From 8ab01dc4a310b432e3fbd477d522395fd54906b2 Mon Sep 17 00:00:00 2001 From: Gregory J Thomas Date: Wed, 13 Nov 2024 15:00:13 -0500 Subject: [PATCH] LMSA-9483 - more changes, mainly separating into two lists and adding buttons instead of a select all checkbox --- .../controller/DecrosslistController.java | 19 ++++ .../resources/static/js/decrosslisting.js | 33 ++++++- .../resources/templates/findParentCourse.html | 94 ++++++++++--------- 3 files changed, 98 insertions(+), 48 deletions(-) diff --git a/src/main/java/edu/iu/uits/lms/crosslist/controller/DecrosslistController.java b/src/main/java/edu/iu/uits/lms/crosslist/controller/DecrosslistController.java index fa0abfa..94b04f8 100644 --- a/src/main/java/edu/iu/uits/lms/crosslist/controller/DecrosslistController.java +++ b/src/main/java/edu/iu/uits/lms/crosslist/controller/DecrosslistController.java @@ -60,6 +60,7 @@ import uk.ac.ox.ctl.lti13.security.oauth2.client.lti.authentication.OidcAuthenticationToken; import javax.servlet.http.HttpSession; +import java.util.ArrayList; import java.util.List; import java.util.Locale; @@ -102,7 +103,25 @@ public String lookupSearchBySisId(@ModelAttribute FindParentModel findParentMode String sisIdSearch = findParentModel.getSisIdSearch().trim(); findParentResult = crosslistService.processSisLookup(sisIdSearch); + List
unavailableToDecrosslistSectionsList = new ArrayList<>(); + List
availableToDecrosslistSectionsList = new ArrayList<>(); + if (findParentResult != null) { + List
fullSectionList = findParentResult.getSectionList(); + + if (fullSectionList != null) { + for (Section section : fullSectionList) { + if (section.getSis_section_id() == null || section.getNonxlist_course_id() == null) { + unavailableToDecrosslistSectionsList.add(section); + } else { + availableToDecrosslistSectionsList.add(section); + } + } + } + + model.addAttribute("unavailableToDecrosslistSectionsList", unavailableToDecrosslistSectionsList); + model.addAttribute("availableToDecrosslistSectionsList", availableToDecrosslistSectionsList); + model.addAttribute("findParentResult", findParentResult); // add canvasCourseId to be used in audit log purposes later model.addAttribute("canvasCourseId", findParentResult.getCanvasCourseId()); diff --git a/src/main/resources/static/js/decrosslisting.js b/src/main/resources/static/js/decrosslisting.js index b237669..8fe6401 100644 --- a/src/main/resources/static/js/decrosslisting.js +++ b/src/main/resources/static/js/decrosslisting.js @@ -38,8 +38,14 @@ jQuery(document).ready(function() { resultsMessage.focus(); } - $("#checkbox-select-all").click(function() { - $('input:checkbox').not(this).prop('checked', this.checked); + $("#select-all-button").click(function() { + $('input:checkbox').prop('checked', true); + updateCounter(); + }); + + $("#deselect-all-button").click(function() { + $('input:checkbox').prop('checked', false); + updateCounter(); }); checkboxCounter(); @@ -53,14 +59,31 @@ function checkboxCounter() { // update the count $checkboxes.change(function() { - var countCheckedCheckboxes = $checkboxes.not("#checkbox-select-all").filter(':checked').length; + var countCheckedCheckboxes = $checkboxes.filter(':checked').length; $('#sections-selected').text(countCheckedCheckboxes + ' selected'); }); } +function updateCounter() { + var $checkboxes = $('#decrosslist-form input[type="checkbox"]'); + var countCheckedCheckboxes = $checkboxes.filter(':checked').length; + $('#sections-selected').text(countCheckedCheckboxes + ' selected'); +} + function submitSisIdForm(button) { - buttonLoading(button); - document.getElementById('sisIdForm').submit(); + var inputFieldToSearch = 'sisid-search'; + + if (document.getElementById(inputFieldToSearch).value.trim() === '') { + var validationMessage = document.getElementById('sisid-validation-message'); + + validationMessage.classList.remove('rvt-display-none'); + validationMessage.setAttribute('aria-invalid', true); + validationMessage.setAttribute('aria-describedby', inputFieldToSearch); + return false; + } else { + buttonLoading(button); + document.getElementById('sisIdForm').submit(); + } } function validateCheckboxForm(button) { diff --git a/src/main/resources/templates/findParentCourse.html b/src/main/resources/templates/findParentCourse.html index a7adf94..20458de 100644 --- a/src/main/resources/templates/findParentCourse.html +++ b/src/main/resources/templates/findParentCourse.html @@ -77,14 +77,24 @@

De-cross-listing sections

Example: SP22-BL-FOLK-E295-4441 -
+
- + SIS Section ID is required. +
+ +
+ + + + + + +
@@ -106,51 +116,49 @@

- Sections listed without a checkbox are not available to de-cross-list because they either do not - have a SIS ID or it is the course's original section. + Select sections to remove, then activate De-cross-list selected sections to de-cross-list + them from the course. Unavailable sections are due to either not having a SIS ID or it is + the course's original section. -
- - - - - - - - - - - - -
Table of sections in the course. Select sections to remove, then activate De-cross-list selected sections to de-cross-list them from the course.
-
- - -
-
Section Name
-
- - -
-
- De-crosslisting unavailable -
-
- -
- -
- - - - - - - Select at least one section to de-cross-list. +
+ Unavailable sections +
+

None listed

+
    +
  • + Section Name +
  • +
- +
+
+

None listed

+
+ Available sections + + +
    +
  • +
    + + +
    +
  • +
+
+
+
+ + + + + + + Select at least one section to de-cross-list.