8 netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
9 if (typeof JSAN == 'undefined') { throw( "The JSAN library object is missing."); }
10 JSAN.errorLevel = "die"; // none, warn, or die
11 JSAN.addRepository('/xul/server/');
12 JSAN.use('util.error'); error = new util.error();
13 error.sdump('D_TRACE','my_init() for main_test.xul');
14 JSAN.use('util.network'); network = new util.network();
15 JSAN.use('OpenILS.data'); data = new OpenILS.data(); data.stash_retrieve();
17 dojo.require('openils.PermaCrud');
18 coust_obj = new openils.PermaCrud({authtoken:ses()}).search('coust',{'name':'circ.staff_client.do_not_auto_attempt_print'})[0];
19 document.getElementById('caption').setAttribute('label',coust_obj.label());
20 document.getElementById('caption').setAttribute('tooltiptext',coust_obj.name());
21 append_to_vbox('desc',coust_obj.description());
23 render_current_setting();
25 document.getElementById('apply').addEventListener(
31 var ml = util.widgets.render_perm_org_menu('ADMIN_ORG_UNIT_SETTING_TYPE');
33 document.getElementById('apply').disabled = false;
34 ml.setAttribute('id','lib_menulist');
35 var x = document.getElementById('menu');
36 util.widgets.remove_children(x);
41 try { error.standard_unexpected_error_alert('main/test.xul',E); } catch(F) { alert(E); }
45 function append_to_vbox(id,node) {
46 if (typeof node == 'string') { var text = document.createTextNode(node); node = document.createElement('description'); node.appendChild(text); }
47 document.getElementById(id).appendChild(node);
50 function admin_string(s,p) {
51 var mc = document.getElementById('adminStrings');
53 return mc.getFormattedString(s,p);
55 return mc.getString(s);
59 function apply_setting(ev) {
61 if (document.getElementById('checkout').checked) { values.push('Checkout'); }
62 if (document.getElementById('bill_pay').checked) { values.push('Bill Pay'); }
63 if (document.getElementById('hold_slip').checked) { values.push('Hold Slip'); }
64 if (document.getElementById('transit_slip').checked) { values.push('Transit Slip'); }
65 if (document.getElementById('hold_transit_slip').checked) { values.push('Hold/Transit Slip'); }
66 var org = document.getElementById('lib_menulist').value;
67 var result = network.simple_request('FM_AOUS_UPDATE',[ ses(), org, { 'circ.staff_client.do_not_auto_attempt_print' : values } ]);
69 alert(admin_string('staff.admin.staff.do_not_auto_attempt_print_setting.update_success'));
70 render_current_setting();
72 error.standard_unexpected_error_alert(admin_string('staff.admin.staff.do_not_auto_attempt_print_setting.update_failure'),result);
76 function render_current_setting() {
77 JSAN.use('util.widgets');
79 util.widgets.remove_children('current');
81 /* FIXME: would be good to have an .authoritative version of FM_AOUS_SPECIFIC_RETRIEVE */
82 var aous_req = network.simple_request('FM_AOUS_SPECIFIC_RETRIEVE',[ ses('ws_ou'), 'circ.staff_client.do_not_auto_attempt_print', ses() ]);
87 'staff.admin.staff.do_not_auto_attempt_print_setting.current_setting_preamble',
88 [ ses('ws_ou_shortname'), data.hash.aou[ aous_req.org ].shortname() ]
92 for (var i in aous_req.value) {
93 var label = document.createElement('label');
94 label.setAttribute('value', ' ' + aous_req.value[i]);
95 append_to_vbox('current',label);
98 /* update data.hash.aous while we have fresh data */
100 data.hash.aous['circ.staff_client.do_not_auto_attempt_print'] = aous_req.value;
107 'staff.admin.staff.do_not_auto_attempt_print_setting.current_setting_nonexistent',
108 [ ses('ws_ou_shortname') ]