Bug 24884: Remove 'New list' button in 'Public lists' tab if OpacAllowPublicListCreat...
[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                                                     [% INCLUDE "openlibrary-readapi.inc" bib = itemsloo %]
500                                                     <!-- COinS / Openurl -->
501                                                     <span class="Z3988" title="[% itemsloo.coins | html %]"></span>
502                                                 </td>
503                                             </tr>
504                                         [% END # / FOREACH itemsloop %]
505                                         </tbody>
506                                     </table> <!-- / #listcontents -->
507                                 </div><!-- / .searchresults -->
508
509                             [% IF ( pagination_bar ) %]
510                                 <div class="pages">[% pagination_bar | $raw %]</div>
511                             [% END %]
512
513                         [% ELSE %]
514                             <div id="toolbar" class="toolbar clearfix">
515                                 <div class="list-actions">
516                                     <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>
517                                     [% IF can_manage_shelf %]
518                                         <span class="sep">|</span>
519                                         <form method="get" action="/cgi-bin/koha/opac-shelves.pl" class="form-inline">
520                                             <input type="hidden" name="op" value="edit_form" />
521                                             <input type="hidden" name="referer" value="view" />
522                                             <input type="hidden" name="category" value="[% shelf.category | html %]" />
523                                             <input type="hidden" name="shelfnumber" value="[% shelf.shelfnumber | html %]" />
524                                             <button type="submit" class="btn btn-link editshelf"><i class="fa fa-fw fa-pencil-square-o" aria-hidden="true"></i> Edit list</button>
525                                         </form>
526
527                                         [% PROCESS delete_shelf context = "details" %]
528
529                                     [% END %]
530                                 </div> <!-- / .list-actions -->
531                             </div> <!-- / #toolbar -->
532
533                             <div class="alert alert-info">
534                                 This list is empty.
535                                 [% IF Koha.Preference( 'opacuserlogin' ) == 1 %]
536                                     You can add to your lists from the results of any <a href="opac-main.pl">search</a>.
537                                 [% END %]
538                             </div>
539                         [% END # / IF itemsloop %]
540                       [% END %]
541                     [% IF itemsloop && can_remove_biblios %]
542                         <input type="hidden" name="op" value="remove_biblios" />
543                         <input type="hidden" name="shelfnumber" value="[% shelf.shelfnumber | html %]" />
544                         <input type="hidden" name="modifyshelfcontents" value="1" />
545                         <input type="submit" value="Remove selected items" id="remove-selected" class="btn btn-danger"/>
546                     [% ELSIF !itemsloop && can_manage_shelf %]
547                         <form method="post" action="opac-shelves.pl">
548                         <input type="hidden" name="op" value="delete" />
549                         <input type="hidden" name="referer" value="list" />
550                         <input type="hidden" name="shelfnumber" value="[% shelf.shelfnumber | html %]"/>
551                         <input type="submit" class="btn btn-danger" value="Delete this list" onclick="return confirmDelete(MSG_CONFIRM_DELETE_LIST)" />
552                     [% END %]
553                             </form> <!-- / myform -->
554
555                     [% IF op == 'add_form' OR op == 'edit_form' %]
556                         <form method="post" action="/cgi-bin/koha/opac-shelves.pl">
557                             <fieldset class="rows">
558                                 [% IF op == 'add_form' %]
559                                     <div id="addshelf">
560                                     <legend>Create a new list</legend>
561                                     <input type="hidden" name="op" value="add" />
562                                 [% ELSE %]
563                                     <legend>Editing <em>[% shelf.shelfname | html %]</em></legend>
564                                     <input type="hidden" name="op" value="edit" />
565                                     <input type="hidden" name="referer" value="[% referer | html %]" />
566                                     <input type="hidden" name="shelfnumber" value="[% shelf.shelfnumber | html %]" />
567                                 [% END %]
568                                 <input type="hidden" name="owner" id="owner" value="[% loggedinusernumber | html %]" />
569                                 <ol>
570                                     <li>
571                                         <label class="required" for="shelfname">List name: </label>
572                                         <input type="text" id="shelfname" name="shelfname" maxlength="255" value="[% shelf.shelfname | html %]" required="required" class="required"/> <span class="required">Required</span></li>
573                                     <li>
574                                         <label for="sortfield" >Sort this list by: </label>
575                                         <select name="sortfield" id="sortfield">
576                                             [% IF shelf.sortfield == "title" %]
577                                                 <option value="title" selected="selected">Title</option>
578                                             [% ELSE %]
579                                                 <option value="title">Title</option>
580                                             [% END %]
581                                             [% IF shelf.sortfield == "author" %]
582                                                 <option value="author" selected="selected">Author</option>
583                                             [% ELSE %]
584                                                 <option value="author">Author</option>
585                                             [% END %]
586                                             [% IF shelf.sortfield == "copyrightdate" %]
587                                                 <option value="copyrightdate" selected="selected">Year</option>
588                                             [% ELSE %]
589                                                 <option value="copyrightdate">Year</option>
590                                             [% END %]
591                                             [% IF shelf.sortfield == "itemcallnumber" %]
592                                                 <option value="itemcallnumber" selected="selected">Call number</option>
593                                             [% ELSE %]
594                                                 <option value="itemcallnumber">Call number</option>
595                                             [% END %]
596                                             [% IF shelf.sortfield == "dateadded" %]
597                                                 <option value="dateadded" selected="selected">Date added</option>
598                                             [% ELSE %]
599                                                 <option value="dateadded">Date added</option>
600                                             [% END %]
601                                         </select>
602                                     </li>
603                                     [% IF Koha.Preference('OpacAllowPublicListCreation') OR category == PUBLIC %]
604                                         <li>
605                                             <label for="category">Category:</label>
606                                             <select name="category" id="category" onchange="AdjustRemark()">
607                                                 [% IF shelf.is_private %]
608                                                         <option value="1" selected="selected">Private</option>
609                                                     [% ELSE %]
610                                                         <option value="1">Private</option>
611                                                     [% END %]
612                                                 [% IF shelf.is_public %]
613                                                     <option value="2" selected="selected">Public</option>
614                                                 [% ELSE %]
615                                                     <option value="2">Public</option>
616                                                 [% END %]
617                                             </select>
618                                             [% IF shelf.is_public AND NOT Koha.Preference('OpacAllowPublicListCreation') %]
619                                                 <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>
620                                             [% END %]
621                                         </li>
622                                     [% END %]
623                                     [% INCLUDE list_permissions %]
624                                 </ol>
625                                 [% UNLESS Koha.Preference('OpacAllowPublicListCreation') OR category == PUBLIC %]
626                                     <input type="hidden" name="category" value="[% PRIVATE | html %]" />
627                                 [% END %]
628                             </fieldset>
629
630                             <fieldset class="action">
631                                 <input type="submit" value="Save" class="btn" />
632                                 [% IF referer == 'view' %]
633                                     <a href="/cgi-bin/koha/opac-shelves.pl?op=view&amp;shelfnumber=[% shelf.shelfnumber | uri %]" class="cancel">Cancel</a>
634                                 [% ELSE %]
635                                      <a href="/cgi-bin/koha/opac-shelves.pl?op=list&amp;category=[% PRIVATE | uri %]" class="cancel">Cancel</a>
636                                  [% END %]
637
638                             </fieldset>
639                         </form>
640
641                     [% ELSIF op == 'list' %]
642                         <h2>Lists</h2>
643                         <div class="toptabs ui-tabs ui-widget ui-widget-content ui-corner-all">
644                         <ul class="ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all">
645                             [% IF Koha.Preference( 'opacuserlogin' ) == 1 %]
646                                 [% IF category == PRIVATE %]
647                                     <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>
648                                 [% ELSE %]
649                                     <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>
650                                 [% END %]
651                             [% END %]
652                             [% IF category == PUBLIC %]
653                                 <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>
654                             [% ELSE %]
655                                 <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>
656                             [% END %]
657                         </ul>
658
659                         [% IF category == PRIVATE %]
660                             <div id="privateshelves" class="ui-tabs-panel ui-widget-content ui-corner-bottom" style="display:block;">
661                         [% ELSE %]
662                             <div id="publicshelves" class="ui-tabs-panel ui-widget-content ui-corner-bottom" style="display:block;">
663                         [% END %]
664
665                         [% IF category == PRIVATE || Koha.Preference('OpacAllowPublicListCreation') %]
666                             [% IF loggedinusername %]
667                                 <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>
668                             [% ELSE %]
669                                 [% IF Koha.Preference( 'opacuserlogin' ) == 1 %]
670                                     <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>
671                                 [% END %]
672                             [% END %]
673                         [% END %]
674
675                             [% IF shelves.count %]
676                                 <table class="table">
677                                     <thead>
678                                         <tr>
679                                             <th>List name</th>
680                                             <th>Contents</th>
681                                             <th>Type</th>
682                                             <th>&nbsp;</th>
683                                         </tr>
684                                     </thead>
685                                     <tbody>
686                                         [% FOREACH s IN shelves %]
687                                             [% SET contents = s.get_contents %]
688                                             <tr>
689                                                 <td><a href="/cgi-bin/koha/opac-shelves.pl?op=view&amp;shelfnumber=[% s.shelfnumber | uri %]">[% s.shelfname | html %]</a></td>
690                                                 <td>[% IF contents.count %][% contents.count | html %] [% IF contents.count == 1 %]item[% ELSE %]items[% END %][% ELSE %]Empty[% END %]</td>
691                                                 <td>
692                                                     [% IF s.is_private %]
693                                                         [% IF s.is_shared %]Shared[% ELSE %]Private[% END %]
694                                                     [% ELSE %]
695                                                         Public
696                                                     [% END %]
697                                                 </td>
698                                                 <td>
699                                                     [% IF s.can_be_managed( loggedinusernumber ) %]
700                                                         <form action="/cgi-bin/koha/opac-shelves.pl" method="get" class="form-inline">
701                                                             <input type="hidden" name="shelfnumber" value="[% s.shelfnumber | html %]" />
702                                                             <input type="hidden" name="category" value="[% s.category | html %]" />
703                                                             <input type="hidden" name="op" value="edit_form" />
704                                                             <input type="hidden" name="referer" value="list" />
705                                                             <button type="submit" class="btn btn-link editshelf"><i class="fa fa-pencil-square-o" aria-hidden="true"></i> Edit</button>
706                                                         </form>
707                                                     [% END %]
708                                                     [% IF s.can_be_deleted( loggedinusernumber ) %]
709                                                         [% PROCESS delete_shelf shelf = s context = "list" %]
710                                                     [% END %]
711                                                     [% IF s.is_private AND s.can_be_managed( loggedinusernumber ) AND Koha.Preference('OpacAllowSharingPrivateLists') %]
712                                                         <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>
713                                                     [% END %]
714                                                     [% IF s.is_shared_with( loggedinusernumber ) %]
715                                                         <form action="opac-shelves.pl" method="post" id="unshare[% s.shelfnumber | html %]" class="form-inline">
716                                                             <input type="hidden" name="op" value="remove_share" />
717                                                             <input type="hidden" name="referer" value="list" />
718                                                             <input type='hidden' name='category' value='[% category | html %]' />
719                                                             <input type="hidden" name="shelfnumber" value="[% s.shelfnumber | html %]" />
720                                                             <button type="submit" class="btn btn-link remove remove_share"
721                                                             data-shelfname="[% s.shelfname | html %]" data-shelfnumber="[% s.shelfnumber | html %]"><i class="fa fa-remove" aria-hidden="true"></i> Remove share</button>
722                                                         </form>
723                                                     [% END %]&nbsp;
724                                                 </td>
725                                             </tr>
726                                         [% END %]
727                                     </tbody>
728                                 </table>
729                                 <div class="pages">[% pagination_bar | $raw %]</div>
730                             [% ELSE %]
731                                 [% IF category == PUBLIC %]
732                                     <p>No public lists.</p>
733                                 [% ELSIF loggedinusernumber %]
734                                     <p>No private lists.</p>
735                                 [% END %]
736                             [% END %]
737                             </div> [%# privateshelves or publicshelves %]
738                             </div> [%# <div class="toptabs ui-tabs ui-widget ui-widget-content ui-corner-all"> %]
739                         [% ELSIF NOT loggedinusernumber %]
740                             [% IF Koha.Preference( 'opacuserlogin' ) == 1 %]
741                                 <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>
742                             [% END %]
743                         [% END  # IF loggedinusername %]
744                 </div> <!-- / #usershelves -->
745                 </div> <!-- / .span10/12 -->
746       </div> <!-- / .row-fluid -->
747     </div> <!-- / .container-fluid -->
748   </div> <!-- / .main -->
749
750 <div class="modal hide" id="modalWin" role="dialog" aria-hidden="true" tabindex="-1">
751     <div class="modal-content">
752         <div class="modal-body">
753             <div style="margin:1em;padding:1em;font-size:150%;">
754                 <img src="[% interface | html %]/[% theme | html %]/images/loading.gif" alt="" /> Loading
755             </div>
756         </div>
757     </div>
758 </div>
759
760 <!-- DEBUG -->
761     <div id="debug"></div>
762 <!-- /DEBUG -->
763
764 [% INCLUDE 'opac-bottom.inc' %]
765 [% BLOCK jsinclude %]
766 [% Asset.js("lib/jquery/plugins/jquery.checkboxes.min.js") | $raw %]
767 [% Asset.js("lib/hc-sticky.js") | $raw %]
768 [% IF OpenLibraryCovers || OpenLibrarySearch %]
769     [% Asset.js("js/openlibrary.js") | $raw %]
770 [% END %]
771 <script>
772 var MSG_REMOVE_FROM_LIST = _("Are you sure you want to remove these items from the list?");
773 var MSG_REMOVE_ONE_FROM_LIST = _("Are you sure you want to remove this item from the list?");
774 var MSG_CONFIRM_DELETE_LIST = _("Are you sure you want to delete this list?");
775 var MSG_CONFIRM_REMOVE_SHARE = _("Are you sure you want to remove this share?");
776
777 [% IF ( ( Koha.Preference( 'opacuserlogin' ) == 1 ) && ( Koha.Preference( 'RequestOnOpac' ) == 1 ) ) %]
778     function holdSelections() {
779         var checkedBoxes = $("input:checkbox:checked");
780         if ($(checkedBoxes).size() == 0) {
781             alert(MSG_NO_RECORD_SELECTED);
782         } else {
783             var bibs = "";
784             $(checkedBoxes).each(function(){
785                 bibs += $(this).val() + "/";
786             });
787             document.location = "/cgi-bin/koha/opac-reserve.pl?biblionumbers="+bibs;
788         }
789     }
790 [% END %]
791 [% IF ( TagsInputEnabled && loggedinusername ) %]
792     function tagSelected() {
793         var checkedBoxes = $("input:checkbox:checked");
794         if ($(checkedBoxes).size()) {
795             $("#tagsel_tag").hide();
796             $(".tag_hides").hide();
797             $("#tagsel_form").show();
798         } else {
799             alert(MSG_NO_RECORD_SELECTED);
800         }
801     }
802
803     function tagCanceled() {
804         $("#tagsel_form").hide();
805         $("#tagsel_tag").show();
806         $(".tag_hides").show();
807         $("#tagsel_new").val("");
808         $(".tagstatus").empty().hide();
809     }
810
811     function tagAdded() {
812         var checkedBoxes = $("input:checkbox:checked");
813         if (!$(checkedBoxes).size()) {
814             alert(MSG_NO_RECORD_SELECTED);
815             return false;
816         }
817
818         var tag = $("#tagsel_new").val();
819         if (!tag || (tag == "")) {
820             alert(MSG_NO_TAG_SPECIFIED);
821             return false;
822         }
823
824         var bibs = [];
825         for (var i = 0; i < $(checkedBoxes).size(); i++) {
826             var box = $(checkedBoxes).get(i);
827             bibs[i] = $(box).val();
828         }
829
830         KOHA.Tags.add_multitags_button(bibs, tag);
831         return false;
832     }
833 [% END %]
834
835 function enableCheckboxActions(){
836     // Enable/disable controls if checkboxes are checked
837     var checkedBoxes = $(".checkboxed input:checkbox:checked");
838     if ($(checkedBoxes).size()) {
839       $("#selections").html(_("With selected titles: "));
840       $("#selections-toolbar .links a").removeClass("disabled");
841     } else {
842       $("#selections").html(_("Select titles to: "));
843       $("#selections-toolbar .links a").addClass("disabled");
844     }
845 }
846
847 $(function() {
848     [% IF Koha.Preference( 'opacbookbag' ) == 1 %]$(".addtocart,.cartRemove").removeClass("hidden");[% END %]
849     $("span.clearall").html("<a id=\"CheckNone\" href=\"#\">"+_("Clear all")+"<\/a>");
850     $("span.checkall").html("<a id=\"CheckAll\" href=\"#\">"+_("Select all")+"<\/a>");
851     $("a.print").show();
852
853     [% IF ( ( Koha.Preference( 'opacuserlogin' ) == 1 ) && ( Koha.Preference( 'RequestOnOpac' ) == 1 ) ) %]
854         $("#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>");
855         $("#selections-toolbar a.hold").click(function(){
856             holdSelections();
857             return false;
858         });
859     [% END %]
860
861     // If JS is enabled add parameter to download link
862     var dialoglink = $(".download").attr("href");
863     dialoglink += "&context=modal";
864     $(".download").attr("href",dialoglink);
865
866     $("#CheckAll").click(function(){
867         $(".checkboxed").checkCheckboxes();
868         enableCheckboxActions();
869         return false;
870     });
871     $("#CheckNone").click(function(){
872         $(".checkboxed").unCheckCheckboxes();
873         enableCheckboxActions();
874         return false;
875     });
876
877     $(".cb").click(function(){
878       enableCheckboxActions();
879     });
880     enableCheckboxActions();
881
882     [% IF ( TagsInputEnabled && loggedinusername ) %]
883         var tagAdd = $(".tag_add");
884         tagAdd.removeClass("hidden");
885         $("#tagsel_tag").click(function(){
886             tagSelected();
887             return false;
888         });
889         $("#tagsel_cancel").click(function(){
890             tagCanceled();
891             return false;
892         });
893         $("#tagsel_button").click(function(){
894             tagAdded();
895             return false;
896         });
897
898         tagAdd.click(function(){
899             var thisid = $(this).attr("id");
900             thisid = thisid.replace("tag_add","");
901             $(this).hide();
902             $("#tagform"+thisid).show();
903             $("#newtag"+thisid).focus();
904             $("#newtag"+thisid+"_status").empty().hide();
905             return false;
906         });
907         $(".cancel_tag_add").click(function(){
908             var thisid = $(this).attr("id");
909             thisid = thisid.replace("cancel","");
910             $("#tagform"+thisid).hide();
911             $("#tag_add"+thisid).show();
912             $("#newtag"+thisid).val("");
913             $("#newtag"+thisid+"_status").empty().hide();
914             return false;
915         });
916         $(".tagbutton").click(function(){
917           var thisid = $(this).attr("title");
918           var tag = $("#newtag"+thisid).val();
919           if (!tag || (tag == "")) {
920               alert(MSG_NO_TAG_SPECIFIED);
921               return false;
922           }
923           KOHA.Tags.add_tag_button(thisid, tag);
924           return false;
925         });
926     [% END %]
927
928     [% IF loggedinusername && can_remove_biblios %]
929         $(".removefromlist").on("click", function(e){
930             return confirmDelete(MSG_REMOVE_ONE_FROM_LIST);
931         });
932
933         $("#myform").submit(function(){
934             var checkedBoxes = $(".checkboxed input:checkbox:checked");
935             var numchecked = $(checkedBoxes).size();
936             if (numchecked) {
937                 if( numchecked > 1 ){
938                     return confirmDelete(MSG_REMOVE_FROM_LIST);
939                 } else {
940                     return confirmDelete(MSG_REMOVE_ONE_FROM_LIST);
941                 }
942             } else {
943                 alert(MSG_NO_RECORD_SELECTED);
944                 return false;
945             }
946         });
947         $("#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>")
948         .click(function(){
949             $("#myform").submit();
950             return false;
951         });
952     [% END %]
953     [% IF OpenLibraryCovers %]KOHA.OpenLibrary.GetCoverFromIsbn();[% END %]
954     [% IF OPACLocalCoverImages %]KOHA.LocalCover.GetCoverFromBibnumber(false);[% END %]
955     [% IF ( GoogleJackets ) %]KOHA.Google.GetCoverFromIsbn();[% END %]
956     [% IF ( Koha.Preference('OpacCoce') && Koha.Preference('CoceProviders') ) %]
957         KOHA.coce.getURL('[% Koha.Preference('CoceHost') | html %]', '[% Koha.Preference('CoceProviders') | html %]');
958     [% END %]
959
960     [% IF print %]
961         window.print();
962         window.onafterprint = function () {
963             window.close();
964         }
965         setTimeout('window.close()', 1000); // Hack for Chrome < 63
966     [% END %]
967
968     AdjustRemark();
969
970     Sticky = $("#floating");
971     Sticky.hcSticky({
972         stickTo: "#usershelves",
973         stickyClass: "floating"
974     });
975
976     [% IF itemsloop %]
977         sortMenu( $("#sorting-form") );
978
979         $("#sortfield").on("change", function(){
980             $('#sorting-form').submit();
981         });
982     [% END %]
983
984     $(".deleteshelf").on("click", function(e){
985         e.preventDefault();
986         var shelf_name = $(this).data("shelfname");
987         var shelf_number = $(this).data("shelfnumber");
988         var is_shared = $(this).data("shared");
989         var count = $(this).data("count");
990         var message = "<p><em>" + shelf_name + "</em></p>";
991         if( count ){
992             message += "<p>" + _("Items on this list:") + " <strong>" + count + "</strong></p>";
993         }
994         if( is_shared ){
995             message += "<p>" + _("This list is shared. Other users will lose access to it.") + "</p>";
996         }
997         confirmModal( message, _("Are you sure you want to delete this list?"), _("Yes, delete"), _("No, do not delete"), function( result ){
998                 if( result ){
999                     $("#deleteshelf" + shelf_number ).submit();
1000                 }
1001             }
1002         );
1003     });
1004
1005     $(".remove_share").on("click", function(e){
1006         e.preventDefault();
1007         var shelf_name = $(this).data("shelfname");
1008         var shelf_number = $(this).data("shelfnumber");
1009         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 ){
1010                 if( result ){
1011                     $("#unshare" + shelf_number ).submit();
1012                 }
1013             }
1014         );
1015     });
1016
1017 }); // document.ready
1018
1019 function sortMenu( sorting_form ){
1020     var shelfnumber = sorting_form.find("input[name='shelfnumber']").val();
1021     var sort_link = "/cgi-bin/koha/opac-shelves.pl?op=view&amp;shelfnumber=" + shelfnumber + "&sortfield=";
1022     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\">";
1023     $("#sortfield").children().each(function(){
1024         if( $(this)[0].tagName.toUpperCase() == "OPTION" ){
1025             menu += "<li><a href=\"" + sort_link + $(this).val() + "\">" + $(this).text() + "</a></li>";
1026         } else if( $(this)[0].tagName.toUpperCase() == "OPTGROUP" ){
1027             menu += "<li class=\"dropdown-header\">" + $(this).attr("label") + "</li>";
1028             $(this).children().each(function(){
1029                 if( $(this)[0].tagName.toUpperCase() == "OPTION" ){
1030                     menu += "<li><a href=\"" + sort_link + $(this).val() + "\">" + $(this).text() + "</a></li>";
1031                 }
1032             });
1033         }
1034     });
1035     menu += "</ul></div>";
1036     $(".list-actions").append( menu );
1037     sorting_form.remove();
1038 }
1039
1040 function AdjustRemark() {
1041     var category;
1042     if( $("#category").length > 0 ) {
1043         category = $("#category").val();
1044     } else {
1045         category = [% category | html %];
1046     }
1047     var perms = $("#allow_changes_from").val();
1048
1049     if( perms < 2 ) {
1050         $("#anyone_remark").hide();
1051     } else if( category==1 ) {
1052         // If we move to Private (without shares), show Anyone remark
1053         // Note: the number of shares is not tested real-time
1054         [% IF !shelf.is_shared %]
1055             $("#anyone_remark").show();
1056         [% ELSE %]
1057             $("#anyone_remark").hide();
1058         [% END %]
1059     } else { // category==2
1060         $("#anyone_remark").hide();
1061     }
1062 }
1063 </script>
1064 [% END %]