<%@ page contentType="text/html;charset=UTF-8" %>
<%@ page import="java.util.Iterator" %>
<%@ page import="java.util.Collection" %>
<%@ page import="net.sz600.basicdata.*" %>
<%@ page import="net.sz600.tool.SzConvert" %>
<%@ page import="net.sz600.database.SzPageInfo" %>
<%@ page import="net.sz600.system.SzProperties" %>
<%@ page import="net.sz600.system.SzLevelNumber" %>
<%@ page import="net.sz600.system.SzPageHelp" %>
<%@ page import="net.sz600.docEngine.*" %>
<%@ include file="/sessionInfo.jsp"%>
<%@ include file="/docEngine/docEngineSession.jsp"%>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link href="<%=strSkin_SESSION%>/css2007.css" rel="stylesheet" type="text/css">
</head>
<BASE target="_self">
<%
    boolean canAdd_SESSION = false;
    boolean canPrint_SESSION = false;
    boolean canDelete_SESSION = false;
    boolean canUpdate_SESSION = false;
    //固定为管理资料
    //szModuleInfo_SESSION.setMKSX(1);
    String strName = "";
    if (docEngineInfo.getModulePopedom().equals("1")) {
    	szModuleInfo_SESSION.setMKSX(1);
    	strName = "(归档文件)";
    } else if (docEngineInfo.getModulePopedom().equals("0")) {
    	szModuleInfo_SESSION.setMKSX(0);
    	strName = "(个人归档文件)";
    }
    //管理资料，只有管理员和有权限的人才能添加。有权限的人员可以查看、修改、删除。
    
    if (isBarManager_SESSION || docEngineInfo.getModulePopedom().equals("0") ) {
      canAdd_SESSION = true;
      canPrint_SESSION = true;
      canDelete_SESSION = true;
      canUpdate_SESSION = true;
    } else {
      canAdd_SESSION = szPopedom_SESSION.isModuleCanAdd(szModuleInfo_SESSION.getMKID(), szLoginInfo_SESSION.getDLID());
      canPrint_SESSION = szPopedom_SESSION.isModuleCanPrint(szModuleInfo_SESSION.getMKID(), szLoginInfo_SESSION.getDLID());
      canDelete_SESSION = false;
      canUpdate_SESSION = false;
    }
    String sKEY = SzConvert.toZeroStr(request.getParameter("InfoID"));
    String sFormID = SzConvert.toZeroStr(request.getParameter("FormID"));    
    
    //获取提交的参数
    String sType = SzConvert.toZeroStr(request.getParameter("type"));
    String sPKEY = SzConvert.toZeroStr(request.getParameter("PKEY"));
    String sPage = SzConvert.toZeroStr(request.getParameter("page"));
    String sSearch = SzConvert.strWriteData(request.getParameter("txtSearch"));
    String sSearchName = SzConvert.strWriteData(request.getParameter("txtSearchName"));

    String sTable_type = "";
    //读取数据
    WdyqType wdyqType = new WdyqType(moduleId);
    WdyqTypeInfo wdyqTypeInfo = null;
    String sCond = "1=1";
    if (docEngineInfo.getModulePopedom().equals("0")) {
    	sCond = "FLDLID=" + szDLID_SESSION;
    }

    String sSortField = SzConvert.toSpaceStr(request.getParameter("txtSortField"));
    int iSortOrder    = Integer.parseInt(SzConvert.toZeroStr(request.getParameter("txtSortOrder")));
    if (sSortField.equals("")) {
    	sSortField = "FLBH";
    	iSortOrder = SzProperties.I_SortOrder_ASC;
    }
    int iCurrentPage = 1;
    try {
        iCurrentPage =  Integer.parseInt(sPage);
    }catch(Exception e) {
    }

    //Iterator iter = wdyqType.getArrayList(sCond, sSortField, iSortOrder, iCurrentPage, sSearch).iterator();
    Collection collType = wdyqType.getArrayList(sCond, sSortField, iSortOrder, sSearch);
    Iterator iter = null;
    int iSize = 0;
    if (collType != null) {
    	iSize = collType.size();
    	iter = collType.iterator();
    }
    SzPageInfo pageInfo = wdyqType.getPageInfo();
    int iPageCount = pageInfo.getPageCount();
    int iRecordCount = pageInfo.getRecordCount();
    iCurrentPage = pageInfo.getCurrentPage();
    int i = 0;
