Bug 20053: Drop type attribute "text/javascript" in OPAC templates
[koha.git] / koha-tmpl / opac-tmpl / bootstrap / en / modules / sci / sci-main.tt
1 [% USE Asset %]
2 [%# Includes %]
3 [% USE Koha %]
4 [% USE KohaDates %]
5 [%# Helper template functions %]
6 [% BLOCK error_message %]
7     [% IF messages.BadBarcode %]
8         <span>(Barcode not found on the database, please see library staff for assistance)</span>
9     [% ELSIF messages.Wrongbranch %]
10         <span>(The item cannot be returned at this library, please see library staff for assistance)</span>
11     [% ELSIF messages.withdrawn %]
12         <span>(Item is withdrawn and check-in blocked by policy, please see library staff for assistance)</span>
13     [% ELSIF messages.NotIssued %]
14         <span>(The book is not currently on loan, please see library staff for assistance)</span>
15     [% ELSE %]
16         <span>(There was a problem returning this item, please see library staff for assistance)</span>
17     [% END %]
18 [% END %]
19
20 [% INCLUDE 'doc-head-open.inc' %]
21
22 <title>[% IF ( LibraryNameTitle ) %][% LibraryNameTitle %][% ELSE %]Koha [% END %] &rsaquo; Self check-in</title>
23
24 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
25 <meta name="generator" content="Koha [% Version %]" /> <!-- leave this for stats -->
26
27 [% IF ( Koha.Preference('OpacFavicon') ) %]
28 <link rel="shortcut icon" href="[% Koha.Preference('OpacFavicon') %]" type="image/x-icon" />
29 [% ELSE %]
30 <link rel="shortcut icon" href="[% interface %]/[% theme %]/images/favicon.ico" type="image/x-icon" />
31 [% END %]
32 [% Asset.css("lib/bootstrap/css/bootstrap.min.css") %]
33 [% Asset.css("lib/jquery/jquery-ui.css") %]
34 [% Asset.css("lib/font-awesome/css/font-awesome.min.css") %]
35 [% Asset.css("css/sci.css") %]
36 [% IF ( Koha.Preference('OPACUserCSS') ) %]<style type="text/css">[% Koha.Preference('OPACUserCSS') %]</style>[% END %]
37 [% IF ( Koha.Preference('SelfCheckInUserCSS') ) %]<style type="text/css">[% Koha.Preference('SelfCheckInUserCSS') %]</style>[% END %]
38 <!--[if lt IE 9]>
39     <script src="[% interface %]/[% theme %]/lib/respond.min.js"></script>
40 <![endif]-->
41 <script>
42     function _(s) { return s } // dummy function for gettext
43 </script>
44 [% Asset.js("lib/modernizr.min.js") %]
45 </head>
46 <body id="sci_main" class="sci" onload="dofocus();" onunload="mungeHistory();">
47
48 [% SET OpacLangSelectorMode = Koha.Preference('OpacLangSelectorMode') %]
49 <div id="wrap">
50     <div class="navbar navbar-inverse navbar-static-top">
51         <div class="navbar-inner">
52             <div class="container-fluid">
53                 <a class="brand" href="/cgi-bin/koha/sci/sci-main.pl"><img src="[% interface %]/[% theme %]/images/koha-logo-navbar.png" alt=""></a>
54                 <div id="checkouthelp">
55                     <ul class="nav pull-right">
56                         <li><a href="/cgi-bin/koha/sci/sci-main.pl" class="helpModal-trigger" role="button" data-toggle="modal"><i class="icon help"></i> Help</a></li>
57                         <li><a id="sci_logout" href="/cgi-bin/koha/sci/sci-main.pl?logout.x=1" class="logout">Logout</a></li>
58                     </ul>
59                 </div>
60
61                 [% IF Koha.Preference( 'opaclanguagesdisplay' ) %]
62                     <div id="members">
63                         <ul class="nav pull-right">
64                             [% INCLUDE 'masthead-langmenu.inc' %]
65                         </ul>
66                     </div>
67                 [% END %]
68
69             </div> <!-- /.container-fluid -->
70         </div> <!-- /.navbar-inner -->
71     </div> <!-- /.navbar -->
72
73 [% IF Koha.Preference( 'opacheader' ) %]
74     <div class="container-fluid">
75         <div class="row-fluid">
76             <div id="opacheader">
77                 [% Koha.Preference( 'opacheader' ) %]
78             </div>
79         </div>
80     </div>
81 [% END %]
82
83     <div class="main">
84         <div class="container-fluid">
85             <div class="row-fluid">
86                 <div id="masthead">
87                     <h1>[% LibraryName %] Self check-in</h1>
88                 [% IF ( nopermission ) %]
89                     [%# This is what is displayed if user doesn't have permission %]
90                     <div class="alert">
91                         <h3>Access denied</h3>
92                         <p>Sorry, this self check-in station has lost authentication. Please contact the administrator to resolve this problem.</p>
93                     </div>
94                 [% ELSIF ( different_ip ) %]
95                     [%# This is what is displayed if user doesn't have permission %]
96                     <div class="alert">
97                         <h3>Session lost</h3>
98                         <p>You are accessing self check-in from a different IP address! Please log in again.</p>
99                     </div>
100                 [% ELSIF ( checkins ) %]
101                     [%# We have results from a check-in attempt %]
102                     <div id="checkins" class="sci_results_list">
103                         [% IF ( success && success.size > 0 || errors && errors.size > 0 ) %]
104                             <h3>Results</h3>
105                                 <table id="sci_bcheckins_table" class="table table-bordered table-striped dataTable no-footer" style="font-size: initial;">
106                                   <thead>
107                                     <th>Barcode</th>
108                                     <th>Status</th>
109                                   </thead>
110                                   <tbody>
111                                 [% FOREACH success_line IN success %]
112                                     <tr><td>[% success_line.barcode %]</td><td>Checked in</td></tr>
113                                 [% END %]
114                                 [% FOREACH error IN errors %]
115                                     <tr>
116                                       <td>[% error.barcode %]</td>
117                                       <td>Not checked in [% PROCESS error_message messages=error.messages %]</td>
118                                     </tr>
119                                 [% END %]
120                                   </tbody>
121                                 </table>
122                                 <div>
123                                     <form method="post" action="#" id="finish_form">
124                                         <button id="sci_finish_button" type="submit" class="btn"><i class="icon finish"></i> Finish</button>
125                                     </form>
126                                 </div>
127                         [% ELSE %]
128                             <div class="alert">
129                                 <p>Your request included no check-ins.</p>
130                             </div>
131                         [% END %]
132                     </div>
133                 [% ELSE %]
134                     [%# Prompt for barcodes %]
135                     <div id="new_checkins" class="sci_entry">
136                         <form id="scan_form" name="scan_form"
137                               method="post" action="/cgi-bin/koha/sci/sci-main.pl">
138                             <fieldset>
139                                 <div>
140                                   <label for="barcode_input">Scan the item or enter its barcode:</label>
141                                   <input id="barcode_input" name="barcode_input" size="20" type="text" class="focus" autocomplete="off" />
142                                   <button id="sci_append_button" type="submit" class="btn btn-default btn-sm">
143                                     <i class="fa fa-plus" aria-hidden="true"></i> <span>Add</span>
144                                   </button>
145                                 </div>
146                                 <div class="sci_input_append">
147                                     <table id="sci_barcodes_table" class="table table-bordered table-striped dataTable no-footer" style="display: none; font-size: initial;">
148                                       <thead>
149                                         <th class="barcodes_column">Barcode</th>
150                                       </thead>
151                                       <tbody>
152                                       </tbody>
153                                     </table>
154                                 </div>
155                                 <input type="hidden" name="op" value="check_in" />
156                                 <div id="button_bar">
157                                 <button id="sci_checkin_button" type="submit" class="btn btn-default btn-sm" style="display: none;">
158                                     <i class="fa fa-check-square-o" aria-hidden="true"></i> <span>Check in</span>
159                                 </button>
160                                 <a href="/cgi-bin/koha/sci/sci-main.pl" class="btn btn-default btn-sm" role="button" style="display: none;" id="sci_refresh_button">
161                                     <i class="fa fa-refresh" aria-hidden="true"></i> <span>Cancel</span>
162                                 </a>
163                                 </div>
164                             </fieldset>
165                         </form>
166                     </div> <!-- / #new_checkins -->
167                 [% END %]
168                 </div> <!-- / #masthead -->
169             </div> <!-- / .row-fluid -->
170         </div> <!-- / .container-fluid -->
171
172         [% IF ( Koha.Preference('SelfCheckInMainUserBlock') ) %]
173             <div id="SelfCheckInMainUserBlock">[% Koha.Preference('SelfCheckInMainUserBlock' ) %]</div>
174         [% END %]
175     </div> <!-- / .main -->
176
177     <div id="helpModal" class="modal hide" tabindex="-1" role="dialog" aria-labelledby="helpModalLabel" aria-hidden="true">
178
179       <div class="modal-header">
180         <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
181         <h3 id="helpModalLabel">Self check-in help</h3>
182       </div>
183
184       <div class="modal-body">
185         <ul>
186           <li>Scan each item or enter its barcode. A list with the entered barcodes will be displayed.</li>
187           <li>Click the 'Check in' button to confirm.</li>
188           <li>The operation results will be displayed for each entered barcode.</li>
189           <li>The 'Finish' button is presented to start over.</li>
190           <li>At any step, clicking the 'Cancel' button will erase the scanned barcodes and start over.</li>
191         </ul>
192       </div>
193     </div> <!-- /#helpModal -->
194 </body>
195
196 [% INCLUDE 'opac-bottom.inc' %]
197 [% BLOCK jsinclude %]
198     [% INCLUDE 'datatables.inc' %]
199     <script>
200
201         function mungeHistory() {
202             // prevent back button from allowing form resubmission
203             if (history && history.pushState) {
204                 history.replaceState(null, document.title, window.location.href);
205             }
206         }
207
208         function dofocus() {
209             $(".focus:last").select();
210         }
211
212         var barcodes = [];
213
214         $(document).ready(function() {
215             // Barcodes scanning table initially hidden
216             $("#sci_barcodes_table").hide();
217             // Control de 'append' button behaviour
218             $("#sci_append_button").on('click',function( e ){
219                 // Make sure the form is not submitted by the button
220                 e.preventDefault();
221                 var barcode = $('#barcode_input').val();
222                 //var result  = validate_barcode( barcode );
223                 $('#sci_barcodes_table tbody').append(
224                         '<tr stype="font-size: initial;"><td>' +
225                             barcode +
226                             '<input type="hidden" name="barcode" value="' + barcode + '" />' +
227                         '</td></tr>' );
228                 // Make sure the table is now displayed
229                 $("#sci_barcodes_table").show();
230                 $('#sci_checkin_button').show();
231                 $('#sci_refresh_button').show();
232                 barcodes.push(barcode);
233                 // clean the input, reset the focus
234                 $('#barcode_input').val('');
235                 dofocus();
236             });
237
238             $(".helpModal-trigger").on("click",function(e){
239                 e.preventDefault();
240                 $("#helpModal").modal("show");
241             });
242
243             // set focus at the beginning
244             dofocus();
245         });
246
247         var idleTime = 0;
248         $(document).ready(function () {
249             //Increment the idle time counter every second
250             var idleInterval = setInterval(timerIncrement, 1000);
251
252             //Zero the idle timer on mouse movement.
253             $(this).mousemove(function (e) {
254                 idleTime = 0;
255             });
256             $(this).keypress(function (e) {
257                 idleTime = 0;
258             });
259         });
260
261         function timerIncrement() {
262             if ( $("#sci_finish_button").is(":visible") || $("#sci_refresh_button").is(":visible") ) {
263                 idleTime = idleTime + 1;
264                 idleTimeout = [% refresh_timeout %];
265                 if (idleTime >= idleTimeout ) {
266                     location.href = '/cgi-bin/koha/sci/sci-main.pl';
267                 }
268             }
269         }
270     </script>
271
272     [% IF ( Koha.Preference('SelfCheckInUserJS') ) %]<script>[% Koha.Preference('SelfCheckInUserJS') %]</script>[% END %]
273 [% END %]