Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McResources.properties =================================================================== diff -u -r2dbeea64b0b9925ebfcc5b10ced841ad134a0f38 -r249ef6f46c46382fcf4b8dc2eb415d5af18b4cb0 --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McResources.properties (.../McResources.properties) (revision 2dbeea64b0b9925ebfcc5b10ced841ad134a0f38) +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McResources.properties (.../McResources.properties) (revision 249ef6f46c46382fcf4b8dc2eb415d5af18b4cb0) @@ -1,7 +1,7 @@ # Project lams_tool_lamc11 #Authoring mode resources label.authoring.mc =Multiple Choice -label.authoring.mc.basic =Please define the questions and their options. +label.authoring.mc.basic =Please define the questions. label.authoring.mc.basic.editOptions =Please define the question and/or its options. label.authoring.title =Title label.authoring.instructions =Instructions Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McAction.java =================================================================== diff -u -r2dbeea64b0b9925ebfcc5b10ced841ad134a0f38 -r249ef6f46c46382fcf4b8dc2eb415d5af18b4cb0 --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McAction.java (.../McAction.java) (revision 2dbeea64b0b9925ebfcc5b10ced841ad134a0f38) +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McAction.java (.../McAction.java) (revision 249ef6f46c46382fcf4b8dc2eb415d5af18b4cb0) @@ -488,6 +488,9 @@ request.getSession().setAttribute(MAP_OPTIONS_CONTENT, mapOptionsContent); logger.debug("updated Options Map: " + request.getSession().getAttribute(MAP_OPTIONS_CONTENT)); + + + Long selectedQuestionContentUid=(Long) request.getSession().getAttribute(SELECTED_QUESTION_CONTENT_UID); logger.debug("selectedQuestionContentUid:" + selectedQuestionContentUid); @@ -514,7 +517,13 @@ } } + Map mapSelectedOptions= (Map) request.getSession().getAttribute(MAP_SELECTED_OPTIONS); + mapSelectedOptions.clear(); + mapSelectedOptions = repopulateCurrentCheckBoxStatesMap(request); + logger.debug("after add mapSelectedOptions: " + mapSelectedOptions); + request.getSession().setAttribute(MAP_SELECTED_OPTIONS, mapSelectedOptions); + mcAuthoringForm.resetUserAction(); return (mapping.findForward(EDIT_OPTS_CONTENT)); } @@ -558,6 +567,14 @@ } } + Map mapSelectedOptions= (Map) request.getSession().getAttribute(MAP_SELECTED_OPTIONS); + mapSelectedOptions.clear(); + mapSelectedOptions = repopulateCurrentCheckBoxStatesMap(request); + logger.debug("after add mapSelectedOptions: " + mapSelectedOptions); + request.getSession().setAttribute(MAP_SELECTED_OPTIONS, mapSelectedOptions); + + + mcAuthoringForm.resetUserAction(); return (mapping.findForward(EDIT_OPTS_CONTENT)); } @@ -812,23 +829,33 @@ McContent mcContent=mcService.retrieveMc(toolContentId); logger.debug("mcContent:" + mcContent); - logger.debug("updating mcContent title and instructions:" + mcContent); - mcContent.setTitle(richTextTitle); - mcContent.setInstructions(richTextInstructions); + - mcContent.setQuestionsSequenced(isQuestionsSequenced); - mcContent.setSynchInMonitor(isSynchInMonitor); - mcContent.setUsernameVisible(isUsernameVisible); - mcContent.setRetries(isRetries); - mcContent.setPassMark(new Integer(passmark)); - mcContent.setShowFeedback(isShowFeedback); - mcContent.setEndLearningMessage(endLearningMessage); - mcContent.setReportTitle(reportTitle); - mcContent.setMonitoringReportTitle(monitoringReportTitle); - mcContent.setEndLearningMessage(endLearningMessage); - mcContent.setOfflineInstructions(richTextOfflineInstructions); - mcContent.setOnlineInstructions(richTextOnlineInstructions); - + if (mcContent != null) + { + logger.debug("updating mcContent title and instructions:" + mcContent); + mcContent.setTitle(richTextTitle); + mcContent.setInstructions(richTextInstructions); + + mcContent.setQuestionsSequenced(isQuestionsSequenced); + mcContent.setSynchInMonitor(isSynchInMonitor); + mcContent.setUsernameVisible(isUsernameVisible); + mcContent.setRetries(isRetries); + mcContent.setPassMark(new Integer(passmark)); + mcContent.setShowFeedback(isShowFeedback); + mcContent.setEndLearningMessage(endLearningMessage); + mcContent.setReportTitle(reportTitle); + mcContent.setMonitoringReportTitle(monitoringReportTitle); + mcContent.setEndLearningMessage(endLearningMessage); + mcContent.setOfflineInstructions(richTextOfflineInstructions); + mcContent.setOnlineInstructions(richTextOnlineInstructions); + } + else + { + mcContent=createContent(request, mcAuthoringForm); + logger.debug("mcContent created"); + } + mcService.resetAllQuestions(mcContent.getUid()); logger.debug("all question reset for :" + mcContent.getUid()); @@ -915,72 +942,11 @@ return (mapping.findForward(LOAD_QUESTIONS)); } - - - - mcAuthoringForm.resetUserAction(); return (mapping.findForward(LOAD_QUESTIONS)); } - /** - * shrinks the size of the Map to only used entries - * - * @param mapQuestionContent - * @param request - * @return - */ - protected Map repopulateMap(HttpServletRequest request, String parameterType) - { - Map mapTempQuestionsContent= new TreeMap(new McComparator()); - logger.debug("parameterType: " + parameterType); - - long mapCounter=0; - for (long i=1; i <= MAX_QUESTION_COUNT ; i++) - { - String candidateQuestionEntry =request.getParameter(parameterType + i); - if ( - (candidateQuestionEntry != null) && - (candidateQuestionEntry.length() > 0) - ) - { - mapCounter++; - mapTempQuestionsContent.put(new Long(mapCounter).toString(), candidateQuestionEntry); - } - } - logger.debug("return repopulated Map: " + mapTempQuestionsContent); - return mapTempQuestionsContent; - } - - - protected Map repopulateCurrentWeightsMap(HttpServletRequest request, String parameterType) - { - Map mapTempQuestionsContent= new TreeMap(new McComparator()); - logger.debug("parameterType: " + parameterType); - - long mapCounter=0; - for (long i=1; i <= MAX_QUESTION_COUNT ; i++) - { - String candidateEntry =request.getParameter(parameterType + i); - String questionText =request.getParameter("questionContent" + i); - if ((questionText != null) && (questionText.length() > 0)) - { - logger.debug("questionText: " + questionText); - if (candidateEntry != null) - { - mapCounter++; - mapTempQuestionsContent.put(new Long(mapCounter).toString(), candidateEntry); - } - } - - } - logger.debug("return repopulated Map: " + mapTempQuestionsContent); - return mapTempQuestionsContent; - } - - - protected McContent createContent(HttpServletRequest request, McAuthoringForm mcAuthoringForm) { IMcService mcService =McUtils.getToolService(request); @@ -1397,7 +1363,89 @@ } + /** + * shrinks the size of the Map to only used entries + * + * @param mapQuestionContent + * @param request + * @return + */ + protected Map repopulateMap(HttpServletRequest request, String parameterType) + { + Map mapTempQuestionsContent= new TreeMap(new McComparator()); + logger.debug("parameterType: " + parameterType); + + long mapCounter=0; + for (long i=1; i <= MAX_QUESTION_COUNT ; i++) + { + String candidateQuestionEntry =request.getParameter(parameterType + i); + if ( + (candidateQuestionEntry != null) && + (candidateQuestionEntry.length() > 0) + ) + { + mapCounter++; + mapTempQuestionsContent.put(new Long(mapCounter).toString(), candidateQuestionEntry); + } + } + logger.debug("return repopulated Map: " + mapTempQuestionsContent); + return mapTempQuestionsContent; + } + + + protected Map repopulateCurrentWeightsMap(HttpServletRequest request, String parameterType) + { + Map mapTempQuestionsContent= new TreeMap(new McComparator()); + logger.debug("parameterType: " + parameterType); + + long mapCounter=0; + for (long i=1; i <= MAX_QUESTION_COUNT ; i++) + { + String candidateEntry =request.getParameter(parameterType + i); + String questionText =request.getParameter("questionContent" + i); + if ((questionText != null) && (questionText.length() > 0)) + { + logger.debug("questionText: " + questionText); + if (candidateEntry != null) + { + mapCounter++; + mapTempQuestionsContent.put(new Long(mapCounter).toString(), candidateEntry); + } + } + + } + logger.debug("return repopulated Map: " + mapTempQuestionsContent); + return mapTempQuestionsContent; + } + + protected Map repopulateCurrentCheckBoxStatesMap(HttpServletRequest request) + { + Map mapTempContent= new TreeMap(new McComparator()); + + long mapCounter=0; + for (long i=1; i <= MAX_OPTION_COUNT ; i++) + { + String candidateEntry =request.getParameter("checkBoxSelected" + i); + String optionText =request.getParameter("optionContent" + i); + + if ( + (candidateEntry != null) && + (candidateEntry.length() > 0) + ) + { + if (candidateEntry.equals("Correct")) + { + mapCounter++; + mapTempContent.put(new Long(mapCounter).toString(), optionText); + } + } + } + logger.debug("return repopulated currentCheckBoxStatesMap: " + mapTempContent); + return mapTempContent; + } + + /** * persists error messages to request scope * @param request @@ -1410,4 +1458,5 @@ logger.debug("add " + message +" to ActionMessages:"); saveErrors(request,errors); } + } Index: lams_tool_lamc/web/BasicContent.jsp =================================================================== diff -u -r2dbeea64b0b9925ebfcc5b10ced841ad134a0f38 -r249ef6f46c46382fcf4b8dc2eb415d5af18b4cb0 --- lams_tool_lamc/web/BasicContent.jsp (.../BasicContent.jsp) (revision 2dbeea64b0b9925ebfcc5b10ced841ad134a0f38) +++ lams_tool_lamc/web/BasicContent.jsp (.../BasicContent.jsp) (revision 249ef6f46c46382fcf4b8dc2eb415d5af18b4cb0) @@ -37,13 +37,13 @@