Koha/koha-tmpl/opac-tmpl/bootstrap/en/modules/sci/sci-main.tt
Owen Leonard 12074faff9
Bug 22880: (follow-up) Loose ends: Better DB update, global inclusion, etc.
This patch makes a number of improvements and ties up some loose ends
where the old system preference usage wasn't getting replaced.

 - Removes news-specific code for defining the language of news
   items queried for the OPAC home page. An identical language variable
   is already defined globally.

   Previous to this patch an 'opacheader' news item would only appear on
   the OPAC home page. Now it should appear on all OPAC pages.

 - Changes the database update so that 'opacheader' news
   items will be inserted with a default title, matching the interface's
   requirement that the title field be populated.

 - The database update will also now insert the old opacheader system
   preference contents into the news item for all active languages as
   defined in the 'opaclanguages' system preference. This helps match
   the previous behavior in which the opacheader contents were the same
   for all languages.

 - Adds support for the new opacheader news item to the self checkout,
   self check-in, and OPAC maintenance pages.

 - Updates sysprefs.t which was using the opacheader preference to test
   on. I've changed it to use URLLinkText instead.

 - Removes the addition of the opacheader system preference from the
   installation SQL file.

Signed-off-by: Lisette Scheer <lisettes@latahlibrary.org>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-02-24 13:24:25 +00:00

275 lines
13 KiB
Text
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

