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

电子政务应用

开发平台:

Java

  1. <%       
  2.        String root = ConfigParaLoader.getParameter("rootUrl");
  3.    if( request.getParameter("type") !=null && Integer.parseInt( request.getParameter("type") ) == 1 ) //上传文件
  4.        {         
  5.            String attachURL = ConfigParaLoader.getParameter("documentAttachmentUrl");
  6.            attachURL += SubPathGenerater.getSeperator() + SubPathGenerater.getSubPath( root + SubPathGenerater.getSeperator() + attachURL);
  7.            
  8.            drvb = ( DocumentReceivedValueBean )session.getAttribute( "recieveddocument" );
  9.    
  10.        //上传文件
  11.        // Initialization
  12.            mySmartUpload.initialize( pageContext );
  13.        mySmartUpload.setTotalMaxFileSize(10000000 );
  14.        //ConfigParaLoader.getParameterByInt("attachmentSize") );
  15.        // Upload
  16.        mySmartUpload.upload();
  17.        mySmartUpload.save( root + SubPathGenerater.getSeperator() + attachURL  );
  18.               
  19.        //保存已有信息
  20.        if( mySmartUpload.getRequest().getParameter("title") != null )
  21.            drvb.setTitle( mySmartUpload.getRequest().getParameter("title") );
  22.        if( mySmartUpload.getRequest().getParameter("NO") != null )           
  23.            drvb.setNO( mySmartUpload.getRequest().getParameter("NO") );
  24.        if( mySmartUpload.getRequest().getParameter("comeFrom") != null )             
  25.            drvb.setComeFrom( mySmartUpload.getRequest().getParameter("comeFrom") );   
  26.        if( !mySmartUpload.getRequest().getParameter("fileNumber").equals("") )             
  27.            drvb.setFileNumber( Integer.parseInt( mySmartUpload.getRequest().getParameter("fileNumber") ) );   
  28.        if( !mySmartUpload.getRequest().getParameter("pages").equals("") )
  29.            drvb.setPages( Integer.parseInt( mySmartUpload.getRequest().getParameter("pages") ) );  
  30.        if( mySmartUpload.getRequest().getParameter("content") != null )             
  31.            drvb.setContent( mySmartUpload.getRequest().getParameter("content") );   
  32.        if( mySmartUpload.getRequest().getParameter("remark") != null )
  33.            drvb.setRemark( mySmartUpload.getRequest().getParameter("remark") ); 
  34.        if( mySmartUpload.getRequest().getParameter("receivedDateS") != null )
  35.            drvb.setReceivedDateS( mySmartUpload.getRequest().getParameter("receivedDateS") ); 
  36.                   
  37.        String dtype = mySmartUpload.getRequest().getParameter("type");        
  38.            drvb.setType( DocumentReceivedType.getInstance( Integer.parseInt(dtype) ) );
  39.         
  40.            String stype = mySmartUpload.getRequest().getParameter("securityType");
  41.            drvb.setSecurityType( SecurityType.getInstance( Integer.parseInt(stype) ) );
  42.       
  43.            Collection c = drvb.getFiles();       
  44.            for(int i=0;i<mySmartUpload.getFiles().getCount();i++)
  45.            {
  46.                com.vnex.intranet.upload.File myFile = mySmartUpload.getFiles().getFile(i);
  47.                if (!myFile.isMissing())   
  48.                {
  49.                    WorkflowFileValueBean wf = new WorkflowFileValueBean();
  50.                    wf.setName( myFile.getFileName() ); 
  51.                    wf.setTitle( attachURL + "/" + myFile.getFileName() ); 
  52.                    wf.setDescription( myFile.getFileName() ); 
  53.                    c.add(wf);              
  54.                }                            
  55.            }         
  56.            drvb.setFiles(c);            
  57.   }
  58.   
  59.       if( request.getParameter("type") !=null && Integer.parseInt( request.getParameter("type") ) == 2 ) //删除文件
  60.       { 
  61.          drvb = ( DocumentReceivedValueBean )session.getAttribute( "recieveddocument" );
  62.    
  63.      //保存已有信息
  64.      if( request.getParameter("title") != null )
  65.          drvb.setTitle( request.getParameter("title") );
  66.      if( request.getParameter("NO") != null )           
  67.          drvb.setNO( request.getParameter("NO") );
  68.      if( request.getParameter("comeFrom") != null )             
  69.          drvb.setComeFrom( request.getParameter("comeFrom") );   
  70.      if( !request.getParameter("fileNumber").equals("") )             
  71.          drvb.setFileNumber( Integer.parseInt( request.getParameter("fileNumber") ) );   
  72.      if( !request.getParameter("pages").equals("") )
  73.          drvb.setPages( Integer.parseInt( request.getParameter("pages") ) );  
  74.      if( request.getParameter("content") != null )             
  75.          drvb.setContent( request.getParameter("content") );   
  76.      if( request.getParameter("remark") != null )
  77.          drvb.setRemark( request.getParameter("remark") ); 
  78.          if( request.getParameter("receivedDate") != null )
  79.          drvb.setReceivedDateS( request.getParameter("receivedDate") ); 
  80.            
  81.          String dtype = request.getParameter("type");        
  82.          drvb.setType( DocumentReceivedType.getInstance( Integer.parseInt(dtype) ) );
  83.          
  84.          String stype = request.getParameter("securityType");
  85.          drvb.setSecurityType( SecurityType.getInstance( Integer.parseInt(stype) ) );
  86.          
  87.          String files[] = request.getParameterValues("attachments");
  88.           
  89.          if(files!= null)
  90.          {              
  91.              for(int i = 0; i<files.length; i++)
  92.              {
  93.                   SubPathGenerater.deleteFile( root + SubPathGenerater.getSeperator() + files[i] );  
  94.                   drvb.removeFile(  files[i] );        
  95.              }     
  96.          } 
  97.          session.setAttribute( "recieveddocument", drvb  );
  98.              
  99.      }
  100. %>