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