<%@ page contentType="text/html;charset=UTF-8" %>
<%@ page import="java.util.Iterator" %>
<%@ page import="net.sz600.basicdata.*" %>
<%@ page import="net.sz600.tool.SzConvert" %>
<%@ page import="net.sz600.database.SzPageInfo" %>
<%@ page import="net.sz600.system.*" %>
<%@ page import="net.sz600.mail.*" %>
<%@ include file="/sessionInfo.jsp"%>
<head>
<title></title>
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Cache-Control" CONTENT="no-cache">
<META HTTP-EQUIV="Expires" CONTENT="0">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link href="<%=strSkin_SESSION%>/css2007.css" rel="stylesheet" type="text/css">
</head>
<%
		String sSearchName = SzConvert.strWriteData(request.getParameter("txtSearchName"));
		String sSearchTitle = SzConvert.strWriteData(request.getParameter("txtSearchTitle"));
		String sSearchBegin = SzConvert.strWriteData(request.getParameter("txtSearchBegin"));
		String sSearchEnd = SzConvert.strWriteData(request.getParameter("txtSearchEnd")); 

    //获取提交的参数
    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 sTable_type = "";
    //读取数据
    YjMailNew yjMail = new YjMailNew();
    YjMailInfo yjMailInfo = null;
    //String sCond = yjMail.genCond(sType, iDLID_SESSION, iBMID_SESSION);
    String sSortField = SzConvert.toSpaceStr(request.getParameter("txtSortField")); 
    int iSortOrder    = Integer.parseInt(SzConvert.toZeroStr(request.getParameter("txtSortOrder"))); 
    if (sSortField.equals("")) { 
    	sSortField = "JSID";
    	iSortOrder = SzProperties.I_SortOrder_DESC;
    } 
    int iCurrentPage = 1;
    try {
        iCurrentPage =  Integer.parseInt(sPage);
    }catch(Exception e) {
    }
    String sCond = yjMail.genManagerCond(sSearchBegin, sSearchEnd, sSearchName, sSearchTitle);
    Iterator iter = yjMail.getArrayList(sCond, sSortField, iSortOrder, iCurrentPage, sSearch).iterator();

    SzPageInfo pageInfo = yjMail.getPageInfo();
    int iPageCount = pageInfo.getPageCount();
    int iRecordCount = pageInfo.getRecordCount();
    iCurrentPage = pageInfo.getCurrentPage();
    int i = 0;
    
    SzAnnex szAnnex = new SzAnnex(yjMail.strAnnexTable);
%>
<!-----上面的工具栏------>
<%@ include file="/share/title.jsp"%>
<table width="100%">
  <form name="formBar" method="post">
  <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%>"> 
  <tr>
    <td>
      发送时间<input type="text" name="txtSearchBegin" class="txtClassSearch" value="<%=sSearchBegin%>" readonly><%=SzPageHelp.calendar2Select1("formBar.txtSearchBegin")%>
      -<input type="text" name="txtSearchEnd" class="txtClassSearch" value="<%=sSearchEnd%>" readonly><%=SzPageHelp.calendar2Select1("formBar.txtSearchEnd")%>
      发送人员<input type="text" name="txtSearchName" class="txtClassSearch" value="<%=sSearchName%>" OnDblClick="javascript:OpenWin32('../','','formBar.txtSearchName');">
		 邮件标题<input type="text" name="txtSearchTitle" class="txtClassSearch" value="<%=sSearchTitle%>">      
     <input class="btnClass" type="button" name="btnSearchNameOk" value="确定" OnClick="javascript:FormSubmit(formBar,'index_manage.jsp');">
    <%
    if (isBarManager_SESSION) {
    	out.println(SzPageHelp.button("彻底删除", "javascript:FormSubmitConfirm(formList, 'delete.jsp?OPERATOR=deleteManager', '这些是别人的邮件，您确定要删除？');"));
    }
    %>
    </td>
  </tr>
  </form>
</table>

