6 if (typeof JSAN == 'undefined') { throw( "The JSAN library object is missing."); }
7 JSAN.errorLevel = "die"; // none, warn, or die
8 JSAN.addRepository('/xul/server/');
9 JSAN.use('util.error'); error = new util.error();
10 error.sdump('D_TRACE','my_init() for circ_age_to_lost.xul');
12 JSAN.use('OpenILS.data'); data = new OpenILS.data(); data.stash_retrieve();
17 $('doit').addEventListener('command',doit,false);
19 if (typeof window.xulG == 'object' && typeof window.xulG.set_tab_name == 'function') {
20 try { window.xulG.set_tab_name( $('offlineStrings').getString('menu.cmd_local_admin_age_overdue_circulations_to_lost.tab') ); } catch(E) { alert(E); }
24 alert('Error in admin/circ_age_to_lost.xul, my_init(): ' + E);
30 $('checkbox').disabled = true;
31 ev.target.disabled = true;
32 $('deck').selectedIndex = 1;
33 var profile = $('profile').value;
34 var circ_lib = $('circ_lib').value;
36 function response_handler(e,r,list) {
40 case 'oncomplete' : return; break;
41 default: result = r.recv().content(); break;
43 dump(e + ' result = ' + js2JSON(result) + '\n');
44 if (typeof result.progress != 'undefined') {
46 $('results_label').setAttribute('value', $('adminStrings').getFormattedString('staff.admin.age_overdue_circulations_to_lost.chunks_processed',[result.progress]) );
48 } else if (typeof result.created != 'undefined') {
50 $('results_label').setAttribute('value', $('adminStrings').getFormattedString('staff.admin.age_overdue_circulations_to_lost.events_created',[result.created]) );
51 $('deck').selectedIndex = 0;
53 } else if (typeof result.error != 'undefined') {
55 $('deck').selectedIndex = 0;
62 $('deck').selectedIndex = 0;
63 alert('Error in admin/circ_age_to_lost.js, doit(), ' + e + ': ' + r + ' => ' + E);
66 dump('firing ' + api.FM_CIRC_AGE_TO_LOST.method + ' with profile ' + profile + ' and circ_lib ' + circ_lib + '\n');
67 fieldmapper.standardRequest(
68 [ api.FM_CIRC_AGE_TO_LOST.app, api.FM_CIRC_AGE_TO_LOST.method ],
70 params: [ses(), { 'user_profile' : profile, 'circ_lib' : circ_lib } ],
71 onresponse: function(r) { response_handler('onresponse',r); },
72 oncomplete: function(r) { response_handler('oncomplete',r); },
73 onerror: function(r) { response_handler('onerror',r); }
78 alert('Error in admin/circ_age_to_lost.js, doit(): ' + E);
82 function build_pgt_list() {
83 JSAN.use('util.functional'); JSAN.use('util.widgets');
84 var default_profile = data.tree.pgt.id();
85 var menu_data = util.functional.map_list(
88 var sname = obj.name();
89 for (i = sname.length; i < 20; i++) {
92 var depth = 0; var p = obj;
93 while (p = data.hash.pgt[ p.parent() ]) { depth++; }
95 obj.description() ? sname + ' : ' + obj.description() : obj.name(),
97 false, // disable menuentry?
98 ( depth * 2) // spaces of indentation
102 var ml = util.widgets.make_menulist( menu_data, default_profile );
103 ml.setAttribute('id','profile'); $('x_profile').appendChild(ml);
106 function build_ou_list() {
107 JSAN.use('util.file'); JSAN.use('util.widgets');
108 var file = new util.file('offline_ou_list');
109 if (file._file.exists()) {
110 var menu_data = file.get_object(); file.close();
111 for (var i = 0; i < menu_data[0].length; i++) { // make sure all entries are enabled
112 menu_data[0][i][2] = false;
114 ml = util.widgets.make_menulist( menu_data[0], menu_data[1] );
115 ml.setAttribute('id','circ_lib'); $('x_circ_lib').appendChild(ml);
117 throw('Missing file offline_ou_list in build_ou_list()');