checkin skeleton
authorphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 14 Dec 2005 17:30:15 +0000 (17:30 +0000)
committerphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 14 Dec 2005 17:30:15 +0000 (17:30 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@2376 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/xul/staff_client/server/circ/checkin.js [new file with mode: 0644]
Open-ILS/xul/staff_client/server/circ/checkin.xul [new file with mode: 0644]
Open-ILS/xul/staff_client/server/circ/checkin_overlay.xul [new file with mode: 0644]

diff --git a/Open-ILS/xul/staff_client/server/circ/checkin.js b/Open-ILS/xul/staff_client/server/circ/checkin.js
new file mode 100644 (file)
index 0000000..f3a806e
--- /dev/null
@@ -0,0 +1,145 @@
+dump('entering circ.checkin.js\n');
+
+if (typeof patron == 'undefined') patron = {};
+circ.checkin = function (params) {
+
+       JSAN.use('util.error'); this.error = new util.error();
+       JSAN.use('util.network'); this.network = new util.network();
+
+       JSAN.use('OpenILS.data'); this.OpenILS = {};
+       this.OpenILS.data = new OpenILS.data(); this.OpenILS.data.init({'via':'stash'});
+}
+
+circ.checkin.prototype = {
+
+       'init' : function( params ) {
+
+               var obj = this;
+
+               obj.session = params['session'];
+
+               JSAN.use('circ.util');
+               var columns = circ.util.columns( 
+                       { 
+                               'barcode' : { 'hidden' : false },
+                               'title' : { 'hidden' : false },
+                               'status' : { 'hidden' : false },
+                       } 
+               );
+
+               JSAN.use('util.list'); obj.list = new util.list('checkin_list');
+               obj.list.init(
+                       {
+                               'columns' : columns,
+                               'map_row_to_column' : function(row,col) {
+                                       // row contains { 'my' : { 'acp' : {}, 'circ' : {}, 'mvr' : {} } }
+                                       // col contains one of the objects listed above in columns
+                                       var my = row.my;
+                                       return eval( col.render );
+                               },
+                       }
+               );
+               
+               JSAN.use('util.controller'); obj.controller = new util.controller();
+               obj.controller.init(
+                       {
+                               'control_map' : {
+                                       'checkin_barcode_entry_textbox' : [
+                                               ['keypress'],
+                                               function(ev) {
+                                                       if (ev.keyCode && ev.keyCode == 13) {
+                                                               obj.checkin();
+                                                       }
+                                               }
+                                       ],
+                                       'cmd_broken' : [
+                                               ['command'],
+                                               function() { alert('Not Yet Implemented'); }
+                                       ],
+                                       'cmd_checkin_submit_barcode' : [
+                                               ['command'],
+                                               function() {
+                                                       obj.checkin();
+                                               }
+                                       ],
+                                       'cmd_checkin_print' : [
+                                               ['command'],
+                                               function() {
+                                               }
+                                       ],
+                                       'cmd_checkin_reprint' : [
+                                               ['command'],
+                                               function() {
+                                               }
+                                       ],
+                                       'cmd_checkin_done' : [
+                                               ['command'],
+                                               function() {
+                                               }
+                                       ],
+                               }
+                       }
+               );
+               this.controller.view.checkin_barcode_entry_textbox.focus();
+
+       },
+
+       'checkin' : function() {
+               var obj = this;
+               try {
+                       var barcode = obj.controller.view.checkin_barcode_entry_textbox.value;
+                       var checkin = obj.network.request(
+                               api.checkin_via_barcode.app,
+                               api.checkin_via_barcode.method,
+                               [ obj.session, barcode, obj.patron_id ]
+                       );
+                       obj.list.append(
+                               {
+                                       'row' : {
+                                               'my' : {
+                                               'circ' : checkin.circ,
+                                               'mvr' : checkin.record,
+                                               'acp' : checkin.copy
+                                               }
+                                       }
+                               //I could override map_row_to_column here
+                               }
+                       );
+                       if (typeof obj.on_checkin == 'function') {
+                               obj.on_checkin(checkin);
+                       }
+                       if (typeof window.xulG == 'object' && typeof window.xulG.on_checkin == 'function') {
+                               obj.error.sdump('D_CIRC','circ.checkin: Calling external .on_checkin()\n');
+                               window.xulG.on_checkin(checkin);
+                       } else {
+                               obj.error.sdump('D_CIRC','circ.checkin: No external .on_checkin()\n');
+                       }
+
+               } catch(E) {
+                       alert('FIXME: need special alert and error handling\n'
+                               + js2JSON(E));
+                       if (typeof obj.on_failure == 'function') {
+                               obj.on_failure(E);
+                       }
+                       if (typeof window.xulG == 'object' && typeof window.xulG.on_failure == 'function') {
+                               obj.error.sdump('D_CIRC','circ.checkin: Calling external .on_failure()\n');
+                               window.xulG.on_failure(E);
+                       } else {
+                               obj.error.sdump('D_CIRC','circ.checkin: No external .on_failure()\n');
+                       }
+               }
+
+       },
+
+       'on_checkin' : function() {
+               this.controller.view.checkin_barcode_entry_textbox.value = '';
+               this.controller.view.checkin_barcode_entry_textbox.focus();
+       },
+
+       'on_failure' : function() {
+               this.controller.view.checkin_barcode_entry_textbox.select();
+               this.controller.view.checkin_barcode_entry_textbox.focus();
+       }
+}
+
+dump('exiting circ.checkin.js\n');
diff --git a/Open-ILS/xul/staff_client/server/circ/checkin.xul b/Open-ILS/xul/staff_client/server/circ/checkin.xul
new file mode 100644 (file)
index 0000000..8ea1466
--- /dev/null
@@ -0,0 +1,72 @@
+<?xml version="1.0"?>
+<!-- Application: Evergreen Staff Client -->
+<!-- Screen: Patron Display -->
+
+<!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
+<!-- STYLESHEETS -->
+<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
+<?xml-stylesheet href="/xul/server/skin/evergreen.css" type="text/css"?>
+<?xml-stylesheet href="/xul/server/skin/circ.css" type="text/css"?>
+
+<!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
+<!-- LOCALIZATION -->
+<!DOCTYPE window SYSTEM "chrome://evergreen/locale/lang.dtd">
+
+<!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
+<!-- OVERLAYS -->
+<?xul-overlay href="/xul/server/OpenILS/util_overlay.xul"?>
+<?xul-overlay href="/xul/server/circ/checkin_overlay.xul"?>
+
+<window id="checkin_win" 
+       onload="my_init()"
+       xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+
+       <!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
+       <!-- BEHAVIOR -->
+        <script type="text/javascript">var myPackageDir = 'evergreen'; var IAMXUL = true; var g = {};</script>
+        <scripts id="openils_util_scripts"/>
+
+       <script type="text/javascript" src="/xul/server/main/JSAN.js"/>
+       <script>
+       <![CDATA[
+               function my_init() {
+                       try {
+                               netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
+                               if (typeof JSAN == 'undefined') { throw( "The JSAN library object is missing."); }
+                               JSAN.errorLevel = "die"; // none, warn, or die
+                               JSAN.addRepository('/xul/server/');
+                               JSAN.use('util.error'); g.error = new util.error();
+                               g.error.sdump('D_TRACE','my_init() for checkin.xul');
+
+                               g.cgi = new CGI();
+
+                               JSAN.use('circ.checkin'); g.checkin = new circ.checkin();
+                               g.checkin.init( 
+                                       { 
+                                               'session' : g.cgi.param('session') 
+                                       } 
+                               );
+       
+                       } catch(E) {
+                               var err_msg = "!! This software has encountered an error.  Please tell your friendly " +
+                                       "system administrator or software developer the following:\n" 
+                                       + 'circ.checkin.xul\n' + E + '\n';
+                               try { g.error.sdump('D_ERROR',err_msg); } catch(E) { dump(err_msg); }
+                               alert(err_msg);
+                       }
+               }
+
+       ]]>
+       </script>
+
+       <commandset id="checkin_cmds">
+               <command id="cmd_checkin_submit_barcode" />
+               <command id="cmd_checkin_print" />
+               <command id="cmd_checkin_reprint" />
+               <command id="cmd_checkin_done" />
+       </commandset>
+
+       <box id="checkin_main" />
+
+</window>
+
diff --git a/Open-ILS/xul/staff_client/server/circ/checkin_overlay.xul b/Open-ILS/xul/staff_client/server/circ/checkin_overlay.xul
new file mode 100644 (file)
index 0000000..0b6082f
--- /dev/null
@@ -0,0 +1,54 @@
+<?xml version="1.0"?>
+<!DOCTYPE overlay SYSTEM "chrome://evergreen/locale/lang.dtd">
+<overlay id="checkin_overlay" 
+       xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+
+<script>dump('loading checkin_overlay.xul\n');</script>
+
+<commandset id="checkin_cmds" />
+
+<box id="checkin_main" flex="1" orient="vertical" class="my_overflow">
+       <vbox id="cmvb1" flex="1"/>
+</box>
+
+<vbox id="cmvb1" flex="1">
+       <groupbox id="cmgb1" flex="2">
+               <caption label="&staff.circ.checkin.caption;" />
+               <hbox id="checkin_top_ui" />
+               <tree id="checkin_list" flex="1" enableColumnDrag="true"/>
+               <hbox id="checkin_bottom_ui" />
+       </groupbox>
+</vbox>
+
+<hbox id="checkin_top_ui">
+       <label id="checkin_scan_barcode_label" 
+               value="&staff.circ.checkin.scan_label;" 
+               accesskey="&staff.circ.checkin.scan_label.accesskey;" 
+               control="checkin_barcode_entry_textbox"/>
+       <textbox id="checkin_barcode_entry_textbox"/>
+       <button id="checkin_submit_barcode_button" 
+               label="&staff.circ.checkin.submit_label;" 
+               command="cmd_checkin_submit_barcode"
+               accesskey="&staff.circ.checkin.submit_label.accesskey;"/>
+</hbox>
+
+<hbox id="checkin_bottom_ui">
+       <button id="checkin_print" 
+               label="&staff.checkin.print_receipt_label;" 
+               command="cmd_checkin_print"
+               accesskey="&staff.checkin.print_receipt_label.accesskey;"/>
+       <button id="checkin_reprint" 
+               label="&staff.checkin.reprint_receipt_label;" 
+               command="cmd_checkin_reprint"
+               accesskey="&staff.checkin.reprint_receipt_label.accesskey;"/>
+       <spacer id="pcii3s" flex="1"/>
+       <checkbox id="checkin_auto" 
+               label="&staff.checkin.auto_print_label;" 
+               accesskey="&staff.checkin.auto_print_label.accesskey;"/> 
+       <button id="checkin_done" 
+               label="&staff.checkin.done_label;" 
+               command="cmd_checkin_done"
+               accesskey="&staff.checkin.done_label.accesskey;"/>
+</hbox>
+
+</overlay>