From 900ba8136491915939c1f0708034d88ceba23a61 Mon Sep 17 00:00:00 2001 From: Liam Whalen Date: Fri, 18 Oct 2013 13:30:44 -0700 Subject: [PATCH] LP1282301] Staff Client search scope For the ctx.search_ou to be the value stored in the staff client if the user is connecting via the staff client, then force the search to change scope back to this value whenever the Staff Client vists the advanced or home pages. When clicking the Refine your search link, the search libraray was being changed to the library from the workstation preferences. This does not make sense when refining a search. In these instances, the search library should be the current library being searched. (sitka) [rt17328] Only menu searches use pref lib Make only the menu searches use the pref lib. This adds a menu_search=1 to the URL requested via the staff client when the menu options for Search -> Search the Catalgoue, Cataloguing -> Palce Hold, or Cataloguing -> Search the Catalogue are chosen. This new variable is checked as a cgi parameter in Util.pm to determine if the search lib should be set to the pref lib. Conflicts: Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Util.pm Conflicts: Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Util.pm Open-ILS/src/templates/opac/parts/advanced/search.tt2 LP1282301 Added changes to searchbar*.tt2 The same changes made to the other serach interfaces were made to serachbar.tt2 and searchbar_staff.tt2. As well, some alerts used in testing were removed. Conflicts: Open-ILS/src/templates/opac/parts/searchbar.tt2 --- .../src/perlmods/lib/OpenILS/WWW/EGCatLoader/Util.pm | 10 ++++++++++ Open-ILS/src/templates/opac/parts/advanced/expert.tt2 | 2 +- Open-ILS/src/templates/opac/parts/advanced/numeric.tt2 | 2 +- Open-ILS/src/templates/opac/parts/searchbar.tt2 | 4 ++-- Open-ILS/xul/staff_client/chrome/content/cat/opac.js | 18 ++++++++++++++++-- Open-ILS/xul/staff_client/chrome/content/main/menu.js | 7 ++++++- 6 files changed, 36 insertions(+), 7 deletions(-) diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Util.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Util.pm index 2bc2c16b4b..71a6fa6fe6 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Util.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Util.pm @@ -485,6 +485,16 @@ sub _get_search_lib { # avoid duplicate lookups return $ctx->{search_ou} if $ctx->{search_ou}; + #If this is a staff client, and we are loading a menu search then we are starting a new query with + #the intention of resetting the search lib to the pref lib, so return the Preferred Search Library + #from the workstation, which is passed as the value of the OILS-Search-Lib header. + + if (($ctx->{is_staff}) and (defined $self->cgi->param('menu_search'))) { + if ($self->apache->headers_in->get('OILS-Search-Lib')) { + return $self->apache->headers_in->get('OILS-Search-Lib'); + } + } + my $loc = $ctx->{copy_location_group_org}; return $loc if $loc; diff --git a/Open-ILS/src/templates/opac/parts/advanced/expert.tt2 b/Open-ILS/src/templates/opac/parts/advanced/expert.tt2 index 8b8849d177..5a28ee2c79 100644 --- a/Open-ILS/src/templates/opac/parts/advanced/expert.tt2 +++ b/Open-ILS/src/templates/opac/parts/advanced/expert.tt2 @@ -37,7 +37,7 @@ diff --git a/Open-ILS/src/templates/opac/parts/advanced/numeric.tt2 b/Open-ILS/src/templates/opac/parts/advanced/numeric.tt2 index 4fa45f1bd8..b034214845 100644 --- a/Open-ILS/src/templates/opac/parts/advanced/numeric.tt2 +++ b/Open-ILS/src/templates/opac/parts/advanced/numeric.tt2 @@ -20,7 +20,7 @@ [%- lib_select_id="numeric_search_library" -%]
diff --git a/Open-ILS/src/templates/opac/parts/searchbar.tt2 b/Open-ILS/src/templates/opac/parts/searchbar.tt2 index a7bdb90423..ba3155a8da 100644 --- a/Open-ILS/src/templates/opac/parts/searchbar.tt2 +++ b/Open-ILS/src/templates/opac/parts/searchbar.tt2 @@ -33,6 +33,7 @@ [%- l('Type: '); INCLUDE "opac/parts/qtype_selector.tt2" id="qtype"; + lib_select_id="basic_search_library"; -%] diff --git a/Open-ILS/xul/staff_client/chrome/content/cat/opac.js b/Open-ILS/xul/staff_client/chrome/content/cat/opac.js index ba54530ce3..4c97bd6266 100644 --- a/Open-ILS/xul/staff_client/chrome/content/cat/opac.js +++ b/Open-ILS/xul/staff_client/chrome/content/cat/opac.js @@ -45,7 +45,9 @@ function my_init() { top_pane = new util.deck('top_pane'); bottom_pane = new util.deck('bottom_pane'); - set_opac(); + var menu_search = g.cgi.param('menu_search') ? true : false; + + set_opac(menu_search); } catch(E) { var err_msg = document.getElementById("offlineStrings").getFormattedString("common.exception", ["cat/opac.xul", E]); @@ -388,8 +390,9 @@ function open_alt_serial_mgmt() { } } -function set_opac() { +function set_opac(menu_search) { g.view = 'opac'; + try { var content_params = { 'show_nav_buttons' : true, @@ -620,6 +623,17 @@ function set_opac() { content_params.url += ';'; content_params.url += 'pane=' + g.data.adv_pane; } + + if (menu_search) { + if (content_params.url.indexOf('?') < 0) + content_params.url += '?'; + else if (content_params.url.indexOf('&') >= 0) + content_params.url += '&'; + else + content_params.url += ';'; + content_params.url += 'menu_search=1'; + } + browser_frame = bottom_pane.set_iframe( xulG.url_prefix('XUL_BROWSER?name=Catalog'), {}, content_params); /* // Remember to use the REMOTE_BROWSER if we ever try to move this to remote xul again browser_frame = bottom_pane.set_iframe( xulG.url_prefix('XUL_REMOTE_BROWSER?name=Catalog'), {}, content_params); diff --git a/Open-ILS/xul/staff_client/chrome/content/main/menu.js b/Open-ILS/xul/staff_client/chrome/content/main/menu.js index 3addc9c53c..3bf546beec 100644 --- a/Open-ILS/xul/staff_client/chrome/content/main/menu.js +++ b/Open-ILS/xul/staff_client/chrome/content/main/menu.js @@ -401,7 +401,7 @@ main.menu.prototype = { ['oncommand'], function(event) { obj.data.stash_retrieve(); - var content_params = { 'session' : ses(), 'authtime' : ses('authtime') }; + var content_params = { 'session' : ses(), 'authtime' : ses('authtime'), 'menu_search' : true }; obj.command_tab(event,obj.url_prefix('XUL_OPAC_WRAPPER'), {'tab_name':offlineStrings.getString('menu.cmd_search_opac.tab')}, content_params); } ], @@ -1997,6 +1997,11 @@ main.menu.prototype = { 'command_tab' : function(event,url,params,content_params) { var newTab = false; var myEvent = event; + + if (content_params.menu_search) { + url = url + '?menu_search=1'; + } + if(event && event.sourceEvent) myEvent = event.sourceEvent; // Note: The last event is not supposed to be myEvent in this if. if(myEvent && myEvent.explicitOriginalTarget.nodeName.match(/toolbarbutton/) && myEvent.explicitOriginalTarget.command == event.originalTarget.id) { -- 2.11.0