1 dump('entering circ.checkin.js\n');
3 if (typeof patron == 'undefined') patron = {};
4 circ.checkin = function (params) {
6 JSAN.use('util.error'); this.error = new util.error();
7 JSAN.use('util.network'); this.network = new util.network();
10 circ.checkin.prototype = {
12 'init' : function( params ) {
16 obj.session = params['session'];
18 JSAN.use('circ.util');
19 var columns = circ.util.columns(
21 'barcode' : { 'hidden' : false },
22 'title' : { 'hidden' : false },
23 'status' : { 'hidden' : false },
26 dump('columns = ' + js2JSON(columns) + '\n');
28 JSAN.use('util.list'); obj.list = new util.list('checkin_list');
32 'map_row_to_column' : function(row,col) {
33 // row contains { 'my' : { 'acp' : {}, 'circ' : {}, 'mvr' : {} } }
34 // col contains one of the objects listed above in columns
36 return eval( col.render );
41 JSAN.use('util.controller'); obj.controller = new util.controller();
45 'checkin_barcode_entry_textbox' : [
48 if (ev.keyCode && ev.keyCode == 13) {
55 function() { alert('Not Yet Implemented'); }
57 'cmd_checkin_submit_barcode' : [
63 'cmd_checkin_print' : [
68 'cmd_checkin_reprint' : [
73 'cmd_checkin_done' : [
81 this.controller.view.checkin_barcode_entry_textbox.focus();
85 'checkin' : function() {
88 var barcode = obj.controller.view.checkin_barcode_entry_textbox.value;
89 var checkin = obj.network.request(
90 api.checkin_via_barcode.app,
91 api.checkin_via_barcode.method,
92 [ obj.session, barcode, obj.patron_id ]
98 'circ' : checkin.circ,
99 'mvr' : checkin.record,
103 //I could override map_row_to_column here
106 if (typeof obj.on_checkin == 'function') {
107 obj.on_checkin(checkin);
109 if (typeof window.xulG == 'object' && typeof window.xulG.on_checkin == 'function') {
110 obj.error.sdump('D_CIRC','circ.checkin: Calling external .on_checkin()\n');
111 window.xulG.on_checkin(checkin);
113 obj.error.sdump('D_CIRC','circ.checkin: No external .on_checkin()\n');
117 alert('FIXME: need special alert and error handling\n'
119 if (typeof obj.on_failure == 'function') {
122 if (typeof window.xulG == 'object' && typeof window.xulG.on_failure == 'function') {
123 obj.error.sdump('D_CIRC','circ.checkin: Calling external .on_failure()\n');
124 window.xulG.on_failure(E);
126 obj.error.sdump('D_CIRC','circ.checkin: No external .on_failure()\n');
132 'on_checkin' : function() {
133 this.controller.view.checkin_barcode_entry_textbox.value = '';
134 this.controller.view.checkin_barcode_entry_textbox.focus();
137 'on_failure' : function() {
138 this.controller.view.checkin_barcode_entry_textbox.select();
139 this.controller.view.checkin_barcode_entry_textbox.focus();
143 dump('exiting circ.checkin.js\n');