send_msg_process.jsp
上传用户:guhaomin
上传日期:2007-06-10
资源大小:23203k
文件大小:4k
源码类别:

电子政务应用

开发平台:

Java

  1. <%@ page errorPage="/vnex/ErrorPage.jsp" %>
  2. <%@ page import="java.util.Vector"%>
  3. <%@ page import="com.vnex.intranet.communication.message.value.*" %>
  4. <%@ page import="com.vnex.intranet.system.loader.ConfigParaLoader"%>
  5. <%@ page import="com.vnex.intranet.util.SubPathGenerater" %>
  6. <jsp:useBean id="msgProxy" scope="application" class="com.vnex.intranet.communication.message.proxy.MessageProxyBean" />
  7. <jsp:useBean id="mvb" scope="request" class="com.vnex.intranet.communication.message.value.MessageValueBean" />
  8. <jsp:useBean id="BusinessName" scope="session" class="com.vnex.intranet.pub.BusinessSession" />
  9. <jsp:useBean id="mySmartUpload" scope="request" class="com.vnex.intranet.upload.SmartUpload" />
  10. <jsp:setProperty name="mvb" property="*" />
  11. <%
  12.     String root = ConfigParaLoader.getParameter("rootUrl");
  13. //out.println("root:="+root);
  14.     String fileSaveRoot = root+"/"+ConfigParaLoader.getParameter("msgAttachmentUrl")+"/";
  15.     String subPath = SubPathGenerater.getSubPath( fileSaveRoot);
  16. fileSaveRoot += subPath;
  17.     //yuduan add begin
  18.     String fileSaveRootSever = "/"+ConfigParaLoader.getParameter("msgAttachmentUrl")+"/";
  19.     fileSaveRootSever += subPath;
  20. //out.println("fileSaveRootSever="+fileSaveRootSever);
  21. //yuduan over
  22.     mySmartUpload.initialize( pageContext );
  23.     mySmartUpload.setTotalMaxFileSize(ConfigParaLoader.getParameterByInt("attachmentSize"));
  24.     mySmartUpload.upload();
  25.     
  26.     Vector fName = new Vector();
  27.     for(int i=0;i<mySmartUpload.getFiles().getCount();i++)
  28.     {
  29.         com.vnex.intranet.upload.File myFile = mySmartUpload.getFiles().getFile(i);
  30.         if(!myFile.isMissing())
  31.         {
  32.            //out.println("fileSaveRoot="+fileSaveRoot);//
  33.            myFile.saveAs(fileSaveRoot+"/"+myFile.getFileName());
  34.            fName.add(fileSaveRootSever+"/"+myFile.getFileName());
  35.         }   
  36.     }
  37.     
  38.     String[] fileNames = null;
  39.     if(fName.size() > 0)
  40.     {
  41.        fileNames = new String[fName.size()];
  42.        fName.toArray(fileNames);
  43.     }
  44.     
  45.     String[] ids = mySmartUpload.getRequest().getParameterValues("receiverArray");
  46.     if(ids != null)
  47.     {
  48.         int[] receiverIds = new int[ids.length];
  49.         for(int i=0;i<ids.length;i++)
  50.         {
  51.            receiverIds[i] = Integer.parseInt(ids[i]);
  52.         }   
  53.         mvb.setReceiverIds(receiverIds);    
  54.     }
  55.     mvb.setMsgTitle(mySmartUpload.getRequest().getParameter("msgTitle"));
  56.     mvb.setMsgBody(mySmartUpload.getRequest().getParameter("msgBody"));
  57.     mvb.setEmpId(BusinessName.getEmpId());
  58.     mvb.setSenderId(BusinessName.getEmpId());
  59.     mvb.setIsSent(1);
  60.     Vector vect = new Vector();
  61.     if(fileNames != null)
  62.     {
  63.         for(int i=0;i<fileNames.length;i++)
  64.         {
  65.            MsgAttachmentValueBean bean = new MsgAttachmentValueBean();
  66.            bean.setFileLocation(fileNames[i]);
  67.    //out.println("this is a good:"+fileNames[i]);
  68.            bean.setCounter(ids.length);
  69.            vect.add(bean);
  70.         }
  71.     }
  72.     if(request.getParameter("resend") != null)
  73.     {
  74.        String[] resendFileLocation = mySmartUpload.getRequest().getParameterValues("fileLocations");
  75.        if(resendFileLocation != null)
  76.        {
  77.           //out.println("find resend");
  78.           for(int i=0;i<resendFileLocation.length;i++)
  79.           {
  80.              MsgAttachmentValueBean bean = new MsgAttachmentValueBean();
  81.              bean.setFileLocation(resendFileLocation[i]);
  82.              bean.setCounter(ids.length);
  83.              vect.add(bean);
  84.              //out.println("fileLocation="+resendFileLocation[i]);///
  85.           }
  86.        }
  87.     }   
  88.     //out.println("vect.size()="+vect.size());///
  89.     mvb.setAttachment(vect);
  90.     msgProxy.sendMessage(mvb);
  91. %>
  92. <html>
  93. <head>
  94. <script language=javascript>
  95. function forward()
  96. {
  97. document.location = "/mainctrl/msg/sentHome";
  98. }
  99. </script>
  100. </head>
  101. <body onload="javascript:forward()">
  102. </body>
  103. </html>
  104.