Bug 18545: Remove use of onclick from OPAC cart
[koha.git] / koha-tmpl / opac-tmpl / bootstrap / en / modules / opac-basket.tt
blobd1b137bd804ba8c37b891717c3b68d80d174a050
1 [% USE Koha %]
2 [% USE KohaDates %]
3 [% SET TagsInputEnabled = ( ( Koha.Preference( 'opacuserlogin' ) == 1 ) && TagsEnabled && TagsInputOnList ) %]
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>
18                         [% UNLESS ( print_basket ) %]
19                             <div id="toolbar" class="toolbar">
20                                 [% IF ( verbose ) %]
21                                     <a href="opac-basket.pl" class="brief">Brief display</a>
22                                 [% ELSE %]
23                                     <a href="opac-basket.pl" class="detail">More details</a>
24                                 [% END %]
25                                 [% IF Koha.Preference( 'opacuserlogin' ) == 1 %]
26                                     <a class="send" href="opac-basket.pl">Send</a>
27                                 [% END %]
28                                 <a class="download" href="opac-basket.pl">Download</a>
29                                 <a class="print-large" href="opac-basket.pl">Print</a>
30                                 <a class="empty" href="opac-basket.pl">Empty and close</a>
31                                 <a class="hide close" href="opac-basket.pl">Hide window</a>
32                             </div>
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">Remove</a>
41                                     [% IF ( Koha.Preference( 'opacuserlogin' ) == 1 ) %]
42                                         [% IF ( ( Koha.Preference( 'virtualshelves' ) == 1 ) && loggedinusername ) %]
43                                             <a href="#" class="newshelf disabled">Add to a list</a>
44                                         [% END %]
45                                         [% IF ( Koha.Preference( 'RequestOnOpac' ) == 1 ) %]
46                                             <a href="#" class="hold disabled">Place hold</a>
47                                         [% END %]
48                                         [% IF ( TagsInputEnabled && loggedinusername ) %]
49                                             <a href="#" id="tagsel_tag" class="disabled">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">
58                                     <a href="#" id="tagsel_cancel">Cancel</a>
59                                 </span>
60                                 [% END %]
61                             </div>
62                         [% END # / UNLESS print_basket %]
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 %]">
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>
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 %]
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 %]
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 %]
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 %]
125                                         [% IF ( BIBLIO_RESULT.seriestitle ) %]
126                                         <tr>
127                                             <th scope="row">Collection</th>
128                                             <td> [% BIBLIO_RESULT.seriestitle %]</td>
129                                         </tr>
130                                         [% END %]
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 %]
143                                         [% IF ( BIBLIO_RESULT.copyrightdate ) %]
144                                             <tr><th scope="row">Copyright</th>
145                                                 <td> [% BIBLIO_RESULT.copyrightdate %]</td>
146                                             </tr>
147                                         [% END %]
149                                         [% IF ( BIBLIO_RESULT.MARCNOTES ) %]
150                                             <tr>
151                                                 <th scope="row">Notes</th>
152                                                 <td>
153                                                 [% FOREACH MARCNOTE IN BIBLIO_RESULT.MARCNOTES %]
154                                                     <p>
155                                                     [% IF MARCNOTE.marcnote.match('^https?://\S+$') %]
156                                                         - <a href="[% MARCNOTE.marcnote %]">[% MARCNOTE.marcnote %]</a>
157                                                     [% ELSE %]
158                                                         - [% MARCNOTE.marcnote %]
159                                                     [% END %]
160                                                     </p>
161                                                 [% END %]
162                                                 </td>
163                                             </tr>
164                                         [% END %]
166                                         [% IF ( BIBLIO_RESULT.unititle ) %]
167                                             <tr>
168                                                 <th scope="row">Unified title</th>
169                                                 <td> [% BIBLIO_RESULT.unititle %]</td>
170                                             </tr>
171                                         [% END %]
173                                         [% IF ( BIBLIO_RESULT.serial ) %]
174                                             <tr>
175                                                 <th scope="row">Serial</th>
176                                                 <td>[% BIBLIO_RESULT.serial %]</td>
177                                             </tr>
178                                         [% END %]
180                                         [% IF ( BIBLIO_RESULT.dewey ) %]
181                                             <tr>
182                                                 <th scope="row">Dewey</th>
183                                                 <td>[% BIBLIO_RESULT.dewey %]</td>
184                                             </tr>
185                                         [% END %]
187                                         [% IF ( BIBLIO_RESULT.classification ) %]
188                                             <tr>
189                                                 <th scope="row">Classification</th>
190                                                 <td> [% BIBLIO_RESULT.classification %]</td>
191                                             </tr>
192                                         [% END %]
194                                         [% IF ( BIBLIO_RESULT.lccn ) %]
195                                             <tr>
196                                                 <th scope="row">LCCN</th>
197                                                 <td> [% BIBLIO_RESULT.lccn %]</td>
198                                             </tr>
199                                         [% END %]
201                                         [% IF BIBLIO_RESULT.MARCURLS.size %]
202                                             <tr>
203                                                 <th scope="row">URL(s)</th>
204                                                 <td>
205                                                    [% FOREACH MARCurl IN BIBLIO_RESULT.MARCURLS %]
206                                                         [% IF MARCurl.part %]<p>[% MARCurl.part %]</p>[% END %]
208                                                         [% IF OPACURLOpenInNewWindow %]
209                                                             <a href="[% MARCurl.MARCURL %]" title="[% MARCurl.MARCURL %]" target="_blank" rel="noreferrer">[% MARCurl.linktext %]</a>
210                                                         [% ELSE %]
211                                                             <a href="[% MARCurl.MARCURL %]" title="[% MARCurl.MARCURL %]">[% MARCurl.linktext %]</a>
212                                                         [% END %]
214                                                         [% IF MARCurl.notes %][% FOREACH note IN MARCurl.notes %]<p>[% note.note %]</p>[% END %][% END %]
215                                                     [% END %]
216                                                 </td>
217                                             </tr>
218                                         [% END %]
220                                         <tr>
221                                             <th scope="row">Location(s) (Status)</th>
222                                             <td>
223                                                 [% IF ( BIBLIO_RESULT.ITEM_RESULTS ) %]
224                                                     <ul>
225                                                         [% FOREACH ITEM_RESULT IN BIBLIO_RESULT.ITEM_RESULTS %]
226                                                             <li>
227                                                                 <strong>[% ITEM_RESULT.branchname %]</strong>[% IF ( ITEM_RESULT.location_opac ) %], [% ITEM_RESULT.location_opac %][% END %]
228                                                                 [% IF ( ITEM_RESULT.itemcallnumber ) %]
229                                                                     ([% ITEM_RESULT.itemcallnumber %])
230                                                                 [% END %]
231                                                                 ([% INCLUDE 'item-status.inc' item = ITEM_RESULT %])
232                                                             </li>
233                                                         [% END %]
234                                                     </ul>
235                                                 [% ELSE %]
236                                                     This record has no items.
237                                                 [% END %]
238                                             </td>
239                                         </tr>
240                                     </table>
241                                 [% END # / FOREACH BIBLIO_RESULT %]
242                             </form>
244                         [% ELSE %]
246                             <form action="/cgi-bin/koha/opac-basket.pl" method="get" name="bookbag_form" id="bookbag_form" class="checkboxed">
247                                 <table id="itemst" class="table table-bordered table-striped">
248                                     <thead>
249                                         <tr>
250                                             [% UNLESS ( print_basket ) %]<th>&nbsp;</th>[% END %]
251                                             <th>Title</th>
252                                             <th>Author</th>
253                                             <th>Year</th>
254                                             <th>Location (Status)</th>
255                                         </tr>
256                                     </thead>
257                                     <tbody>
258                                     [% FOREACH BIBLIO_RESULT IN BIBLIO_RESULTS %]
259                                         <tr>
260                                             [% UNLESS ( print_basket ) %]
261                                                 <td>
262                                                 <input type="checkbox" class="cb" value="[% BIBLIO_RESULT.biblionumber %]" name="bib[% BIBLIO_RESULT.biblionumber %]" id="bib[% BIBLIO_RESULT.biblionumber %]">
263                                                 </td>
264                                             [% END %]
265                                             <td>
266                                                 <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>
267                                                 <!-- COinS / Openurl -->
268                                                 <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>
269                                                 [% IF ( TagsInputEnabled && loggedinusername ) %]
270                                                 <span id="newtag[% BIBLIO_RESULT.biblionumber %]_status" class="tagstatus results_summary" style="display:none">Tag status here.</span>
271                                                 [% END %]
272                                             </td>
273                                             <td>[% BIBLIO_RESULT.author %]</td>
274                                             <td>
275                                                 [% IF ( BIBLIO_RESULT.publicationyear ) %]
276                                                     [% BIBLIO_RESULT.publicationyear %]
277                                                 [% ELSE %]
278                                                     [% BIBLIO_RESULT.copyrightdate %]
279                                                 [% END %]
280                                             </td>
281                                             <td>[% IF ( BIBLIO_RESULT.ITEM_RESULTS ) %]<ul>[% FOREACH ITEM_RESULT IN BIBLIO_RESULT.ITEM_RESULTS %]
282                                                 <li>
283                                                     [% ITEM_RESULT.branchname %][% IF ( ITEM_RESULT.location_opac ) %], [% ITEM_RESULT.location_opac %][% END %]
284                                                     [% IF ( ITEM_RESULT.itemcallnumber ) %]
285                                                         ([% ITEM_RESULT.itemcallnumber %])
286                                                     [% END %]
287                                                     ([% INCLUDE 'item-status.inc' item = ITEM_RESULT %])
288                                                 </li>
289                                                 [% END %]</ul>[% ELSE %]This record has no items.[% END %]
290                                             </td>
291                                         </tr>
292                                     [% END # / FOREACH BIBLIO_RESULT %]
293                                     </tbody>
294                                 </table>
295                             </form>
296                         [% END # / verbose %]
298                         [% UNLESS ( print_basket ) %]
299                             <form name="myform" action="opac-basket.pl" method="get">
300                                 <input type="hidden" name="records" id="records" />
301                             </form>
302                         [% END %]
304                 </div> <!-- / #userbasket -->
305             </div> <!-- / .span10 -->
306         </div> <!-- / .row-fluid -->
307     </div> <!-- / .container-fluid -->
308 </div> <!-- / .main -->
310 [% INCLUDE 'opac-bottom.inc' %]
312 [% BLOCK jsinclude %]
313     [% IF ( print_basket ) %]
314         <script type="text/javascript">
315             //<![CDATA[
316                 $(document).ready(function(){
317                     print();
318                     location.href="/cgi-bin/koha/opac-basket.pl?bib_list=[% bib_list %][% IF ( verbose ) %]&verbose=1[% END %]";
319                 });
320             //]]>
321         </script>
322     [% ELSE %]
323         <script type="text/javascript" src="[% interface %]/[% theme %]/lib/jquery/plugins/jquery.checkboxes.min.js"></script>
324         [% INCLUDE 'datatables.inc' %]
325         <script type="text/javascript">
326             //<![CDATA[
328             [% IF ( TagsInputEnabled && loggedinusername ) %]
329                 function tagSelected() {
330                     var bibs = document.getElementById('records').value;
331                     if (bibs) {
332                         $("#tagsel_tag").hide();
333                         $("#tag_hides").hide();
334                         $("#tagsel_form").show();
335                     } else {
336                         alert(MSG_NO_RECORD_SELECTED);
337                     }
338                 }
340                 function tagCanceled() {
341                     $("#tagsel_form").hide();
342                     $("#tagsel_tag").show();
343                     $("#tag_hides").show();
344                     $("#tagsel_new").val("");
345                     $(".tagstatus").empty().hide();
346                 }
348                 function tagAdded() {
349                     var checkedBoxes = $("input:checkbox:checked");
350                     if (!$(checkedBoxes).size()) {
351                         alert(MSG_NO_RECORD_SELECTED);
352                         return false;
353                     }
355                     var tag = $("#tagsel_new").val();
356                     if (!tag || (tag == "")) {
357                         alert(MSG_NO_TAG_SPECIFIED);
358                         return false;
359                     }
361                     var bibs = [];
362                     for (var i = 0; i < $(checkedBoxes).size(); i++) {
363                         var box = $(checkedBoxes).get(i);
364                         bibs[i] = $(box).val();
365                     }
367                     KOHA.Tags.add_multitags_button(bibs, tag);
368                     return false;
369                 }
370             [% END # / TagsInputEnabled && loggedinusername %]
372             $(document).ready(function(){
373                 $(".brief").click(function(){
374                     showLess();
375                     return false;
376                 });
378                 $(".detail").click(function(){
379                     showMore();
380                     return false;
381                 });
383                 $(".send").click(function(){
384                     sendBasket();
385                     return false;
386                 });
388                 $(".download").click(function(){
389                     downloadBasket();
390                     return false;
391                 });
393                 $(".print-large").click(function(){
394                     e.preventDefault();
395                     printBasket();
396                     return false;
397                 });
399                 $(".empty").click(function(){
400                     delBasket();
401                     return false;
402                 });
404                 $(".deleteshelf").click(function(){
405                     delSelRecords();
406                     return false;
407                 });
409                 $(".newshelf").click(function(){
410                     addSelToShelf();
411                     return false;
412                 });
414                 $(".hold").click(function(){
415                     holdSel();
416                     return false;
417                 });
419                 $("#tagsel_tag").click(function(){
420                     tagSelected();
421                     return false;
422                 });
424                 $("#tagsel_button").click(function(){
425                     tagAdded();
426                     return false;
427                 });
429                 $("#tagsel_cancel").click(function(){
430                     tagCanceled();
431                     return false;
432                 });
434                 $("#CheckAll").click(function(){
435                     var checked = [];
436                     $(".checkboxed").checkCheckboxes("*", true).each(
437                         function() {
438                             selRecord(this.value,true);
439                         }
440                     );
441                     enableCheckboxActions();
442                     return false;
443                 });
445                 $("#CheckNone").click(function(){
446                     var checked = [];
447                     $(".checkboxed").unCheckCheckboxes("*",true).each(
448                         function() {
449                             selRecord(this.value,false);
450                         }
451                     );
452                     enableCheckboxActions();
453                     return false;
454                 });
456                 $("#itemst").dataTable($.extend(true, {}, dataTablesDefaults, {
457                     "aaSorting": [[ 1, "asc" ]],
458                     "aoColumnDefs": [
459                       { "aTargets": [ 0,-1 ], "bSortable": false, "bSearchable": false }
460                     ],
461                     "aoColumns": [
462                         null,
463                         { "sType": "anti-the" },
464                         null,
465                         null,
466                         null
467                     ]
468                 }));
470                 $(".cb").change(function(){
471                     if ($(this).prop("checked")){
472                         selRecord($(this).val(), true);
473                     }
474                     enableCheckboxActions();
475                     return false;
476                 });
477             });
479             function enableCheckboxActions(){
480                 // Enable/disable controls if checkboxes are checked
481                 var checkedBoxes = $(".checkboxed input:checkbox:checked");
482                 if ($(checkedBoxes).size()) {
483                   $("#selections").html(_("With selected titles: "));
484                   $("#selections-toolbar .links a").removeClass("disabled");
485                 } else {
486                   $("#selections").html(_("Select titles to: "));
487                   $("#selections-toolbar .links a").addClass("disabled");
488                 }
489             }
490             //]]>
491         </script>
492     [% END # / IF print_basket %]
493 [% END # / BLOCK jsinclude %]