Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McResources.properties =================================================================== RCS file: /usr/local/cvsroot/lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/Attic/McResources.properties,v diff -u -r1.17 -r1.18 --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McResources.properties 28 Oct 2005 19:15:47 -0000 1.17 +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McResources.properties 29 Oct 2005 12:02:49 -0000 1.18 @@ -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 =================================================================== RCS file: /usr/local/cvsroot/lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McAction.java,v diff -u -r1.26 -r1.27 --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McAction.java 28 Oct 2005 19:15:47 -0000 1.26 +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McAction.java 29 Oct 2005 12:02:49 -0000 1.27 @@ -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 =================================================================== RCS file: /usr/local/cvsroot/lams_tool_lamc/web/Attic/BasicContent.jsp,v diff -u -r1.2 -r1.3 --- lams_tool_lamc/web/BasicContent.jsp 28 Oct 2005 19:15:46 -0000 1.2 +++ lams_tool_lamc/web/BasicContent.jsp 29 Oct 2005 12:02:49 -0000 1.3 @@ -37,13 +37,13 @@