%>
<body>
  <form name="formList" method="post">
<!-----上面的工具栏------>
<%@ include file="title.jsp"%>
<table width="100%">

  <input type="hidden" name="page" value="<%=sPage%>">
  <input type="hidden" name="type" value="<%=sType%>">
  <input type="hidden" name="txtSearch" value="<%=sSearch%>">
  <input type="hidden" name="txtSortField" value="<%=sSortField%>">
  <input type="hidden" name="txtSortOrder" value="<%=iSortOrder%>">
  <input type="hidden" name="KEY" value="<%=sKEY%>">
  <input type="hidden" name="FormID" value="<%=sFormID%>">  
  <tr>
    <td><b>归档文件分类选择<%=strName%></b>
      <%
      if (iSize > 0) {
      	out.println(SzPageHelp.button("确定","javascript:FormSubmitConfirm(formList, 'control.jsp?OPERATOR=save', '确定要归档？');"));
      }
      %>
      
      <%=SzPageHelp.closeButton()%>
    </td>
  </tr>
</table>

<!-----信息列表----->
<table width="100%" border="1" bordercolorlight="#C0C0C0" bordercolordark="#FFFFFF" class="tableClass" cellpadding="1" cellspacing="0">

  <input type="hidden" name="page" value="<%=iCurrentPage%>">
  <input type="hidden" name="txtSearch" value="<%=sSearch%>">
  <input type="hidden" name="type" value="<%=sType%>">
  <input type="hidden" name="txtSortField" value="<%=sSortField%>">
  <input type="hidden" name="txtSortOrder" value="<%=iSortOrder%>">
  <input type="hidden" name="KEY" value="<%=sKEY%>">
  <input type="hidden" name="FormID" value="<%=sFormID%>">    
  <tr class="trClassTitle">
    <td width="5"><input type="checkbox" name="chkCheckAll" OnClick="javascript:CheckAll(formList, chkCheckAll, 'chkId');"></td>
    <td><%=SzPageHelp.sortTitle("分类名称", "FLMC", sSortField, iSortOrder)%></td>
  </tr>
<%
    while (iter != null && iter.hasNext()) {
        wdyqTypeInfo = (WdyqTypeInfo)iter.next();
        i++;
%>
  <tr>
    <td width="5" title="<%=i%>"><input type="checkbox" name="chkId" id="chkId" value="<%=wdyqTypeInfo.getFLID()%>"></td>
    <td><%=SzLevelNumber.getLevelSpace(wdyqTypeInfo.getFLBH())%><%=wdyqTypeInfo.getFLMC()%>&nbsp;</td>
  </tr>
<%
    }
    out.println(SzPageHelp.outIndexTableTr(i, SzProperties.I_PageSize, 2));
%>

  
</table>
</form>
<!-----下面的工具栏------>
<table width="100%">
  <form name="formPage" method="post">
  <input type="hidden" name="type" value="<%=sType%>">
  <input type="hidden" name="txtSearchName" value="<%=sSearchName%>">
  <input type="hidden" name="txtSortField" value="<%=sSortField%>">
  <input type="hidden" name="txtSortOrder" value="<%=iSortOrder%>">
  <tr>
    <td align="right">
      <%@ include file="/share/page/search_include.jsp"%>
    </td>
  </tr>
  </form>
</table>

<!-----这里包含要提交的内容--->
<form name="formHidden" method="post">
  <input type="hidden" name="type" value="<%=sType%>">
  <input type="hidden" name="page" value="<%=iCurrentPage%>">
  <input type="hidden" name="txtSearch" value="<%=sSearch%>">
  <input type="hidden" name="txtSortField" value="<%=sSortField%>">
  <input type="hidden" name="txtSortOrder" value="<%=iSortOrder%>">
</form>
<script language="javascript">

  function FormSave(formName, url) {
    formName.action = url;
    formName.submit();
  }

</script>
<script language="javascript" src="../../share/js/commonTool.js"></script>
</body>
