You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

161 lines
4.8 KiB

3 years ago
<!-- $Id: convert_main.htm 14216 2008-03-10 02:27:21Z testyang $ -->
{include file="pageheader.htm"}
<div class="list-div">
<form name="theForm">
<table cellpadding="0" cellspacing="0">
<tr>
<td colspan="4"><span style="color:#FF0000;"><strong>{$lang.confirm_convert}</strong></span><br />
{$lang.backup_data}<a href="database.php?act=backup"><strong>{$lang.backup}</strong></a></td>
</tr>
<tr>
<td colspan="4">{$lang.select_system}
<select name="selModule" id="selModule">
{foreach from=$module_list item=module}
<option value="{$module.code}">{$module.desc}</option>
{/foreach}
</select>
{$lang.note_select_system}</td>
</tr>
<tr>
<td colspan="4">{$lang.select_charset}
<select name="selCharset" id="selCharset">
{html_options options=$charset_list}
</select>
{$lang.note_select_charset}</td>
</tr>
<tr>
<td colspan="4"><strong>{$lang.your_config}</strong><br />{$lang.dir_notes}</td>
</tr>
<tr>
<td><div align="right"><strong>{$lang.your_host}</strong></div></td>
<td><input name="host" type="text" id="host" value="{$def_val.host}" /></td>
<td><div align="right"><strong>{$lang.your_db}</strong></div></td>
<td><input name="db" type="text" id="db" value="{$def_val.db}" /></td>
</tr>
<tr>
<td><div align="right"><strong>{$lang.your_user}</strong></div></td>
<td><input name="user" type="text" id="user" value="{$def_val.user}" /></td>
<td><div align="right"><strong>{$lang.your_pass}</strong></div></td>
<td><input name="pass" type="password" id="pass" value="{$def_val.pass}" /></td>
</tr>
<tr>
<td><div align="right"><strong>{$lang.your_prefix}</strong></div></td>
<td><input name="prefix" type="text" id="prefix" value="{$def_val.prefix}" /></td>
<td><div align="right"><strong>{$lang.your_path}</strong></div></td>
<td><input name="path" type="text" id="path" value="{$def_val.path}" /></td>
</tr>
<tr>
<td colspan="4"><div align="center">
<input name="convert" type="button" class="button" id="convert" onclick="convertData()" value="{$lang.convert}" />
</div></td>
</tr>
<tr>
<td colspan="4"><span id="status_1"></span><br /><span id="status_2"></span><br /><span id="status_3"></span></td>
</tr>
<tr>
<td colspan="4"><strong>{$lang.remark}</strong><br />{$lang.remark_info}</td>
</tr>
</table>
</form>
</div>
{insert_scripts files="../js/utils.js,validator.js"}
{literal}
<script language="javascript">
/**
* 检查可选系统
*/
function checkSystem()
{
var sel = document.forms['theForm'].elements['selModule'];
if (sel.options.length <= 0)
{
alert(no_system);
return false;
}
return true;
}
/**
* 检查设置
*/
function checkConfig()
{
if (!checkSystem())
{
return false;
}
var validator = new Validator('theForm');
validator.required('host', host_not_null);
validator.required('db', db_not_null);
validator.required('user', user_not_null);
validator.required('path', path_not_null);
return validator.passed();
}
/**
* 转换
*/
function convertData()
{
// 检查设置
if (!checkConfig())
{
return;
}
// 取得设置
var config = new Object();
var ele = document.forms['theForm'].elements;
config.host = ele['host'].value;
config.db = ele['db'].value;
config.user = ele['user'].value;
config.pass = ele['pass'].value;
config.prefix = ele['prefix'].value;
config.code = ele['selModule'].value;
config.path = ele['path'].value;
config.charset = ele['selCharset'].value;
// 测试数据库链接,检查表,检查目录
output(check_your_db);
Ajax.call('convert.php?is_ajax=1&act=check', config, response, 'POST', 'JSON');
}
function response(result)
{
if (!result.error)
{
if (result.content.length > 0)
{
output(result.message);
Ajax.call('convert.php?is_ajax=1&act=process', 'step=' + result.content, response, 'POST', 'JSON');
}
else
{
output(act_ok);
alert(act_ok);
}
}
else
{
output(result.message);
alert(result.message);
}
}
/**
* 输出信息
* @param string msg
*/
function output(msg)
{
today = new Date();
msg = today.getHours() + ':' + today.getMinutes() + ':' + today.getSeconds() + ' ' + msg;
for (i = 3; i > 1; i--)
{
document.getElementById('status_' + i).innerHTML = document.getElementById('status_' + (i - 1)).innerHTML;
}
document.getElementById('status_1').innerHTML = msg;
}
</script>
{/literal}
3 years ago
{include file="pagefooter.htm"}