2 <!-- Application: Evergreen Staff Client -->
3 <!-- Screen: Workstation level search preferences -->
8 <?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
9 <?xml-stylesheet href="chrome://open_ils_staff_client/skin/global.css" type="text/css"?>
11 <!DOCTYPE window SYSTEM "chrome://open_ils_staff_client/locale/lang.dtd">
13 <?xul-overlay href="chrome://open_ils_staff_client/content/OpenILS/util_overlay_chrome.xul"?>
15 <window id="search_prefs_diag"
16 onload="try { my_init(); } catch(E) { alert(E); }"
17 xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
18 <script type="text/javascript">
19 var myPackageDir = 'open_ils_staff_client'; var IAMXUL = true;
21 <scripts id="openils_util_scripts"/>
22 <script type="text/javascript" src="JSAN.js"/>
35 JSAN.use('OpenILS.data');
36 data = new OpenILS.data();
37 data.init({'via':'stash'});
38 search_lib_box = document.getElementById('search_lib');
39 pref_lib_box = document.getElementById('pref_lib');
40 adv_pane_box = document.getElementById('adv_pane');
41 // NOTE: If this ever deals with custom trees, this is where you likely want to mess with things.
42 add_aou(data.tree.aou, '');
43 prefSvc = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch).QueryInterface(Components.interfaces.nsIPrefBranch2);
44 saved_message = document.getElementById('saved_message').textContent;
45 cleared_message = document.getElementById('cleared_message').textContent;
46 if (data.search_lib) {
47 search_lib_box.value = data.search_lib;
49 search_lib_box.selectedIndex = 0;
52 pref_lib_box.value = data.pref_lib;
54 pref_lib_box.selectedIndex = 0;;
57 adv_pane_box.value = data.adv_pane;
59 adv_pane_box.selectedIndex = 0;
62 function add_aou(aou, depth) {
63 search_lib_box.appendItem(depth + aou.name(), aou.id(), '');
64 pref_lib_box.appendItem(depth + aou.name(), aou.id(), '');
65 for(var i = 0; i < aou.children().length; i++)
66 add_aou(aou.children()[i], depth + ' ');
68 function update_prefs() {
69 prefSvc.setIntPref('open-ils.' + data.server_unadorned + '.search_lib', search_lib_box.value);
70 prefSvc.setIntPref('open-ils.' + data.server_unadorned + '.pref_lib', pref_lib_box.value);
71 prefSvc.setCharPref('open-ils.' + data.server_unadorned + '.adv_pane', adv_pane_box.value);
72 data.search_lib = search_lib_box.value;
73 data.pref_lib = pref_lib_box.value;
74 data.adv_pane = adv_pane_box.value;
75 data.stash('search_lib');
76 data.stash('pref_lib');
77 data.stash('adv_pane');
80 function clear_prefs() {
81 prefSvc.clearUserPref('open-ils.' + data.server_unadorned + '.search_lib');
82 prefSvc.clearUserPref('open-ils.' + data.server_unadorned + '.pref_lib');
83 prefSvc.clearUserPref('open-ils.' + data.server_unadorned + '.adv_pane');
84 data.search_lib = null;
87 data.stash('search_lib');
88 data.stash('pref_lib');
89 data.stash('adv_pane');
90 alert(cleared_message);
94 <commandset id="search_prefs_cmds">
95 <command id="save_search_prefs" oncommand="update_prefs()" />
96 <command id="clear_search_prefs" oncommand="clear_prefs()" />
98 <vbox id="search_prefs_main">
100 <caption label="&staff.search_prefs.search_lib.caption;"/>
101 <description>&staff.search_prefs.search_lib.description;</description>
102 <menulist id="search_lib">
108 <caption label="&staff.search_prefs.pref_lib.caption;"/>
109 <description>&staff.search_prefs.pref_lib.description;</description>
110 <menulist id="pref_lib">
116 <caption label="&staff.search_prefs.adv_pane.caption;"/>
117 <description>&staff.search_prefs.adv_pane.description;</description>
118 <menulist id="adv_pane">
120 <menuitem label="&staff.search_prefs.adv_pane.advanced;" value="advanced" />
121 <menuitem label="&staff.search_prefs.adv_pane.numeric;" value="numeric" />
122 <menuitem label="&staff.search_prefs.adv_pane.expert;" value="expert" />
126 <button id="save_button" command="save_search_prefs" label="&staff.search_prefs.save.label;" accesskey="&staff.search_prefs.save.accesskey;"/>
127 <button id="clear_button" command="clear_search_prefs" label="&staff.search_prefs.clear.label;" accesskey="&staff.search_prefs.clear.accesskey;"/>
129 <description id="saved_message" style="display:none">&staff.search_prefs.saved_message;</description>
130 <description id="cleared_message" style="display:none">&staff.search_prefs.cleared_message;</description>