Index: lams_tool_lamc/conf/language/lams/ApplicationResources_en_AU.properties =================================================================== diff -u -r7041e49ed13e7dd50bd59642d0218d364866ff0a -r87ff0b33fa2d006a084b2ae9b7ff14d4c4be0f6d --- lams_tool_lamc/conf/language/lams/ApplicationResources_en_AU.properties (.../ApplicationResources_en_AU.properties) (revision 7041e49ed13e7dd50bd59642d0218d364866ff0a) +++ lams_tool_lamc/conf/language/lams/ApplicationResources_en_AU.properties (.../ApplicationResources_en_AU.properties) (revision 87ff0b33fa2d006a084b2ae9b7ff14d4c4be0f6d) @@ -153,7 +153,6 @@ error.content.locked =The content has been locked since it is being used by one mor more learners.
The modification of the content is not allowed. error.content.inUse =modification of the content is not allowed since one or more learners has attempted the activity. error.noLearnerActivity =Summary report is not available since no users attempted the activity yet. -label.answers =Answers: button.endLearning =Next Activity label.learning.user =User label.learning.attemptTime =Attempt Date/Time @@ -211,7 +210,8 @@ label.tip.editQuestion =Enables editing of question candidates.none.correct =Please fix this: There must be 1 correct candidate answer out of at least 2 candidate answers. count.finished.session =Finished Session Count: -label.add.candidates =Answers +label.add.candidates =Add blank answer +label.answers =Answers label.add.new.question =Add label.marks =mark(s) label.new.question =New Question @@ -228,7 +228,6 @@ questions.none.submitted =No questions submitted. Please add at least one question. label.edit.question =Edit Question label.feedback.simple =Feedback: -candidates.duplicate.correct =Please fix this: There must be one and only one correct candidate answer. label.group.results =Group's top and average marks candidates.groupSize.warning =Please fix this: There must be at least 2 candidate answers. candidates.unremovable.groupSize =The candidate answer can not be removed since there must be at least 2 candidate answers. Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/AuthoringUtil.java =================================================================== diff -u -r9a2c06691bf5157039ae82f36ec2f84c32eda8cb -r87ff0b33fa2d006a084b2ae9b7ff14d4c4be0f6d --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/AuthoringUtil.java (.../AuthoringUtil.java) (revision 9a2c06691bf5157039ae82f36ec2f84c32eda8cb) +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/AuthoringUtil.java (.../AuthoringUtil.java) (revision 87ff0b33fa2d006a084b2ae9b7ff14d4c4be0f6d) @@ -1346,29 +1346,6 @@ return false; } - protected boolean validateOnlyOneCorrectCandidate(List caList) { - int correctCandidatesCount = 0; - - Iterator itCaList = caList.iterator(); - while (itCaList.hasNext()) { - McCandidateAnswersDTO mcCandidateAnswersDTO = (McCandidateAnswersDTO) itCaList.next(); - - String candidateAnswer = mcCandidateAnswersDTO.getCandidateAnswer(); - String correct = mcCandidateAnswersDTO.getCorrect(); - - if (correct.equals("Correct")) { - // there is at leat one Correct candidate, it is good. - ++correctCandidatesCount; - } - } - - if (correctCandidatesCount > 1) { - return false; // not good - } - - return true; - } - /** * buildDefaultQuestionContent(McContent mcContent, IMcService mcService) * Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McAction.java =================================================================== diff -u -r8ddb4345fdfc8904e5a7ff156cc63053e63741ca -r87ff0b33fa2d006a084b2ae9b7ff14d4c4be0f6d --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McAction.java (.../McAction.java) (revision 8ddb4345fdfc8904e5a7ff156cc63053e63741ca) +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McAction.java (.../McAction.java) (revision 87ff0b33fa2d006a084b2ae9b7ff14d4c4be0f6d) @@ -151,8 +151,6 @@ Map mapWeights = new TreeMap(new McComparator()); - String totalMarks = request.getParameter("totalMarks"); - Map mapMarks = AuthoringUtil.extractMapMarks(listQuestionContentDTO); Map mapCandidatesList = AuthoringUtil.extractMapCandidatesList(listQuestionContentDTO); @@ -169,13 +167,9 @@ McGeneralAuthoringDTO mcGeneralAuthoringDTO = new McGeneralAuthoringDTO(); if (activeModule.equals(McAppConstants.AUTHORING)) { - List attachmentListBackup = new ArrayList(); List attachmentList = (List) sessionMap.get(McAppConstants.ATTACHMENT_LIST_KEY); - attachmentListBackup = attachmentList; - List deletedAttachmentListBackup = new ArrayList(); List deletedAttachmentList = (List) sessionMap.get(McAppConstants.DELETED_ATTACHMENT_LIST_KEY); - deletedAttachmentListBackup = deletedAttachmentList; String onlineInstructions = (String) sessionMap.get(McAppConstants.ONLINE_INSTRUCTIONS_KEY); mcGeneralAuthoringDTO.setOnlineInstructions(onlineInstructions); @@ -243,8 +237,6 @@ List attachmentList = (List) sessionMap.get(McAppConstants.ATTACHMENT_LIST_KEY); List deletedAttachmentList = (List) sessionMap.get(McAppConstants.DELETED_ATTACHMENT_LIST_KEY); - - List attachments = saveAttachments(mcContent, attachmentList, deletedAttachmentList, mapping, request); } McUtils.setDefineLater(request, false, strToolContentID, mcService); @@ -343,111 +335,44 @@ String editQuestionBoxRequest = request.getParameter("editQuestionBoxRequest"); - String totalMarks = request.getParameter("totalMarks"); - String mark = request.getParameter("mark"); String passmark = request.getParameter("passmark"); AuthoringUtil authoringUtil = new AuthoringUtil(); - boolean validateCandidateAnswersNotBlank = authoringUtil.validateCandidateAnswersNotBlank(request); - List caList = authoringUtil.repopulateCandidateAnswersBox(request, false); caList = AuthoringUtil.removeBlankEntries(caList); - boolean validateSingleCorrectCandidate = authoringUtil.validateSingleCorrectCandidate(caList); - - boolean validateOnlyOneCorrectCandidate = authoringUtil.validateOnlyOneCorrectCandidate(caList); - - ActionMessages errors = new ActionMessages(); - - if (!validateCandidateAnswersNotBlank) { - ActionMessage error = new ActionMessage("candidates.blank"); - errors.add(ActionMessages.GLOBAL_MESSAGE, error); - } - - if (!validateSingleCorrectCandidate) { - ActionMessage error = new ActionMessage("candidates.none.correct"); - errors.add(ActionMessages.GLOBAL_MESSAGE, error); - } - - if (!validateOnlyOneCorrectCandidate) { - ActionMessage error = new ActionMessage("candidates.duplicate.correct"); - errors.add(ActionMessages.GLOBAL_MESSAGE, error); - } - - if (!errors.isEmpty()) { - saveErrors(request, errors); - McAction.logger.debug("errors saved: " + errors); - } - List listQuestionContentDTO = (List) sessionMap.get(McAppConstants.LIST_QUESTION_CONTENT_DTO_KEY); McGeneralAuthoringDTO mcGeneralAuthoringDTO = new McGeneralAuthoringDTO(); mcGeneralAuthoringDTO.setMarkValue(mark); mcGeneralAuthoringDTO.setPassMarkValue(passmark); - if (errors.isEmpty()) { - McContent mcContent = mcService.retrieveMc(new Long(strToolContentID)); + mcGeneralAuthoringDTO.setContentFolderID(contentFolderID); - mcGeneralAuthoringDTO.setContentFolderID(contentFolderID); + mcGeneralAuthoringDTO.setSbmtSuccess(new Integer(0).toString()); - mcGeneralAuthoringDTO.setSbmtSuccess(new Integer(0).toString()); + String newQuestion = request.getParameter("newQuestion"); - String newQuestion = request.getParameter("newQuestion"); + String feedback = request.getParameter("feedback"); - String feedback = request.getParameter("feedback"); + String editableQuestionIndex = request.getParameter("editableQuestionIndex"); + mcAuthoringForm.setQuestionIndex(editableQuestionIndex); - String editableQuestionIndex = request.getParameter("editableQuestionIndex"); - mcAuthoringForm.setQuestionIndex(editableQuestionIndex); + if ((newQuestion != null) && (newQuestion.length() > 0)) { + if ((editQuestionBoxRequest != null) && (editQuestionBoxRequest.equals("false"))) { + // request for add and save + boolean duplicates = AuthoringUtil.checkDuplicateQuestions(listQuestionContentDTO, newQuestion); - if ((newQuestion != null) && (newQuestion.length() > 0)) { - if ((editQuestionBoxRequest != null) && (editQuestionBoxRequest.equals("false"))) { - // request for add and save - boolean duplicates = AuthoringUtil.checkDuplicateQuestions(listQuestionContentDTO, newQuestion); - - if (!duplicates) { - McQuestionContentDTO mcQuestionContentDTO = null; - Iterator listIterator = listQuestionContentDTO.iterator(); - while (listIterator.hasNext()) { - mcQuestionContentDTO = (McQuestionContentDTO) listIterator.next(); - - String question = mcQuestionContentDTO.getQuestion(); - String displayOrder = mcQuestionContentDTO.getDisplayOrder(); - - if ((displayOrder != null) && (!displayOrder.equals(""))) { - if (displayOrder.equals(editableQuestionIndex)) { - break; - } - - } - } - - mcQuestionContentDTO.setQuestion(newQuestion); - mcQuestionContentDTO.setFeedback(feedback); - mcQuestionContentDTO.setDisplayOrder(editableQuestionIndex); - mcQuestionContentDTO.setListCandidateAnswersDTO(caList); - mcQuestionContentDTO.setMark(mark); - - mcQuestionContentDTO.setCaCount(new Integer(mcQuestionContentDTO.getListCandidateAnswersDTO() - .size()).toString()); - - listQuestionContentDTO = AuthoringUtil.reorderUpdateListQuestionContentDTO( - listQuestionContentDTO, mcQuestionContentDTO, editableQuestionIndex); - // post reorderUpdateListQuestionContentDTO listQuestionContentDTO - } else { - // duplicate question entry, not adding - } - } else { - // request for edit and save + if (!duplicates) { McQuestionContentDTO mcQuestionContentDTO = null; Iterator listIterator = listQuestionContentDTO.iterator(); while (listIterator.hasNext()) { mcQuestionContentDTO = (McQuestionContentDTO) listIterator.next(); - String question = mcQuestionContentDTO.getQuestion(); String displayOrder = mcQuestionContentDTO.getDisplayOrder(); if ((displayOrder != null) && (!displayOrder.equals(""))) { @@ -469,46 +394,55 @@ listQuestionContentDTO = AuthoringUtil.reorderUpdateListQuestionContentDTO(listQuestionContentDTO, mcQuestionContentDTO, editableQuestionIndex); + // post reorderUpdateListQuestionContentDTO listQuestionContentDTO + } else { + // duplicate question entry, not adding } } else { - // entry blank, not adding - } + // request for edit and save + McQuestionContentDTO mcQuestionContentDTO = null; + Iterator listIterator = listQuestionContentDTO.iterator(); + while (listIterator.hasNext()) { + mcQuestionContentDTO = (McQuestionContentDTO) listIterator.next(); - mcGeneralAuthoringDTO.setMarkValue(mark); + String displayOrder = mcQuestionContentDTO.getDisplayOrder(); - request.setAttribute(McAppConstants.LIST_QUESTION_CONTENT_DTO, listQuestionContentDTO); - sessionMap.put(McAppConstants.LIST_QUESTION_CONTENT_DTO_KEY, listQuestionContentDTO); + if ((displayOrder != null) && (!displayOrder.equals(""))) { + if (displayOrder.equals(editableQuestionIndex)) { + break; + } - commonSaveCode(request, mcGeneralAuthoringDTO, mcAuthoringForm, sessionMap, activeModule, strToolContentID, - defaultContentIdStr, mcService, httpSessionID, listQuestionContentDTO); + } + } - request.setAttribute(McAppConstants.TOTAL_QUESTION_COUNT, new Integer(listQuestionContentDTO.size())); + mcQuestionContentDTO.setQuestion(newQuestion); + mcQuestionContentDTO.setFeedback(feedback); + mcQuestionContentDTO.setDisplayOrder(editableQuestionIndex); + mcQuestionContentDTO.setListCandidateAnswersDTO(caList); + mcQuestionContentDTO.setMark(mark); - return (mapping.findForward(McAppConstants.LOAD_QUESTIONS)); + mcQuestionContentDTO.setCaCount(new Integer(mcQuestionContentDTO.getListCandidateAnswersDTO().size()) + .toString()); + + listQuestionContentDTO = AuthoringUtil.reorderUpdateListQuestionContentDTO(listQuestionContentDTO, + mcQuestionContentDTO, editableQuestionIndex); + } } else { - // errors is not empty + // entry blank, not adding + } - commonSaveCode(request, mcGeneralAuthoringDTO, mcAuthoringForm, sessionMap, activeModule, strToolContentID, - defaultContentIdStr, mcService, httpSessionID, listQuestionContentDTO); + mcGeneralAuthoringDTO.setMarkValue(mark); - // generating dyn pass map using listQuestionContentDTO - Map passMarksMap = authoringUtil.buildDynamicPassMarkMap(listQuestionContentDTO, false); - mcGeneralAuthoringDTO.setPassMarksMap(passMarksMap); + request.setAttribute(McAppConstants.LIST_QUESTION_CONTENT_DTO, listQuestionContentDTO); + sessionMap.put(McAppConstants.LIST_QUESTION_CONTENT_DTO_KEY, listQuestionContentDTO); - String totalMark = AuthoringUtil.getTotalMark(listQuestionContentDTO); - mcAuthoringForm.setTotalMarks(totalMark); - mcGeneralAuthoringDTO.setTotalMarks(totalMark); + commonSaveCode(request, mcGeneralAuthoringDTO, mcAuthoringForm, sessionMap, activeModule, strToolContentID, + defaultContentIdStr, mcService, httpSessionID, listQuestionContentDTO); - request.setAttribute(McAppConstants.MC_GENERAL_AUTHORING_DTO, mcGeneralAuthoringDTO); + request.setAttribute(McAppConstants.TOTAL_QUESTION_COUNT, new Integer(listQuestionContentDTO.size())); - request.setAttribute(McAppConstants.LIST_QUESTION_CONTENT_DTO, listQuestionContentDTO); - sessionMap.put(McAppConstants.LIST_QUESTION_CONTENT_DTO_KEY, listQuestionContentDTO); + return (mapping.findForward("itemList")); - request.setAttribute("requestNewEditableQuestionBox", new Boolean(true).toString()); - - return newEditableQuestionBox(mapping, form, request, response); - } - } /** @@ -716,17 +650,13 @@ String contentFolderID = WebUtil.readStrParam(request, AttributeNames.PARAM_CONTENT_FOLDER_ID); mcAuthoringForm.setContentFolderID(contentFolderID); - String totalMarks = request.getParameter("totalMarks"); - String activeModule = request.getParameter(McAppConstants.ACTIVE_MODULE); String strToolContentID = request.getParameter(AttributeNames.PARAM_TOOL_CONTENT_ID); String defaultContentIdStr = new Long(mcService.getToolDefaultContentIdBySignature(McAppConstants.MY_SIGNATURE)) .toString(); - McContent mcContent = mcService.retrieveMc(new Long(strToolContentID)); - McGeneralAuthoringDTO mcGeneralAuthoringDTO = new McGeneralAuthoringDTO(); mcGeneralAuthoringDTO.setContentFolderID(contentFolderID); @@ -738,8 +668,6 @@ List listAddableQuestionContentDTO = (List) sessionMap.get(McAppConstants.NEW_ADDABLE_QUESTION_CONTENT_KEY); - McQuestionContentDTO mcQuestionContentDTONew = null; - int listSize = listQuestionContentDTO.size(); request.setAttribute(McAppConstants.NEW_ADDABLE_QUESTION_CONTENT_LIST, listAddableQuestionContentDTO); @@ -754,79 +682,30 @@ String passmark = request.getParameter("passmark"); mcGeneralAuthoringDTO.setPassMarkValue(passmark); - boolean validateCandidateAnswersNotBlank = authoringUtil.validateCandidateAnswersNotBlank(request); - List caList = authoringUtil.repopulateCandidateAnswersBox(request, false); caList = AuthoringUtil.removeBlankEntries(caList); - boolean validateSingleCorrectCandidate = authoringUtil.validateSingleCorrectCandidate(caList); + if ((newQuestion != null) && (newQuestion.length() > 0)) { + boolean duplicates = AuthoringUtil.checkDuplicateQuestions(listQuestionContentDTO, newQuestion); - boolean validateOnlyOneCorrectCandidate = authoringUtil.validateOnlyOneCorrectCandidate(caList); + if (!duplicates) { + McQuestionContentDTO mcQuestionContentDTO = new McQuestionContentDTO(); + mcQuestionContentDTO.setDisplayOrder(new Long(listSize + 1).toString()); + mcQuestionContentDTO.setFeedback(feedback); + mcQuestionContentDTO.setQuestion(newQuestion); + mcQuestionContentDTO.setMark(mark); - ActionMessages errors = new ActionMessages(); + mcQuestionContentDTO.setListCandidateAnswersDTO(caList); + mcQuestionContentDTO.setCaCount(new Integer(mcQuestionContentDTO.getListCandidateAnswersDTO().size()) + .toString()); - if (!validateCandidateAnswersNotBlank) { - ActionMessage error = new ActionMessage("candidates.blank"); - errors.add(ActionMessages.GLOBAL_MESSAGE, error); - } - - if (!validateSingleCorrectCandidate) { - ActionMessage error = new ActionMessage("candidates.none.correct"); - errors.add(ActionMessages.GLOBAL_MESSAGE, error); - } - - if (!validateOnlyOneCorrectCandidate) { - ActionMessage error = new ActionMessage("candidates.duplicate.correct"); - errors.add(ActionMessages.GLOBAL_MESSAGE, error); - } - - if (!errors.isEmpty()) { - saveErrors(request, errors); - McAction.logger.debug("errors saved: " + errors); - } - - if (errors.isEmpty()) { - if ((newQuestion != null) && (newQuestion.length() > 0)) { - boolean duplicates = AuthoringUtil.checkDuplicateQuestions(listQuestionContentDTO, newQuestion); - - if (!duplicates) { - McQuestionContentDTO mcQuestionContentDTO = new McQuestionContentDTO(); - mcQuestionContentDTO.setDisplayOrder(new Long(listSize + 1).toString()); - mcQuestionContentDTO.setFeedback(feedback); - mcQuestionContentDTO.setQuestion(newQuestion); - mcQuestionContentDTO.setMark(mark); - - mcQuestionContentDTO.setListCandidateAnswersDTO(caList); - mcQuestionContentDTO.setCaCount(new Integer(mcQuestionContentDTO.getListCandidateAnswersDTO() - .size()).toString()); - - listQuestionContentDTO.add(mcQuestionContentDTO); - } else { - // entry duplicate, not adding - } + listQuestionContentDTO.add(mcQuestionContentDTO); } else { - // entry blank, not adding + // entry duplicate, not adding } } else { - // errors, not adding - - commonSaveCode(request, mcGeneralAuthoringDTO, mcAuthoringForm, sessionMap, activeModule, strToolContentID, - defaultContentIdStr, mcService, httpSessionID, listQuestionContentDTO); - - Map passMarksMap = authoringUtil.buildDynamicPassMarkMap(listQuestionContentDTO, false); - mcGeneralAuthoringDTO.setPassMarksMap(passMarksMap); - - String totalMark = AuthoringUtil.getTotalMark(listQuestionContentDTO); - mcAuthoringForm.setTotalMarks(totalMark); - mcGeneralAuthoringDTO.setTotalMarks(totalMark); - - request.setAttribute(McAppConstants.MC_GENERAL_AUTHORING_DTO, mcGeneralAuthoringDTO); - - request.setAttribute(McAppConstants.LIST_QUESTION_CONTENT_DTO, listQuestionContentDTO); - sessionMap.put(McAppConstants.LIST_QUESTION_CONTENT_DTO_KEY, listQuestionContentDTO); - - return newQuestionBox(mapping, form, request, response); + // entry blank, not adding } mcGeneralAuthoringDTO.setMarkValue(mark); @@ -852,7 +731,7 @@ request.setAttribute(McAppConstants.TOTAL_QUESTION_COUNT, new Integer(listQuestionContentDTO.size())); - return (mapping.findForward(McAppConstants.LOAD_QUESTIONS)); + return (mapping.findForward("itemList")); } /** @@ -879,8 +758,6 @@ String contentFolderID = WebUtil.readStrParam(request, AttributeNames.PARAM_CONTENT_FOLDER_ID); mcAuthoringForm.setContentFolderID(contentFolderID); - String totalMarks = request.getParameter("totalMarks"); - String activeModule = request.getParameter(McAppConstants.ACTIVE_MODULE); String strToolContentID = request.getParameter(AttributeNames.PARAM_TOOL_CONTENT_ID); @@ -990,8 +867,6 @@ String httpSessionID = mcAuthoringForm.getHttpSessionID(); - String totalMarks = request.getParameter("totalMarks"); - SessionMap sessionMap = (SessionMap) request.getSession().getAttribute(httpSessionID); String questionIndex = request.getParameter("questionIndex"); @@ -1009,7 +884,6 @@ Iterator listIterator = listQuestionContentDTO.iterator(); while (listIterator.hasNext()) { McQuestionContentDTO mcQuestionContentDTO = (McQuestionContentDTO) listIterator.next(); - String question = mcQuestionContentDTO.getQuestion(); String displayOrder = mcQuestionContentDTO.getDisplayOrder(); if ((displayOrder != null) && (!displayOrder.equals(""))) { @@ -1141,8 +1015,6 @@ String questionIndex = request.getParameter("questionIndex"); mcAuthoringForm.setQuestionIndex(questionIndex); - String totalMarks = request.getParameter("totalMarks"); - List listQuestionContentDTO = (List) sessionMap.get(McAppConstants.LIST_QUESTION_CONTENT_DTO_KEY); McQuestionContentDTO mcQuestionContentDTO = null; @@ -1252,7 +1124,7 @@ request.setAttribute(McAppConstants.MC_GENERAL_AUTHORING_DTO, mcGeneralAuthoringDTO); request.setAttribute(McAppConstants.TOTAL_QUESTION_COUNT, new Integer(listQuestionContentDTO.size())); - return (mapping.findForward(McAppConstants.LOAD_QUESTIONS)); + return (mapping.findForward("itemList")); } /** @@ -1281,8 +1153,6 @@ String questionIndex = request.getParameter("questionIndex"); mcAuthoringForm.setQuestionIndex(questionIndex); - String totalMarks = request.getParameter("totalMarks"); - List listQuestionContentDTO = (List) sessionMap.get(McAppConstants.LIST_QUESTION_CONTENT_DTO_KEY); listQuestionContentDTO = AuthoringUtil.swapNodes(listQuestionContentDTO, questionIndex, "down"); @@ -1372,7 +1242,7 @@ mcGeneralAuthoringDTO.setCorrectMap(correctMap); request.setAttribute(McAppConstants.MC_GENERAL_AUTHORING_DTO, mcGeneralAuthoringDTO); request.setAttribute(McAppConstants.TOTAL_QUESTION_COUNT, new Integer(listQuestionContentDTO.size())); - return (mapping.findForward(McAppConstants.LOAD_QUESTIONS)); + return (mapping.findForward("itemList")); } public ActionForward moveQuestionUp(ActionMapping mapping, ActionForm form, HttpServletRequest request, @@ -1483,7 +1353,7 @@ request.setAttribute(McAppConstants.TOTAL_QUESTION_COUNT, new Integer(listQuestionContentDTO.size())); - return (mapping.findForward(McAppConstants.LOAD_QUESTIONS)); + return (mapping.findForward("itemList")); } /** @@ -2025,66 +1895,51 @@ SessionMap sessionMap = (SessionMap) request.getSession().getAttribute(httpSessionID); String questionIndex = request.getParameter("questionIndex"); - mcAuthoringForm.setQuestionIndex(questionIndex); + request.setAttribute("questionIndex", questionIndex); + request.setAttribute(McAppConstants.CURRENT_EDITABLE_QUESTION_INDEX, questionIndex); String candidateIndex = request.getParameter("candidateIndex"); - mcAuthoringForm.setCandidateIndex(candidateIndex); + request.setAttribute("candidateIndex", candidateIndex); String totalMarks = request.getParameter("totalMarks"); AuthoringUtil authoringUtil = new AuthoringUtil(); - boolean validateCandidateAnswersNotBlank = authoringUtil.validateCandidateAnswersNotBlank(request); - - ActionMessages errors = new ActionMessages(); - - if (!validateCandidateAnswersNotBlank) { - ActionMessage error = new ActionMessage("candidates.blank"); - errors.add(ActionMessages.GLOBAL_MESSAGE, error); - } - - if (!errors.isEmpty()) { - saveErrors(request, errors); - } - List caList = authoringUtil.repopulateCandidateAnswersBox(request, false); List listQuestionContentDTO = (List) sessionMap.get(McAppConstants.LIST_QUESTION_CONTENT_DTO_KEY); - if (errors.isEmpty()) { - List candidates = new LinkedList(); - List listCandidates = new LinkedList(); - String editableQuestion = ""; - Iterator listIterator = listQuestionContentDTO.iterator(); - while (listIterator.hasNext()) { - McQuestionContentDTO mcQuestionContentDTO = (McQuestionContentDTO) listIterator.next(); + List candidates = new LinkedList(); + List listCandidates = new LinkedList(); + String editableQuestion = ""; + Iterator listIterator = listQuestionContentDTO.iterator(); + while (listIterator.hasNext()) { + McQuestionContentDTO mcQuestionContentDTO = (McQuestionContentDTO) listIterator.next(); - String question = mcQuestionContentDTO.getQuestion(); - String displayOrder = mcQuestionContentDTO.getDisplayOrder(); + String question = mcQuestionContentDTO.getQuestion(); + String displayOrder = mcQuestionContentDTO.getDisplayOrder(); - if ((displayOrder != null) && (!displayOrder.equals(""))) { - if (displayOrder.equals(questionIndex)) { - editableQuestion = mcQuestionContentDTO.getQuestion(); + if ((displayOrder != null) && (!displayOrder.equals(""))) { + if (displayOrder.equals(questionIndex)) { + editableQuestion = mcQuestionContentDTO.getQuestion(); - candidates = mcQuestionContentDTO.getListCandidateAnswersDTO(); - // candidates found - // but we are using the repopulated caList here + candidates = mcQuestionContentDTO.getListCandidateAnswersDTO(); + // candidates found + // but we are using the repopulated caList here - listCandidates = AuthoringUtil.swapCandidateNodes(caList, candidateIndex, "down"); + listCandidates = AuthoringUtil.swapCandidateNodes(caList, candidateIndex, "down"); - mcQuestionContentDTO.setListCandidateAnswersDTO(listCandidates); + mcQuestionContentDTO.setListCandidateAnswersDTO(listCandidates); - break; - } - + break; } + } } sessionMap.put(McAppConstants.LIST_QUESTION_CONTENT_DTO_KEY, listQuestionContentDTO); String contentFolderID = WebUtil.readStrParam(request, AttributeNames.PARAM_CONTENT_FOLDER_ID); - mcAuthoringForm.setContentFolderID(contentFolderID); String activeModule = request.getParameter(McAppConstants.ACTIVE_MODULE); @@ -2106,7 +1961,6 @@ mcGeneralAuthoringDTO.setContentFolderID(contentFolderID); mcGeneralAuthoringDTO.setActivityTitle(richTextTitle); - mcAuthoringForm.setTitle(richTextTitle); mcGeneralAuthoringDTO.setActivityInstructions(richTextInstructions); @@ -2122,11 +1976,6 @@ mcGeneralAuthoringDTO.setAttachmentList(attachmentList); mcGeneralAuthoringDTO.setDeletedAttachmentList(deletedAttachmentList); - - String strOnlineInstructions = request.getParameter("onlineInstructions"); - String strOfflineInstructions = request.getParameter("offlineInstructions"); - mcAuthoringForm.setOnlineInstructions(strOnlineInstructions); - mcAuthoringForm.setOfflineInstructions(strOfflineInstructions); } mcGeneralAuthoringDTO.setEditActivityEditMode(new Boolean(true).toString()); @@ -2140,11 +1989,6 @@ mcGeneralAuthoringDTO.setHttpSessionID(httpSessionID); mcGeneralAuthoringDTO.setActiveModule(activeModule); mcGeneralAuthoringDTO.setDefaultContentIdStr(defaultContentIdStr); - mcAuthoringForm.setToolContentID(strToolContentID); - mcAuthoringForm.setHttpSessionID(httpSessionID); - mcAuthoringForm.setActiveModule(activeModule); - mcAuthoringForm.setDefaultContentIdStr(defaultContentIdStr); - mcAuthoringForm.setCurrentTab("1"); request.setAttribute(McAppConstants.LIST_QUESTION_CONTENT_DTO, listQuestionContentDTO); @@ -2157,7 +2001,6 @@ mcGeneralAuthoringDTO.setPassMarksMap(passMarksMap); String totalMark = AuthoringUtil.getTotalMark(listQuestionContentDTO); - mcAuthoringForm.setTotalMarks(totalMark); mcGeneralAuthoringDTO.setTotalMarks(totalMark); Map correctMap = authoringUtil.buildCorrectMap(); @@ -2166,9 +2009,6 @@ String newQuestion = request.getParameter("newQuestion"); mcGeneralAuthoringDTO.setEditableQuestionText(newQuestion); - String feedback = request.getParameter("feedback"); - mcAuthoringForm.setFeedback(feedback); - String mark = request.getParameter("mark"); mcGeneralAuthoringDTO.setMarkValue(mark); @@ -2179,7 +2019,7 @@ String editQuestionBoxRequest = request.getParameter("editQuestionBoxRequest"); request.setAttribute("requestNewEditableQuestionBox", new Boolean(true).toString()); - return newEditableQuestionBox(mapping, form, request, response); + return (mapping.findForward("candidateAnswersList")); } /** @@ -2204,65 +2044,48 @@ SessionMap sessionMap = (SessionMap) request.getSession().getAttribute(httpSessionID); String questionIndex = request.getParameter("questionIndex"); - mcAuthoringForm.setQuestionIndex(questionIndex); + request.setAttribute("questionIndex", questionIndex); + request.setAttribute(McAppConstants.CURRENT_EDITABLE_QUESTION_INDEX, questionIndex); - String totalMarks = request.getParameter("totalMarks"); - String candidateIndex = request.getParameter("candidateIndex"); - mcAuthoringForm.setCandidateIndex(candidateIndex); + request.setAttribute("candidateIndex", candidateIndex); AuthoringUtil authoringUtil = new AuthoringUtil(); - boolean validateCandidateAnswersNotBlank = authoringUtil.validateCandidateAnswersNotBlank(request); - - ActionMessages errors = new ActionMessages(); - - if (!validateCandidateAnswersNotBlank) { - ActionMessage error = new ActionMessage("candidates.blank"); - errors.add(ActionMessages.GLOBAL_MESSAGE, error); - } - - if (!errors.isEmpty()) { - saveErrors(request, errors); - } - List caList = authoringUtil.repopulateCandidateAnswersBox(request, false); List listQuestionContentDTO = (List) sessionMap.get(McAppConstants.LIST_QUESTION_CONTENT_DTO_KEY); - if (errors.isEmpty()) { - List candidates = new LinkedList(); - List listCandidates = new LinkedList(); - String editableQuestion = ""; - Iterator listIterator = listQuestionContentDTO.iterator(); - while (listIterator.hasNext()) { - McQuestionContentDTO mcQuestionContentDTO = (McQuestionContentDTO) listIterator.next(); + List candidates = new LinkedList(); + List listCandidates = new LinkedList(); + String editableQuestion = ""; + Iterator listIterator = listQuestionContentDTO.iterator(); + while (listIterator.hasNext()) { + McQuestionContentDTO mcQuestionContentDTO = (McQuestionContentDTO) listIterator.next(); - String question = mcQuestionContentDTO.getQuestion(); - String displayOrder = mcQuestionContentDTO.getDisplayOrder(); + String question = mcQuestionContentDTO.getQuestion(); + String displayOrder = mcQuestionContentDTO.getDisplayOrder(); - if ((displayOrder != null) && (!displayOrder.equals(""))) { - if (displayOrder.equals(questionIndex)) { - editableQuestion = mcQuestionContentDTO.getQuestion(); + if ((displayOrder != null) && (!displayOrder.equals(""))) { + if (displayOrder.equals(questionIndex)) { + editableQuestion = mcQuestionContentDTO.getQuestion(); - candidates = mcQuestionContentDTO.getListCandidateAnswersDTO(); + candidates = mcQuestionContentDTO.getListCandidateAnswersDTO(); - listCandidates = AuthoringUtil.swapCandidateNodes(caList, candidateIndex, "up"); + listCandidates = AuthoringUtil.swapCandidateNodes(caList, candidateIndex, "up"); - mcQuestionContentDTO.setListCandidateAnswersDTO(listCandidates); - mcQuestionContentDTO.setCaCount(new Integer(listCandidates.size()).toString()); + mcQuestionContentDTO.setListCandidateAnswersDTO(listCandidates); + mcQuestionContentDTO.setCaCount(new Integer(listCandidates.size()).toString()); - break; - } - + break; } + } } sessionMap.put(McAppConstants.LIST_QUESTION_CONTENT_DTO_KEY, listQuestionContentDTO); String contentFolderID = WebUtil.readStrParam(request, AttributeNames.PARAM_CONTENT_FOLDER_ID); - mcAuthoringForm.setContentFolderID(contentFolderID); String activeModule = request.getParameter(McAppConstants.ACTIVE_MODULE); @@ -2283,7 +2106,6 @@ mcGeneralAuthoringDTO.setContentFolderID(contentFolderID); mcGeneralAuthoringDTO.setActivityTitle(richTextTitle); - mcAuthoringForm.setTitle(richTextTitle); mcGeneralAuthoringDTO.setActivityInstructions(richTextInstructions); @@ -2299,11 +2121,6 @@ mcGeneralAuthoringDTO.setAttachmentList(attachmentList); mcGeneralAuthoringDTO.setDeletedAttachmentList(deletedAttachmentList); - - String strOnlineInstructions = request.getParameter("onlineInstructions"); - String strOfflineInstructions = request.getParameter("offlineInstructions"); - mcAuthoringForm.setOnlineInstructions(strOnlineInstructions); - mcAuthoringForm.setOfflineInstructions(strOfflineInstructions); } mcGeneralAuthoringDTO.setEditActivityEditMode(new Boolean(true).toString()); @@ -2317,11 +2134,6 @@ mcGeneralAuthoringDTO.setHttpSessionID(httpSessionID); mcGeneralAuthoringDTO.setActiveModule(activeModule); mcGeneralAuthoringDTO.setDefaultContentIdStr(defaultContentIdStr); - mcAuthoringForm.setToolContentID(strToolContentID); - mcAuthoringForm.setHttpSessionID(httpSessionID); - mcAuthoringForm.setActiveModule(activeModule); - mcAuthoringForm.setDefaultContentIdStr(defaultContentIdStr); - mcAuthoringForm.setCurrentTab("1"); request.setAttribute(McAppConstants.LIST_QUESTION_CONTENT_DTO, listQuestionContentDTO); @@ -2337,15 +2149,11 @@ mcGeneralAuthoringDTO.setCorrectMap(correctMap); String totalMark = AuthoringUtil.getTotalMark(listQuestionContentDTO); - mcAuthoringForm.setTotalMarks(totalMark); mcGeneralAuthoringDTO.setTotalMarks(totalMark); String newQuestion = request.getParameter("newQuestion"); mcGeneralAuthoringDTO.setEditableQuestionText(newQuestion); - String feedback = request.getParameter("feedback"); - mcAuthoringForm.setFeedback(feedback); - String mark = request.getParameter("mark"); mcGeneralAuthoringDTO.setMarkValue(mark); @@ -2356,7 +2164,7 @@ String editQuestionBoxRequest = request.getParameter("editQuestionBoxRequest"); request.setAttribute("requestNewEditableQuestionBox", new Boolean(true).toString()); - return newEditableQuestionBox(mapping, form, request, response); + return (mapping.findForward("candidateAnswersList")); } /** @@ -2381,10 +2189,11 @@ SessionMap sessionMap = (SessionMap) request.getSession().getAttribute(httpSessionID); String questionIndex = request.getParameter("questionIndex"); - mcAuthoringForm.setQuestionIndex(questionIndex); + request.setAttribute("questionIndex", questionIndex); + request.setAttribute(McAppConstants.CURRENT_EDITABLE_QUESTION_INDEX, questionIndex); String candidateIndex = request.getParameter("candidateIndex"); - mcAuthoringForm.setCandidateIndex(candidateIndex); + request.setAttribute("candidateIndex", candidateIndex); String totalMarks = request.getParameter("totalMarks"); @@ -2435,7 +2244,6 @@ sessionMap.put(McAppConstants.LIST_QUESTION_CONTENT_DTO_KEY, listQuestionContentDTO); String contentFolderID = WebUtil.readStrParam(request, AttributeNames.PARAM_CONTENT_FOLDER_ID); - mcAuthoringForm.setContentFolderID(contentFolderID); String activeModule = request.getParameter(McAppConstants.ACTIVE_MODULE); @@ -2461,7 +2269,6 @@ mcGeneralAuthoringDTO.setContentFolderID(contentFolderID); mcGeneralAuthoringDTO.setActivityTitle(richTextTitle); - mcAuthoringForm.setTitle(richTextTitle); mcGeneralAuthoringDTO.setActivityInstructions(richTextInstructions); @@ -2477,11 +2284,6 @@ mcGeneralAuthoringDTO.setAttachmentList(attachmentList); mcGeneralAuthoringDTO.setDeletedAttachmentList(deletedAttachmentList); - - String strOnlineInstructions = request.getParameter("onlineInstructions"); - String strOfflineInstructions = request.getParameter("offlineInstructions"); - mcAuthoringForm.setOnlineInstructions(strOnlineInstructions); - mcAuthoringForm.setOfflineInstructions(strOfflineInstructions); } mcGeneralAuthoringDTO.setEditActivityEditMode(new Boolean(true).toString()); @@ -2495,11 +2297,6 @@ mcGeneralAuthoringDTO.setHttpSessionID(httpSessionID); mcGeneralAuthoringDTO.setActiveModule(activeModule); mcGeneralAuthoringDTO.setDefaultContentIdStr(defaultContentIdStr); - mcAuthoringForm.setToolContentID(strToolContentID); - mcAuthoringForm.setHttpSessionID(httpSessionID); - mcAuthoringForm.setActiveModule(activeModule); - mcAuthoringForm.setDefaultContentIdStr(defaultContentIdStr); - mcAuthoringForm.setCurrentTab("1"); request.setAttribute(McAppConstants.LIST_QUESTION_CONTENT_DTO, listQuestionContentDTO); @@ -2512,7 +2309,6 @@ mcGeneralAuthoringDTO.setPassMarksMap(passMarksMap); String totalMark = AuthoringUtil.getTotalMark(listQuestionContentDTO); - mcAuthoringForm.setTotalMarks(totalMark); mcGeneralAuthoringDTO.setTotalMarks(totalMark); Map correctMap = authoringUtil.buildCorrectMap(); @@ -2521,9 +2317,6 @@ String newQuestion = request.getParameter("newQuestion"); mcGeneralAuthoringDTO.setEditableQuestionText(newQuestion); - String feedback = request.getParameter("feedback"); - mcAuthoringForm.setFeedback(feedback); - String mark = request.getParameter("mark"); mcGeneralAuthoringDTO.setMarkValue(mark); @@ -2534,7 +2327,7 @@ String editQuestionBoxRequest = request.getParameter("editQuestionBoxRequest"); request.setAttribute("requestNewEditableQuestionBox", new Boolean(true).toString()); - return newEditableQuestionBox(mapping, form, request, response); + return (mapping.findForward("candidateAnswersList")); } /** @@ -2559,13 +2352,12 @@ SessionMap sessionMap = (SessionMap) request.getSession().getAttribute(httpSessionID); String questionIndex = request.getParameter("questionIndex"); - mcAuthoringForm.setQuestionIndex(questionIndex); + request.setAttribute("questionIndex", questionIndex); + request.setAttribute(McAppConstants.CURRENT_EDITABLE_QUESTION_INDEX, questionIndex); String candidateIndex = request.getParameter("candidateIndex"); - mcAuthoringForm.setCandidateIndex(candidateIndex); + request.setAttribute("candidateIndex", candidateIndex); - String totalMarks = request.getParameter("totalMarks"); - List listQuestionContentDTO = (List) sessionMap.get(McAppConstants.LIST_QUESTION_CONTENT_DTO_KEY); AuthoringUtil authoringUtil = new AuthoringUtil(); @@ -2609,7 +2401,6 @@ sessionMap.put(McAppConstants.LIST_QUESTION_CONTENT_DTO_KEY, listQuestionContentDTO); String contentFolderID = WebUtil.readStrParam(request, AttributeNames.PARAM_CONTENT_FOLDER_ID); - mcAuthoringForm.setContentFolderID(contentFolderID); String activeModule = request.getParameter(McAppConstants.ACTIVE_MODULE); @@ -2628,7 +2419,6 @@ mcGeneralAuthoringDTO.setContentFolderID(contentFolderID); mcGeneralAuthoringDTO.setActivityTitle(richTextTitle); - mcAuthoringForm.setTitle(richTextTitle); mcGeneralAuthoringDTO.setActivityInstructions(richTextInstructions); @@ -2644,11 +2434,6 @@ mcGeneralAuthoringDTO.setAttachmentList(attachmentList); mcGeneralAuthoringDTO.setDeletedAttachmentList(deletedAttachmentList); - - String strOnlineInstructions = request.getParameter("onlineInstructions"); - String strOfflineInstructions = request.getParameter("offlineInstructions"); - mcAuthoringForm.setOnlineInstructions(strOnlineInstructions); - mcAuthoringForm.setOfflineInstructions(strOfflineInstructions); } mcGeneralAuthoringDTO.setEditActivityEditMode(new Boolean(true).toString()); @@ -2662,11 +2447,6 @@ mcGeneralAuthoringDTO.setHttpSessionID(httpSessionID); mcGeneralAuthoringDTO.setActiveModule(activeModule); mcGeneralAuthoringDTO.setDefaultContentIdStr(defaultContentIdStr); - mcAuthoringForm.setToolContentID(strToolContentID); - mcAuthoringForm.setHttpSessionID(httpSessionID); - mcAuthoringForm.setActiveModule(activeModule); - mcAuthoringForm.setDefaultContentIdStr(defaultContentIdStr); - mcAuthoringForm.setCurrentTab("1"); request.setAttribute(McAppConstants.LIST_QUESTION_CONTENT_DTO, listQuestionContentDTO); @@ -2679,24 +2459,21 @@ mcGeneralAuthoringDTO.setPassMarksMap(passMarksMap); String totalMark = AuthoringUtil.getTotalMark(listQuestionContentDTO); - mcAuthoringForm.setTotalMarks(totalMark); mcGeneralAuthoringDTO.setTotalMarks(totalMark); Map correctMap = authoringUtil.buildCorrectMap(); mcGeneralAuthoringDTO.setCorrectMap(correctMap); mcGeneralAuthoringDTO.setEditableQuestionText(newQuestion); - mcAuthoringForm.setFeedback(feedback); - mcGeneralAuthoringDTO.setMarkValue(mark); request.setAttribute(McAppConstants.MC_GENERAL_AUTHORING_DTO, mcGeneralAuthoringDTO); request.setAttribute(McAppConstants.TOTAL_QUESTION_COUNT, new Integer(listQuestionContentDTO.size())); request.setAttribute("requestNewEditableQuestionBox", new Boolean(true).toString()); - return newEditableQuestionBox(mapping, form, request, response); + return (mapping.findForward("candidateAnswersList")); } public ActionForward updateMarksList(ActionMapping mapping, ActionForm form, HttpServletRequest request, @@ -2820,23 +2597,10 @@ String totalMarks = request.getParameter("totalMarks"); String candidateIndex = request.getParameter("candidateIndex"); - mcAuthoringForm.setCandidateIndex(candidateIndex); + request.setAttribute("candidateIndex", candidateIndex); AuthoringUtil authoringUtil = new AuthoringUtil(); - boolean validateCandidateAnswersNotBlank = authoringUtil.validateCandidateAnswersNotBlank(request); - - ActionMessages errors = new ActionMessages(); - - if (!validateCandidateAnswersNotBlank) { - ActionMessage error = new ActionMessage("candidates.blank"); - errors.add(ActionMessages.GLOBAL_MESSAGE, error); - } - - if (!errors.isEmpty()) { - saveErrors(request, errors); - } - List caList = authoringUtil.repopulateCandidateAnswersBox(request, false); List listQuestionContentDTO = (List) sessionMap.get(McAppConstants.LIST_QUESTION_CONTENT_DTO_KEY); @@ -2845,28 +2609,22 @@ List listAddableQuestionContentDTO = (List) sessionMap.get(McAppConstants.NEW_ADDABLE_QUESTION_CONTENT_KEY); - if (errors.isEmpty()) { - List candidates = new LinkedList(); - List listCandidates = new LinkedList(); + List listCandidates = new LinkedList(); - Iterator listIterator = listAddableQuestionContentDTO.iterator(); - /* there is only 1 question dto */ - while (listIterator.hasNext()) { - McQuestionContentDTO mcQuestionContentDTO = (McQuestionContentDTO) listIterator.next(); + Iterator listIterator = listAddableQuestionContentDTO.iterator(); + /* there is only 1 question dto */ + while (listIterator.hasNext()) { + McQuestionContentDTO mcQuestionContentDTO = (McQuestionContentDTO) listIterator.next(); - candidates = mcQuestionContentDTO.getListCandidateAnswersDTO(); + listCandidates = AuthoringUtil.swapCandidateNodes(caList, candidateIndex, "up"); - listCandidates = AuthoringUtil.swapCandidateNodes(caList, candidateIndex, "up"); - - mcQuestionContentDTO.setListCandidateAnswersDTO(listCandidates); - } + mcQuestionContentDTO.setListCandidateAnswersDTO(listCandidates); } request.setAttribute(McAppConstants.NEW_ADDABLE_QUESTION_CONTENT_LIST, listAddableQuestionContentDTO); sessionMap.put(McAppConstants.NEW_ADDABLE_QUESTION_CONTENT_KEY, listAddableQuestionContentDTO); String contentFolderID = WebUtil.readStrParam(request, AttributeNames.PARAM_CONTENT_FOLDER_ID); - mcAuthoringForm.setContentFolderID(contentFolderID); String activeModule = request.getParameter(McAppConstants.ACTIVE_MODULE); @@ -2888,7 +2646,6 @@ mcGeneralAuthoringDTO.setContentFolderID(contentFolderID); mcGeneralAuthoringDTO.setActivityTitle(richTextTitle); - mcAuthoringForm.setTitle(richTextTitle); mcGeneralAuthoringDTO.setActivityInstructions(richTextInstructions); @@ -2907,8 +2664,6 @@ String strOnlineInstructions = request.getParameter("onlineInstructions"); String strOfflineInstructions = request.getParameter("offlineInstructions"); - mcAuthoringForm.setOnlineInstructions(strOnlineInstructions); - mcAuthoringForm.setOfflineInstructions(strOfflineInstructions); } mcGeneralAuthoringDTO.setEditActivityEditMode(new Boolean(true).toString()); @@ -2922,11 +2677,6 @@ mcGeneralAuthoringDTO.setHttpSessionID(httpSessionID); mcGeneralAuthoringDTO.setActiveModule(activeModule); mcGeneralAuthoringDTO.setDefaultContentIdStr(defaultContentIdStr); - mcAuthoringForm.setToolContentID(strToolContentID); - mcAuthoringForm.setHttpSessionID(httpSessionID); - mcAuthoringForm.setActiveModule(activeModule); - mcAuthoringForm.setDefaultContentIdStr(defaultContentIdStr); - mcAuthoringForm.setCurrentTab("1"); request.setAttribute(McAppConstants.LIST_QUESTION_CONTENT_DTO, listQuestionContentDTO); @@ -2942,14 +2692,12 @@ mcGeneralAuthoringDTO.setCorrectMap(correctMap); String totalMark = AuthoringUtil.getTotalMark(listQuestionContentDTO); - mcAuthoringForm.setTotalMarks(totalMark); mcGeneralAuthoringDTO.setTotalMarks(totalMark); String newQuestion = request.getParameter("newQuestion"); mcGeneralAuthoringDTO.setEditableQuestionText(newQuestion); String feedback = request.getParameter("feedback"); - mcAuthoringForm.setFeedback(feedback); String mark = request.getParameter("mark"); mcGeneralAuthoringDTO.setMarkValue(mark); @@ -2960,7 +2708,7 @@ String editQuestionBoxRequest = request.getParameter("editQuestionBoxRequest"); - return newQuestionBox(mapping, form, request, response); + return (mapping.findForward("candidateAnswersAddList")); } @@ -2975,54 +2723,35 @@ SessionMap sessionMap = (SessionMap) request.getSession().getAttribute(httpSessionID); String candidateIndex = request.getParameter("candidateIndex"); - mcAuthoringForm.setCandidateIndex(candidateIndex); + request.setAttribute("candidateIndex", candidateIndex); String totalMarks = request.getParameter("totalMarks"); AuthoringUtil authoringUtil = new AuthoringUtil(); - boolean validateCandidateAnswersNotBlank = authoringUtil.validateCandidateAnswersNotBlank(request); - - ActionMessages errors = new ActionMessages(); - - if (!validateCandidateAnswersNotBlank) { - ActionMessage error = new ActionMessage("candidates.blank"); - errors.add(ActionMessages.GLOBAL_MESSAGE, error); - } - - if (!errors.isEmpty()) { - saveErrors(request, errors); - } - List caList = authoringUtil.repopulateCandidateAnswersBox(request, false); List listQuestionContentDTO = (List) sessionMap.get(McAppConstants.LIST_QUESTION_CONTENT_DTO_KEY); sessionMap.put(McAppConstants.LIST_QUESTION_CONTENT_DTO_KEY, listQuestionContentDTO); List listAddableQuestionContentDTO = (List) sessionMap.get(McAppConstants.NEW_ADDABLE_QUESTION_CONTENT_KEY); - if (errors.isEmpty()) { - List candidates = new LinkedList(); - List listCandidates = new LinkedList(); + List listCandidates = new LinkedList(); - Iterator listIterator = listAddableQuestionContentDTO.iterator(); - /* there is only 1 question dto */ - while (listIterator.hasNext()) { - McQuestionContentDTO mcQuestionContentDTO = (McQuestionContentDTO) listIterator.next(); + Iterator listIterator = listAddableQuestionContentDTO.iterator(); + /* there is only 1 question dto */ + while (listIterator.hasNext()) { + McQuestionContentDTO mcQuestionContentDTO = (McQuestionContentDTO) listIterator.next(); - candidates = mcQuestionContentDTO.getListCandidateAnswersDTO(); + listCandidates = AuthoringUtil.swapCandidateNodes(caList, candidateIndex, "down"); - listCandidates = AuthoringUtil.swapCandidateNodes(caList, candidateIndex, "down"); - - mcQuestionContentDTO.setListCandidateAnswersDTO(listCandidates); - } + mcQuestionContentDTO.setListCandidateAnswersDTO(listCandidates); } request.setAttribute(McAppConstants.NEW_ADDABLE_QUESTION_CONTENT_LIST, listAddableQuestionContentDTO); sessionMap.put(McAppConstants.NEW_ADDABLE_QUESTION_CONTENT_KEY, listAddableQuestionContentDTO); String contentFolderID = WebUtil.readStrParam(request, AttributeNames.PARAM_CONTENT_FOLDER_ID); - mcAuthoringForm.setContentFolderID(contentFolderID); String activeModule = request.getParameter(McAppConstants.ACTIVE_MODULE); @@ -3038,13 +2767,10 @@ String defaultContentIdStr = new Long(mcService.getToolDefaultContentIdBySignature(McAppConstants.MY_SIGNATURE)) .toString(); - McContent mcContent = mcService.retrieveMc(new Long(strToolContentID)); - McGeneralAuthoringDTO mcGeneralAuthoringDTO = new McGeneralAuthoringDTO(); mcGeneralAuthoringDTO.setContentFolderID(contentFolderID); mcGeneralAuthoringDTO.setActivityTitle(richTextTitle); - mcAuthoringForm.setTitle(richTextTitle); mcGeneralAuthoringDTO.setActivityInstructions(richTextInstructions); @@ -3060,11 +2786,6 @@ mcGeneralAuthoringDTO.setAttachmentList(attachmentList); mcGeneralAuthoringDTO.setDeletedAttachmentList(deletedAttachmentList); - - String strOnlineInstructions = request.getParameter("onlineInstructions"); - String strOfflineInstructions = request.getParameter("offlineInstructions"); - mcAuthoringForm.setOnlineInstructions(strOnlineInstructions); - mcAuthoringForm.setOfflineInstructions(strOfflineInstructions); } mcGeneralAuthoringDTO.setEditActivityEditMode(new Boolean(true).toString()); @@ -3078,11 +2799,6 @@ mcGeneralAuthoringDTO.setHttpSessionID(httpSessionID); mcGeneralAuthoringDTO.setActiveModule(activeModule); mcGeneralAuthoringDTO.setDefaultContentIdStr(defaultContentIdStr); - mcAuthoringForm.setToolContentID(strToolContentID); - mcAuthoringForm.setHttpSessionID(httpSessionID); - mcAuthoringForm.setActiveModule(activeModule); - mcAuthoringForm.setDefaultContentIdStr(defaultContentIdStr); - mcAuthoringForm.setCurrentTab("1"); request.setAttribute(McAppConstants.LIST_QUESTION_CONTENT_DTO, listQuestionContentDTO); @@ -3095,7 +2811,6 @@ mcGeneralAuthoringDTO.setPassMarksMap(passMarksMap); String totalMark = AuthoringUtil.getTotalMark(listQuestionContentDTO); - mcAuthoringForm.setTotalMarks(totalMark); mcGeneralAuthoringDTO.setTotalMarks(totalMark); Map correctMap = authoringUtil.buildCorrectMap(); @@ -3104,19 +2819,14 @@ String newQuestion = request.getParameter("newQuestion"); mcGeneralAuthoringDTO.setEditableQuestionText(newQuestion); - String feedback = request.getParameter("feedback"); - mcAuthoringForm.setFeedback(feedback); - String mark = request.getParameter("mark"); mcGeneralAuthoringDTO.setMarkValue(mark); request.setAttribute(McAppConstants.MC_GENERAL_AUTHORING_DTO, mcGeneralAuthoringDTO); request.setAttribute(McAppConstants.TOTAL_QUESTION_COUNT, new Integer(listQuestionContentDTO.size())); - String editQuestionBoxRequest = request.getParameter("editQuestionBoxRequest"); - - return newQuestionBox(mapping, form, request, response); + return (mapping.findForward("candidateAnswersAddList")); } public ActionForward removeAddedCandidate(ActionMapping mapping, ActionForm form, HttpServletRequest request, @@ -3130,7 +2840,7 @@ SessionMap sessionMap = (SessionMap) request.getSession().getAttribute(httpSessionID); String candidateIndex = request.getParameter("candidateIndex"); - mcAuthoringForm.setCandidateIndex(candidateIndex); + request.setAttribute("candidateIndex", candidateIndex); String totalMarks = request.getParameter("totalMarks"); @@ -3179,7 +2889,6 @@ sessionMap.put(McAppConstants.NEW_ADDABLE_QUESTION_CONTENT_KEY, listAddableQuestionContentDTO); String contentFolderID = WebUtil.readStrParam(request, AttributeNames.PARAM_CONTENT_FOLDER_ID); - mcAuthoringForm.setContentFolderID(contentFolderID); String activeModule = request.getParameter(McAppConstants.ACTIVE_MODULE); @@ -3205,7 +2914,6 @@ mcGeneralAuthoringDTO.setContentFolderID(contentFolderID); mcGeneralAuthoringDTO.setActivityTitle(richTextTitle); - mcAuthoringForm.setTitle(richTextTitle); mcGeneralAuthoringDTO.setActivityInstructions(richTextInstructions); @@ -3221,11 +2929,6 @@ mcGeneralAuthoringDTO.setAttachmentList(attachmentList); mcGeneralAuthoringDTO.setDeletedAttachmentList(deletedAttachmentList); - - String strOnlineInstructions = request.getParameter("onlineInstructions"); - String strOfflineInstructions = request.getParameter("offlineInstructions"); - mcAuthoringForm.setOnlineInstructions(strOnlineInstructions); - mcAuthoringForm.setOfflineInstructions(strOfflineInstructions); } mcGeneralAuthoringDTO.setEditActivityEditMode(new Boolean(true).toString()); @@ -3239,11 +2942,6 @@ mcGeneralAuthoringDTO.setHttpSessionID(httpSessionID); mcGeneralAuthoringDTO.setActiveModule(activeModule); mcGeneralAuthoringDTO.setDefaultContentIdStr(defaultContentIdStr); - mcAuthoringForm.setToolContentID(strToolContentID); - mcAuthoringForm.setHttpSessionID(httpSessionID); - mcAuthoringForm.setActiveModule(activeModule); - mcAuthoringForm.setDefaultContentIdStr(defaultContentIdStr); - mcAuthoringForm.setCurrentTab("1"); request.setAttribute(McAppConstants.LIST_QUESTION_CONTENT_DTO, listQuestionContentDTO); @@ -3256,7 +2954,6 @@ mcGeneralAuthoringDTO.setPassMarksMap(passMarksMap); String totalMark = AuthoringUtil.getTotalMark(listQuestionContentDTO); - mcAuthoringForm.setTotalMarks(totalMark); mcGeneralAuthoringDTO.setTotalMarks(totalMark); Map correctMap = authoringUtil.buildCorrectMap(); @@ -3266,7 +2963,6 @@ mcGeneralAuthoringDTO.setEditableQuestionText(newQuestion); String feedback = request.getParameter("feedback"); - mcAuthoringForm.setFeedback(feedback); String mark = request.getParameter("mark"); mcGeneralAuthoringDTO.setMarkValue(mark); @@ -3277,7 +2973,7 @@ String editQuestionBoxRequest = request.getParameter("editQuestionBoxRequest"); - return newQuestionBox(mapping, form, request, response); + return (mapping.findForward("candidateAnswersAddList")); } @@ -3292,7 +2988,7 @@ SessionMap sessionMap = (SessionMap) request.getSession().getAttribute(httpSessionID); String candidateIndex = request.getParameter("candidateIndex"); - mcAuthoringForm.setCandidateIndex(candidateIndex); + request.setAttribute("candidateIndex", candidateIndex); String totalMarks = request.getParameter("totalMarks"); @@ -3335,7 +3031,6 @@ sessionMap.put(McAppConstants.LIST_QUESTION_CONTENT_DTO_KEY, listQuestionContentDTO); String contentFolderID = WebUtil.readStrParam(request, AttributeNames.PARAM_CONTENT_FOLDER_ID); - mcAuthoringForm.setContentFolderID(contentFolderID); String activeModule = request.getParameter(McAppConstants.ACTIVE_MODULE); @@ -3355,7 +3050,6 @@ mcGeneralAuthoringDTO.setContentFolderID(contentFolderID); mcGeneralAuthoringDTO.setActivityTitle(richTextTitle); - mcAuthoringForm.setTitle(richTextTitle); mcGeneralAuthoringDTO.setActivityInstructions(richTextInstructions); @@ -3371,11 +3065,6 @@ mcGeneralAuthoringDTO.setAttachmentList(attachmentList); mcGeneralAuthoringDTO.setDeletedAttachmentList(deletedAttachmentList); - - String strOnlineInstructions = request.getParameter("onlineInstructions"); - String strOfflineInstructions = request.getParameter("offlineInstructions"); - mcAuthoringForm.setOnlineInstructions(strOnlineInstructions); - mcAuthoringForm.setOfflineInstructions(strOfflineInstructions); } mcGeneralAuthoringDTO.setEditActivityEditMode(new Boolean(true).toString()); @@ -3389,11 +3078,6 @@ mcGeneralAuthoringDTO.setHttpSessionID(httpSessionID); mcGeneralAuthoringDTO.setActiveModule(activeModule); mcGeneralAuthoringDTO.setDefaultContentIdStr(defaultContentIdStr); - mcAuthoringForm.setToolContentID(strToolContentID); - mcAuthoringForm.setHttpSessionID(httpSessionID); - mcAuthoringForm.setActiveModule(activeModule); - mcAuthoringForm.setDefaultContentIdStr(defaultContentIdStr); - mcAuthoringForm.setCurrentTab("1"); request.setAttribute(McAppConstants.LIST_QUESTION_CONTENT_DTO, listQuestionContentDTO); @@ -3406,23 +3090,20 @@ mcGeneralAuthoringDTO.setPassMarksMap(passMarksMap); String totalMark = AuthoringUtil.getTotalMark(listQuestionContentDTO); - mcAuthoringForm.setTotalMarks(totalMark); mcGeneralAuthoringDTO.setTotalMarks(totalMark); Map correctMap = authoringUtil.buildCorrectMap(); mcGeneralAuthoringDTO.setCorrectMap(correctMap); mcGeneralAuthoringDTO.setEditableQuestionText(newQuestion); - mcAuthoringForm.setFeedback(feedback); - mcGeneralAuthoringDTO.setMarkValue(mark); request.setAttribute(McAppConstants.MC_GENERAL_AUTHORING_DTO, mcGeneralAuthoringDTO); request.setAttribute(McAppConstants.TOTAL_QUESTION_COUNT, new Integer(listQuestionContentDTO.size())); - return newQuestionBox(mapping, form, request, response); + return (mapping.findForward("candidateAnswersAddList")); } Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McMonitoringAction.java =================================================================== diff -u -r8ddb4345fdfc8904e5a7ff156cc63053e63741ca -r87ff0b33fa2d006a084b2ae9b7ff14d4c4be0f6d --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McMonitoringAction.java (.../McMonitoringAction.java) (revision 8ddb4345fdfc8904e5a7ff156cc63053e63741ca) +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McMonitoringAction.java (.../McMonitoringAction.java) (revision 87ff0b33fa2d006a084b2ae9b7ff14d4c4be0f6d) @@ -730,20 +730,13 @@ boolean validateSingleCorrectCandidate = authoringUtil.validateSingleCorrectCandidate(caList); - boolean validateOnlyOneCorrectCandidate = authoringUtil.validateOnlyOneCorrectCandidate(caList); - ActionMessages errors = new ActionMessages(); if (!validateSingleCorrectCandidate) { ActionMessage error = new ActionMessage("candidates.none.correct"); errors.add(ActionMessages.GLOBAL_MESSAGE, error); } - if (!validateOnlyOneCorrectCandidate) { - ActionMessage error = new ActionMessage("candidates.duplicate.correct"); - errors.add(ActionMessages.GLOBAL_MESSAGE, error); - } - if (!errors.isEmpty()) { saveErrors(request, errors); logger.debug("errors saved: " + errors); @@ -1000,7 +993,6 @@ caList = AuthoringUtil.removeBlankEntries(caList); boolean validateSingleCorrectCandidate = authoringUtil.validateSingleCorrectCandidate(caList); - boolean validateOnlyOneCorrectCandidate = authoringUtil.validateOnlyOneCorrectCandidate(caList); ActionMessages errors = new ActionMessages(); @@ -1009,11 +1001,6 @@ errors.add(ActionMessages.GLOBAL_MESSAGE, error); } - if (!validateOnlyOneCorrectCandidate) { - ActionMessage error = new ActionMessage("candidates.duplicate.correct"); - errors.add(ActionMessages.GLOBAL_MESSAGE, error); - } - if (!errors.isEmpty()) { saveErrors(request, errors); logger.debug("errors saved: " + errors); Index: lams_tool_lamc/web/WEB-INF/struts-config.xml =================================================================== diff -u -r9d26aaf34391eb58df037978365deda31de85c1b -r87ff0b33fa2d006a084b2ae9b7ff14d4c4be0f6d --- lams_tool_lamc/web/WEB-INF/struts-config.xml (.../struts-config.xml) (revision 9d26aaf34391eb58df037978365deda31de85c1b) +++ lams_tool_lamc/web/WEB-INF/struts-config.xml (.../struts-config.xml) (revision 87ff0b33fa2d006a084b2ae9b7ff14d4c4be0f6d) @@ -110,8 +110,31 @@ path="/authoring/editQuestionBox.jsp" redirect="false" /> + + + + + + + + - - <%@ include file="/common/taglibs.jsp"%>

