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