Bug 7953 - add opacuserjs to the sco template
[koha.git] / koha-tmpl / opac-tmpl / prog / en / modules / sco / sco-main.tt
1 [% USE KohaDates %]
2 [% INCLUDE 'doc-head-open.inc' %][% IF ( LibraryNameTitle ) %][% LibraryNameTitle %][% ELSE %]Koha [% END %] &rsaquo; Self checkout </title>
3 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
4 <meta name="generator" content="Koha [% Version %]" /> <!-- leave this for stats -->
5 <link rel="shortcut icon" href="[% themelang %]/includes/favicon.ico" type="image/x-icon" />
6 <script type="text/javascript" src="[% themelang %]/lib/jquery/jquery.js"></script>
7 <script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.tablesorter.min.js"></script>
8 <script type="text/javascript">//<![CDATA[
9 function sco_init(valid_session) {
10     if (valid_session == 1) {
11         setTimeout("location.href='/cgi-bin/koha/sco/sco-main.pl?op=logout';",[% SelfCheckTimeout %]); 
12     }
13 }
14 function dofocus() {    // named function req'd for body onload event by some FF and IE7 security models
15     // alert("dofocus called");
16     $(".focus:last").select();
17 }
18
19 function checkout_confirm(patronid) {
20     var   barcode = $("#barcode").val();
21     // alert("checkout_confirm('" + patronid + "') called for barcode '" + barcode + "'");
22     if (! barcode) { dofocus(); return false; }    // no barcode
23     if (barcode == "__KOHA_NEW_CIRC__") {   // magic barcode 
24         window.location.href='/cgi-bin/koha/sco/sco-main.pl?op=logout';
25         return false;
26     }
27     if (this.valid_session == 0) {
28         // probably should force logout like above ? --atz 6/09
29         if (confirm('Session has expired.  Click \'OK\' to continue processing this item.  Click Cancel if you are not ' + patronid)){
30             this.op.value='logout';
31             this.patronid.value='';
32         }
33     }
34     return true;
35 }
36
37 $.tablesorter.addParser({
38     id: 'articles',
39     is: function(s) {return false;  },
40     format: function(s) { return s.toLowerCase().replace(/^(the|an|a) /,''); },
41     type: 'text'
42 });
43
44 $(document).ready(function() {
45     [% IF ( patronid ) %] sco_init(1);
46     [% ELSIF ( timedout ) %] sco_init(1);
47     [% END %]
48     $("#loanTable").tablesorter({
49         [% IF ( dateformat_metric ) %]
50             dateFormat: 'uk',
51         [% END %]
52         widgets:   ['zebra'],
53         sortList:  [[2, 1], [0, 0]],
54         headers: {
55             0: { sorter: 'articles' },
56             3: { sorter: false }
57             [% UNLESS ( nofines ) %], 4: { sorter: false }[% END %]
58         }
59     });
60 });
61 //]]>
62
63 </script>
64 [% IF ( opacuserjs ) %]<script type="text/javascript">[% opacuserjs %]</script>[% END %]
65
66
67 <link rel="stylesheet" type="text/css" href="[% themelang %]/css/sco.css" />
68 [% IF ( OPACUserCSS ) %]<style type="text/css">[% OPACUserCSS %]</style>[% END %]
69
70 </head>
71 <body onload="dofocus();">
72
73 <div id="doc" class="yui-t7">
74
75 <div id="masthead"><h1>[% LibraryName %] Self checkout system</h1></div>
76 <div id="bd">
77
78 [% IF ( impossible ) %]<!-- We tried to issue, but failed. -->
79 <div class="dialog alert"><h3>Item cannot be checked out.</h3><p>Sorry, This item cannot be checked out at this station.  </p>
80 [% IF ( title ) %]<p>Title: <em>[% title |html %]</em> </p>[% END %]
81 <p>
82    [% IF ( circ_error_UNKNOWN_BARCODE ) %]
83     <em>MESSAGE 1:</em> The system does not recognize this barcode.
84    [% ELSIF ( circ_error_TOO_MANY ) %]
85     <em>MESSAGE 2:</em> You have borrowed too many items and can't check out any more.
86    [% ELSIF ( circ_error_ISSUED_TO_ANOTHER ) %]
87     <em>MESSAGE 3:</em> This item is checked out to someone else.
88    [% ELSIF ( circ_error_NO_MORE_RENEWALS ) %]
89     <em>MESSAGE 4:</em> You cannot renew this item again.
90    [% ELSIF ( circ_error_NOT_FOR_LOAN ) %]
91     <em>MESSAGE 5:</em> This item is not for loan.
92    [% ELSIF ( circ_error_DEBT ) %]
93     <em>MESSAGE 6:</em> You owe the library [% amount %] and cannot borrow.
94    [% ELSIF ( circ_error_WTHDRAWN ) %]
95     <em>MESSAGE 7:</em> This item has been withdrawn from the collection.
96    [% ELSIF ( circ_error_RESTRICTED ) %]
97     <em>MESSAGE 8:</em>
98    [% ELSIF ( circ_error_RESERVED ) %]
99     <em>MESSAGE 9:</em> This item is reserved for another patron.
100    [% ELSIF ( circ_error_ITEMNOTSAMEBRANCH ) %]
101     <em>MESSAGE 10:</em>
102    [% ELSIF ( circ_error_EXPIRED ) %]
103     <em>MESSAGE 11:</em> Your account has expired.
104    [% ELSIF ( circ_error_DEBARRED ) %]
105     <em>MESSAGE 12:</em> Your account has been suspended.
106    [% ELSIF ( circ_error_CARD_LOST ) %]
107     <em>MESSAGE 13:</em> This card has been declared lost.
108    [% ELSIF ( circ_error_GNA ) %]
109     <em>MESSAGE 14:</em>
110    [% ELSIF ( circ_error_INVALID_DATE ) %]
111     <em>MESSAGE 15:</em>
112    [% END %]
113    Please see a member of the library staff.
114 </p>
115 <form action="/cgi-bin/koha/sco/sco-main.pl" name="errorForm" method="post">
116 <input type="hidden" name="op" value="login" />
117 <input type="hidden" name="patronid" value="[% patronid %]" />
118 [% IF ( returnitem ) %]
119 [% IF ( AllowSelfCheckReturns ) %]
120 <input type="hidden" name="barcode" value="[% barcode %]" />
121 <input type="button" name="returnbook" value="Return this item" class="return" onclick="this.form.op.value='returnbook';this.form.submit();"  />
122 [% END %]
123 [% END %]
124 <input type="submit" name= "confirm" value="Return to Account Summary" class="back focus" />
125 </form>
126 [% END %]
127 [% IF ( confirm ) %]<!-- We need to confirm the issue.. -->
128 <div class="dialog alert"><h3>Please confirm the checkout:</h3>
129 <p>[% IF ( confirm_renew_issue ) %]This item is already checked out to you.[% END %]</p>
130
131 <form action="/cgi-bin/koha/sco/sco-main.pl" name="confirmForm" method="post">
132 <input type="hidden" name="op" value="checkout" />
133 <input type="hidden" name="patronid" value="[% patronid %]" />
134 <input type="hidden" name="barcode" value="[% barcode %]" />
135 <input type="hidden" name="confirmed" value="" />
136 [% IF ( renew ) %]
137 [% IF ( AllowSelfCheckReturns ) %]
138 <input type="button" value="Return item" name="confirm" class="return" onclick="this.form.op.value='returnbook';this.form.submit();"  />
139 [% END %]
140 [% END %]
141 [% UNLESS ( renew ) %]<input type="button" value="Renew item" name="confirm" class="renew" onclick="this.form.confirmed.value='1';this.form.submit();" />
142 [% ELSE %]<input type="button" value="Renew item" class="renew" onclick="this.form.confirmed.value='1';this.form.submit();" />[% END %]
143 <input type="button" value="Cancel" class="cancel" onclick="this.form.op.value='';this.form.submit();return true;"  />
144 </form>
145 </div>
146 [% END %]
147
148 [% IF ( nopermission ) %]<!-- This is what is displayed if user doesnt have permission --><div class="dialog alert"><h3>Access denied</h3>
149 Sorry, this self-checkout station has lost authentication.  Please contact the administrator to resolve this problem. </div>
150 [% END %]
151 [% IF ( timed_out ) %]<!-- This is what is displayed if login has timed out -->
152 <div class="dialog alert"><h3>Session timed out</h3>Sorry, your session has timed out, please log in again.</div>[% END %]
153 [% IF ( different_ip ) %]<!-- This is what is displayed if user doesnt have permission --><div class="dialog alert"><h3>Session lost</h3>You are accessing self-checkout from a different IP address! please log in again.</div>[% END %]
154 [% IF ( invalid_username_or_password ) %]
155 <!-- This is what is displayed if user doesnt have permission --><div class="dialog alert"><h3>Record not found</h3><p>Your userid was not found in the database.  Please try again.</p></div>[% END %]
156
157
158 [% UNLESS ( hide_main ) %]
159         <div class="sco_head">
160         [% UNLESS ( validuser ) %] 
161     <h3>Self checkout</h3>
162         [% END %]
163
164         <div id="checkouthelp">
165                 <a href="/cgi-bin/koha/sco/help.pl">HELP</a> with the self checkout system
166         </div>
167
168         [% IF ( patronid ) %]
169         [% IF ( validuser ) %]
170     <h3 class="warning">You are logged in as [% borrowername %].</h3>
171         [% END %]
172         </div>
173         [% IF ( nouser ) %]
174         <div class="dialog alert"><h4>Sorry</h4><p>The userid <strong>[% patronid %]</strong> was not found in the database.  Please try again.</p></div>
175         <br />
176         [% END %]
177         [% END %]
178
179         [% IF ( timedout ) %]
180         <div class="dialog message"><h4>Sorry</h4><p>Your session has timed out due to inactivity.  Please sign in.</p></div>
181         <br />
182         [% END %]
183         [% IF ( validuser ) %]
184   [% IF ( display_patron_image ) %]<div class="yui-ge"><div class="yui-u first">[% END %]
185         <div id="newcheckout" class="sco_entry">
186         <form id="scan_form" name="scan_form" method="post" action="/cgi-bin/koha/sco/sco-main.pl" onsubmit="return checkout_confirm('[% patronid %]');">
187         <fieldset><legend> Check out[% IF ( AllowSelfCheckReturns ) %], return[% END %] or renew an item: </legend>
188         <label for="barcode">Scan a new item or enter its barcode:</label>
189         <input id="barcode" name="barcode" size="20" class="focus" />
190         <input type="hidden" name="op" value="checkout" />
191         <input type="hidden" name="patronid" value="[% patronid %]" />
192         <input type="hidden" name="valid_session" value="1" />
193         <input type="submit" value="Submit" class="submit" /></fieldset>
194         </form>
195         <div><form method="post" action="/cgi-bin/koha/sco/sco-main.pl?op=logout" ><input type="submit" value="Finish" class="finish" /></form></div>
196         </div> <!-- sco_entry --> <!-- newcheckout -->
197   [% IF ( display_patron_image ) %]</div> <!-- /yui-u first -->[% END %]
198   [% IF ( display_patron_image ) %]
199   <div class="yui-u">
200         <img src="/cgi-bin/koha/sco/sco-patron-image.pl?cardnumber=[% cardnumber %]" alt="" />
201   </div>
202   [% END %]
203   </div> <!-- /yui-ge -->
204   <div class="yui-g">
205         <div id="borrowerdetails">
206         [% IF ( issues_count ) %]
207         <table id="loanTable"><caption>Checkouts for [% borrowername %] <span class="count">([% issues_count %] total)</span></caption>
208         <!-- ISSUES TABLE ROWS -->
209     <thead>
210         <tr><th>Title</th><th>Call no.</th><th>Due</th><th>Renew</th>[% UNLESS ( nofines ) %]<th>Fines</th>[% END %]</tr>
211     </thead>
212
213     <tbody>
214         [% FOREACH ISSUE IN ISSUES %]
215         [% UNLESS ( loop.odd ) %]<tr class="highlight">[% ELSE %]<tr>[% END %]
216     <!-- FIXME: yet another jacket image breakpoint -->
217         <td>[% UNLESS ( ISSUE.noitemlinks ) %]<a href="/cgi-bin/koha/opac-detail.pl?bib=[% ISSUE.biblionumber %]">[% ISSUE.title |html %]</a>[% ELSE %]<strong>[% ISSUE.title |html %]</strong>[% END %]<span class="item-details">
218         [% ISSUE.author %]</span> ([% ISSUE.barcode %])</td>
219         <td>[% ISSUE.itemcallnumber %]</td>
220         [% IF ( ISSUE.overdue ) %]<td class="overdue">[% ISSUE.date_due | $KohaDates %]</td>[% ELSE %]<td>[% ISSUE.date_due | $KohaDates %]</td>[% END %]
221         <td>
222     <form action="/cgi-bin/koha/sco/sco-main.pl" method="post">
223     <input type="hidden" name="op" value="checkout" />
224     <input type="hidden" name="patronid" value="[% patronid %]" />
225     <input type="hidden" name="barcode" value="[% ISSUE.barcode %]" />
226     <input type="hidden" name="confirmed" value=""  />
227         [% IF ( ISSUE.norenew ) %]
228           [% IF ( ISSUE.AllowSelfCheckReturns ) %]
229           <input type="button" value="Return Item" name="confirm" class="return" onclick="this.form.op.value='returnbook';this.form.submit();"  />
230           [% ELSE %]
231           <span>No renewals allowed</span>
232           [% END %]
233         [% ELSE %]
234             [% UNLESS ( ISSUE.renew ) %]<input type="button" value="Renew Item"  name="confirm" class="renew" onclick="this.form.confirmed.value='1';this.form.submit();" />
235             [% ELSE %]<input type="button" value="Renew Item" class="renew" onclick="this.form.confirmed.value='1';this.form.submit();" />[% END %]
236         [% END %]
237     </form>
238         </td>
239         [% UNLESS ( nofines ) %]<td>[% IF ( ISSUE.charges ) %]Yes[% ELSE %]No[% END %]</td>[% END %]</tr>
240         [% END %]
241     </tbody>
242
243         </table>
244         [% ELSE %]
245         <h3>You currently have nothing checked out.</h3>
246         [% END %]
247 </div> <!-- /yui-g -->
248         [% ELSE %]<!-- not validuser -->
249         <div class="sco_entry" >
250         <form id="mainform" action="/cgi-bin/koha/sco/sco-main.pl" name="mainform" method="post">
251        [% IF ( authbylogin ) %]
252         <fieldset class="checkout">
253        <legend>Please login with your username and password</legend>
254        <label for="patronlogin">Username:</label>
255         <input type="text" id="patronlogin" class="focus" size="20" name="patronlogin" />
256        <label for="patronpw">Password:</label>
257         <input type="password" id="patronpw" size="20" name="patronpw" />
258        [% ELSE %]
259         <fieldset class="checkout"><label for="patronid">Please enter your card number:</label> 
260         <input type="text" id="patronid" class="focus" size="20" name="patronid" />
261         [% END %]
262
263         [% FOREACH INPUT IN INPUTS %]<input type="hidden" name="[% INPUT.name |html %]" value="[% INPUT.value |html %]">[% END %]
264         <input type="hidden" name="op" value="login" />
265         <input type="submit" value="Submit" class="submit" /></fieldset></form>
266         </div>
267         [% END %]
268 [% END %] <!-- ( / hide main) -->       
269         
270         </div>
271 </div>
272 [% INCLUDE 'opac-bottom.inc' %]