Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McAppConstants.java =================================================================== diff -u -r57412c3df9867b1ccef773efe817994848c58870 -rdecc127e5fc343f5cd178e0c6481b987be36a35e --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McAppConstants.java (.../McAppConstants.java) (revision 57412c3df9867b1ccef773efe817994848c58870) +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McAppConstants.java (.../McAppConstants.java) (revision decc127e5fc343f5cd178e0c6481b987be36a35e) @@ -127,6 +127,7 @@ public static final String CHOICE_TYPE_ADVANCED ="choiceTypeAdvanced"; public static final String CHOICE_TYPE_INSTRUCTIONS ="choiceTypeInstructions"; public static final String EDIT_OPTIONS_MODE ="editOptionsMode"; + public static final String SUBMIT_SUCCESS ="submitSuccess"; /** Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McResources.properties =================================================================== diff -u -r62fed58c7feaf586a7f6ae9b6f2aa91fad04e1d3 -rdecc127e5fc343f5cd178e0c6481b987be36a35e --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McResources.properties (.../McResources.properties) (revision 62fed58c7feaf586a7f6ae9b6f2aa91fad04e1d3) +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McResources.properties (.../McResources.properties) (revision decc127e5fc343f5cd178e0c6481b987be36a35e) @@ -75,6 +75,7 @@ error.checkBoxes.empty =Please correct this: No candidate answer has been selected. error.weights.zero =Please correct this: The question weights can not be 0. error.weights.notInteger =Please correct this: The question weights must be an integer. +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.title =Please correct this: The field "Title" is mandatory.
Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McAction.java =================================================================== diff -u -rec045225325cf41e01a4fb7d4940528659fe1b98 -rdecc127e5fc343f5cd178e0c6481b987be36a35e --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McAction.java (.../McAction.java) (revision ec045225325cf41e01a4fb7d4940528659fe1b98) +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McAction.java (.../McAction.java) (revision decc127e5fc343f5cd178e0c6481b987be36a35e) @@ -354,6 +354,27 @@ logger.debug("MAX_QUESTION_INDEX: " + request.getSession().getAttribute(MAX_QUESTION_INDEX)); return (mapping.findForward(LOAD_QUESTIONS)); } + + + logger.debug("will validate SubTotalWeights"); + boolean subWeightsValid=validateSubTotalWeights(request,mcAuthoringForm); + logger.debug("subWeightsValid:" + subWeightsValid); + if (subWeightsValid == false) + { + ActionMessages errors= new ActionMessages(); + errors= new ActionMessages(); + errors.add(Globals.ERROR_KEY,new ActionMessage("error.question.weight.total")); + saveErrors(request,errors); + mcAuthoringForm.resetUserAction(); + persistError(request,"error.question.weight.total"); + + request.getSession().setAttribute(CURRENT_TAB, new Long(1)); + + int maxQuestionIndex=mapQuestionsContent.size(); + request.getSession().setAttribute(MAX_QUESTION_INDEX, new Integer(maxQuestionIndex)); + logger.debug("MAX_QUESTION_INDEX: " + request.getSession().getAttribute(MAX_QUESTION_INDEX)); + return (mapping.findForward(LOAD_QUESTIONS)); + } Map mapWeights= repopulateMap(request, "questionWeight"); @@ -1187,7 +1208,10 @@ errors.add(Globals.ERROR_KEY,new ActionMessage("submit.successful")); logger.debug("add submit.successful to ActionMessages"); saveErrors(request,errors); + request.setAttribute(SUBMIT_SUCCESS, new Integer(1)); + logger.debug("set SUBMIT_SUCCESS to 1"); + request.getSession().setAttribute(EDIT_OPTIONS_MODE, new Integer(0)); logger.debug("setting EDIT_OPTIONS_MODE to 0"); @@ -1578,6 +1602,29 @@ } + protected boolean validateSubTotalWeights(HttpServletRequest request, McAuthoringForm mcAuthoringForm) + { + Map mapWeights= repopulateCurrentWeightsMap(request, "questionWeight"); + logger.debug("mapWeights: " + mapWeights); + + int totalWeight=0; + Iterator itMap = mapWeights.entrySet().iterator(); + while (itMap.hasNext()) { + Map.Entry pairs = (Map.Entry)itMap.next(); + logger.debug("using the pair: " + pairs.getKey() + " = " + pairs.getValue()); + + int currentWeight=new Integer(pairs.getValue().toString()).intValue(); + totalWeight= totalWeight + currentWeight; + logger.debug("sub totalWeight: " + totalWeight); + } + logger.debug("final totalWeight: " + totalWeight); + + if (totalWeight > 100) + return false; + else + return true; + } + protected boolean validateQuestionWeights(HttpServletRequest request, McAuthoringForm mcAuthoringForm) { Map mapWeights= repopulateCurrentWeightsMap(request, "questionWeight"); Index: lams_tool_lamc/web/BasicContent.jsp =================================================================== diff -u -rec045225325cf41e01a4fb7d4940528659fe1b98 -rdecc127e5fc343f5cd178e0c6481b987be36a35e --- lams_tool_lamc/web/BasicContent.jsp (.../BasicContent.jsp) (revision ec045225325cf41e01a4fb7d4940528659fe1b98) +++ lams_tool_lamc/web/BasicContent.jsp (.../BasicContent.jsp) (revision decc127e5fc343f5cd178e0c6481b987be36a35e) @@ -57,7 +57,7 @@ - : + : " value="" @@ -89,11 +89,12 @@ - : + : - " value="" size="50" maxlength="255" > - + " value="" + size="50" maxlength="255" > + Index: lams_tool_lamc/web/OptionsContent.jsp =================================================================== diff -u -r4104892571edba09bbe5854515ef4b40d37b9c20 -rdecc127e5fc343f5cd178e0c6481b987be36a35e --- lams_tool_lamc/web/OptionsContent.jsp (.../OptionsContent.jsp) (revision 4104892571edba09bbe5854515ef4b40d37b9c20) +++ lams_tool_lamc/web/OptionsContent.jsp (.../OptionsContent.jsp) (revision decc127e5fc343f5cd178e0c6481b987be36a35e) @@ -5,23 +5,26 @@ <%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %> <%@ taglib uri="fck-editor" prefix="FCK" %> - - +
- - + - + + + + + + + + - - - - - - - - - - +
+ : + + " size="50" maxlength="255">
+ +  
+ + + - + + + - - + + + "> - + +
: : - " value="" - size="50" maxlength="255"> - -   - + size="50" maxlength="255"> + @@ -72,27 +77,21 @@ - - -   - - - - + +
: - " value="" - size="50" maxlength="255"> + : -   + " value="" + size="50" maxlength="255"> @@ -113,50 +112,50 @@ - - -   - - - - - + +
-    + +  
-    + +  
+ +
+ + @@ -165,8 +164,8 @@
  + Index: lams_tool_lamc/web/authoringMaincontent.jsp =================================================================== diff -u -r57412c3df9867b1ccef773efe817994848c58870 -rdecc127e5fc343f5cd178e0c6481b987be36a35e --- lams_tool_lamc/web/authoringMaincontent.jsp (.../authoringMaincontent.jsp) (revision 57412c3df9867b1ccef773efe817994848c58870) +++ lams_tool_lamc/web/authoringMaincontent.jsp (.../authoringMaincontent.jsp) (revision decc127e5fc343f5cd178e0c6481b987be36a35e) @@ -96,7 +96,7 @@ - Index: lams_tool_lamc/web/errorbox.jsp =================================================================== diff -u -r8638df541d8dada50e311c121e24534c33a889d6 -rdecc127e5fc343f5cd178e0c6481b987be36a35e --- lams_tool_lamc/web/errorbox.jsp (.../errorbox.jsp) (revision 8638df541d8dada50e311c121e24534c33a889d6) +++ lams_tool_lamc/web/errorbox.jsp (.../errorbox.jsp) (revision decc127e5fc343f5cd178e0c6481b987be36a35e) @@ -21,13 +21,23 @@ <%@ taglib uri="/WEB-INF/struts-html-el.tld" prefix="html-el" %> <%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %> - -
    - -
  • -
    -
-
+ + + + + + + + + + + + + + + + +
+ <%@ include file="errorbox.jsp" %>