Index: lams_tool_lamc/web/authoring/AuthoringTabsHolder.jsp =================================================================== diff -u -r18e5e690d2e1a7c3d918759f7a2827c8205feaac -r87ff0b33fa2d006a084b2ae9b7ff14d4c4be0f6d --- lams_tool_lamc/web/authoring/AuthoringTabsHolder.jsp (.../AuthoringTabsHolder.jsp) (revision 18e5e690d2e1a7c3d918759f7a2827c8205feaac) +++ lams_tool_lamc/web/authoring/AuthoringTabsHolder.jsp (.../AuthoringTabsHolder.jsp) (revision 87ff0b33fa2d006a084b2ae9b7ff14d4c4be0f6d) @@ -1,24 +1,3 @@ -<%-- -Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org) -License Information: http://lamsfoundation.org/licensing/lams/2.0/ - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License version 2 as - published by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - - http://www.gnu.org/licenses/gpl.txt ---%> - - @@ -43,9 +22,13 @@ <fmt:message key="activity.title" /> + + <%@ include file="/common/header.jsp"%> - + + + + - function submitMethod() { - document.McAuthoringForm.submit(); - } + - + +

+ - - @@ -206,36 +171,37 @@ + width="100%"> <%@ include file="/authoring/candidateAnswersList.jsp"%>
- - +
- - - +
+ + + +
@@ -244,15 +210,17 @@ - - + + + - - + + + +
Index: lams_tool_lamc/web/authoring/itemlist.jsp =================================================================== diff -u -r29fac4bd0bdf28bcaaeee7aae4020ccb15b6e520 -r87ff0b33fa2d006a084b2ae9b7ff14d4c4be0f6d --- lams_tool_lamc/web/authoring/itemlist.jsp (.../itemlist.jsp) (revision 29fac4bd0bdf28bcaaeee7aae4020ccb15b6e520) +++ lams_tool_lamc/web/authoring/itemlist.jsp (.../itemlist.jsp) (revision 87ff0b33fa2d006a084b2ae9b7ff14d4c4be0f6d) @@ -1,45 +1,22 @@ -<%-- -Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org) -License Information: http://lamsfoundation.org/licensing/lams/2.0/ - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License version 2 as - published by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - - http://www.gnu.org/licenses/gpl.txt ---%> - <%@ include file="/common/taglibs.jsp"%> - +

