<%@ page contentType="text/html;charset=gbk" %>
<%@ page import="java.util.*" %>
<%@ page import="net.sz600.database.*" %>
<%@ page import="net.sz600.tool.*" %>
<%@ page import="net.sz600.formEngine2.*" %>
<%@ include file="/sessionInfo.jsp"%>
<head>
<BASE target=_self>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=GBK">
<link href="<%=strSkin_SESSION%>/css2007.css" rel="stylesheet" type="text/css">
</head>
<%
 	int iCount = SzConvert.toInt(request.getParameter("fileCount"));
	if (iCount <= 0) {
		iCount = 10;
	}
	String strName = SzConvert.strWriteData(request.getParameter("fileName"));
	String strDir = SzConvert.strWriteData(request.getParameter("dirName"));	
	BdForm bdForm = new BdForm();
	ArrayList list  = bdForm.getHistoryList(iCount, strDir, strName);	
	int iLen = list.size();
%>
<!-----上面的工具栏------>
<form name="formUpdate" method="post" action="control.jsp">
  <input type="hidden" name="OPERATOR" value="">


<!-----信息维护------>
<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="3">
    	显示的文件数量：<input type="text" class="txtClass60" name="fileCount" value="<%=iCount %>">
    	时间检索：<input type="text" class="txtClass120" name="dirName" value="<%=strDir%>">
    	文件名检索：<input type="text" class="txtClass80" name="fileName" value="<%=strName%>">
    	<input type="button" class="btnClass" value="确定" OnClick="javascript:SearchOk();";>
    	<%=SzPageHelp.closeButton() %>
    	<br>
    	
    </td>
  </tr>  
  <tr class="trClassTitle">
    <td>时间</td>
    <td>文件</td>
    <td>操作</td>
  </tr>
  <%
    String s[] = null;
    String sName = "";
  	String sDir = "";
  	for (int i = iLen -1; i>=0; i--) {
  		s = (String[])list.get(i);
  		sDir = s[0];
  		sName = s[1];
  %>
  <tr>
    <td><%=sDir %></td>
    <td><%=sName %></td>
    <td>
    <input type="button" class="btnClass" value="删除" OnClick="javascript:Delete('<%=sDir %>');" <%if (i > iLen -5) { out.println("disabled");} %>>    
    <input type="button" class="btnClass" value="还原" OnClick="javascript:StoreUp('<%=sDir %>','<%=sName %>');">
    </td>
  </tr>  
  <%  		
  	}
  %>
</table>

</form>

<script language="javascript">
  //第一个表示对象，form，第二个表示字符串
  function FormSubmit(oFormName, vUrl) {
    oFormName.action = vUrl;
    oFormName.submit();
  }
</script>
<script language="javascript">
  function SearchOk() {
  	formUpdate.action = "index.jsp";
  	formUpdate.submit();  
  }
  
  function Delete(sFile) {
    if (confirm("确定删除已经备份的文件?")) {    
  	  formUpdate.OPERATOR.value = "deleteHistory";
  	  formUpdate.action = "formHistoryControl.jsp?dirName=" + sFile;
  	  formUpdate.submit();
  	}	
  }

  function StoreUp(sDir, sFile) {
    if (confirm("确定还原?")) {    
  	  formUpdate.OPERATOR.value = "storeHistory";
  	  formUpdate.action = "formHistoryControl.jsp?dirName=" + sDir + "&fileName=" + sFile;
  	  formUpdate.submit();
  	}	
  }
  
</script>