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