<%@ page contentType="text/html;charset=gbk" %>
<%@ page import="java.util.*" %>
<%@ page import="net.sz600.database.*" %>
<%@ page import="net.sz600.tool.*" %>
<%@ page import="net.sz600.basicdata.*" %>
<%@ include file="/sessionInfo.jsp"%>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=GBK">
<link href="<%=strSkin_SESSION%>/css2007.css" rel="stylesheet" type="text/css">
</head>
<%

	SzBackUp2 backUp = new SzBackUp2();
	String backDir = backUp.getBackPath();
	
	int iCount = SzConvert.toInt(request.getParameter("fileCount"));
	if (iCount <= 0) {
		iCount = 10;
	}
	String strName = SzConvert.strWriteData(request.getParameter("fileName"));
	ArrayList list  = backUp.getFileList(iCount, backDir, strName);
	int iLen = list.size();
	
 	ReadOaConfig rc = new ReadOaConfig();
 	String backup_value = rc.getBackup_value();
 	String s = "";
 	if (backup_value.equals("1")) {
 		s = "    (自动备份已启动，每天凌晨自动备份，可在“安全配置”里修改自动备份方式)";
 	} else if (backup_value.equals("2")) {
 		s = "    (自动备份已启动，每周一凌晨自动备份，可在“安全配置”里修改自动备份方式)";
 	} else if (backup_value.equals("0")) {
 		s = "    (手动备份，可在“安全配置”里修改自动备份方式)";
 	}
%>
<!-----上面的工具栏------>
<%@ include file="/share/title.jsp"%>
<form name="formUpdate" method="post" action="control.jsp">
  <input type="hidden" name="OPERATOR" value="">
<table width="100%">
  <tr>
    <td>&nbsp;<b>数据库备份信息</b>
    <%=s%>
    </td>
  </tr>
</table>

<!-----信息维护------>
<table width="700" border="1" bordercolorlight="#C0C0C0" bordercolordark="#FFFFFF" class="tableClass" cellpadding="3" cellspacing="0">
  <tr>
    <td width="150" align="right">数据库备份路径（文件夹）</td>
    <td><input type="text" class="txtClass2" name="backDir" value="<%=backDir %>">
    <% if (isSystemManager_SESSION) { %>
    	<input type="button" class="btnClass" value="手动备份"  OnClick="javascript:BackUp();"><br>
    <% } %>
    	<font color="red">系统自动备份到文件夹“<%=backDir %>\年-月-日.bak”下,包括数据库,附件文件</font><br>

    </td>
  </tr>
</table>
<br>
<table width="100%">
  <tr>
    <td>&nbsp;<b>数据库还原信息</b>
    </td>
  </tr>
</table>
<table width="700" border="1" bordercolorlight="#C0C0C0" bordercolordark="#FFFFFF" class="tableClass" cellpadding="3" cellspacing="0">
  <tr>
    <td colspan="2">
    	显示的文件数量：<input type="text" class="txtClass60" name="fileCount" value="<%=iCount %>">
<!--
    	文件名检索：<input type="text" class="txtClass" name="fileName" value="<%=strName%>">
    	<input type="button" class="btnClass" value="确定" OnClick="javascript:SearchOk();";><br>
-->    	
    </td>
  </tr>  
  <tr class="trClassTitle">
    <td>当前文件夹下的备份文件
    </td>
  </tr>
  <%
    String sName = "";
  	for (int i = iLen -1; i>=0; i--) {
  		sName = (String)list.get(i);
  %>
  <tr>
    <td><%=sName %></td>
  </tr>  
  <%  		
  	}
  %>
</table>

</form>

<script language="javascript">
  //第一个表示对象，form，第二个表示字符串
  function FormSubmit(oFormName, vUrl) {

    oFormName.action = vUrl;
    oFormName.submit();
  }
</script>
<script language="javascript">
  function Start() {
  	formUpdate.OPERATOR.value = "start";
  	formUpdate.action = "control2.jsp";
  	formUpdate.submit();
  }

  function Stop() {
  	formUpdate.OPERATOR.value = "stop";
  	formUpdate.action = "control2.jsp";
  	formUpdate.submit();
  }
  
  function BackUp() {
    document.getElementById("divLine").style.display = "block";
  	formUpdate.OPERATOR.value = "backup";
  	formUpdate.action = "control2.jsp";
  	formUpdate.submit();
  }
  
  function SearchOk() {
  	formUpdate.action = "index.jsp";
  	formUpdate.submit();  
  }
  
  function Delete(sFile) {
    if (confirm("确定删除已经备份的文件?")) {    
  	  formUpdate.OPERATOR.value = "delete";
  	  formUpdate.action = "control2.jsp?sFile=" + sFile;
  	  formUpdate.submit();
  	}	
  }

  function StoreUp(sFile) {
    if (confirm("确定还原?")) {    
  	  formUpdate.OPERATOR.value = "store";
  	  formUpdate.action = "control2.jsp?sFile=" + sFile;
  	  formUpdate.submit();
  	}	
  }
  
  function FormSave(formName, url) {
    //检查是否可以保存
    if (formName.szDLMM.value != formName.DLMM.value) {
      formName.DLMM.focus();
      alert("原始密码不正确，请重新输入");
      return false;
    }
    if (formName.DLMM1.value != formName.DLMM2.value) {
      formName.DLMM1.focus();
      alert("新的密码和确认密码不一样，请重新输入");
      return false;
    }
    //提交
    formName.action = url;
    formName.submit();
  }
</script>
<div id="divLine" class="divLine" align="center" style="position:absolute;width:450;height:150px;left:150px;top:150px;padding:60px 0 0 0; margin:0px;overflow:auto;overflow:hidden;display:none; background-color:#dbdbdb;">
	<img src="<%=strSkin_SESSION%>/bar.gif">
</div><!---------------------------------------------------------------20120112 ting----------------------------------------->
