lp1849212 Browse by Instructor YAOUS
authorKyle Huckins <khuckins@catalyte.io>
Thu, 5 Mar 2020 01:15:20 +0000 (01:15 +0000)
committerJane Sandberg <sandbej@linnbenton.edu>
Sun, 19 Jul 2020 16:27:19 +0000 (09:27 -0700)
- Add YAOUS to allow/disallow browsing by Instructor.
- Minor code cleanup

Signed-off-by: Kyle Huckins <khuckins@catalyte.io>
 Changes to be committed:
modified:   Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Course.pm
modified:   Open-ILS/src/sql/Pg/upgrade/XXXX.schema.course-materials-module.sql
modified:   Open-ILS/src/templates/opac/course_browse.tt2
modified:   Open-ILS/src/templates/opac/parts/course_search/qtype_selector.tt2

Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Course.pm
Open-ILS/src/sql/Pg/upgrade/XXXX.schema.course-materials-module.sql
Open-ILS/src/templates/opac/course_browse.tt2
Open-ILS/src/templates/opac/parts/course_search/qtype_selector.tt2

index 80535cd..42160c1 100644 (file)
@@ -66,7 +66,7 @@ sub load_course_browse {
                     'usr',
                     'is_public'
                 ]},
-                # We need to support the chosen library as well...
+                # TODO: We need to support the chosen library as well...
                 "where" => {'+acmcu' => 'is_public'}
             });
             $results = $e->json_query({
@@ -110,9 +110,8 @@ sub load_course_browse {
                     'is_archived',
                     'owning_lib'
                 ]},
-            #    "limit" => $limit,
                 "order_by" => {"acmc" => [$qtype]},
-                # We need to support the chosen library as well...
+                # TODO: We need to support the chosen library as well...
                 "where" => {'-not' => {'+acmc' => 'is_archived'}}
             });
         }
index 73eed26..fdb8420 100644 (file)
@@ -71,6 +71,21 @@ VALUES (
         'coust',
         'description'
     )
+), (
+    'circ',
+    'circ.course_materials_browse_by_instructor', 'bool',
+    oils_i18n_gettext(
+        'circ.course_materials_browse_by_instructor',
+        'Allow users to browse Courses by Instructor',
+        'coust',
+        'label'
+    ),
+    oils_i18n_gettext(
+        'circ.course_materials_browse_by_instructor',
+        'If enabled, the Org Unit will allow OPAC users to browse Courses by instructor name.'
+        'coust',
+        'description'
+    )
 );
 
 COMMIT;
index 568b852..5caabdc 100644 (file)
@@ -14,7 +14,6 @@
     lower_limit = 0;
     depart_list = ['blimit', 'bterm', 'bpivot'];
     ctx.metalinks.push('<meta name="robots" content="noindex,follow">');
-
 %]
 
 <h2 class="sr-only">[% l('Course Browse') %]</h2>
index 1ae0ab1..279b1c8 100644 (file)
@@ -1,8 +1,17 @@
-[%  query_types = [
+[% query_types = [
     {value => "name", label => l("Title"), plural_label => l("Titles"), browse => 1},
-    {value => "instructor", label => l("Instructor"), plural_label => l('Instructors'), browse => 1},
     {value => "course_number", label => l("Course Number"), plural_label => l('Course Numbers'), browse => 1}
 ];
+
+IF ctx.get_org_setting(
+    CGI.param('locg'), 'circ.course_materials_browse_by_instructor');
+query_types.push({
+    value => "instructor", 
+    label => l("Instructor"),
+    plural_label => l('Instructors'), 
+    browse => 1},
+);
+END;
 -%]
 <select name="[% name || 'qtype' %]"[% IF id; ' id="'; id ; '"' ; END -%]
     title="[% l('Select query type:') %]">