Lines 55-60
Link Here
|
55 |
[% END %] |
55 |
[% END %] |
56 |
[% Asset.js('js/Gettext.js') | $raw %] |
56 |
[% Asset.js('js/Gettext.js') | $raw %] |
57 |
[% Asset.js('js/i18n.js') | $raw %] |
57 |
[% Asset.js('js/i18n.js') | $raw %] |
|
|
58 |
[% Asset.js('js/timeout.js') | $raw %] |
58 |
</head> |
59 |
</head> |
59 |
<body id="sco_main" class="sco"> |
60 |
<body id="sco_main" class="sco"> |
60 |
<div id="wrapper"> |
61 |
<div id="wrapper"> |
Lines 328-334
Link Here
|
328 |
<input type="password" id="patronpw" class="form-control" size="20" name="patronpw" autocomplete="off" /> |
329 |
<input type="password" id="patronpw" class="form-control" size="20" name="patronpw" autocomplete="off" /> |
329 |
</div> |
330 |
</div> |
330 |
<div class="col-md-12"> |
331 |
<div class="col-md-12"> |
331 |
<button type="submit" class="btn btn-primary">Log in</button> |
332 |
<button id="sco_patron_login" type="submit" class="btn btn-primary">Log in</button> |
332 |
</div> |
333 |
</div> |
333 |
</div> |
334 |
</div> |
334 |
<!-- /.row --> |
335 |
<!-- /.row --> |
Lines 341-347
Link Here
|
341 |
<input type="text" id="patronid" class="form-control focus" size="20" name="patronid" autocomplete="off" /> |
342 |
<input type="text" id="patronid" class="form-control focus" size="20" name="patronid" autocomplete="off" /> |
342 |
</div> |
343 |
</div> |
343 |
<div class="col-md-12"> |
344 |
<div class="col-md-12"> |
344 |
<button type="submit" class="btn btn-primary">Submit</button> |
345 |
<button id="sco_patron_login" type="submit" class="btn btn-primary">Submit</button> |
345 |
</div> |
346 |
</div> |
346 |
</div> |
347 |
</div> |
347 |
<!-- /.row --> |
348 |
<!-- /.row --> |
Lines 401-411
Link Here
|
401 |
history.replaceState(null, document.title, window.location.href); |
402 |
history.replaceState(null, document.title, window.location.href); |
402 |
} |
403 |
} |
403 |
} |
404 |
} |
404 |
var mainTimeout; |
405 |
document.addEventListener("DOMContentLoaded",function(){ |
405 |
function sco_init() { |
406 |
if ( document.querySelector('#sco_patron_login,#logout_form') ){ |
406 |
mainTimeout = setTimeout(function() { |
407 |
login_timeout(); |
407 |
location.href = '/cgi-bin/koha/sco/sco-main.pl?op=logout'; |
408 |
} |
408 |
}, [% SelfCheckTimeout | html %]); |
409 |
}); |
|
|
410 |
function login_timeout(){ |
411 |
//NOTE: There can only be 1 sco_login_timer at a time |
412 |
if ( ! window.sco_login_timer ){ |
413 |
const idleTimeout = "[% Koha.Preference('SelfCheckTimeout') || 120 | html %]"; |
414 |
const home_href = "/cgi-bin/koha/sco/sco-main.pl?op=logout"; |
415 |
const sco_timer = new sc_timer({ |
416 |
"idle_timeout": idleTimeout, |
417 |
"redirect_url": home_href |
418 |
}); |
419 |
window.sco_login_timer = sco_timer; |
420 |
sco_timer.start_timer(); |
421 |
} |
409 |
} |
422 |
} |
410 |
function dofocus() { // named function req'd for body onload event by some FF and IE7 security models |
423 |
function dofocus() { // named function req'd for body onload event by some FF and IE7 security models |
411 |
// alert("dofocus called"); |
424 |
// alert("dofocus called"); |
Lines 458-464
Link Here
|
458 |
|
471 |
|
459 |
$(document).ready(function() { |
472 |
$(document).ready(function() { |
460 |
dofocus(); |
473 |
dofocus(); |
461 |
[% IF ( patronid ) %]sco_init();[% END %] |
|
|
462 |
|
474 |
|
463 |
var dTables = $("#loanTable, #holdst, #finestable"); |
475 |
var dTables = $("#loanTable, #holdst, #finestable"); |
464 |
dTables.each(function(){ |
476 |
dTables.each(function(){ |
Lines 490-507
Link Here
|
490 |
|
502 |
|
491 |
$("#logout_form").on("click", function(e){ |
503 |
$("#logout_form").on("click", function(e){ |
492 |
e.preventDefault(e); |
504 |
e.preventDefault(e); |
493 |
clearTimeout(mainTimeout); |
|
|
494 |
[% IF Koha.Preference('SelfCheckReceiptPrompt') %] |
505 |
[% IF Koha.Preference('SelfCheckReceiptPrompt') %] |
495 |
var confirmStart = Date.now(); |
506 |
var confirmStart = Date.now(); |
496 |
confirmModal("", _("Would you like to print a receipt?"), _("Print receipt and end session"), _("End session"), function(result) { |
507 |
confirmModal("", _("Would you like to print a receipt?"), _("Print receipt and end session"), _("End session"), function(result) { |
497 |
if ( result && (Date.now() - confirmStart) < [% SelfCheckTimeout | html %] ) { |
508 |
if ( result && (Date.now() - confirmStart) < [% Koha.Preference('SelfCheckTimeout') | html %] ) { |
498 |
var win = window.open("/cgi-bin/koha/sco/printslip.pl?print=qslip"); |
509 |
var win = window.open("/cgi-bin/koha/sco/printslip.pl?print=qslip"); |
499 |
location.href = '/cgi-bin/koha/sco/sco-main.pl?op=logout'; |
510 |
location.href = '/cgi-bin/koha/sco/sco-main.pl?op=logout'; |
500 |
} else { |
511 |
} else { |
501 |
location.href = '/cgi-bin/koha/sco/sco-main.pl?op=logout'; |
512 |
location.href = '/cgi-bin/koha/sco/sco-main.pl?op=logout'; |
502 |
} |
513 |
} |
503 |
}) |
514 |
}) |
504 |
sco_init(); |
|
|
505 |
[% ELSE %] |
515 |
[% ELSE %] |
506 |
location.href = '/cgi-bin/koha/sco/sco-main.pl?op=logout'; |
516 |
location.href = '/cgi-bin/koha/sco/sco-main.pl?op=logout'; |
507 |
[% END %] |
517 |
[% END %] |