From 61c19563190adc80d62a77734267411576a4c039 Mon Sep 17 00:00:00 2001 From: Dan Pearl Date: Thu, 1 Oct 2015 12:12:29 -0400 Subject: [PATCH] LP#1487527 - Provide shortcut for changing search scope. A common usage of the TPAC is to do a search in a restricted scope, and when the results are lacking, to repeat the search in a consortium-wide search. This provides a distinctively-colored alternate search button to re-do the current search in the widest scope. Signed-off-by: Dan Pearl --- Open-ILS/src/templates/opac/css/style.css.tt2 | 7 +++++ Open-ILS/src/templates/opac/parts/css/colors.tt2 | 2 ++ Open-ILS/src/templates/opac/parts/org_selector.tt2 | 30 ++++++++++++++++++++-- .../src/templates/opac/parts/result/paginate.tt2 | 7 ++++- Open-ILS/src/templates/opac/parts/searchbar.tt2 | 15 +++++++++-- Open-ILS/src/templates/opac/results.tt2 | 2 +- .../OPAC/search_scope_express_change | 10 ++++++++ 7 files changed, 67 insertions(+), 6 deletions(-) create mode 100644 docs/RELEASE_NOTES_NEXT/OPAC/search_scope_express_change diff --git a/Open-ILS/src/templates/opac/css/style.css.tt2 b/Open-ILS/src/templates/opac/css/style.css.tt2 index ff8c6ad592..87316fba8b 100644 --- a/Open-ILS/src/templates/opac/css/style.css.tt2 +++ b/Open-ILS/src/templates/opac/css/style.css.tt2 @@ -1296,6 +1296,13 @@ a.opac-button-header:hover, #dash_wrapper a.opac-button:hover { display: inline-block; } +.opac-distinctive { + background-color: [% css_colors.distinct_medium %]; +} +.opac-distinctive:hover { + background: [% css_colors.distinct_dark %]; +} + #myopac_checked_div { padding: 0px; } diff --git a/Open-ILS/src/templates/opac/parts/css/colors.tt2 b/Open-ILS/src/templates/opac/parts/css/colors.tt2 index 85e00bdaf7..700b84d6a0 100644 --- a/Open-ILS/src/templates/opac/parts/css/colors.tt2 +++ b/Open-ILS/src/templates/opac/parts/css/colors.tt2 @@ -16,6 +16,8 @@ primary_fade = "#007a54", # medium green primary_offset = "#417860", # light_green control = "#69A088", # lighter green + distinct_medium = "#1a7f99", # blue + distinct_dark = "#0f485a", # blue (dark) accent_light = "#ccc", # grey (light) accent_lighter = "#ddd", # grey (lighter) accent_lighter2 = "#d8d8d8", # grey (lighter again) diff --git a/Open-ILS/src/templates/opac/parts/org_selector.tt2 b/Open-ILS/src/templates/opac/parts/org_selector.tt2 index ab4d7c91f0..a1a659869f 100644 --- a/Open-ILS/src/templates/opac/parts/org_selector.tt2 +++ b/Open-ILS/src/templates/opac/parts/org_selector.tt2 @@ -14,6 +14,10 @@ BLOCK build_org_selector; node_stack = [{org => org_unit || ctx.aouct_tree || ctx.aou_tree}]; inherited_vis = ctx.get_cgf('opac.org_unit.non_inherited_visibility').enabled == 'f'; + # Save the topmost org unit in the list (for the All Libraries global search) + first_selectable_ou_index = -1; + option_index = -1; + IF !name; name = loc_name; END; @@ -123,12 +127,34 @@ BLOCK build_org_selector; END; pad_depth = pad_depth * 2; - display_name = loc_grp ? loc_grp.name : org_unit.name %] + display_name = loc_grp ? loc_grp.name : org_unit.name; + + option_index = option_index + 1; + + # This restores the library selector selected value to what it was before the "all library" + # express search overrode the previous value; + IF CGI.param('scope_restore') != -1; + IF option_index == CGI.param('scope_restore'); + selected = 'selected="selected"'; + ctx.selected_label = l('All Libraries'); + ELSE; + selected = ''; + END; + ELSE; + IF selected == 'selected="selected"'; + ctx.selected_label = display_name; + END; + END; + + IF first_selectable_ou_index == -1 AND disabled == ''; + first_selectable_ou_index = option_index; + END -%] - + [%- END %] + [%- END %] diff --git a/Open-ILS/src/templates/opac/parts/result/paginate.tt2 b/Open-ILS/src/templates/opac/parts/result/paginate.tt2 index cccf18bf4b..92e3992504 100644 --- a/Open-ILS/src/templates/opac/parts/result/paginate.tt2 +++ b/Open-ILS/src/templates/opac/parts/result/paginate.tt2 @@ -1,6 +1,11 @@ [% BLOCK results_count_header %]
- [% ctx.bookbag ? l('List Contents') : l('Search Results') %] + + [% ctx.bookbag ? l('List Contents') : l('Search Results') %] + [% IF ctx.selected_label; + ' ' _ l('in') _ ' ' _ ctx.selected_label _ ' '; + END %] + [%~ |l('' _ ctx.result_start _'', '' _ ctx.result_stop _ '', diff --git a/Open-ILS/src/templates/opac/parts/searchbar.tt2 b/Open-ILS/src/templates/opac/parts/searchbar.tt2 index c2d271025c..4947b0036e 100644 --- a/Open-ILS/src/templates/opac/parts/searchbar.tt2 +++ b/Open-ILS/src/templates/opac/parts/searchbar.tt2 @@ -2,7 +2,7 @@ [% PROCESS "opac/parts/org_selector.tt2" %]
[% UNLESS took_care_of_form -%] -
+ [%- END %] diff --git a/Open-ILS/src/templates/opac/results.tt2 b/Open-ILS/src/templates/opac/results.tt2 index f1bb957adf..091ad704b3 100644 --- a/Open-ILS/src/templates/opac/results.tt2 +++ b/Open-ILS/src/templates/opac/results.tt2 @@ -20,7 +20,7 @@ PROCESS get_library; -%]

[% l('Search Results') %]

- + [% INCLUDE "opac/parts/searchbar.tt2" took_care_of_form=1 %]

[% l('Additional search filters and navigation') %]

diff --git a/docs/RELEASE_NOTES_NEXT/OPAC/search_scope_express_change b/docs/RELEASE_NOTES_NEXT/OPAC/search_scope_express_change new file mode 100644 index 0000000000..d8b4a93277 --- /dev/null +++ b/docs/RELEASE_NOTES_NEXT/OPAC/search_scope_express_change @@ -0,0 +1,10 @@ +Search Scope Express Selection +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +A common usage of the catalog is to do a search in a restricted scope, +like a local library. When the results are lacking, the search is repeated in a +consortium-wide scope. This feature provides a distinctively-colored +alternate search button to re-do the current search in the widest +scope. + +After the wide-scope is done, the scope indicated in the drop-down control will +be restored to what it was before. -- 2.11.0