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