Index: lams_tool_sbmt/conf/language/ApplicationResources.properties =================================================================== RCS file: /usr/local/cvsroot/lams_tool_sbmt/conf/language/Attic/ApplicationResources.properties,v diff -u -r1.10 -r1.11 --- lams_tool_sbmt/conf/language/ApplicationResources.properties 24 Jul 2006 08:48:39 -0000 1.10 +++ lams_tool_sbmt/conf/language/ApplicationResources.properties 1 Aug 2006 07:10:12 -0000 1.11 @@ -106,6 +106,6 @@ label.session.name =Session name label.count =Count label.no.user.available =No user available - - #======= End labels: Exported 100 labels for en AU ===== + +msg.mark.released=Marks have been released. Index: lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/submitFilesApplicationContext.xml =================================================================== RCS file: /usr/local/cvsroot/lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/submitFilesApplicationContext.xml,v diff -u -r1.14 -r1.15 --- lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/submitFilesApplicationContext.xml 18 Jun 2006 18:38:02 -0000 1.14 +++ lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/submitFilesApplicationContext.xml 1 Aug 2006 07:10:12 -0000 1.15 @@ -4,7 +4,13 @@ - + + org.lamsfoundation.lams.tool.sbmt.ApplicationResources + + + + + Index: lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/dto/FileDetailsDTO.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/dto/FileDetailsDTO.java,v diff -u -r1.9 -r1.10 --- lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/dto/FileDetailsDTO.java 6 Apr 2006 06:41:33 -0000 1.9 +++ lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/dto/FileDetailsDTO.java 1 Aug 2006 07:10:12 -0000 1.10 @@ -57,13 +57,7 @@ private UserDTO userDTO; - public String getExportedURL() { - return exportedURL; - } - public void setExportedURL(String exportedURL) { - this.exportedURL = exportedURL; - } - public FileDetailsDTO(SubmissionDetails details, SubmitFilesReport report){ + public FileDetailsDTO(SubmissionDetails details, UserDTO userDTO){ if(details == null){ log.warn("SubmissionDetails is null, failed to initial FileDetailDTO"); return; @@ -81,39 +75,23 @@ this.dateOfSubmission = details.getDateOfSubmission(); this.uuID = details.getUuid(); this.versionID = details.getVersionID(); + SubmitFilesReport report = details.getReport(); if(report != null){ this.reportID = report.getReportID(); this.dateMarksReleased = report.getDateMarksReleased(); this.comments = report.getComments(); this.marks = report.getMarks(); } - } - public FileDetailsDTO(SubmissionDetails details, SubmitFilesReport report,UserDTO userDTO){ - this(details,report); this.userDTO = userDTO; } - public FileDetailsDTO(SubmissionDetails details){ - - if(details == null){ - log.warn("SubmissionDetails is null, failed to initial FileDetailDTO"); - return; - } - - this.submissionID = details.getSubmissionID(); - this.filePath = details.getFilePath(); - this.fileDescription = details.getFileDescription(); - this.dateOfSubmission = details.getDateOfSubmission(); - this.uuID = details.getUuid(); - this.versionID = details.getVersionID(); - - SubmitFilesReport report = details.getReport(); - if(report != null){ - this.reportID = report.getReportID(); - this.dateMarksReleased = report.getDateMarksReleased(); - this.comments = report.getComments(); - this.marks = report.getMarks(); - } + + public String getExportedURL() { + return exportedURL; } + public void setExportedURL(String exportedURL) { + this.exportedURL = exportedURL; + } + /** * @return Returns the reportID. */ 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.51 -r1.52 --- lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/service/SubmitFilesService.java 18 Jun 2006 18:38:02 -0000 1.51 +++ lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/service/SubmitFilesService.java 1 Aug 2006 07:10:12 -0000 1.52 @@ -585,9 +585,8 @@ Iterator iterator = list.iterator(); while(iterator.hasNext()){ SubmissionDetails submissionDetails = (SubmissionDetails)iterator.next(); - SubmitFilesReport report = submissionDetails.getReport(); UserDTO user = getUserDetails(userID); - FileDetailsDTO detailDto = new FileDetailsDTO(submissionDetails,report, user); + FileDetailsDTO detailDto = new FileDetailsDTO(submissionDetails,user); detailDto.setDateOfSubmission(DateUtil.convertFromUTCToLocal(Calendar.getInstance().getTimeZone(), detailDto.getDateOfSubmission())); details.add(detailDto); } @@ -606,15 +605,14 @@ List userFileList; while(iterator.hasNext()){ SubmissionDetails submissionDetails = (SubmissionDetails)iterator.next(); - SubmitFilesReport report = submissionDetails.getReport(); Learner learner = submissionDetails.getLearner(); if(learner == null){ log.error("Could not find learer for special submission item:" + submissionDetails); return null; } UserDTO user = getUserDetails(learner.getUserID()); - FileDetailsDTO detailDto = new FileDetailsDTO(submissionDetails,report,user); + FileDetailsDTO detailDto = new FileDetailsDTO(submissionDetails,user); detailDto.setDateOfSubmission(DateUtil.convertFromUTCToLocal(Calendar.getInstance().getTimeZone(), detailDto.getDateOfSubmission())); userFileList = (List) map.get(user); //if it is first time to this user, creating a new ArrayList for this user. @@ -631,7 +629,9 @@ public FileDetailsDTO getFileDetails(Long detailID){ SubmissionDetails details = submissionDetailsDAO.getSubmissionDetailsByID(detailID); details.setDateOfSubmission(DateUtil.convertFromUTCToLocal(Calendar.getInstance().getTimeZone(), details.getDateOfSubmission())); - return new FileDetailsDTO(details); + UserDTO user = getUserDetails(details.getLearner().getUserID()); + + return new FileDetailsDTO(details,user); } /** * (non-Javadoc) Index: lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/web/MonitoringAction.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/web/MonitoringAction.java,v diff -u -r1.29 -r1.30 --- lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/web/MonitoringAction.java 13 Jun 2006 07:27:25 -0000 1.29 +++ lams_tool_sbmt/src/java/org/lamsfoundation/lams/tool/sbmt/web/MonitoringAction.java 1 Aug 2006 07:10:12 -0000 1.30 @@ -27,12 +27,15 @@ import java.io.ByteArrayOutputStream; import java.io.IOException; +import java.io.PrintWriter; +import java.util.ArrayList; +import java.util.Comparator; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; +import java.util.TreeMap; -import javax.servlet.ServletRequest; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -47,7 +50,6 @@ import org.apache.struts.action.ActionMapping; import org.apache.struts.action.ActionMessage; import org.apache.struts.action.ActionMessages; -import org.apache.struts.action.DynaActionForm; import org.lamsfoundation.lams.tool.sbmt.SubmitFilesContent; import org.lamsfoundation.lams.tool.sbmt.SubmitFilesSession; import org.lamsfoundation.lams.tool.sbmt.dto.AuthoringDTO; @@ -58,10 +60,12 @@ import org.lamsfoundation.lams.tool.sbmt.service.SubmitFilesServiceProxy; import org.lamsfoundation.lams.tool.sbmt.util.SbmtConstants; import org.lamsfoundation.lams.tool.sbmt.util.SbmtWebUtils; -import org.lamsfoundation.lams.usermanagement.dto.UserDTO; +import org.lamsfoundation.lams.util.MessageService; import org.lamsfoundation.lams.util.WebUtil; import org.lamsfoundation.lams.web.action.LamsDispatchAction; import org.lamsfoundation.lams.web.util.AttributeNames; +import org.springframework.web.context.WebApplicationContext; +import org.springframework.web.context.support.WebApplicationContextUtils; /** @@ -70,21 +74,15 @@ * path="/monitoring" * parameter="method" * scope="request" + * validate="false" * name="SbmtMonitoringForm" * - * @struts.action-forward name="userlist" path="/monitoring/monitoring.jsp" - * @struts.action-forward name="userMarks" path="/monitoring/monitoring.jsp" - * @struts.action-forward name="updateMarks" path="/monitoring/monitoring.jsp" - * @struts.action-forward name="allUserMarks" path="/monitoring/monitoring.jsp" + * @struts.action-forward name="listMark" path="/monitoring/mark/mark.jsp" + * @struts.action-forward name="updateMark" path="/monitoring/mark/updatemark.jsp" + * @struts.action-forward name="listAllMarks" path="/monitoring/mark/allmarks.jsp" * - * @struts.action-forward name="instructions" path="/monitoring/monitoring.jsp" - * @struts.action-forward name="showActivity" path="/monitoring/monitoring.jsp" * @struts.action-forward name="success" path="/monitoring/monitoring.jsp" - * @struts.action-forward name="load" path="/monitoring/monitoring.jsp" * - * @struts.action-forward name="statistic" path="/monitoring/monitoring.jsp" - * - * */ public class MonitoringAction extends LamsDispatchAction { @@ -93,8 +91,6 @@ /** * Default ActionForward for Monitor - * (non-Javadoc) - * @see org.apache.struts.actions.DispatchAction#unspecified(org.apache.struts.action.ActionMapping, org.apache.struts.action.ActionForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) */ public ActionForward unspecified( ActionMapping mapping, @@ -103,42 +99,23 @@ HttpServletResponse response) { Long contentID =new Long(WebUtil.readLongParam(request,AttributeNames.PARAM_TOOL_CONTENT_ID)); - request.getSession().setAttribute(AttributeNames.PARAM_TOOL_CONTENT_ID,contentID); - - return doTabs(mapping, form, request, response); - } - - private ActionForward doTabs(ActionMapping mapping, - ActionForm form, - HttpServletRequest request, - HttpServletResponse response) { - this.userList(mapping, form, request, response); - this.instructions(mapping, form, request, response); - this.showActivity(mapping, form, request, response); - this.statistic(mapping, form, request, response); - - return mapping.findForward("load"); - } - - /** - * List all user for monitor staff choose which user need to do report marking. - * It is first step to do report marking. - * @param mapping - * @param form - * @param request - * @param response - * @return - */ - public ActionForward userList(ActionMapping mapping, - ActionForm form, - HttpServletRequest request, - HttpServletResponse response){ - //Long sessionID =new Long(WebUtil.readLongParam(request,AttributeNames.PARAM_TOOL_SESSION_ID)); - Long contentID = (Long) request.getSession().getAttribute(AttributeNames.PARAM_TOOL_CONTENT_ID); - submitFilesService = getSubmitFilesService(); - //List userList = submitFilesService.getUsers(sessionID); + submitFilesService = getSubmitFilesService(); + +// List userList = submitFilesService.getUsers(sessionID); List submitFilesSessionList = submitFilesService.getSubmitFilesSessionByContentID(contentID); - Map sessionUserMap = new HashMap(); + Map sessionUserMap = new TreeMap(new Comparator(){ + public int compare(SessionDTO o1, SessionDTO o2) { + if(o1 != null && o2 != null){ + int c = o1.getSessionName().compareTo(o2.getSessionName()); + //to ensure session can be put into map even they have duplicated name. + return c==0?1:c; + }else if(o1 != null) + return 1; + else + return -1; + } + + }); //build a map with all users in the submitFilesSessionList Iterator it = submitFilesSessionList.iterator(); @@ -156,134 +133,66 @@ //request.setAttribute(AttributeNames.PARAM_TOOL_SESSION_ID,sessionID); request.setAttribute("sessionUserMap",sessionUserMap); - return mapping.findForward("userlist"); - } - /** - * Display special user's marks information. - * @param mapping - * @param form - * @param request - * @param response - * @return - */ - public ActionForward getFilesUploadedByUser(ActionMapping mapping, - ActionForm form, - HttpServletRequest request, - HttpServletResponse response){ - Long sessionID =new Long(WebUtil.readLongParam(request,AttributeNames.PARAM_TOOL_SESSION_ID)); - Long userID = new Long(WebUtil.readLongParam(request,"userID")); + Map sessionStatisticMap = new HashMap(); - submitFilesService = getSubmitFilesService(); - //return FileDetailsDTO list according to the given userID and sessionID - List files = submitFilesService.getFilesUploadedByUser(userID,sessionID); - UserDTO userDto = submitFilesService.getUserDetails(userID); + // build a map with all users in the submitFilesSessionList + it = submitFilesSessionList.iterator(); + while (it.hasNext()) { + + SubmitFilesSession sfs = (SubmitFilesSession) it.next(); + Long sessionID = sfs.getSessionID(); + String sessionName = sfs.getSessionName(); + + //return FileDetailsDTO list according to the given sessionID + Map userFilesMap = submitFilesService.getFilesUploadedBySession(sessionID); + Iterator iter = userFilesMap.values().iterator(); + Iterator dtoIter; + int notMarkedCount = 0; + int markedCount = 0; + while(iter.hasNext()){ + List list = (List) iter.next(); + dtoIter = list.iterator(); + while(dtoIter.hasNext()){ + FileDetailsDTO dto = (FileDetailsDTO) dtoIter.next(); + if(dto.getMarks() == null) + notMarkedCount++; + else + markedCount++; + } + } + StatisticDTO statisticDto = new StatisticDTO(); + SessionDTO sessionDto = new SessionDTO(); + statisticDto.setMarkedCount(markedCount); + statisticDto.setNotMarkedCount(notMarkedCount); + statisticDto.setTotalUploadedFiles(markedCount+notMarkedCount); + sessionDto.setSessionID(sessionID); + sessionDto.setSessionName(sessionName); + sessionStatisticMap.put(sessionDto,statisticDto); + } + + request.setAttribute("statisticList",sessionStatisticMap); - request.setAttribute(AttributeNames.PARAM_TOOL_SESSION_ID,sessionID); - request.setAttribute("user",userDto); - request.setAttribute("userReport",files); + //instruction + SubmitFilesContent persistContent = submitFilesService.getSubmitFilesContent(contentID); + //if this content does not exist, then reset the contentID to current value to keep it on HTML page. + persistContent.setContentID(contentID); - setTab(request); - doTabs(mapping, form, request, response); - return mapping.findForward("userMarks"); - } + AuthoringDTO authorDto = new AuthoringDTO(persistContent); + request.setAttribute(SbmtConstants.AUTHORING_DTO,authorDto); + request.setAttribute(SbmtConstants.PAGE_EDITABLE, new Boolean(SbmtWebUtils.isSbmtEditable(persistContent))); + + return mapping.findForward("success"); + } + + /** - * Display update mark initial page. + * Release mark * @param mapping * @param form * @param request * @param response * @return */ - public ActionForward markFile(ActionMapping mapping, - ActionForm form, - HttpServletRequest request, - HttpServletResponse response){ - - Long sessionID =new Long(WebUtil.readLongParam(request,AttributeNames.PARAM_TOOL_SESSION_ID)); - Long userID = new Long(WebUtil.readLongParam(request,"userID")); - Long detailID = new Long(WebUtil.readLongParam(request,"detailID")); - - submitFilesService = getSubmitFilesService(); - - request.setAttribute(AttributeNames.PARAM_TOOL_SESSION_ID,sessionID); - request.setAttribute("user",submitFilesService.getUserDetails(userID)); - request.setAttribute("fileDetails",submitFilesService.getFileDetails(detailID)); - - setTab(request); - doTabs(mapping, form, request, response); - return mapping.findForward("updateMarks"); - } - - public ActionForward updateMarks(ActionMapping mapping, - ActionForm form, - HttpServletRequest request, - HttpServletResponse response){ - //check whether the mark is validate - Long marks = null; - DynaActionForm sbmtMonitoringForm = (DynaActionForm) form; - - ActionMessages errors = new ActionMessages(); - try { - marks = new Long(WebUtil.readLongParam(request,"marks")); - } catch (IllegalArgumentException e) { - errors.add(ActionMessages.GLOBAL_MESSAGE,new ActionMessage("errors.mark.invalid.number")); - } - //if marks is invalid long, then throw error message directly. - String comments = WebUtil.readStrParam(request,"comments",true); - if(!errors.isEmpty()){ - //to echo back to error page. - FileDetailsDTO details = (FileDetailsDTO) request.getAttribute("fileDetails"); - if(details != null) - details.setComments(comments); - saveErrors(request,errors); - - setTab(request); - doTabs(mapping, form, request, response); - sbmtMonitoringForm.set("method", "markFile"); - return mapping.findForward("updateMarks"); - } - - //get other request parameters - String reportIDStr = request.getParameter("reportID"); - Long reportID = new Long(-1); - if(!StringUtils.isEmpty(reportIDStr)) - reportID = Long.valueOf(reportIDStr); - - Long sessionID =new Long(WebUtil.readLongParam(request,AttributeNames.PARAM_TOOL_SESSION_ID)); - Long userID = new Long(WebUtil.readLongParam(request,"userID")); - - //get service then update report table - submitFilesService = getSubmitFilesService(); - - submitFilesService.updateMarks(reportID,marks,comments); - List report = submitFilesService.getFilesUploadedByUser(userID,sessionID); - request.setAttribute("userReport",report); - request.setAttribute(AttributeNames.PARAM_TOOL_SESSION_ID,sessionID); - UserDTO userDto = submitFilesService.getUserDetails(userID); - request.setAttribute("user",userDto); - - setTab(request); - doTabs(mapping, form, request, response); - return mapping.findForward("userMarks"); - } - public ActionForward viewAllMarks(ActionMapping mapping, - ActionForm form, - HttpServletRequest request, - HttpServletResponse response){ - - Long sessionID =new Long(WebUtil.readLongParam(request,AttributeNames.PARAM_TOOL_SESSION_ID)); - submitFilesService = getSubmitFilesService(); - //return FileDetailsDTO list according to the given sessionID - Map userFilesMap = submitFilesService.getFilesUploadedBySession(sessionID); - request.setAttribute(AttributeNames.PARAM_TOOL_SESSION_ID,sessionID); -// request.setAttribute("user",submitFilesService.getUserDetails(userID)); - request.setAttribute("report",userFilesMap); - - setTab(request); - doTabs(mapping, form, request, response); - return mapping.findForward("allUserMarks"); - - } public ActionForward releaseMarks(ActionMapping mapping, ActionForm form, HttpServletRequest request, @@ -294,11 +203,23 @@ Long sessionID =new Long(WebUtil.readLongParam(request,AttributeNames.PARAM_TOOL_SESSION_ID)); submitFilesService.releaseMarksForSession(sessionID); - setTab(request); + try { + PrintWriter out = response.getWriter(); + out.write(getMessageService().getMessage("msg.mark.released")); + out.flush(); + } catch (IOException e) { + } - //echo message back - return doTabs(mapping, form, request, response); + return null; } + /** + * Download submit file marks by MS Excel file format. + * @param mapping + * @param form + * @param request + * @param response + * @return + */ public ActionForward downloadMarks(ActionMapping mapping, ActionForm form, HttpServletRequest request, @@ -309,7 +230,7 @@ //return FileDetailsDTO list according to the given sessionID Map userFilesMap = submitFilesService.getFilesUploadedBySession(sessionID); //construct Excel file format and download - ActionMessages errors = new ActionMessages(); + String errors = null; try { //create an empty excel file HSSFWorkbook wb = new HSSFWorkbook(); @@ -380,154 +301,174 @@ byte[] data = bos.toByteArray(); response.getOutputStream().write(data,0,data.length); response.getOutputStream().flush(); - } catch (IOException e) { + } catch (Exception e) { log.error(e); - errors.add(ActionMessages.GLOBAL_MESSAGE,new ActionMessage("monitoring.download.error",e.toString())); + errors =new ActionMessage("monitoring.download.error",e.toString()).toString(); } - if(!errors.isEmpty()){ - saveErrors(request,errors); - request.setAttribute(AttributeNames.PARAM_TOOL_SESSION_ID,sessionID); - setTab(request); - doTabs(mapping, form, request, response); - return mapping.findForward("userlist"); + if(errors != null){ + try { + PrintWriter out = response.getWriter(); + out.write(errors); + out.flush(); + } catch (IOException e) { + } } return null; } + //********************************************************** + // Mark udpate/view methods + //********************************************************** /** - * Display online/offline instruction information from Authoring. This page is read-only. + * Display special user's marks information. * @param mapping * @param form * @param request * @param response * @return */ - public ActionForward instructions(ActionMapping mapping, - ActionForm form, - HttpServletRequest request, - HttpServletResponse response){ + public ActionForward listMark(ActionMapping mapping, + ActionForm form, + HttpServletRequest request, + HttpServletResponse response){ + Long sessionID =new Long(WebUtil.readLongParam(request,AttributeNames.PARAM_TOOL_SESSION_ID)); + Long userID = new Long(WebUtil.readLongParam(request,"userID")); + + submitFilesService = getSubmitFilesService(); + //return FileDetailsDTO list according to the given userID and sessionID + List files = submitFilesService.getFilesUploadedByUser(userID,sessionID); - Long contentID = new Long(WebUtil.readLongParam(request,AttributeNames.PARAM_TOOL_CONTENT_ID)); - - //get back the upload file list and display them on page - submitFilesService = SubmitFilesServiceProxy.getSubmitFilesService(this - .getServlet().getServletContext()); - - SubmitFilesContent persistContent = submitFilesService.getSubmitFilesContent(contentID); - //if this content does not exist, then reset the contentID to current value to keep it on HTML page. - persistContent.setContentID(contentID); - - AuthoringDTO authorDto = new AuthoringDTO(persistContent); - request.setAttribute(SbmtConstants.AUTHORING_DTO,authorDto); - return mapping.findForward("instructions"); + request.setAttribute(AttributeNames.PARAM_TOOL_SESSION_ID,sessionID); + request.setAttribute("report",files); + return mapping.findForward("listMark"); } /** - * Display acitivty from authoring. The information will be same with "Basic" tab in authoring page. - * This page is read-only. + * Display update mark initial page. * @param mapping * @param form * @param request * @param response * @return */ - public ActionForward showActivity(ActionMapping mapping, - ActionForm form, - HttpServletRequest request, - HttpServletResponse response){ - - Long contentID = new Long(WebUtil.readLongParam(request,AttributeNames.PARAM_TOOL_CONTENT_ID)); - getAuthoringActivity(contentID, request); - return mapping.findForward("showActivity"); + public ActionForward newMark(ActionMapping mapping, + ActionForm form, + HttpServletRequest request, + HttpServletResponse response){ + + Long sessionID =new Long(WebUtil.readLongParam(request,AttributeNames.PARAM_TOOL_SESSION_ID)); + Long userID = new Long(WebUtil.readLongParam(request,"userID")); + Long detailID = new Long(WebUtil.readLongParam(request,"detailID")); + String updateMode = request.getParameter("updateMode"); + + setMarkPage(request, sessionID, userID, detailID, updateMode); + return mapping.findForward("updateMark"); } + + + /** - * Provide statistic information. Includes:
- *
  • Files not marked
  • - *
  • Files marked
  • - *
  • Total Files
  • + * Update mark. * @param mapping * @param form * @param request * @param response * @return */ - public ActionForward statistic(ActionMapping mapping, - ActionForm form, - HttpServletRequest request, - HttpServletResponse response){ - Long contentID = new Long(WebUtil.readLongParam(request, AttributeNames.PARAM_TOOL_CONTENT_ID)); + public ActionForward updateMark(ActionMapping mapping, + ActionForm form, + HttpServletRequest request, + HttpServletResponse response){ + Long sessionID =new Long(WebUtil.readLongParam(request,AttributeNames.PARAM_TOOL_SESSION_ID)); + Long userID = new Long(WebUtil.readLongParam(request,"userID")); + Long detailID = new Long(WebUtil.readLongParam(request,"detailID")); + String updateMode = request.getParameter("updateMode"); + Long reportID= new Long(WebUtil.readLongParam(request,"reportID")); + + //check whether the mark is validate + Long marks = null; + ActionMessages errors = new ActionMessages(); + try { + marks = new Long(WebUtil.readLongParam(request,"marks")); + } catch (IllegalArgumentException e) { + errors.add(ActionMessages.GLOBAL_MESSAGE,new ActionMessage("errors.mark.invalid.number")); + } + //if marks is invalid long, then throw error message directly. + String comments = WebUtil.readStrParam(request,"comments",true); + if(!errors.isEmpty()){ + setMarkPage(request, sessionID, userID, detailID, updateMode); + //to echo back to error page. + FileDetailsDTO details = (FileDetailsDTO) request.getAttribute("report"); + if(details != null) + details.setComments(comments); + saveErrors(request,errors); + return mapping.findForward("updateMark"); + } + + //get service then update report table submitFilesService = getSubmitFilesService(); - // List userList = submitFilesService.getUsers(sessionID); - List submitFilesSessionList = submitFilesService.getSubmitFilesSessionByContentID(contentID); - Map sessionStatisticMap = new HashMap(); - - // build a map with all users in the submitFilesSessionList - Iterator it = submitFilesSessionList.iterator(); - while (it.hasNext()) { - - SubmitFilesSession sfs = (SubmitFilesSession) it.next(); - Long sessionID = sfs.getSessionID(); - String sessionName = sfs.getSessionName(); - - submitFilesService = getSubmitFilesService(); - //return FileDetailsDTO list according to the given sessionID - Map userFilesMap = submitFilesService.getFilesUploadedBySession(sessionID); - Iterator iter = userFilesMap.values().iterator(); - Iterator dtoIter; - int notMarkedCount = 0; - int markedCount = 0; - while(iter.hasNext()){ - List list = (List) iter.next(); - dtoIter = list.iterator(); - while(dtoIter.hasNext()){ - FileDetailsDTO dto = (FileDetailsDTO) dtoIter.next(); - if(dto.getMarks() == null) - notMarkedCount++; - else - markedCount++; - } - } - StatisticDTO statisticDto = new StatisticDTO(); - SessionDTO sessionDto = new SessionDTO(); - statisticDto.setMarkedCount(markedCount); - statisticDto.setNotMarkedCount(notMarkedCount); - statisticDto.setTotalUploadedFiles(markedCount+notMarkedCount); - sessionDto.setSessionID(sessionID); - sessionDto.setSessionName(sessionName); - sessionStatisticMap.put(sessionDto,statisticDto); + + submitFilesService.updateMarks(reportID,marks,comments); + + if(StringUtils.equals(updateMode, "listMark")){ + List report = submitFilesService.getFilesUploadedByUser(userID,sessionID); + request.setAttribute("report",report); + request.setAttribute(AttributeNames.PARAM_TOOL_SESSION_ID,sessionID); + return mapping.findForward("listMark"); + }else{ + Map report = submitFilesService.getFilesUploadedBySession(sessionID); + request.setAttribute("reports",report); + return mapping.findForward("listAllMarks"); } - - request.setAttribute("statisticList",sessionStatisticMap); - return mapping.findForward("statistic"); } /** - * @param request + * View mark of all learner from same tool content ID. + * @param mapping * @param form * @param request + * @param response + * @return */ - private void getAuthoringActivity(Long contentID, ServletRequest request) { + public ActionForward listAllMarks(ActionMapping mapping, + ActionForm form, + HttpServletRequest request, + HttpServletResponse response){ - //get back the upload file list and display them on page - submitFilesService = SubmitFilesServiceProxy.getSubmitFilesService(this - .getServlet().getServletContext()); + Long sessionID =new Long(WebUtil.readLongParam(request,AttributeNames.PARAM_TOOL_SESSION_ID)); + submitFilesService = getSubmitFilesService(); + //return FileDetailsDTO list according to the given sessionID + Map userFilesMap = submitFilesService.getFilesUploadedBySession(sessionID); + request.setAttribute(AttributeNames.PARAM_TOOL_SESSION_ID,sessionID); +// request.setAttribute("user",submitFilesService.getUserDetails(userID)); + request.setAttribute("reports",userFilesMap); - SubmitFilesContent persistContent = submitFilesService.getSubmitFilesContent(contentID); - //if this content does not exist, then reset the contentID to current value to keep it on HTML page. - persistContent.setContentID(contentID); - AuthoringDTO authorDto = new AuthoringDTO(persistContent); - request.setAttribute(SbmtConstants.AUTHORING_DTO,authorDto); - - request.setAttribute(SbmtConstants.PAGE_EDITABLE, new Boolean(SbmtWebUtils.isSbmtEditable(persistContent))); - } + return mapping.findForward("listAllMarks"); + + } + //********************************************************** + // Private methods + //********************************************************** + private ISubmitFilesService getSubmitFilesService(){ return SubmitFilesServiceProxy .getSubmitFilesService(this.getServlet() .getServletContext()); } - private void setTab(HttpServletRequest request) { - String currTab = request.getParameter("currentTab"); - request.setAttribute("currentTab",currTab); + /** + * Return ResourceService bean. + */ + private MessageService getMessageService() { + WebApplicationContext wac = WebApplicationContextUtils.getRequiredWebApplicationContext(getServlet().getServletContext()); + return (MessageService) wac.getBean("sbmtMessageService"); + } + private void setMarkPage(HttpServletRequest request, Long sessionID, Long userID, Long detailID, String updateMode) { + submitFilesService = getSubmitFilesService(); + + request.setAttribute(AttributeNames.PARAM_TOOL_SESSION_ID,sessionID); + List report = new ArrayList(); + report.add(submitFilesService.getFileDetails(detailID)); + request.setAttribute("report",report); + request.setAttribute("updateMode", updateMode); } - } Index: lams_tool_sbmt/web/WEB-INF/lams.tld =================================================================== RCS file: /usr/local/cvsroot/lams_tool_sbmt/web/WEB-INF/Attic/lams.tld,v diff -u -r1.7 -r1.8 --- lams_tool_sbmt/web/WEB-INF/lams.tld 6 Jul 2006 04:36:06 -0000 1.7 +++ lams_tool_sbmt/web/WEB-INF/lams.tld 1 Aug 2006 07:10:12 -0000 1.8 @@ -310,5 +310,8 @@ ExportPortOutput /WEB-INF/tags/ExportPortOutput.tag - + + DefineLater + /WEB-INF/tags/DefineLater.tag + 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.30 -r1.31 --- lams_tool_sbmt/web/WEB-INF/struts/struts-config.xml 25 Jul 2006 04:41:59 -0000 1.30 +++ lams_tool_sbmt/web/WEB-INF/struts/struts-config.xml 1 Aug 2006 07:10:12 -0000 1.31 @@ -118,53 +118,28 @@ scope="request" parameter="method" unknown="false" - validate="true" + validate="false" > - - - - - + */ +%> + +<%@ tag body-content="scriptless" %> +<%@ taglib uri="tags-fmt" prefix="fmt" %> +<%@ taglib uri="tags-core" prefix="c" %> + +<%@ attribute name="defineLaterMessageKey" required="false" rtexprvalue="true" %> +<%@ attribute name="buttonTryAgainKey" required="false" rtexprvalue="true" %> + +<%-- Default value for I18N keys --%> + + + + + + + +

     

    + +

    + +

    + +
    Index: lams_tool_sbmt/web/images/indicator.gif =================================================================== RCS file: /usr/local/cvsroot/lams_tool_sbmt/web/images/indicator.gif,v diff -u Binary files differ Fisheye: Tag 1.13 refers to a dead (removed) revision in file `lams_tool_sbmt/web/monitoring/alluserlist.jsp'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.9 refers to a dead (removed) revision in file `lams_tool_sbmt/web/monitoring/instructions.jsp'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.5 refers to a dead (removed) revision in file `lams_tool_sbmt/web/monitoring/marking.jsp'. Fisheye: No comparison available. Pass `N' to diff? Index: lams_tool_sbmt/web/monitoring/monitoring.jsp =================================================================== RCS file: /usr/local/cvsroot/lams_tool_sbmt/web/monitoring/monitoring.jsp,v diff -u -r1.9 -r1.10 --- lams_tool_sbmt/web/monitoring/monitoring.jsp 29 Jun 2006 08:07:01 -0000 1.9 +++ lams_tool_sbmt/web/monitoring/monitoring.jsp 1 Aug 2006 07:10:12 -0000 1.10 @@ -3,13 +3,6 @@ <%@include file="/common/taglibs.jsp"%> - - - - - - - <fmt:message key="activity.title" /> @@ -20,7 +13,7 @@ var themeName="aqua"; function init(){ - initTabSize(5); + initTabSize(4); var tag = document.getElementById("currentTab"); if(tag.value != "") @@ -49,9 +42,7 @@ return true; } - function doSubmit(method, tabId) { - if(tabId != null) - document.SbmtMonitoringForm.currentTab.value=tabId; + function doSubmit(method) { document.SbmtMonitoringForm.method.value=method; document.SbmtMonitoringForm.submit(); } @@ -69,58 +60,32 @@ -
    - + - + - + - - - - - + - + + - - - - - - - - - - - - - - - - -

    - - - -

    Fisheye: Tag 1.10 refers to a dead (removed) revision in file `lams_tool_sbmt/web/monitoring/showactivity.jsp'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.8 refers to a dead (removed) revision in file `lams_tool_sbmt/web/monitoring/statistic.jsp'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.11 refers to a dead (removed) revision in file `lams_tool_sbmt/web/monitoring/updatemarks.jsp'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.11 refers to a dead (removed) revision in file `lams_tool_sbmt/web/monitoring/usermarkslist.jsp'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.12 refers to a dead (removed) revision in file `lams_tool_sbmt/web/monitoring/viewallmarks.jsp'. Fisheye: No comparison available. Pass `N' to diff? Index: lams_tool_sbmt/web/monitoring/mark/allmarks.jsp =================================================================== RCS file: /usr/local/cvsroot/lams_tool_sbmt/web/monitoring/mark/allmarks.jsp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ lams_tool_sbmt/web/monitoring/mark/allmarks.jsp 1 Aug 2006 07:10:12 -0000 1.1 @@ -0,0 +1,33 @@ + + +<%@include file="/common/taglibs.jsp"%> + + + <fmt:message key="activity.title" /> + + + + + + + + + <%@include file="filelist.jsp"%> + + + + + +
    + + + +
    + + \ No newline at end of file Index: lams_tool_sbmt/web/monitoring/mark/fileinfo.jsp =================================================================== RCS file: /usr/local/cvsroot/lams_tool_sbmt/web/monitoring/mark/fileinfo.jsp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ lams_tool_sbmt/web/monitoring/mark/fileinfo.jsp 1 Aug 2006 07:10:12 -0000 1.1 @@ -0,0 +1,56 @@ + + + + + + , + + , + + : + + + + + + + + : + + + + + + +   + + + + + + + + + + : + + + + + + + + + + + + + + + + : + + + + + \ No newline at end of file Index: lams_tool_sbmt/web/monitoring/mark/filelist.jsp =================================================================== RCS file: /usr/local/cvsroot/lams_tool_sbmt/web/monitoring/mark/filelist.jsp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ lams_tool_sbmt/web/monitoring/mark/filelist.jsp 1 Aug 2006 07:10:12 -0000 1.1 @@ -0,0 +1,43 @@ +<%@include file="fileinfo.jsp"%> + + + + : + + + + + + + + + + + + + + + + : + + + + + + + + + + + + + + + + + + +
    + + Index: lams_tool_sbmt/web/monitoring/mark/mark.jsp =================================================================== RCS file: /usr/local/cvsroot/lams_tool_sbmt/web/monitoring/mark/mark.jsp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ lams_tool_sbmt/web/monitoring/mark/mark.jsp 1 Aug 2006 07:10:12 -0000 1.1 @@ -0,0 +1,32 @@ + + +<%@include file="/common/taglibs.jsp"%> + + + <fmt:message key="activity.title" /> + + + + + + + + + <%@include file="filelist.jsp"%> + + + + +
    + + + +
    + + \ No newline at end of file Index: lams_tool_sbmt/web/monitoring/mark/updatemark.jsp =================================================================== RCS file: /usr/local/cvsroot/lams_tool_sbmt/web/monitoring/mark/updatemark.jsp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ lams_tool_sbmt/web/monitoring/mark/updatemark.jsp 1 Aug 2006 07:10:12 -0000 1.1 @@ -0,0 +1,60 @@ + + +<%@include file="/common/taglibs.jsp"%> + + + <fmt:message key="activity.title" /> + + + + + + + +
    + + + + + + + + <%@include file="fileinfo.jsp"%> + + + + + + + + + + + + + + +
    + +
    + + + > +
    + + +
    + + + +    + + + +
    +
    +
    + + \ No newline at end of file Index: lams_tool_sbmt/web/monitoring/parts/activity.jsp =================================================================== RCS file: /usr/local/cvsroot/lams_tool_sbmt/web/monitoring/parts/activity.jsp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ lams_tool_sbmt/web/monitoring/parts/activity.jsp 1 Aug 2006 07:10:12 -0000 1.1 @@ -0,0 +1,47 @@ +<%@ include file="/common/taglibs.jsp"%> + + + + + + + + + + + + + + + + + + + + + + + +
    + + : + + +
    + + : + + +
    + + + + + + + + +

    + +

    +
    Index: lams_tool_sbmt/web/monitoring/parts/instructions.jsp =================================================================== RCS file: /usr/local/cvsroot/lams_tool_sbmt/web/monitoring/parts/Attic/instructions.jsp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ lams_tool_sbmt/web/monitoring/parts/instructions.jsp 1 Aug 2006 07:10:12 -0000 1.1 @@ -0,0 +1,78 @@ +<%@ include file="/common/taglibs.jsp"%> + + + + + + + + + + + + + + + +
    + + : +
    + +
    + + : +
    +
      + +
    • + + + + + + + +
    • +
      +
    +
    + +
    + + + + + + + + + + + + + + +
    + + : +
    + +
    + + : +
    +
      + +
    • + + + + + + + +
    • +
      +
    +
    Index: lams_tool_sbmt/web/monitoring/parts/statistic.jsp =================================================================== RCS file: /usr/local/cvsroot/lams_tool_sbmt/web/monitoring/parts/statistic.jsp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ lams_tool_sbmt/web/monitoring/parts/statistic.jsp 1 Aug 2006 07:10:12 -0000 1.1 @@ -0,0 +1,37 @@ +<%@ include file="/common/taglibs.jsp"%> + + + + + + + + + + + + + + + + + + + + +
    + : +
    + + + +
    + + + +
    + + + +
    +
    Index: lams_tool_sbmt/web/monitoring/parts/summary.jsp =================================================================== RCS file: /usr/local/cvsroot/lams_tool_sbmt/web/monitoring/parts/summary.jsp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ lams_tool_sbmt/web/monitoring/parts/summary.jsp 1 Aug 2006 07:10:12 -0000 1.1 @@ -0,0 +1,124 @@ +<%@include file="/common/taglibs.jsp"%> + + + + + + + + + + + +
    + + +
    + + + + + + + + + + + + + + + + + + + + + + + + +
    : +
    + + + +
    +
    + + + + + +
    +