[% USE raw %]
[% USE Asset %]
[%# Includes %]
[% USE Koha %]
[% USE KohaDates %]
[% USE KohaNews %]
[%# Helper template functions %]
[% BLOCK error_message %]
[% IF messages.BadBarcode %]
<span>(Barcode not found on the database, please see library staff for assistance)</span>
[% ELSIF messages.Wrongbranch %]
<span>(The item cannot be returned at this library, please see library staff for assistance)</span>
[% ELSIF messages.withdrawn %]
<span>(Item is withdrawn and check-in blocked by policy, please see library staff for assistance)</span>
[% ELSIF messages.NotIssued %]
<span>(The book is not currently on loan, please see library staff for assistance)</span>
[% ELSE %]
<span>(There was a problem returning this item, please see library staff for assistance)</span>
[% END %]
[% END %]
[% PROCESS 'html_helpers.inc' %]
[% SET OpacHeader = KohaNews.get( location => "opacheader", lang => lang, library => branchcode, blocktitle => 0 ) %]
[% INCLUDE 'doc-head-open.inc' %]
<title>[% IF ( LibraryNameTitle ) %][% LibraryNameTitle | html %][% ELSE %]Koha [% END %] &rsaquo; Self check-in</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Koha [% Version | html %]" /> <!-- leave this for stats -->
[% IF ( Koha.Preference('OpacFavicon') ) %]
<link rel="shortcut icon" href="[% Koha.Preference('OpacFavicon') | url %]" type="image/x-icon" />
[% ELSE %]
<link rel="shortcut icon" href="[% interface | html %]/[% theme | html %]/images/favicon.ico" type="image/x-icon" />
[% END %]
[% Asset.css("lib/bootstrap/css/bootstrap.min.css") | $raw %]
[% Asset.css("lib/jquery/jquery-ui-1.12.1.css") | $raw %]
[% Asset.css("lib/font-awesome/css/font-awesome.min.css") | $raw %]
[% Asset.css("css/sco.css") | $raw %]
[% IF ( Koha.Preference('OPACUserCSS') ) %]<style>[% Koha.Preference('OPACUserCSS') | $raw %]</style>[% END %]
[% IF ( Koha.Preference('SelfCheckInUserCSS') ) %]<style>[% Koha.Preference('SelfCheckInUserCSS') | $raw %]</style>[% END %]
<!--[if lt IE 9]>
<script src="[% interface | html %]/[% theme | html %]/lib/respond.min.js"></script>
<![endif]-->
<script>
function _(s) { return s } // dummy function for gettext
</script>
[% Asset.js("lib/modernizr.min.js") | $raw %]
</head>
<body id="sci_main" class="sci" onload="dofocus();" onunload="mungeHistory();">
[% SET OpacLangSelectorMode = Koha.Preference('OpacLangSelectorMode') %]
<div id="wrap">
<div class="navbar navbar-inverse navbar-static-top">
<div class="navbar-inner">
<div class="container-fluid">
<a class="brand" href="/cgi-bin/koha/sci/sci-main.pl"><img src="[% interface | html %]/[% theme | html %]/images/koha-green-logo.png" alt=""></a>
<div id="checkouthelp">
<ul class="nav pull-right">
<li><a href="/cgi-bin/koha/sci/sci-main.pl" class="helpModal-trigger" role="button" data-toggle="modal"><i class="fa fa-info-circle"></i> Help</a></li>
<li><a id="sci_logout" href="/cgi-bin/koha/sci/sci-main.pl?logout.x=1" class="logout">Log out</a></li>
</ul>
</div>
[% IF Koha.Preference( 'opaclanguagesdisplay' ) %]
<div id="members">
<ul class="nav pull-right">
[% INCLUDE 'masthead-langmenu.inc' %]
</ul>
</div>
[% END %]
</div> <!-- /.container-fluid -->
</div> <!-- /.navbar-inner -->
</div> <!-- /.navbar -->
[% IF ( OpacHeader ) %]
<div class="container-fluid">
<div class="row-fluid">
<div id="opacheader">
[% PROCESS koha_news_block news => OpacHeader %]
</div>
</div>
</div>
[% END %]
<div class="main">
<div class="container-fluid">
<div class="row-fluid">
<div id="masthead">
<h1>[% LibraryName | html %] Self check-in</h1>
[% IF ( nopermission ) %]
[%# This is what is displayed if user doesn't have permission %]
<div class="alert">
<h3>Access denied</h3>
<p>Sorry, this self check-in station has lost authentication. Please contact the administrator to resolve this problem.</p>
</div>
[% ELSIF ( different_ip ) %]
[%# This is what is displayed if user doesn't have permission %]
<div class="alert">
<h3>Session lost</h3>
<p>You are accessing self check-in from a different IP address! Please log in again.</p>
</div>
[% ELSIF ( checkins ) %]
[%# We have results from a check-in attempt %]
<div id="checkins" class="sci_results_list">
[% IF ( success && success.size > 0 || errors && errors.size > 0 ) %]
<h3>Results</h3>
<table id="sci_bcheckins_table" class="table table-bordered table-striped dataTable no-footer" style="font-size: initial;">
<thead>
<th>Barcode</th>
<th>Status</th>
</thead>
<tbody>
[% FOREACH success_line IN success %]
<tr><td>[% success_line.barcode | html %]</td><td>Checked in</td></tr>
[% END %]
[% FOREACH error IN errors %]
<tr>
<td>[% error.barcode | html %]</td>
<td>Not checked in [% PROCESS error_message messages=error.messages %]</td>
</tr>
[% END %]
</tbody>
</table>
<div>
<form method="post" action="#" id="finish_form">
<button id="sci_finish_button" type="submit" class="btn"><i class="fa fa-check"></i> Finish</button>
</form>
</div>
[% ELSE %]
<div class="alert">
<p>Your request included no check-ins.</p>
</div>
[% END %]
</div>
[% ELSE %]
[%# Prompt for barcodes %]
<div id="new_checkins" class="sci_entry">
<form id="scan_form" name="scan_form"
method="post" action="/cgi-bin/koha/sci/sci-main.pl">
<fieldset>
<div>
<label for="barcode_input">Scan the item or enter its barcode:</label>
<input id="barcode_input" name="barcode_input" size="20" type="text" class="focus" autocomplete="off" />
<button id="sci_append_button" type="submit" class="btn btn-default btn-sm">
<i class="fa fa-plus" aria-hidden="true"></i> <span>Add</span>
</button>
</div>
<div class="sci_input_append">
<table id="sci_barcodes_table" class="table table-bordered table-striped dataTable no-footer" style="display: none; font-size: initial;">
<thead>
<th class="barcodes_column">Barcode</th>
</thead>
<tbody>
</tbody>
</table>
</div>
<input type="hidden" name="op" value="check_in" />
<div id="button_bar">
<button id="sci_checkin_button" type="submit" class="btn btn-default btn-sm" style="display: none;">
<i class="fa fa-check-square-o" aria-hidden="true"></i> <span>Check in</span>
</button>
<a href="/cgi-bin/koha/sci/sci-main.pl" class="btn btn-default btn-sm" role="button" style="display: none;" id="sci_refresh_button">
<i class="fa fa-refresh" aria-hidden="true"></i> <span>Cancel</span>
</a>
</div>
</fieldset>
</form>
</div> <!-- / #new_checkins -->
[% END %]
</div> <!-- / #masthead -->
</div> <!-- / .row-fluid -->
</div> <!-- / .container-fluid -->
[% IF ( Koha.Preference('SelfCheckInMainUserBlock') ) %]
<div id="SelfCheckInMainUserBlock">[% Koha.Preference('SelfCheckInMainUserBlock' ) | $raw %]</div>
[% END %]
</div> <!-- / .main -->
<div id="helpModal" class="modal hide" tabindex="-1" role="dialog" aria-labelledby="helpModalLabel" aria-hidden="true">
<div class="modal-header">
<button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
<h3 id="helpModalLabel">Self check-in help</h3>
</div>
<div class="modal-body">
<ul>
<li>Scan each item or enter its barcode. A list with the entered barcodes will be displayed.</li>
<li>Click the 'Check in' button to confirm.</li>
<li>The operation results will be displayed for each entered barcode.</li>
<li>The 'Finish' button is presented to start over.</li>
<li>At any step, clicking the 'Cancel' button will erase the scanned barcodes and start over.</li>
</ul>
</div>
</div> <!-- /#helpModal -->
</body>
[% INCLUDE 'opac-bottom.inc' %]
[% BLOCK jsinclude %]
<script>
function mungeHistory() {
// prevent back button from allowing form resubmission
if (history && history.pushState) {
history.replaceState(null, document.title, window.location.href);
}
}
function dofocus() {
$(".focus:last").select();
}
var barcodes = [];
$(document).ready(function() {
// Barcodes scanning table initially hidden
$("#sci_barcodes_table").hide();
// Control de 'append' button behaviour
$("#sci_append_button").on('click',function( e ){
// Make sure the form is not submitted by the button
e.preventDefault();
var barcode = $('#barcode_input').val();
//var result = validate_barcode( barcode );
$('#sci_barcodes_table tbody').append(
'<tr style="font-size: initial;"><td>' +
barcode +
'<input type="hidden" name="barcode" value="' + barcode + '" />' +
'</td></tr>' );
// Make sure the table is now displayed
$("#sci_barcodes_table").show();
$('#sci_checkin_button').show();
$('#sci_refresh_button').show();
barcodes.push(barcode);
// clean the input, reset the focus
$('#barcode_input').val('');
dofocus();
});
$(".helpModal-trigger").on("click",function(e){
e.preventDefault();
$("#helpModal").modal("show");
});
// set focus at the beginning
dofocus();
});
var idleTime = 0;
$(document).ready(function () {
//Increment the idle time counter every second
var idleInterval = setInterval(timerIncrement, 1000);
//Zero the idle timer on mouse movement.
$(this).mousemove(function (e) {
idleTime = 0;
});
$(this).keypress(function (e) {
idleTime = 0;
});
});
function timerIncrement() {
if ( $("#sci_finish_button").is(":visible") || $("#sci_refresh_button").is(":visible") ) {
idleTime = idleTime + 1;
idleTimeout = [% refresh_timeout | html %];
if (idleTime >= idleTimeout ) {
location.href = '/cgi-bin/koha/sci/sci-main.pl';
}
}
}
</script>
[% IF ( Koha.Preference('SelfCheckInUserJS') ) %]<script>[% Koha.Preference('SelfCheckInUserJS') | $raw %]</script>[% END %]
[% END %]