Upped the default patron timeout to 10 minutes
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 31 Jul 2008 15:53:44 +0000 (15:53 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 31 Jul 2008 15:53:44 +0000 (15:53 +0000)
When an item barcode is scanned but the Enter key is not sent,
the system waits a configured amount of time (default 800 milliseconds)
then selects the text so the next scan will replace the existing text.

Automatically print at logout time

Replace Logout and Print links with "Done" links since printing is assumed

git-svn-id: svn://svn.open-ils.org/ILS/trunk@10219 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/web/opac/extras/selfcheck/selfcheck.css
Open-ILS/web/opac/extras/selfcheck/selfcheck.js
Open-ILS/web/opac/extras/selfcheck/selfcheck.xml
Open-ILS/web/opac/locale/en-US/opac.dtd

index b7aa882..3064574 100644 (file)
@@ -81,6 +81,15 @@ body { font-size: 12pt; }
     display: block;
     visibility: visible;
 }
+#selfck-items-out-done-div {
+    width: 100%;
+    text-align: center;
+    margin-top: 20px;
+}
 
+.selfck-done-link {
+    font-size: 12pt;
+    font-weight: bold;
+}
 
 
index 3ac63e0..61140b3 100644 (file)
@@ -24,11 +24,13 @@ var itemBarcode = null;
 var itemsOutTemplate = null;
 var isRenewal = false;
 var pendingXact = false;
-var patronTimeout = 120000;
+var patronTimeout = 600000; /* 10 minutes */
 var timerId = null;
 var printWrapper;
 var printTemplate;
 var successfulItems = {};
