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