Index: lams_tool_laqa/conf/language/lams/ApplicationResources.properties =================================================================== diff -u -r4409f4bd1640395d7eacbf1681be39628304d815 -rd9946f994303feb9afeed1f9c1a382427dba046b --- lams_tool_laqa/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision 4409f4bd1640395d7eacbf1681be39628304d815) +++ lams_tool_laqa/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision d9946f994303feb9afeed1f9c1a382427dba046b) @@ -101,6 +101,7 @@ label.new.question = New question label.feedback = Feedback label.save.question = Add +label.save.question.new.version = Add as new version label.tip.editQuestion = Enables editing of question label.tip.deleteQuestion = Deletes question label.tip.moveQuestionDown = Moves question down Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/controller/AuthoringController.java =================================================================== diff -u -rb19b1766bda6ae9634e07b9046948df7d2d2caca -rd9946f994303feb9afeed1f9c1a382427dba046b --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/controller/AuthoringController.java (.../AuthoringController.java) (revision b19b1766bda6ae9634e07b9046948df7d2d2caca) +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/controller/AuthoringController.java (.../AuthoringController.java) (revision d9946f994303feb9afeed1f9c1a382427dba046b) @@ -358,7 +358,8 @@ * saveQuestion */ @RequestMapping(value = "/saveQuestion", method = RequestMethod.POST) - public String saveQuestion(@ModelAttribute("newQuestionForm") QbQuestionForm form, HttpServletRequest request) + public String saveQuestion(@ModelAttribute("newQuestionForm") QbQuestionForm form, HttpServletRequest request, + @RequestParam(name = "newVersion", required = false) boolean enforceNewVersion) throws IOException, ServletException { SessionMap sessionMap = getSessionMap(form, request); SortedSet qaQuestions = getQuestions(sessionMap); @@ -421,13 +422,19 @@ int isQbQuestionModified = isDefaultQuestion ? IQbService.QUESTION_MODIFIED_ID_BUMP : qbQuestion.isQbQuestionModified(oldQbQuestion); + if (isQbQuestionModified < IQbService.QUESTION_MODIFIED_VERSION_BUMP && enforceNewVersion) { + isQbQuestionModified = IQbService.QUESTION_MODIFIED_VERSION_BUMP; + } QbQuestion updatedQuestion = null; switch (isQbQuestionModified) { case IQbService.QUESTION_MODIFIED_VERSION_BUMP: { - // impossible scenario as long as ESSAY question type can't have version - throw new RuntimeException( - "Impossible scenario as long as ESSAY question type can't have new versions"); + // new version of the old question gets created + updatedQuestion = qbQuestion.clone(); + updatedQuestion.clearID(); + updatedQuestion.setVersion(qbService.getMaxQuestionVersion(qbQuestion.getQuestionId()) + 1); + updatedQuestion.setCreateDate(new Date()); } + break; case IQbService.QUESTION_MODIFIED_ID_BUMP: { // new question gets created updatedQuestion = qbQuestion.clone(); Index: lams_tool_laqa/web/authoring/newQuestionBox.jsp =================================================================== diff -u -rb19b1766bda6ae9634e07b9046948df7d2d2caca -rd9946f994303feb9afeed1f9c1a382427dba046b --- lams_tool_laqa/web/authoring/newQuestionBox.jsp (.../newQuestionBox.jsp) (revision b19b1766bda6ae9634e07b9046948df7d2d2caca) +++ lams_tool_laqa/web/authoring/newQuestionBox.jsp (.../newQuestionBox.jsp) (revision d9946f994303feb9afeed1f9c1a382427dba046b) @@ -32,6 +32,15 @@