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