Index: lams_tool_sbmt/conf/xdoclet/struts-forms.xml =================================================================== RCS file: /usr/local/cvsroot/lams_tool_sbmt/conf/xdoclet/struts-forms.xml,v diff -u -r1.4 -r1.5 --- lams_tool_sbmt/conf/xdoclet/struts-forms.xml 20 Jul 2005 07:27:46 -0000 1.4 +++ lams_tool_sbmt/conf/xdoclet/struts-forms.xml 27 Jul 2005 06:44:54 -0000 1.5 @@ -1,10 +1,8 @@ + type="java.lang.String" /> + type="java.lang.String" /> @@ -13,12 +11,10 @@ + type="org.apache.struts.upload.FormFile"/> + type="java.lang.String"/> Index: lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/service/ISubmitFilesService.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/service/ISubmitFilesService.java,v diff -u -r1.8 -r1.9 --- lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/service/ISubmitFilesService.java 22 Jul 2005 05:41:31 -0000 1.8 +++ lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/service/ISubmitFilesService.java 27 Jul 2005 06:44:54 -0000 1.9 @@ -25,6 +25,7 @@ import java.util.List; import java.util.Map; +import org.apache.struts.upload.FormFile; import org.lamsfoundation.lams.contentrepository.IVersionedNode; import org.lamsfoundation.lams.tool.sbmt.SubmitFilesContent; import org.lamsfoundation.lams.tool.sbmt.SubmitFilesReport; @@ -95,16 +96,15 @@ * * @param contentID * The content_id of the record to be updated in the database - * @param filePath - * The physical location of the file from where it has to be - * uploaded + * @param uploadedFile + * The STRUTS org.apache.struts.upload.FormFile type * @param fileDescription * The description of the file being uploaded. * @param userID * The User who has uploaded the file. * @throws SubmitFilesException */ - public void uploadFile(Long contentID, String filePath, + public void uploadFile(Long contentID, FormFile uploadedFile, String fileDescription, Long userID) throws SubmitFilesException; /** Index: lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/service/SubmitFilesService.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/service/SubmitFilesService.java,v diff -u -r1.12 -r1.13 --- lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/service/SubmitFilesService.java 26 Jul 2005 07:05:26 -0000 1.12 +++ lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/service/SubmitFilesService.java 27 Jul 2005 06:44:54 -0000 1.13 @@ -23,8 +23,8 @@ package org.lamsfoundation.lams.tool.sbmt.service; import java.io.File; -import java.io.FileInputStream; import java.io.FileNotFoundException; +import java.io.IOException; import java.io.InputStream; import java.util.ArrayList; import java.util.Calendar; @@ -38,6 +38,7 @@ import java.util.TreeSet; import org.apache.log4j.Logger; +import org.apache.struts.upload.FormFile; import org.lamsfoundation.lams.contentrepository.AccessDeniedException; import org.lamsfoundation.lams.contentrepository.FileException; import org.lamsfoundation.lams.contentrepository.ICredentials; @@ -363,8 +364,6 @@ * uploaded * @param sessionID * The ToolSessionID of the file being uploaded - * @param filePath - * The physical path of the file * @param fileDescription * The description of the file * @param fileName @@ -377,7 +376,7 @@ * The User who has uploaded the file. * @throws SubmitFilesException */ - private void uploadFile(InputStream stream, Long sessionID, String filePath, + private void uploadFile(InputStream stream, Long sessionID, String fileDescription, String fileName, String mimeType, Date dateOfSubmission, Long userID) throws SubmitFilesException { @@ -388,7 +387,7 @@ + " found."); else { NodeKey nodeKey = uploadFileToRepository(stream, fileName, mimeType); - SubmissionDetails details = new SubmissionDetails(filePath,fileDescription,dateOfSubmission, + SubmissionDetails details = new SubmissionDetails(fileName,fileDescription,dateOfSubmission, userID,nodeKey.getUuid(),nodeKey.getVersion()); SubmitFilesReport report = new SubmitFilesReport(); details.setReport(report); @@ -512,16 +511,17 @@ * @see org.lamsfoundation.lams.tool.sbmt.service.ISubmitFilesService#uploadFile(java.lang.Long, * java.lang.String, java.lang.String) */ - public void uploadFile(Long sessionID, String filePath, + public void uploadFile(Long sessionID, FormFile uploadFile, String fileDescription, Long userID) throws SubmitFilesException{ try{ - File file = new File(filePath); - String fileName = file.getName(); + String fileName = uploadFile.getFileName(); String mimeType = fileName.substring(fileName.lastIndexOf(".")+1,fileName.length()); - FileInputStream stream = new FileInputStream(file); - uploadFile(stream,sessionID,filePath,fileDescription,fileName,mimeType,new Date(),userID); + InputStream stream = uploadFile.getInputStream(); + uploadFile(stream,sessionID,fileDescription,fileName,mimeType,new Date(),userID); }catch(FileNotFoundException fe){ throw new SubmitFilesException("FileNotFoundException occured while trying to upload File" + fe.getMessage()); + } catch (IOException e) { + throw new SubmitFilesException("FileNotFoundException occured while trying to upload File" + e.getMessage()); } } Index: lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/web/LearnerAction.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/web/LearnerAction.java,v diff -u -r1.9 -r1.10 --- lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/web/LearnerAction.java 21 Jul 2005 07:31:47 -0000 1.9 +++ lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/web/LearnerAction.java 27 Jul 2005 06:44:54 -0000 1.10 @@ -21,6 +21,7 @@ import org.apache.struts.action.ActionMessages; import org.apache.struts.action.DynaActionForm; import org.apache.struts.actions.DispatchAction; +import org.apache.struts.upload.FormFile; import org.lamsfoundation.lams.tool.sbmt.SubmitFilesContent; import org.lamsfoundation.lams.tool.sbmt.SubmitFilesSession; import org.lamsfoundation.lams.tool.sbmt.dto.FileDetailsDTO; @@ -90,14 +91,14 @@ Long sessionID =(Long) authForm.get("toolSessionID"); Long userID = (Long)authForm.get("userID"); - String filePath = (String) authForm.get("filePath"); + FormFile uploadedFile= (FormFile) authForm.get("filePath"); String fileDescription = (String) authForm.get("fileDescription"); - + submitFilesService = SubmitFilesServiceProxy.getSubmitFilesService(this.getServlet().getServletContext()); //to avoid user without patience click "upload" button too fast saveToken(request); try{ - submitFilesService.uploadFile(sessionID,filePath,fileDescription,userID); + submitFilesService.uploadFile(sessionID,uploadedFile,fileDescription,userID); List filesUploaded = submitFilesService.getFilesUploadedByUser(userID,sessionID); listUploadFiles(authForm, filesUploaded); return mapping.getInputForward(); Index: lams_tool_sbmt/web/sbmtLearner.jsp =================================================================== RCS file: /usr/local/cvsroot/lams_tool_sbmt/web/Attic/sbmtLearner.jsp,v diff -u -r1.7 -r1.8 --- lams_tool_sbmt/web/sbmtLearner.jsp 22 Jul 2005 05:56:18 -0000 1.7 +++ lams_tool_sbmt/web/sbmtLearner.jsp 27 Jul 2005 06:44:54 -0000 1.8 @@ -22,7 +22,7 @@

-

+

@@ -85,7 +85,7 @@
- +

Index: lams_tool_sbmt/web/WEB-INF/struts/struts-config.xml =================================================================== RCS file: /usr/local/cvsroot/lams_tool_sbmt/web/WEB-INF/struts/Attic/struts-config.xml,v diff -u -r1.8 -r1.9 --- lams_tool_sbmt/web/WEB-INF/struts/struts-config.xml 21 Jul 2005 07:31:48 -0000 1.8 +++ lams_tool_sbmt/web/WEB-INF/struts/struts-config.xml 27 Jul 2005 06:44:54 -0000 1.9 @@ -15,22 +15,18 @@ + type="java.lang.String" /> + type="java.lang.String" /> + type="org.apache.struts.upload.FormFile"/> + type="java.lang.String"/> + +<%@ taglib uri="fck-editor" prefix="FCK"%> +<%@ taglib uri="tags-html-el" prefix="html"%> +<%@ taglib uri="tags-tiles" prefix="tiles"%> +<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c"%> +<%@ taglib uri="http://java.sun.com/jstl/fmt" prefix="fmt"%> + + + + + +Submit Files + + + + + + + +
+

+

+
+ + + + + + + + + + + + +
:
: +
+
+
+

+

+ + + + + + + + + + + + + + + + + + + + +
: +
: +
: + + + +
+
+ + + + + +
+ + + +
+ + +