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