Bug 32434: Show "Lists" line on lists results
[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                                                             <span class="itypetext">[% itemsloo.description | html %]</span>
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
490                                                         [% IF itemsloo.shelves.count %]
491                                                             <div class="results_summary shelves">
492                                                                 <span class="label">Lists:</span>
493                                                                 <ul>
494                                                                     [% FOREACH item_shelf IN itemsloo.shelves %]
495                                                                         <li>
496                                                                             <a href="/cgi-bin/koha/opac-shelves.pl?op=view&amp;shelfnumber=[% item_shelf.shelfnumber | uri %]">[% item_shelf.shelfname | html %]</a>
497                                                                             [%~ UNLESS loop.last %], [% ELSE %].[% END ~%]
498                                                                         </li>
499                                                                     [% END %]
500                                                                 </ul>
501                                                             </div>
502                                                         [% END %]
503
504                                                         [% IF ( TagsShowEnabled && itemsloo.TagLoop.size ) %]
505                                                             <div class="results_summary tags">
506                                                                 <span class="label">Tags:</span>
507                                                                 <ul>
508                                                                     [% FOREACH TagLoo IN itemsloo.TagLoop %]
509                                                                         <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>
510                                                                     [% END %]
511                                                                 </ul>
512                                                             </div>
513                                                         [% END %]
514
515                                                         [% INCLUDE 'title-actions-menu.inc' items=itemsloo %]
516
517                                                         [% INCLUDE "openlibrary-readapi.inc" bib = itemsloo %]
518                                                         <!-- COinS / Openurl -->
519                                                         <span class="Z3988" title="[% itemsloo.coins | html %]"></span>
520                                                     </td>
521                                                 </tr>
522                                             [% END # / FOREACH itemsloop %]
523                                         </tbody>
524                                     </table> <!-- / #listcontents -->
525                                 </div><!-- / .searchresults -->
526
527                                 [% IF ( pagination_bar ) %]
528                                     <div class="pages">[% pagination_bar | $raw %]</div>
529                                 [% END %]
530
531                                 [% IF can_remove_biblios %]
532                                     <input type="hidden" name="op" value="remove_biblios" />
533                                     <input type="hidden" name="shelfnumber" value="[% shelf.shelfnumber | html %]" />
534                                     <input type="hidden" name="modifyshelfcontents" value="1" />
535                                     <input type="submit" value="Remove selected items" id="remove-selected" class="btn btn-danger"/>
536                                 [% END %]
537                             </form> <!-- /myform -->
538                         [% ELSE %]
539                             <div id="toolbar" class="toolbar clearfix">
540                                 <div class="list-actions">
541                                     <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>
542                                     [% IF can_manage_shelf %]
543                                         <span class="sep">|</span>
544                                         <form method="get" action="/cgi-bin/koha/opac-shelves.pl" class="d-inline">
545                                             <input type="hidden" name="op" value="edit_form" />
546                                             <input type="hidden" name="referer" value="view" />
547                                             <input type="hidden" name="public" value="[% shelf.public | html %]" />
548                                             <input type="hidden" name="shelfnumber" value="[% shelf.shelfnumber | html %]" />
549                                             <button type="submit" class="btn btn-link editshelf"><i class="fa fa-fw fa-pencil-square-o" aria-hidden="true"></i> Edit list</button>
550                                         </form>
551
552                                         [% PROCESS delete_shelf context = "details" %]
553
554                                     [% END %]
555                                 </div> <!-- / .list-actions -->
556                             </div> <!-- / #toolbar -->
557
558                             <div class="alert alert-info">
559                                 <span>This list is empty.</span>
560                                 [% IF Koha.Preference( 'opacuserlogin' ) == 1 %]
561                                     <span>You can add to your lists from the results of any <a href="opac-main.pl">search</a>.</span>
562                                 [% END %]
563                             </div>
564
565                             [% IF can_manage_shelf %]
566                                 <form method="post" action="opac-shelves.pl">
567                                     <input type="hidden" name="op" value="delete" />
568                                     <input type="hidden" name="referer" value="list" />
569                                     <input type="hidden" name="shelfnumber" value="[% shelf.shelfnumber | html %]"/>
570                                     <input type="submit" class="btn btn-danger" value="Delete this list" onclick="return confirmDelete(MSG_CONFIRM_DELETE_LIST)" />
571                                 </form>
572                             [% END %]
573                         [% END # / IF itemsloop %]
574                     [% END # /IF shelf AND op == 'view' %]
575
576                     [% IF op == 'add_form' OR op == 'edit_form' %]
577                         <form method="post" action="/cgi-bin/koha/opac-shelves.pl">
578                             <fieldset class="rows">
579                                 [% IF op == 'add_form' %]
580                                     <div id="addshelf">
581                                         <legend><h1>Create a new list</h1></legend>
582                                     <input type="hidden" name="op" value="add" />
583                                 [% ELSE %]
584                                 <legend><h1>Editing <em>[% shelf.shelfname | html %]</em></h1></legend>
585                                     <input type="hidden" name="op" value="edit" />
586                                     <input type="hidden" name="referer" value="[% referer | html %]" />
587                                     <input type="hidden" name="shelfnumber" value="[% shelf.shelfnumber | html %]" />
588                                 [% END %]
589                                 <input type="hidden" name="owner" id="owner" value="[% loggedinusernumber | html %]" />
590                                 <ol>
591                                     <li>
592                                         <label class="required" for="shelfname">List name: </label>
593                                         <input type="text" id="shelfname" name="shelfname" maxlength="255" value="[% shelf.shelfname | html %]" required="required" class="focus required"/>
594                                         <span class="required">Required</span></li>
595                                     <li>
596                                         <label for="sortfield" >Sort this list by: </label>
597                                         <select name="sortfield" id="sortfield">
598                                             [% IF shelf.sortfield == "title" %]
599                                                 <option value="title" selected="selected">Title</option>
600                                             [% ELSE %]
601                                                 <option value="title">Title</option>
602                                             [% END %]
603                                             [% IF shelf.sortfield == "author" %]
604                                                 <option value="author" selected="selected">Author</option>
605                                             [% ELSE %]
606                                                 <option value="author">Author</option>
607                                             [% END %]
608                                             [% IF shelf.sortfield == "copyrightdate" %]
609                                                 <option value="copyrightdate" selected="selected">Year</option>
610                                             [% ELSE %]
611                                                 <option value="copyrightdate">Year</option>
612                                             [% END %]
613                                             [% IF shelf.sortfield == "itemcallnumber" %]
614                                                 <option value="itemcallnumber" selected="selected">Call number</option>
615                                             [% ELSE %]
616                                                 <option value="itemcallnumber">Call number</option>
617                                             [% END %]
618                                             [% IF shelf.sortfield == "dateadded" %]
619                                                 <option value="dateadded" selected="selected">Date added</option>
620                                             [% ELSE %]
621                                                 <option value="dateadded">Date added</option>
622                                             [% END %]
623                                         </select>
624                                     </li>
625                                     [% IF Koha.Preference('OpacAllowPublicListCreation') OR public == 1 %]
626                                         <li>
627                                             <label for="public">Category:</label>
628                                             <select name="public" id="public" onchange="AdjustRemark()">
629                                                 [% IF shelf.is_private %]
630                                                         <option value="0" selected="selected">Private</option>
631                                                     [% ELSE %]
632                                                         <option value="0">Private</option>
633                                                     [% END %]
634                                                 [% IF shelf.is_public %]
635                                                     <option value="1" selected="selected">Public</option>
636                                                 [% ELSE %]
637                                                     <option value="1">Public</option>
638                                                 [% END %]
639                                             </select>
640                                             [% IF shelf.is_public AND NOT Koha.Preference('OpacAllowPublicListCreation') %]
641                                                 <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>
642                                             [% END %]
643                                         </li>
644                                     [% END %]
645                                     [% INCLUDE list_permissions %]
646                                 </ol>
647                                 [% UNLESS Koha.Preference('OpacAllowPublicListCreation') OR public == 1 %]
648                                     <input type="hidden" name="public" value="0" />
649                                 [% END %]
650                             </fieldset> <!-- /.rows -->
651
652                             <fieldset class="action">
653                                 <input type="submit" value="Save" class="btn btn-primary" />
654                                 [% IF referer == 'view' %]
655                                     <a href="/cgi-bin/koha/opac-shelves.pl?op=view&amp;shelfnumber=[% shelf.shelfnumber | uri %]" class="cancel">Cancel</a>
656                                 [% ELSE %]
657                                     <a href="/cgi-bin/koha/opac-shelves.pl?op=list" class="cancel">Cancel</a>
658                                 [% END %]
659                             </fieldset>
660                         </form>
661
662                     [% ELSIF op == 'transfer' %]
663                         <h1>Transfer ownership of shared list '[% shelf.shelfname | html %]'</h1>
664                         <br/>
665                         <form action="/cgi-bin/koha/opac-shelves.pl" id="transferform" method="post">
666                         <fieldset>
667                             <input type="hidden" name="op" value="transfer" />
668                             <input type="hidden" name="public" value="0" />
669                             <input type="hidden" name="shelfnumber" value="[% shelf.shelfnumber | html %]" />
670                             <div>
671                                 <label for="find_patron">New owner: </label>
672                                 <select name="new_owner" id="new_owner">
673                                 [% FOREACH sharee IN shared_users %]
674                                     <option value="[% sharee.borrowernumber | html %]" selected="">[% sharee.email | html %]</option>
675                                 [% END %]
676                                 </select>
677                             </div>
678                             <br/>
679                             <fieldset class="action">
680                                 <input type="submit" value="Transfer" class="submit" />
681                                 <a href="/cgi-bin/koha/opac-shelves.pl?op=list&amp;public=0" class="cancel">Cancel</a>
682                             </fieldset>
683                         </fieldset>
684                         </form>
685
686                     [% ELSIF op == 'list' %]
687                         <h1>Lists</h1>
688                         <div class="toptabs ui-tabs ui-widget ui-widget-content ui-corner-all">
689                             <ul class="ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all">
690                                 [% IF Koha.Preference( 'opacuserlogin' ) == 1 %]
691                                     [% IF !public %]
692                                         <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>
693                                     [% ELSE %]
694                                         <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>
695                                     [% END %]
696                                 [% END %]
697                                 [% IF public %]
698                                     <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>
699                                 [% ELSE %]
700                                     <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>
701                                 [% END %]
702                             </ul>
703
704                             [% IF !public %]
705                                 <div id="privateshelves" class="ui-tabs-panel ui-widget-content ui-corner-bottom" style="display:block;">
706                             [% ELSE %]
707                                 <div id="publicshelves" class="ui-tabs-panel ui-widget-content ui-corner-bottom" style="display:block;">
708                             [% END %]
709
710                             [% IF !public || Koha.Preference('OpacAllowPublicListCreation') %]
711                                 [% IF loggedinusername %]
712                                     <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>
713                                 [% ELSE %]
714                                     [% IF Koha.Preference( 'opacuserlogin' ) == 1 %]
715                                         <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>
716                                     [% END %]
717                                 [% END %]
718                             [% END %]
719
720                             [% IF shelves.count %]
721                                 <table class="table">
722                                     [% IF !public %]
723                                     <caption class="sr-only">Your lists</caption>
724                                     [% ELSIF public %]
725                                     <caption class="sr-only">Public lists</caption>
726                                     [% END %]
727                                     <thead>
728                                         <tr>
729                                             <th>List name</th>
730                                             <th>Contents</th>
731                                             <th>Type</th>
732                                             <th>&nbsp;</th>
733                                         </tr>
734                                     </thead>
735                                     <tbody>
736                                         [% FOREACH s IN shelves %]
737                                             [% SET contents = s.get_contents %]
738                                             <tr>
739                                                 <td><a href="/cgi-bin/koha/opac-shelves.pl?op=view&amp;shelfnumber=[% s.shelfnumber | uri %]">[% s.shelfname | html %]</a></td>
740                                                 <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>
741                                                 <td>
742                                                     [% IF s.is_private %]
743                                                         [% IF s.is_shared %]<span>Shared</span>[% ELSE %]<span>Private</span>[% END %]
744                                                     [% ELSE %]
745                                                         <span>Public</span>
746                                                     [% END %]
747                                                 </td>
748                                                 <td>
749                                                     [% IF 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="[% s.public | html %]" />
753                                                             <input type="hidden" name="op" value="edit_form" />
754                                                             <input type="hidden" name="referer" value="list" />
755                                                             <button type="submit" class="btn btn-link editshelf"><i class="fa fa-pencil-square-o" aria-hidden="true"></i> Edit</button>
756                                                         </form>
757                                                     [% END %]
758                                                     [% IF s.can_be_deleted( loggedinusernumber ) %]
759                                                         [% PROCESS delete_shelf shelf = s context = "list" %]
760                                                     [% END %]
761                                                     [% IF s.is_private AND s.can_be_managed( loggedinusernumber ) AND Koha.Preference('OpacAllowSharingPrivateLists') %]
762                                                         <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>
763                                                     [% END %]
764                                                     [% IF s.is_shared AND s.can_be_managed( loggedinusernumber ) %]
765                                                         <form action="/cgi-bin/koha/opac-shelves.pl" method="get" class="d-inline">
766                                                             <input type="hidden" name="shelfnumber" value="[% s.shelfnumber | html %]" />
767                                                             <input type="hidden" name="public" value="0" />
768                                                             <input type="hidden" name="op" value="transfer" />
769                                                             <input type="hidden" name="referer" value="list" />
770                                                             <button type="submit" class="btn btn-link transfershelf"> Transfer</button>
771                                                         </form>
772                                                     [% END %]
773                                                     [% IF s.is_shared_with( loggedinusernumber ) %]
774                                                         <form action="opac-shelves.pl" method="post" id="unshare[% s.shelfnumber | html %]" class="d-inline">
775                                                             <input type="hidden" name="op" value="remove_share" />
776                                                             <input type="hidden" name="referer" value="list" />
777                                                             <input type='hidden' name='public' value='[% public | html %]' />
778                                                             <input type="hidden" name="shelfnumber" value="[% s.shelfnumber | html %]" />
779                                                             <button type="submit" class="btn btn-link remove remove_share"
780                                                             data-shelfname="[% s.shelfname | html %]" data-shelfnumber="[% s.shelfnumber | html %]"><i class="fa fa-remove" aria-hidden="true"></i> Remove share</button>
781                                                         </form>
782                                                     [% END %]&nbsp;
783                                                 </td>
784                                             </tr>
785                                         [% END %]
786                                     </tbody>
787                                 </table> <!-- /.table -->
788                                 <div class="pages">[% pagination_bar | $raw %]</div>
789                             [% ELSE %]
790                                 [% IF public %]
791                                     <p>No public lists.</p>
792                                 [% ELSIF loggedinusernumber %]
793                                     <p>No private lists.</p>
794                                 [% END %]
795                             [% END # /IF shelves.count %]
796                         </div>
797                     [% ELSIF NOT loggedinusernumber %]
798                         [% IF Koha.Preference( 'opacuserlogin' ) == 1 %]
799                             <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>
800                         [% END %]
801                     [% END  # IF op == 'add_form' OR op == 'edit_form' %]
802                 </div> <!-- / #usershelves -->
803             </div> <!-- / .col-lg-10/12 -->
804         </div> <!-- / .row -->
805     </div> <!-- / .container-fluid -->
806 </div> <!-- / .main -->
807
808 <form method="post" id="download_list" action="/cgi-bin/koha/opac-downloadshelf.pl">
809     <input type="hidden" name="shelfnumber" value="[% shelf.shelfnumber | html %]" />
810     <input type="hidden" name="format" id="download_format" value="" />
811 </form>
812
813 [% INCLUDE 'opac-bottom.inc' %]
814 [% BLOCK jsinclude %]
815 [% Asset.js("lib/hc-sticky.js") | $raw %]
816 [% IF OpenLibraryCovers || OpenLibrarySearch %]
817     [% Asset.js("js/openlibrary.js") | $raw %]
818 [% END %]
819 <script>
820 var MSG_REMOVE_FROM_LIST = _("Are you sure you want to remove these items from the list?");
821 var MSG_REMOVE_ONE_FROM_LIST = _("Are you sure you want to remove this item from the list?");
822 var MSG_CONFIRM_DELETE_LIST = _("Are you sure you want to delete this list?");
823 var MSG_CONFIRM_REMOVE_SHARE = _("Are you sure you want to remove this share?");
824
825 [% IF ( ( Koha.Preference( 'opacuserlogin' ) == 1 ) && ( Koha.Preference( 'OPACHoldRequests' ) == 1 ) ) %]
826     function holdSelections() {
827         var checkedBoxes = $("input:checkbox:checked");
828         if ($(checkedBoxes).size() == 0) {
829             alert( __("No item was selected") );
830         } else {
831             var bibs = "";
832             $(checkedBoxes).each(function(){
833                 bibs += $(this).val() + "/";
834             });
835             document.location = "/cgi-bin/koha/opac-reserve.pl?biblionumbers="+bibs;
836         }
837     }
838 [% END %]
839 [% IF ( TagsInputEnabled && loggedinusername ) %]
840     function tagSelected() {
841         var checkedBoxes = $("input:checkbox:checked");
842         if ($(checkedBoxes).size()) {
843             $("#tagsel_tag").hide();
844             $(".tag_hides").hide();
845             $("#tagsel_form").show();
846         } else {
847             alert( __("No item was selected") );
848         }
849     }
850
851     function tagCanceled() {
852         $("#tagsel_form").hide();
853         $("#tagsel_tag").show();
854         $(".tag_hides").show();
855         $("#tagsel_new").val("");
856         $(".tagstatus").empty().hide();
857     }
858
859     function tagAdded() {
860         var checkedBoxes = $("input:checkbox:checked");
861         if (!$(checkedBoxes).size()) {
862             alert( __("No item was selected") );
863             return false;
864         }
865
866         var tag = $("#tagsel_new").val();
867         if (!tag || (tag == "")) {
868             alert(MSG_NO_TAG_SPECIFIED);
869             return false;
870         }
871
872         var bibs = [];
873         for (var i = 0; i < $(checkedBoxes).size(); i++) {
874             var box = $(checkedBoxes).get(i);
875             bibs[i] = $(box).val();
876         }
877
878         KOHA.Tags.add_multitags_button(bibs, tag);
879         return false;
880     }
881 [% END %]
882
883 function enableCheckboxActions(){
884     // Enable/disable controls if checkboxes are checked
885     var checkedBoxes = $(".cb:checked");
886     if ($(checkedBoxes).size()) {
887       $(".selections").html(_("With selected titles: "));
888       $(".selections-toolbar .links a").removeClass("disabled");
889     } else {
890       $(".selections").html(_("Select titles to: "));
891       $(".selections-toolbar .links a").addClass("disabled");
892     }
893 }
894
895 $(function() {
896     [% IF Koha.Preference( 'opacbookbag' ) == 1 %]$(".addtocart,.cartRemove").removeClass("hidden");[% END %]
897
898     [% IF ( ( Koha.Preference( 'opacuserlogin' ) == 1 ) && ( Koha.Preference( 'OPACHoldRequests' ) == 1 ) ) %]
899         $(".selections-toolbar a.hold").click(function(e){
900             e.preventDefault();
901             holdSelections();
902         });
903     [% END %]
904
905     $("a.print").show();
906
907     $("#CheckAll").on("click",function(e){
908         e.preventDefault();
909         $(".cb").prop("checked", true);
910         enableCheckboxActions();
911     });
912     $("#CheckNone").on("click",function(e){
913         e.preventDefault();
914         $(".cb").prop("checked", false);
915         enableCheckboxActions();
916     });
917
918     $(".cb").click(function(){
919       enableCheckboxActions();
920     });
921     enableCheckboxActions();
922
923     [% IF ( TagsInputEnabled && loggedinusername ) %]
924         var tagAdd = $(".tag_add");
925         tagAdd.removeClass("hidden");
926         $("#tagsel_tag").click(function(){
927             tagSelected();
928             return false;
929         });
930         $("#tagsel_cancel").click(function(){
931             tagCanceled();
932             return false;
933         });
934         $("#tagsel_button").click(function(){
935             tagAdded();
936             return false;
937         });
938
939         tagAdd.click(function(){
940             var thisid = $(this).attr("id");
941             thisid = thisid.replace("tag_add","");
942             $(this).hide();
943             $("#tagform"+thisid).show();
944             $("#newtag"+thisid).focus();
945             $("#newtag"+thisid+"_status").empty().hide();
946             return false;
947         });
948         $(".cancel_tag_add").click(function(){
949             var thisid = $(this).attr("id");
950             thisid = thisid.replace("cancel","");
951             $("#tagform"+thisid).hide();
952             $("#tag_add"+thisid).show();
953             $("#newtag"+thisid).val("");
954             $("#newtag"+thisid+"_status").empty().hide();
955             return false;
956         });
957         $(".tagbutton").click(function(){
958           var thisid = $(this).attr("title");
959           var tag = $("#newtag"+thisid).val();
960           if (!tag || (tag == "")) {
961               alert(MSG_NO_TAG_SPECIFIED);
962               return false;
963           }
964           KOHA.Tags.add_tag_button(thisid, tag);
965           return false;
966         });
967     [% END %]
968
969     [% IF loggedinusername && can_remove_biblios %]
970         $(".removefromlist").on("click", function(e){
971             return confirmDelete(MSG_REMOVE_ONE_FROM_LIST);
972         });
973
974         $("#myform").submit(function(){
975             var checkedBoxes = $(".cb:checked");
976             var numchecked = $(checkedBoxes).size();
977             if (numchecked) {
978                 if( numchecked > 1 ){
979                     return confirmDelete(MSG_REMOVE_FROM_LIST);
980                 } else {
981                     return confirmDelete(MSG_REMOVE_ONE_FROM_LIST);
982                 }
983             } else {
984                 alert( __("No item was selected") );
985                 return false;
986             }
987         });
988         $("#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>")
989         .click(function(){
990             $("#myform").submit();
991             return false;
992         });
993     [% END %]
994     [% IF OpenLibraryCovers %]KOHA.OpenLibrary.GetCoverFromIsbn();[% END %]
995     [% IF OPACLocalCoverImages %]KOHA.LocalCover.GetCoverFromBibnumber(false);[% END %]
996     [% IF ( GoogleJackets ) %]KOHA.Google.GetCoverFromIsbn();[% END %]
997     [% IF ( Koha.Preference('OpacCoce') && Koha.Preference('CoceProviders') ) %]
998         KOHA.coce.getURL('[% Koha.Preference('CoceHost') | html %]', '[% Koha.Preference('CoceProviders') | html %]');
999     [% END %]
1000
1001     [% IF print %]
1002         window.print();
1003         window.onafterprint = function () {
1004             window.close();
1005         }
1006         setTimeout('window.close()', 1000); // Hack for Chrome < 63
1007     [% END %]
1008
1009     AdjustRemark();
1010
1011     Sticky = $("#floating");
1012     Sticky.hcSticky({
1013         stickTo: "#usershelves",
1014         stickyClass: "floating"
1015     });
1016
1017     [% IF itemsloop %]
1018         sortMenu( $("#sorting-form") );
1019
1020         $("#sortfield").on("change", function(){
1021             $('#sorting-form').submit();
1022         });
1023     [% END %]
1024
1025     $(".deleteshelf").on("click", function(e){
1026         e.preventDefault();
1027         var shelf_name = $(this).data("shelfname");
1028         var shelf_number = $(this).data("shelfnumber");
1029         var is_shared = $(this).data("shared");
1030         var count = $(this).data("count");
1031         var message = "<p><em>" + shelf_name + "</em></p>";
1032         if( count ){
1033             message += "<p>" + _("Items on this list:") + " <strong>" + count + "</strong></p>";
1034         }
1035         if( is_shared ){
1036             message += "<p>" + _("This list is shared. Other users will lose access to it.") + "</p>";
1037         }
1038         confirmModal( message, _("Are you sure you want to delete this list?"), _("Yes, delete"), _("No, do not delete"), function( result ){
1039                 if( result ){
1040                     $("#deleteshelf" + shelf_number ).submit();
1041                 }
1042             }
1043         );
1044     });
1045
1046     $(".remove_share").on("click", function(e){
1047         e.preventDefault();
1048         var shelf_name = $(this).data("shelfname");
1049         var shelf_number = $(this).data("shelfnumber");
1050         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 ){
1051                 if( result ){
1052                     $("#unshare" + shelf_number ).submit();
1053                 }
1054             }
1055         );
1056     });
1057
1058     $(".download-list").on("click", function(e){
1059         e.preventDefault();
1060         var format = $(this).data("format");
1061         $("#download_format").val( format );
1062         $("#download_list").submit();
1063     });
1064
1065 }); // document.ready
1066
1067 function sortMenu( sorting_form ){
1068     var shelfnumber = sorting_form.find("input[name='shelfnumber']").val();
1069     var sort_link = "/cgi-bin/koha/opac-shelves.pl?op=view&amp;shelfnumber=" + shelfnumber + "&sortfield=";
1070     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\">";
1071     $("#sortfield").children().each(function(){
1072         if( $(this)[0].tagName.toUpperCase() == "OPTION" ){
1073             menu += "<a class=\"dropdown-item\" href=\"" + sort_link + $(this).val() + "\">" + $(this).text() + "</a>";
1074         } else if( $(this)[0].tagName.toUpperCase() == "OPTGROUP" ){
1075             menu += "<span class=\"dropdown-header\">" + $(this).attr("label") + "</span>";
1076             $(this).children().each(function(){
1077                 if( $(this)[0].tagName.toUpperCase() == "OPTION" ){
1078                     menu += "<a class=\"dropdown-item\" href=\"" + sort_link + $(this).val() + "&direction=" + $(this).data('direction') + "\">" + $(this).text() + "</a>";
1079                 }
1080             });
1081         }
1082     });
1083     menu += "</div>";
1084     $(".list-actions").append( menu );
1085     sorting_form.remove();
1086 }
1087
1088 function AdjustRemark() {
1089     var public;
1090     if( $("#public").length > 0 ) {
1091         public = $("#public").val();
1092     } else {
1093         public = "[% public | html %]";
1094     }
1095     var perms = $("#allow_changes_from").val();
1096
1097     if( perms < 2 ) {
1098         $("#anyone_remark").hide();
1099         $("#staff_remark").hide();
1100     } else if( public==0 ) {
1101         // If we move to Private (without shares), show Anyone remark
1102         // Note: the number of shares is not tested real-time
1103         [% IF !shelf.is_shared %]
1104             if ( perms==2 ) {
1105                 $("#anyone_remark").show();
1106                 $("#staff_remark").hide();
1107             } else if ( perms==3 ) {
1108                 $("#anyone_remark").hide();
1109                 $("#staff_remark").show();
1110             }
1111         [% ELSE %]
1112             $("#anyone_remark").hide();
1113             $("#staff_remark").hide();
1114         [% END %]
1115     } else { // public==1
1116         $("#anyone_remark").hide();
1117         $("#staff_remark").hide();
1118     }
1119 }
1120 </script>
1121 [% END %]