LP1282301] Staff Client search scope user/ldw/LP1282301_staff_client_search_preferences
authorLiam Whalen <liam.whalen@bc.libraries.coop>
Fri, 18 Oct 2013 20:30:44 +0000 (13:30 -0700)
committerLiam Whalen <whalen.ld@gmail.com>
Mon, 10 Mar 2014 20:45:57 +0000 (13:45 -0700)
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

Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Util.pm
Open-ILS/src/templates/opac/parts/advanced/expert.tt2
Open-ILS/src/templates/opac/parts/advanced/numeric.tt2
Open-ILS/src/templates/opac/parts/searchbar.tt2
Open-ILS/xul/staff_client/chrome/content/cat/opac.js
Open-ILS/xul/staff_client/chrome/content/main/menu.js

index 2bc2c16..71a6fa6 100644 (file)
@@ -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;
 
index 8b8849d..5a28ee2 100644 (file)
@@ -37,7 +37,7 @@
                <td colspan="5" class="expert-search-row">
                    <label for="[% lib_select_id %]"><strong>[% l("Search Library:") %]</strong>
                        [%- PROCESS "opac/parts/org_selector.tt2";
-                           INCLUDE build_org_selector id=lib_select_id show_loc_groups=1 
+                           INCLUDE build_org_selector value=ctx.search_ou id=lib_select_id show_loc_groups=1 
                        %]
                    </label>
                </td>
index 4fa45f1..b034214 100644 (file)
@@ -20,7 +20,7 @@
             [%- lib_select_id="numeric_search_library" -%]
             <label for="[% lib_select_id %]"><strong>[% l("Search Library:") %]</strong>
                   [% PROCESS "opac/parts/org_selector.tt2";
-                     INCLUDE build_org_selector id=lib_select_id show_loc_groups=1
+                     INCLUDE build_org_selector value=ctx.search_ou id=lib_select_id show_loc_groups=1
                   %]
             </label>
            <br/>
index a7bdb90..ba3155a 100644 (file)
@@ -33,6 +33,7 @@
         [%- 
             l('Type: ');
             INCLUDE "opac/parts/qtype_selector.tt2" id="qtype";
+            lib_select_id="basic_search_library";
         -%]
         </label>
         <label id="search_itype_label" for="search_itype_selector">
@@ -55,8 +56,7 @@
         [%- 
             l('Library: ');
             select_lib_label = l("Select search library");
-            INCLUDE build_org_selector arialabel=select_lib_label 
-              id='search_org_selector' show_loc_groups=1
+            INCLUDE build_org_selector value=ctx.search_ou id=lib_select_id show_loc_groups=1
         -%]
         </label>
     <span>
index ba54530..4c97bd6 100644 (file)
@@ -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);
index 3addc9c..3bf546b 100644 (file)
@@ -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) {