Bug 14544: QA fixes - some minor bug fixes
[koha.git] / koha-tmpl / opac-tmpl / bootstrap / en / modules / opac-basket.tt
1 [% USE Koha %]
2 [% USE KohaDates %]
3 [% SET TagsInputEnabled = ( ( Koha.Preference( 'opacuserlogin' ) == 1 ) && TagsEnabled && TagsInputOnList ) %]
4
5 [% INCLUDE 'doc-head-open.inc' %]
6 <title>[% IF ( LibraryNameTitle ) %][% LibraryNameTitle %][% ELSE %]Koha online[% END %] catalog &rsaquo; Your cart</title>
7 [% INCLUDE 'doc-head-close.inc' %]
8 [% BLOCK cssinclude %]<style type="text/css">.item-status { display: inline; }</style>[% END %]
9 </head>
10 [% INCLUDE 'bodytag.inc' bodyid='basket' %]
11     <div class="main">
12         <div class="container-fluid">
13             <div class="row-fluid">
14                 <div class="span12">
15                     <div id="userbasket">
16                         <h2>Your cart</h2>
17
18                         [% UNLESS ( print_basket ) %]
19                             <div id="toolbar" class="toolbar">
20                                 [% IF ( verbose ) %]
21                                     <a href="opac-basket.pl" class="brief" onclick="showLess(); return false;">Brief display</a>
22                                 [% ELSE %]
23                                     <a href="opac-basket.pl" class="detail" onclick="showMore(); return false;">More details</a>
24                                 [% END %]
25                                 [% IF Koha.Preference( 'opacuserlogin' ) == 1 %]
26                                     <a class="send" href="opac-basket.pl" onclick="sendBasket(); return false;">Send</a>
27                                 [% END %]
28                                 <a class="download" href="opac-basket.pl" onclick="downloadBasket(); return false;">Download</a>
29                                 <a class="print-large" href="opac-basket.pl" onclick="printBasket(); return false;">Print</a>
30                                 <a class="empty" href="opac-basket.pl" onclick="delBasket(); return false;">Empty and close</a>
31                                 <a class="hide close" href="opac-basket.pl">Hide window</a>
32                             </div>
33
34                             <div id="selections-toolbar" class="toolbar">
35                                 <a id="CheckAll" href="#">Select all</a>
36                                 <a id="CheckNone" href="#">Clear all</a>
37                                 <span class="sep">|</span>
38                                 <span class="links" id="tag_hides">
39                                     <span id="selections">Select titles to: </span>
40                                     <a href="#" class="deleteshelf disabled" onclick="delSelRecords(); return false;">Remove</a>
41                                     [% IF ( Koha.Preference( 'opacuserlogin' ) == 1 ) %]
42                                         [% IF ( ( Koha.Preference( 'virtualshelves' ) == 1 ) && loggedinusername ) %]
43                                             <a href="#" class="newshelf disabled" onclick="addSelToShelf(); return false;">Add to a list</a>
44                                         [% END %]
45                                         [% IF ( Koha.Preference( 'RequestOnOpac' ) == 1 ) %]
46                                             <a href="#" class="hold disabled" onclick="holdSel(); return false;">Place hold</a>
47                                         [% END %]
48                                         [% IF ( TagsInputEnabled && loggedinusername ) %]
49                                             <a href="#" id="tagsel_tag" class="disabled" onclick="tagSelected(); return false;">Tag</a>
50                                         [% END %]
51                                     [% END # / IF opacuserlogin %]
52                                 </span>
53                                 [% IF ( TagsInputEnabled && loggedinusername ) %]
54                                 <span id="tagsel_form" style="display:none">
55                                     <label for="tagsel_new">New tag:</label>
56                                     <input name="tagsel_new" id="tagsel_new" maxlength="100" />
57                                     <input id="tagsel_button" name="tagsel_button" class="input tagsel_button" title="Add" type="submit" value="Add" onclick="tagAdded(); return false;" />
58                                     <a href="#" id="tagsel_cancel" onclick="tagCanceled(); return false;">Cancel</a>
59                                 </span>
60                                 [% END %]
61                             </div>
62                         [% END # / UNLESS print_basket %]
63
64                         [% IF ( verbose ) %]
65                             <form action="opac-basket.pl" method="get" name="bookbag_form" id="bookbag_form" class="checkboxed">
66                                 [% FOREACH BIBLIO_RESULT IN BIBLIO_RESULTS %]
67                                     <h3>
68                                         [% IF ( print_basket ) %]
69                                             [% BIBLIO_RESULT.title |html %]
70                                                 [% IF ( BIBLIO_RESULT.subtitle ) %] [% FOREACH subtitl IN BIBLIO_RESULT.subtitle %] [% subtitl.subfield |html %] [% END %][% END %]
71                                                 [% IF ( BIBLIO_RESULT.author ) %] [% BIBLIO_RESULT.author |html %][% END %]
72                                         [% ELSE %]
73                                                 <input type="checkbox" class="cb" value="[% BIBLIO_RESULT.biblionumber %]" name="bib[% BIBLIO_RESULT.biblionumber %]" id="bib[% BIBLIO_RESULT.biblionumber %]" onclick="selRecord(value,checked)" />
74                                                 [% BIBLIO_RESULT.title |html %]
75                                                 [% IF ( BIBLIO_RESULT.subtitle ) %] [% FOREACH subtitl IN BIBLIO_RESULT.subtitle %] [% subtitl.subfield |html %] [% END %][% END %]
76                                                 [% IF ( BIBLIO_RESULT.author ) %] [% BIBLIO_RESULT.author |html %][% END %]
77                                         [% END # / IF print_basket %]
78                                     </h3>
79                                     <!-- COinS / Openurl -->
80                                     <span class="Z3988" title="ctx_ver=Z39.88-2004&amp;rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&amp;rft.au=[% BIBLIO_RESULT.author %]&amp;rft.btitle=[% BIBLIO_RESULT.title |url %]&amp;rft.date=[% BIBLIO_RESULT.publicationyear %]&amp;rft.tpages=[% BIBLIO_RESULT.item('size') %]&amp;rft.isbn=[% BIBLIO_RESULT.isbn |url %]&amp;rft.aucorp=&amp;rft.place=[% BIBLIO_RESULT.place %]&amp;rft.pub=[% BIBLIO_RESULT.publisher |url %]&amp;rft.edition=[% BIBLIO_RESULT.edition %]&amp;rft.series=[% BIBLIO_RESULT.series %]&amp;rft.genre="></span>
81
82                                     <table class="table">
83                                         [% IF ( BIBLIO_RESULT.isbn ) %]
84                                             <tr>
85                                                 <th scope="row">ISBN</th>
86                                                 <td>[% BIBLIO_RESULT.isbn %]</td>
87                                             </tr>
88                                         [% END %]
89
90                                         [% IF ( BIBLIO_RESULT.HASAUTHORS ) %]
91                                         <tr>
92                                             <th scope="row">Author(s)</th>
93                                             <td>
94                                                [% IF ( BIBLIO_RESULT.author ) %]
95                                                    <p>[% BIBLIO_RESULT.author %]</p>
96                                                [% END %]
97                                                [% IF ( BIBLIO_RESULT.MARCAUTHORS ) %]
98                                                    [% FOREACH MARCAUTHOR IN BIBLIO_RESULT.MARCAUTHORS %]
99                                                    <p> [% FOREACH MARCAUTHOR_SUBFIELDS_LOO IN MARCAUTHOR.MARCAUTHOR_SUBFIELDS_LOOP %]
100                                                           [% MARCAUTHOR_SUBFIELDS_LOO.separator %]
101                                                               [% MARCAUTHOR_SUBFIELDS_LOO.value %]
102                                                        [% END %]
103                                                    </p>
104                                                    [% END %]
105                                                [% END %]
106                                             </td>
107                                         </tr>
108                                         [% END %]
109
110                                         [% IF ( BIBLIO_RESULT.publishercode ) %]
111                                             <tr>
112                                                 <th scope="row">Publisher</th>
113                                                 <td>[% BIBLIO_RESULT.place %] [% BIBLIO_RESULT.publishercode %] [% BIBLIO_RESULT.publicationyear %]
114                                                 </td>
115                                             </tr>
116                                         [% END %]
117
118                                         [% IF ( BIBLIO_RESULT.pages ) %]
119                                             <tr>
120                                                 <th scope="row">Details</th>
121                                                 <td>[% BIBLIO_RESULT.pages %] [% BIBLIO_RESULT.illus %] [% BIBLIO_RESULT.item('size') %]</td>
122                                             </tr>
123                                         [% END %]
124
125                                         [% IF ( BIBLIO_RESULT.seriestitle ) %]
126                                         <tr>
127                                             <th scope="row">Collection</th>
128                                             <td> [% BIBLIO_RESULT.seriestitle %]</td>
129                                         </tr>
130                                         [% END %]
131
132                                         [% IF ( BIBLIO_RESULT.MARCSUBJCTS ) %]
133                                         <tr>
134                                             <th scope="row">Subject(s)</th>
135                                             <td>[% FOREACH MARCSUBJCT IN BIBLIO_RESULT.MARCSUBJCTS %]
136                                                    <p> [% FOREACH MARCSUBJECT_SUBFIELDS_LOO IN MARCSUBJCT.MARCSUBJECT_SUBFIELDS_LOOP %]
137                                                         [% MARCSUBJECT_SUBFIELDS_LOO.separator %][% MARCSUBJECT_SUBFIELDS_LOO.value %][% END %]
138                                                    </p>
139                                                 [% END %]</td>
140                                         </tr>
141                                         [% END %]
142
143                                         [% IF ( BIBLIO_RESULT.copyrightdate ) %]
144                                             <tr><th scope="row">Copyright</th>
145                                                 <td> [% BIBLIO_RESULT.copyrightdate %]</td>
146                                             </tr>
147                                         [% END %]
148
149                                         [% IF ( BIBLIO_RESULT.MARCNOTES ) %]
150                                             <tr>
151                                                 <th scope="row">Notes</th>
152                                                 <td>
153                                                 [% FOREACH MARCNOTE IN BIBLIO_RESULT.MARCNOTES %]
154                                                     <p>- [% MARCNOTE.marcnote %]</p>
155                                                 [% END %]</td>
156                                             </tr>
157                                         [% END %]
158
159                                         [% IF ( BIBLIO_RESULT.unititle ) %]
160                                             <tr>
161                                                 <th scope="row">Unified title</th>
162                                                 <td> [% BIBLIO_RESULT.unititle %]</td>
163                                             </tr>
164                                         [% END %]
165
166                                         [% IF ( BIBLIO_RESULT.serial ) %]
167                                             <tr>
168                                                 <th scope="row">Serial</th>
169                                                 <td>[% BIBLIO_RESULT.serial %]</td>
170                                             </tr>
171                                         [% END %]
172
173                                         [% IF ( BIBLIO_RESULT.dewey ) %]
174                                             <tr>
175                                                 <th scope="row">Dewey</th>
176                                                 <td>[% BIBLIO_RESULT.dewey %]</td>
177                                             </tr>
178                                         [% END %]
179
180                                         [% IF ( BIBLIO_RESULT.classification ) %]
181                                             <tr>
182                                                 <th scope="row">Classification</th>
183                                                 <td> [% BIBLIO_RESULT.classification %]</td>
184                                             </tr>
185                                         [% END %]
186
187                                         [% IF ( BIBLIO_RESULT.lccn ) %]
188                                             <tr>
189                                                 <th scope="row">LCCN</th>
190                                                 <td> [% BIBLIO_RESULT.lccn %]</td>
191                                             </tr>
192                                         [% END %]
193
194                                         [% IF BIBLIO_RESULT.MARCURLS.size %]
195                                             <tr>
196                                                 <th scope="row">URL(s)</th>
197                                                 <td>
198                                                    [% FOREACH MARCurl IN BIBLIO_RESULT.MARCURLS %]
199                                                         [% IF MARCurl.part %]<p>[% MARCurl.part %]</p>[% END %]
200
201                                                         [% IF OPACurlOpenInNewWindow %]
202                                                             <a href="[% MARCurl.MARCURL %]" title="[% MARCurl.MARCURL %]" target="_blank">[% MARCurl.linktext %]</a>
203                                                         [% ELSE %]
204                                                             <a href="[% MARCurl.MARCURL %]" title="[% MARCurl.MARCURL %]">[% MARCurl.linktext %]</a>
205                                                         [% END %]
206
207                                                         [% IF MARCurl.notes %][% FOREACH note IN MARCurl.notes %]<p>[% note.note %]</p>[% END %][% END %]
208                                                     [% END %]
209                                                 </td>
210                                             </tr>
211                                         [% END %]
212
213                                         <tr>
214                                             <th scope="row">Location(s) (Status)</th>
215                                             <td>
216                                                 [% IF ( BIBLIO_RESULT.ITEM_RESULTS ) %]
217                                                     <ul>
218                                                         [% FOREACH ITEM_RESULT IN BIBLIO_RESULT.ITEM_RESULTS %]
219                                                             <li>
220                                                                 <strong>[% ITEM_RESULT.branchname %]</strong>[% IF ( ITEM_RESULT.location_opac ) %], [% ITEM_RESULT.location_opac %][% END %]
221                                                                 [% IF ( ITEM_RESULT.itemcallnumber ) %]
222                                                                     ([% ITEM_RESULT.itemcallnumber %])
223                                                                 [% END %]
224                                                                 ([% INCLUDE 'item-status.inc' item = ITEM_RESULT %])
225                                                             </li>
226                                                         [% END %]
227                                                     </ul>
228                                                 [% ELSE %]
229                                                     This record has no items.
230                                                 [% END %]
231                                             </td>
232                                         </tr>
233                                     </table>
234                                 [% END # / FOREACH BIBLIO_RESULT %]
235                             </form>
236
237                         [% ELSE %]
238
239                             <form action="/cgi-bin/koha/opac-basket.pl" method="get" name="bookbag_form" id="bookbag_form" class="checkboxed">
240                                 <table id="itemst" class="table table-bordered table-striped">
241                                     <thead>
242                                         <tr>
243                                             [% UNLESS ( print_basket ) %]<th>&nbsp;</th>[% END %]
244                                             <th>Title</th>
245                                             <th>Author</th>
246                                             <th>Year</th>
247                                             <th>Location (Status)</th>
248                                         </tr>
249                                     </thead>
250                                     <tbody>
251                                     [% FOREACH BIBLIO_RESULT IN BIBLIO_RESULTS %]
252                                         <tr>
253                                             [% UNLESS ( print_basket ) %]
254                                                 <td>
255                                                 <input type="checkbox" class="cb" value="[% BIBLIO_RESULT.biblionumber %]" name="bib[% BIBLIO_RESULT.biblionumber %]" id="bib[% BIBLIO_RESULT.biblionumber %]" onclick="selRecord(value,checked);" />
256                                                 </td>
257                                             [% END %]
258                                             <td>
259                                                 <a href="#" onclick="openBiblio('[% BIBLIO_RESULT.dest %]',[% BIBLIO_RESULT.biblionumber %])">[% BIBLIO_RESULT.title |html %][% IF ( BIBLIO_RESULT.subtitle ) %] [% FOREACH subtitl IN BIBLIO_RESULT.subtitle %][% subtitl.subfield |html %][% END %][% END %]</a>
260                                                 <!-- COinS / Openurl -->
261                                                 <span class="Z3988" title="ctx_ver=Z39.88-2004&amp;rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&amp;rft.au=[% BIBLIO_RESULT.author %]&amp;rft.btitle=[% BIBLIO_RESULT.title |url %]&amp;rft.date=[% BIBLIO_RESULT.publicationyear %]&amp;rft.tpages=[% BIBLIO_RESULT.item('size') %]&amp;rft.isbn=[% BIBLIO_RESULT.isbn |url %]&amp;rft.aucorp=&amp;rft.place=[% BIBLIO_RESULT.place %]&amp;rft.pub=[% BIBLIO_RESULT.publisher |url %]&amp;rft.edition=[% BIBLIO_RESULT.edition %]&amp;rft.series=[% BIBLIO_RESULT.series %]&amp;rft.genre="></span>
262                                                 [% IF ( TagsInputEnabled && loggedinusername ) %]
263                                                 <span id="newtag[% BIBLIO_RESULT.biblionumber %]_status" class="tagstatus results_summary" style="display:none">Tag status here.</span>
264                                                 [% END %]
265                                             </td>
266                                             <td>[% BIBLIO_RESULT.author %]</td>
267                                             <td>
268                                                 [% IF ( BIBLIO_RESULT.publicationyear ) %]
269                                                     [% BIBLIO_RESULT.publicationyear %]
270                                                 [% ELSE %]
271                                                     [% BIBLIO_RESULT.copyrightdate %]
272                                                 [% END %]
273                                             </td>
274                                             <td>[% IF ( BIBLIO_RESULT.ITEM_RESULTS ) %]<ul>[% FOREACH ITEM_RESULT IN BIBLIO_RESULT.ITEM_RESULTS %]
275                                                 <li>
276                                                     [% ITEM_RESULT.branchname %][% IF ( ITEM_RESULT.location_opac ) %], [% ITEM_RESULT.location_opac %][% END %]
277                                                     [% IF ( ITEM_RESULT.itemcallnumber ) %]
278                                                         ([% ITEM_RESULT.itemcallnumber %])
279                                                     [% END %]
280                                                     ([% INCLUDE 'item-status.inc' item = ITEM_RESULT %])
281                                                 </li>
282                                                 [% END %]</ul>[% ELSE %]This record has no items.[% END %]
283                                             </td>
284                                         </tr>
285                                     [% END # / FOREACH BIBLIO_RESULT %]
286                                     </tbody>
287                                 </table>
288                             </form>
289                         [% END # / verbose %]
290
291                         [% UNLESS ( print_basket ) %]
292                             <form name="myform" action="opac-basket.pl" method="get">
293                                 <input type="hidden" name="records" id="records" />
294                             </form>
295                         [% END %]
296
297                 </div> <!-- / #userbasket -->
298             </div> <!-- / .span10 -->
299         </div> <!-- / .row-fluid -->
300     </div> <!-- / .container-fluid -->
301 </div> <!-- / .main -->
302
303 [% INCLUDE 'opac-bottom.inc' %]
304
305 [% BLOCK jsinclude %]
306     [% IF ( print_basket ) %]
307         <script type="text/javascript">
308             //<![CDATA[
309                 $(document).ready(function(){
310                     print();
311                     location.href="/cgi-bin/koha/opac-basket.pl?bib_list=[% bib_list %][% IF ( verbose ) %]&verbose=1[% END %]";
312                 });
313             //]]>
314         </script>
315     [% ELSE %]
316         <script type="text/javascript" src="[% interface %]/[% theme %]/lib/jquery/plugins/jquery.checkboxes.min.js"></script>
317         [% INCLUDE 'datatables.inc' %]
318         <script type="text/javascript">
319             //<![CDATA[
320
321             [% IF ( TagsInputEnabled && loggedinusername ) %]
322                 function tagSelected() {
323                     var bibs = document.getElementById('records').value;
324                     if (bibs) {
325                         $("#tagsel_tag").hide();
326                         $("#tag_hides").hide();
327                         $("#tagsel_form").show();
328                     } else {
329                         alert(MSG_NO_RECORD_SELECTED);
330                     }
331                 }
332
333                 function tagCanceled() {
334                     $("#tagsel_form").hide();
335                     $("#tagsel_tag").show();
336                     $("#tag_hides").show();
337                     $("#tagsel_new").val("");
338                     $(".tagstatus").empty().hide();
339                 }
340
341                 function tagAdded() {
342                     var checkedBoxes = $("input:checkbox:checked");
343                     if (!$(checkedBoxes).size()) {
344                         alert(MSG_NO_RECORD_SELECTED);
345                         return false;
346                     }
347
348                     var tag = $("#tagsel_new").val();
349                     if (!tag || (tag == "")) {
350                         alert(MSG_NO_TAG_SPECIFIED);
351                         return false;
352                     }
353
354                     var bibs = [];
355                     for (var i = 0; i < $(checkedBoxes).size(); i++) {
356                         var box = $(checkedBoxes).get(i);
357                         bibs[i] = $(box).val();
358                     }
359
360                     KOHA.Tags.add_multitags_button(bibs, tag);
361                     return false;
362                 }
363             [% END # / TagsInputEnabled && loggedinusername %]
364
365             $(document).ready(function(){
366                 $("#CheckAll").click(function(){
367                     var checked = [];
368                     $(".checkboxed").checkCheckboxes("*", true).each(
369                         function() {
370                             selRecord(this.value,true);
371                         }
372                     );
373                     enableCheckboxActions();
374                     return false;
375                 });
376
377                 $("#CheckNone").click(function(){
378                     var checked = [];
379                     $(".checkboxed").unCheckCheckboxes("*",true).each(
380                         function() {
381                             selRecord(this.value,false);
382                         }
383                     );
384                     enableCheckboxActions();
385                     return false;
386                 });
387
388                 $("#itemst").dataTable($.extend(true, {}, dataTablesDefaults, {
389                     "aaSorting": [[ 1, "asc" ]],
390                     "aoColumnDefs": [
391                       { "aTargets": [ 0,-1 ], "bSortable": false, "bSearchable": false }
392                     ],
393                     "aoColumns": [
394                         null,
395                         { "sType": "anti-the" },
396                         null,
397                         null,
398                         null
399                     ]
400                 }));
401
402                 $(".cb").click(function(){
403                     enableCheckboxActions();
404                 });
405                 enableCheckboxActions();
406             });
407
408             function enableCheckboxActions(){
409                 // Enable/disable controls if checkboxes are checked
410                 var checkedBoxes = $(".checkboxed input:checkbox:checked");
411                 if ($(checkedBoxes).size()) {
412                   $("#selections").html(_("With selected titles: "));
413                   $("#selections-toolbar .links a").removeClass("disabled");
414                 } else {
415                   $("#selections").html(_("Select titles to: "));
416                   $("#selections-toolbar .links a").addClass("disabled");
417                 }
418             }
419             //]]>
420         </script>
421     [% END # / IF print_basket %]
422 [% END # / BLOCK jsinclude %]