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