receivedDocUpload.jsp
资源名称:NetOffice.rar [点击查看]
上传用户:guhaomin
上传日期:2007-06-10
资源大小:23203k
文件大小:5k
源码类别:
电子政务应用
开发平台:
Java
- <%
- String root = ConfigParaLoader.getParameter("rootUrl");
- if( request.getParameter("type") !=null && Integer.parseInt( request.getParameter("type") ) == 1 ) //上传文件
- {
- String attachURL = ConfigParaLoader.getParameter("documentAttachmentUrl");
- attachURL += SubPathGenerater.getSeperator() + SubPathGenerater.getSubPath( root + SubPathGenerater.getSeperator() + attachURL);
- drvb = ( DocumentReceivedValueBean )session.getAttribute( "recieveddocument" );
- //上传文件
- // Initialization
- mySmartUpload.initialize( pageContext );
- mySmartUpload.setTotalMaxFileSize(10000000 );
- //ConfigParaLoader.getParameterByInt("attachmentSize") );
- // Upload
- mySmartUpload.upload();
- mySmartUpload.save( root + SubPathGenerater.getSeperator() + attachURL );
- //保存已有信息
- if( mySmartUpload.getRequest().getParameter("title") != null )
- drvb.setTitle( mySmartUpload.getRequest().getParameter("title") );
- if( mySmartUpload.getRequest().getParameter("NO") != null )
- drvb.setNO( mySmartUpload.getRequest().getParameter("NO") );
- if( mySmartUpload.getRequest().getParameter("comeFrom") != null )
- drvb.setComeFrom( mySmartUpload.getRequest().getParameter("comeFrom") );
- if( !mySmartUpload.getRequest().getParameter("fileNumber").equals("") )
- drvb.setFileNumber( Integer.parseInt( mySmartUpload.getRequest().getParameter("fileNumber") ) );
- if( !mySmartUpload.getRequest().getParameter("pages").equals("") )
- drvb.setPages( Integer.parseInt( mySmartUpload.getRequest().getParameter("pages") ) );
- if( mySmartUpload.getRequest().getParameter("content") != null )
- drvb.setContent( mySmartUpload.getRequest().getParameter("content") );
- if( mySmartUpload.getRequest().getParameter("remark") != null )
- drvb.setRemark( mySmartUpload.getRequest().getParameter("remark") );
- if( mySmartUpload.getRequest().getParameter("receivedDateS") != null )
- drvb.setReceivedDateS( mySmartUpload.getRequest().getParameter("receivedDateS") );
- String dtype = mySmartUpload.getRequest().getParameter("type");
- drvb.setType( DocumentReceivedType.getInstance( Integer.parseInt(dtype) ) );
- String stype = mySmartUpload.getRequest().getParameter("securityType");
- drvb.setSecurityType( SecurityType.getInstance( Integer.parseInt(stype) ) );
- Collection c = drvb.getFiles();
- for(int i=0;i<mySmartUpload.getFiles().getCount();i++)
- {
- com.vnex.intranet.upload.File myFile = mySmartUpload.getFiles().getFile(i);
- if (!myFile.isMissing())
- {
- WorkflowFileValueBean wf = new WorkflowFileValueBean();
- wf.setName( myFile.getFileName() );
- wf.setTitle( attachURL + "/" + myFile.getFileName() );
- wf.setDescription( myFile.getFileName() );
- c.add(wf);
- }
- }
- drvb.setFiles(c);
- }
- if( request.getParameter("type") !=null && Integer.parseInt( request.getParameter("type") ) == 2 ) //删除文件
- {
- drvb = ( DocumentReceivedValueBean )session.getAttribute( "recieveddocument" );
- //保存已有信息
- if( request.getParameter("title") != null )
- drvb.setTitle( request.getParameter("title") );
- if( request.getParameter("NO") != null )
- drvb.setNO( request.getParameter("NO") );
- if( request.getParameter("comeFrom") != null )
- drvb.setComeFrom( request.getParameter("comeFrom") );
- if( !request.getParameter("fileNumber").equals("") )
- drvb.setFileNumber( Integer.parseInt( request.getParameter("fileNumber") ) );
- if( !request.getParameter("pages").equals("") )
- drvb.setPages( Integer.parseInt( request.getParameter("pages") ) );
- if( request.getParameter("content") != null )
- drvb.setContent( request.getParameter("content") );
- if( request.getParameter("remark") != null )
- drvb.setRemark( request.getParameter("remark") );
- if( request.getParameter("receivedDate") != null )
- drvb.setReceivedDateS( request.getParameter("receivedDate") );
- String dtype = request.getParameter("type");
- drvb.setType( DocumentReceivedType.getInstance( Integer.parseInt(dtype) ) );
- String stype = request.getParameter("securityType");
- drvb.setSecurityType( SecurityType.getInstance( Integer.parseInt(stype) ) );
- String files[] = request.getParameterValues("attachments");
- if(files!= null)
- {
- for(int i = 0; i<files.length; i++)
- {
- SubPathGenerater.deleteFile( root + SubPathGenerater.getSeperator() + files[i] );
- drvb.removeFile( files[i] );
- }
- }
- session.setAttribute( "recieveddocument", drvb );
- }
- %>