Bug 25280: Use modal confirmation when removing share from a list in the OPAC
[koha.git] / koha-tmpl / opac-tmpl / bootstrap / en / modules / opac-shelves.tt
1 [% USE raw %]
2 [% USE Asset %]
3 [% USE Koha %]
4 [% SET PRIVATE = 1 %]
5 [% SET PUBLIC = 2 %]
6 [% SET TagsShowEnabled = ( ( Koha.Preference( 'TagsEnabled' ) == 1 ) && Koha.Preference('TagsShowOnList') ) %]
7 [% SET TagsInputEnabled = ( ( Koha.Preference( 'opacuserlogin' ) == 1 ) && ( Koha.Preference( 'TagsEnabled' ) == 1 ) && Koha.Preference('TagsInputOnList') ) %]
8 [% SET AdlibrisEnabled = Koha.Preference('AdlibrisCoversEnabled') %]
9 [% SET AdlibrisURL = Koha.Preference('AdlibrisCoversURL') %]
10
11 [% 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='[% shelf.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='[% shelf.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" id="unshare[% shelf.shelfnumber | html %]" 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 remove remove_share"
201                                                             data-shelfname="[% shelf.shelfname | html %]" data-shelfnumber="[% shelf.shelfnumber | html %]"><i class="fa fa-remove" aria-hidden="true"></i> Remove share</button>
202                                         </form>
203                                     [% END %]
204                                 </div>
205
206                                 <form action="/cgi-bin/koha/opac-shelves.pl" id="sorting-form" class="form-inline sort_by pull-right">
207                                     <input type="hidden" name="op" value="view" />
208                                     <input type="hidden" name="shelfnumber" value="[% shelf.shelfnumber | html %]" />
209
210                                     <label for="sortfield">Sort by: </label>
211                                     <select name="sortfield" id="sortfield" class="resort">
212                                         <option value="">Default sorting</option>
213                                         <optgroup label="Author">
214                                             [% IF sortfield == 'author' && direction == 'asc' %]
215                                                 <option value="author:asc" selected="selected">Author (A-Z)</option>
216                                             [% ELSE %]
217                                                 <option value="author:asc">Author (A-Z)</option>
218                                             [% END %]
219                                             [% IF sortfield == 'author' && direction == 'desc' %]
220                                                 <option value="author:desc" selected="selected">Author (Z-A)</option>
221                                             [% ELSE %]
222                                                 <option value="author:desc">Author (Z-A)</option>
223                                             [% END %]
224                                         </optgroup>
225                                         <optgroup label="Title">
226                                             [% IF sortfield == 'title' && direction == 'asc' %]
227                                                 <option value="title:asc" selected="selected">Title (A-Z)</option>
228                                             [% ELSE %]
229                                                 <option value="title:asc">Title (A-Z)</option>
230                                             [% END %]
231                                             [% IF sortfield == 'title' && direction == 'desc' %]
232                                                 <option value="title:desc" selected="selected">Title (Z-A)</option>
233                                             [% ELSE %]
234                                                 <option value="title:desc">Title (Z-A)</option>
235                                             [% END %]
236                                         </optgroup>
237                                         <optgroup label="Call number">
238                                             [% IF sortfield == 'itemcallnumber' && direction == 'asc' %]
239                                                 <option value="itemcallnumber:asc" selected="selected">Call number (A-Z)</option>
240                                             [% ELSE %]
241                                                 <option value="itemcallnumber:asc">Call number (A-Z)</option>
242                                             [% END %]
243                                             [% IF sortfield == 'itemcallnumber' && direction == 'desc' %]
244                                                 <option value="itemcallnumber:desc" selected="selected">Call number (Z-A)</option>
245                                             [% ELSE %]
246                                                 <option value="itemcallnumber:desc">Call number (Z-A)</option>
247                                             [% END %]
248                                         </optgroup>
249                                         <optgroup label="Copyright date">
250                                             [% IF sortfield == 'copyrightdate' && direction == 'asc' %]
251                                                 <option value="copyrightdate:desc" selected="selected">Copyright date (newest to oldest)</option>
252                                             [% ELSE %]
253                                                 <option value="copyrightdate:desc">Copyright date (newest to oldest)</option>
254                                             [% END %]
255                                             [% IF sortfield == 'copyrightdate' && direction == 'desc' %]
256                                                 <option value="copyrightdate:asc" selected="selected">Copyright date (oldest to newest)</option>
257                                             [% ELSE %]
258                                                 <option value="copyrightdate:asc">Copyright date (oldest to newest)</option>
259                                             [% END %]
260                                         </optgroup>
261                                         <optgroup label="Date added">
262                                             [% IF sortfield == "dateadded" && direction == 'asc' %]
263                                                 <option value="dateadded:desc" selected="selected">Date added (newest to oldest)</option>
264                                             [% ELSE %]
265                                                 <option value="dateadded:desc">Date added (newest to oldest)</option>
266                                             [% END %]
267                                             [% IF sortfield == "dateadded" && direction == 'desc' %]
268                                                 <option value="dateadded:asc" selected="selected">Date added (oldest to newest)</option>
269                                             [% ELSE %]
270                                                 <option value="dateadded:asc">Date added (oldest to newest)</option>
271                                             [% END %]
272                                         </optgroup>
273                                     </select>
274
275                                     <input type="submit" class="btn btn-small" id="sort-submit" value="Resort list" />
276                                 </form>
277
278                             </div> <!-- / #toolbar -->
279
280                             <div id="selections-toolbar" class="toolbar noprint">
281                                 <span class="checkall"></span> <span class="clearall"></span> <span class="sep">|</span>
282                                 <span class="links">
283                                     <span id="selections">Select titles to: </span>
284                                     [% IF Koha.Preference( 'RequestOnOpac' ) == 1 %]
285                                         <span id="placehold"></span>
286                                     [% END %]
287                                     [% IF ( TagsInputEnabled && loggedinusername ) %]
288                                         <span id="addtags">
289                                           <a id="tagsel_tag" href="#" class="btn btn-link btn-disabled"><i class="fa fa-fw fa-tag"></i> Tag</a>
290                                         </span>
291                                         <span id="tagsel_form" style="display:none">
292                                           <label for="tagsel_new">New tag(s), separated by a comma:</label>
293                                           <input type="text" name="tagsel_new" id="tagsel_new" maxlength="100" />
294                                           <input id="tagsel_button" name="tagsel_button" class="tagsel_button btn btn-small" title="tagsel_button" type="submit" value="Add" />
295                                           <a href="#" id="tagsel_cancel">Cancel</a>
296                                         </span>
297                                     [% END %]
298                                     [% IF loggedinusername && can_remove_biblios %]
299                                         <span id="removeitems"></span>
300                                     [% END %]
301                                 </span> <!-- / .links -->
302                             </div> <!-- / #selections-toolbar -->
303                             </div> <!-- /#floating -->
304
305                             <form action="/cgi-bin/koha/opac-shelves.pl" method="post" id="myform" name="myform" class="checkboxed">
306                                 [% IF can_manage_shelf %]
307                                     <input type="hidden" name="op" value="remove_biblios" />
308                                     <input type="hidden" name="shelfnumber" value="[% shelf.shelfnumber | html %]" />
309                                 [% END %]
310                                 <div class="searchresults">
311                                     <table id="listcontents" class="table">
312                                         <tbody>
313                                         [% FOREACH itemsloo IN itemsloop %]
314                                             <tr>
315                                                 <td class="select selectcol"><input type="checkbox" class="cb" name="biblionumber" value="[% itemsloo.biblionumber | html %]" /></td>
316                                                 [% UNLESS ( item_level_itypes ) %]
317                                                     <td>
318                                                         [% UNLESS ( Koha.Preference('OpacNoItemTypeImages') ) %]
319                                                             <img src="[% itemsloo.imageurl | html %]" alt="[% itemsloo.description | html %]" title="[% itemsloo.description | html %]" />
320                                                         [% END %]
321                                                         [% itemsloo.description | html %]
322                                                     </td>
323                                                 [% END %]
324                                                 <td>
325                                                     <div class="coverimages">
326                                                         <a class="p1" href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% itemsloo.biblionumber | html %]">
327                                                             [% IF ( OPACLocalCoverImages ) %]
328                                                                 <span title="[% itemsloo.biblionumber |url %]" class="[% itemsloo.biblionumber | html %]" id="local-thumbnail[% loop.count | html %]"></span>
329                                                             [% END %]
330                                                             [% IF ( AdlibrisEnabled && itemsloo.normalized_isbn ) %]
331                                                                 <img src="[% AdlibrisURL | html %]?isbn=[% itemsloo.normalized_isbn | html %]" class="adlibris-cover" alt="Adlibris cover image" />
332                                                             [% END %]
333                                                             [% IF ( OPACAmazonCoverImages ) %]
334                                                                 [% IF ( itemsloo.normalized_isbn ) %]
335                                                                     <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>
336                                                                 [% ELSE %]
337                                                                     <span class="no-image">No cover image available</span>
338                                                                 [% END %]
339                                                             [% END %]
340
341                                                             [% IF ( SyndeticsEnabled && SyndeticsCoverImages ) %]
342                                                                 <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>
343                                                             [% END %]
344
345                                                             [% IF ( GoogleJackets ) %]
346                                                                 [% IF ( itemsloo.normalized_isbn ) %]
347                                                                     <div title="[% itemsloo.biblionumber |url %]" class="[% itemsloo.normalized_isbn | html %]" id="gbs-thumbnail[% loop.count | html %]"></div>
348                                                                 [% ELSE %]
349                                                                     <span class="no-image">No cover image available</span>
350                                                                 [% END %]
351                                                             [% END %]
352
353                                                             [% IF ( Koha.Preference('Coce') && Koha.Preference('CoceProviders') ) %]
354                                                                 [% coce_id = itemsloo.normalized_ean || itemsloo.normalized_isbn %]
355                                                                 [% IF ( coce_id ) %]
356                                                                     <span title="[% itemsloo.biblionumber |url %]" class="[% coce_id | html %]" id="coce-thumbnail[% loop.count | html %]"></span>
357                                                                 [% ELSE %]
358                                                                     <span class="no-image">No cover image available</span>
359                                                                 [% END %]
360                                                             [% END %]
361
362
363                                                             [% IF OpenLibraryCovers %]
364                                                                 [% IF itemsloo.normalized_isbn %]
365                                                                     <span title="[% itemsloo.biblionumber | html %]" class="[% itemsloo.normalized_isbn | html %]" id="openlibrary-thumbnail[% loop.count | html %]"></span>
366                                                                 [% ELSE %]
367                                                                     <span class="no-image">No cover image available</span>
368                                                                 [% END %]
369                                                             [% END %]
370
371                                                         </a> <!-- / .p1 -->
372                                                         [% IF ( Koha.Preference('BakerTaylorEnabled') && !Koha.Preference('BakerTaylorBookstoreURL') ) %]
373                                                             [% bt_id = ( itemsloo.normalized_upc || itemsloo.normalized_isbn ) %]
374                                                             [% IF ( bt_id ) %]
375                                                                 <img alt="See Baker &amp; Taylor" src="[% BakerTaylorImageURL | html %][% bt_id | html %]" />
376                                                             [% ELSE %]
377                                                                 <span class="no-image">No cover image available</span>
378                                                             [% END %]
379                                                         [% END %]
380
381                                                         [% IF ( Koha.Preference('BakerTaylorEnabled') && Koha.Preference('BakerTaylorBookstoreURL') ) %]
382                                                             [% bt_id = ( itemsloo.normalized_upc || itemsloo.normalized_isbn ) %]
383                                                             [% IF ( bt_id ) %]
384                                                                 <a href="https://[% Koha.Preference('BakerTaylorBookstoreURL') | uri %][% bt_id | uri %]">
385                                                                     <img alt="See Baker &amp; Taylor" src="[% BakerTaylorImageURL | html %][% bt_id | html %]" />
386                                                                 </a>
387                                                             [% ELSE %]
388                                                                 <span class="no-image">No cover image available</span>
389                                                             [% END %]
390                                                         [% END %]
391
392                                                         [% IF Koha.Preference('OPACCustomCoverImages') AND Koha.Preference('CustomCoverImagesURL') %]
393                                                             [% IF ( itemsloo.BiblioDefaultViewmarc ) %]
394                                                                 <a class="custom_cover_image" href="/cgi-bin/koha/opac-MARCdetail.pl?biblionumber=[% itemsloo.biblionumber |url %]">
395                                                             [% ELSE %]
396                                                                 [% IF ( itemsloo.BiblioDefaultViewisbd ) %]
397                                                                     <a class="custom_cover_image" href="/cgi-bin/koha/opac-ISBDdetail.pl?biblionumber=[% itemsloo.biblionumber |url %]">
398                                                                 [% ELSE %]
399                                                                     <a class="custom_cover_image" href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% itemsloo.biblionumber |url %]">
400                                                                 [% END %]
401                                                             [% END %]
402                                                             <img alt="Cover image" src="[% itemsloo.biblio_object.custom_cover_image_url | url %]" /></a>
403                                                         [% END %]
404
405                                                     </div>
406                                                     [% IF ( itemsloo.XSLTBloc ) %]
407                                                         [% itemsloo.XSLTBloc | $raw %]
408                                                     [% ELSE %]
409
410                                                         [% IF ( itemsloo.BiblioDefaultViewmarc ) %]
411                                                             <a class="title" href="/cgi-bin/koha/opac-MARCdetail.pl?biblionumber=[% itemsloo.biblionumber |url %]" title="View details for this title">
412                                                         [% ELSE %]
413                                                             [% IF ( itemsloo.BiblioDefaultViewisbd ) %]
414                                                                 <a class="title" href="/cgi-bin/koha/opac-ISBDdetail.pl?biblionumber=[% itemsloo.biblionumber |url %]" title="View details for this title">
415                                                             [% ELSE %]
416                                                                 <a class="title" href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% itemsloo.biblionumber |url %]" title="View details for this title">
417                                                             [% END %]
418                                                         [% END %]
419
420                                                         [% INCLUDE 'biblio-title.inc' biblio=itemsloo %]
421                                                         </a>
422
423                                                         [% IF ( itemsloo.author ) %]
424                                                             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>
425                                                         [% ELSE %]
426                                                             &nbsp;
427                                                         [% END %]
428
429                                                         <span class="results_summary">
430                                                             <span class="label">Publication:</span>
431                                                             [% IF ( itemsloo.place ) %]
432                                                                 [% itemsloo.place | html %]
433                                                             [% END %]
434                                                             [% IF ( itemsloo.publishercode ) %]
435                                                                 [% itemsloo.publishercode | html %]
436                                                             [% END %]
437                                                             [% IF ( itemsloo.publicationyear ) %]
438                                                                 [% itemsloo.publicationyear | html %]
439                                                             [% ELSE %]
440                                                                 [% IF ( itemsloo.copyrightdate ) %]
441                                                                     [% itemsloo.copyrightdate | html %]
442                                                                 [% END %]
443                                                             [% END %]
444                                                             [% IF ( itemsloo.pages ) %]. [% itemsloo.pages | html %][% END %]
445                                                             [% IF ( itemsloo.notes ) %], [% itemsloo.notes | html %][% END %]
446                                                             [% IF ( itemsloo.item('size') ) %] [% itemsloo.item('size') | html %][% END %]
447                                                         </span>
448                                                         <span class="results_summary">
449                                                             <span class="label">Holdings:</span>
450                                                             [% IF ( itemsloo.ITEM_RESULTS ) %]
451                                                                 [% FOREACH ITEM_RESULT IN itemsloo.ITEM_RESULTS %]
452                                                                     [% ITEM_RESULT.homebranch | html %]
453                                                                     [% IF ( ITEM_RESULT.location_opac ) %]
454                                                                         <span class="shelvingloc">[% ITEM_RESULT.location_opac | html %]</span>
455                                                                     [% END %]
456                                                                     [% IF ( ITEM_RESULT.itemcallnumber ) %]
457                                                                         ([% ITEM_RESULT.itemcallnumber | html %])
458                                                                             [% IF ( loop.last ) %].[% ELSE %],[% END %]
459                                                                     [% END %]
460                                                                 [% END %]
461                                                             [% ELSE %]
462                                                                 This record has no items.
463                                                             [% END %]
464                                                         </span>
465                                                     [% END # / IF itemsloo.XSLTBloc %]
466
467                                                     [% IF ( TagsShowEnabled && itemsloo.TagLoop.size ) %]
468                                                         <div class="results_summary tags">
469                                                             <span class="label">Tags:</span>
470                                                             <ul>
471                                                                 [% FOREACH TagLoo IN itemsloo.TagLoop %]
472                                                                     <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>
473                                                                 [% END %]
474                                                             </ul>
475                                                         </div>
476                                                     [% END %]
477
478                                                     [% INCLUDE 'title-actions-menu.inc' items=itemsloo %]
479
480                                                     <!-- COinS / Openurl -->
481                                                     <span class="Z3988" title="[% itemsloo.coins | html %]"></span>
482                                                 </td>
483                                             </tr>
484                                         [% END # / FOREACH itemsloop %]
485                                         </tbody>
486                                     </table> <!-- / #listcontents -->
487                                 </div><!-- / .searchresults -->
488
489                             [% IF ( pagination_bar ) %]
490                                 <div class="pages">[% pagination_bar | $raw %]</div>
491                             [% END %]
492
493                         [% ELSE %]
494                             <div id="toolbar" class="toolbar clearfix">
495                                 <div class="list-actions">
496                                     <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>
497                                     [% IF can_manage_shelf %]
498                                         <span class="sep">|</span>
499                                         <form method="get" action="/cgi-bin/koha/opac-shelves.pl" class="form-inline">
500                                             <input type="hidden" name="op" value="edit_form" />
501                                             <input type="hidden" name="referer" value="view" />
502                                             <input type="hidden" name="category" value="[% shelf.category | html %]" />
503                                             <input type="hidden" name="shelfnumber" value="[% shelf.shelfnumber | html %]" />
504                                             <button type="submit" class="btn btn-link editshelf"><i class="fa fa-fw fa-pencil-square-o"></i> Edit list</button>
505                                         </form>
506
507                                         <form method="post" action="/cgi-bin/koha/opac-shelves.pl" class="form-inline">
508                                             <input type="hidden" name="op" value="delete" />
509                                             <input type="hidden" name="shelfnumber" value="[% shelf.shelfnumber | html %]"/>
510                                             <input type="hidden" name="category" value="[% shelf.category | html %]" />
511                                             <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>
512                                         </form>
513                                     [% END %]
514                                 </div> <!-- / .list-actions -->
515                             </div> <!-- / #toolbar -->
516
517                             <div class="alert alert-info">
518                                 This list is empty.
519                                 [% IF Koha.Preference( 'opacuserlogin' ) == 1 %]
520                                     You can add to your lists from the results of any <a href="opac-main.pl">search</a>.
521                                 [% END %]
522                             </div>
523                         [% END # / IF itemsloop %]
524                       [% END %]
525                     [% IF itemsloop && can_remove_biblios %]
526                         <input type="hidden" name="op" value="remove_biblios" />
527                         <input type="hidden" name="shelfnumber" value="[% shelf.shelfnumber | html %]" />
528                         <input type="hidden" name="modifyshelfcontents" value="1" />
529                         <input type="submit" value="Remove selected items" id="remove-selected" class="btn btn-danger"/>
530                     [% ELSIF !itemsloop && can_manage_shelf %]
531                         <form method="post" action="opac-shelves.pl">
532                         <input type="hidden" name="op" value="delete" />
533                         <input type="hidden" name="referer" value="list" />
534                         <input type="hidden" name="shelfnumber" value="[% shelf.shelfnumber | html %]"/>
535                         <input type="submit" class="btn btn-danger" value="Delete this list" onclick="return confirmDelete(MSG_CONFIRM_DELETE_LIST)" />
536                     [% END %]
537                             </form> <!-- / myform -->
538
539                     [% IF op == 'add_form' OR op == 'edit_form' %]
540                         <form method="post" action="/cgi-bin/koha/opac-shelves.pl">
541                             <fieldset class="rows">
542                                 [% IF op == 'add_form' %]
543                                     <div id="addshelf">
544                                     <legend>Create a new list</legend>
545                                     <input type="hidden" name="op" value="add" />
546                                 [% ELSE %]
547                                     <legend>Editing <em>[% shelf.shelfname | html %]</em></legend>
548                                     <input type="hidden" name="op" value="edit" />
549                                     <input type="hidden" name="referer" value="[% referer | html %]" />
550                                     <input type="hidden" name="shelfnumber" value="[% shelf.shelfnumber | html %]" />
551                                 [% END %]
552                                 <input type="hidden" name="owner" id="owner" value="[% loggedinusernumber | html %]" />
553                                 <ol>
554                                     <li>
555                                         <label class="required" for="shelfname">List name: </label>
556                                         <input type="text" id="shelfname" name="shelfname" maxlength="255" value="[% shelf.shelfname | html %]" required="required" class="required"/> <span class="required">Required</span></li>
557                                     <li>
558                                         <label for="sortfield" >Sort this list by: </label>
559                                         <select name="sortfield" id="sortfield">
560                                             [% IF shelf.sortfield == "title" %]
561                                                 <option value="title" selected="selected">Title</option>
562                                             [% ELSE %]
563                                                 <option value="title">Title</option>
564                                             [% END %]
565                                             [% IF shelf.sortfield == "author" %]
566                                                 <option value="author" selected="selected">Author</option>
567                                             [% ELSE %]
568                                                 <option value="author">Author</option>
569                                             [% END %]
570                                             [% IF shelf.sortfield == "copyrightdate" %]
571                                                 <option value="copyrightdate" selected="selected">Year</option>
572                                             [% ELSE %]
573                                                 <option value="copyrightdate">Year</option>
574                                             [% END %]
575                                             [% IF shelf.sortfield == "itemcallnumber" %]
576                                                 <option value="itemcallnumber" selected="selected">Call number</option>
577                                             [% ELSE %]
578                                                 <option value="itemcallnumber">Call number</option>
579                                             [% END %]
580                                             [% IF shelf.sortfield == "dateadded" %]
581                                                 <option value="dateadded" selected="selected">Date added</option>
582                                             [% ELSE %]
583                                                 <option value="dateadded">Date added</option>
584                                             [% END %]
585                                         </select>
586                                     </li>
587                                     [% IF Koha.Preference('OpacAllowPublicListCreation') OR category == PUBLIC %]
588                                         <li>
589                                             <label for="category">Category:</label>
590                                             <select name="category" id="category" onchange="AdjustRemark()">
591                                                 [% IF shelf.is_private %]
592                                                         <option value="1" selected="selected">Private</option>
593                                                     [% ELSE %]
594                                                         <option value="1">Private</option>
595                                                     [% END %]
596                                                 [% IF shelf.is_public %]
597                                                     <option value="2" selected="selected">Public</option>
598                                                 [% ELSE %]
599                                                     <option value="2">Public</option>
600                                                 [% END %]
601                                             </select>
602                                             [% IF shelf.is_public AND NOT Koha.Preference('OpacAllowPublicListCreation') %]
603                                                 <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>
604                                             [% END %]
605                                         </li>
606                                     [% END %]
607                                     [% INCLUDE list_permissions %]
608                                 </ol>
609                                 [% UNLESS Koha.Preference('OpacAllowPublicListCreation') OR category == PUBLIC %]
610                                     <input type="hidden" name="category" value="[% PRIVATE | html %]" />
611                                 [% END %]
612                             </fieldset>
613
614                             <fieldset class="action">
615                                 <input type="submit" value="Save" class="btn" />
616                                 [% IF referer == 'view' %]
617                                     <a href="/cgi-bin/koha/opac-shelves.pl?op=view&amp;shelfnumber=[% shelf.shelfnumber | uri %]" class="cancel">Cancel</a>
618                                 [% ELSE %]
619                                      <a href="/cgi-bin/koha/opac-shelves.pl?op=list&amp;category=[% PRIVATE | uri %]" class="cancel">Cancel</a>
620                                  [% END %]
621
622                             </fieldset>
623                         </form>
624
625                     [% ELSIF op == 'list' %]
626                         <h2>Lists</h2>
627                         <div class="toptabs ui-tabs ui-widget ui-widget-content ui-corner-all">
628                         <ul class="ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all">
629                             [% IF Koha.Preference( 'opacuserlogin' ) == 1 %]
630                                 [% IF category == PRIVATE %]
631                                     <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>
632                                 [% ELSE %]
633                                     <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>
634                                 [% END %]
635                             [% END %]
636                             [% IF category == PUBLIC %]
637                                 <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>
638                             [% ELSE %]
639                                 <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>
640                             [% END %]
641                         </ul>
642
643                         [% IF category == PRIVATE %]
644                             <div id="privateshelves" class="ui-tabs-panel ui-widget-content ui-corner-bottom" style="display:block;">
645                         [% ELSE %]
646                             <div id="publicshelves" class="ui-tabs-panel ui-widget-content ui-corner-bottom" style="display:block;">
647                         [% END %]
648
649                             [% IF loggedinusername %]
650                                 <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>
651                             [% ELSE %]
652                                 [% IF Koha.Preference( 'opacuserlogin' ) == 1 %]
653                                     <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>
654                                 [% END %]
655                             [% END %]
656
657                             [% IF shelves.count %]
658                                 <table class="table">
659                                     <thead>
660                                         <tr>
661                                             <th>List name</th>
662                                             <th>Contents</th>
663                                             <th>Type</th>
664                                             <th>&nbsp;</th>
665                                         </tr>
666                                     </thead>
667                                     <tbody>
668                                         [% FOREACH s IN shelves %]
669                                             [% SET contents = s.get_contents %]
670                                             <tr>
671                                                 <td><a href="/cgi-bin/koha/opac-shelves.pl?op=view&amp;shelfnumber=[% s.shelfnumber | uri %]">[% s.shelfname | html %]</a></td>
672                                                 <td>[% IF contents.count %][% contents.count | html %] [% IF contents.count == 1 %]item[% ELSE %]items[% END %][% ELSE %]Empty[% END %]</td>
673                                                 <td>
674                                                     [% IF s.is_private %]
675                                                         [% IF s.is_shared %]Shared[% ELSE %]Private[% END %]
676                                                     [% ELSE %]
677                                                         Public
678                                                     [% END %]
679                                                 </td>
680                                                 <td>
681                                                     [% IF s.can_be_managed( loggedinusernumber ) %]
682                                                         <form action="/cgi-bin/koha/opac-shelves.pl" method="get" class="form-inline">
683                                                             <input type="hidden" name="shelfnumber" value="[% s.shelfnumber | html %]" />
684                                                             <input type="hidden" name="category" value="[% s.category | html %]" />
685                                                             <input type="hidden" name="op" value="edit_form" />
686                                                             <input type="hidden" name="referer" value="list" />
687                                                             <button type="submit" class="btn btn-link editshelf"><i class="fa fa-pencil-square-o"></i> Edit</button>
688                                                         </form>
689                                                     [% END %]
690                                                     [% IF s.can_be_deleted( loggedinusernumber ) %]
691                                                         <form action="/cgi-bin/koha/opac-shelves.pl" method="post" class="form-inline">
692                                                             <input type="hidden" name="op" value="delete" />
693                                                             <input type="hidden" name="referer" value="list" />
694                                                             <input type='hidden' name='category' value='[% category | html %]' />
695                                                             <input type="hidden" name="shelfnumber" value="[% s.shelfnumber | html %]" />
696                                                             <button type="submit" class="btn btn-link remove deleteshelf" onclick="return confirmDelete(MSG_CONFIRM_DELETE_LIST);"><i class="fa fa-remove"></i> Delete</button>
697                                                         </form>
698                                                     [% END %]
699                                                     [% IF s.is_private AND s.can_be_managed( loggedinusernumber ) AND Koha.Preference('OpacAllowSharingPrivateLists') %]
700                                                         <a href="/cgi-bin/koha/opac-shareshelf.pl?op=invite&shelfnumber=[% s.shelfnumber | uri %]" class="sharelist btn btn-link"><i class="fa fa-share"></i> Share</a>
701                                                     [% END %]
702                                                     [% IF s.is_shared_with( loggedinusernumber ) %]
703                                                         <form action="opac-shelves.pl" method="post" id="unshare[% s.shelfnumber | html %]" class="form-inline">
704                                                             <input type="hidden" name="op" value="remove_share" />
705                                                             <input type="hidden" name="referer" value="list" />
706                                                             <input type='hidden' name='category' value='[% category | html %]' />
707                                                             <input type="hidden" name="shelfnumber" value="[% s.shelfnumber | html %]" />
708                                                             <button type="submit" class="btn btn-link remove remove_share"
709                                                             data-shelfname="[% s.shelfname | html %]" data-shelfnumber="[% s.shelfnumber | html %]"><i class="fa fa-remove" aria-hidden="true"></i> Remove share</button>
710                                                         </form>
711                                                     [% END %]&nbsp;
712                                                 </td>
713                                             </tr>
714                                         [% END %]
715                                     </tbody>
716                                 </table>
717                                 <div class="pages">[% pagination_bar | $raw %]</div>
718                             [% ELSE %]
719                                 [% IF category == PUBLIC %]
720                                     <p>No public lists.</p>
721                                 [% ELSIF loggedinusernumber %]
722                                     <p>No private lists.</p>
723                                 [% END %]
724                             [% END %]
725                             </div> [%# privateshelves or publicshelves %]
726                             </div> [%# <div class="toptabs ui-tabs ui-widget ui-widget-content ui-corner-all"> %]
727                         [% ELSIF NOT loggedinusernumber %]
728                             [% IF Koha.Preference( 'opacuserlogin' ) == 1 %]
729                                 <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>
730                             [% END %]
731                         [% END  # IF loggedinusername %]
732                 </div> <!-- / #usershelves -->
733                 </div> <!-- / .span10/12 -->
734       </div> <!-- / .row-fluid -->
735     </div> <!-- / .container-fluid -->
736   </div> <!-- / .main -->
737
738 <div class="modal hide" id="modalWin" role="dialog" aria-hidden="true" tabindex="-1">
739     <div class="modal-content">
740         <div class="modal-body">
741             <div style="margin:1em;padding:1em;font-size:150%;">
742                 <img src="[% interface | html %]/[% theme | html %]/images/loading.gif" alt="" /> Loading
743             </div>
744         </div>
745     </div>
746 </div>
747
748 <!-- DEBUG -->
749     <div id="debug"></div>
750 <!-- /DEBUG -->
751
752 [% INCLUDE 'opac-bottom.inc' %]
753 [% BLOCK jsinclude %]
754 [% Asset.js("lib/jquery/plugins/jquery.checkboxes.min.js") | $raw %]
755 [% Asset.js("lib/hc-sticky.js") | $raw %]
756 <script>
757 var MSG_REMOVE_FROM_LIST = _("Are you sure you want to remove these items from the list?");
758 var MSG_REMOVE_ONE_FROM_LIST = _("Are you sure you want to remove this item from the list?");
759 var MSG_CONFIRM_DELETE_LIST = _("Are you sure you want to delete this list?");
760 var MSG_CONFIRM_REMOVE_SHARE = _("Are you sure you want to remove this share?");
761
762 [% IF ( ( Koha.Preference( 'opacuserlogin' ) == 1 ) && ( Koha.Preference( 'RequestOnOpac' ) == 1 ) ) %]
763     function holdSelections() {
764         var checkedBoxes = $("input:checkbox:checked");
765         if ($(checkedBoxes).size() == 0) {
766             alert(MSG_NO_RECORD_SELECTED);
767         } else {
768             var bibs = "";
769             $(checkedBoxes).each(function(){
770                 bibs += $(this).val() + "/";
771             });
772             document.location = "/cgi-bin/koha/opac-reserve.pl?biblionumbers="+bibs;
773         }
774     }
775 [% END %]
776 [% IF ( TagsInputEnabled && loggedinusername ) %]
777     function tagSelected() {
778         var checkedBoxes = $("input:checkbox:checked");
779         if ($(checkedBoxes).size()) {
780             $("#tagsel_tag").hide();
781             $(".tag_hides").hide();
782             $("#tagsel_form").show();
783         } else {
784             alert(MSG_NO_RECORD_SELECTED);
785         }
786     }
787
788     function tagCanceled() {
789         $("#tagsel_form").hide();
790         $("#tagsel_tag").show();
791         $(".tag_hides").show();
792         $("#tagsel_new").val("");
793         $(".tagstatus").empty().hide();
794     }
795
796     function tagAdded() {
797         var checkedBoxes = $("input:checkbox:checked");
798         if (!$(checkedBoxes).size()) {
799             alert(MSG_NO_RECORD_SELECTED);
800             return false;
801         }
802
803         var tag = $("#tagsel_new").val();
804         if (!tag || (tag == "")) {
805             alert(MSG_NO_TAG_SPECIFIED);
806             return false;
807         }
808
809         var bibs = [];
810         for (var i = 0; i < $(checkedBoxes).size(); i++) {
811             var box = $(checkedBoxes).get(i);
812             bibs[i] = $(box).val();
813         }
814
815         KOHA.Tags.add_multitags_button(bibs, tag);
816         return false;
817     }
818 [% END %]
819
820 function enableCheckboxActions(){
821     // Enable/disable controls if checkboxes are checked
822     var checkedBoxes = $(".checkboxed input:checkbox:checked");
823     if ($(checkedBoxes).size()) {
824       $("#selections").html(_("With selected titles: "));
825       $("#selections-toolbar .links a").removeClass("disabled");
826     } else {
827       $("#selections").html(_("Select titles to: "));
828       $("#selections-toolbar .links a").addClass("disabled");
829     }
830 }
831
832 $(function() {
833     [% IF Koha.Preference( 'opacbookbag' ) == 1 %]$(".addtocart,.cartRemove").removeClass("hidden");[% END %]
834     $("span.clearall").html("<a id=\"CheckNone\" href=\"#\">"+_("Clear all")+"<\/a>");
835     $("span.checkall").html("<a id=\"CheckAll\" href=\"#\">"+_("Select all")+"<\/a>");
836     $("a.print").show();
837
838     [% IF ( ( Koha.Preference( 'opacuserlogin' ) == 1 ) && ( Koha.Preference( 'RequestOnOpac' ) == 1 ) ) %]
839         $("#placehold").html("<a href=\"#\" class=\"btn btn-link hold tag_hides btn-disabled\"><i class=\"fa fa-fw fa-bookmark\"></i> "+_("Place hold")+"<\/a>");
840         $("#selections-toolbar a.hold").click(function(){
841             holdSelections();
842             return false;
843         });
844     [% END %]
845
846     // If JS is enabled add parameter to download link
847     var dialoglink = $(".download").attr("href");
848     dialoglink += "&context=modal";
849     $(".download").attr("href",dialoglink);
850
851     $("#CheckAll").click(function(){
852         $(".checkboxed").checkCheckboxes();
853         enableCheckboxActions();
854         return false;
855     });
856     $("#CheckNone").click(function(){
857         $(".checkboxed").unCheckCheckboxes();
858         enableCheckboxActions();
859         return false;
860     });
861
862     $(".cb").click(function(){
863       enableCheckboxActions();
864     });
865     enableCheckboxActions();
866
867     [% IF ( TagsInputEnabled && loggedinusername ) %]
868         var tagAdd = $(".tag_add");
869         tagAdd.removeClass("hidden");
870         $("#tagsel_tag").click(function(){
871             tagSelected();
872             return false;
873         });
874         $("#tagsel_cancel").click(function(){
875             tagCanceled();
876             return false;
877         });
878         $("#tagsel_button").click(function(){
879             tagAdded();
880             return false;
881         });
882
883         tagAdd.click(function(){
884             var thisid = $(this).attr("id");
885             thisid = thisid.replace("tag_add","");
886             $(this).hide();
887             $("#tagform"+thisid).show();
888             $("#newtag"+thisid).focus();
889             $("#newtag"+thisid+"_status").empty().hide();
890             return false;
891         });
892         $(".cancel_tag_add").click(function(){
893             var thisid = $(this).attr("id");
894             thisid = thisid.replace("cancel","");
895             $("#tagform"+thisid).hide();
896             $("#tag_add"+thisid).show();
897             $("#newtag"+thisid).val("");
898             $("#newtag"+thisid+"_status").empty().hide();
899             return false;
900         });
901         $(".tagbutton").click(function(){
902           var thisid = $(this).attr("title");
903           var tag = $("#newtag"+thisid).val();
904           if (!tag || (tag == "")) {
905               alert(MSG_NO_TAG_SPECIFIED);
906               return false;
907           }
908           KOHA.Tags.add_tag_button(thisid, tag);
909           return false;
910         });
911     [% END %]
912
913     [% IF loggedinusername && can_remove_biblios %]
914         $(".removefromlist").on("click", function(e){
915             return confirmDelete(MSG_REMOVE_ONE_FROM_LIST);
916         });
917
918         $("#myform").submit(function(){
919             var checkedBoxes = $(".checkboxed input:checkbox:checked");
920             var numchecked = $(checkedBoxes).size();
921             if (numchecked) {
922                 if( numchecked > 1 ){
923                     return confirmDelete(MSG_REMOVE_FROM_LIST);
924                 } else {
925                     return confirmDelete(MSG_REMOVE_ONE_FROM_LIST);
926                 }
927             } else {
928                 alert(MSG_NO_RECORD_SELECTED);
929                 return false;
930             }
931         });
932         $("#removeitems").html("<a href=\"#\" class=\"btn btn-link disabled removeitems tag_hides\"><i class=\"fa fa-fw fa-remove\"></i> "+_("Remove from list")+"</a>")
933         .click(function(){
934             $("#myform").submit();
935             return false;
936         });
937     [% END %]
938     [% IF OpenLibraryCovers %]KOHA.OpenLibrary.GetCoverFromIsbn();[% END %]
939     [% IF OPACLocalCoverImages %]KOHA.LocalCover.GetCoverFromBibnumber(false);[% END %]
940     [% IF ( GoogleJackets ) %]KOHA.Google.GetCoverFromIsbn();[% END %]
941     [% IF ( Koha.Preference('Coce') && Koha.Preference('CoceProviders') ) %]
942         KOHA.coce.getURL('[% Koha.Preference('CoceHost') | html %]', '[% Koha.Preference('CoceProviders') | html %]');
943     [% END %]
944
945     [% IF print %]
946         window.print();
947         window.onafterprint = function () {
948             window.close();
949         }
950         setTimeout('window.close()', 1000); // Hack for Chrome < 63
951     [% END %]
952
953     AdjustRemark();
954
955     Sticky = $("#floating");
956     Sticky.hcSticky({
957         stickTo: "#usershelves",
958         stickyClass: "floating"
959     });
960
961     [% IF itemsloop %]
962         sortMenu( $("#sorting-form") );
963
964         $("#sortfield").on("change", function(){
965             $('#sorting-form').submit();
966         });
967     [% END %]
968
969     $(".remove_share").on("click", function(e){
970         e.preventDefault();
971         var shelf_name = $(this).data("shelfname");
972         var shelf_number = $(this).data("shelfnumber");
973         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 ){
974                 if( result ){
975                     $("#unshare" + shelf_number ).submit();
976                 }
977             }
978         );
979     });
980
981 }); // document.ready
982
983 function sortMenu( sorting_form ){
984     var shelfnumber = sorting_form.find("input[name='shelfnumber']").val();
985     var sort_link = "/cgi-bin/koha/opac-shelves.pl?op=view&amp;shelfnumber=" + shelfnumber + "&sortfield=";
986     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\">";
987     $("#sortfield").children().each(function(){
988         if( $(this)[0].tagName.toUpperCase() == "OPTION" ){
989             menu += "<li><a href=\"" + sort_link + $(this).val() + "\">" + $(this).text() + "</a></li>";
990         } else if( $(this)[0].tagName.toUpperCase() == "OPTGROUP" ){
991             menu += "<li class=\"dropdown-header\">" + $(this).attr("label") + "</li>";
992             $(this).children().each(function(){
993                 if( $(this)[0].tagName.toUpperCase() == "OPTION" ){
994                     menu += "<li><a href=\"" + sort_link + $(this).val() + "\">" + $(this).text() + "</a></li>";
995                 }
996             });
997         }
998     });
999     menu += "</ul></div>";
1000     $(".list-actions").append( menu );
1001     sorting_form.remove();
1002 }
1003
1004 function AdjustRemark() {
1005     var category;
1006     if( $("#category").length > 0 ) {
1007         category = $("#category").val();
1008     } else {
1009         category = [% category | html %];
1010     }
1011     var perms = $("#allow_changes_from").val();
1012
1013     if( perms < 2 ) {
1014         $("#anyone_remark").hide();
1015     } else if( category==1 ) {
1016         // If we move to Private (without shares), show Anyone remark
1017         // Note: the number of shares is not tested real-time
1018         [% IF !shelf.is_shared %]
1019             $("#anyone_remark").show();
1020         [% ELSE %]
1021             $("#anyone_remark").hide();
1022         [% END %]
1023     } else { // category==2
1024         $("#anyone_remark").hide();
1025     }
1026 }
1027 </script>
1028 [% END %]