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