Index: lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/service/ISubmitFilesService.java =================================================================== diff -u -ra8328bd7083a98162fe2ea19193a08ca16de51d4 -rfefb3d42a0ef4f8c5b602fc1634c7e7ce619eea6 --- lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/service/ISubmitFilesService.java (.../ISubmitFilesService.java) (revision a8328bd7083a98162fe2ea19193a08ca16de51d4) +++ lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/service/ISubmitFilesService.java (.../ISubmitFilesService.java) (revision fefb3d42a0ef4f8c5b602fc1634c7e7ce619eea6) @@ -135,7 +135,7 @@ * @param marksFileInputStream * @param marksFileName */ - public void updateMarks(Long reportID, Float marks, String comments, FormFile file, Long SessionID) + public void updateMarks(Long reportID, Float marks, String comments, MultipartFile file, Long SessionID) throws InvalidParameterException, RepositoryCheckedException; /** Index: lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/service/SubmitFilesService.java =================================================================== diff -u -ra8328bd7083a98162fe2ea19193a08ca16de51d4 -rfefb3d42a0ef4f8c5b602fc1634c7e7ce619eea6 --- lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/service/SubmitFilesService.java (.../SubmitFilesService.java) (revision a8328bd7083a98162fe2ea19193a08ca16de51d4) +++ lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/service/SubmitFilesService.java (.../SubmitFilesService.java) (revision fefb3d42a0ef4f8c5b602fc1634c7e7ce619eea6) @@ -620,7 +620,7 @@ throw new SubmitFilesException("No such session with a sessionID of: " + sessionID + " found."); } -// NodeKey nodeKey = processFile(file); + NodeKey nodeKey = processFile(file); SubmissionDetails details = new SubmissionDetails(); details.setFileDescription(fileDescription); @@ -629,8 +629,8 @@ SubmitUser learner = submitUserDAO.getLearner(sessionID, userID); details.setLearner(learner); -// details.setUuid(nodeKey.getUuid()); -// details.setVersionID(nodeKey.getVersion()); + details.setUuid(nodeKey.getUuid()); + details.setVersionID(nodeKey.getVersion()); SubmitFilesReport report = new SubmitFilesReport(); details.setReport(report); details.setSubmitFileSession(session); @@ -652,10 +652,10 @@ * @throws RepositoryCheckedException * @throws InvalidParameterException */ - private NodeKey processFile(FormFile file) { + private NodeKey processFile(MultipartFile file) { NodeKey node = null; - if ((file != null) && !StringUtils.isEmpty(file.getFileName())) { - String fileName = file.getFileName(); + if ((file != null) && !StringUtils.isEmpty(file.getName())) { + String fileName = file.getName(); try { node = getSbmtToolContentHandler().uploadFile(file.getInputStream(), fileName, file.getContentType()); } catch (InvalidParameterException e) { @@ -760,7 +760,7 @@ } @Override - public void updateMarks(Long reportID, Float marks, String comments, FormFile markFile, Long sessionID) + public void updateMarks(Long reportID, Float marks, String comments, MultipartFile markFile, Long sessionID) throws InvalidParameterException, RepositoryCheckedException { SubmitFilesSession session = getSessionById(sessionID); @@ -769,7 +769,7 @@ // can share the mark file across users NodeKey nodeKey = null; - if ((markFile != null) && !StringUtils.isEmpty(markFile.getFileName())) { + if ((markFile != null) && !StringUtils.isEmpty(markFile.getName())) { nodeKey = this.processFile(markFile); } @@ -793,7 +793,7 @@ report.setMarkFileVersionID(null); } - report.setMarkFileName(markFile.getFileName()); + report.setMarkFileName(markFile.getName()); report.setMarkFileUUID(nodeKey.getUuid()); report.setMarkFileVersionID(nodeKey.getVersion()); } @@ -811,7 +811,7 @@ report.setMarks(marks); // If there is a new file, delete the existing and add the mark file - if ((markFile != null) && !StringUtils.isEmpty(markFile.getFileName())) { + if ((markFile != null) && !StringUtils.isEmpty(markFile.getName())) { // Delete the existing if (report.getMarkFileUUID() != null) { @@ -826,7 +826,7 @@ // NodeKey nodeKey = toolContentHandler.uploadFile(marksFileInputStream, marksFileName, null, // IToolContentHandler.TYPE_ONLINE); - report.setMarkFileName(markFile.getFileName()); + report.setMarkFileName(markFile.getName()); report.setMarkFileUUID(nodeKey.getUuid()); report.setMarkFileVersionID(nodeKey.getVersion()); } Index: lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/web/controller/LearnerController.java =================================================================== diff -u -r3c1a078fa0607bbbe0f78641ffebb16ebbb3114a -rfefb3d42a0ef4f8c5b602fc1634c7e7ce619eea6 --- lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/web/controller/LearnerController.java (.../LearnerController.java) (revision 3c1a078fa0607bbbe0f78641ffebb16ebbb3114a) +++ lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/web/controller/LearnerController.java (.../LearnerController.java) (revision fefb3d42a0ef4f8c5b602fc1634c7e7ce619eea6) @@ -87,6 +87,7 @@ * @author Steve.Ni */ @Controller +@RequestMapping("/learner") public class LearnerController implements SbmtConstants { private static final boolean MODE_OPTIONAL = false; @@ -107,7 +108,7 @@ /** * The initial page of learner in Submission tool. This page will list all uploaded files and learn */ - @RequestMapping("/learner") + @RequestMapping("") public String unspecified(@ModelAttribute LearnerForm learnerForm, HttpServletRequest request) { // initial session Map SessionMap sessionMap = new SessionMap(); @@ -418,7 +419,7 @@ errorMap.add("GLOBAL", "errors.maxdescsize"); } - FileValidatorSpringUtil.validateFileSize(learnerForm.getFile(), false); + FileValidatorSpringUtil.validateFileSize(learnerForm.getFile().getSize(), false, errorMap); if (learnerForm.getFile() != null) { LearnerController.logger.debug("Learner submit file : " + learnerForm.getFile().getName()); Index: lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/web/controller/MarkController.java =================================================================== diff -u -ra8328bd7083a98162fe2ea19193a08ca16de51d4 -rfefb3d42a0ef4f8c5b602fc1634c7e7ce619eea6 --- lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/web/controller/MarkController.java (.../MarkController.java) (revision a8328bd7083a98162fe2ea19193a08ca16de51d4) +++ lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/web/controller/MarkController.java (.../MarkController.java) (revision fefb3d42a0ef4f8c5b602fc1634c7e7ce619eea6) @@ -41,6 +41,8 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.stereotype.Controller; +import org.springframework.util.LinkedMultiValueMap; +import org.springframework.util.MultiValueMap; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.RequestMapping; @@ -67,21 +69,22 @@ /** * Update mark. */ + @RequestMapping("/updateMark") public String updateMark(@ModelAttribute MarkForm markForm, HttpServletRequest request) throws InvalidParameterException, RepositoryCheckedException { // Check whether the mark is valid. Float marks = null; String markStr = markForm.getMarks(); - List messages = new ArrayList<>(); + MultiValueMap errorMap = new LinkedMultiValueMap(); try { marks = NumberUtil.getLocalisedFloat(markStr, request.getLocale()); } catch (Exception e) { - messages.add("errors.mark.invalid.number"); + errorMap.add("GLOBAL", "errors.mark.invalid.number"); } String comments = WebUtil.readStrParam(request, "comments", true); - if (messages != null && !messages.isEmpty()) { + if (!errorMap.isEmpty()) { List report = new ArrayList(); FileDetailsDTO fileDetail = submitFilesService.getFileDetails(markForm.getDetailID(), request.getLocale()); // echo back the input, even they are wrong. @@ -92,7 +95,7 @@ request.setAttribute("report", report); request.setAttribute(AttributeNames.PARAM_TOOL_SESSION_ID, markForm.getToolSessionID()); - request.setAttribute("messages", messages); + request.setAttribute("errorMap", errorMap); return "monitoring/mark/updatemark"; } @@ -117,6 +120,7 @@ /** * Display update mark initial page. */ + @RequestMapping("/newMark") public String newMark(@ModelAttribute MarkForm markForm, HttpServletRequest request) { FileDetailsDTO fileDetailsDTO = submitFilesService.getFileDetails(markForm.getDetailID(), request.getLocale()); @@ -135,6 +139,7 @@ /** * Update the form */ + @RequestMapping("/updateMarkForm") private void updateMarkForm(MarkForm markForm, FileDetailsDTO fileDetailsDTO) { if (fileDetailsDTO.getMarks() != null) { @@ -149,6 +154,7 @@ /** * Remove a mark file */ + @RequestMapping("/removeMarkFile") public String removeMarkFile(@ModelAttribute MarkForm markForm, HttpServletRequest request, HttpServletResponse response) { Index: lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/web/controller/MonitoringController.java =================================================================== diff -u -re570134b86338055e4fabad4761e69fbb47a57e0 -rfefb3d42a0ef4f8c5b602fc1634c7e7ce619eea6 --- lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/web/controller/MonitoringController.java (.../MonitoringController.java) (revision e570134b86338055e4fabad4761e69fbb47a57e0) +++ lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/web/controller/MonitoringController.java (.../MonitoringController.java) (revision fefb3d42a0ef4f8c5b602fc1634c7e7ce619eea6) @@ -55,6 +55,7 @@ import org.lamsfoundation.lams.tool.sbmt.dto.SessionDTO; import org.lamsfoundation.lams.tool.sbmt.dto.StatisticDTO; import org.lamsfoundation.lams.tool.sbmt.service.ISubmitFilesService; +import org.lamsfoundation.lams.tool.sbmt.web.form.MarkForm; import org.lamsfoundation.lams.usermanagement.dto.UserDTO; import org.lamsfoundation.lams.util.DateUtil; import org.lamsfoundation.lams.util.MessageService; @@ -65,6 +66,9 @@ import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.http.MediaType; import org.springframework.stereotype.Controller; +import org.springframework.util.LinkedMultiValueMap; +import org.springframework.util.MultiValueMap; +import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.util.HtmlUtils; @@ -160,7 +164,7 @@ } /** Ajax call to populate the tablesorter */ - @RequestMapping(produces = MediaType.APPLICATION_JSON_UTF8_VALUE) + @RequestMapping(path = "/getUsers", produces = MediaType.APPLICATION_JSON_UTF8_VALUE) @ResponseBody public String getUsers(HttpServletRequest request, HttpServletResponse response) { @@ -238,6 +242,7 @@ /** * AJAX call to refresh statistic page. */ + @RequestMapping("/doStatistic") public String doStatistic(HttpServletRequest request) { Long contentID = new Long(WebUtil.readLongParam(request, AttributeNames.PARAM_TOOL_CONTENT_ID)); @@ -261,6 +266,7 @@ /** * Release mark */ + @RequestMapping("/releaseMarks") public void releaseMarks(HttpServletRequest request, HttpServletResponse response) { // get service then update report table @@ -284,13 +290,14 @@ /** * Download submit file marks by MS Excel file format. */ + @RequestMapping("/downloadMarks") public void downloadMarks(HttpServletRequest request, HttpServletResponse response) { Long sessionID = new Long(WebUtil.readLongParam(request, AttributeNames.PARAM_TOOL_SESSION_ID)); // return FileDetailsDTO list according to the given sessionID Map userFilesMap = submitFilesService.getFilesUploadedBySession(sessionID, request.getLocale()); // construct Excel file format and download - String errors = null; + MultiValueMap errorMap = new LinkedMultiValueMap(); try { // create an empty excel file HSSFWorkbook wb = new HSSFWorkbook(); @@ -366,14 +373,18 @@ response.getOutputStream().write(data, 0, data.length); response.getOutputStream().flush(); } catch (Exception e) { -// LamsDispatchAction.log.error(e); - errors = new ActionMessage("monitoring.download.error", e.toString()).toString(); + logger.error(e); + errorMap.add("monitoring.download.error", e.toString()); } - if (errors != null) { + if (!errorMap.isEmpty()) { try { PrintWriter out = response.getWriter(); - out.write(errors); + Iterator it = errorMap.keySet().iterator(); + while(it.hasNext()){ + String theKey = (String)it.next(); + out.write(theKey); + } out.flush(); } catch (IOException e) { } @@ -383,7 +394,7 @@ /** * Set Submission Deadline */ - @RequestMapping(produces = MediaType.TEXT_PLAIN_VALUE) + @RequestMapping(path = "setSubmissionDeadline", produces = MediaType.TEXT_PLAIN_VALUE) @ResponseBody public String setSubmissionDeadline(HttpServletRequest request, HttpServletResponse response) throws IOException { @@ -413,6 +424,7 @@ /** * Display special user's marks information. */ + @RequestMapping("/listMark") public String listMark(HttpServletRequest request) { Long sessionID = new Long(WebUtil.readLongParam(request, AttributeNames.PARAM_TOOL_SESSION_ID)); Integer userID = WebUtil.readIntParam(request, "userID"); @@ -428,6 +440,7 @@ /** * View mark of all learner from same tool content ID. */ + @RequestMapping("/listAllMarks") public String listAllMarks(HttpServletRequest request) { Long sessionID = new Long(WebUtil.readLongParam(request, AttributeNames.PARAM_TOOL_SESSION_ID)); @@ -445,6 +458,7 @@ * Remove the original file created by the learner. Does not actually remove it from the content repository - merely * makes it as removed. */ + @RequestMapping("/removeLearnerFile") public String removeLearnerFile(HttpServletRequest request) throws ServletException { return removeRestoreLearnerFile(request, true); } @@ -453,10 +467,12 @@ * Remove the original file created by the learner. Does not actually remove it from the content repository - merely * makes it as removed. */ + @RequestMapping("/restoreLearnerFile") public String restoreLearnerFile(HttpServletRequest request) throws ServletException { return removeRestoreLearnerFile(request, false); } + @RequestMapping("/removeRestoreLearnerFile") public String removeRestoreLearnerFile(HttpServletRequest request, boolean remove) throws ServletException { UserDTO currentUser = (UserDTO) SessionManager.getSession().getAttribute(AttributeNames.USER); Index: lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/web/form/MarkForm.java =================================================================== diff -u -ra8328bd7083a98162fe2ea19193a08ca16de51d4 -rfefb3d42a0ef4f8c5b602fc1634c7e7ce619eea6 --- lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/web/form/MarkForm.java (.../MarkForm.java) (revision a8328bd7083a98162fe2ea19193a08ca16de51d4) +++ lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/web/form/MarkForm.java (.../MarkForm.java) (revision fefb3d42a0ef4f8c5b602fc1634c7e7ce619eea6) @@ -20,11 +20,9 @@ * **************************************************************** */ - package org.lamsfoundation.lams.tool.sbmt.web.form; -import org.apache.struts.action.ActionForm; -import org.apache.struts.upload.FormFile; +import org.springframework.web.multipart.MultipartFile; /** * @author lfoxton @@ -40,7 +38,7 @@ private Long detailID; private Long reportID; private String marks; - private FormFile markFile; + private MultipartFile markFile; private String comments; private String updateMode; private Long markFileUUID; @@ -89,11 +87,11 @@ this.marks = marks; } - public FormFile getMarkFile() { + public MultipartFile getMarkFile() { return markFile; } - public void setMarkFile(FormFile markFile) { + public void setMarkFile(MultipartFile markFile) { this.markFile = markFile; } Index: lams_tool_sbmt/web/learner/redirectAfterSubmit.jsp =================================================================== diff -u -re570134b86338055e4fabad4761e69fbb47a57e0 -rfefb3d42a0ef4f8c5b602fc1634c7e7ce619eea6 --- lams_tool_sbmt/web/learner/redirectAfterSubmit.jsp (.../redirectAfterSubmit.jsp) (revision e570134b86338055e4fabad4761e69fbb47a57e0) +++ lams_tool_sbmt/web/learner/redirectAfterSubmit.jsp (.../redirectAfterSubmit.jsp) (revision fefb3d42a0ef4f8c5b602fc1634c7e7ce619eea6) @@ -1,4 +1,4 @@ -<%@ include file="/common/taglibs.jsp"%> +s<%@ include file="/common/taglibs.jsp"%> @@ -8,7 +8,7 @@ <%@ include file="/common/header.jsp"%> Index: lams_tool_sbmt/web/learner/sbmtlearner.jsp =================================================================== diff -u -r3c1a078fa0607bbbe0f78641ffebb16ebbb3114a -rfefb3d42a0ef4f8c5b602fc1634c7e7ce619eea6 --- lams_tool_sbmt/web/learner/sbmtlearner.jsp (.../sbmtlearner.jsp) (revision 3c1a078fa0607bbbe0f78641ffebb16ebbb3114a) +++ lams_tool_sbmt/web/learner/sbmtlearner.jsp (.../sbmtlearner.jsp) (revision fefb3d42a0ef4f8c5b602fc1634c7e7ce619eea6) @@ -48,7 +48,7 @@ } } function finish() { - var finishUrl = "learner.do?method=finish&sessionMapID=${sessionMapID}"; + var finishUrl = "learner/finish.do?sessionMapID=${sessionMapID}"; return submitCount(finishUrl); } function notebook() { @@ -105,8 +105,8 @@ var answer = confirm(msg); if (answer) { $.ajax({ - url: '', - data: 'method=deleteLearnerFile&detailId=' + detailId, + url: '', + data: 'detailId=' + detailId, success: function () { document.location.href = ""; }, Index: lams_tool_sbmt/web/monitoring/mark/mark.jsp =================================================================== diff -u -ra8328bd7083a98162fe2ea19193a08ca16de51d4 -rfefb3d42a0ef4f8c5b602fc1634c7e7ce619eea6 --- lams_tool_sbmt/web/monitoring/mark/mark.jsp (.../mark.jsp) (revision a8328bd7083a98162fe2ea19193a08ca16de51d4) +++ lams_tool_sbmt/web/monitoring/mark/mark.jsp (.../mark.jsp) (revision fefb3d42a0ef4f8c5b602fc1634c7e7ce619eea6) @@ -19,15 +19,15 @@