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.62 -r1.63 --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McResources.properties 5 Feb 2006 14:32:56 -0000 1.62 +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McResources.properties 6 Feb 2006 21:32:38 -0000 1.63 @@ -138,6 +138,7 @@ error.question.weight.total =Please correct this: The total question weight:100 has been reached. error.answers.duplicate =Please correct this: The candidate answers must be unique. error.emptyQuestion =Please enter the question text. The chosen question can not be empty. +error.emptyWeight =Sorry, the question can not be added without a weight. error.title =Please correct this: The field "Title" is mandatory.
error.instructions =Please correct this: The field "Instructions" is mandatory.
error.reportTitle =Please correct this: The field "Report Title (Advanced)" is mandatory.
Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McUtils.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McUtils.java,v diff -u -r1.28 -r1.29 --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McUtils.java 5 Feb 2006 14:32:56 -0000 1.28 +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McUtils.java 6 Feb 2006 21:32:38 -0000 1.29 @@ -171,7 +171,7 @@ public static Map generateOptionsMap(List listMcOptions) { logger.debug("incoming listMcOptions" + listMcOptions); - Map mapOptionsContent= new TreeMap(new McComparator()); + Map mapOptionsContent= new TreeMap(new McStringComparator()); Iterator listIterator=listMcOptions.iterator(); Long mapIndex=new Long(1); @@ -509,6 +509,32 @@ } + public static void debugMaps(HttpServletRequest request) + { + Map mapQuestionsContent=(Map)request.getSession().getAttribute(MAP_QUESTIONS_CONTENT); + Map mapOptionsContent=(Map)request.getSession().getAttribute(MAP_OPTIONS_CONTENT); + Map mapGeneralOptionsContent=(Map)request.getSession().getAttribute(MAP_GENERAL_OPTIONS_CONTENT); + Map mapGeneralSelectedOptionsContent=(Map)request.getSession().getAttribute(MAP_GENERAL_SELECTED_OPTIONS_CONTENT); + Map mapStartupGeneralOptionsContent=(Map)request.getSession().getAttribute(MAP_STARTUP_GENERAL_OPTIONS_CONTENT); + Map mapStartupGeneralSelectedOptionsContent=(Map)request.getSession().getAttribute(MAP_STARTUP_GENERAL_SELECTED_OPTIONS_CONTENT); + Map mapDisabledQuestions=(Map)request.getSession().getAttribute(MAP_DISABLED_QUESTIONS); + Map mapWeights=(Map)request.getSession().getAttribute(MAP_WEIGHTS); + Map mapCheckBoxStates=(Map)request.getSession().getAttribute(MAP_CHECKBOX_STATES); + Map mapSelectedOptions=(Map)request.getSession().getAttribute(MAP_SELECTED_OPTIONS); + + logger.debug("START DEBUGGING MAPS:"); + logger.debug("mapQuestionsContent:" + mapQuestionsContent); + logger.debug("mapOptionsContent:" + mapOptionsContent); + logger.debug("mapGeneralOptionsContent:" + mapGeneralOptionsContent); + logger.debug("mapGeneralSelectedOptionsContent:" + mapGeneralSelectedOptionsContent); + logger.debug("mapStartupGeneralOptionsContent:" + mapStartupGeneralOptionsContent); + logger.debug("mapStartupGeneralSelectedOptionsContent:" + mapStartupGeneralSelectedOptionsContent); + logger.debug("mapDisabledQuestions:" + mapDisabledQuestions); + logger.debug("mapWeights:" + mapWeights); + logger.debug("mapCheckBoxStates:" + mapCheckBoxStates); + logger.debug("mapSelectedOptions:" + mapSelectedOptions); + logger.debug("STOP DEBUGGING MAPS"); + } 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.96 -r1.97 --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McAction.java 5 Feb 2006 15:01:55 -0000 1.96 +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McAction.java 6 Feb 2006 21:32:38 -0000 1.97 @@ -41,6 +41,7 @@ import org.lamsfoundation.lams.tool.mc.McApplicationException; import org.lamsfoundation.lams.tool.mc.McAttachmentDTO; import org.lamsfoundation.lams.tool.mc.McComparator; +import org.lamsfoundation.lams.tool.mc.McStringComparator; import org.lamsfoundation.lams.tool.mc.McUtils; import org.lamsfoundation.lams.tool.mc.pojos.McContent; import org.lamsfoundation.lams.tool.mc.pojos.McOptsContent; @@ -133,17 +134,10 @@ public class McAction extends LamsDispatchAction implements McAppConstants { /* - * change the logic about completion status - - * once lams_learning is ready and appContext file is src/ then FINISH toool session will work. - * * when to reset define later and synchin monitor etc.. * * make sure the tool gets called on: * setAsForceComplete(Long userId) throws McApplicationException - * - * Note: the tool must support deletion of an existing content from within the authoring environment. - * The current support for this is by implementing the tool contract : removeToolContent(Long toolContentId) */ static Logger logger = Logger.getLogger(McAction.class.getName()); @@ -191,7 +185,6 @@ } - /** * adds a new entry to the questions Map * @@ -211,6 +204,8 @@ ServletException { logger.debug("dispatching addNewQuestion..."); + McUtils.debugMaps(request); + McAuthoringForm mcAuthoringForm = (McAuthoringForm) form; IMcService mcService =McUtils.getToolService(request); @@ -242,7 +237,8 @@ int maxQuestionIndex=mapQuestionsContent.size(); request.getSession().setAttribute(MAX_QUESTION_INDEX, new Integer(maxQuestionIndex)); logger.debug("MAX_QUESTION_INDEX: " + request.getSession().getAttribute(MAX_QUESTION_INDEX)); - + + McUtils.debugMaps(request); return (mapping.findForward(destination)); } @@ -260,6 +256,7 @@ request.getSession().setAttribute(MAX_QUESTION_INDEX, new Integer(maxQuestionIndex)); logger.debug("MAX_QUESTION_INDEX: " + request.getSession().getAttribute(MAX_QUESTION_INDEX)); + McUtils.debugMaps(request); return (mapping.findForward(destination)); } @@ -280,6 +277,7 @@ request.getSession().setAttribute(MAX_QUESTION_INDEX, new Integer(maxQuestionIndex)); logger.debug("MAX_QUESTION_INDEX: " + request.getSession().getAttribute(MAX_QUESTION_INDEX)); + McUtils.debugMaps(request); return (mapping.findForward(destination)); } request.getSession().setAttribute(MAP_WEIGHTS, mapWeights); @@ -313,6 +311,7 @@ logger.debug("sequenced mapGeneralSelectedOptionsContent:"+ mapGeneralSelectedOptionsContent); request.getSession().setAttribute(MAP_GENERAL_SELECTED_OPTIONS_CONTENT, mapGeneralSelectedOptionsContent); + McUtils.debugMaps(request); return (mapping.findForward(destination)); } @@ -337,6 +336,7 @@ ServletException { logger.debug("dispatching removeQuestion..."); + McUtils.debugMaps(request); McAuthoringForm mcAuthoringForm = (McAuthoringForm) form; IMcService mcService =McUtils.getToolService(request); @@ -429,7 +429,8 @@ mapGeneralSelectedOptionsContent=AuthoringUtil.sequenceMap(mapGeneralSelectedOptionsContent); logger.debug("sequenced mapGeneralSelectedOptionsContent:"+ mapGeneralSelectedOptionsContent); request.getSession().setAttribute(MAP_GENERAL_SELECTED_OPTIONS_CONTENT, mapGeneralSelectedOptionsContent); - + + McUtils.debugMaps(request); return (mapping.findForward(destination)); } @@ -453,6 +454,8 @@ ServletException { logger.debug("dispatching editOptions..."); + McUtils.debugMaps(request); + McAuthoringForm mcAuthoringForm = (McAuthoringForm) form; IMcService mcService =McUtils.getToolService(request); @@ -473,11 +476,10 @@ Map mapQuestionsContent=AuthoringUtil.repopulateMap(request, "questionContent"); logger.debug("mapQuestionsContent after shrinking: " + mapQuestionsContent); logger.debug("mapQuestionsContent size after shrinking: " + mapQuestionsContent.size()); - request.getSession().setAttribute(MAP_QUESTIONS_CONTENT, mapQuestionsContent); + Map mapWeights= AuthoringUtil.repopulateMap(request, "questionWeight"); - request.getSession().setAttribute(MAP_WEIGHTS, mapWeights); - logger.debug("MAP_WEIGHTS:" + request.getSession().getAttribute(MAP_WEIGHTS)); + logger.debug("MAP_WEIGHTS:" + request.getSession().getAttribute(MAP_WEIGHTS)); String questionIndex =mcAuthoringForm.getQuestionIndex(); logger.debug("questionIndex:" + questionIndex); @@ -499,9 +501,34 @@ request.getSession().setAttribute(EDIT_OPTIONS_MODE, new Integer(0)); logger.debug("setting EDIT_OPTIONS_MODE to 0"); + + McUtils.debugMaps(request); return (mapping.findForward(destination)); } + String editableQuestionWeight=(String)mapWeights.get(questionIndex); + logger.debug("editableQuestionWeight:" + editableQuestionWeight); + + if ((editableQuestionWeight == null) || (editableQuestionWeight.equals(""))) + { + ActionMessages errors= new ActionMessages(); + errors.add(Globals.ERROR_KEY,new ActionMessage("error.emptyWeight")); + logger.debug("add error.emptyWeight to ActionMessages"); + saveErrors(request,errors); + mcAuthoringForm.resetUserAction(); + logger.debug("return to destination to fix error."); + + request.getSession().setAttribute(EDIT_OPTIONS_MODE, new Integer(0)); + logger.debug("setting EDIT_OPTIONS_MODE to 0"); + + McUtils.debugMaps(request); + return (mapping.findForward(destination)); + } + + /*persist valid question and weights maps into session*/ + request.getSession().setAttribute(MAP_QUESTIONS_CONTENT, mapQuestionsContent); + request.getSession().setAttribute(MAP_WEIGHTS, mapWeights); + Long toolContentId=(Long)request.getSession().getAttribute(TOOL_CONTENT_ID); logger.debug("toolContentId:" + toolContentId); @@ -512,7 +539,7 @@ Iterator itMapGeneral = mapGeneralOptionsContent.entrySet().iterator(); boolean optionsPresentationValid=false; - Map mapOptionsContent= new TreeMap(new McComparator()); + Map mapOptionsContent= new TreeMap(new McStringComparator()); Map mapSelectedOptions= new TreeMap(new McComparator()); Map mapGsoc=(Map)request.getSession().getAttribute(MAP_GENERAL_SELECTED_OPTIONS_CONTENT); logger.debug("mapGsoc from the cache: " + mapGsoc); @@ -613,7 +640,7 @@ List listOptionsContent=mcService.findMcOptionsContentByQueId(mcQueContent.getUid()); logger.debug("listOptionsContent: " + listOptionsContent); - mapOptionsContent= new TreeMap(new McComparator()); + mapOptionsContent= new TreeMap(new McStringComparator()); mapSelectedOptions= new TreeMap(new McComparator()); /* options have been persisted before */ @@ -760,7 +787,8 @@ mapGeneralSelectedOptionsContent=AuthoringUtil.sequenceMap(mapGeneralSelectedOptionsContent); logger.debug("sequenced mapGeneralSelectedOptionsContent:"+ mapGeneralSelectedOptionsContent); request.getSession().setAttribute(MAP_GENERAL_SELECTED_OPTIONS_CONTENT, mapGeneralSelectedOptionsContent); - + + McUtils.debugMaps(request); return (mapping.findForward(destination)); } @@ -784,6 +812,8 @@ ServletException { logger.debug("dispatching addOption..."); + McUtils.debugMaps(request); + McAuthoringForm mcAuthoringForm = (McAuthoringForm) form; IMcService mcService =McUtils.getToolService(request); @@ -815,6 +845,8 @@ request.getSession().setAttribute(EDIT_OPTIONS_MODE, new Integer(1)); logger.debug("setting EDIT_OPTIONS_MODE to 1"); + + McUtils.debugMaps(request); return (mapping.findForward(destination)); } @@ -831,6 +863,8 @@ request.getSession().setAttribute(EDIT_OPTIONS_MODE, new Integer(1)); logger.debug("setting EDIT_OPTIONS_MODE to 1"); + + McUtils.debugMaps(request); return (mapping.findForward(destination)); } @@ -905,6 +939,7 @@ logger.debug("sequenced mapGeneralSelectedOptionsContent:"+ mapGeneralSelectedOptionsContent); request.getSession().setAttribute(MAP_GENERAL_SELECTED_OPTIONS_CONTENT, mapGeneralSelectedOptionsContent); + McUtils.debugMaps(request); return (mapping.findForward(destination)); } @@ -928,6 +963,8 @@ ServletException { logger.debug("dispatching removeOption..."); + McUtils.debugMaps(request); + McAuthoringForm mcAuthoringForm = (McAuthoringForm) form; IMcService mcService =McUtils.getToolService(request); @@ -960,6 +997,8 @@ request.getSession().setAttribute(EDIT_OPTIONS_MODE, new Integer(1)); logger.debug("setting EDIT_OPTIONS_MODE :" + 1); + + McUtils.debugMaps(request); return (mapping.findForward(destination)); } @@ -1040,6 +1079,8 @@ mapGeneralSelectedOptionsContent=AuthoringUtil.sequenceMap(mapGeneralSelectedOptionsContent); logger.debug("sequenced mapGeneralSelectedOptionsContent:"+ mapGeneralSelectedOptionsContent); request.getSession().setAttribute(MAP_GENERAL_SELECTED_OPTIONS_CONTENT, mapGeneralSelectedOptionsContent); + + McUtils.debugMaps(request); return (mapping.findForward(destination)); } @@ -1063,6 +1104,8 @@ ServletException { logger.debug("dispatching moveQuestionDown..."); + McUtils.debugMaps(request); + McAuthoringForm mcAuthoringForm = (McAuthoringForm) form; IMcService mcService =McUtils.getToolService(request); @@ -1145,6 +1188,8 @@ mapGeneralSelectedOptionsContent=AuthoringUtil.sequenceMap(mapGeneralSelectedOptionsContent); logger.debug("sequenced mapGeneralSelectedOptionsContent:"+ mapGeneralSelectedOptionsContent); request.getSession().setAttribute(MAP_GENERAL_SELECTED_OPTIONS_CONTENT, mapGeneralSelectedOptionsContent); + + McUtils.debugMaps(request); return (mapping.findForward(destination)); } @@ -1168,6 +1213,8 @@ ServletException { logger.debug("dispatching moveQuestionUp..."); + McUtils.debugMaps(request); + McAuthoringForm mcAuthoringForm = (McAuthoringForm) form; IMcService mcService =McUtils.getToolService(request); @@ -1250,6 +1297,7 @@ logger.debug("sequenced mapGeneralSelectedOptionsContent:"+ mapGeneralSelectedOptionsContent); request.getSession().setAttribute(MAP_GENERAL_SELECTED_OPTIONS_CONTENT, mapGeneralSelectedOptionsContent); + McUtils.debugMaps(request); return (mapping.findForward(destination)); } @@ -1273,6 +1321,8 @@ ServletException { logger.debug("dispatching doneOptions..."); + McUtils.debugMaps(request); + McAuthoringForm mcAuthoringForm = (McAuthoringForm) form; IMcService mcService =McUtils.getToolService(request); @@ -1301,6 +1351,8 @@ request.getSession().setAttribute(EDIT_OPTIONS_MODE, new Integer(1)); logger.debug("setting EDIT_OPTIONS_MODE to 1"); + + McUtils.debugMaps(request); return (mapping.findForward(destination)); } @@ -1385,6 +1437,7 @@ logger.debug("sequenced mapGeneralSelectedOptionsContent:"+ mapGeneralSelectedOptionsContent); request.getSession().setAttribute(MAP_GENERAL_SELECTED_OPTIONS_CONTENT, mapGeneralSelectedOptionsContent); + McUtils.debugMaps(request); return (mapping.findForward(destination)); } @@ -1417,6 +1470,8 @@ ToolException { logger.debug("dispatching editActivityQuestions..."); + McUtils.debugMaps(request); + IMcService mcService =McUtils.getToolService(request); /* determine whether the request is from Monitoring url Edit Activity*/ @@ -1430,7 +1485,8 @@ request.getSession().setAttribute(EDIT_OPTIONS_MODE, new Integer(0)); logger.debug("setting EDIT_OPTIONS_MODE to 0"); - + + McUtils.debugMaps(request); return (mapping.findForward(destination)); } @@ -1455,6 +1511,8 @@ { logger.debug("dispatching submitQuestions..."); + McUtils.debugMaps(request); + McAuthoringForm mcAuthoringForm = (McAuthoringForm) form; IMcService mcService =McUtils.getToolService(request); @@ -1475,7 +1533,6 @@ logger.debug("mapQuestionsContent before submit: " + mapQuestionsContent); request.getSession().setAttribute(MAP_QUESTIONS_CONTENT, mapQuestionsContent); - Long toolContentId=(Long)request.getSession().getAttribute(TOOL_CONTENT_ID); logger.debug("toolContentId:" + toolContentId); AuthoringUtil.refreshMaps(request, toolContentId.longValue()); @@ -1526,7 +1583,8 @@ saveErrors(request,errors); mcAuthoringForm.resetUserAction(); persistError(request,"error.questions.submitted.none"); - + + McUtils.debugMaps(request); return (mapping.findForward(destination)); } @@ -1546,7 +1604,8 @@ int maxQuestionIndex=mapQuestionsContent.size(); request.getSession().setAttribute(MAX_QUESTION_INDEX, new Integer(maxQuestionIndex)); logger.debug("MAX_QUESTION_INDEX: " + request.getSession().getAttribute(MAX_QUESTION_INDEX)); - + + McUtils.debugMaps(request); return (mapping.findForward(destination)); } @@ -1568,6 +1627,7 @@ request.getSession().setAttribute(MAX_QUESTION_INDEX, new Integer(maxQuestionIndex)); logger.debug("MAX_QUESTION_INDEX: " + request.getSession().getAttribute(MAX_QUESTION_INDEX)); + McUtils.debugMaps(request); return (mapping.findForward(destination)); } @@ -1628,6 +1688,7 @@ request.getSession().setAttribute(MAX_QUESTION_INDEX, new Integer(maxQuestionIndex)); logger.debug("MAX_QUESTION_INDEX: " + request.getSession().getAttribute(MAX_QUESTION_INDEX)); + McUtils.debugMaps(request); return (mapping.findForward(destination)); } } @@ -1653,6 +1714,7 @@ request.getSession().setAttribute(MAX_QUESTION_INDEX, new Integer(maxQuestionIndex)); logger.debug("MAX_QUESTION_INDEX: " + request.getSession().getAttribute(MAX_QUESTION_INDEX)); + McUtils.debugMaps(request); return (mapping.findForward(destination)); } @@ -1674,6 +1736,7 @@ request.getSession().setAttribute(MAX_QUESTION_INDEX, new Integer(maxQuestionIndex)); logger.debug("MAX_QUESTION_INDEX: " + request.getSession().getAttribute(MAX_QUESTION_INDEX)); + McUtils.debugMaps(request); return (mapping.findForward(destination)); } request.getSession().setAttribute(PASSMARK, new Integer(passmark).toString()); @@ -1864,6 +1927,8 @@ request.getSession().setAttribute(ACTIVE_MODULE, DEFINE_LATER); request.getSession().setAttribute(DEFINE_LATER_IN_EDIT_MODE, new Boolean(false)); } + + McUtils.debugMaps(request); return (mapping.findForward(destination)); } @@ -1888,6 +1953,8 @@ { logger.debug("dispatching deleteOfflineFile..."); + McUtils.debugMaps(request); + McAuthoringForm mcAuthoringForm = (McAuthoringForm) form; IMcService mcService =McUtils.getToolService(request); @@ -1909,6 +1976,8 @@ request.getSession().setAttribute(LIST_OFFLINEFILES_METADATA, listOfflineFilesMetaData); mcAuthoringForm.resetUserAction(); + + McUtils.debugMaps(request); return (mapping.findForward(destination)); } @@ -1934,6 +2003,8 @@ { logger.debug("dispatching deleteOnlineFile..."); + McUtils.debugMaps(request); + McAuthoringForm mcAuthoringForm = (McAuthoringForm) form; IMcService mcService =McUtils.getToolService(request); @@ -1955,6 +2026,8 @@ request.getSession().setAttribute(LIST_ONLINEFILES_METADATA, listOnlineFilesMetaData); mcAuthoringForm.resetUserAction(); + + McUtils.debugMaps(request); return (mapping.findForward(destination)); } @@ -1979,6 +2052,8 @@ RepositoryCheckedException { logger.debug("dispatching submitOfflineFile..."); + McUtils.debugMaps(request); + McAuthoringForm mcAuthoringForm = (McAuthoringForm) form; IMcService mcService =McUtils.getToolService(request); @@ -2005,6 +2080,8 @@ request.getSession().setAttribute(EDIT_OPTIONS_MODE, new Integer(0)); logger.debug("setting EDIT_OPTIONS_MODE :" + 0); + + McUtils.debugMaps(request); return (mapping.findForward(destination)); } @@ -2018,6 +2095,8 @@ mcAuthoringForm.resetUserAction(); request.getSession().setAttribute(EDIT_OPTIONS_MODE, new Integer(0)); logger.debug("setting EDIT_OPTIONS_MODE :" + 0); + + McUtils.debugMaps(request); return (mapping.findForward(destination)); } @@ -2042,6 +2121,7 @@ RepositoryCheckedException { logger.debug("dispatching submitOnlineFiles..."); + McUtils.debugMaps(request); McAuthoringForm mcAuthoringForm = (McAuthoringForm) form; IMcService mcService =McUtils.getToolService(request); @@ -2068,6 +2148,7 @@ request.getSession().setAttribute(EDIT_OPTIONS_MODE, new Integer(0)); logger.debug("setting EDIT_OPTIONS_MODE :" + 0); + McUtils.debugMaps(request); return (mapping.findForward(destination)); } @@ -2080,6 +2161,8 @@ mcAuthoringForm.resetUserAction(); request.getSession().setAttribute(EDIT_OPTIONS_MODE, new Integer(0)); logger.debug("setting EDIT_OPTIONS_MODE :" + 0); + + McUtils.debugMaps(request); return (mapping.findForward(destination)); } @@ -2103,6 +2186,8 @@ ServletException { logger.debug("dispatching doneAdvancedTab..."); + McUtils.debugMaps(request); + McAuthoringForm mcAuthoringForm = (McAuthoringForm) form; IMcService mcService =McUtils.getToolService(request); @@ -2115,6 +2200,8 @@ AuthoringUtil.readData(request, mcAuthoringForm); mcAuthoringForm.resetUserAction(); + + McUtils.debugMaps(request); return (mapping.findForward(destination)); } @@ -2138,6 +2225,8 @@ ServletException { logger.debug("dispatching doneInstructionsTab..."); + McUtils.debugMaps(request); + McAuthoringForm mcAuthoringForm = (McAuthoringForm) form; IMcService mcService =McUtils.getToolService(request); @@ -2150,6 +2239,8 @@ AuthoringUtil.readData(request, mcAuthoringForm); mcAuthoringForm.resetUserAction(); + + McUtils.debugMaps(request); return (mapping.findForward(destination)); } @@ -2179,9 +2270,9 @@ ServletException { logger.debug("dispatching cancelAuthoring..."); + McUtils.debugMaps(request); McAuthoringForm mcAuthoringForm = (McAuthoringForm) form; - /* determine whether the request is from Monitoring url Edit Activity*/ String sourceMcStarter = (String) request.getAttribute(SOURCE_MC_STARTER); logger.debug("sourceMcStarter: " + sourceMcStarter); @@ -2193,6 +2284,7 @@ logger.debug("removed attribues..."); /* Check this: find out where to forward to*/ + McUtils.debugMaps(request); return (mapping.findForward(AUTHORING_STARTER)); } @@ -2208,6 +2300,7 @@ protected boolean validateQuestionWeights(HttpServletRequest request, Map mapWeights, McAuthoringForm mcAuthoringForm) { logger.debug("mapWeights: " + mapWeights); + McUtils.debugMaps(request); Iterator itMap = mapWeights.entrySet().iterator(); while (itMap.hasNext()) { @@ -2222,6 +2315,7 @@ saveErrors(request,errors); mcAuthoringForm.resetUserAction(); persistError(request,"error.weights.empty"); + return false; } Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McStarterAction.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McStarterAction.java,v diff -u -r1.63 -r1.64 --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McStarterAction.java 5 Feb 2006 15:01:55 -0000 1.63 +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McStarterAction.java 6 Feb 2006 21:32:38 -0000 1.64 @@ -135,6 +135,7 @@ import org.lamsfoundation.lams.tool.mc.McAppConstants; import org.lamsfoundation.lams.tool.mc.McApplicationException; import org.lamsfoundation.lams.tool.mc.McComparator; +import org.lamsfoundation.lams.tool.mc.McStringComparator; import org.lamsfoundation.lams.tool.mc.McUtils; import org.lamsfoundation.lams.tool.mc.pojos.McContent; import org.lamsfoundation.lams.tool.mc.pojos.McOptsContent; @@ -184,7 +185,7 @@ } initialiseAttributes(request); - /* determine whether the request is from Monitoring url Edit Activity + /* determine whether the request is from Monitoring url Edit Activity. * null sourceMcStarter indicates that the request is from authoring url. * */ @@ -398,6 +399,7 @@ /* we should allow content to be edited if the url mode is define Later*/ if (!defineLater.equals(DEFINE_LATER)) { + logger.debug("the url mode is :" + defineLater); if (isDefineLater == true) { persistError(request,"error.content.beingModified"); @@ -566,6 +568,8 @@ protected void retrieveExistingContent(HttpServletRequest request, McAuthoringForm mcAuthoringForm, long toolContentId, McContent mcContent) { IMcService mcService =McUtils.getToolService(request); + logger.debug("mcService:" + mcService); + request.getSession().setAttribute(IS_REVISITING_USER, new Boolean(true)); /*to find out whether the content is being modified or not*/ request.getSession().setAttribute(DEFINE_LATER, new Boolean(mcContent.isDefineLater())); @@ -578,7 +582,6 @@ /*used in advanced tab*/ request.getSession().setAttribute(RICHTEXT_REPORT_TITLE,mcContent.getReportTitle()); request.getSession().setAttribute(RICHTEXT_END_LEARNING_MSG,mcContent.getEndLearningMessage()); - //request.getSession().setAttribute(RETRIES, new Boolean(mcContent.isRetries())); request.getSession().setAttribute(PASSMARK, mcContent.getPassMark()); //Integer /* used in instructions tab*/ @@ -590,7 +593,6 @@ request.getSession().setAttribute(CREATION_DATE,creationDate); logger.debug("RICHTEXT_TITLE:" + request.getSession().getAttribute(RICHTEXT_TITLE)); - logger.debug("getting name lists based on uid:" + mcContent.getUid()); List listUploadedOffFiles= mcService.retrieveMcUploadedOfflineFilesName(mcContent.getUid()); @@ -616,6 +618,8 @@ logger.debug("starter initialized the existing Questions Map: " + request.getSession().getAttribute(MAP_QUESTIONS_CONTENT)); AuthoringUtil.refreshMaps(request, toolContentId); + AuthoringUtil.assignStaterMapsToCurrentMaps(request); + /*process offline files metadata*/ List listOfflineFilesMetaData=mcService.getOfflineFilesMetaData(mcContent.getUid()); logger.debug("existing listOfflineFilesMetaData, to be structured as McAttachmentDTO: " + listOfflineFilesMetaData); @@ -649,7 +653,15 @@ */ protected void retrieveDefaultContent(HttpServletRequest request, McAuthoringForm mcAuthoringForm) { - IMcService mcService =McUtils.getToolService(request); + IMcService mcService = (IMcService)request.getSession().getAttribute(TOOL_SERVICE); + logger.debug("mcService: " + mcService); + if (mcService == null) + { + logger.debug("will retrieve mcService"); + mcService = McServiceProxy.getMcService(getServlet().getServletContext()); + logger.debug("retrieving mcService from cache: " + mcService); + } + request.getSession().setAttribute(IS_REVISITING_USER, new Boolean(false)); request.getSession().setAttribute(DEFINE_LATER_EDIT_ACTIVITY, new Boolean(false)); @@ -658,12 +670,13 @@ long contentId=0; logger.debug("getting default content"); contentId=mcService.getToolDefaultContentIdBySignature(MY_SIGNATURE); + logger.debug("contentId:" + contentId); McContent mcContent=mcService.retrieveMc(new Long(contentId)); logger.debug("mcContent:" + mcContent); /* reset all radioboxes to false*/ mcAuthoringForm.resetRadioBoxes(); - logger.debug("all radioboxes arec reset"); + logger.debug("all radioboxes are reset"); request.getSession().setAttribute(RICHTEXT_TITLE,mcContent.getTitle()); request.getSession().setAttribute(RICHTEXT_INSTRUCTIONS,mcContent.getInstructions()); @@ -676,7 +689,6 @@ request.getSession().setAttribute(RICHTEXT_END_LEARNING_MSG,mcContent.getEndLearningMessage()); logger.debug("PASSMARK:" + request.getSession().getAttribute(PASSMARK)); - logger.debug("RICHTEXT_TITLE:" + request.getSession().getAttribute(RICHTEXT_TITLE)); logger.debug("getting default content"); @@ -703,7 +715,7 @@ List list=mcService.findMcOptionsContentByQueId(mcQueContent.getUid()); logger.debug("options list:" + list); - Map mapOptionsContent= new TreeMap(new McComparator()); + Map mapOptionsContent= new TreeMap(new McStringComparator()); Iterator listIterator=list.iterator(); Long mapIndex=new Long(1); while (listIterator.hasNext()) @@ -758,10 +770,6 @@ request.getSession().setAttribute(LIST_OFFLINEFILES_METADATA, listOfflineFilesMetaData); request.getSession().setAttribute(LIST_ONLINEFILES_METADATA, listOnlineFilesMetaData); - Map mapQuestionsContent= new TreeMap(new McComparator()); - Map mapOptionsContent= new TreeMap(new McComparator()); - Map mapDefaultOptionsContent= new TreeMap(new McComparator()); - Map mapGeneralOptionsContent= new TreeMap(new McComparator()); request.getSession().setAttribute(MAP_GENERAL_OPTIONS_CONTENT, mapGeneralOptionsContent);