in-house use
authorphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 8 Feb 2006 20:10:21 +0000 (20:10 +0000)
committerphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 8 Feb 2006 20:10:21 +0000 (20:10 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@3008 dcc99617-32d9-48b4-a31d-7c20da2025e4

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

diff --git a/Open-ILS/xul/staff_client/server/circ/in_house_use.js b/Open-ILS/xul/staff_client/server/circ/in_house_use.js
new file mode 100644 (file)
index 0000000..81f3777
--- /dev/null
@@ -0,0 +1,176 @@
+dump('entering circ.in_house_use.js\n');
+
+if (typeof circ == 'undefined') circ = {};
+circ.in_house_use = function (params) {
+
+       JSAN.use('util.error'); this.error = new util.error();
+       JSAN.use('util.network'); this.network = new util.network();
+       JSAN.use('util.date');
+       JSAN.use('OpenILS.data'); this.data = new OpenILS.data(); this.data.init({'via':'stash'});
+}
+
+circ.in_house_use.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 },
+                               'location' : { 'hidden' : false },
+                               'call_number' : { 'hidden' : false },
+                               'checkin_text' : { 'hidden' : false, 'flex' : 3 }
+                       } 
+               );
+
+               JSAN.use('util.list'); obj.list = new util.list('in_house_use_list');
+               obj.list.init(
+                       {
+                               'columns' : columns,
+                               'map_row_to_column' : circ.util.std_map_row_to_column(),
+                       }
+               );
+               
+               JSAN.use('util.controller'); obj.controller = new util.controller();
+               obj.controller.init(
+                       {
+                               'control_map' : {
+                                       'in_house_use_barcode_entry_textbox' : [
+                                               ['keypress'],
+                                               function(ev) {
+                                                       if (ev.keyCode && ev.keyCode == 13) {
+                                                               obj.in_house_use();
+                                                       }
+                                               }
+                                       ],
+                                       'in_house_use_multiplier_label' : [
+                                               ['render'],
+                                               function(e) {
+                                                       return function() {
+                                                               obj.controller.view.in_house_use_multiplier_textbox.select();
+                                                               obj.controller.view.in_house_use_multiplier_textbox.value = 1;
+                                                       };
+                                               }
+                                       ],
+                                       'in_house_use_multiplier_textbox' : [
+                                               ['change'],
+                                               function(ev) {
+                                                       if (ev.target.nodeName == 'textbox') {
+                                                               try {
+                                                                       if (ev.target.value > 0) {
+                                                                               /* good value */
+                                                                       } else {
+                                                                               ev.target.value = 1;
+                                                                       }
+                                                               } catch(E) {
+                                                                       dump('in_house_use:multiplier: ' + E + '\n');
+                                                                       ev.target.value = 1;
+                                                               }
+                                                       }
+                                               }
+                                       ],
+                                       'cmd_broken' : [
+                                               ['command'],
+                                               function() { alert('Not Yet Implemented'); }
+                                       ],
+                                       'cmd_in_house_use_submit_barcode' : [
+                                               ['command'],
+                                               function() {
+                                                       obj.in_house_use();
+                                               }
+                                       ],
+                                       'cmd_in_house_use_print' : [
+                                               ['command'],
+                                               function() {
+                                               }
+                                       ],
+                                       'cmd_in_house_use_reprint' : [
+                                               ['command'],
+                                               function() {
+                                               }
+                                       ],
+                                       'cmd_in_house_use_done' : [
+                                               ['command'],
+                                               function() {
+                                               }
+                                       ],
+                               }
+                       }
+               );
+               this.controller.render();
+               this.controller.view.in_house_use_barcode_entry_textbox.focus();
+
+       },
+
+       'in_house_use' : function() {
+               var obj = this;
+               try {
+                       var barcode = obj.controller.view.in_house_use_barcode_entry_textbox.value;
+                       var multiplier = obj.controller.view.in_house_use_multiplier_textbox.value;
+                       JSAN.use('circ.util');
+
+                       var copy = obj.network.simple_request('FM_ACP_RETRIEVE_VIA_BARCODE',[ barcode ]); 
+                       var mods = obj.network.simple_request('MODS_SLIM_RECORD_RETRIEVE_VIA_COPY',[ copy.id() ]);
+                       /* FIXME -- Use workstation ou */
+                       var result = obj.network.simple_request('FM_AIHU_CREATE',
+                               [ obj.session, { 'copyid' : copy.id(), 'location' : obj.data.list.au[0].home_ou(), 'count' : multiplier } ]
+                       );
+
+                       obj.list.append(
+                               {
+                                       'row' : {
+                                               'my' : {
+                                                       'mvr' : mods,
+                                                       'acp' : copy,
+                                                       'text' : result.length + ' uses',
+                                               }
+                                       }
+                               //I could override map_row_to_column here
+                               }
+                       );
+                       if (typeof obj.on_in_house_use == 'function') {
+                               obj.on_in_house_use(result);
+                       }
+                       if (typeof window.xulG == 'object' && typeof window.xulG.on_in_house_use == 'function') {
+                               obj.error.sdump('D_CIRC','circ.in_house_use: Calling external .on_in_house_use()\n');
+                               window.xulG.on_in_house_use(result);
+                       } else {
+                               obj.error.sdump('D_CIRC','circ.in_house_use: No external .on_in_house_use()\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.in_house_use: Calling external .on_failure()\n');
+                               window.xulG.on_failure(E);
+                       } else {
+                               obj.error.sdump('D_CIRC','circ.in_house_use: No external .on_failure()\n');
+                       }
+               }
+
+       },
+
+       'on_in_house_use' : function() {
+               this.controller.view.in_house_use_multiplier_textbox.select();
+               this.controller.view.in_house_use_multiplier_textbox.value = '1';
+               this.controller.view.in_house_use_barcode_entry_textbox.value = '';
+               this.controller.view.in_house_use_barcode_entry_textbox.focus();
+       },
+
+       'on_failure' : function() {
+               this.controller.view.in_house_use_barcode_entry_textbox.select();
+               this.controller.view.in_house_use_barcode_entry_textbox.focus();
+       }
+}
+
+dump('exiting circ.in_house_use.js\n');
diff --git a/Open-ILS/xul/staff_client/server/circ/in_house_use.xul b/Open-ILS/xul/staff_client/server/circ/in_house_use.xul
new file mode 100644 (file)
index 0000000..fa9ce64
--- /dev/null
@@ -0,0 +1,118 @@
+<?xml version="1.0"?>
+<!-- Application: Evergreen Staff Client -->
+<!-- Screen: Patron Display -->
+
+<!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
+<!-- STYLESHEETS -->
+<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
+<?xml-stylesheet href="chrome://open_ils_staff_client/skin/global.css" type="text/css"?>
+<?xml-stylesheet href="/xul/server/skin/global.css" type="text/css"?>
+<?xml-stylesheet href="/xul/server/skin/circ.css" type="text/css"?>
+
+<!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
+<!-- LOCALIZATION -->
+<!DOCTYPE window SYSTEM "chrome://open_ils_staff_client/locale/lang.dtd">
+
+<!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
+<!-- OVERLAYS -->
+<?xul-overlay href="/xul/server/OpenILS/util_overlay.xul"?>
+
+<window id="in_house_use_win" 
+       onload="my_init()"
+       xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+
+       <!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
+       <!-- BEHAVIOR -->
+        <script type="text/javascript">var myPackageDir = 'open_ils_staff_client'; 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 in_house_use.xul');
+
+                               g.cgi = new CGI();
+
+                               JSAN.use('circ.in_house_use'); g.in_house_use = new circ.in_house_use();
+                               g.in_house_use.init( 
+                                       { 
+                                               'session' : g.cgi.param('session') 
+                                       } 
+                               );
+       
+                               if (typeof window.xulG == 'object' && typeof window.xulG.set_tab_name == 'function') {
+                                       try { window.xulG.set_tab_name('In-House Use'); } catch(E) { alert(E); }
+                               }
+
+                       } catch(E) {
+                               var err_msg = "!! This software has encountered an error.  Please tell your friendly " +
+                                       "system administrator or software developer the following:\n" 
+                                       + 'circ.in_house_use.xul\n' + E + '\n';
+                               try { g.error.sdump('D_ERROR',err_msg); } catch(E) { dump(err_msg); }
+                               alert(err_msg);
+                       }
+               }
+
+       ]]>
+       </script>
+
+       <commandset id="in_house_use_cmds">
+               <command id="cmd_in_house_use_submit_barcode" />
+               <command id="cmd_in_house_use_print" />
+               <command id="cmd_in_house_use_reprint" />
+               <command id="cmd_in_house_use_done" />
+       </commandset>
+
+<box id="in_house_use_main" flex="1" orient="vertical" class="my_overflow">
+<vbox id="cmvb1" flex="1">
+<groupbox id="cmgb1" flex="2">
+
+       <caption label="In-House Use" />
+
+       <hbox id="in_house_use_top_ui">
+               <label id="in_house_use_scan_barcode_label" 
+                       value="Enter Barcode:" 
+                       accesskey="a"
+                       control="in_house_use_barcode_entry_textbox"/>
+               <textbox id="in_house_use_barcode_entry_textbox"/>
+               <button id="in_house_use_submit_barcode_button" 
+                       label="Submit"
+                       command="cmd_in_house_use_submit_barcode"
+                       accesskey="S"/>
+               <spacer flex="1"/>
+               <label id="in_house_use_multiplier_label" value="Multiplier:" control="in_house_use_multiplier_textbox" accesskey="M"/>
+               <textbox id="in_house_use_multiplier_textbox" value="1"/>
+       </hbox>
+
+
+       <tree id="in_house_use_list" flex="1" enableColumnDrag="true"/>
+
+       <hbox id="in_house_use_bottom_ui">
+               <button id="in_house_use_print" 
+                       label="Print List" 
+                       command="cmd_in_house_use_print"
+                       accesskey=""/>
+               <button id="in_house_use_reprint" 
+                       label="Re-Print Last List" 
+                       command="cmd_in_house_use_reprint"
+                       accesskey="L"/>
+               <spacer id="pcii3s" flex="1"/>
+               <checkbox id="in_house_use_auto" 
+                       label="Auto-Print" 
+                       accesskey_disabled="A"/> 
+       </hbox>
+
+</groupbox>
+</vbox>
+</box>
+
+</overlay>
+</window>
+