<link href="styles/general.css" rel="stylesheet" type="text/css" />
<link href="styles/main.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="js/utils.js"></script>
<body>
<h1>
<span class="action-span"><a href="?ctl=data&act=data_back"><tpl>$data_backup</tpl><!--数据库备份--></a></span>
<span class="action-span1"><a href="?ctl=index&act=admin_main"><tpl>$common_admin_index</tpl><!--管理首页--></a> >> <tpl>$data_revert</tpl><!--数据库还原--></span>
<div style="clear:both"></div>
</h1>
<div class="list-div" id="listDiv">
<form name="form1" id="form1" method="post" action="index.php?ctl=data&act=sql_del">
<table width="100%" cellspacing="1" cellpadding="2" id="list-table">
  <tr>
    <th width=60 align="right"><input type="checkbox" name="chkall" onClick="checkall(this.form, 'file[]')"><tpl>$data_import_file_del</tpl><!--删除--></th>
    <th width="313"><tpl>$data_import_file_name</tpl><!--sql备份文件名--></th>
    <th width="209"><tpl>$data_import_file_time</tpl><!--时间--></th>
    <th width="110"><tpl>$data_import_file_size</tpl><!--大小--></th>
    <th width="62"><tpl>$data_import_file_vol</tpl><!--卷标--></th>
    <th width="199"><tpl>$data_import_oper</tpl><!--操作--></th>
  </tr>
  <tpl>foreach $array as $list</tpl>
  <tr <tpl>if $list['mark']==2</tpl> style="display:none"<tpl>/if</tpl>>
   <td><input type="checkbox" name="file[]" value="<tpl>$list['name']</tpl>" /></td>
   <td><tpl>if $list['mark']==1</tpl><img src="images/menu_plus.gif" onClick="rowClicked(this)"><tpl>/if</tpl><tpl>if $list['mark']==2</tpl><img src="images/menu_arrow.gif"><tpl>/if</tpl><a href="../data/databack/<tpl>$list['name']</tpl>"><tpl>$list['name']</tpl></a></td>
   <td><tpl>$list['add_time']</tpl></td>
   <td><tpl>$list['file_size']</tpl></td>
   <td><tpl>$list['vol']</tpl></td>
   <td align="center"><tpl>if $list['mark']==1 or $list['mark']==0</tpl><a href="?ctl=data&act=run_data_import&file_name=<tpl>$list['name']</tpl>"><tpl>$data_import</tpl><!--导入--></a><tpl>else</tpl>&nbsp;<tpl>/if</tpl></td>
  </tr>
  <tpl>/foreach</tpl>
  <tr>
    <td colspan=7 align="left"><input type="submit" value="<tpl>$data_import_file_del</tpl>" class="button" />
  </tr>
</table>
</form>
</div>
<div id="footer">
<tpl>$common_copyright</tpl>
</div>
</body>
<script type="text/javascript">
function checkall(frm, chk)
{
    for (i = 0; i < frm.elements.length; i++)
    {
        if (frm.elements[i].name == chk)
        {
            frm.elements[i].checked = frm.elements['chkall'].checked;
        }
    }
}

function rowClicked(obj)
{
  var row = obj.parentNode.parentNode;
  var tbl = row.parentNode.parentNode;
  var test = false;
  var img = '';

  if (obj.src.substr(obj.src.lastIndexOf('/') + 1) == "menu_minus.gif")
  obj.src = "images/menu_plus.gif";
  else
  obj.src = "images/menu_minus.gif";



  for (i = 0; i < tbl.rows.length; i++)
  {
    var cell = tbl.rows[i].cells[1];

    if (cell && cell.childNodes[0].src)
    {
      img = cell.childNodes[0].src.substr(cell.childNodes[0].src.lastIndexOf('/') + 1);
    }
    else
    {
      img = '';
    }

    if (test && img)
    {
      if (img == "menu_arrow.gif")
      {
        tbl.rows[i].style.display = tbl.rows[i].style.display != 'none' ? 'none' : (Browser.isIE) ? 'block' : 'table-row';
      }
      else
      {
        test=false;
      }
    }

    if (tbl.rows[i] == row)
    {
      test = true;
    }
  }
 }
</script>