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