- + - + - - - - -
+ + @@ -68,11 +45,11 @@ - + + images/down.gif" border="0" @@ -103,13 +80,16 @@ - images/edit.gif" border="0" - title="" - onclick="javascript:showMessage('');"> + + + ?dispatch=newEditableQuestionBox&questionIndex=${queIndex}&contentFolderID=${mcGeneralAuthoringDTO.contentFolderID}&httpSessionID=${mcGeneralAuthoringDTO.httpSessionID}&toolContentID=${mcGeneralAuthoringDTO.toolContentID}&activeModule=${mcGeneralAuthoringDTO.activeModule}&defaultContentIdStr=${mcGeneralAuthoringDTO.defaultContentIdStr}&sln=${mcGeneralAuthoringDTO.sln}&showMarks=${mcGeneralAuthoringDTO.showMarks}&randomize=${mcGeneralAuthoringDTO.randomize}&questionsSequenced=${mcGeneralAuthoringDTO.questionsSequenced}&retries=${mcGeneralAuthoringDTO.retries}&reflect=${mcGeneralAuthoringDTO.reflect}&reflectionSubject=${mcGeneralAuthoringDTO.reflectionSubject}&KeepThis=true&TB_iframe=true&height=540&width=950&modal=true + + + + + images/delete.gif" border="0" title="" onclick="removeQuestion(${queIndex});"> @@ -119,13 +99,4 @@
-<%-- This script will works when a new resoruce item submit in order to refresh "Resource List" panel. --%> - Index: lams_tool_lamc/web/authoring/itemlistViewOnly.jsp =================================================================== diff -u -ree243d4e5cb79d63c83f87a473b996d6b2c2e86f -r87ff0b33fa2d006a084b2ae9b7ff14d4c4be0f6d --- lams_tool_lamc/web/authoring/itemlistViewOnly.jsp (.../itemlistViewOnly.jsp) (revision ee243d4e5cb79d63c83f87a473b996d6b2c2e86f) +++ lams_tool_lamc/web/authoring/itemlistViewOnly.jsp (.../itemlistViewOnly.jsp) (revision 87ff0b33fa2d006a084b2ae9b7ff14d4c4be0f6d) @@ -1,24 +1,3 @@ -<%-- -Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org) -License Information: http://lamsfoundation.org/licensing/lams/2.0/ - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License version 2 as - published by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - - http://www.gnu.org/licenses/gpl.txt ---%> - - <%@ include file="/common/taglibs.jsp" %>
Index: lams_tool_lamc/web/authoring/newQuestionBox.jsp =================================================================== diff -u -r877e20f893a1e5accb8a70a37b20ea2bea102349 -r87ff0b33fa2d006a084b2ae9b7ff14d4c4be0f6d --- lams_tool_lamc/web/authoring/newQuestionBox.jsp (.../newQuestionBox.jsp) (revision 877e20f893a1e5accb8a70a37b20ea2bea102349) +++ lams_tool_lamc/web/authoring/newQuestionBox.jsp (.../newQuestionBox.jsp) (revision 87ff0b33fa2d006a084b2ae9b7ff14d4c4be0f6d) @@ -1,87 +1,71 @@ -<%-- -Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org) -License Information: http://lamsfoundation.org/licensing/lams/2.0/ - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License version 2 as - published by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - - http://www.gnu.org/licenses/gpl.txt ---%> - <%@ include file="/common/taglibs.jsp"%> <%@ include file="/common/header.jsp"%> + + + + - + +
@@ -181,21 +162,20 @@ + width="100%"> <%@ include file="/authoring/candidateAnswersAddList.jsp"%>
- - +
-
+