From 6a4b8d943e3ff56cd168e91b1b60513c560c6646 Mon Sep 17 00:00:00 2001 From: Jane Sandberg Date: Sat, 19 Dec 2020 19:20:43 -0800 Subject: [PATCH] LP1895678: Bring course materials into the bootstrap OPAC Also adds course_ou and use_courses to ctx, so that we can avoid having so many duplicate and slightly inconsistent checks to see if we are using the course materials module. Signed-off-by: Jane Sandberg Signed-off-by: Garry Collum Signed-off-by: Galen Charlton --- .../src/perlmods/lib/OpenILS/WWW/EGCatLoader.pm | 3 + .../src/templates-bootstrap/opac/course_browse.tt2 | 147 +++++++++++++++++++++ .../src/templates-bootstrap/opac/course_search.tt2 | 82 ++++++++++++ .../src/templates-bootstrap/opac/css/style.css.tt2 | 13 +- .../opac/parts/record/copy_table.tt2 | 18 ++- .../opac/parts/result/table.tt2 | 11 ++ .../opac/parts/topnav_subnav.tt2 | 13 +- 7 files changed, 276 insertions(+), 11 deletions(-) create mode 100644 Open-ILS/src/templates-bootstrap/opac/course_browse.tt2 create mode 100644 Open-ILS/src/templates-bootstrap/opac/course_search.tt2 diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader.pm index 663cde60d4..ac307e8753 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader.pm @@ -466,6 +466,9 @@ sub load_common { return $rows; }; + $ctx->{course_ou} = int($self->cgi->param('locg')) || $self->ctx->{physical_loc} || $self->ctx->{aou_tree}->()->id; + $ctx->{use_courses} = $ctx->{get_org_setting}->($ctx->{course_ou}, 'circ.course_materials_opt_in') ? 1 : 0; + return Apache2::Const::OK; } diff --git a/Open-ILS/src/templates-bootstrap/opac/course_browse.tt2 b/Open-ILS/src/templates-bootstrap/opac/course_browse.tt2 new file mode 100644 index 0000000000..15c87fd62d --- /dev/null +++ b/Open-ILS/src/templates-bootstrap/opac/course_browse.tt2 @@ -0,0 +1,147 @@ +[%- + + PROCESS "opac/parts/header.tt2"; + PROCESS "opac/parts/misc_util.tt2"; + PROCESS "opac/parts/org_selector.tt2"; + WRAPPER "opac/parts/base.tt2"; + INCLUDE "opac/parts/topnav.tt2"; + + ctx.page_title = l("Browse Courses"); + blimit = CGI.param('blimit') || ctx.opac_hits_per_page || 10; + display_idx = CGI.param('didx') || ctx.match_idx || 0; + + upper_limit = 0; + lower_limit = 0; + depart_list = ['blimit', 'bterm', 'bpivot']; + ctx.metalinks.push(''); +%] + +

[% l('Course Browse') %]

