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