+ % }
<%= hidden_field last_page_was_add_course => 1 =%>
<%= $c->hidden_fields('number_of_additional_users') =%>
diff --git a/templates/HelpFiles/AdminAddCourse.html.ep b/templates/HelpFiles/AdminAddCourse.html.ep
index 6e7e38c98b..8cdf53a3e6 100644
--- a/templates/HelpFiles/AdminAddCourse.html.ep
+++ b/templates/HelpFiles/AdminAddCourse.html.ep
@@ -18,10 +18,15 @@
. 'creating future courses, or manage and email course users. Note, by default these new users will be '
. '"Dropped" and unable to login to the [_1] course.', $ce->{admin_course_id}) =%>
-
+
<%= maketext('You may choose a course to copy components from. Select the course and which components to copy. '
. 'If the course is not a true course (like the modelCourse) then only the templates and html folders, '
. 'and the simple and course config files can be copied. The "simple config" file contains the settings '
. 'made in the "Course Config" page. The "course config" file should only be copied if you know what you '
. 'are doing.') =%>
+
+ <%= maketext('If there are .conf files in the [_1] folder, you may select a number of these to include at the '
+ . 'end of the course.conf file. This only applies when not copying a course.conf file from another course.',
+ $ce->{webworkDirs}{addOnConf}) =%>
+
From 01dda642e2f5d2a0d7c3ccb6c5e8682865ebb5a5 Mon Sep 17 00:00:00 2001
From: Alex Jordan
Date: Thu, 4 Jun 2026 21:42:33 -0700
Subject: [PATCH 2/2] javascript for Add Course add-on-conf multiselect
---
htdocs/js/CourseAdmin/restrict_select.js | 34 +++++++++++++++++++
.../CourseAdmin/add_course_form.html.ep | 10 ++++--
2 files changed, 42 insertions(+), 2 deletions(-)
create mode 100644 htdocs/js/CourseAdmin/restrict_select.js
diff --git a/htdocs/js/CourseAdmin/restrict_select.js b/htdocs/js/CourseAdmin/restrict_select.js
new file mode 100644
index 0000000000..8e5550ee34
--- /dev/null
+++ b/htdocs/js/CourseAdmin/restrict_select.js
@@ -0,0 +1,34 @@
+(() => {
+ const addOnConfSelect = document.getElementById('add_on_conf');
+ const addOnConfOptgroups = [...addOnConfSelect.querySelectorAll('optgroup')];
+
+ // Track previously selected options to identify the newly clicked option
+ let previousSelection = [];
+
+ addOnConfSelect.addEventListener('change', (event) => {
+ const currentSelection = Array.from(addOnConfSelect.selectedOptions);
+
+ // Find the option the user just clicked/selected
+ const newlySelected = currentSelection.find((option) => !previousSelection.includes(option));
+
+ if (newlySelected) {
+ // Find the parent optgroup
+ const parent = newlySelected.closest('optgroup');
+
+ // Loop through all options in the other groups and unselect them as appropriate
+ addOnConfOptgroups.forEach((group) => {
+ Array.from(group.children).forEach((option) => {
+ if (
+ option !== newlySelected &&
+ (parent.dataset.single || (!parent.dataset.single && group.dataset.single))
+ ) {
+ option.selected = false;
+ }
+ });
+ });
+ }
+
+ // Update tracking variable for the next change event
+ previousSelection = Array.from(addOnConfSelect.selectedOptions);
+ });
+})();
diff --git a/templates/ContentGenerator/CourseAdmin/add_course_form.html.ep b/templates/ContentGenerator/CourseAdmin/add_course_form.html.ep
index ac9ff7d93c..cdadb9175d 100644
--- a/templates/ContentGenerator/CourseAdmin/add_course_form.html.ep
+++ b/templates/ContentGenerator/CourseAdmin/add_course_form.html.ep
@@ -1,5 +1,9 @@
% use WeBWorK::Utils::CourseManagement qw(listCourses);
%
+% content_for js => begin
+ <%= javascript getAssetURL($ce, 'js/CourseAdmin/restrict_select.js'), defer => undef =%>
+% end
+%
% # Create an array of permission values for the permission selects.
% my $permissionLevels = [];
% for my $role (sort { $ce->{userRoles}{$a} <=> $ce->{userRoles}{$b} } keys %{ $ce->{userRoles} }) {
@@ -233,11 +237,13 @@
<%= select_field add_on_conf => [
c(
maketext('Use Default')
- => [ [ maketext('Distribution Default Config File') => '' ] ]
+ => [ [ maketext('Distribution Default Config File') => '' ] ],
+ 'data-single' => 'true'
),
c(
maketext('Source Course')
- => [ [ maketext("Source Course's Config File") => '*' ] ]
+ => [ [ maketext("Source Course's Config File") => '*' ] ],
+ 'data-single' => 'true'
),
c(
maketext('Append to Distribution Default')