+ +
+
+
+
+
+ + [% control_qtype = INCLUDE "opac/parts/course_search/qtype_selector.tt2" + id="browse-search-class" browse_only=1 plural=1 %] + + [% control_bterm = BLOCK %] + + [% END; #control_bterm BLOCK %] + + [% control_locg = INCLUDE build_org_selector id='browse-context' + show_log_groups=1 arialabel=l('Select owning Library') %] + + [% l('Browse for [_1] starting with [_2] in [_3]', + control_qtype, control_bterm, control_locg) %] + + + +
+
+ + [% BLOCK browse_pager %] + [% + pivot_lower = CGI.param('didx') - blimit; + pivot_higher = CGI.param('didx') + blimit; + IF pivot_lower < 0; + pivot_lower = 0; + END; + IF CGI.param('didx') <= 0; + lower_limit = 1; + ELSE; + lower_limit = 0; + END; + + IF pivot_higher > ctx.browse_results.size; + pivot_higher = ctx.browse_results.size - (blimit + 1); + upper_limit = 1; + ELSE; + upper_limit = 0; + END; + %] + [% IF ctx.browse_results.size >= blimit %] +
+ [% IF lower_limit == 0 %] + ← [%l ('Back') %] + [% END %] + [% IF upper_limit == 0 %] + [%l ('Next') %] → + [% END %] + +
+ [% END %] + [% END %] + + [% PROCESS browse_pager id=0 %] + +
+ [% IF ctx.browse_error %] + + [% l("An error occurred browsing records. " _ + "Please try again in a moment or report the issue " _ + "to library staff.") %] + + [% ELSE %] + [% IF ctx.browse_leading_article_warning %] +
+ [% l("Your browse term seems to begin with an article (a, an, the). You might get better results by omitting the article.") %] + [% IF ctx.browse_leading_article_alternative %] +

[% alternative_link = BLOCK %] + [% ctx.browse_leading_article_alternative | html %] + [%- END; # alternative_link BLOCK + l("Did you mean [_1]?", alternative_link); + END # IF %] +

+
+ [% END # IF browse leading article warning %] + +
    + [% FOR result IN ctx.browse_results %] + [% IF result.browse_index >= CGI.param('didx') && + result.browse_index <= (CGI.param('didx') + blimit - 1) %] +
  • + + [% IF result.results_count > 0 %] + [% result.value | html %] + ([% + IF result.accurate == 'f'; + l("At least"); " "; + END; #result.accurate IF + result.results_count %]) + [% ELSE %] + [% result.value | html %] + [% END; #result.sources IF %] + +
  • + [% END %] + [% END; #result in browse_results %] +
+ [% END; #browse error ELSE %] +
+ + [% PROCESS browse_pager id=1 %] +
+ +
+
+
+ +[% END %] diff --git a/Open-ILS/src/templates-bootstrap/opac/course_search.tt2 b/Open-ILS/src/templates-bootstrap/opac/course_search.tt2 new file mode 100644 index 0000000000..4fc7c8e626 --- /dev/null +++ b/Open-ILS/src/templates-bootstrap/opac/course_search.tt2 @@ -0,0 +1,82 @@ +[%- PROCESS "opac/parts/header.tt2"; + WRAPPER "opac/parts/base.tt2"; + INCLUDE "opac/parts/topnav.tt2"; + ctx.page_title = l("Course Search"); + + PROCESS "opac/parts/misc_util.tt2"; + PROCESS get_library; + ctx.metalinks.push(''); +-%] + +

[% l('Course Search') %]

+ +
+
+
+ +
+ [% l("Course Search Input") %] +
+ +
+
+
+ +
+
+ [% PROCESS "opac/parts/org_selector.tt2" %] + [% INCLUDE build_org_selector show_loc_groups=1 id=org.id %] + + + + +
+
+
+ +
+ +
+
+
+
+
+ +[% END %] diff --git a/Open-ILS/src/templates-bootstrap/opac/css/style.css.tt2 b/Open-ILS/src/templates-bootstrap/opac/css/style.css.tt2 index df0122f4bb..575d468627 100755 --- a/Open-ILS/src/templates-bootstrap/opac/css/style.css.tt2 +++ b/Open-ILS/src/templates-bootstrap/opac/css/style.css.tt2 @@ -1752,14 +1752,11 @@ div.result_table_utils_cont { text-transform:none; } -.search_catalog_lbl { - font-size: [% css_fonts.size_bigger %]; -} -.adv_search_catalog_lbl { - font-size: [% css_fonts.size_bigger %]; -} - -.browse_the_catalog_lbl { +.search_catalog_lbl, +.adv_search_catalog_lbl, +.browse_the_catalog_lbl, +.search_courses_lbl, +.browse_courses_lbl { font-size: [% css_fonts.size_bigger %]; } diff --git a/Open-ILS/src/templates-bootstrap/opac/parts/record/copy_table.tt2 b/Open-ILS/src/templates-bootstrap/opac/parts/record/copy_table.tt2 index 0432fff0af..130d8aa028 100755 --- a/Open-ILS/src/templates-bootstrap/opac/parts/record/copy_table.tt2 +++ b/Open-ILS/src/templates-bootstrap/opac/parts/record/copy_table.tt2 @@ -44,8 +44,10 @@ IF has_copies or ctx.foreign_copies; [%- END %] [% l("Barcode") %] [% l("Shelving Location") %] - [%- IF ctx.is_staff %] + [%- IF ctx.is_staff || ctx.use_courses %] [% l("Circulation Modifier") %] + [%- END %] + [%- IF ctx.is_staff %] [% l("Age Hold Protection") %] [% l("Active/Create Date") %] [%- END %] @@ -54,6 +56,9 @@ IF has_copies or ctx.foreign_copies; [%- END %] [% l("Status") %] [% l("Due Date") %] + [%- IF ctx.use_courses %] + [% l("Courses") %] + [%- END %] @@ -139,8 +144,12 @@ END; # FOREACH bib END; -%] [%- INCLUDE "opac/parts/location_name_link.tt2"; -%] - [%- IF ctx.is_staff %] + [% IF copy_info.courses.size > 0 || ctx.is_staff %] [% copy_info.circ_modifier | html %] + [% ELSIF ctx.use_courses %] + + [% END %] + [% IF ctx.is_staff %] [% copy_info.age_protect ? ctx.get_crahp(copy_info.age_protect).name : l('None') | html %] @@ -224,6 +233,11 @@ END; # FOREACH bib ELSE; '-'; END %] + [%- IF ctx.use_courses %] + [%- FOREACH course IN copy_info.courses %] +
[% course.course_number %]
+ [% END %] + [% END %] [% IF copy_info.notes; %] diff --git a/Open-ILS/src/templates-bootstrap/opac/parts/result/table.tt2 b/Open-ILS/src/templates-bootstrap/opac/parts/result/table.tt2 index 7f3ab3cd68..8395412829 100755 --- a/Open-ILS/src/templates-bootstrap/opac/parts/result/table.tt2 +++ b/Open-ILS/src/templates-bootstrap/opac/parts/result/table.tt2 @@ -326,6 +326,17 @@ [% UNLESS rec.mmr_id; PROCESS "opac/parts/result/copy_counts.tt2"; END; %] + [% IF ctx.use_courses %] + [%- courseStrings = [] %] + [% FOREACH course IN rec.courses %] + [% courseString = course.name _ ' (' _ course.course_number _ ')' %] + [% courseStrings.push(courseString); %] + [% END %] + [% IF courseStrings.size > 0 %] + [% l('Associated Courses: ') %] + [% courseStrings.join(', ') %] + [% END %] + [% END %] [% IF rec.user_circulated %]
diff --git a/Open-ILS/src/templates-bootstrap/opac/parts/topnav_subnav.tt2 b/Open-ILS/src/templates-bootstrap/opac/parts/topnav_subnav.tt2 index faea851a26..27ff5d39a7 100755 --- a/Open-ILS/src/templates-bootstrap/opac/parts/topnav_subnav.tt2 +++ b/Open-ILS/src/templates-bootstrap/opac/parts/topnav_subnav.tt2 @@ -19,6 +19,17 @@ [% ELSE %] [% l('Advanced Search') %] [% END %] + + [% IF ctx.page == 'course_search'; %] + [% l('Search Courses') %] + [% ELSIF ctx.use_courses %] + [% l('Search Courses') %] + [% END %] + [% IF ctx.page == 'course_browse'; %] + [% l('Browse Courses') %] + [% ELSIF ctx.use_courses %] + [% l('Browse Courses') %] + [% END %]
@@ -26,4 +37,4 @@ [% INCLUDE 'opac/parts/cart_nav.tt2' %] - \ No newline at end of file + -- 2.11.0