Bug 31379: Change results per page text for default
[koha.git] / koha-tmpl / opac-tmpl / bootstrap / en / modules / opac-shelves.tt
1 [% USE raw %]
2 [% USE Asset %]
3 [% USE Koha %]
4 [% USE AdditionalContents %]
5 [% SET OpacNav = AdditionalContents.get( location => "OpacNav", lang => lang, library => logged_in_user.branchcode || default_branch, blocktitle => 0 ) %]
6 [% SET OpacNavBottom = AdditionalContents.get( location => "OpacNavBottom", lang => lang, library => logged_in_user.branchcode || default_branch, blocktitle => 0 ) %]
7 [% SET TagsShowEnabled = ( ( Koha.Preference( 'TagsEnabled' ) == 1 ) && Koha.Preference('TagsShowOnList') ) %]
8 [% SET TagsInputEnabled = ( ( Koha.Preference( 'opacuserlogin' ) == 1 ) && ( Koha.Preference( 'TagsEnabled' ) == 1 ) && Koha.Preference('TagsInputOnList') ) %]
9
10 [% BLOCK delete_shelf %]
11     <form action="/cgi-bin/koha/opac-shelves.pl" method="post" id="deleteshelf[% shelf.shelfnumber | html %]" class="d-inline">
12         <input type="hidden" name="op" value="delete" />
13         <input type="hidden" name="referer" value="list" />
14         <input type='hidden' name='public' value='[% public | html %]' />
15         <input type="hidden" name="shelfnumber" value="[% shelf.shelfnumber | html %]" />
16         <button type="submit" class="btn btn-link remove deleteshelf" data-shelfnumber="[% shelf.shelfnumber | html %]" data-shelfname="[% shelf.shelfname | html %]" data-shared="[% shelf.is_shared | html %]" data-count="[% contents.count | html %]">
17             <i class="fa fa-remove" aria-hidden="true"></i>
18             [% IF ( context == "list" ) %]
19                 Delete
20             [% ELSE %]
21                 Delete list
22             [% END %]
23         </button>
24     </form>
25 [% END %]
26
27 [% INCLUDE 'doc-head-open.inc' %]
28 <title>[% IF op == 'view' %]Contents of [% shelf.shelfname | html %][% ELSE %]Your lists[% END %] &rsaquo; [% IF ( LibraryNameTitle ) %][% LibraryNameTitle | html %][% ELSE %]Koha online[% END %] catalog</title>
29 [% INCLUDE 'doc-head-close.inc' %]
30 [% BLOCK cssinclude %][% END %]
31 </head>
32 [% IF ( loggedinusername ) %]
33     [% INCLUDE 'bodytag.inc' bodyid='opac-userlists' bodyclass='scrollto' %]
34 [% ELSE %]
35     [% INCLUDE 'bodytag.inc' bodyid='opac-lists' bodyclass='scrollto' %]
36 [% END %]
37
38 [% BLOCK list_permissions %]
39     <li>
40         <label for="allow_changes_from">Allow changes to contents from: </label>
41         <select name="allow_changes_from" id="allow_changes_from" onchange="AdjustRemark()">
42
43             [% IF shelf.allow_change_from_owner %]<option value="0">Nobody</option>[% ELSE %]<option value="0" selected="selected">Nobody</option>[% END %]
44
45             [% IF shelf.allow_change_from_owner && (( !shelf.is_public && !shelf.is_shared ) || !shelf.allow_change_from_others ) %]
46                 <option value="1" selected="selected">Owner only</option>
47             [% ELSE %]
48                 <option value="1">Owner only</option>
49             [% END %]
50
51             [% IF shelf.allow_change_from_others %]<option value="2" selected="selected">Anyone seeing this list</option>[% ELSE %]<option value="2">Anyone seeing this list</option>[% END %]
52
53             [% IF staffuser == 1 %][% IF shelf.allow_change_from_staff %]<option value="3" selected="selected">Staff only</option>[% ELSE %]<option value="3">Staff only</option>[% END %][% END %]
54
55         </select>
56         &emsp; <span id="anyone_remark" style="display:none;color:red;">The "Anyone" permission has no actual effect while this list is strictly private.</span>
57         &emsp; <span id="staff_remark" style="display:none;color:red;">The "Staff only" permission has no actual effect while this list is strictly private.</span>
58     </li>
59 [% END %]
60
61 [% INCLUDE 'masthead.inc' %]
62 <div class="main">
63     <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumbs">
64         <ol class="breadcrumb">
65             <li class="breadcrumb-item">
66                 <a href="/cgi-bin/koha/opac-main.pl">Home</a>
67             </li>
68             [% IF ( loggedinusername ) %]
69                 <li class="breadcrumb-item">
70                     <a href="/cgi-bin/koha/opac-user.pl">[% INCLUDE 'patron-title.inc' patron = logged_in_user %]</a>
71                 </li>
72             [% END %]
73
74             [% IF op != 'list' %]
75                 <li class="breadcrumb-item">
76                     <a href="/cgi-bin/koha/opac-shelves.pl">Lists</a>
77                 </li>
78             [% ELSE %]
79                 <li class="breadcrumb-item active">
80                     <a href="#" aria-current="page">Lists</a>
81                 </li>
82             [% END %]
83
84             [% IF shelf and shelf.is_private %]
85                 [% IF op == 'view' OR op == 'edit_form' %]
86                     <li class="breadcrumb-item">
87                         <a href="/cgi-bin/koha/opac-shelves.pl?op=list&amp;public=0">Your lists</a>
88                     </li>
89                 [% ELSE %]
90                     <li class="breadcrumb-item active">
91                         <a href="#" aria-current="page">Your lists</a>
92                     </li>
93                 [% END %]
94             [% ELSIF shelf AND shelf.is_public %]
95                 [% IF op == 'view' %]
96                     <li class="breadcrumb-item">
97                         <a href="/cgi-bin/koha/opac-shelves.pl?op=list&amp;public=1">Public lists</a>
98                     </li>
99                 [% ELSE %]
100                     <li class="breadcrumb-item active">
101                         <a href="#" aria-current="page">Public lists</a>
102                     </li>
103                 [% END %]
104             [% END %]
105
106             [% IF op == 'view' %]
107                 <li class="breadcrumb-item active">
108                     <a href="#" aria-current="page">Contents of &nbsp;<em>[% shelf.shelfname | html %]</em></a>
109                 </li>
110             [% END %]
111
112             [% IF op == 'add_form' %]
113                 <li class="breadcrumb-item active">
114                     <a href="#" aria-current="page">Create new list</a>
115                 </li>
116             [% END %]
117
118             [% IF op == 'edit_form' %]
119                 <li class="breadcrumb-item active">
120                     <a href="#" aria-current="page">Edit list &nbsp;<em>[% shelf.shelfname | html %]</em></a>
121                 </li>
122             [% END %]
123         </ol> <!-- / .breadcrumb -->
124     </nav> <!-- /#breadcrumbs -->
125
126     <div class="container-fluid">
127         <div class="row">
128             [% IF ( OpacNav||loggedinusername ) %]
129                 <div class="col col-lg-2 order-2 order-lg-1">
130                     <div id="navigation">
131                         [% INCLUDE 'navigation.inc' IsPatronPage=1 %]
132                     </div>
133                 </div>
134                 <div class="col-md-12 col-lg-10 order-1">
135             [% ELSE %]
136                 <div class="col order-first order-md-first order-lg-2">
137             [% END %]
138
139                 <div id="usershelves" class="maincontent">
140
141                     [% FOR m IN messages %]
142                         [% SWITCH m.type %]
143                             [% CASE 'message' %]
144                                 <div class="alert alert-success" role="alert">
145                             [% CASE 'error' %]
146                                 <div class="alert alert-danger" role="alert">
147                         [% END %]
148                         [% SWITCH m.code %]
149                         [% CASE 'error_on_update' %]
150                             <span>An error occurred when updating this list.</span>
151                         [% CASE 'error_on_insert' %]
152                             <span>An error occurred when creating this list.</span>
153                         [% CASE 'error_on_delete' %]
154                             <span>An error occurred when deleting this list.</span>
155                         [% CASE 'error_on_add_biblio' %]
156                             <span>The item has not been added to the list. Please check it's not already in the list.</span>
157                         [% CASE 'error_on_remove_share' %]
158                             <span>The share has not been removed.</span>
159                         [% CASE 'no_email_found' %]
160                             <span>No email found for the patrons that accepted the share</span>
161                         [% CASE 'success_on_update' %]
162                             <span>List updated.</span>
163                         [% CASE 'success_on_insert' %]
164                             <span>List created.</span>
165                         [% CASE 'success_on_delete' %]
166                             <span>List deleted.</span>
167                         [% CASE 'success_on_add_biblio' %]
168                             <span>The item has been added to the list.</span>
169                         [% CASE 'success_on_remove_biblios' %]
170                             <span>The item has been removed from the list.</span>
171                         [% CASE 'success_on_remove_share' %]
172                             <span>The share has been removed.</span>
173                         [% CASE 'does_not_exist' %]
174                             <span>This list does not exist.</span>
175                         [% CASE 'item_does_not_exist' %]
176                             <span>This item does not exist.</span>
177                         [% CASE 'unauthorized_on_view' %]
178                             <span>You do not have permission to view this list.</span>
179                         [% CASE 'unauthorized_on_insert' %]
180                             <span>You do not have permission to create a new list.</span>
181                         [% CASE 'unauthorized_on_update' %]
182                             <span>You do not have permission to update this list.</span>
183                         [% CASE 'unauthorized_on_delete' %]
184                             <span>You do not have permission to delete this list.</span>
185                         [% CASE 'unauthorized_on_add_biblio' %]
186                             <span>You do not have permission to add a record to this list.</span>
187                         [% CASE 'unauthorized_transfer' %]
188                             <span>You do not have permission to transfer ownership of this list.</span>
189                         [% CASE 'no_biblio_removed' %]
190                             <span>No record was removed.</span>
191                         [% CASE 'new_owner_not_found' %]
192                             <span>The new owner could not be found anymore.</span>
193                         [% CASE 'new_owner_has_no_share' %]
194                             <span>The new owner has no share for this list.</span>
195
196                         [% CASE 'Koha::Exceptions::Virtualshelf::DuplicateObject' %]
197                             <span>An error occurred when creating the list. The name [% shelfname | html %] already exists.</span>
198                         [% CASE 'DBIx::Class::Exception' %]
199                             [% m.msg | html %]
200                         [% CASE %]
201                             [% m.code | html %]
202                             [% m.msg | html %]
203                         [% END %]
204                         </div>
205                     [% END %]
206
207                     [% IF shelf AND op == 'view' %]
208                         <h1>
209                             [% shelf.shelfname | html %]
210                             [%  IF ( public ) %]
211                                 <a href="[% OPACBaseURL | url %]/cgi-bin/koha/opac-shelves.pl?rss=1&amp;op=view&amp;shelfnumber=[% shelf.shelfnumber | uri %]" class="rss-list-link noprint" aria-label="Subscribe to this list">
212                                     <i class="fa fa-fw fa-rss rsssearchicon" aria-hidden="true" title="Subscribe to this list"></i>
213                                 </a>
214                             [% END %]
215                         </h1>
216
217                         [% IF ( itemsloop ) %]
218                             [% SET contents = shelf.get_contents %]
219                             [% IF ( contents.count ) %]<p>This list contains [% contents.count | html %] titles</p>[% END %]
220                             <div id="floating">
221                                 <div id="toolbar" class="toolbar clearfix">
222                                     <div class="list-actions">
223                                         <a class="btn btn-link newshelf" href="/cgi-bin/koha/opac-shelves.pl?op=add_form"><i class="fa fa-fw fa-plus" aria-hidden="true"></i> New list</a> <span class="sep">|</span>
224
225                                         <div id="download-list" class="btn-group dropdown">
226                                             <a id="format" class="btn btn-link dropdown-toggle" data-toggle="dropdown" href="/cgi-bin/koha/opac-downloadshelf.pl?shelfnumber=[% shelf.shelfnumber | html %]"><i class="fa fa-fw fa-download" aria-hidden="true"></i> Download <b class="caret"></b></a>
227                                             <div class="dropdown-menu pull-left" role="menu" aria-labelledby="format">
228                                                 <a role="menuitem" class="dropdown-item download-list" data-format="bibtex" href="#">BibTeX</a>
229                                                 [% IF Koha.Preference('OPACISBD') %]<a role="menuitem" class="dropdown-item download-list" data-format="isbd" href="#">ISBD</a>[% END %]
230                                                 <a role="menuitem" class="dropdown-item download-list" data-format="iso2709" href="#">MARC</a>
231                                                 <a role="menuitem" class="dropdown-item download-list" data-format="ris" href="#">RIS (Zotero, EndNote, others)</a>
232                                                 [% FOREACH csv_profile IN csv_profiles %]
233                                                     <a role="menuitem" class="dropdown-item download-list" data-format="[% csv_profile.export_format_id | html %]" href="#">CSV - [% csv_profile.profile | html %]</a>
234                                                 [% END %]
235                                             </div>
236                                         </div>
237
238                                         [% IF Koha.Preference( 'opacuserlogin' ) == 1 %]
239                                             <span class="sendlist"><a href="/cgi-bin/koha/opac-sendshelf.pl?shelfid=[% shelf.shelfnumber | uri %]" class="btn btn-link send" onclick="open('/cgi-bin/koha/opac-sendshelf.pl?shelfid=[% shelf.shelfnumber | html %]','win_form','scrollbars=yes,resizable=yes,height=400,width=500,top=50,left=100'); return false; "><i class="fa fa-fw fa-envelope" aria-hidden="true"></i> Send list</a></span>
240                                         [% END %]
241
242                                         <a class="btn btn-link print-small" target="_blank" href="/cgi-bin/koha/opac-shelves.pl?op=view&amp;shelfnumber=[% shelf.shelfnumber | html %]&sortfield=[% sortfield | html %]&direction=[% direction | uri %]&print=1"><i class="fa fa-fw fa-print" aria-hidden="true"></i> Print list</a>
243
244                                         [% IF can_manage_shelf %]
245                                             <span class="sep">|</span>
246                                             <form method="get" action="/cgi-bin/koha/opac-shelves.pl" class="d-inline">
247                                                 <input type="hidden" name="op" value="edit_form" />
248                                                 <input type="hidden" name="referer" value="view" />
249                                                 <input type='hidden' name='public' value='[% shelf.public | html %]' />
250                                                 <input type="hidden" name="shelfnumber" value="[% shelf.shelfnumber | html %]" />
251                                                 <button type="submit" class="btn btn-link editshelf"><i class="fa fa-fw fa-pencil-square-o" aria-hidden="true"></i> Edit list</button>
252                                             </form>
253
254                                             [% PROCESS delete_shelf context = "details" %]
255
256                                             [% IF !public && Koha.Preference('OpacAllowSharingPrivateLists') %]
257                                                 <a href="/cgi-bin/koha/opac-shareshelf.pl?op=invite&shelfnumber=[% shelf.shelfnumber | uri %]" class="btn btn-link sharelist"><i class="fa fa-fw fa-share" aria-hidden="true"></i> Share list</a>
258                                             [% END %]
259                                         [% ELSIF !public # not manageshelf and private means shared %]
260                                             <form action="/cgi-bin/koha/opac-shelves.pl" method="post" id="unshare[% shelf.shelfnumber | html %]" class="d-inline">
261                                                 <input type="hidden" name="op" value="remove_share" />
262                                                 <input type="hidden" name="referer" value="list" />
263                                                 <input type='hidden' name='public' value='[% public | html %]' />
264                                                 <input type="hidden" name="shelfnumber" value="[% shelf.shelfnumber | html %]" />
265                                                 <button type="submit" class="btn btn-link remove remove_share" data-shelfname="[% shelf.shelfname | html %]" data-shelfnumber="[% shelf.shelfnumber | html %]">
266                                                     <i class="fa fa-remove" aria-hidden="true"></i> Remove share
267                                                 </button>
268                                             </form>
269                                         [% END # /IF can_manage_shelf %]
270                                     </div> <!-- /.list-actions -->
271
272                                     <form action="/cgi-bin/koha/opac-shelves.pl" id="sorting-form" class="d-inline sort_by pull-right">
273                                         <input type="hidden" name="op" value="view" />
274                                         <input type="hidden" name="shelfnumber" value="[% shelf.shelfnumber | html %]" />
275
276                                         <label for="sortfield">Sort by: </label>
277                                         <select name="sortfield" id="sortfield" class="resort">
278                                             <option value="">Default sorting</option>
279                                             <optgroup label="Author">
280                                                 [% IF sortfield == 'author' && direction == 'asc' %]
281                                                     <option value="author" data-direction="asc" selected="selected">Author (A-Z)</option>
282                                                 [% ELSE %]
283                                                     <option value="author" data-direction="asc">Author (A-Z)</option>
284                                                 [% END %]
285                                                 [% IF sortfield == 'author' && direction == 'desc' %]
286                                                     <option value="author" data-direction="desc" selected="selected">Author (Z-A)</option>
287                                                 [% ELSE %]
288                                                     <option value="author" data-direction="desc">Author (Z-A)</option>
289                                                 [% END %]
290                                             </optgroup>
291                                             <optgroup label="Title">
292                                                 [% IF sortfield == 'title' && direction == 'asc' %]
293                                                     <option value="title" data-direction="asc" selected="selected">Title (A-Z)</option>
294                                                 [% ELSE %]
295                                                     <option value="title" data-direction="asc">Title (A-Z)</option>
296                                                 [% END %]
297                                                 [% IF sortfield == 'title' && direction == 'desc' %]
298                                                     <option value="title" data-direction="desc" selected="selected">Title (Z-A)</option>
299                                                 [% ELSE %]
300                                                     <option value="title" data-direction="desc">Title (Z-A)</option>
301                                                 [% END %]
302                                             </optgroup>
303                                             <optgroup label="Call number">
304                                                 [% IF sortfield == 'itemcallnumber' && direction == 'asc' %]
305                                                     <option value="itemcallnumber" data-direction="asc" selected="selected">Call number (A-Z)</option>
306                                                 [% ELSE %]
307                                                     <option value="itemcallnumber" data-direction="asc">Call number (A-Z)</option>
308                                                 [% END %]
309                                                 [% IF sortfield == 'itemcallnumber' && direction == 'desc' %]
310                                                     <option value="itemcallnumber" data-direction="desc" selected="selected">Call number (Z-A)</option>
311                                                 [% ELSE %]
312                                                     <option value="itemcallnumber" data-direction="desc">Call number (Z-A)</option>
313                                                 [% END %]
314                                             </optgroup>
315                                             <optgroup label="Copyright date">
316                                                 [% IF sortfield == 'copyrightdate' && direction == 'asc' %]
317                                                     <option value="copyrightdate" data-direction="desc" selected="selected">Copyright date (newest to oldest)</option>
318                                                 [% ELSE %]
319                                                     <option value="copyrightdate" data-direction="desc">Copyright date (newest to oldest)</option>
320                                                 [% END %]
321                                                 [% IF sortfield == 'copyrightdate' && direction == 'desc' %]
322                                                     <option value="copyrightdate" data-direction="asc" selected="selected">Copyright date (oldest to newest)</option>
323                                                 [% ELSE %]
324                                                     <option value="copyrightdate" data-direction="asc">Copyright date (oldest to newest)</option>
325                                                 [% END %]
326                                             </optgroup>
327                                             <optgroup label="Date added">
328                                                 [% IF sortfield == "dateadded" && direction == 'asc' %]
329                                                     <option value="dateadded" data-direction="desc" selected="selected">Date added (newest to oldest)</option>
330                                                 [% ELSE %]
331                                                     <option value="dateadded" data-direction="desc">Date added (newest to oldest)</option>
332                                                 [% END %]
333                                                 [% IF sortfield == "dateadded" && direction == 'desc' %]
334                                                     <option value="dateadded" data-direction="asc" selected="selected">Date added (oldest to newest)</option>
335                                                 [% ELSE %]
336                                                     <option value="dateadded" data-direction="asc">Date added (oldest to newest)</option>
337                                                 [% END %]
338                                             </optgroup>
339                                         </select>
340
341                                         <input type="submit" class="btn btn-primary btn-sm" id="sort-submit" value="Resort list" />
342                                     </form> <!-- /#sorting-form -->
343
344                                 </div> <!-- / #toolbar -->
345
346                                 <div class="selections-toolbar toolbar noprint">
347                                     <div class="check_control">
348                                         <span class="checkall">
349                                             <a id="CheckAll" class="btn btn-link btn-sm" href="#">Select all</a>
350                                         </span>
351                                         <span class="clearall">
352                                             <a id="CheckNone" class="btn btn-link btn-sm" href="#">Clear all</a>
353                                         </span>
354                                     </div>
355                                     <div class="links">
356                                         <span class="selections">Select titles to: </span>
357                                         [% IF ( ( Koha.Preference( 'opacuserlogin' ) == 1 ) && ( Koha.Preference( 'OPACHoldRequests' ) == 1 ) ) %]
358                                             <span id="placehold">
359                                                 <a href="#" class="btn btn-link hold tag_hides disabled"><i class="fa fa-fw fa-bookmark" aria-hidden="true"></i> Place hold</a>
360                                             </span>
361                                         [% END %]
362
363                                         [% IF ( TagsInputEnabled && loggedinusername ) %]
364                                             <span id="addtags">
365                                                 <a id="tagsel_tag" href="#" class="btn btn-link disabled"><i class="fa fa-fw fa-tag" aria-hidden="true"></i> Tag</a>
366                                             </span>
367                                             <span id="tagsel_form" class="form-inline" style="display:none">
368                                                 <label for="tagsel_new">New tag(s), separated by a comma:</label>
369                                                 <input class="form-control form-control-sm" type="text" name="tagsel_new" id="tagsel_new" maxlength="100" />
370                                                 <input id="tagsel_button" name="tagsel_button" class="tagsel_button btn btn-primary btn-sm" title="tagsel_button" type="submit" value="Add" />
371                                                 <a href="#" id="tagsel_cancel">Cancel</a>
372                                             </span>
373                                         [% END %]
374                                         [% IF loggedinusername && can_remove_biblios %]
375                                             <span id="removeitems"></span>
376                                         [% END %]
377                                     </div> <!-- / .links -->
378                                 </div> <!-- / .selections-toolbar -->
379                             </div> <!-- /#floating -->
380
381                             <form action="/cgi-bin/koha/opac-shelves.pl" method="post" id="myform" name="myform">
382                                 [% IF can_manage_shelf %]
383                                     <input type="hidden" name="op" value="remove_biblios" />
384                                     <input type="hidden" name="shelfnumber" value="[% shelf.shelfnumber | html %]" />
385                                 [% END %]
386                                 <div class="searchresults">
387                                     <table id="listcontents" class="table">
388                                         <tbody>
389                                             [% FOREACH itemsloo IN itemsloop %]
390                                                 <tr>
391                                                     [% IF ( itemsloo.title ) %]
392                                                         [% check_title = itemsloo.title %]
393                                                     [% ELSE %]
394                                                         [% check_title = itemsloo.biblionumber %]
395                                                     [% END %]
396                                                     <td class="selectcol"><input type="checkbox" class="cb" name="biblionumber" value="[% itemsloo.biblionumber | html %]" aria-label="[% check_title | html %]"/></td>
397                                                     [% UNLESS ( item_level_itypes ) %]
398                                                         <td>
399                                                             [% UNLESS ( Koha.Preference('OpacNoItemTypeImages') ) %]
400                                                                 <img src="[% itemsloo.imageurl | html %]" alt="[% itemsloo.description | html %]" title="[% itemsloo.description | html %]" />
401                                                             [% END %]
402                                                             [% itemsloo.description | html %]
403                                                         </td>
404                                                     [% END %]
405                                                     <td>
406                                                         <div class="coverimages">
407                                                             <a class="p1" href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% itemsloo.biblionumber | html %]">
408                                                                 [% IF ( itemsloo.title ) %]
409                                                                     [% img_title = itemsloo.title %]
410                                                                 [% ELSE %]
411                                                                     [% img_title = itemsloo.biblionumber %]
412                                                                 [% END %]
413
414                                                                 [% IF ( OPACLocalCoverImages ) %]
415                                                                     <span title="[% img_title | html %]" class="[% itemsloo.biblionumber | html %]" id="local-thumbnail[% loop.count | html %]"></span>
416                                                                 [% END %]
417
418                                                                 [% IF ( OPACAmazonCoverImages ) %]
419                                                                     [% IF ( itemsloo.normalized_isbn ) %]
420                                                                         <span title="[% img_title | html %]" id="amazon-thumbnail[% loop.count | html %]"><img src="https://images-na.ssl-images-amazon.com/images/P/[% itemsloo.normalized_isbn | html %].01.TZZZZZZZ.jpg" alt="" /></span>
421                                                                     [% ELSE %]
422                                                                         <span class="no-image">No cover image available</span>
423                                                                     [% END %]
424                                                                 [% END %]
425
426                                                                 [% IF ( SyndeticsEnabled && SyndeticsCoverImages ) %]
427                                                                     <span title="[% img_title | html %]" id="syndetics-thumbnail[% loop.count | html %]"><img src="https://secure.syndetics.com/index.aspx?isbn=[% itemsloo.normalized_isbn | html %]/SC.GIF&amp;client=[% SyndeticsClientCode | html %]&amp;type=xw10&amp;upc=[% itemsloo.normalized_upc | html %]&amp;oclc=[% itemsloo.normalized_oclc | html %]" alt="" /></span>
428                                                                 [% END %]
429
430                                                                 [% IF ( GoogleJackets ) %]
431                                                                     [% IF ( itemsloo.normalized_isbn ) %]
432                                                                         <div title="[% img_title | html %]" class="[% itemsloo.normalized_isbn | html %]" id="gbs-thumbnail[% loop.count | html %]"></div>
433                                                                     [% ELSE %]
434                                                                         <span class="no-image">No cover image available</span>
435                                                                     [% END %]
436                                                                 [% END %]
437
438                                                                 [% IF ( Koha.Preference('OpacCoce') && Koha.Preference('CoceProviders') ) %]
439                                                                     [% coce_id = itemsloo.normalized_ean || itemsloo.normalized_isbn %]
440                                                                     [% IF ( coce_id ) %]
441                                                                         <span title="[% img_title | html %]" class="[% coce_id | html %]" id="coce-thumbnail[% loop.count | html %]"></span>
442                                                                     [% ELSE %]
443                                                                         <span class="no-image">No cover image available</span>
444                                                                     [% END %]
445                                                                 [% END %]
446
447
448                                                                 [% IF OpenLibraryCovers %]
449                                                                     [% IF itemsloo.normalized_isbn %]
450                                                                         <span title="[% img_title | html %]" class="[% itemsloo.normalized_isbn | html %]" id="openlibrary-thumbnail[% loop.count | html %]"></span>
451                                                                     [% ELSE %]
452                                                                         <span class="no-image">No cover image available</span>
453                                                                     [% END %]
454                                                                 [% END %]
455
456                                                             </a> <!-- / .p1 -->
457                                                             [% IF ( Koha.Preference('BakerTaylorEnabled') && !Koha.Preference('BakerTaylorBookstoreURL') ) %]
458                                                                 [% bt_id = ( itemsloo.normalized_upc || itemsloo.normalized_isbn ) %]
459                                                                 [% IF ( bt_id ) %]
460                                                                     <img alt="See Baker &amp; Taylor" src="[% BakerTaylorImageURL | html %][% bt_id | html %]" />
461                                                                 [% ELSE %]
462                                                                     <span class="no-image">No cover image available</span>
463                                                                 [% END %]
464                                                             [% END %]
465
466                                                             [% IF ( Koha.Preference('BakerTaylorEnabled') && Koha.Preference('BakerTaylorBookstoreURL') ) %]
467                                                                 [% bt_id = ( itemsloo.normalized_upc || itemsloo.normalized_isbn ) %]
468                                                                 [% IF ( bt_id ) %]
469                                                                     <a href="https://[% Koha.Preference('BakerTaylorBookstoreURL') | uri %][% bt_id | uri %]">
470                                                                         <img alt="See Baker &amp; Taylor" src="[% BakerTaylorImageURL | html %][% bt_id | html %]" />
471                                                                     </a>
472                                                                 [% ELSE %]
473                                                                     <span class="no-image">No cover image available</span>
474                                                                 [% END %]
475                                                             [% END %]
476
477                                                             [% IF Koha.Preference('OPACCustomCoverImages') AND Koha.Preference('CustomCoverImagesURL') %]
478                                                                 [% SET custom_cover_image_url = itemsloo.biblio_object.custom_cover_image_url %]
479                                                                 [% IF custom_cover_image_url %]
480                                                                     <a class="custom_cover_image" href="[% PROCESS biblio_a_href biblionumber => itemsloo.biblionumber %]">
481                                                                     <img alt="Cover image" src="[% custom_cover_image_url | url %]" /></a>
482                                                                 [% END %]
483                                                             [% END %]
484
485                                                         </div>
486
487                                                         [% itemsloo.XSLTBloc | $raw %]
488
489                                                         [% IF ( TagsShowEnabled && itemsloo.TagLoop.size ) %]
490                                                             <div class="results_summary tags">
491                                                                 <span class="label">Tags:</span>
492                                                                 <ul>
493                                                                     [% FOREACH TagLoo IN itemsloo.TagLoop %]
494                                                                         <li><a href="/cgi-bin/koha/opac-search.pl?tag=[% TagLoo.term | uri %]&amp;q=[% TagLoo.term | uri %]">[% TagLoo.term | html %]</a> <span class="weight">([% TagLoo.weight_total | html %])</span></li>
495                                                                     [% END %]
496                                                                 </ul>
497                                                             </div>
498                                                         [% END %]
499
500                                                         [% INCLUDE 'title-actions-menu.inc' items=itemsloo %]
501
502                                                         [% INCLUDE "openlibrary-readapi.inc" bib = itemsloo %]
503                                                         <!-- COinS / Openurl -->
504                                                         <span class="Z3988" title="[% itemsloo.coins | html %]"></span>
505                                                     </td>
506                                                 </tr>
507                                             [% END # / FOREACH itemsloop %]
508                                         </tbody>
509                                     </table> <!-- / #listcontents -->
510                                 </div><!-- / .searchresults -->
511
512                                 [% IF ( pagination_bar ) %]
513                                     <div class="pages">[% pagination_bar | $raw %]</div>
514                                 [% END %]
515
516                                 [% IF can_remove_biblios %]
517                                     <input type="hidden" name="op" value="remove_biblios" />
518                                     <input type="hidden" name="shelfnumber" value="[% shelf.shelfnumber | html %]" />
519                                     <input type="hidden" name="modifyshelfcontents" value="1" />
520                                     <input type="submit" value="Remove selected items" id="remove-selected" class="btn btn-danger"/>
521                                 [% END %]
522                             </form> <!-- /myform -->
523                         [% ELSE %]
524                             <div id="toolbar" class="toolbar clearfix">
525                                 <div class="list-actions">
526                                     <a class="btn btn-link newshelf" href="/cgi-bin/koha/opac-shelves.pl?op=add_form"><i class="fa fa-fw fa-plus" aria-hidden="true"></i> New list</a>
527                                     [% IF can_manage_shelf %]
528                                         <span class="sep">|</span>
529                                         <form method="get" action="/cgi-bin/koha/opac-shelves.pl" class="d-inline">
530                                             <input type="hidden" name="op" value="edit_form" />
531                                             <input type="hidden" name="referer" value="view" />
532                                             <input type="hidden" name="public" value="[% shelf.public | html %]" />
533                                             <input type="hidden" name="shelfnumber" value="[% shelf.shelfnumber | html %]" />
534                                             <button type="submit" class="btn btn-link editshelf"><i class="fa fa-fw fa-pencil-square-o" aria-hidden="true"></i> Edit list</button>
535                                         </form>
536
537                                         [% PROCESS delete_shelf context = "details" %]
538
539                                     [% END %]
540                                 </div> <!-- / .list-actions -->
541                             </div> <!-- / #toolbar -->
542
543                             <div class="alert alert-info">
544                                 <span>This list is empty.</span>
545                                 [% IF Koha.Preference( 'opacuserlogin' ) == 1 %]
546                                     <span>You can add to your lists from the results of any <a href="opac-main.pl">search</a>.</span>
547                                 [% END %]
548                             </div>
549
550                             [% IF can_manage_shelf %]
551                                 <form method="post" action="opac-shelves.pl">
552                                     <input type="hidden" name="op" value="delete" />
553                                     <input type="hidden" name="referer" value="list" />
554                                     <input type="hidden" name="shelfnumber" value="[% shelf.shelfnumber | html %]"/>
555                                     <input type="submit" class="btn btn-danger" value="Delete this list" onclick="return confirmDelete(MSG_CONFIRM_DELETE_LIST)" />
556                                 </form>
557                             [% END %]
558                         [% END # / IF itemsloop %]
559                     [% END # /IF shelf AND op == 'view' %]
560
561                     [% IF op == 'add_form' OR op == 'edit_form' %]
562                         <form method="post" action="/cgi-bin/koha/opac-shelves.pl">
563                             <fieldset class="rows">
564                                 [% IF op == 'add_form' %]
565                                     <div id="addshelf">
566                                         <legend><h1>Create a new list</h1></legend>
567                                     <input type="hidden" name="op" value="add" />
568                                 [% ELSE %]
569                                 <legend><h1>Editing <em>[% shelf.shelfname | html %]</em></h1></legend>
570                                     <input type="hidden" name="op" value="edit" />
571                                     <input type="hidden" name="referer" value="[% referer | html %]" />
572                                     <input type="hidden" name="shelfnumber" value="[% shelf.shelfnumber | html %]" />
573                                 [% END %]
574                                 <input type="hidden" name="owner" id="owner" value="[% loggedinusernumber | html %]" />
575                                 <ol>
576                                     <li>
577                                         <label class="required" for="shelfname">List name: </label>
578                                         <input type="text" id="shelfname" name="shelfname" maxlength="255" value="[% shelf.shelfname | html %]" required="required" class="focus required"/>
579                                         <span class="required">Required</span></li>
580                                     <li>
581                                         <label for="sortfield" >Sort this list by: </label>
582                                         <select name="sortfield" id="sortfield">
583                                             [% IF shelf.sortfield == "title" %]
584                                                 <option value="title" selected="selected">Title</option>
585                                             [% ELSE %]
586                                                 <option value="title">Title</option>
587                                             [% END %]
588                                             [% IF shelf.sortfield == "author" %]
589                                                 <option value="author" selected="selected">Author</option>
590                                             [% ELSE %]
591                                                 <option value="author">Author</option>
592                                             [% END %]
593                                             [% IF shelf.sortfield == "copyrightdate" %]
594                                                 <option value="copyrightdate" selected="selected">Year</option>
595                                             [% ELSE %]
596                                                 <option value="copyrightdate">Year</option>
597                                             [% END %]
598                                             [% IF shelf.sortfield == "itemcallnumber" %]
599                                                 <option value="itemcallnumber" selected="selected">Call number</option>
600                                             [% ELSE %]
601                                                 <option value="itemcallnumber">Call number</option>
602                                             [% END %]
603                                             [% IF shelf.sortfield == "dateadded" %]
604                                                 <option value="dateadded" selected="selected">Date added</option>
605                                             [% ELSE %]
606                                                 <option value="dateadded">Date added</option>
607                                             [% END %]
608                                         </select>
609                                     </li>
610                                     [% IF Koha.Preference('OpacAllowPublicListCreation') OR public == 1 %]
611                                         <li>
612                                             <label for="public">Category:</label>
613                                             <select name="public" id="public" onchange="AdjustRemark()">
614                                                 [% IF shelf.is_private %]
615                                                         <option value="0" selected="selected">Private</option>
616                                                     [% ELSE %]
617                                                         <option value="0">Private</option>
618                                                     [% END %]
619                                                 [% IF shelf.is_public %]
620                                                     <option value="1" selected="selected">Public</option>
621                                                 [% ELSE %]
622                                                     <option value="1">Public</option>
623                                                 [% END %]
624                                             </select>
625                                             [% IF shelf.is_public AND NOT Koha.Preference('OpacAllowPublicListCreation') %]
626                                                 <span class="hint alert alert-info">The library has disabled the ability for patrons to create new public lists.  If you make your list private, you will not be able to make it public again.</span>
627                                             [% END %]
628                                         </li>
629                                     [% END %]
630                                     [% INCLUDE list_permissions %]
631                                 </ol>
632                                 [% UNLESS Koha.Preference('OpacAllowPublicListCreation') OR public == 1 %]
633                                     <input type="hidden" name="public" value="0" />
634                                 [% END %]
635                             </fieldset> <!-- /.rows -->
636
637                             <fieldset class="action">
638                                 <input type="submit" value="Save" class="btn btn-primary" />
639                                 [% IF referer == 'view' %]
640                                     <a href="/cgi-bin/koha/opac-shelves.pl?op=view&amp;shelfnumber=[% shelf.shelfnumber | uri %]" class="cancel">Cancel</a>
641                                 [% ELSE %]
642                                     <a href="/cgi-bin/koha/opac-shelves.pl?op=list" class="cancel">Cancel</a>
643                                 [% END %]
644                             </fieldset>
645                         </form>
646
647                     [% ELSIF op == 'transfer' %]
648                         <h1>Transfer ownership of shared list '[% shelf.shelfname | html %]'</h1>
649                         <br/>
650                         <form action="/cgi-bin/koha/opac-shelves.pl" id="transferform" method="post">
651                         <fieldset>
652                             <input type="hidden" name="op" value="transfer" />
653                             <input type="hidden" name="public" value="0" />
654                             <input type="hidden" name="shelfnumber" value="[% shelf.shelfnumber | html %]" />
655                             <div>
656                                 <label for="find_patron">New owner: </label>
657                                 <select name="new_owner" id="new_owner">
658                                 [% FOREACH sharee IN shared_users %]
659                                     <option value="[% sharee.borrowernumber | html %]" selected="">[% sharee.email | html %]</option>
660                                 [% END %]
661                                 </select>
662                             </div>
663                             <br/>
664                             <fieldset class="action">
665                                 <input type="submit" value="Transfer" class="submit" />
666                                 <a href="/cgi-bin/koha/opac-shelves.pl?op=list&amp;public=0" class="cancel">Cancel</a>
667                             </fieldset>
668                         </fieldset>
669                         </form>
670
671                     [% ELSIF op == 'list' %]
672                         <h1>Lists</h1>
673                         <div class="toptabs ui-tabs ui-widget ui-widget-content ui-corner-all">
674                             <ul class="ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all">
675                                 [% IF Koha.Preference( 'opacuserlogin' ) == 1 %]
676                                     [% IF !public %]
677                                         <li id="privateshelves_tab" class="ui-state-default ui-corner-top ui-tabs-active ui-state-active"><a class="ui-tabs-anchor" href="/cgi-bin/koha/opac-shelves.pl?op=list&amp;public=0">Your lists</a></li>
678                                     [% ELSE %]
679                                         <li id="privateshelves_tab" class="ui-state-default ui-corner-top"><a class="ui-tabs-anchor" href="/cgi-bin/koha/opac-shelves.pl?op=list&amp;public=0">Your lists</a></li>
680                                     [% END %]
681                                 [% END %]
682                                 [% IF public %]
683                                     <li id="publicshelves_tab" class="ui-state-default ui-corner-top ui-tabs-active ui-state-active"><a class="ui-tabs-anchor" href="/cgi-bin/koha/opac-shelves.pl?op=list&amp;public=1">Public lists</a></li>
684                                 [% ELSE %]
685                                     <li id="publicshelves_tab" class="ui-state-default ui-corner-top"><a class="ui-tabs-anchor" href="/cgi-bin/koha/opac-shelves.pl?op=list&amp;public=1">Public lists</a></li>
686                                 [% END %]
687                             </ul>
688
689                             [% IF !public %]
690                                 <div id="privateshelves" class="ui-tabs-panel ui-widget-content ui-corner-bottom" style="display:block;">
691                             [% ELSE %]
692                                 <div id="publicshelves" class="ui-tabs-panel ui-widget-content ui-corner-bottom" style="display:block;">
693                             [% END %]
694
695                             [% IF !public || Koha.Preference('OpacAllowPublicListCreation') %]
696                                 [% IF loggedinusername %]
697                                     <div id="toolbar" class="toolbar"><a class="btn btn-link newshelf" href="/cgi-bin/koha/opac-shelves.pl?op=add_form"><i class="fa fa-plus" aria-hidden="true"></i> New list</a></div>
698                                 [% ELSE %]
699                                     [% IF Koha.Preference( 'opacuserlogin' ) == 1 %]
700                                         <div class="alert alert-info"><a href="/cgi-bin/koha/opac-shelves.pl?op=add_form">Log in to create a new list</a></div>
701                                     [% END %]
702                                 [% END %]
703                             [% END %]
704
705                             [% IF shelves.count %]
706                                 <table class="table">
707                                     [% IF !public %]
708                                     <caption class="sr-only">Your lists</caption>
709                                     [% ELSIF public %]
710                                     <caption class="sr-only">Public lists</caption>
711                                     [% END %]
712                                     <thead>
713                                         <tr>
714                                             <th>List name</th>
715                                             <th>Contents</th>
716                                             <th>Type</th>
717                                             <th>&nbsp;</th>
718                                         </tr>
719                                     </thead>
720                                     <tbody>
721                                         [% FOREACH s IN shelves %]
722                                             [% SET contents = s.get_contents %]
723                                             <tr>
724                                                 <td><a href="/cgi-bin/koha/opac-shelves.pl?op=view&amp;shelfnumber=[% s.shelfnumber | uri %]">[% s.shelfname | html %]</a></td>
725                                                 <td>[% IF contents.count %][% contents.count | html %] [% IF contents.count == 1 %]<span>item</span>[% ELSE %]<span>items</span>[% END %][% ELSE %]<span>Empty</span>[% END %]</td>
726                                                 <td>
727                                                     [% IF s.is_private %]
728                                                         [% IF s.is_shared %]<span>Shared</span>[% ELSE %]<span>Private</span>[% END %]
729                                                     [% ELSE %]
730                                                         <span>Public</span>
731                                                     [% END %]
732                                                 </td>
733                                                 <td>
734                                                     [% IF s.can_be_managed( loggedinusernumber ) %]
735                                                         <form action="/cgi-bin/koha/opac-shelves.pl" method="get" class="d-inline">
736                                                             <input type="hidden" name="shelfnumber" value="[% s.shelfnumber | html %]" />
737                                                             <input type="hidden" name="public" value="[% s.public | html %]" />
738                                                             <input type="hidden" name="op" value="edit_form" />
739                                                             <input type="hidden" name="referer" value="list" />
740                                                             <button type="submit" class="btn btn-link editshelf"><i class="fa fa-pencil-square-o" aria-hidden="true"></i> Edit</button>
741                                                         </form>
742                                                     [% END %]
743                                                     [% IF s.can_be_deleted( loggedinusernumber ) %]
744                                                         [% PROCESS delete_shelf shelf = s context = "list" %]
745                                                     [% END %]
746                                                     [% IF s.is_private AND s.can_be_managed( loggedinusernumber ) AND Koha.Preference('OpacAllowSharingPrivateLists') %]
747                                                         <a href="/cgi-bin/koha/opac-shareshelf.pl?op=invite&shelfnumber=[% s.shelfnumber | uri %]" class="sharelist btn btn-link"><i class="fa fa-share" aria-hidden="true"></i> Share</a>
748                                                     [% END %]
749                                                     [% IF s.is_shared AND s.can_be_managed( loggedinusernumber ) %]
750                                                         <form action="/cgi-bin/koha/opac-shelves.pl" method="get" class="d-inline">
751                                                             <input type="hidden" name="shelfnumber" value="[% s.shelfnumber | html %]" />
752                                                             <input type="hidden" name="public" value="0" />
753                                                             <input type="hidden" name="op" value="transfer" />
754                                                             <input type="hidden" name="referer" value="list" />
755                                                             <button type="submit" class="btn btn-link transfershelf"> Transfer</button>
756                                                         </form>
757                                                     [% END %]
758                                                     [% IF s.is_shared_with( loggedinusernumber ) %]
759                                                         <form action="opac-shelves.pl" method="post" id="unshare[% s.shelfnumber | html %]" class="d-inline">
760                                                             <input type="hidden" name="op" value="remove_share" />
761                                                             <input type="hidden" name="referer" value="list" />
762                                                             <input type='hidden' name='public' value='[% public | html %]' />
763                                                             <input type="hidden" name="shelfnumber" value="[% s.shelfnumber | html %]" />
764                                                             <button type="submit" class="btn btn-link remove remove_share"
765                                                             data-shelfname="[% s.shelfname | html %]" data-shelfnumber="[% s.shelfnumber | html %]"><i class="fa fa-remove" aria-hidden="true"></i> Remove share</button>
766                                                         </form>
767                                                     [% END %]&nbsp;
768                                                 </td>
769                                             </tr>
770                                         [% END %]
771                                     </tbody>
772                                 </table> <!-- /.table -->
773                                 <div class="pages">[% pagination_bar | $raw %]</div>
774                             [% ELSE %]
775                                 [% IF public %]
776                                     <p>No public lists.</p>
777                                 [% ELSIF loggedinusernumber %]
778                                     <p>No private lists.</p>
779                                 [% END %]
780                             [% END # /IF shelves.count %]
781                         </div>
782                     [% ELSIF NOT loggedinusernumber %]
783                         [% IF Koha.Preference( 'opacuserlogin' ) == 1 %]
784                             <div class="alert alert-info"><a href="/cgi-bin/koha/opac-shelves.pl?op=add_form">Log in to create a new list</a></div>
785                         [% END %]
786                     [% END  # IF op == 'add_form' OR op == 'edit_form' %]
787                 </div> <!-- / #usershelves -->
788             </div> <!-- / .col-lg-10/12 -->
789         </div> <!-- / .row -->
790     </div> <!-- / .container-fluid -->
791 </div> <!-- / .main -->
792
793 <form method="post" id="download_list" action="/cgi-bin/koha/opac-downloadshelf.pl">
794     <input type="hidden" name="shelfnumber" value="[% shelf.shelfnumber | html %]" />
795     <input type="hidden" name="format" id="download_format" value="" />
796 </form>
797
798 [% INCLUDE 'opac-bottom.inc' %]
799 [% BLOCK jsinclude %]
800 [% Asset.js("lib/hc-sticky.js") | $raw %]
801 [% IF OpenLibraryCovers || OpenLibrarySearch %]
802     [% Asset.js("js/openlibrary.js") | $raw %]
803 [% END %]
804 <script>
805 var MSG_REMOVE_FROM_LIST = _("Are you sure you want to remove these items from the list?");
806 var MSG_REMOVE_ONE_FROM_LIST = _("Are you sure you want to remove this item from the list?");
807 var MSG_CONFIRM_DELETE_LIST = _("Are you sure you want to delete this list?");
808 var MSG_CONFIRM_REMOVE_SHARE = _("Are you sure you want to remove this share?");
809
810 [% IF ( ( Koha.Preference( 'opacuserlogin' ) == 1 ) && ( Koha.Preference( 'OPACHoldRequests' ) == 1 ) ) %]
811     function holdSelections() {
812         var checkedBoxes = $("input:checkbox:checked");
813         if ($(checkedBoxes).size() == 0) {
814             alert( __("No item was selected") );
815         } else {
816             var bibs = "";
817             $(checkedBoxes).each(function(){
818                 bibs += $(this).val() + "/";
819             });
820             document.location = "/cgi-bin/koha/opac-reserve.pl?biblionumbers="+bibs;
821         }
822     }
823 [% END %]
824 [% IF ( TagsInputEnabled && loggedinusername ) %]
825     function tagSelected() {
826         var checkedBoxes = $("input:checkbox:checked");
827         if ($(checkedBoxes).size()) {
828             $("#tagsel_tag").hide();
829             $(".tag_hides").hide();
830             $("#tagsel_form").show();
831         } else {
832             alert( __("No item was selected") );
833         }
834     }
835
836     function tagCanceled() {
837         $("#tagsel_form").hide();
838         $("#tagsel_tag").show();
839         $(".tag_hides").show();
840         $("#tagsel_new").val("");
841         $(".tagstatus").empty().hide();
842     }
843
844     function tagAdded() {
845         var checkedBoxes = $("input:checkbox:checked");
846         if (!$(checkedBoxes).size()) {
847             alert( __("No item was selected") );
848             return false;
849         }
850
851         var tag = $("#tagsel_new").val();
852         if (!tag || (tag == "")) {
853             alert(MSG_NO_TAG_SPECIFIED);
854             return false;
855         }
856
857         var bibs = [];
858         for (var i = 0; i < $(checkedBoxes).size(); i++) {
859             var box = $(checkedBoxes).get(i);
860             bibs[i] = $(box).val();
861         }
862
863         KOHA.Tags.add_multitags_button(bibs, tag);
864         return false;
865     }
866 [% END %]
867
868 function enableCheckboxActions(){
869     // Enable/disable controls if checkboxes are checked
870     var checkedBoxes = $(".cb:checked");
871     if ($(checkedBoxes).size()) {
872       $(".selections").html(_("With selected titles: "));
873       $(".selections-toolbar .links a").removeClass("disabled");
874     } else {
875       $(".selections").html(_("Select titles to: "));
876       $(".selections-toolbar .links a").addClass("disabled");
877     }
878 }
879
880 $(function() {
881     [% IF Koha.Preference( 'opacbookbag' ) == 1 %]$(".addtocart,.cartRemove").removeClass("hidden");[% END %]
882
883     [% IF ( ( Koha.Preference( 'opacuserlogin' ) == 1 ) && ( Koha.Preference( 'OPACHoldRequests' ) == 1 ) ) %]
884         $(".selections-toolbar a.hold").click(function(e){
885             e.preventDefault();
886             holdSelections();
887         });
888     [% END %]
889
890     $("a.print").show();
891
892     $("#CheckAll").on("click",function(e){
893         e.preventDefault();
894         $(".cb").prop("checked", true);
895         enableCheckboxActions();
896     });
897     $("#CheckNone").on("click",function(e){
898         e.preventDefault();
899         $(".cb").prop("checked", false);
900         enableCheckboxActions();
901     });
902
903     $(".cb").click(function(){
904       enableCheckboxActions();
905     });
906     enableCheckboxActions();
907
908     [% IF ( TagsInputEnabled && loggedinusername ) %]
909         var tagAdd = $(".tag_add");
910         tagAdd.removeClass("hidden");
911         $("#tagsel_tag").click(function(){
912             tagSelected();
913             return false;
914         });
915         $("#tagsel_cancel").click(function(){
916             tagCanceled();
917             return false;
918         });
919         $("#tagsel_button").click(function(){
920             tagAdded();
921             return false;
922         });
923
924         tagAdd.click(function(){
925             var thisid = $(this).attr("id");
926             thisid = thisid.replace("tag_add","");
927             $(this).hide();
928             $("#tagform"+thisid).show();
929             $("#newtag"+thisid).focus();
930             $("#newtag"+thisid+"_status").empty().hide();
931             return false;
932         });
933         $(".cancel_tag_add").click(function(){
934             var thisid = $(this).attr("id");
935             thisid = thisid.replace("cancel","");
936             $("#tagform"+thisid).hide();
937             $("#tag_add"+thisid).show();
938             $("#newtag"+thisid).val("");
939             $("#newtag"+thisid+"_status").empty().hide();
940             return false;
941         });
942         $(".tagbutton").click(function(){
943           var thisid = $(this).attr("title");
944           var tag = $("#newtag"+thisid).val();
945           if (!tag || (tag == "")) {
946               alert(MSG_NO_TAG_SPECIFIED);
947               return false;
948           }
949           KOHA.Tags.add_tag_button(thisid, tag);
950           return false;
951         });
952     [% END %]
953
954     [% IF loggedinusername && can_remove_biblios %]
955         $(".removefromlist").on("click", function(e){
956             return confirmDelete(MSG_REMOVE_ONE_FROM_LIST);
957         });
958
959         $("#myform").submit(function(){
960             var checkedBoxes = $(".cb:checked");
961             var numchecked = $(checkedBoxes).size();
962             if (numchecked) {
963                 if( numchecked > 1 ){
964                     return confirmDelete(MSG_REMOVE_FROM_LIST);
965                 } else {
966                     return confirmDelete(MSG_REMOVE_ONE_FROM_LIST);
967                 }
968             } else {
969                 alert( __("No item was selected") );
970                 return false;
971             }
972         });
973         $("#removeitems").html("<a href=\"#\" class=\"btn btn-link disabled removeitems tag_hides\"><i class=\"fa fa-fw fa-remove\" aria-hidden=\"true\"></i> "+_("Remove from list")+"</a>")
974         .click(function(){
975             $("#myform").submit();
976             return false;
977         });
978     [% END %]
979     [% IF OpenLibraryCovers %]KOHA.OpenLibrary.GetCoverFromIsbn();[% END %]
980     [% IF OPACLocalCoverImages %]KOHA.LocalCover.GetCoverFromBibnumber(false);[% END %]
981     [% IF ( GoogleJackets ) %]KOHA.Google.GetCoverFromIsbn();[% END %]
982     [% IF ( Koha.Preference('OpacCoce') && Koha.Preference('CoceProviders') ) %]
983         KOHA.coce.getURL('[% Koha.Preference('CoceHost') | html %]', '[% Koha.Preference('CoceProviders') | html %]');
984     [% END %]
985
986     [% IF print %]
987         window.print();
988         window.onafterprint = function () {
989             window.close();
990         }
991         setTimeout('window.close()', 1000); // Hack for Chrome < 63
992     [% END %]
993
994     AdjustRemark();
995
996     Sticky = $("#floating");
997     Sticky.hcSticky({
998         stickTo: "#usershelves",
999         stickyClass: "floating"
1000     });
1001
1002     [% IF itemsloop %]
1003         sortMenu( $("#sorting-form") );
1004
1005         $("#sortfield").on("change", function(){
1006             $('#sorting-form').submit();
1007         });
1008     [% END %]
1009
1010     $(".deleteshelf").on("click", function(e){
1011         e.preventDefault();
1012         var shelf_name = $(this).data("shelfname");
1013         var shelf_number = $(this).data("shelfnumber");
1014         var is_shared = $(this).data("shared");
1015         var count = $(this).data("count");
1016         var message = "<p><em>" + shelf_name + "</em></p>";
1017         if( count ){
1018             message += "<p>" + _("Items on this list:") + " <strong>" + count + "</strong></p>";
1019         }
1020         if( is_shared ){
1021             message += "<p>" + _("This list is shared. Other users will lose access to it.") + "</p>";
1022         }
1023         confirmModal( message, _("Are you sure you want to delete this list?"), _("Yes, delete"), _("No, do not delete"), function( result ){
1024                 if( result ){
1025                     $("#deleteshelf" + shelf_number ).submit();
1026                 }
1027             }
1028         );
1029     });
1030
1031     $(".remove_share").on("click", function(e){
1032         e.preventDefault();
1033         var shelf_name = $(this).data("shelfname");
1034         var shelf_number = $(this).data("shelfnumber");
1035         confirmModal( shelf_name, _("Are you sure you want to remove sharing? You will no longer have access to the list."), _("Yes, remove sharing"), _("No, do not remove sharing"), function( result ){
1036                 if( result ){
1037                     $("#unshare" + shelf_number ).submit();
1038                 }
1039             }
1040         );
1041     });
1042
1043     $(".download-list").on("click", function(e){
1044         e.preventDefault();
1045         var format = $(this).data("format");
1046         $("#download_format").val( format );
1047         $("#download_list").submit();
1048     });
1049
1050 }); // document.ready
1051
1052 function sortMenu( sorting_form ){
1053     var shelfnumber = sorting_form.find("input[name='shelfnumber']").val();
1054     var sort_link = "/cgi-bin/koha/opac-shelves.pl?op=view&amp;shelfnumber=" + shelfnumber + "&sortfield=";
1055     var menu = "<div class=\"btn-group dropdown\"><button type=\"button\" class=\"btn btn-link dropdown-toggle\" data-toggle=\"dropdown\" id=\"sortmenu\" aria-haspopup=\"true\" aria-expanded=\"false\"><i class=\"fa fa-sort\" aria-hidden=\"true\"></i> " + _("Sort") + "</span></button><div class=\"dropdown-menu dropdown-menu-right\" aria-labelledby=\"sortmenu\">";
1056     $("#sortfield").children().each(function(){
1057         if( $(this)[0].tagName.toUpperCase() == "OPTION" ){
1058             menu += "<a class=\"dropdown-item\" href=\"" + sort_link + $(this).val() + "\">" + $(this).text() + "</a>";
1059         } else if( $(this)[0].tagName.toUpperCase() == "OPTGROUP" ){
1060             menu += "<span class=\"dropdown-header\">" + $(this).attr("label") + "</span>";
1061             $(this).children().each(function(){
1062                 if( $(this)[0].tagName.toUpperCase() == "OPTION" ){
1063                     menu += "<a class=\"dropdown-item\" href=\"" + sort_link + $(this).val() + "&direction=" + $(this).data('direction') + "\">" + $(this).text() + "</a>";
1064                 }
1065             });
1066         }
1067     });
1068     menu += "</div>";
1069     $(".list-actions").append( menu );
1070     sorting_form.remove();
1071 }
1072
1073 function AdjustRemark() {
1074     var public;
1075     if( $("#public").length > 0 ) {
1076         public = $("#public").val();
1077     } else {
1078         public = "[% public | html %]";
1079     }
1080     var perms = $("#allow_changes_from").val();
1081
1082     if( perms < 2 ) {
1083         $("#anyone_remark").hide();
1084         $("#staff_remark").hide();
1085     } else if( public==0 ) {
1086         // If we move to Private (without shares), show Anyone remark
1087         // Note: the number of shares is not tested real-time
1088         [% IF !shelf.is_shared %]
1089             if ( perms==2 ) {
1090                 $("#anyone_remark").show();
1091                 $("#staff_remark").hide();
1092             } else if ( perms==3 ) {
1093                 $("#anyone_remark").hide();
1094                 $("#staff_remark").show();
1095             }
1096         [% ELSE %]
1097             $("#anyone_remark").hide();
1098             $("#staff_remark").hide();
1099         [% END %]
1100     } else { // public==1
1101         $("#anyone_remark").hide();
1102         $("#staff_remark").hide();
1103     }
1104 }
1105 </script>
1106 [% END %]