Bug 20168: Update of the OPAC bootstrap template to bootstrap v4
[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-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                                                     <td class="select selectcol"><input type="checkbox" class="cb" name="biblionumber" value="[% itemsloo.biblionumber | html %]" /></td>
357                                                     [% UNLESS ( item_level_itypes ) %]
358                                                         <td>
359                                                             [% UNLESS ( Koha.Preference('OpacNoItemTypeImages') ) %]
360                                                                 <img src="[% itemsloo.imageurl | html %]" alt="[% itemsloo.description | html %]" title="[% itemsloo.description | html %]" />
361                                                             [% END %]
362                                                             [% itemsloo.description | html %]
363                                                         </td>
364                                                     [% END %]
365                                                     <td>
366                                                         <div class="coverimages">
367                                                             <a class="p1" href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% itemsloo.biblionumber | html %]">
368                                                                 [% IF ( itemsloo.title ) %]
369                                                                     [% img_title = itemsloo.title %]
370                                                                 [% ELSE %]
371                                                                     [% img_title = itemsloo.biblionumber %]
372                                                                 [% END %]
373
374                                                                 [% IF ( OPACLocalCoverImages ) %]
375                                                                     <span title="[% img_title | html %]" class="[% itemsloo.biblionumber | html %]" id="local-thumbnail[% loop.count | html %]"></span>
376                                                                 [% END %]
377                                                                 [% IF ( AdlibrisEnabled && itemsloo.normalized_isbn ) %]
378                                                                     <img src="[% AdlibrisURL | html %]?isbn=[% itemsloo.normalized_isbn | html %]" class="adlibris-cover" alt="Adlibris cover image" />
379                                                                 [% END %]
380                                                                 [% IF ( OPACAmazonCoverImages ) %]
381                                                                     [% IF ( itemsloo.normalized_isbn ) %]
382                                                                         <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>
383                                                                     [% ELSE %]
384                                                                         <span class="no-image">No cover image available</span>
385                                                                     [% END %]
386                                                                 [% END %]
387
388                                                                 [% IF ( SyndeticsEnabled && SyndeticsCoverImages ) %]
389                                                                     <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>
390                                                                 [% END %]
391
392                                                                 [% IF ( GoogleJackets ) %]
393                                                                     [% IF ( itemsloo.normalized_isbn ) %]
394                                                                         <div title="[% img_title | html %]" class="[% itemsloo.normalized_isbn | html %]" id="gbs-thumbnail[% loop.count | html %]"></div>
395                                                                     [% ELSE %]
396                                                                         <span class="no-image">No cover image available</span>
397                                                                     [% END %]
398                                                                 [% END %]
399
400                                                                 [% IF ( Koha.Preference('OpacCoce') && Koha.Preference('CoceProviders') ) %]
401                                                                     [% coce_id = itemsloo.normalized_ean || itemsloo.normalized_isbn %]
402                                                                     [% IF ( coce_id ) %]
403                                                                         <span title="[% img_title | html %]" class="[% coce_id | html %]" id="coce-thumbnail[% loop.count | html %]"></span>
404                                                                     [% ELSE %]
405                                                                         <span class="no-image">No cover image available</span>
406                                                                     [% END %]
407                                                                 [% END %]
408
409
410                                                                 [% IF OpenLibraryCovers %]
411                                                                     [% IF itemsloo.normalized_isbn %]
412                                                                         <span title="[% img_title | html %]" class="[% itemsloo.normalized_isbn | html %]" id="openlibrary-thumbnail[% loop.count | html %]"></span>
413                                                                     [% ELSE %]
414                                                                         <span class="no-image">No cover image available</span>
415                                                                     [% END %]
416                                                                 [% END %]
417
418                                                             </a> <!-- / .p1 -->
419                                                             [% IF ( Koha.Preference('BakerTaylorEnabled') && !Koha.Preference('BakerTaylorBookstoreURL') ) %]
420                                                                 [% bt_id = ( itemsloo.normalized_upc || itemsloo.normalized_isbn ) %]
421                                                                 [% IF ( bt_id ) %]
422                                                                     <img alt="See Baker &amp; Taylor" src="[% BakerTaylorImageURL | html %][% bt_id | html %]" />
423                                                                 [% ELSE %]
424                                                                     <span class="no-image">No cover image available</span>
425                                                                 [% END %]
426                                                             [% END %]
427
428                                                             [% IF ( Koha.Preference('BakerTaylorEnabled') && Koha.Preference('BakerTaylorBookstoreURL') ) %]
429                                                                 [% bt_id = ( itemsloo.normalized_upc || itemsloo.normalized_isbn ) %]
430                                                                 [% IF ( bt_id ) %]
431                                                                     <a href="https://[% Koha.Preference('BakerTaylorBookstoreURL') | uri %][% bt_id | uri %]">
432                                                                         <img alt="See Baker &amp; Taylor" src="[% BakerTaylorImageURL | html %][% bt_id | html %]" />
433                                                                     </a>
434                                                                 [% ELSE %]
435                                                                     <span class="no-image">No cover image available</span>
436                                                                 [% END %]
437                                                             [% END %]
438
439                                                             [% IF Koha.Preference('OPACCustomCoverImages') AND Koha.Preference('CustomCoverImagesURL') %]
440                                                                 [% IF ( itemsloo.BiblioDefaultViewmarc ) %]
441                                                                     <a class="custom_cover_image" href="/cgi-bin/koha/opac-MARCdetail.pl?biblionumber=[% itemsloo.biblionumber |url %]">
442                                                                 [% ELSE %]
443                                                                     [% IF ( itemsloo.BiblioDefaultViewisbd ) %]
444                                                                         <a class="custom_cover_image" href="/cgi-bin/koha/opac-ISBDdetail.pl?biblionumber=[% itemsloo.biblionumber |url %]">
445                                                                     [% ELSE %]
446                                                                         <a class="custom_cover_image" href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% itemsloo.biblionumber |url %]">
447                                                                     [% END %]
448                                                                 [% END %]
449                                                                 <img alt="Cover image" src="[% itemsloo.biblio_object.custom_cover_image_url | url %]" /></a>
450                                                             [% END %]
451
452                                                         </div>
453                                                         [% IF ( itemsloo.XSLTBloc ) %]
454                                                             [% itemsloo.XSLTBloc | $raw %]
455                                                         [% ELSE %]
456
457                                                             [% IF ( itemsloo.BiblioDefaultViewmarc ) %]
458                                                                 <a class="title" href="/cgi-bin/koha/opac-MARCdetail.pl?biblionumber=[% itemsloo.biblionumber |url %]" title="View details for this title">
459                                                             [% ELSE %]
460                                                                 [% IF ( itemsloo.BiblioDefaultViewisbd ) %]
461                                                                     <a class="title" href="/cgi-bin/koha/opac-ISBDdetail.pl?biblionumber=[% itemsloo.biblionumber |url %]" title="View details for this title">
462                                                                 [% ELSE %]
463                                                                     <a class="title" href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% itemsloo.biblionumber |url %]" title="View details for this title">
464                                                                 [% END %]
465                                                             [% END %]
466
467                                                             [% INCLUDE 'biblio-title.inc' biblio=itemsloo %]
468                                                             </a>
469
470                                                             [% IF ( itemsloo.author ) %]
471                                                                 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>
472                                                             [% ELSE %]
473                                                                 &nbsp;
474                                                             [% END %]
475
476                                                             <span class="results_summary">
477                                                                 <span class="label">Publication:</span>
478                                                                 [% IF ( itemsloo.place ) %]
479                                                                     [% itemsloo.place | html %]
480                                                                 [% END %]
481                                                                 [% IF ( itemsloo.publishercode ) %]
482                                                                     [% itemsloo.publishercode | html %]
483                                                                 [% END %]
484                                                                 [% IF ( itemsloo.publicationyear ) %]
485                                                                     [% itemsloo.publicationyear | html %]
486                                                                 [% ELSE %]
487                                                                     [% IF ( itemsloo.copyrightdate ) %]
488                                                                         [% itemsloo.copyrightdate | html %]
489                                                                     [% END %]
490                                                                 [% END %]
491                                                                 [% IF ( itemsloo.pages ) %]. [% itemsloo.pages | html %][% END %]
492                                                                 [% IF ( itemsloo.notes ) %], [% itemsloo.notes | html %][% END %]
493                                                                 [% IF ( itemsloo.item('size') ) %] [% itemsloo.item('size') | html %][% END %]
494                                                             </span>
495                                                             <span class="results_summary">
496                                                                 <span class="label">Holdings:</span>
497                                                                 [% IF ( itemsloo.ITEM_RESULTS ) %]
498                                                                     [% FOREACH ITEM_RESULT IN itemsloo.ITEM_RESULTS %]
499                                                                         [% ITEM_RESULT.homebranch | html %]
500                                                                         [% IF ( ITEM_RESULT.location_opac ) %]
501                                                                             <span class="shelvingloc">[% ITEM_RESULT.location_opac | html %]</span>
502                                                                         [% END %]
503                                                                         [% IF ( ITEM_RESULT.itemcallnumber ) %]
504                                                                             ([% ITEM_RESULT.itemcallnumber | html %])
505                                                                                 [% IF ( loop.last ) %].[% ELSE %],[% END %]
506                                                                         [% END %]
507                                                                     [% END %]
508                                                                 [% ELSE %]
509                                                                     This record has no items.
510                                                                 [% END %]
511                                                             </span>
512                                                         [% END # / IF itemsloo.XSLTBloc %]
513
514                                                         [% IF ( TagsShowEnabled && itemsloo.TagLoop.size ) %]
515                                                             <div class="results_summary tags">
516                                                                 <span class="label">Tags:</span>
517                                                                 <ul>
518                                                                     [% FOREACH TagLoo IN itemsloo.TagLoop %]
519                                                                         <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>
520                                                                     [% END %]
521                                                                 </ul>
522                                                             </div>
523                                                         [% END %]
524
525                                                         [% INCLUDE 'title-actions-menu.inc' items=itemsloo %]
526
527                                                         [% INCLUDE "openlibrary-readapi.inc" bib = itemsloo %]
528                                                         <!-- COinS / Openurl -->
529                                                         <span class="Z3988" title="[% itemsloo.coins | html %]"></span>
530                                                     </td>
531                                                 </tr>
532                                             [% END # / FOREACH itemsloop %]
533                                         </tbody>
534                                     </table> <!-- / #listcontents -->
535                                 </div><!-- / .searchresults -->
536
537                                 [% IF ( pagination_bar ) %]
538                                     <div class="pages">[% pagination_bar | $raw %]</div>
539                                 [% END %]
540
541                                 [% IF can_remove_biblios %]
542                                     <input type="hidden" name="op" value="remove_biblios" />
543                                     <input type="hidden" name="shelfnumber" value="[% shelf.shelfnumber | html %]" />
544                                     <input type="hidden" name="modifyshelfcontents" value="1" />
545                                     <input type="submit" value="Remove selected items" id="remove-selected" class="btn btn-danger"/>
546                                 [% END %]
547                             </form> <!-- /myform -->
548                         [% ELSE %]
549                             <div id="toolbar" class="toolbar clearfix">
550                                 <div class="list-actions">
551                                     <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>
552                                     [% IF can_manage_shelf %]
553                                         <span class="sep">|</span>
554                                         <form method="get" action="/cgi-bin/koha/opac-shelves.pl" class="d-inline">
555                                             <input type="hidden" name="op" value="edit_form" />
556                                             <input type="hidden" name="referer" value="view" />
557                                             <input type="hidden" name="category" value="[% shelf.category | html %]" />
558                                             <input type="hidden" name="shelfnumber" value="[% shelf.shelfnumber | html %]" />
559                                             <button type="submit" class="btn btn-link editshelf"><i class="fa fa-fw fa-pencil-square-o" aria-hidden="true"></i> Edit list</button>
560                                         </form>
561
562                                         [% PROCESS delete_shelf context = "details" %]
563
564                                     [% END %]
565                                 </div> <!-- / .list-actions -->
566                             </div> <!-- / #toolbar -->
567
568                             <div class="alert alert-info">
569                                 This list is empty.
570                                 [% IF Koha.Preference( 'opacuserlogin' ) == 1 %]
571                                     You can add to your lists from the results of any <a href="opac-main.pl">search</a>.
572                                 [% END %]
573                             </div>
574
575                             [% IF can_manage_shelf %]
576                                 <form method="post" action="opac-shelves.pl">
577                                     <input type="hidden" name="op" value="delete" />
578                                     <input type="hidden" name="referer" value="list" />
579                                     <input type="hidden" name="shelfnumber" value="[% shelf.shelfnumber | html %]"/>
580                                     <input type="submit" class="btn btn-danger" value="Delete this list" onclick="return confirmDelete(MSG_CONFIRM_DELETE_LIST)" />
581                                 </form>
582                             [% END %]
583                         [% END # / IF itemsloop %]
584                     [% END # /IF shelf AND op == 'view' %]
585
586                     [% IF op == 'add_form' OR op == 'edit_form' %]
587                         <form method="post" action="/cgi-bin/koha/opac-shelves.pl">
588                             <fieldset class="rows">
589                                 [% IF op == 'add_form' %]
590                                     <div id="addshelf">
591                                     <legend>Create a new list</legend>
592                                     <input type="hidden" name="op" value="add" />
593                                 [% ELSE %]
594                                     <legend>Editing <em>[% shelf.shelfname | html %]</em></legend>
595                                     <input type="hidden" name="op" value="edit" />
596                                     <input type="hidden" name="referer" value="[% referer | html %]" />
597                                     <input type="hidden" name="shelfnumber" value="[% shelf.shelfnumber | html %]" />
598                                 [% END %]
599                                 <input type="hidden" name="owner" id="owner" value="[% loggedinusernumber | html %]" />
600                                 <ol>
601                                     <li>
602                                         <label class="required" for="shelfname">List name: </label>
603                                         <input type="text" id="shelfname" name="shelfname" maxlength="255" value="[% shelf.shelfname | html %]" required="required" class="required"/>
604                                         <span class="required">Required</span></li>
605                                     <li>
606                                         <label for="sortfield" >Sort this list by: </label>
607                                         <select name="sortfield" id="sortfield">
608                                             [% IF shelf.sortfield == "title" %]
609                                                 <option value="title" selected="selected">Title</option>
610                                             [% ELSE %]
611                                                 <option value="title">Title</option>
612                                             [% END %]
613                                             [% IF shelf.sortfield == "author" %]
614                                                 <option value="author" selected="selected">Author</option>
615                                             [% ELSE %]
616                                                 <option value="author">Author</option>
617                                             [% END %]
618                                             [% IF shelf.sortfield == "copyrightdate" %]
619                                                 <option value="copyrightdate" selected="selected">Year</option>
620                                             [% ELSE %]
621                                                 <option value="copyrightdate">Year</option>
622                                             [% END %]
623                                             [% IF shelf.sortfield == "itemcallnumber" %]
624                                                 <option value="itemcallnumber" selected="selected">Call number</option>
625                                             [% ELSE %]
626                                                 <option value="itemcallnumber">Call number</option>
627                                             [% END %]
628                                             [% IF shelf.sortfield == "dateadded" %]
629                                                 <option value="dateadded" selected="selected">Date added</option>
630                                             [% ELSE %]
631                                                 <option value="dateadded">Date added</option>
632                                             [% END %]
633                                         </select>
634                                     </li>
635                                     [% IF Koha.Preference('OpacAllowPublicListCreation') OR category == PUBLIC %]
636                                         <li>
637                                             <label for="category">Category:</label>
638                                             <select name="category" id="category" onchange="AdjustRemark()">
639                                                 [% IF shelf.is_private %]
640                                                         <option value="1" selected="selected">Private</option>
641                                                     [% ELSE %]
642                                                         <option value="1">Private</option>
643                                                     [% END %]
644                                                 [% IF shelf.is_public %]
645                                                     <option value="2" selected="selected">Public</option>
646                                                 [% ELSE %]
647                                                     <option value="2">Public</option>
648                                                 [% END %]
649                                             </select>
650                                             [% IF shelf.is_public AND NOT Koha.Preference('OpacAllowPublicListCreation') %]
651                                                 <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>
652                                             [% END %]
653                                         </li>
654                                     [% END %]
655                                     [% INCLUDE list_permissions %]
656                                 </ol>
657                                 [% UNLESS Koha.Preference('OpacAllowPublicListCreation') OR category == PUBLIC %]
658                                     <input type="hidden" name="category" value="[% PRIVATE | html %]" />
659                                 [% END %]
660                             </fieldset> <!-- /.rows -->
661
662                             <fieldset class="action">
663                                 <input type="submit" value="Save" class="btn btn-primary" />
664                                 [% IF referer == 'view' %]
665                                     <a href="/cgi-bin/koha/opac-shelves.pl?op=view&amp;shelfnumber=[% shelf.shelfnumber | uri %]" class="cancel">Cancel</a>
666                                 [% ELSE %]
667                                     <a href="/cgi-bin/koha/opac-shelves.pl?op=list&amp;category=[% PRIVATE | uri %]" class="cancel">Cancel</a>
668                                 [% END %]
669                             </fieldset>
670                         </form>
671
672                     [% ELSIF op == 'list' %]
673                         <h2>Lists</h2>
674                         <div class="toptabs ui-tabs ui-widget ui-widget-content ui-corner-all">
675                             <ul class="ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all">
676                                 [% IF Koha.Preference( 'opacuserlogin' ) == 1 %]
677                                     [% IF category == PRIVATE %]
678                                         <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>
679                                     [% ELSE %]
680                                         <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>
681                                     [% END %]
682                                 [% END %]
683                                 [% IF category == PUBLIC %]
684                                     <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>
685                                 [% ELSE %]
686                                     <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>
687                                 [% END %]
688                             </ul>
689
690                             [% IF category == PRIVATE %]
691                                 <div id="privateshelves" class="ui-tabs-panel ui-widget-content ui-corner-bottom" style="display:block;">
692                             [% ELSE %]
693                                 <div id="publicshelves" class="ui-tabs-panel ui-widget-content ui-corner-bottom" style="display:block;">
694                             [% END %]
695
696                             [% IF category == PRIVATE || Koha.Preference('OpacAllowPublicListCreation') %]
697                                 [% IF loggedinusername %]
698                                     <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>
699                                 [% ELSE %]
700                                     [% IF Koha.Preference( 'opacuserlogin' ) == 1 %]
701                                         <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>
702                                     [% END %]
703                                 [% END %]
704                             [% END %]
705
706                             [% IF shelves.count %]
707                                 <table class="table">
708                                     <thead>
709                                         <tr>
710                                             <th>List name</th>
711                                             <th>Contents</th>
712                                             <th>Type</th>
713                                             <th>&nbsp;</th>
714                                         </tr>
715                                     </thead>
716                                     <tbody>
717                                         [% FOREACH s IN shelves %]
718                                             [% SET contents = s.get_contents %]
719                                             <tr>
720                                                 <td><a href="/cgi-bin/koha/opac-shelves.pl?op=view&amp;shelfnumber=[% s.shelfnumber | uri %]">[% s.shelfname | html %]</a></td>
721                                                 <td>[% IF contents.count %][% contents.count | html %] [% IF contents.count == 1 %]item[% ELSE %]items[% END %][% ELSE %]Empty[% END %]</td>
722                                                 <td>
723                                                     [% IF s.is_private %]
724                                                         [% IF s.is_shared %]Shared[% ELSE %]Private[% END %]
725                                                     [% ELSE %]
726                                                         Public
727                                                     [% END %]
728                                                 </td>
729                                                 <td>
730                                                     [% IF s.can_be_managed( loggedinusernumber ) %]
731                                                         <form action="/cgi-bin/koha/opac-shelves.pl" method="get" class="d-inline">
732                                                             <input type="hidden" name="shelfnumber" value="[% s.shelfnumber | html %]" />
733                                                             <input type="hidden" name="category" value="[% s.category | html %]" />
734                                                             <input type="hidden" name="op" value="edit_form" />
735                                                             <input type="hidden" name="referer" value="list" />
736                                                             <button type="submit" class="btn btn-link editshelf"><i class="fa fa-pencil-square-o" aria-hidden="true"></i> Edit</button>
737                                                         </form>
738                                                     [% END %]
739                                                     [% IF s.can_be_deleted( loggedinusernumber ) %]
740                                                         [% PROCESS delete_shelf shelf = s context = "list" %]
741                                                     [% END %]
742                                                     [% IF s.is_private AND s.can_be_managed( loggedinusernumber ) AND Koha.Preference('OpacAllowSharingPrivateLists') %]
743                                                         <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>
744                                                     [% END %]
745                                                     [% IF s.is_shared_with( loggedinusernumber ) %]
746                                                         <form action="opac-shelves.pl" method="post" id="unshare[% s.shelfnumber | html %]" class="d-inline">
747                                                             <input type="hidden" name="op" value="remove_share" />
748                                                             <input type="hidden" name="referer" value="list" />
749                                                             <input type='hidden' name='category' value='[% category | html %]' />
750                                                             <input type="hidden" name="shelfnumber" value="[% s.shelfnumber | html %]" />
751                                                             <button type="submit" class="btn btn-link remove remove_share"
752                                                             data-shelfname="[% s.shelfname | html %]" data-shelfnumber="[% s.shelfnumber | html %]"><i class="fa fa-remove" aria-hidden="true"></i> Remove share</button>
753                                                         </form>
754                                                     [% END %]&nbsp;
755                                                 </td>
756                                             </tr>
757                                         [% END %]
758                                     </tbody>
759                                 </table> <!-- /.table -->
760                                 <div class="pages">[% pagination_bar | $raw %]</div>
761                             [% ELSE %]
762                                 [% IF category == PUBLIC %]
763                                     <p>No public lists.</p>
764                                 [% ELSIF loggedinusernumber %]
765                                     <p>No private lists.</p>
766                                 [% END %]
767                             [% END # /IF shelves.count %]
768                         </div> [%# <div class="toptabs ui-tabs ui-widget ui-widget-content ui-corner-all"> %]
769                     [% ELSIF NOT loggedinusernumber %]
770                         [% IF Koha.Preference( 'opacuserlogin' ) == 1 %]
771                             <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>
772                         [% END %]
773                     [% END  # IF op == 'add_form' OR op == 'edit_form' %]
774                 </div> <!-- / #usershelves -->
775             </div> <!-- / .col-lg-10/12 -->
776         </div> <!-- / .row -->
777     </div> <!-- / .container-fluid -->
778 </div> <!-- / .main -->
779
780 <div class="modal" id="modalWin" role="dialog" aria-hidden="true" tabindex="-1">
781     <div class="modal-content">
782         <div class="modal-body">
783             <div style="margin:1em;padding:1em;font-size:150%;">
784                 <img src="[% interface | html %]/[% theme | html %]/images/loading.gif" alt="" /> Loading
785             </div>
786         </div>
787     </div>
788 </div>
789
790 <!-- DEBUG -->
791     <div id="debug"></div>
792 <!-- /DEBUG -->
793
794 [% INCLUDE 'opac-bottom.inc' %]
795 [% BLOCK jsinclude %]
796 [% Asset.js("lib/jquery/plugins/jquery.checkboxes.min.js") | $raw %]
797 [% Asset.js("lib/hc-sticky.js") | $raw %]
798 [% IF OpenLibraryCovers || OpenLibrarySearch %]
799     [% Asset.js("js/openlibrary.js") | $raw %]
800 [% END %]
801 <script>
802 var MSG_REMOVE_FROM_LIST = _("Are you sure you want to remove these items from the list?");
803 var MSG_REMOVE_ONE_FROM_LIST = _("Are you sure you want to remove this item from the list?");
804 var MSG_CONFIRM_DELETE_LIST = _("Are you sure you want to delete this list?");
805 var MSG_CONFIRM_REMOVE_SHARE = _("Are you sure you want to remove this share?");
806
807 [% IF ( ( Koha.Preference( 'opacuserlogin' ) == 1 ) && ( Koha.Preference( 'RequestOnOpac' ) == 1 ) ) %]
808     function holdSelections() {
809         var checkedBoxes = $("input:checkbox:checked");
810         if ($(checkedBoxes).size() == 0) {
811             alert(MSG_NO_RECORD_SELECTED);
812         } else {
813             var bibs = "";
814             $(checkedBoxes).each(function(){
815                 bibs += $(this).val() + "/";
816             });
817             document.location = "/cgi-bin/koha/opac-reserve.pl?biblionumbers="+bibs;
818         }
819     }
820 [% END %]
821 [% IF ( TagsInputEnabled && loggedinusername ) %]
822     function tagSelected() {
823         var checkedBoxes = $("input:checkbox:checked");
824         if ($(checkedBoxes).size()) {
825             $("#tagsel_tag").hide();
826             $(".tag_hides").hide();
827             $("#tagsel_form").show();
828         } else {
829             alert(MSG_NO_RECORD_SELECTED);
830         }
831     }
832
833     function tagCanceled() {
834         $("#tagsel_form").hide();
835         $("#tagsel_tag").show();
836         $(".tag_hides").show();
837         $("#tagsel_new").val("");
838         $(".tagstatus").empty().hide();
839     }
840
841     function tagAdded() {
842         var checkedBoxes = $("input:checkbox:checked");
843         if (!$(checkedBoxes).size()) {
844             alert(MSG_NO_RECORD_SELECTED);
845             return false;
846         }
847
848         var tag = $("#tagsel_new").val();
849         if (!tag || (tag == "")) {
850             alert(MSG_NO_TAG_SPECIFIED);
851             return false;
852         }
853
854         var bibs = [];
855         for (var i = 0; i < $(checkedBoxes).size(); i++) {
856             var box = $(checkedBoxes).get(i);
857             bibs[i] = $(box).val();
858         }
859
860         KOHA.Tags.add_multitags_button(bibs, tag);
861         return false;
862     }
863 [% END %]
864
865 function enableCheckboxActions(){
866     // Enable/disable controls if checkboxes are checked
867     var checkedBoxes = $(".checkboxed input:checkbox:checked");
868     if ($(checkedBoxes).size()) {
869       $("#selections").html(_("With selected titles: "));
870       $("#selections-toolbar .links a").removeClass("disabled");
871     } else {
872       $("#selections").html(_("Select titles to: "));
873       $("#selections-toolbar .links a").addClass("disabled");
874     }
875 }
876
877 $(function() {
878     [% IF Koha.Preference( 'opacbookbag' ) == 1 %]$(".addtocart,.cartRemove").removeClass("hidden");[% END %]
879     $("span.clearall").html("<a id=\"CheckNone\" class=\"btn btn-link btn-sm\" href=\"#\">"+_("Clear all")+"<\/a>");
880     $("span.checkall").html("<a id=\"CheckAll\" class=\"btn btn-link btn-sm\" href=\"#\">"+_("Select all")+"<\/a>");
881     $("a.print").show();
882
883     [% IF ( ( Koha.Preference( 'opacuserlogin' ) == 1 ) && ( Koha.Preference( 'RequestOnOpac' ) == 1 ) ) %]
884         $("#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>");
885         $("#selections-toolbar a.hold").click(function(){
886             holdSelections();
887             return false;
888         });
889     [% END %]
890
891     $("#CheckAll").click(function(){
892         $(".checkboxed").checkCheckboxes();
893         enableCheckboxActions();
894         return false;
895     });
896     $("#CheckNone").click(function(){
897         $(".checkboxed").unCheckCheckboxes();
898         enableCheckboxActions();
899         return false;
900     });
901
902     $(".cb").click(function(){
903       enableCheckboxActions();
904     });
905     enableCheckboxActions();
906
907     [% IF ( TagsInputEnabled && loggedinusername ) %]
908         var tagAdd = $(".tag_add");
909         tagAdd.removeClass("hidden");
910         $("#tagsel_tag").click(function(){
911             tagSelected();
912             return false;
913         });
914         $("#tagsel_cancel").click(function(){
915             tagCanceled();
916             return false;
917         });
918         $("#tagsel_button").click(function(){
919             tagAdded();
920             return false;
921         });
922
923         tagAdd.click(function(){
924             var thisid = $(this).attr("id");
925             thisid = thisid.replace("tag_add","");
926             $(this).hide();
927             $("#tagform"+thisid).show();
928             $("#newtag"+thisid).focus();
929             $("#newtag"+thisid+"_status").empty().hide();
930             return false;
931         });
932         $(".cancel_tag_add").click(function(){
933             var thisid = $(this).attr("id");
934             thisid = thisid.replace("cancel","");
935             $("#tagform"+thisid).hide();
936             $("#tag_add"+thisid).show();
937             $("#newtag"+thisid).val("");
938             $("#newtag"+thisid+"_status").empty().hide();
939             return false;
940         });
941         $(".tagbutton").click(function(){
942           var thisid = $(this).attr("title");
943           var tag = $("#newtag"+thisid).val();
944           if (!tag || (tag == "")) {
945               alert(MSG_NO_TAG_SPECIFIED);
946               return false;
947           }
948           KOHA.Tags.add_tag_button(thisid, tag);
949           return false;
950         });
951     [% END %]
952
953     [% IF loggedinusername && can_remove_biblios %]
954         $(".removefromlist").on("click", function(e){
955             return confirmDelete(MSG_REMOVE_ONE_FROM_LIST);
956         });
957
958         $("#myform").submit(function(){
959             var checkedBoxes = $(".checkboxed input:checkbox:checked");
960             var numchecked = $(checkedBoxes).size();
961             if (numchecked) {
962                 if( numchecked > 1 ){
963                     return confirmDelete(MSG_REMOVE_FROM_LIST);
964                 } else {
965                     return confirmDelete(MSG_REMOVE_ONE_FROM_LIST);
966                 }
967             } else {
968                 alert(MSG_NO_RECORD_SELECTED);
969                 return false;
970             }
971         });
972         $("#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>")
973         .click(function(){
974             $("#myform").submit();
975             return false;
976         });
977     [% END %]
978     [% IF OpenLibraryCovers %]KOHA.OpenLibrary.GetCoverFromIsbn();[% END %]
979     [% IF OPACLocalCoverImages %]KOHA.LocalCover.GetCoverFromBibnumber(false);[% END %]
980     [% IF ( GoogleJackets ) %]KOHA.Google.GetCoverFromIsbn();[% END %]
981     [% IF ( Koha.Preference('OpacCoce') && Koha.Preference('CoceProviders') ) %]
982         KOHA.coce.getURL('[% Koha.Preference('CoceHost') | html %]', '[% Koha.Preference('CoceProviders') | html %]');
983     [% END %]
984
985     [% IF print %]
986         window.print();
987         window.onafterprint = function () {
988             window.close();
989         }
990         setTimeout('window.close()', 1000); // Hack for Chrome < 63
991     [% END %]
992
993     AdjustRemark();
994
995     Sticky = $("#floating");
996     Sticky.hcSticky({
997         stickTo: "#usershelves",
998         stickyClass: "floating"
999     });
1000
1001     [% IF itemsloop %]
1002         sortMenu( $("#sorting-form") );
1003
1004         $("#sortfield").on("change", function(){
1005             $('#sorting-form').submit();
1006         });
1007     [% END %]
1008
1009     $(".deleteshelf").on("click", function(e){
1010         e.preventDefault();
1011         var shelf_name = $(this).data("shelfname");
1012         var shelf_number = $(this).data("shelfnumber");
1013         var is_shared = $(this).data("shared");
1014         var count = $(this).data("count");
1015         var message = "<p><em>" + shelf_name + "</em></p>";
1016         if( count ){
1017             message += "<p>" + _("Items on this list:") + " <strong>" + count + "</strong></p>";
1018         }
1019         if( is_shared ){
1020             message += "<p>" + _("This list is shared. Other users will lose access to it.") + "</p>";
1021         }
1022         confirmModal( message, _("Are you sure you want to delete this list?"), _("Yes, delete"), _("No, do not delete"), function( result ){
1023                 if( result ){
1024                     $("#deleteshelf" + shelf_number ).submit();
1025                 }
1026             }
1027         );
1028     });
1029
1030     $(".remove_share").on("click", function(e){
1031         e.preventDefault();
1032         var shelf_name = $(this).data("shelfname");
1033         var shelf_number = $(this).data("shelfnumber");
1034         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 ){
1035                 if( result ){
1036                     $("#unshare" + shelf_number ).submit();
1037                 }
1038             }
1039         );
1040     });
1041
1042 }); // document.ready
1043
1044 function sortMenu( sorting_form ){
1045     var shelfnumber = sorting_form.find("input[name='shelfnumber']").val();
1046     var sort_link = "/cgi-bin/koha/opac-shelves.pl?op=view&amp;shelfnumber=" + shelfnumber + "&sortfield=";
1047     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\">";
1048     $("#sortfield").children().each(function(){
1049         if( $(this)[0].tagName.toUpperCase() == "OPTION" ){
1050             menu += "<a class=\"dropdown-item\" href=\"" + sort_link + $(this).val() + "\">" + $(this).text() + "</a>";
1051         } else if( $(this)[0].tagName.toUpperCase() == "OPTGROUP" ){
1052             menu += "<span class=\"dropdown-header\">" + $(this).attr("label") + "</span>";
1053             $(this).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                 }
1057             });
1058         }
1059     });
1060     menu += "</div>";
1061     $(".list-actions").append( menu );
1062     sorting_form.remove();
1063 }
1064
1065 function AdjustRemark() {
1066     var category;
1067     if( $("#category").length > 0 ) {
1068         category = $("#category").val();
1069     } else {
1070         category = [% category | html %];
1071     }
1072     var perms = $("#allow_changes_from").val();
1073
1074     if( perms < 2 ) {
1075         $("#anyone_remark").hide();
1076     } else if( category==1 ) {
1077         // If we move to Private (without shares), show Anyone remark
1078         // Note: the number of shares is not tested real-time
1079         [% IF !shelf.is_shared %]
1080             $("#anyone_remark").show();
1081         [% ELSE %]
1082             $("#anyone_remark").hide();
1083         [% END %]
1084     } else { // category==2
1085         $("#anyone_remark").hide();
1086     }
1087 }
1088 </script>
1089 [% END %]