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"/>
33 JSAN.use('OpenILS.data');
34 data = new OpenILS.data();
35 data.init({'via':'stash'});
36 search_lib_box = document.getElementById('search_lib');
37 pref_lib_box = document.getElementById('pref_lib');
38 // NOTE: If this ever deals with custom trees, this is where you likely want to mess with things.
39 add_aou(data.tree.aou, '');
40 prefSvc = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch).QueryInterface(Components.interfaces.nsIPrefBranch2);
41 saved_message = document.getElementById('saved_message').textContent;
42 if (data.search_lib) {
43 search_lib_box.value = data.search_lib;
44 pref_lib_box.value = data.pref_lib;
46 search_lib_box.selectedIndex = 0;
47 pref_lib_box.selectedIndex = 0;;
50 function add_aou(aou, depth) {
51 search_lib_box.appendItem(depth + aou.name(), aou.id(), '');
52 pref_lib_box.appendItem(depth + aou.name(), aou.id(), '');
53 for(var i = 0; i < aou.children().length; i++)
54 add_aou(aou.children()[i], depth + ' ');
56 function update_prefs() {
57 prefSvc.setIntPref('open-ils.' + data.server_unadorned + '.search_lib', search_lib_box.value);
58 prefSvc.setIntPref('open-ils.' + data.server_unadorned + '.pref_lib', pref_lib_box.value);
59 data.search_lib = search_lib_box.value;
60 data.pref_lib = pref_lib_box.value;
61 data.stash('search_lib');
62 data.stash('pref_lib');
67 <commandset id="search_prefs_cmds">
68 <command id="save_search_prefs" oncommand="update_prefs()" />
70 <vbox id="search_prefs_main">
72 <caption label="&staff.search_prefs.search_lib.caption;"/>
73 <description>&staff.search_prefs.search_lib.description;</description>
74 <menulist id="search_lib">
80 <caption label="&staff.search_prefs.pref_lib.caption;"/>
81 <description>&staff.search_prefs.pref_lib.description;</description>
82 <menulist id="pref_lib">
87 <button id="save_button" command="save_search_prefs" label="&staff.search_prefs.save.label;" accesskey="&staff.search_prefs.save.accesskey;"/>
89 <description id="saved_message" style="display:none">&staff.search_prefs.saved_message;</description>