<!--#
##
#	Project: PHPDISK File Storage Solution
#	This is NOT a freeware, use is subject to license terms.
#
#	Site: http://www.phpdisk.com
#
#	$Id: database.tpl.html 25 2011-03-04 07:36:51Z along $
#
#	Copyright (C) 2008-2011 PHPDisk Team. All Rights Reserved.
#
##
#-->
<!--#if($action =='backup' || $action =='optimize'){#-->
<div id="container">
<!--#if($action =='backup'){#-->
<h1>{$L['backup_database']}<!--#sitemap_tag($L['backup_database']);#--></h1>
<div>
<div class="tips_box"><b>{$L['tips']}: </b><br />
<ul>
	<li><img class="img_light" src="images/light.gif" align="absmiddle"> <span class="txtgray">{$L['backup_database_tips']}</span></li>
	<li><img class="img_light" src="images/light.gif" align="absmiddle"> <span class="txtgray">{$L['backup_database_tips2']}</span></li>
</ul>
</div>
<!--#}else{#-->
<h1>{$L['optimize_database']}<!--#sitemap_tag($L['optimize_database']);#--></h1>
<div>
<div class="tips_box"><b>{$L['tips']}: </b><img class="img_light" src="images/light.gif" align="absmiddle"> <span class="txtgray">{$L['optimize_database_tips']}</span>
</div>
<!--#}#-->
<form method="post" name="myform" action="{#urr("admincp","item=database")#}" onsubmit="return dosubmit(this);">
<input type="hidden" name="action" value="backup" />
<input type="hidden" name="task" value="backup" />
<table align="center" width="100%" cellpadding="0" cellspacing="0" id="db_table" class="td_line">
<tr>
	<td class="bold" width="40%">&nbsp;&nbsp;&nbsp;&nbsp;{$L['name']}</td>
	<td class="bold" width="100">{$L['engine']}</td>
	<td class="bold" width="100" align="center">{$L['rows']}</td>
	<td class="bold" width="100" align="center">{$L['index_length']}</td>
	<td class="bold" width="100" align="center">{$L['data_free']}</td>
	<td class="bold" width="100" align="right">{$L['data_length']}</td>
</tr>
<!--#
if(count($table_arr)){
	foreach($table_arr as $k => $v){
		$color = ($k%2 ==0) ? 'color1' :'color4';
		$index_size += $v['Index_length'];
		$data_size += $v['Data_length'];
		$table_size += $v['Data_length']+$v['Index_length'];
		$v['Data_free'] = $v['Data_free'] ? "<span class='txtred bold'>".$v['Data_free']."</span>" : $v['Data_free'];
#-->
<tr class="{$color}">
    <td><input type="checkbox" name="tables[]" value="{$v['Name']}" checked />{$v['Name']}</td>
    <td>{$v['Engine']}</td>
    <td align="center">{$v['Rows']}</td>
    <td align="center">{#get_size($v['Index_length'])#}</td>
    <td align="center">{$v['Data_free']}</td>
    <td align="right">{#get_size($v['Data_length'])#}</td>
</tr>
<!--#
	}
}
unset($table_arr);
#-->
<tr>
	<td colspan="6" height="50"><input name='chkall' type='checkbox' id='chkall' onclick='checkall(this.form)' value='check' checked><label for="chkall">{$L['sel_all']}</label>&nbsp;&nbsp;
	<span class="txtred">({$L['index_size']}:{#get_size($index_size)#} {$L['data_size']}:{#get_size($data_size)#},{$L['all']}:{#get_size($table_size)#})</span>&nbsp;&nbsp;
	<!--#if($action =='backup'){#-->
	{$L['one_sql_file']}<input type="text" name="sizelimit" value="2048" size="5"/> K <input type="submit" class="btn" value="{$L['btn_run_backup']}" />&nbsp;&nbsp;
	<!--#}else{#-->
	<input type="button" class="btn" value="{$L['run_optimize']}" onClick="go('{#urr("admincp","item=database&action=$action&task=optimize")#}');"/>
	<!--#}#-->
	</td>
</tr>
</table>
</form>
<script type="text/javascript">
function dosubmit(o){
	if(checkbox_ids("tables[]") != true){
		alert("{$L['please_select_operation_tables']}");
		return false;
	}

}
function checkall(form) {
	for(var i = 0;i < form.elements.length; i++) {
		var e = form.elements[i];
		if (e.name != 'chkall' && e.disabled != true) {
			e.checked = form.chkall.checked;
		}
	}
}
</script>
</div>
</div>
<!--#}elseif($action =='restore'){#-->
<div id="container">
<h1>{$L['restore_database']}<!--#sitemap_tag($L['restore_database']);#--></h1>
<div>
<div class="tips_box"><b>{$L['tips']}: </b>
<ul>
	<li><img class="img_light" src="images/light.gif" align="absmiddle"> <span class="txtgray">{$L['restore_database_tips']}</span></li>
	<li><img class="img_light" src="images/light.gif" align="absmiddle"> <span class="txtgray">{$L['restore_database_tips2']}</span></li>
	<li><img class="img_light" src="images/light.gif" align="absmiddle"> <span class="txtgray">{$L['restore_database_tips3']}</span></li>
</ul>
</div>
<table align="center" width="100%" cellpadding="0" cellspacing="0" class="td_line">
<!--#
if(count($infos)){
#-->
<tr align="center" class="bold">
	<td width="8%">{$L['sql_order']}</td>
	<td width="30%" >{$L['sql_name']}</td>
	<td width="10%">{$L['sql_size']}</td>
	<td width="20%">{$L['backup_time']}</td>
	<td width="8%">{$L['part_number']}</td>
	<td width="20%">{$L['operation']}</td>
</tr>
<!--#
	foreach($infos as $k => $v){
		$k++;
#-->
  <tr bgcolor="{$v['bgcolor']}"  align="center" onmouseover="this.className='color4'" onmouseout="this.className=''">
    <td>{$k}</td>
    <td>{$v['filename']}</td>
    <td>{$v['filesize']} M</td>
	<td>{$v['maketime']}</td>
    <td>{$v['number']}</td>
    <td>
	<a href="{$v['a_delete']}" onclick="return confirm('{$L['sql_delete_confirm']}');">{$L['sql_file_delete']}</a>&nbsp;&nbsp;
	<a href="{$v['a_restore']}" onclick="return confirm('{$L['sql_restore_confirm']}');">{$L['sql_restore']}</a>
	</td>
</tr>
<!--#
	}
	unset($infos);
}else{
#-->
<tr>
	<td class="f12" colspan="6">{$L['no_backup_database']}</td>
</tr>
<!--#
}
#-->
</table>
</div>
</div>
<!--#}#-->