<!-----信息列表----->
<table width="100%" border="1" bordercolorlight="#C0C0C0" bordercolordark="#FFFFFF" class="tableClass" cellpadding="1" cellspacing="0">
  <form name="formList" method="post">
  <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="txtSearchBegin" value="<%=sSearchBegin%>">
	<input type="hidden" name="txtSearchEnd" value="<%=sSearchEnd%>">  
  <input type="hidden" name="txtSearchName" value="<%=sSearchName%>">
  <input type="hidden" name="txtSearchTitle" value="<%=sSearchTitle%>">  
     
  <tr class="trClassTitle">
    <td width="5"><input type="checkbox" name="chkCheckAll" OnClick="javascript:CheckAll(formList, chkCheckAll, 'chkId');"></td>
    <td width="10"  nowrap>&nbsp;</td>
    <td width="10"  nowrap>&nbsp;</td>
    <td>文件夹</td>
    <td width="120"><%=SzPageHelp.sortTitle("发送人员", "FSDLXM", sSortField, iSortOrder, strLevel_SESSION)%>
    <%=SzPageHelp.sortTitle("邮件", "FSYJDZ", sSortField, iSortOrder, strLevel_SESSION)%></td>
    <td width="120"><%=SzPageHelp.sortTitle("收件人员", "JSDLXM", sSortField, iSortOrder, strLevel_SESSION)%>
    <%=SzPageHelp.sortTitle("邮件", "JSYJDZ", sSortField, iSortOrder, strLevel_SESSION)%></td>
    <td><%=SzPageHelp.sortTitle("邮件标题", "FSBT", sSortField, iSortOrder, strLevel_SESSION)%></td>
    <td width="120"><%=SzPageHelp.sortTitle("发送时间", "FSSJ", sSortField, iSortOrder, strLevel_SESSION)%></td>
    <td width="40">操作</td>
  </tr>
<%
    while (iter != null && iter.hasNext()) {
        yjMailInfo = (YjMailInfo)iter.next();
        i++;
%>
  <tr  onMouseOver="javascript:this.className='trMouseOver'" onMouseOut="javascript:this.className='trMouseOut'">
    <td width="5" title="<%=i%>"><input type="checkbox" name="chkId" id="chkId" value="<%=yjMailInfo.getJSID()%>"></td>
    <td width="10" align="center">
     <%=yjMail.getStateImage(yjMailInfo.getYJYD(), yjMailInfo.getYJBZ())%>
    </td>
    <td width="10" align="center">
     <%=SzPageHelp.annexImage(strSkin_SESSION, szAnnex.hasAnnex(yjMailInfo.getFSID())) %>
    </td>
    <td width="45"><%=yjMail.getFoldName(yjMailInfo.getYJWJJ())%></td>    
    <td><%=yjMailInfo.getFSDLXM()%>&nbsp;<%=yjMailInfo.getFSYJDZ()%>&nbsp;</td>
    <td><%=yjMailInfo.getJSDLXM()%>&nbsp;<%=yjMailInfo.getJSYJDZ()%>&nbsp;<%=yjMail.getForeignMailStateName(yjMailInfo) %></td>
    <td><%=yjMail.getTargImage(yjMailInfo.getYJBLZT())%>
        <a href="javascript:FormSubmit(formPage,'detail.jsp?OPERATOR=manage&type=<%=sType%>&KEY=<%=yjMailInfo.getJSID()%>');">
        <%=yjMailInfo.getFSBT()%></a>&nbsp;</td>
    <td><%=yjMailInfo.getFSSJ()%>&nbsp;</td>
    <td>
      <a href="javascript:FormSubmit(formPage,'detail.jsp?OPERATOR=manage&type=<%=sType%>&KEY=<%=yjMailInfo.getJSID()%>');">详情</a>
    </td>
  </tr>
<%
    }
    out.println(SzPageHelp.outIndexTableTr(i, SzProperties.I_PageSize, 9));
%>

  </form>
</table>

<!-----下面的工具栏------>
<table width="100%">
  <form name="formPage" method="post">
  <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="txtSearchBegin" value="<%=sSearchBegin%>">
	<input type="hidden" name="txtSearchEnd" value="<%=sSearchEnd%>">  
  <input type="hidden" name="txtSearchName" value="<%=sSearchName%>">
  <input type="hidden" name="txtSearchTitle" value="<%=sSearchTitle%>">    
  <tr>
    <td align="right">
      <%@ include file="/share/page/page_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%>"> 
  
	<input type="hidden" name="txtSearchBegin" value="<%=sSearchBegin%>">
	<input type="hidden" name="txtSearchEnd" value="<%=sSearchEnd%>">  
  <input type="hidden" name="txtSearchName" value="<%=sSearchName%>">
  <input type="hidden" name="txtSearchTitle" value="<%=sSearchTitle%>">    
</form>
<script language="javascript" src="../share/js/commonTool.js"></script>
<script language="javascript">

  function move() {      
    var vDir = formBar.dir.value;
    if (vDir == "") {
		return;
    }
    formList.action = "delete.jsp?OPERATOR=move&dir=" + vDir;
    formList.submit();
  }
  
  function setTarg() {      
    var vDir = formBar.targ.value;
    if (vDir == "") {
		return;
    }
    formList.action = "delete.jsp?OPERATOR=targ&dir=" + vDir;
    formList.submit();
  }  
  
</script>
<%
    ////如果要使用日历控件，必须输出这个calendarFrame
    out.println(SzPageHelp.calendar2Frame1());
%>
