Index: lams_central/conf/language/lams/ApplicationResources.properties =================================================================== diff -u -rd0031eadc1ee66ed82eade3ffa5c039016d999eb -re137553ae8df8ba48da568c79e4deea0f5380d29 --- lams_central/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision d0031eadc1ee66ed82eade3ffa5c039016d999eb) +++ lams_central/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision e137553ae8df8ba48da568c79e4deea0f5380d29) @@ -888,4 +888,6 @@ authoring.tbl.use.noticeboard.tooltip=After the AE, displays content to students as additional information or as a reflection on the AE topic authoring.create.application.exercise=Add New Application Exercise label.marks=Marks +authoring.tbl.delete.appex.prompt=Do you want to delete the Application Exercise {0}? +authoring.tbl.delete.mcq.prompt=Do you want to delete the RAT Question {0}? #======= End labels: Exported 872 labels for en AU ===== Index: lams_central/conf/language/lams/ApplicationResources_en_AU.properties =================================================================== diff -u -rd0031eadc1ee66ed82eade3ffa5c039016d999eb -re137553ae8df8ba48da568c79e4deea0f5380d29 --- lams_central/conf/language/lams/ApplicationResources_en_AU.properties (.../ApplicationResources_en_AU.properties) (revision d0031eadc1ee66ed82eade3ffa5c039016d999eb) +++ lams_central/conf/language/lams/ApplicationResources_en_AU.properties (.../ApplicationResources_en_AU.properties) (revision e137553ae8df8ba48da568c79e4deea0f5380d29) @@ -889,4 +889,6 @@ authoring.tbl.use.noticeboard.tooltip=After the AE, displays content to students as additional information or as a reflection on the AE topic authoring.create.application.exercise=Add New Application Exercise label.marks=Marks +authoring.tbl.delete.appex.prompt=Do you want to delete the Application Exercise {0}? +authoring.tbl.delete.mcq.prompt=Do you want to delete the RAT Question {0}? #======= End labels: Exported 872 labels for en AU ===== Index: lams_central/src/java/org/lamsfoundation/lams/authoring/template/web/TBLTemplateController.java =================================================================== diff -u -rd0031eadc1ee66ed82eade3ffa5c039016d999eb -re137553ae8df8ba48da568c79e4deea0f5380d29 --- lams_central/src/java/org/lamsfoundation/lams/authoring/template/web/TBLTemplateController.java (.../TBLTemplateController.java) (revision d0031eadc1ee66ed82eade3ffa5c039016d999eb) +++ lams_central/src/java/org/lamsfoundation/lams/authoring/template/web/TBLTemplateController.java (.../TBLTemplateController.java) (revision e137553ae8df8ba48da568c79e4deea0f5380d29) @@ -415,6 +415,7 @@ aeStartOffset = getOffsetFromRequest(request, "aeLogistic", "aeScheduled", "aeStartDatetime"); } + // Process the Multiple Choice Questions that go to IRA and TRA & Peer Review fields TreeMap correctAnswers = new TreeMap(); Enumeration parameterNames = request.getParameterNames(); while (parameterNames.hasMoreElements()) { @@ -456,6 +457,7 @@ addValidationErrorMessage("authoring.error.rat.not.blank", null, ratErrors); } updateCorrectAnswers(correctAnswers); + redoDisplayOrder(); } if (useApplicationExercises) { @@ -470,6 +472,20 @@ errorMessages.addAll(peerReviewErrors); } + // Reset the display order or it confuses matters in the MCQ tool. Display order may skip numbers if the user + // deletes questions on the screen before saving. + private void redoDisplayOrder() { + SortedMap oldTestQuestions = testQuestions; + testQuestions = new TreeMap(); + int newDisplayOrder = 1; + for (Map.Entry oldQuestionEntry : oldTestQuestions.entrySet()) { + ObjectNode question = oldQuestionEntry.getValue(); + question.put(RestTags.DISPLAY_ORDER, newDisplayOrder); + testQuestions.put(newDisplayOrder, question); + newDisplayOrder++; + } + } + private Long getOffsetFromRequest(HttpServletRequest request, String radioButtonField, String radioButtonScheduledString, String dateField) { String radioValue = WebUtil.readStrParam(request, radioButtonField, true); @@ -495,22 +511,29 @@ for (int i = 1; i <= numAppEx; i++) { String appexDiv = "divappex"+i; AppExData newAppex = new AppExData(); - newAppex.title = WebUtil.readStrParam(request, appexDiv+"Title"); + newAppex.title = WebUtil.readStrParam(request, appexDiv+"Title", true); newAppex.assessments = processAssessments(request, i, newAppex.title); - newAppex.useNoticeboard = WebUtil.readBooleanParam(request, appexDiv+"NB", false); - if ( newAppex.useNoticeboard ) { - newAppex.noticeboardInstructions = getTrimmedString(request, appexDiv+"NBEntry", true); - if ( newAppex.noticeboardInstructions == null ) - addValidationErrorMessage( - "authoring.error.application.exercise.needs.noticeboard.text", new Object[] {"\"" + newAppex.title + "\""}, applicationExerciseErrors); - } - applicationExercises.put(i, newAppex); + // null indicates appex was deleted + if ( newAppex.assessments != null ) { + newAppex.useNoticeboard = WebUtil.readBooleanParam(request, appexDiv+"NB", false); + if ( newAppex.useNoticeboard ) { + newAppex.noticeboardInstructions = getTrimmedString(request, appexDiv+"NBEntry", true); + if ( newAppex.noticeboardInstructions == null ) + addValidationErrorMessage( + "authoring.error.application.exercise.needs.noticeboard.text", new Object[] {"\"" + newAppex.title + "\""}, applicationExerciseErrors); + } + applicationExercises.put(i, newAppex); + } } } private SortedMap processAssessments(HttpServletRequest request, int appexNumber, String appexTitle) { SortedMap applicationExercises = new TreeMap(); - int numAssessments = WebUtil.readIntParam(request, "numAssessments" + appexNumber); + Integer numAssessments = WebUtil.readIntParam(request, "numAssessments" + appexNumber, true); + if ( numAssessments == null ) { + // Application Exercise has been deleted + return null; + } for (int i = 1; i <= numAssessments; i++) { String assessmentPrefix = new StringBuilder("divass").append(appexNumber).append("assessment") Index: lams_central/web/authoring/template/comms.jsp =================================================================== diff -u -r9b74251ca3fd30ec06f5b94eb95e21e9a9dc603f -re137553ae8df8ba48da568c79e4deea0f5380d29 --- lams_central/web/authoring/template/comms.jsp (.../comms.jsp) (revision 9b74251ca3fd30ec06f5b94eb95e21e9a9dc603f) +++ lams_central/web/authoring/template/comms.jsp (.../comms.jsp) (revision e137553ae8df8ba48da568c79e4deea0f5380d29) @@ -1,5 +1,7 @@ var validator; + var appexDeleteMsg = ""; + var mcqDeleteMsg = ""; // configure the wizard. Call after doing var validator = $("#templateForm").validate({ // screens need to specify the tabNumber for the save button if they are hiding tabs @@ -389,6 +391,18 @@ }); } + function deleteAppexDiv(idOfDivToDelete, idOfTitleField) { + if ( confirm(appexDeleteMsg.replace("{0}", "\""+$("#"+idOfTitleField).val()+"\"")) ) { + $("#"+idOfDivToDelete).remove(); + } + } + + function deleteMCQDiv(idOfDivToDelete, idOfTitleField) { + if ( confirm(mcqDeleteMsg.replace("{0}", "\""+$("#"+idOfTitleField).val()+"\"")) ) { + $("#"+idOfDivToDelete).remove(); + } + } + function testURL(urlField) { launchPopup($('#'+urlField).val(),'popupUrl'); } Index: lams_central/web/authoring/template/tbl/appex.jsp =================================================================== diff -u -r3545f552a808e2338350fee3467ed6a53a1fc67f -re137553ae8df8ba48da568c79e4deea0f5380d29 --- lams_central/web/authoring/template/tbl/appex.jsp (.../appex.jsp) (revision 3545f552a808e2338350fee3467ed6a53a1fc67f) +++ lams_central/web/authoring/template/tbl/appex.jsp (.../appex.jsp) (revision e137553ae8df8ba48da568c79e4deea0f5380d29) @@ -11,6 +11,7 @@
+   Index: lams_central/web/authoring/template/tool/assessmcq.jsp =================================================================== diff -u -rd0031eadc1ee66ed82eade3ffa5c039016d999eb -re137553ae8df8ba48da568c79e4deea0f5380d29 --- lams_central/web/authoring/template/tool/assessmcq.jsp (.../assessmcq.jsp) (revision d0031eadc1ee66ed82eade3ffa5c039016d999eb) +++ lams_central/web/authoring/template/tool/assessmcq.jsp (.../assessmcq.jsp) (revision e137553ae8df8ba48da568c79e4deea0f5380d29) @@ -34,7 +34,7 @@ - + Index: lams_central/web/authoring/template/tool/assessment.jsp =================================================================== diff -u -rd0031eadc1ee66ed82eade3ffa5c039016d999eb -re137553ae8df8ba48da568c79e4deea0f5380d29 --- lams_central/web/authoring/template/tool/assessment.jsp (.../assessment.jsp) (revision d0031eadc1ee66ed82eade3ffa5c039016d999eb) +++ lams_central/web/authoring/template/tool/assessment.jsp (.../assessment.jsp) (revision e137553ae8df8ba48da568c79e4deea0f5380d29) @@ -29,7 +29,7 @@ - + Index: lams_central/web/authoring/template/tool/mcquestion.jsp =================================================================== diff -u -rd0031eadc1ee66ed82eade3ffa5c039016d999eb -re137553ae8df8ba48da568c79e4deea0f5380d29 --- lams_central/web/authoring/template/tool/mcquestion.jsp (.../mcquestion.jsp) (revision d0031eadc1ee66ed82eade3ffa5c039016d999eb) +++ lams_central/web/authoring/template/tool/mcquestion.jsp (.../mcquestion.jsp) (revision e137553ae8df8ba48da568c79e4deea0f5380d29) @@ -16,6 +16,7 @@
+
${questionNumber eq 1 ? "