<script type="text/javascript" src="[% ctx.media_prefix %]/js/ui/default/circ/selfcheck/payment.js"></script>
<link rel='stylesheet' type='text/css' href='[% ctx.media_prefix %]/css/skin/[% ctx.skin %]/selfcheck.css'/>
[% INCLUDE 'circ/selfcheck/audio_config.tt2' %]
+[% INCLUDE 'circ/selfcheck/logout_dialog.tt2' %]
<div id='oils-selfck-top-div'>
[% INCLUDE 'circ/selfcheck/banner.tt2' %]
</table>
</form>
</div>
+<div dojoType="dijit.Dialog" jsId='oilsSelfckWsDialog' class='oils-logout-dialog' style='display:none;'>
+ <form>
+ <table>
+ <tr>
+ <td>[% l('Choose a location') %]</td>
+ <td><div dojoType='openils.widget.OrgUnitFilteringSelect' jsId='oilsSelfckWsLocSelector'
+ searchAttr='shortname' labelAttr='shortname'></div></td>
+ </tr>
+ <tr>
+ <td>[% l('Enter a workstation name') %]</td>
+ <td><input dojoType='dijit.form.TextBox' jsId='oilsSelfckWsName'/></td>
+ </tr>
+ <tr>
+ <td colspan='2' align='center'>
+ <button jsId='oilsSelfckWsSubmit' dojoType='dijit.form.Button'>[% l('Submit') %]</button>
+ </td>
+ </tr>
+ </table>
+ </form>
+</div>
+
[% END %]
var localeStrings = dojo.i18n.getLocalization('openils.circ', 'selfcheck');
// set patron timeout default
-var patronTimeout = 180000; /* 3 minutes */
+var patronTimeout = 160000; /* 2 minutes, 40 seconds */
var timerId = null;
+// 20 second inactivity warning; total default timeout is 3 minutes.
+var patronTimeoutWarning = 20000;
+var selfckWarningSetup = false;
+var selfckWarningTimer;
const SET_BARCODE_REGEX = 'opac.barcode_regex';
const SET_PATRON_TIMEOUT = 'circ.selfcheck.patron_login_timeout';
function selfckStartTimer() {
timerId = setTimeout(
function() {
- SelfCheckManager.prototype.logoutPatron();
+ selfckLogoutWarning();
},
patronTimeout
);
selfckStartTimer();
}
+function selfckLogoutWarning() {
+
+ // connect the logout warning dialog button handlers if needed
+ if (!selfckWarningSetup) {
+ selfckWarningSetup = true;
+
+ dojo.connect(oilsSelfckLogout, 'onClick',
+ function() {
+ clearTimeout(selfckWarningTimer);
+ oilsSelfckLogoutDialog.hide();
+ SelfCheckManager.prototype.logoutPatron();
+ }
+ );
+
+ dojo.connect(oilsSelfckContinue, 'onClick',
+ function() {
+ clearTimeout(selfckWarningTimer);
+ oilsSelfckLogoutDialog.hide();
+ selfckResetTimer();
+ }
+ );
+ }
+
+ // warn the patron of imminent logout
+ oilsSelfckLogoutDialog.show();
+ selfckWarningTimer = setTimeout(
+ function() {
+ // no action was taken, force a logout.
+ oilsSelfckLogoutDialog.hide();
+ SelfCheckManager.prototype.logoutPatron();
+ },
+ patronTimeoutWarning
+ );
+}
+
function SelfCheckManager() {
this.cgi = new openils.CGI();
if(settings[SET_BARCODE_REGEX])
this.patronBarcodeRegex = new RegExp(settings[SET_BARCODE_REGEX].value);
- if(settings[SET_PATRON_TIMEOUT])
- patronTimeout = parseInt(settings[SET_PATRON_TIMEOUT].value) * 1000;
+ // Subtract the timeout warning interval from the configured timeout
+ // so that when taken together they add up to the configured amount.
+ if(settings[SET_PATRON_TIMEOUT]) {
+ patronTimeout =
+ (parseInt(settings[SET_PATRON_TIMEOUT].value) * 1000)
+ - patronTimeoutWarning;
+ }
}
SelfCheckManager.prototype.drawLoginPage = function() {
*/
SelfCheckManager.prototype.checkout = function(barcode, override) {
+ // reset timeout
+ selfckResetTimer();
+
this.prevCirc = null;
if(!barcode) {