+var scanTimeout = 800;
+var scanTimeoutId;
 
 
 function selfckInit() {
@@ -54,10 +56,7 @@ function selfckInit() {
             selfckPatronLogin();
     };
 
-    $('selfck-item-barcode-input').onkeypress = function(evt) {
-        if(userPressedEnter(evt)) 
-            selfckCheckout();
-    };
+    $('selfck-item-barcode-input').onkeypress = selfckItemBarcodeKeypress;
 
     // for debugging, allow passing the user barcode via param
     var urlbc = new CGI().param('patron');
@@ -73,6 +72,28 @@ function selfckInit() {
 //    selfckMkDummyCirc(); // testing only
 }
 
+
+function selfckItemBarcodeKeypress(evt) {
+    if(userPressedEnter(evt)) {
+        clearTimeout(scanTimeoutId);
+        selfckCheckout();
+    } else {
+        /*  If scanTimeout milliseconds have passed and there is
+            still data in the input box, it's a likely indication
+            of a partial scan. Select the text so the next scan
+            will replace the value */
+        clearTimeout(scanTimeoutId);
+        scanTimeoutId = setTimeout(
+            function() {
+                if($('selfck-item-barcode-input').value) {
+                    $('selfck-item-barcode-input').select();
+                }
+            },
+            scanTimeout
+        );
+    }
+}
+
 /*
  * Start the logout timer
  */
@@ -100,8 +121,13 @@ function selfckResetTimer() {
 function selfckLogoutPatron() {
     $('selfck-item-barcode-input').value = ''; // prevent browser caching
     $('selfck-patron-login-input').value = '';
-    if(patron) // page reload resets everything
-        location.href = location.href;
+    if(patron) {
+        selfckPrint();
+        setTimeout(
+            function() { location.href = location.href; },
+            800
+        );
+    }
 }
 
 /*
@@ -210,7 +236,7 @@ function selfckShowMsgNode(evt) {
   * Renders a row in the checkouts table for the current circulation
   */
 function selfckDislplayCheckout(evt) {
-    unHideMe($('selfck-items-out-table'));
+    unHideMe($('selfck-items-out-table-wrapper'));
 
     var template = itemsOutTemplate.cloneNode(true);
     var copy = evt.payload.copy;
@@ -279,8 +305,11 @@ function selfckRenew() {
   * Sets the print date and prints the page
   */
 function selfckPrint() {
-    appendClear($('selfck-print-date'), text(new Date().toLocaleString()));
-    window.print();
+    for(var x in successfulItems) { // make sure we've checked out at least one item
+        appendClear($('selfck-print-date'), text(new Date().toLocaleString()));
+        window.print();
+        return;
+    }
 }
 
 
index b2a98dc..4337899 100644 (file)
                     </div>
                     <div id='selfck-logout-link-div'>
                         <span class='selfck-link-span'>
-                            <a href='javascript:void(0);' id='selfck-print-co-button' 
-                                onclick='selfckPrint();'>&selfck.print_checkouts;</a>
-                        </span>
-                        <span class='selfck-link-span'>
-                            <a href='javascript:void(0);' id='selfck-logout-button' 
-                                onclick='selfckLogoutPatron();'>&selfck.logout;</a>
-                        </span>
-                        <span class='selfck-link-span'>
-                            <a href='javascript:void(0);' id='selfck-logout-print-button' 
-                                onclick='selfckPrint(); selfckLogoutPatron();'>&selfck.print_logout;</a>
+                            <a href='javascript:void(0);' class='selfck-done-link' 
+                                onclick='selfckLogoutPatron();'>&selfck.done;</a>
                         </span>
                     </div>
                 </div>
                         <div id='selfck-item-barcode-form'>
                             <span><input type='text' id='selfck-item-barcode-input'> </input></span>
                             <span><button onclick='selfckCheckout();'>&selfck.submit;</button></span>
+                            <span><button onclick='$("selfck-item-barcode-input").value = "";'>&selfck.clear;</button></span>
                         </div>
                     </div>
                 </div>
                 <!--***********************************************************************
                     This is where patrons scan in the item barcodes
                     *********************************************************************** -->
-                <table id='selfck-items-out-table' class='hide_me'>
-                    <thead>
-                        <tr>
-                            <td id='selfck-pic-cell'></td>
-                            <td>&selfck.barcode;</td>
-                            <td>&selfck.title;</td>
-                            <td>&selfck.author;</td>
-                            <td>&selfck.due_date;</td>
-                            <td>&selfck.remaining;</td>
-                            <td>&selfck.cotype;</td>
-                        </tr>
-                    </thead>
-                    <tbody id='selfck-items-out-tbody'>
-                        <tr id='selfck-items-out-row'>
-                            <td><img class='jacket' name='selfck.jacket'></img></td>
-                            <td name='selfck.barcode'></td>
-                            <td name='selfck.title'></td>
-                            <td name='selfck.author'></td>
-                            <td name='selfck.due_date'></td>
-                            <td name='selfck.remaining'></td>
-                            <td>
-                                <span name='selfck.cotype_co'>&selfck.cotype_co;</span>
-                                <span name='selfck.cotype_rn' class='hide_me'>&selfck.cotype_rn;</span>
-                            </td>
-                        </tr>
-                    </tbody>
-                </table>
+                <div id='selfck-items-out-table-wrapper' class='hide_me'>
+                    <table id='selfck-items-out-table'>
+                        <thead>
+                            <tr>
+                                <td id='selfck-pic-cell'></td>
+                                <td>&selfck.barcode;</td>
+                                <td>&selfck.title;</td>
+                                <td>&selfck.author;</td>
+                                <td>&selfck.due_date;</td>
+                                <td>&selfck.remaining;</td>
+                                <td>&selfck.cotype;</td>
+                            </tr>
+                        </thead>
+                        <tbody id='selfck-items-out-tbody'>
+                            <tr id='selfck-items-out-row'>
+                                <td><img class='jacket' name='selfck.jacket'></img></td>
+                                <td name='selfck.barcode'></td>
+                                <td name='selfck.title'></td>
+                                <td name='selfck.author'></td>
+                                <td name='selfck.due_date'></td>
+                                <td name='selfck.remaining'></td>
+                                <td>
+                                    <span name='selfck.cotype_co'>&selfck.cotype_co;</span>
+                                    <span name='selfck.cotype_rn' class='hide_me'>&selfck.cotype_rn;</span>
+                                </td>
+                            </tr>
+                        </tbody>
+                    </table>
+                    <div id='selfck-items-out-done-div'>
+                        <a href='javascript:void(0);' id='selfck-print-co-button' 
+                            class='selfck-done-link' onclick='selfckLogoutPatron();'>&selfck.done;</a>
+                    </div>
+                </div>
             </div>
         </div>
 
index c493fbb..0ef11d9 100644 (file)
@@ -645,6 +645,7 @@ Ensure Caps-Lock is off and try again or contact your local library.">
 <!ENTITY selfck.staff_login "Library barcode or username">
 <!ENTITY selfck.staff_pw "Password">
 <!ENTITY selfck.submit "Submit">
+<!ENTITY selfck.clear "Clear">
 <!ENTITY selfck.patron_barcode_label "Please scan your library barcode">
 <!ENTITY selfck.item_barcode_label "Please scan an item to checkout or renew:">
 <!ENTITY selfck.barcode "Barcode">
@@ -655,8 +656,7 @@ Ensure Caps-Lock is off and try again or contact your local library.">
 <!ENTITY selfck.cotype "Type">
 <!ENTITY selfck.cotype_co "Checkout">
 <!ENTITY selfck.cotype_rn "Renewal">
-<!ENTITY selfck.logout "Logout">
-<!ENTITY selfck.print_logout "Print &amp; Logout">
+<!ENTITY selfck.done "Done">
 <!ENTITY selfck.welcome "Welcome">
 
 <!-- event messages -->
@@ -666,5 +666,4 @@ Ensure Caps-Lock is off and try again or contact your local library.">
 <!ENTITY selfck.event.patron_not_found "The patron barcode was not found">
 <!ENTITY selfck.event.item_noncat "The requested item is not in the catalog">
 <!ENTITY selfck.event.item_nocirc "The requested item is not allowed to circulate">
-<!ENTITY selfck.print_checkouts "Print Receipt">