8 if (typeof JSAN == 'undefined') { throw( "The JSAN library object is missing."); }
9 JSAN.errorLevel = "die"; // none, warn, or die
10 JSAN.addRepository('/xul/server/');
11 JSAN.use('util.error'); error = new util.error();
12 error.sdump('D_TRACE','my_init() for main_test.xul');
13 JSAN.use('util.network'); network = new util.network();
14 JSAN.use('OpenILS.data'); data = new OpenILS.data(); data.stash_retrieve();
16 dojo.require('openils.PermaCrud');
17 coust_obj = new openils.PermaCrud({authtoken:ses()}).search('coust',{'name':'circ.staff_client.do_not_auto_attempt_print'})[0];
18 document.getElementById('caption').setAttribute('label',coust_obj.label());
19 document.getElementById('caption').setAttribute('tooltiptext',coust_obj.name());
20 append_to_vbox('desc',coust_obj.description());
22 render_current_setting();
24 document.getElementById('apply').addEventListener(
30 var ml = util.widgets.render_perm_org_menu('ADMIN_ORG_UNIT_SETTING_TYPE');
32 document.getElementById('apply').disabled = false;
33 ml.setAttribute('id','lib_menulist');
34 var x = document.getElementById('menu');
35 util.widgets.remove_children(x);
40 try { error.standard_unexpected_error_alert('main/test.xul',E); } catch(F) { alert(E); }
44 function append_to_vbox(id,node) {
45 if (typeof node == 'string') { var text = document.createTextNode(node); node = document.createElement('description'); node.appendChild(text); }
46 document.getElementById(id).appendChild(node);
49 function admin_string(s,p) {
50 var mc = document.getElementById('adminStrings');
52 return mc.getFormattedString(s,p);
54 return mc.getString(s);
58 function apply_setting(ev) {
60 if (document.getElementById('checkout').checked) { values.push('Checkout'); }
61 if (document.getElementById('bill_pay').checked) { values.push('Bill Pay'); }
62 if (document.getElementById('hold_slip').checked) { values.push('Hold Slip'); }
63 if (document.getElementById('transit_slip').checked) { values.push('Transit Slip'); }
64 if (document.getElementById('hold_transit_slip').checked) { values.push('Hold/Transit Slip'); }
65 var org = document.getElementById('lib_menulist').value;
66 var result = network.simple_request('FM_AOUS_UPDATE',[ ses(), org, { 'circ.staff_client.do_not_auto_attempt_print' : values } ]);
68 alert(admin_string('staff.admin.staff.do_not_auto_attempt_print_setting.update_success'));
69 render_current_setting();
71 error.standard_unexpected_error_alert(admin_string('staff.admin.staff.do_not_auto_attempt_print_setting.update_failure'),result);
75 function render_current_setting() {
76 JSAN.use('util.widgets');
78 util.widgets.remove_children('current');
80 /* FIXME: would be good to have an .authoritative version of FM_AOUS_SPECIFIC_RETRIEVE */
81 var aous_req = network.simple_request('FM_AOUS_SPECIFIC_RETRIEVE',[ ses('ws_ou'), 'circ.staff_client.do_not_auto_attempt_print', ses() ]);
86 'staff.admin.staff.do_not_auto_attempt_print_setting.current_setting_preamble',
87 [ ses('ws_ou_shortname'), data.hash.aou[ aous_req.org ].shortname() ]
91 for (var i in aous_req.value) {
92 var label = document.createElement('label');
93 label.setAttribute('value', ' ' + aous_req.value[i]);
94 append_to_vbox('current',label);
97 /* update data.hash.aous while we have fresh data */
99 data.hash.aous['circ.staff_client.do_not_auto_attempt_print'] = aous_req.value;
106 'staff.admin.staff.do_not_auto_attempt_print_setting.current_setting_nonexistent',
107 [ ses('ws_ou_shortname') ]