Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McResources.properties
===================================================================
diff -u -r5cf96a36b8ac2deb83f53e8ec7693dec994a1379 -r8638df541d8dada50e311c121e24534c33a889d6
--- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McResources.properties (.../McResources.properties) (revision 5cf96a36b8ac2deb83f53e8ec7693dec994a1379)
+++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McResources.properties (.../McResources.properties) (revision 8638df541d8dada50e311c121e24534c33a889d6)
@@ -1,6 +1,8 @@
# 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.editOptions =Please define the question and/or its options.
label.authoring.title =Title
label.authoring.instructions =Instructions
@@ -28,6 +30,7 @@
label.report.title =Report Title
label.monitoringReport.title =Monitoring Report Title
label.report.endLearningMessage =End of Activity Message
+label.question.only =Question
label.question =Question:
label.question1 =Question 1
radiobox.defineLater =Define Later
@@ -50,7 +53,7 @@
error.instructions =The field "Instructions" is mandatory.
error.reportTitle =The field "Report Title (Advanced)" is mandatory.
error.defaultquestion.empty =The first question can not be empty.
-submit.successful =The content has been created successfully.
+submit.successful =The content has been created successfully.
error.question.addNotAllowed.thisScreen = The question text can not be modified in this screen since it has options attached . Please use the "Options" button to edit the question text.
error.question.removeNotAllowed.thisScreen = The question can not be removed since one or more of the question texts has been modified. Please try again without any text modifications.
Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/IMcQueContentDAO.java
===================================================================
diff -u -r5cf96a36b8ac2deb83f53e8ec7693dec994a1379 -r8638df541d8dada50e311c121e24534c33a889d6
--- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/IMcQueContentDAO.java (.../IMcQueContentDAO.java) (revision 5cf96a36b8ac2deb83f53e8ec7693dec994a1379)
+++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/IMcQueContentDAO.java (.../IMcQueContentDAO.java) (revision 8638df541d8dada50e311c121e24534c33a889d6)
@@ -38,6 +38,8 @@
public McQueContent getQuestionContentByQuestionText(final String question, final Long mcContentUid);
+ public void cleanAllQuestions(final Long mcContentUid);
+
public void resetAllQuestions(final Long mcContentUid);
public void removeQuestionContentByMcUid(final Long mcContentUid);
Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/hibernate/McQueContentDAO.java
===================================================================
diff -u -r5cf96a36b8ac2deb83f53e8ec7693dec994a1379 -r8638df541d8dada50e311c121e24534c33a889d6
--- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/hibernate/McQueContentDAO.java (.../McQueContentDAO.java) (revision 5cf96a36b8ac2deb83f53e8ec7693dec994a1379)
+++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/dao/hibernate/McQueContentDAO.java (.../McQueContentDAO.java) (revision 8638df541d8dada50e311c121e24534c33a889d6)
@@ -46,6 +46,8 @@
private static final String LOAD_QUESTION_CONTENT_BY_CONTENT_ID = "from mcQueContent in class McQueContent where mcQueContent.mcContentId=:mcContentId";
+ private static final String CLEAN_QUESTION_CONTENT_BY_CONTENT_ID = "from mcQueContent in class McQueContent where mcQueContent.mcContentId=:mcContentId";
+
private static final String LOAD_QUESTION_CONTENT_BY_QUESTION_TEXT = "from mcQueContent in class McQueContent where mcQueContent.question=:question and mcQueContent.mcContentId=:mcContentUid";
@@ -126,7 +128,29 @@
}
+ public void cleanAllQuestions(final Long mcContentUid)
+ {
+ HibernateTemplate templ = this.getHibernateTemplate();
+ List list = getSession().createQuery(CLEAN_QUESTION_CONTENT_BY_CONTENT_ID)
+ .setLong("mcContentId", mcContentUid.longValue())
+ .list();
+
+ if(list != null && list.size() > 0){
+ Iterator listIterator=list.iterator();
+ while (listIterator.hasNext())
+ {
+ McQueContent mcQueContent=(McQueContent)listIterator.next();
+ if ((mcQueContent != null) && (mcQueContent.isDisabled()));
+ {
+ this.getSession().setFlushMode(FlushMode.AUTO);
+ templ.delete(mcQueContent);
+ }
+ }
+ }
+ }
+
+
public void saveMcQueContent(McQueContent mcQueContent)
{
this.getHibernateTemplate().save(mcQueContent);
Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/service/IMcService.java
===================================================================
diff -u -r5cf96a36b8ac2deb83f53e8ec7693dec994a1379 -r8638df541d8dada50e311c121e24534c33a889d6
--- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/service/IMcService.java (.../IMcService.java) (revision 5cf96a36b8ac2deb83f53e8ec7693dec994a1379)
+++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/service/IMcService.java (.../IMcService.java) (revision 8638df541d8dada50e311c121e24534c33a889d6)
@@ -79,6 +79,8 @@
public void resetAllQuestions(final Long mcContentUid) throws McApplicationException;
+ public void cleanAllQuestions(final Long mcContentUid) throws McApplicationException;
+
public void removeMcOptionsContentByQueId(Long mcQueContentId) throws McApplicationException;
public void removeMcOptionsContent(McOptsContent mcOptsContent);
Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/service/McServicePOJO.java
===================================================================
diff -u -r5cf96a36b8ac2deb83f53e8ec7693dec994a1379 -r8638df541d8dada50e311c121e24534c33a889d6
--- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/service/McServicePOJO.java (.../McServicePOJO.java) (revision 5cf96a36b8ac2deb83f53e8ec7693dec994a1379)
+++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/service/McServicePOJO.java (.../McServicePOJO.java) (revision 8638df541d8dada50e311c121e24534c33a889d6)
@@ -226,6 +226,21 @@
}
+
+ public void cleanAllQuestions(final Long mcContentUid) throws McApplicationException
+ {
+ try
+ {
+ mcQueContentDAO.cleanAllQuestions(mcContentUid);
+ }
+ catch (DataAccessException e)
+ {
+ throw new McApplicationException("Exception occured when lams is cleaning all questions: "
+ + e.getMessage(),
+ e);
+ }
+ }
+
public void createMcSession(McSession mcSession) throws McApplicationException
{
Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McAction.java
===================================================================
diff -u -r5cf96a36b8ac2deb83f53e8ec7693dec994a1379 -r8638df541d8dada50e311c121e24534c33a889d6
--- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McAction.java (.../McAction.java) (revision 5cf96a36b8ac2deb83f53e8ec7693dec994a1379)
+++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McAction.java (.../McAction.java) (revision 8638df541d8dada50e311c121e24534c33a889d6)
@@ -562,6 +562,7 @@
Map mapQuestionsContent=repopulateMap(request, "questionContent");
logger.debug("FINAL mapQuestionsContent after shrinking: " + mapQuestionsContent);
logger.debug("mapQuestionsContent size after shrinking: " + mapQuestionsContent.size());
+ request.getSession().setAttribute(MAP_QUESTIONS_CONTENT, mapQuestionsContent);
Long toolContentId=(Long)request.getSession().getAttribute(TOOL_CONTENT_ID);
logger.debug("toolContentId:" + toolContentId);
@@ -588,6 +589,15 @@
}
}
}
+
+ mcService.cleanAllQuestions(mcContent.getUid());
+ logger.debug("all questions cleaned for :" + mcContent.getUid());
+
+ ActionMessages errors= new ActionMessages();
+ errors.add(Globals.ERROR_KEY,new ActionMessage("submit.successful"));
+ logger.debug("add submit.successful to ActionMessages");
+ saveErrors(request,errors);
+
mcAuthoringForm.resetUserAction();
return (mapping.findForward(LOAD_QUESTIONS));
}
Index: lams_tool_lamc/web/authoringMaincontent.jsp
===================================================================
diff -u -r5cf96a36b8ac2deb83f53e8ec7693dec994a1379 -r8638df541d8dada50e311c121e24534c33a889d6
--- lams_tool_lamc/web/authoringMaincontent.jsp (.../authoringMaincontent.jsp) (revision 5cf96a36b8ac2deb83f53e8ec7693dec994a1379)
+++ lams_tool_lamc/web/authoringMaincontent.jsp (.../authoringMaincontent.jsp) (revision 8638df541d8dada50e311c121e24534c33a889d6)
@@ -42,7 +42,7 @@
<%@ include file="errorbox.jsp" %> |
+ <%@ include file="errorbox.jsp" %> + | +
+ |
+
-
-
- |
- |
   |