Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/controller/AuthoringController.java =================================================================== diff -u -re423418cca5e77a3b54cb3be496b67abe01c4183 -rb19b1766bda6ae9634e07b9046948df7d2d2caca --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/controller/AuthoringController.java (.../AuthoringController.java) (revision e423418cca5e77a3b54cb3be496b67abe01c4183) +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/controller/AuthoringController.java (.../AuthoringController.java) (revision b19b1766bda6ae9634e07b9046948df7d2d2caca) @@ -550,6 +550,21 @@ return "authoring/itemlist"; } + @RequestMapping(path = "/toggleQuestionRequired", method = RequestMethod.POST) + @ResponseBody + public String toggleQuestionRequired(@ModelAttribute("newQuestionForm") QaAuthoringForm form, + HttpServletRequest request) throws IOException, ServletException { + SessionMap sessionMap = getSessionMap(form, request); + int questionIndex = NumberUtils.toInt(request.getParameter("questionIndex"), -1); + Set qaQuestions = getQuestions(sessionMap); + + List rList = new ArrayList<>(qaQuestions); + QaQueContent question = rList.get(questionIndex); + question.setAnswerRequired(!question.isAnswerRequired()); + + return String.valueOf(question.isAnswerRequired()); + } + /** * moves a question down in the list */ Index: lams_tool_laqa/web/authoring/BasicContent.jsp =================================================================== diff -u -rbd5bbb74ec968f0048a3be657eae4ed7bdeef7d6 -rb19b1766bda6ae9634e07b9046948df7d2d2caca --- lams_tool_laqa/web/authoring/BasicContent.jsp (.../BasicContent.jsp) (revision bd5bbb74ec968f0048a3be657eae4ed7bdeef7d6) +++ lams_tool_laqa/web/authoring/BasicContent.jsp (.../BasicContent.jsp) (revision b19b1766bda6ae9634e07b9046948df7d2d2caca) @@ -47,6 +47,27 @@ ); }; } + + function toggleQuestionRequired(questionIndex, icon){ + var sequenceId = $('.reference-sequence-id', $(icon).parents('tr')).val(); + + $.ajax({ + url: '', + type: 'POST', + dataType : 'text', + data: { + sessionMapID: "${sessionMapID}", + questionIndex: questionIndex + }, + success(isRequired) { + if (isRequired == 'true') { + $(icon).addClass('text-danger'); + } else if (isRequired == 'false') { + $(icon).removeClass('text-danger'); + } + } + }); + } function moveQuestion(questionIndex, actionMethod){ var url = "" + actionMethod + ".do"; Index: lams_tool_laqa/web/authoring/itemlist.jsp =================================================================== diff -u -r86c25c80d92701a94c3161575c76c363891402ad -rb19b1766bda6ae9634e07b9046948df7d2d2caca --- lams_tool_laqa/web/authoring/itemlist.jsp (.../itemlist.jsp) (revision 86c25c80d92701a94c3161575c76c363891402ad) +++ lams_tool_laqa/web/authoring/itemlist.jsp (.../itemlist.jsp) (revision b19b1766bda6ae9634e07b9046948df7d2d2caca) @@ -50,6 +50,13 @@ onclick="javascript:moveQuestion(${status.index},'moveQuestionDown') "/> + + + " + alt="" + onClick="javascript:toggleQuestionRequired(${status.index}, this)"> + Index: lams_tool_laqa/web/authoring/newQuestionBox.jsp =================================================================== diff -u -r8a10262db418fe16a5ac30cb2123feddea6f162e -rb19b1766bda6ae9634e07b9046948df7d2d2caca --- lams_tool_laqa/web/authoring/newQuestionBox.jsp (.../newQuestionBox.jsp) (revision 8a10262db418fe16a5ac30cb2123feddea6f162e) +++ lams_tool_laqa/web/authoring/newQuestionBox.jsp (.../newQuestionBox.jsp) (revision b19b1766bda6ae9634e07b9046948df7d2d2caca) @@ -138,12 +138,6 @@
-
- -
-