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