$loc = $self->cgi->param('loc');
return $loc if $loc;
+ if ($self->apache->headers_in->get('OILS-Search-Lib')) {
+ return $self->apache->headers_in->get('OILS-Search-Lib');
+ }
+
my $pref_lib = $self->_get_pref_lib();
return $pref_lib if $pref_lib;
my $plib = $self->cgi->param('plib');
return $plib if $plib;
+ if ($self->apache->headers_in->get('OILS-Pref-Lib')) {
+ return $self->apache->headers_in->get('OILS-Pref-Lib');
+ }
+
if ($ctx->{user}) {
# See if the user has a search library preference
my $lset = $self->editor->search_actor_user_setting({
[%- IF ctx.pref_ou && ctx.pref_ou != ctx.search_ou; %]
<span class="preflib">[%
l('Preferred library: [_1][_2][_3]', '<b>', ctx.get_aou(ctx.pref_ou).name, '</b>');
- %]<a href="[% mkurl(ctx.opac_root _ '/myopac/prefs_settings')
- %]" class="preflib_change" title="[% l("Change preferred library"); %]">[% l('?') %]</a>
+ IF NOT ctx.is_staff %]<a href="[% mkurl(ctx.opac_root _ '/myopac/prefs_settings')
+ %]" class="preflib_change" title="[% l("Change preferred library"); %]">[% l('?') %]</a>[% END; %]
</span>
[%- END; %]
<!ENTITY staff.main.menu.admin.client.hotkeys.setworkstation.accesskey "">
<!ENTITY staff.main.menu.admin.client.hotkeys.clearworkstation.label "Clear Workstation Default">
<!ENTITY staff.main.menu.admin.client.hotkeys.clearworkstation.accesskey "">
+<!ENTITY staff.main.menu.admin.client.search_prefs.label "Set Search Preferences">
<!ENTITY staff.main.menu.admin.client.toolbars "Toolbars">
<!ENTITY staff.main.menu.admin.client.toolbars.current "Current">
<!ENTITY staff.main.menu.admin.client.toolbars.config.label "Configure Toolbars">
<!ENTITY staff.item.batch.hold.cancel_btn.label "Cancel">
<!ENTITY staff.item.batch.hold.cancel_btn.accesskey "C">
<!ENTITY staff.item.batch.hold.failures_and_settings "The settings above may be changed for retries and overrides.">
+<!ENTITY staff.search_prefs.search_lib.caption "Default Search Library">
+<!ENTITY staff.search_prefs.search_lib.description "The default search library setting determines what library is searched from the advanced search screen and portal page by default. Manual selection of a search library will override it. One recommendation is to set the search library to the highest point you would normally want to search.">
+<!ENTITY staff.search_prefs.pref_lib.caption "Preferred Library">
+<!ENTITY staff.search_prefs.pref_lib.description "The preferred library is used to show copies and URIs regardless of the library searched. One recommendation is to set this to your workstation library so that local copies show up first in search results.">
+<!ENTITY staff.search_prefs.save.label "Save">
+<!ENTITY staff.search_prefs.save.accesskey "S">
+<!ENTITY staff.search_prefs.saved_message "Preferences saved">
'ALT_HOLDS_PRINT' : 'oils://remote/opac/extras/circ/alt_holds_print.html',
'SERIAL_PRINT_ROUTING_LIST_USERS' : 'oils://remote/eg/serial/print_routing_list_users',
'XUL_SERIAL_BATCH_RECEIVE': 'oils://remote/xul/server/serial/batch_receive.xul',
- 'EG_TRIGGER_EVENTS' : 'oils://remote/eg/actor/user/event_log'
+ 'EG_TRIGGER_EVENTS' : 'oils://remote/eg/actor/user/event_log',
+ 'XUL_SEARCH_PREFS' : 'chrome://open_ils_staff_client/content/main/search_prefs.xul'
}
if(use_tpac) {
var url = G.auth.controller.view.server_prompt.value.match(/^[^\/]*/).toString() || urls.remote;
G.data.server_unadorned = url; G.data.stash('server_unadorned'); G.data.stash_retrieve();
+ try {
+ G.data.search_lib = G.pref.getIntPref('open-ils.' + url + '.search_lib');
+ G.data.pref_lib = G.pref.getIntPref('open-ils.' + url + '.pref_lib');
+ } catch(E) {
+ G.data.search_lib = null;
+ G.data.pref_lib = null;
+ }
+ G.data.stash('search_lib');
+ G.data.stash('pref_lib');
if (! url.match( '^(http|https)://' ) ) { url = 'http://' + url; }
xulG.pref.setBoolPref('oils.copy_editor.copy_location_name_first', !curvalue);
}
],
+ 'cmd_search_prefs' : [
+ ['oncommand'],
+ function() {
+ try {
+ obj.set_tab(obj.url_prefix('XUL_SEARCH_PREFS'));
+ } catch(E) {
+ alert(E)
+ }
+ }
+ ],
};
JSAN.use('util.controller');
perm="DEBUG_CLIENT"
/>
<command id="cmd_copy_editor_copy_location_first_toggle" />
+ <command id="cmd_search_prefs" />
</commandset>
<!-- The File menu on the main menu -->
<menuitem label="&staff.server.admin.index.printer;" command="cmd_local_admin_printer"/>
<menuitem label="&staff.main.menu.admin.template_edit.label;" accesskey="&staff.main.menu.admin.template_edit.accesskey;" command="cmd_print_list_template_edit"/>
<menuitem label="&staff.server.admin.index.fonts_and_sounds;" command="cmd_local_admin_fonts_and_sounds"/>
+ <menuitem label="&staff.main.menu.admin.client.search_prefs.label;" command="cmd_search_prefs"/>
<menuitem type="checkbox" label="&staff.main.menu.admin.client.copy_editor.copy_location.label;" command="cmd_copy_editor_copy_location_first_toggle"/>
<menu id="main.menu.admin.client.hotkeys" label="&staff.main.menu.admin.client.hotkeys;">
<menupopup id="main.menu.admin.client.hotkeys.popup">
--- /dev/null
+<?xml version="1.0"?>
+<!-- Application: Evergreen Staff Client -->
+<!-- Screen: Workstation level search preferences -->
+<!--
+ vim:noet:sw=4:ts=4:
+-->
+
+<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
+<?xml-stylesheet href="chrome://open_ils_staff_client/skin/global.css" type="text/css"?>
+
+<!DOCTYPE window SYSTEM "chrome://open_ils_staff_client/locale/lang.dtd">
+
+<?xul-overlay href="chrome://open_ils_staff_client/content/OpenILS/util_overlay_chrome.xul"?>
+
+<window id="search_prefs_diag"
+ onload="try { my_init(); } catch(E) { alert(E); }"
+ xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+ <script type="text/javascript">
+ var myPackageDir = 'open_ils_staff_client'; var IAMXUL = true;
+ </script>
+ <scripts id="openils_util_scripts"/>
+ <script type="text/javascript" src="JSAN.js"/>
+
+ <script>
+ <![CDATA[
+ var g = {};
+ var search_lib_box;
+ var pref_lib_box;
+ var prefSvc;
+ var data;
+ var saved_message;
+ function my_init() {
+ JSAN.use('OpenILS.data');
+ data = new OpenILS.data();
+ data.init({'via':'stash'});
+ search_lib_box = document.getElementById('search_lib');
+ pref_lib_box = document.getElementById('pref_lib');
+ // NOTE: If this ever deals with custom trees, this is where you likely want to mess with things.
+ add_aou(data.tree.aou, '');
+ prefSvc = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch).QueryInterface(Components.interfaces.nsIPrefBranch2);
+ saved_message = document.getElementById('saved_message').textContent;
+ if (data.search_lib) {
+ search_lib_box.value = data.search_lib;
+ pref_lib_box.value = data.pref_lib;
+ } else {
+ search_lib_box.selectedIndex = 0;
+ pref_lib_box.selectedIndex = 0;;
+ }
+ }
+ function add_aou(aou, depth) {
+ search_lib_box.appendItem(depth + aou.name(), aou.id(), '');
+ pref_lib_box.appendItem(depth + aou.name(), aou.id(), '');
+ for(var i = 0; i < aou.children().length; i++)
+ add_aou(aou.children()[i], depth + ' ');
+ }
+ function update_prefs() {
+ prefSvc.setIntPref('open-ils.' + data.server_unadorned + '.search_lib', search_lib_box.value);
+ prefSvc.setIntPref('open-ils.' + data.server_unadorned + '.pref_lib', pref_lib_box.value);
+ data.search_lib = search_lib_box.value;
+ data.pref_lib = pref_lib_box.value;
+ data.stash('search_lib');
+ data.stash('pref_lib');
+ alert(saved_message);
+ }
+ ]]>
+ </script>
+ <commandset id="search_prefs_cmds">
+ <command id="save_search_prefs" oncommand="update_prefs()" />
+ </commandset>
+ <vbox id="search_prefs_main">
+ <groupbox>
+ <caption label="&staff.search_prefs.search_lib.caption;"/>
+ <description>&staff.search_prefs.search_lib.description;</description>
+ <menulist id="search_lib">
+ <menupopup>
+ </menupopup>
+ </menulist>
+ </groupbox>
+ <groupbox>
+ <caption label="&staff.search_prefs.pref_lib.caption;"/>
+ <description>&staff.search_prefs.pref_lib.description;</description>
+ <menulist id="pref_lib">
+ <menupopup>
+ </menupopup>
+ </menulist>
+ </groupbox>
+ <button id="save_button" command="save_search_prefs" label="&staff.search_prefs.save.label;" accesskey="&staff.search_prefs.save.accesskey;"/>
+ </vbox>
+ <description id="saved_message" style="display:none">&staff.search_prefs.saved_message;</description>
+</window>
newChannel: function(aURI) {
var ios = Components.classes["@mozilla.org/network/io-service;1"].getService(Components.interfaces.nsIIOService);
var host;
+ var data_cache = Components.classes["@open-ils.org/openils_data_cache;1"].getService().wrappedJSObject.data;
switch(aURI.host) {
case 'remote':
- var data_cache = Components.classes["@open-ils.org/openils_data_cache;1"].getService().wrappedJSObject.data;
host = data_cache.server_unadorned;
break;
case 'selfcheck':
return ios.newChannel("about:blank", null, null); // Bad input. Not really sure what to do. Returning a dummy channel does prevent a crash, though!
var chunk = aURI.spec.replace(/^oils:\/\/[^\/]*\//,'');
var channel = ios.newChannel("https://" + host + "/" + chunk, null, null).QueryInterface(Components.interfaces.nsIHttpChannel);
- channel.QueryInterface(Components.interfaces.nsIHttpChannel).setRequestHeader("OILS-Wrapper", "true", false);
+ channel.setRequestHeader("OILS-Wrapper", "true", false);
+ // If we have a search/pref lib, set them too!
+ if (data_cache.search_lib && data_cache.search_lib != null)
+ channel.setRequestHeader("OILS-Search-Lib", data_cache.search_lib, false);
+ if (data_cache.pref_lib && data_cache.pref_lib != null)
+ channel.setRequestHeader("OILS-Pref-Lib", data_cache.pref_lib, false);
if(this._system_principal == null) {
// We don't have the owner?
var chrome_service = Components.classesByID['{61ba33c0-3031-11d3-8cd0-0060b0fc14a3}'].getService().QueryInterface(Components.interfaces.nsIProtocolHandler);