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