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