<%@ 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.SzProperties" %>
<%@ page import="net.sz600.system.SzLevelNumber" %>
<%@ page import="net.sz600.system.SzPageHelp" %>
<%@ page import="net.sz600.system.*" %>
<%@ page import="net.sz600.mail.*" %>
<%@ include file="/sessionInfoWeixin.jsp"%>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimum-scale=1.0, maximum-scale=1.0" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="format-detection" content="telephone=no" />
<%@ include file="/share/oa_app_title.jsp"%>
 <link href="<%=strLevel_SESSION%>app/images/soarwell_css.css" rel="stylesheet" type="text/css" />
 <script type="text/javascript" src="<%=strLevel_SESSION%>share/js/commonTool.js"></script>
</head>
<%
    //获取提交的参数
    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 = "";
    //读取数据
    YjMailNew yjMail = new YjMailNew();
    YjMailInfo yjMailInfo = null;

    String sSortField = SzConvert.toSpaceStr(request.getParameter("txtSortField")); 
    int iSortOrder    = Integer.parseInt(SzConvert.toZeroStr(request.getParameter("txtSortOrder"))); 
    if (sSortField.equals("")) { 
    	sSortField = "FSID";
    	iSortOrder = SzProperties.I_SortOrder_DESC;
    } 
    int iCurrentPage = 1;
    try {
        iCurrentPage =  Integer.parseInt(sPage);
    }catch(Exception e) {
    }
    
    int iPageSize = SzProperties.I_PageSize_APP;
    String sCond = yjMail.genSendCond(sType, iDLID_SESSION, "", "", "", "");    
    Iterator iter = yjMail.getArrayList(sCond, sSortField, iSortOrder, iCurrentPage, iPageSize, 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="/app/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>
      <%=SzPageHelp.button("写邮件", "javascript:FormSubmit(formBar, 'update.jsp?OPERATOR=add&KEY=0');")%>
      <%=SzPageHelp.button("彻底删除", "javascript:FormSubmitConfirm(formList, 'delete.jsp?OPERATOR=delete', '确定要删除？');")%>
    </td>
  </tr>
  </form>
</table>

<!-----信息列表----->
<table width="100%" border="0" cellspacing="3" cellpadding="3" style="border:#D7D7D9 1px solid;">
  <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%>"> 
<%
    while (iter != null && iter.hasNext()) {
        yjMailInfo = (YjMailInfo)iter.next();
        i++;
%>
<%
	if (i>1) {
%>
  <tr>
    <td height="8" align="left" background="../images/line.gif"></td>
  </tr> 
<% } %>  
  <tr>
    <td><span class="product_name"><%=i%></span>
    <input type="checkbox" name="chkId" id="chkId" value="<%=yjMailInfo.getJSID()%>">
    <%=yjMail.getStateImage(strLevel_SESSION, yjMailInfo.getYJYD(), yjMailInfo.getYJBZ(), yjMailInfo.getYJZFBZ())%>
    <%=SzPageHelp.annexImage(strSkin_SESSION, szAnnex.hasAnnex(yjMailInfo.getFSID())) %>
    <%=yjMail.getTargImage(strLevel_SESSION, yjMailInfo.getYJBLZT())%>
    <% if (sType.equals("1")) { %>
      <a href="javascript:FormSubmit(formPage,'update.jsp?OPERATOR=update&type=<%=sType%>&KEY=<%=yjMailInfo.getJSID()%>');">发送</a>
    <% } %>       
  	</td>
  </tr> 
  <tr>  
    <td><span class="product_content"><a href="#" OnClick="javascript:FormSubmit(formPage,'detail.jsp?OPERATOR=detail&type=0&KEY=<%=yjMailInfo.getJSID()%>');">
        <b>[邮件标题]</b><%=yjMailInfo.getFSBT()%>&nbsp;
        </a></span>
    </td>
  </tr>  
  <tr>
  	<td><span class="product_content"><b>[收件人员]</b><%=yjMailInfo.getJSDLXM()%></span></td>
  </tr>  
  <tr>
  	<td><span class="product_content"><b>[收件人邮件]</b><%=yjMailInfo.getJSYJDZ()%></span></td>
  </tr>      

  <tr>
  	<td><span class="product_content"><b>[发送时间]</b><%=yjMailInfo.getFSSJ()%></span></td>
  </tr>
<%
    }
		out.println(SzPageHelp.printTableBlankApp(i, iPageSize));
%>

  </form>
</table>

<!-----下面的工具栏------>
<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="/app/share/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%>"> 
</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();
  }
  
</script>
