Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McResources.properties
===================================================================
diff -u -rd6cf8ad18993af7a9d51820aa2cd2274d1560ac7 -r7d4312121d0ac51529464536ca8203c445f5d433
--- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McResources.properties (.../McResources.properties) (revision d6cf8ad18993af7a9d51820aa2cd2274d1560ac7)
+++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McResources.properties (.../McResources.properties) (revision 7d4312121d0ac51529464536ca8203c445f5d433)
@@ -2,13 +2,15 @@
#Authoring mode resources
label.authoring.mc =Multiple Choice
label.authoring.mc.basic =Please define the questions.
+label.mc.questions =Multiple Choice Questions
label.authoring.mc.basic.editOptions =Please define the question and/or its options.
label.authoring.title =Title
label.authoring.instructions =Instructions
label.Questions =Questions
label.weight =Weight
label.action =Action
label.actions =Actions
+label.add.question =Add Question
label.fileContent =File Content
button.basic =Basic
@@ -72,6 +74,7 @@
feedback =Please address the following issues before submit.
error.default.content.notSetup =The tool initialization error: The tool default content has not been set up properly.
+error.questions.submitted.none =Please correct this: No questions have been submitted.
error.question.empty =Please correct this: The question text can not be empty.
error.weights.empty =Please correct this: The question weights can not be empty.
error.checkBoxes.empty =Please correct this: No candidate answer has been selected.
Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McAction.java
===================================================================
diff -u -r27704d3c27e7319c0a145e10dd99717b6f5ed82c -r7d4312121d0ac51529464536ca8203c445f5d433
--- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McAction.java (.../McAction.java) (revision 27704d3c27e7319c0a145e10dd99717b6f5ed82c)
+++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McAction.java (.../McAction.java) (revision 7d4312121d0ac51529464536ca8203c445f5d433)
@@ -1,5 +1,4 @@
-/*
- *Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
+/* *Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org)
*
*This program is free software; you can redistribute it and/or modify
*it under the terms of the GNU General Public License as published by
@@ -293,7 +292,7 @@
}
mcAuthoringForm.resetUserAction();
- return (mapping.findForward(LOAD_FILE_CONTENT));
+ return null;
}
@@ -392,7 +391,7 @@
logger.debug("updated SELECTED_QUESTION");
}
- mcAuthoringForm.setAddQuestion(null);
+
mcAuthoringForm.setRemoveQuestion(null);
mcAuthoringForm.setEditOptions(null);
mcAuthoringForm.setMoveUp(null);
@@ -402,13 +401,15 @@
mcAuthoringForm.setViewFileItem(null);
+ /*
String addQuestion=request.getParameter("addQuestion");
logger.debug("parameter addQuestion" + addQuestion);
if ((addQuestion != null) && addQuestion.equals("1"))
{
logger.debug("parameter addQuestion is selected " + addQuestion);
mcAuthoringForm.setAddQuestion("1");
}
+ */
String editOptions=request.getParameter("editOptions");
@@ -503,6 +504,9 @@
int maxQuestionIndex=mapQuestionsContent.size();
request.getSession().setAttribute(MAX_QUESTION_INDEX, new Integer(maxQuestionIndex));
logger.debug("MAX_QUESTION_INDEX: " + request.getSession().getAttribute(MAX_QUESTION_INDEX));
+
+ mcAuthoringForm.setAddQuestion(null);
+ mcAuthoringForm.setSubmitQuestions(null);
return (mapping.findForward(LOAD_QUESTIONS));
}
@@ -517,6 +521,9 @@
int maxQuestionIndex=mapQuestionsContent.size();
request.getSession().setAttribute(MAX_QUESTION_INDEX, new Integer(maxQuestionIndex));
logger.debug("MAX_QUESTION_INDEX: " + request.getSession().getAttribute(MAX_QUESTION_INDEX));
+
+ mcAuthoringForm.setAddQuestion(null);
+ mcAuthoringForm.setSubmitQuestions(null);
return (mapping.findForward(LOAD_QUESTIONS));
}
@@ -538,6 +545,9 @@
int maxQuestionIndex=mapQuestionsContent.size();
request.getSession().setAttribute(MAX_QUESTION_INDEX, new Integer(maxQuestionIndex));
logger.debug("MAX_QUESTION_INDEX: " + request.getSession().getAttribute(MAX_QUESTION_INDEX));
+
+ mcAuthoringForm.setAddQuestion(null);
+ mcAuthoringForm.setSubmitQuestions(null);
return (mapping.findForward(LOAD_QUESTIONS));
}
@@ -557,7 +567,10 @@
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));
+
+ mcAuthoringForm.setAddQuestion(null);
+ mcAuthoringForm.setSubmitQuestions(null);
+ return (mapping.findForward(LOAD_QUESTIONS));
}
/**
@@ -1306,12 +1319,31 @@
request.getSession().setAttribute(EDIT_OPTIONS_MODE, new Integer(0));
logger.debug("setting EDIT_OPTIONS_MODE to 0");
+ ActionMessages errors= new ActionMessages();
+
Map mapQuestionsContent=repopulateMap(request, "questionContent");
- logger.debug("mapQuestionsContent before move down: " + mapQuestionsContent);
+ logger.debug("mapQuestionsContent before submit: " + mapQuestionsContent);
request.getSession().setAttribute(MAP_QUESTIONS_CONTENT, mapQuestionsContent);
+
+ /* make sure the questions Map is not empty*/
+ int mapSize=mapQuestionsContent.size();
+ logger.debug("mapSize: " + mapSize);
- ActionMessages errors= new ActionMessages();
-
+ if (mapSize == 0)
+ {
+ request.getSession().setAttribute(CURRENT_TAB, new Long(1));
+
+ errors= new ActionMessages();
+ errors.add(Globals.ERROR_KEY,new ActionMessage("error.questions.submitted.none"));
+ saveErrors(request,errors);
+ mcAuthoringForm.resetUserAction();
+ persistError(request,"error.questions.submitted.none");
+
+ mcAuthoringForm.setAddQuestion(null);
+ mcAuthoringForm.setSubmitQuestions(null);
+ return (mapping.findForward(LOAD_QUESTIONS));
+ }
+
boolean weightsValid=validateQuestionWeights(request,mcAuthoringForm);
logger.debug("weightsValid:" + weightsValid);
if (weightsValid == false)
@@ -1322,6 +1354,9 @@
int maxQuestionIndex=mapQuestionsContent.size();
request.getSession().setAttribute(MAX_QUESTION_INDEX, new Integer(maxQuestionIndex));
logger.debug("MAX_QUESTION_INDEX: " + request.getSession().getAttribute(MAX_QUESTION_INDEX));
+
+ mcAuthoringForm.setAddQuestion(null);
+ mcAuthoringForm.setSubmitQuestions(null);
return (mapping.findForward(LOAD_QUESTIONS));
}
@@ -1342,6 +1377,9 @@
int maxQuestionIndex=mapQuestionsContent.size();
request.getSession().setAttribute(MAX_QUESTION_INDEX, new Integer(maxQuestionIndex));
logger.debug("MAX_QUESTION_INDEX: " + request.getSession().getAttribute(MAX_QUESTION_INDEX));
+
+ mcAuthoringForm.setAddQuestion(null);
+ mcAuthoringForm.setSubmitQuestions(null);
return (mapping.findForward(LOAD_QUESTIONS));
}
@@ -1401,6 +1439,9 @@
int maxQuestionIndex=mapQuestionsContent.size();
request.getSession().setAttribute(MAX_QUESTION_INDEX, new Integer(maxQuestionIndex));
logger.debug("MAX_QUESTION_INDEX: " + request.getSession().getAttribute(MAX_QUESTION_INDEX));
+
+ mcAuthoringForm.setAddQuestion(null);
+ mcAuthoringForm.setSubmitQuestions(null);
return (mapping.findForward(LOAD_QUESTIONS));
}
}
@@ -1427,6 +1468,9 @@
int maxQuestionIndex=mapQuestionsContent.size();
request.getSession().setAttribute(MAX_QUESTION_INDEX, new Integer(maxQuestionIndex));
logger.debug("MAX_QUESTION_INDEX: " + request.getSession().getAttribute(MAX_QUESTION_INDEX));
+
+ mcAuthoringForm.setAddQuestion(null);
+ mcAuthoringForm.setSubmitQuestions(null);
return (mapping.findForward(LOAD_QUESTIONS));
}
@@ -1457,7 +1501,7 @@
logger.debug("richTextInstructions: " + richTextInstructions);
- if ((richTextTitle == null) || (richTextTitle.length() == 0) || richTextTitle.equalsIgnoreCase(RICHTEXT_BLANK))
+ if ((richTextTitle == null) || (richTextTitle.length() == 0) || richTextTitle.equalsIgnoreCase(RICHTEXT_BLANK))
{
errors.add(Globals.ERROR_KEY,new ActionMessage("error.title"));
logger.debug("add title to ActionMessages");
@@ -1480,6 +1524,9 @@
int maxQuestionIndex=mapQuestionsContent.size();
request.getSession().setAttribute(MAX_QUESTION_INDEX, new Integer(maxQuestionIndex));
logger.debug("MAX_QUESTION_INDEX: " + request.getSession().getAttribute(MAX_QUESTION_INDEX));
+
+ mcAuthoringForm.setAddQuestion(null);
+ mcAuthoringForm.setSubmitQuestions(null);
return (mapping.findForward(LOAD_QUESTIONS));
}
@@ -1572,6 +1619,9 @@
int maxQuestionIndex=mapQuestionsContent.size();
request.getSession().setAttribute(MAX_QUESTION_INDEX, new Integer(maxQuestionIndex));
logger.debug("MAX_QUESTION_INDEX: " + request.getSession().getAttribute(MAX_QUESTION_INDEX));
+
+ mcAuthoringForm.setAddQuestion(null);
+ mcAuthoringForm.setSubmitQuestions(null);
return (mapping.findForward(LOAD_QUESTIONS));
}
Index: lams_tool_lamc/web/BasicContent.jsp
===================================================================
diff -u -rfd6328a28e3ebbd9700e73f6120398153b2dacb1 -r7d4312121d0ac51529464536ca8203c445f5d433
--- lams_tool_lamc/web/BasicContent.jsp (.../BasicContent.jsp) (revision fd6328a28e3ebbd9700e73f6120398153b2dacb1)
+++ lams_tool_lamc/web/BasicContent.jsp (.../BasicContent.jsp) (revision 7d4312121d0ac51529464536ca8203c445f5d433)
@@ -52,80 +52,66 @@
-->
+ |
+ ||||
+ |
+ ||||
|
-
-
- " value=" |
-
-
- ![]() |
-
-
- |
+ |
|
+
+
+ " value=" |
-
- ![]() ![]() |
-
+ ![]() ![]() |
-
-
- " value=" |
+ ![]() ![]()
-
- |
-
- ![]() ![]()
- |
-
-
- |
- ![]() ![]() |
+ |
+
+
+ ![]() ![]() |
+