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() {
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');
// 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
*/
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
+ );
+ }
}
/*
* 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;
* 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;
+ }
}
</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>
<!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">
<!ENTITY selfck.cotype "Type">
<!ENTITY selfck.cotype_co "Checkout">
<!ENTITY selfck.cotype_rn "Renewal">
-<!ENTITY selfck.logout "Logout">
-<!ENTITY selfck.print_logout "Print & Logout">
+<!ENTITY selfck.done "Done">
<!ENTITY selfck.welcome "Welcome">
<!-- event messages -->
<!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">