1 dump('entering circ.offline.js\n');
3 if (typeof circ == 'undefined') circ = {};
4 circ.offline = function (params) {
6 netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
7 JSAN.use('util.error'); this.error = new util.error();
9 dump('circ.offline: ' + E + '\n');
13 circ.offline.prototype = {
15 'init' : function( params ) {
18 netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
22 JSAN.use('util.deck'); obj.deck = new util.deck('main');
24 JSAN.use('util.controller'); obj.controller = new util.controller();
30 function() { alert('Not Yet Implemented'); }
34 function() { obj.deck.set_iframe('offline_checkout.xul',{},{}); }
38 function() { obj.deck.set_iframe('offline_renew.xul',{},{}); }
40 'cmd_in_house_use' : [
42 function() { obj.deck.set_iframe('offline_in_house_use.xul',{},{}); }
46 function() { obj.deck.set_iframe('offline_checkin.xul',{},{}); }
48 'cmd_register_patron' : [
50 function() { obj.deck.set_iframe('offline_register.xul',{},{}); }
52 'cmd_print_last_receipt' : [
55 JSAN.use('util.print'); var print = new util.print();
61 function() { window.close(); }
72 this.error.sdump('D_ERROR','circ.offline.init: ' + E + '\n');
76 'receipt_init' : function() {
77 function backup_receipt_templates() {
78 data.print_list_templates = {
79 'offline_checkout' : {
80 'type' : 'offline_checkout',
81 'header' : 'Patron %patron_barcode%<br/>\r\nYou checked out the following items:<hr/><ol>',
82 'line_item' : '<li>Barcode: %barcode%<br/>\r\nDue: %due_date%\r\n',
83 'footer' : '</ol><hr />%TODAY_TRIM%<br/>\r\n<br/>\r\n',
86 'type' : 'offline_checkin',
87 'header' : 'You checked in the following items:<hr/><ol>',
88 'line_item' : '<li>Barcode: %barcode%\r\n',
89 'footer' : '</ol><hr />%TODAY_TRIM%<br/>\r\n<br/>\r\n',
92 'type' : 'offline_renew',
93 'header' : 'You renewed the following items:<hr/><ol>',
94 'line_item' : '<li>Barcode: %barcode%\r\n',
95 'footer' : '</ol><hr />%TODAY_TRIM%<br/>\r\n<br/>\r\n',
97 'offline_inhouse_use' : {
98 'type' : 'offline_inhouse_use',
99 'header' : 'You marked the following in-house items used:<hr/><ol>',
100 'line_item' : '<li>Barcode: %barcode%\r\nUses: %count%',
101 'footer' : '</ol><hr />%TODAY_TRIM%<br/>\r\n<br/>\r\n',
104 data.stash('print_list_templates');
107 JSAN.use('OpenILS.data'); var data = new OpenILS.data(); data.init({'via':'stash'});
108 JSAN.use('util.file'); var file = new util.file('print_list_templates');
109 if (file._file.exists()) {
111 var x = file.get_object();
113 data.print_list_templates = x;
114 data.stash('print_list_templates');
116 backup_receipt_templates();
120 backup_receipt_templates();
123 backup_receipt_templates();
128 'patron_init' : function() {
129 JSAN.use('OpenILS.data'); var data = new OpenILS.data(); data.init({'via':'stash'});
130 JSAN.use('util.file'); var file = new util.file('offline_patron_list');
131 if (file._file.exists()) {
132 var lines = file.get_content().split(/\n/);
134 for (var i = 0; i < lines.length; i++) {
135 hash[ lines[i].split(/\s+/)[0] ] = lines[i].split(/\s+/)[1];
138 data.bad_patrons = hash;
139 data.stash('bad_patrons');
140 var file2 = new util.file('offline_patron_list.date');
141 if (file2._file.exists()) {
142 data.bad_patrons_date = file2.get_content();
143 data.stash('bad_patrons_date');
147 data.bad_patrons = {};
148 data.stash('bad_patrons');
155 dump('exiting circ.offline.js\n');