<%@ page contentType="text/html;charset=UTF-8" %>
<%@ page import="java.util.Iterator" %>
<%@ page import="net.sz600.tool.SzConvert" %>
<%@ page import="net.sz600.tool.SzDateHelp" %>
<%@ page import="net.sz600.system.*" %>
<%@ page import="net.sz600.mail.*" %>
<%@ include file="/sessionInfo.jsp"%>
<%
    //获取提交的参数
    String sType = SzConvert.toZeroStr(request.getParameter("type"));
    String sPage = SzConvert.toZeroStr(request.getParameter("page"));
    String sSearch = SzConvert.strWriteData(request.getParameter("txtSearch"));
    String sPKEY = SzConvert.toZeroStr(request.getParameter("PKEY"));
    
    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"));       
%>
<form name="formHidden" method="post">
  <input type="hidden" name="page" value="<%=sPage%>">
  <input type="hidden" name="txtSearch" value="<%=sSearch%>">
  <input type="hidden" name="PKEY" value="<%=sPKEY%>">
  <input type="hidden" name="type" value="<%=sType%>">
  
	<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>
<%
    String sOPERATOR = SzConvert.toSpaceStr(request.getParameter("OPERATOR"));
		String dir = SzConvert.toSpaceStr(request.getParameter("dir"));
    YjMailNew yjMail = new YjMailNew();
    YjMailReceive yjMailReceive = new YjMailReceive();
    boolean flag = false;
    String sUrl = "index.jsp";
    if (sType.equals("0") || sType.equals("3")) {
    	
    } else if (sType.equals("1") || sType.equals("2")) {
    	sUrl = "index_send.jsp";
    } else {
    	sUrl = "index_fold.jsp";
    }    
    String sMessage = "";

    String id_str[] = request.getParameterValues("chkId");
    //System.out.println("sOPERATOR==" + sOPERATOR);
    //SzOut.printArray(id_str);
    if (sOPERATOR.equals("delete")) {        
      flag = yjMail.delete(id_str, SzConvert.toInt(sType));
    } else if (sOPERATOR.equals("move")) {    	
    	flag = yjMailReceive.move(id_str, dir);    	
    } else if (sOPERATOR.equals("targ")) {
    	flag = yjMailReceive.targ(id_str, dir);
    } else if (sOPERATOR.equals("deleteManager")) {
    	//按照收件删除，ID是JSID
    	flag = yjMail.delete(id_str, yjMail.intManagerFold);
    	sUrl = "index_manage.jsp";
    }
    sMessage = SzOut.getMessage();

    if (flag) {
        out.println(SzPageHelp.jsAlert("操作成功"));
        //out.println(SzPageHelp.jsGoUrl(sUrl));
        out.println(SzPageHelp.jsFormSubmit("formHidden",sUrl));
    } else {
        out.println(SzPageHelp.jsAlertBack(sMessage));
    }
%>
