Bug 14418: More XSS vulnerabilities in opac-shelves.pl
[koha.git] / koha-tmpl / opac-tmpl / bootstrap / en / modules / opac-shelves.tt
1 [% USE Koha %]
2 [% SET TagsShowEnabled = ( ( Koha.Preference( 'TagsEnabled' ) == 1 ) && TagsShowOnList ) %]
3 [% SET TagsInputEnabled = ( ( Koha.Preference( 'opacuserlogin' ) == 1 ) && ( Koha.Preference( 'TagsEnabled' ) == 1 ) && TagsInputOnList ) %]
4
5 [% INCLUDE 'doc-head-open.inc' %][% IF ( LibraryNameTitle ) %][% LibraryNameTitle %][% ELSE %]Koha online[% END %] catalog ›   [% IF ( viewshelf ) %]Contents of [% shelfname |html %][% ELSE %]Your lists[% END %][% INCLUDE 'doc-head-close.inc' %]
6 [% BLOCK cssinclude %][% END %]
7 </head>
8 [% IF ( loggedinusername ) %][% INCLUDE 'bodytag.inc' bodyid='opac-userlists' bodyclass='scrollto' %][% ELSE %][% INCLUDE 'bodytag.inc' bodyid='opac-lists' bodyclass='scrollto' %][% END %]
9
10 [% BLOCK list_permissions %]
11     <li>
12         <label for="allow_add">Permissions: </label>
13         <select name="allow_add" id="allow_add">
14             [% IF allow_add %]<option value="0">Do not allow</option>[% ELSE %]<option value="0" selected="selected">Do not allow</option>[% END %]
15             [% IF allow_add %]<option value="1" selected="selected">Allow</option>[% ELSE %]<option value="1">Allow</option>[% END %]
16         </select>
17         &nbsp;<span>anyone else to add entries. (The owner of a list is always allowed to add entries, but needs permission to remove.)</span>
18     </li>
19     <li>
20         <label>&nbsp;</label>
21         <select name="allow_delete_own" id="allow_delete_own">
22             [% IF allow_delete_own %]<option value="0">Do not allow</option>[% ELSE %]<option value="0" selected="selected">Do not allow</option>[% END %]
23             [% IF allow_delete_own %]<option value="1" selected="selected">Allow</option>[% ELSE %]<option value="1">Allow</option>[% END %]
24         </select>
25         &nbsp;<span>anyone to remove his own contributed entries.</span>
26     </li>
27     <li>
28         <label>&nbsp;</label>
29         <select name="allow_delete_other" id="allow_delete_other">
30             [% IF allow_delete_other %]<option value="0">Do not allow</option>[% ELSE %]<option value="0" selected="selected">Do not allow</option>[% END %]
31             [% IF allow_delete_other %]<option value="1" selected="selected">Allow</option>[% ELSE %]<option value="1">Allow</option>[% END %]
32         </select>
33         &nbsp;<span>anyone to remove other contributed entries.</span>
34     </li>
35 [% END %]
36 [% BLOCK remove_share %]
37     [%# Use: add parameter shelfnumber and add end form tag %]
38     <form action="opac-shelves.pl" method="post" class="form-inline">
39         <input type="hidden" name="shelves" value="1" />
40         <input type="hidden" name="display" value="privateshelves" />
41         <input type="submit" class="deleteshelf" onclick="return confirmDelete(MSG_CONFIRM_REMOVE_SHARE);" value="Remove share" />
42 [% END %]
43
44 [% INCLUDE 'masthead.inc' %]
45 <div class="main">
46     <ul class="breadcrumb noprint">
47         <li><a href="/cgi-bin/koha/opac-main.pl">Home</a> <span class="divider">&rsaquo;</span></li>
48         [% IF ( loggedinusername ) %]
49             <li><a href="/cgi-bin/koha/opac-user.pl">[% FOREACH USER_INF IN USER_INFO %][% USER_INF.title %] [% USER_INF.firstname %] [% USER_INF.surname %][% END %]</a> <span class="divider">&rsaquo;</span></li>
50         [% END %]
51
52         [% IF ( category1 ) %]
53             [% IF ( viewshelf || edit ) %]
54                 <li><a href="/cgi-bin/koha/opac-shelves.pl?display=privateshelves">Your lists</a></li>
55             [% ELSE %]
56                 <li>Your lists</li>
57             [% END %]
58         [% ELSIF ( category2 ) %]
59             [% IF ( viewshelf || edit ) %]
60                 <li><a href="/cgi-bin/koha/opac-shelves.pl?display=publicshelves">Public lists</a></li>
61             [% ELSE %]
62                 <li>Public lists</li>
63             [% END %]
64         [% ELSIF ( showprivateshelves ) %]
65             [% IF ( viewshelf || edit ) %]
66                 <li><a href="/cgi-bin/koha/opac-shelves.pl?display=privateshelves">Your lists</a></li>
67             [% ELSE %]
68                 <li>Your lists</li>
69             [% END %]
70         [% ELSIF ( showpublicshelves ) %]
71             [% IF ( viewshelf || edit || shelves ) %]
72                 <li><a href="/cgi-bin/koha/opac-shelves.pl?display=publicshelves">Public lists</a></li>
73             [% ELSE %]
74                 <li>Public lists</li>
75             [% END %]
76         [% END %]
77
78         [% IF ( viewshelf ) %]
79             <li><span class="divider">&rsaquo;</span> Contents of <i>[% shelfname | html %]</i></li>
80         [% END %]
81
82         [% IF ( shelves ) %]
83             <li><span class="divider">&rsaquo;</span> Create new list</li>
84         [% END %]
85
86         [% IF ( edit ) %]
87             <li><span class="divider">&rsaquo;</span> Edit list <i>[% shelfname | html %]</i></li>
88         [% END %]
89
90     </ul> <!-- / .breadcrumb -->
91
92     <div class="container-fluid">
93         <div class="row-fluid">
94             [% IF ( OpacNav||loggedinusername ) && !print %]
95                 <div class="span2">
96                     <div id="navigation">
97                         [% INCLUDE 'navigation.inc' IsPatronPage=1 %]
98                     </div>
99                 </div>
100             [% END %]
101
102             [% IF ( OpacNav||loggedinusername ) %]
103                 <div class="span10">
104             [% ELSE %]
105                 <div class="span12">
106             [% END %]
107                 <div id="usershelves" class="maincontent">
108
109                     [% IF ( paramsloop ) %]
110                         [% FOREACH paramsloo IN paramsloop %]
111                             [% IF ( paramsloo.already ) %]<div class="alert">A list named <b>[% paramsloo.already %]</b> already exists!</div>[% END %]
112                             [% IF ( paramsloo.addshelf_failed ) %]<div class="dialog alert">List could not be created. [% IF loggedinuser==0 %](Do not use the database administrator account.)[% END %]</div>[% END %]
113                             [% IF ( paramsloo.status ) %]<div class="alert">[% paramsloo.string %]</div>[% END %]
114                             [% IF ( paramsloo.nobarcode ) %]<div class="alert">ERROR: No barcode given.</div>[% END %]
115                             [% IF ( paramsloo.noshelfnumber ) %]<div class="alert">ERROR: No shelfnumber given.</div>[% END %]
116                             [% IF ( paramsloo.need_confirm ) %]
117                               <div class="alert">
118                                 The list <i>[% paramsloo.need_confirm %]</i> is not empty.
119                                 <br />It has <b>[% paramsloo.count %]</b> [% IF ( paramsloo.single ) %]entry[% ELSE %]entries[% END %].
120                                 <br />Use the "Confirm" button below to confirm deletion.
121                              </div>
122                             [% END %]
123                             [% IF ( paramsloo.nopermission ) %]
124                               <div class="alert">ERROR: You do not have adequate permission for that action on list [% paramsloo.nopermission |html%].</div>
125                             [% END %]
126                             [% IF ( paramsloo.failgetitem ) %]
127                               <div class="alert">ERROR: No item found with barcode [% paramsloo.failgetitem %].</div>
128                             [% END %]
129                             [% IF ( paramsloo.duplicatebiblio ) %]
130                               <div class="alert">A record matching barcode <b>[% paramsloo.duplicatebiblio %]</b> has already been added.</div>
131                             [% END %]
132                             [% IF ( paramsloo.delete_ok ) %]
133                               <div class="alert alert-info">List [% paramsloo.delete_ok |html %] Deleted.</div>
134                             [% END %]
135                             [% IF ( paramsloo.delete_fail ) %]
136                               <div class="alert alert-info">ERROR: Database error. Delete (list number [% paramsloo.delete_fail |html %]) failed.</div>
137                             [% END %]
138                             [% IF ( paramsloo.unrecognized ) %]
139                               <div class="alert alert-info">ERROR: List number [% paramsloo.unrecognized %] unrecognized.</div>
140                             [% END %]
141                             [% IF ( paramsloo.modifyfailure) %]
142                               <div class="alert alert-info">ERROR: Shelf could not be renamed to [% paramsloo.modifyfailure %]. This name may not be unique for this type of list. Please check.</div>
143                             [% END %]
144                             [% IF ( paramsloo.nothingdeleted) %]
145                               <div class="alert alert-info">Warning: You could not delete any selected items from this shelf.</div>
146                             [% END %]
147                             [% IF ( paramsloo.somedeleted) %]
148                               <div class="alert alert-info">Warning: You could not delete all selected items from this shelf.</div>
149                             [% END %]
150                         [% END # / FOREACH paramsloop %]
151                     [% END # / IF paramsloop %]
152
153                     [% IF ( viewshelf ) %]<!--  Viewing a particular shelf -->
154                         <h3>
155                             [% shelfname |html %]
156                             <a href="[% OPACBaseURL %]/cgi-bin/koha/opac-shelves.pl?rss=1&amp;viewshelf=[% shelfnumber %]" class="rss-list-link noprint">
157                                 <img src="[% interface %]/[% theme %]/images/feed-icon-16x16.png" alt="Subscribe to this list" title="Subscribe to this list" border="0" class="rsssearchicon"/>
158                             </a>
159                         </h3>
160
161                         [% IF ( itemsloop ) %]
162                             <div id="toolbar" class="toolbar clearfix">
163                                 <div class="list-actions">
164                                     <a class="newshelf" href="/cgi-bin/koha/opac-shelves.pl?shelves=1">New list</a> <span class="sep">|</span>
165                                     <a href="/cgi-bin/koha/opac-downloadshelf.pl?shelfid=[% shelfnumber | html %]&amp;showprivateshelves=[% showprivateshelves | html %]" class="download" data-toggle="modal" data-target="#modalWin">Download list</a>
166
167                                     [% IF Koha.Preference( 'opacuserlogin' ) == 1 %]
168                                         <span class="sendlist"><a href="/cgi-bin/koha/opac-sendshelf.pl?shelfid=[% shelfnumber | html %]" class="send" onclick="open('/cgi-bin/koha/opac-sendshelf.pl?shelfid=[% shelfnumber | html %]','win_form','scrollbars=no,resizable=no,height=300,width=450,top=50,left=100'); return false; ">Send list</a></span>
169                                     [% END %]
170
171                                     <a class="print-small" target="_blank" href="/cgi-bin/koha/opac-shelves.pl?viewshelf=[% shelfnumber %]&sort=[% sort %]&direction=[% direction |uri %]&print=1">Print list</a>
172
173                                     [% IF ( manageshelf ) %]
174                                         <span class="sep">|</span>
175                                         <form method="get" action="/cgi-bin/koha/opac-shelves.pl" class="form-inline">
176                                             <input type="hidden" name="op" value="modif" />
177                                             <input type="hidden" name="display" value="viewshelf" />
178                                             <input type="hidden" name="shelfnumber" value="[% shelfnumber | html %]" />
179                                             <input type="submit" class="editshelf" value="Edit list" />
180                                         </form>
181
182                                         <form method="post" action="/cgi-bin/koha/opac-shelves.pl" class="form-inline">
183                                             <input type="hidden" value="1" name="shelves"/>
184                                             <input type="hidden" value="1" name="DEL-[% shelfnumber | html %]"/>
185                                             [% IF ( showprivateshelves ) %]
186                                                 <input type="hidden" name="display" value="privateshelves"/>
187                                             [% END %]
188                                             <input type="submit" class="deleteshelf" value="Delete list" onclick="return confirmDelete(MSG_CONFIRM_DELETE_LIST);"/>
189                                         </form>
190                                         [% IF showprivateshelves && Koha.Preference('OpacAllowSharingPrivateLists') %]
191                                             <a href="/cgi-bin/koha/opac-shareshelf.pl?op=invite&shelfnumber=[% shelfnumber | html %]" class="">Share list</a>
192                                         [% END %]
193                                     [% ELSIF showprivateshelves # not manageshelf and private means shared %]
194                                         [% INCLUDE remove_share %]
195                                             <input type="hidden" name="REMSHR-[% shelfnumber | html %]" value="1" />
196                                         </form>
197                                     [% END # / IF manageshelf %]
198                                 </div>
199
200                                 <form action="/cgi-bin/koha/opac-shelves.pl" id="sorting-form" class="form-inline sort_by pull-right">
201                                     <input type="hidden" name="viewshelf" value="[% shelfnumber | html %]" />
202
203                                     <label for="sort">Sort by: </label>
204                                     <select name="sort" id="sort" class="resort" onchange="$('#sorting-form').submit()">
205                                         <option value="">Default sorting</option>
206
207                                         [% IF sort == 'author' %]
208                                             <option value="author" selected="selected">Author</option>
209                                         [% ELSE %]
210                                             <option value="author">Author</option>
211                                         [% END %]
212
213                                         [% IF sort == 'title' %]
214                                             <option value="title" selected="selected">Title</option>
215                                         [% ELSE %]
216                                             <option value="title">Title</option>
217                                         [% END %]
218
219                                         [% IF sort == 'itemcallnumber' %]
220                                             <option value="itemcallnumber" selected="selected">Call number</option>
221                                         [% ELSE %]
222                                             <option value="itemcallnumber">Call number</option>
223                                         [% END %]
224
225                                         [% IF sort == 'copyrightdate' %]
226                                             <option value="copyrightdate" selected="selected">Copyright date</option>
227                                         [% ELSE %]
228                                             <option value="copyrightdate">Copyright date</option>
229                                         [% END %]
230                                     </select>
231
232                                     <select name="direction" class="resort" onchange="$('#sorting-form').submit()">
233                                         [% IF direction == 'asc' %]
234                                             <option value="asc" selected="selected">Ascending</option>
235                                         [% ELSE %]
236                                             <option value="asc">Ascending</option>
237                                         [% END %]
238
239                                         [% IF direction == 'desc' %]
240                                             <option value="desc" selected="selected">Descending</option>
241                                         [% ELSE %]
242                                             <option value="desc">Descending</option>
243                                         [% END %]
244                                     </select>
245
246                                     <input type="submit" class="btn btn-small" id="sort-submit" value="Resort list" />
247                                 </form>
248
249                             </div> <!-- / #toolbar -->
250
251                             <div id="selections-toolbar" class="toolbar noprint">
252                                 <span class="checkall"></span> <span class="clearall"></span> <span class="sep">|</span>
253                                 <span class="links">
254                                     <span id="selections">Select titles to: </span>
255                                     [% IF Koha.Preference( 'RequestOnOpac' ) == 1 %]
256                                         <span id="placehold"></span>
257                                     [% END %]
258                                     [% IF ( TagsInputEnabled && loggedinusername ) %]
259                                         <span id="addtags">
260                                           <a id="tagsel_tag" href="#" class="disabled">Tag</a>
261                                         </span>
262                                         <span id="tagsel_form" style="display:none">
263                                           <label for="tagsel_new">New tag(s), separated by a comma:</label>
264                                           <input name="tagsel_new" id="tagsel_new" maxlength="100" />
265                                           <input id="tagsel_button" name="tagsel_button" class="tagsel_button btn btn-small" title="tagsel_button" type="submit" value="Add" />
266                                           <a href="#" id="tagsel_cancel">Cancel</a>
267                                         </span>
268                                     [% END %]
269                                     [% IF ( loggedinusername && allowremovingitems ) %]
270                                         <span id="removeitems"></span>
271                                     [% END %]
272                                 </span> <!-- / .links -->
273                             </div> <!-- / #selections-toolbar -->
274
275                             <form action="/cgi-bin/koha/opac-shelves.pl" method="post" id="myform" name="myform" class="checkboxed">
276                                 [% IF ( manageshelf ) %]
277                                     <input type="hidden" name="viewshelf" value="[% shelfnumber | html %]" />
278                                     <input type="hidden" name="modifyshelfcontents" value="1" />
279                                 [% END %]
280                                 <div class="searchresults">
281                                     <table id="listcontents" class="table">
282                                         <tbody>
283                                         [% FOREACH itemsloo IN itemsloop %]
284                                             <tr>
285                                                 <td class="select selectcol"><input type="checkbox" class="cb" name="REM-[% itemsloo.biblionumber %]" value="[% itemsloo.biblionumber %]" /></td>
286                                                 [% UNLESS ( item_level_itypes ) %]
287                                                     <td>
288                                                         [% UNLESS ( noItemTypeImages ) %]
289                                                             <img src="[% itemsloo.imageurl %]" alt="[% itemsloo.description %]" title="[% itemsloo.description %]" />
290                                                         [% END %]
291                                                         [% itemsloo.description %]
292                                                     </td>
293                                                 [% END %]
294                                                 <td>
295                                                     <div class="coverimages">
296                                                         <a class="p1" href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% itemsloo.biblionumber %]">
297                                                             [% IF ( OPACLocalCoverImages ) %]
298                                                                 <span title="[% itemsloo.biblionumber |url %]" class="[% itemsloo.biblionumber %]" id="local-thumbnail[% loop.count %]"></span>
299                                                             [% END %]
300
301                                                             [% IF ( OPACAmazonCoverImages ) %]
302                                                                 [% IF ( itemsloo.normalized_isbn ) %]
303                                                                     <span title="[% SEARCH_RESULT.biblionumber %]" id="amazon-thumbnail[% loop.count %]"><img src="http://images.amazon.com/images/P/[% itemsloo.normalized_isbn %].01.TZZZZZZZ.jpg" alt="" /></span>
304                                                                 [% ELSE %]
305                                                                     <span class="no-image">No cover image available</span>
306                                                                 [% END %]
307                                                             [% END %]
308
309                                                             [% IF ( SyndeticsEnabled && SyndeticsCoverImages ) %]
310                                                                 [% IF ( using_https ) %]
311                                                                     <span title="[% SEARCH_RESULT.biblionumber %]" id="syndetics-thumbnail[% loop.count %]"><img src="https://secure.syndetics.com/index.aspx?isbn=[% itemsloo.normalized_isbn %]/SC.GIF&amp;client=[% SyndeticsClientCode %]&amp;type=xw10&amp;upc=[% itemsloo.normalized_upc %]&amp;oclc=[% itemsloo.normalized_oclc %]" alt="" /></span>
312                                                                 [% ELSE %]
313                                                                     <span title="[% SEARCH_RESULT.biblionumber %]" id="syndetics-thumbnail[% loop.count %]"><img src="http://www.syndetics.com/index.aspx?isbn=[% itemsloo.normalized_isbn %]/SC.GIF&amp;client=[% SyndeticsClientCode %]&amp;type=xw10&amp;upc=[% itemsloo.normalized_upc %]&amp;oclc=[% itemsloo.normalized_oclc %]" alt="" /></span>
314                                                                 [% END %]
315                                                             [% END %]
316
317                                                             [% IF ( GoogleJackets ) %]
318                                                                 [% IF ( itemsloo.normalized_isbn ) %]
319                                                                     <div title="[% itemsloo.biblionumber |url %]" class="[% itemsloo.normalized_isbn %]" id="gbs-thumbnail[% loop.count %]"></div>
320                                                                 [% ELSE %]
321                                                                     <span class="no-image">No cover image available</span>
322                                                                 [% END %]
323                                                             [% END %]
324
325                                                             [% IF OpenLibraryCovers %]
326                                                                 [% IF itemsloo.normalized_isbn %]
327                                                                     <span title="[% itemsloo.biblionumber %]" class="[% itemsloo.normalized_isbn %]" id="openlibrary-thumbnail[% loop.count %]"></span>
328                                                                 [% ELSE %]
329                                                                     <span class="no-image">No cover image available</span>
330                                                                 [% END %]
331                                                             [% END %]
332
333                                                         </a> <!-- / .p1 -->
334                                                         [% IF ( BakerTaylorEnabled ) %]
335                                                             [% IF ( itemsloo.normalized_isbn ) %]
336                                                                 <a href="https://[% BakerTaylorBookstoreURL |html %][% itemsloo.normalized_isbn %]"><img alt="See Baker &amp; Taylor" src="[% BakerTaylorImageURL |html %][% itemsloo.normalized_isbn %]" /></a>
337                                                             [% ELSE %]
338                                                                 <span class="no-image">No cover image available</span>
339                                                             [% END %]
340                                                         [% END %]
341                                                     </div>
342                                                     [% IF ( itemsloo.XSLTBloc ) %]
343                                                         [% itemsloo.XSLTBloc %]
344                                                     [% ELSE %]
345
346                                                         [% IF ( itemsloo.BiblioDefaultViewmarc ) %]
347                                                             <a class="title" href="/cgi-bin/koha/opac-MARCdetail.pl?biblionumber=[% itemsloo.biblionumber |url %]" title="View details for this title">
348                                                         [% ELSE %]
349                                                             [% IF ( itemsloo.BiblioDefaultViewisbd ) %]
350                                                                 <a class="title" href="/cgi-bin/koha/opac-ISBDdetail.pl?biblionumber=[% itemsloo.biblionumber |url %]" title="View details for this title">
351                                                             [% ELSE %]
352                                                                 <a class="title" href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% itemsloo.biblionumber |url %]" title="View details for this title">
353                                                             [% END %]
354                                                         [% END %]
355
356                                                         [% IF ( itemsloo.title ) %]
357                                                             [% itemsloo.title |html %]
358                                                         [% ELSE %]
359                                                             No title
360                                                         [% END %]
361
362                                                         [% FOREACH subtitl IN itemsloo.subtitle %]
363                                                             [% subtitl.subfield|html %]
364                                                         [% END %]
365                                                         </a>
366
367                                                         [% IF ( itemsloo.author ) %]
368                                                             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 %]</a>
369                                                         [% ELSE %]
370                                                             &nbsp;
371                                                         [% END %]
372
373                                                         <span class="results_summary">
374                                                             <span class="label">Publication:</span>
375                                                             [% IF ( itemsloo.place ) %]
376                                                                 [% itemsloo.place %]
377                                                             [% END %]
378                                                             [% IF ( itemsloo.publishercode ) %]
379                                                                 [% itemsloo.publishercode|html %]
380                                                             [% END %]
381                                                             [% IF ( itemsloo.publicationyear ) %]
382                                                                 [% itemsloo.publicationyear %]
383                                                             [% ELSE %]
384                                                                 [% IF ( itemsloo.copyrightdate ) %]
385                                                                     [% itemsloo.copyrightdate %]
386                                                                 [% END %]
387                                                             [% END %]
388                                                             [% IF ( itemsloo.pages ) %]. [% itemsloo.pages %][% END %]
389                                                             [% IF ( itemsloo.notes ) %], [% itemsloo.notes|html %][% END %]
390                                                             [% IF ( itemsloo.item('size') ) %] [% itemsloo.item('size') %][% END %]
391                                                         </span>
392                                                         <span class="results_summary">
393                                                             <span class="label">Holdings:</span>
394                                                             [% IF ( itemsloo.ITEM_RESULTS ) %]
395                                                                 [% FOREACH ITEM_RESULT IN itemsloo.ITEM_RESULTS %]
396                                                                     [% ITEM_RESULT.homebranch %]
397                                                                     [% IF ( ITEM_RESULT.location_opac ) %]
398                                                                         , [% ITEM_RESULT.location_opac %]
399                                                                     [% END %]
400                                                                     [% IF ( ITEM_RESULT.itemcallnumber ) %]
401                                                                         ([% ITEM_RESULT.itemcallnumber %])
402                                                                             [% IF ( loop.last ) %].[% ELSE %],[% END %]
403                                                                     [% END %]
404                                                                 [% END %]
405                                                             [% ELSE %]
406                                                                 This record has no items.
407                                                             [% END %]
408                                                         </span>
409                                                     [% END # / IF itemsloo.XSLTBloc %]
410
411                                                     [% IF ( TagsShowEnabled && itemsloo.TagLoop.size ) %]
412                                                         <div class="results_summary tags">
413                                                             <span class="label">Tags:</span>
414                                                             <ul>
415                                                                 [% FOREACH TagLoo IN itemsloo.TagLoop %]
416                                                                     <li><a href="/cgi-bin/koha/opac-search.pl?tag=[% TagLoo.term |url %]&amp;q=[% TagLoo.term |url %]">[% TagLoo.term %]</a> <span class="weight">([% TagLoo.weight_total %])</span></li>
417                                                                 [% END %]
418                                                             </ul>
419                                                         </div>
420                                                     [% END %]
421
422                                                     <span class="results_summary">
423
424                                                         [% IF Koha.Preference( 'RequestOnOpac' ) == 1 %]
425                                                             [% UNLESS ( itemsloo.norequests ) %]
426                                                                 [% IF Koha.Preference( 'opacuserlogin' ) == 1 %]
427                                                                     [% IF ( itemsloo.allow_onshelf_holds ) %]
428                                                                         <span class="actions"><a class="hold" href="/cgi-bin/koha/opac-reserve.pl?biblionumber=[% itemsloo.biblionumber %]">Place hold</a><!-- add back when available 0 holds in queue--></span>
429                                                                     [% ELSE %]
430                                                                         [% IF ( itemsloo.itemsissued ) %]
431                                                                             <span class="actions"><a class="hold" href="/cgi-bin/koha/opac-reserve.pl?biblionumber=[% itemsloo.biblionumber %]">Place hold</a><!-- add back when available 0 holds in queue--></span>
432                                                                         [% END %]
433                                                                     [% END %]
434                                                                 [% END # / IF opacuserlogin %]
435                                                             [% END # / UNLESS itemsloo.norequests %]
436                                                         [% END # / RequestOnOpac %]
437
438                                                         [% IF ( TagsInputEnabled ) %]
439                                                             [% IF ( loggedinusername ) %]
440                                                                 <span class="actions"><a class="tag_add hidden" id="tag_add[% itemsloo.biblionumber %]" href="#">Add tag</a></span>
441                                                                 <div id="tagform[% itemsloo.biblionumber %]" class="tag_results_input" style="display:none;">
442                                                                     <label for="newtag[% itemsloo.biblionumber %]">New tag(s), separated by a comma:</label>
443                                                                     <input name="newtag[% itemsloo.biblionumber %]" id="newtag[% itemsloo.biblionumber %]" maxlength="100" />
444                                                                     <input name="tagbutton" class="tagbutton btn btn-small" title="[% itemsloo.biblionumber %]" type="submit" value="Add" />
445                                                                     <a class="cancel_tag_add" id="cancel[% itemsloo.biblionumber %]" href="#">(done)</a>
446                                                                 </div>
447                                                                 <div id="newtag[% itemsloo.biblionumber %]_status" class="tagstatus" style="display:none;">
448                                                                 Tag status here.
449                                                                 </div>
450                                                             [% ELSIF ( loop.first ) %]
451                                                                 <span class="tagstatus" id="login4tags">Log in to add tags.</span>
452                                                             [% END # / IF loggedinusername %]
453                                                         [% END # / IF TagsInputEnabled %]
454
455                                                         [% IF ( ( Koha.Preference( 'opacuserlogin' ) == 1 ) && loggedinusername && ( Koha.Preference( 'virtualshelves' ) == 1 ) ) %]
456                                                             <span class="actions"><a class="addtoshelf" href="/cgi-bin/koha/opac-addbybiblionumber.pl?biblionumber=[% itemsloo.biblionumber %]" onclick="Dopop('opac-addbybiblionumber.pl?biblionumber=[% itemsloo.biblionumber %]'); return false;">Save to another list</a></span>
457                                                         [% END %]
458
459                                                         [% IF ( allowremovingitems ) %]
460                                                             <span class="actions"><a class="removefromlist hidden" id="REM-[% itemsloo.biblionumber %]" href="#">Remove from this list</a></span>
461                                                         [% END %]
462
463                                                         [% IF Koha.Preference( 'opacbookbag' ) == 1 %]
464                                                             [% IF ( itemsloo.incart ) %]
465                                                                 <span class="actions"><a class="addtocart cart[% itemsloo.biblionumber %] hidden" href="#" onclick="addRecord('[% itemsloo.biblionumber %]'); return false;">In your cart</a> <a class="cartRemove cartR[% itemsloo.biblionumber %] hidden" href="#" onclick="delSingleRecord('[% itemsloo.biblionumber %]'); return false;">(remove)</a></span>
466                                                             [% ELSE %]
467                                                                 <span class="actions"><a class="addtocart cart[% itemsloo.biblionumber %] hidden" href="#" onclick="addRecord('[% itemsloo.biblionumber %]'); return false;">Add to cart</a> <a style="display:none;" class="cartRemove cartR[% itemsloo.biblionumber %] hidden" href="#" onclick="delSingleRecord('[% itemsloo.biblionumber %]'); return false;">(remove)</a></span>
468                                                             [% END %]
469                                                         [% END # / IF opacbookbag %]
470                                                     </span> <!-- / .results_summary .actions -->
471
472                                                     <!-- COinS / Openurl -->
473                                                     <span class="Z3988" title="[% itemsloo.coins %]"></span>
474                                                 </td>
475                                             </tr>
476                                         [% END # / FOREACH itemsloop %]
477                                         </tbody>
478                                     </table> <!-- / #listcontents -->
479                                 </div><!-- / .searchresults -->
480
481                             [% IF ( pagination_bar ) %]
482                                 <div class="pages">[% pagination_bar %]</div>
483                             [% END %]
484
485                         [% ELSE %]
486                             <div id="toolbar" class="toolbar clearfix">
487                                 <div class="list-actions">
488                                     <a class="newshelf" href="/cgi-bin/koha/opac-shelves.pl?shelves=1">New list</a> <span class="sep"></span>
489                                     [% IF ( manageshelf ) %]
490                                         <span class="sep">|</span>
491                                         <form method="get" action="/cgi-bin/koha/opac-shelves.pl" class="form-inline">
492                                             <input type="hidden" name="op" value="modif" />
493                                             <input type="hidden" name="display" value="viewshelf" />
494                                             <input type="hidden" name="shelfnumber" value="[% shelfnumber | html %]" />
495                                             <input type="submit" class="editshelf" value="Edit list" />
496                                         </form>
497
498                                         <form method="post" action="/cgi-bin/koha/opac-shelves.pl" class="form-inline">
499                                             <input type="hidden" value="1" name="shelves"/>
500                                             <input type="hidden" value="1" name="DEL-[% shelfnumber | html  %]"/>
501                                             [% IF ( showprivateshelves ) %]
502                                                 <input type="hidden" name="display" value="privateshelves"/>
503                                             [% END %]
504                                             <input type="submit" class="deleteshelf" value="Delete list" onclick="return confirmDelete(MSG_CONFIRM_DELETE_LIST);"/>
505                                         </form>
506                                     [% END # / IF manageshelf %]
507                                 </div> <!-- / .list-actions -->
508                             </div> <!-- / #toolbar -->
509
510                             <div class="alert alert-info">
511                                 This list is empty.
512                                 [% IF Koha.Preference( 'opacuserlogin' ) == 1 %]
513                                     You can add to your lists from the results of any <a href="opac-main.pl">search</a>.
514                                 [% END %]
515                             </div>
516                         [% END # / IF itemsloop %]
517                     [% END # / IF viewshelf %]
518
519                     [% IF ( itemsloop && allowremovingitems ) %]
520                         <input type="hidden" name="shelfnumber" value="[% shelfnumber | html %]" />
521                         <input type="hidden" name="modifyshelfcontents" value="1" />
522                         <input type="hidden" name="viewshelf" value="[% shelfnumber | html %]" /><input type="submit" value="Remove selected items" id="remove-selected" class="btn btn-danger"/>
523                         </form>
524                     [% ELSIF ( !itemsloop && manageshelf ) %]
525                         <form method="post" action="opac-shelves.pl">
526                         <input type="hidden" name="DEL-[% shelfnumber | html %]" value="1" />
527                         <input type="hidden" name="shelves" value="1" />
528                         <input type="hidden" name="shelfoff" value="[% shelfoff %]" />
529                         <input type="submit" class="btn btn-danger" value="Delete this list" onclick="return confirmDelete(MSG_CONFIRM_DELETE_LIST)" />
530                         </form>
531                     [% END %]
532
533                     [% IF ( edit ) %]
534                         <form method="post" action="/cgi-bin/koha/opac-shelves.pl">
535                             <input type="hidden" name="op" value="modifsave" />
536                             <input type="hidden" name="display" value="[% display |html %]" />
537                             <input type="hidden" name="shelfnumber" value="[% shelfnumber | html %]" />
538                             <fieldset class="rows">
539                                 <legend>Editing <em>[% shelfname |html %]</em></legend>
540                                 <ol>
541                                     <li><label for="shelfname">List name: </label><input type="text" id="shelfname" name="shelfname" maxlength="255" value="[% shelfname |html %]" /></li>
542                                     <li>
543                                         <label for="sortfield" >Sort this list by: </label>
544                                         <select name="sortfield" id="sortfield">
545                                             [% IF ( sortfield == "title" ) %]
546                                                 <option value="title" selected="selected">Title</option>
547                                             [% ELSE %]
548                                                 <option value="title">Title</option>
549                                             [% END %]
550                                             [% IF ( sortfield == "author" ) %]
551                                                 <option value="author" selected="selected">Author</option>
552                                             [% ELSE %]
553                                                 <option value="author">Author</option>
554                                             [% END %]
555                                             [% IF ( sortfield == "copyrightdate" ) %]
556                                                 <option value="copyrightdate" selected="selected">Year</option>
557                                             [% ELSE %]
558                                                 <option value="copyrightdate">Year</option>
559                                             [% END %]
560                                             [% IF ( sortfield == "itemcallnumber" ) %]
561                                                 <option value="itemcallnumber" selected="selected">Call number</option>
562                                             [% ELSE %]
563                                                 <option value="itemcallnumber">Call number</option>
564                                             [% END %]
565                                         </select>
566                                     </li>
567                                     [% IF ( OpacAllowPublicListCreation || category2 ) %]
568                                         <li>
569                                             <label for="category">Category:</label>
570                                             <select name="category" id="category">
571                                                 [% IF ( category1 ) %]
572                                                         <option value="1" selected="selected">Private</option>
573                                                     [% ELSE %]
574                                                         <option value="1">Private</option>
575                                                     [% END %]
576                                                 [% IF ( category2 ) %]
577                                                     <option value="2" selected="selected">Public</option>
578                                                 [% ELSE %]
579                                                     <option value="2">Public</option>
580                                                 [% END %]
581                                             </select>
582                                             [% IF ( category2 && !OpacAllowPublicListCreation ) %]
583                                                 <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>
584                                             [% END %]
585                                         </li>
586                                         [% INCLUDE list_permissions %]
587                                     [% END %]
588                                 </ol>
589                                 [% UNLESS ( OpacAllowPublicListCreation || category2 ) %]
590                                     <input type="hidden" name="category" value="1" />
591                                 [% END %]
592                             </fieldset>
593
594                             <fieldset class="action">
595                                 <input type="submit" value="Save" class="btn" />
596                                 [% IF ( showprivateshelves ) %]
597                                     <a class="cancel" href="/cgi-bin/koha/opac-shelves.pl?shelfnumber=[% shelfnumber | html %]&amp;display=privateshelves">Cancel</a>
598                                 [% ELSE %]
599                                     <a class="cancel" href="/cgi-bin/koha/opac-shelves.pl?shelfnumber=[% shelfnumber | html %]">Cancel</a>
600                                 [% END %]
601                             </fieldset>
602                         </form>
603                     [% END # / IF edit %]
604
605
606                     [% UNLESS ( edit ) %]
607                         [% UNLESS ( viewshelf ) %]
608                             [% UNLESS ( shelves ) %]
609                                 <h2>Lists</h2>
610                                 <div class="toptabs ui-tabs ui-widget ui-widget-content ui-corner-all">
611                                 <ul class="ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all">
612                                     [% IF Koha.Preference( 'opacuserlogin' ) == 1 %]
613                                         [% IF ( showprivateshelves ) %]
614                                             <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?display=privateshelves">Your lists</a></li>
615                                         [% ELSE %]
616                                             <li id="privateshelves_tab" class="ui-state-default ui-corner-top"><a class="ui-tabs-anchor" href="/cgi-bin/koha/opac-shelves.pl?display=privateshelves">Your lists</a></li>
617                                         [% END %]
618                                     [% END %]
619                                     [% IF ( showpublicshelves ) %]
620                                         <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?display=publicshelves">Public lists</a></li>
621                                     [% ELSE %]
622                                         <li id="publicshelves_tab" class="ui-state-default ui-corner-top"><a class="ui-tabs-anchor" href="/cgi-bin/koha/opac-shelves.pl?display=publicshelves">Public lists</a></li>
623                                     [% END %]
624                                 </ul>
625
626                                 [% IF ( showprivateshelves ) %]
627                                         <div id="privateshelves" class="ui-tabs-panel ui-widget-content ui-corner-bottom" style="display:block;">
628
629                                         [% IF ( loggedinusername ) %]
630                                             <div id="toolbar" class="toolbar"><a class="newshelf" href="/cgi-bin/koha/opac-shelves.pl?shelves=1">New list</a></div>
631                                             [% IF ( showprivateshelves ) %]
632                                                 [% IF ( shelveslooppriv ) %]
633                                                     <table class="table">
634                                                         <thead>
635                                                             <tr>
636                                                                 <th>List name</th>
637                                                                 <th>Contents</th>
638                                                                 <th>Type</th>
639                                                                 <th>&nbsp;</th>
640                                                             </tr>
641                                                         </thead>
642                                                         <tbody>
643                                                             [% FOREACH shelveslooppri IN shelveslooppriv %]
644                                                                 <tr>
645                                                                     <td><a href="/cgi-bin/koha/opac-shelves.pl?display=privateshelves&amp;viewshelf=[% shelveslooppri.shelf %]&amp;sortfield=[% shelveslooppri.sortfield %]">[% shelveslooppri.shelfname |html %]</a></td>
646                                                                     <td>[% IF ( shelveslooppri.count ) %][% shelveslooppri.count %] [% IF ( shelveslooppri.single ) %]item[% ELSE %]items[% END %][% ELSE %]Empty[% END %]</td>
647                                                                     <td>
648                                                                         [% IF ( shelveslooppri.viewcategory1 ) %][% IF !shelveslooppri.shares %]Private[% ELSE %]Shared[% END %][% END %]
649                                                                     </td>
650                                                                     <td>
651                                                                         [% IF ( shelveslooppri.mine ) %]
652                                                                         <form action="/cgi-bin/koha/opac-shelves.pl" method="get" class="form-inline">
653                                                                             <input type="hidden" name="shelfnumber" value="[% shelveslooppri.shelf |html %]" />
654                                                                             <input type="hidden" name="display" value="privateshelves" />
655                                                                             <input type="hidden" name="op" value="modif" />
656                                                                             <input type="submit" class="editshelf" value="Edit" />
657                                                                         </form>
658                                                                         <form action="opac-shelves.pl" method="post" class="form-inline">
659                                                                             <input type="hidden" name="shelves" value="1" />
660                                                                             <input type="hidden" name="display" value="privateshelves" />
661                                                                             <input type="hidden" name="DEL-[% shelveslooppri.shelf |html %]" value="1" />
662                                                                             <input type="hidden" name="shelfoff" value="[% shelfoff |html %]" />
663                                                                             [% IF ( shelveslooppri.confirm ) %]
664                                                                                 <input type="hidden" name="CONFIRM-[% shelveslooppri.confirm |html %]" value="1" />
665                                                                                 <input type="submit" class="btn btn-danger confirm" value="Confirm" />
666                                                                             [% ELSE %]
667                                                                                 <input type="submit" class="deleteshelf" onclick="return confirmDelete(MSG_CONFIRM_DELETE_LIST);" value="Delete" />
668                                                                             [% END %]
669                                                                         </form>
670                                                                             [% IF Koha.Preference('OpacAllowSharingPrivateLists') %]
671                                                                                 <a href="/cgi-bin/koha/opac-shareshelf.pl?op=invite&shelfnumber=[% shelveslooppri.shelf |html %]" class="">Share</a>
672                                                                             [% END %]
673                                                                         [% ELSE # not shelveslooppri.mine, so shared %]
674                                                                             [% INCLUDE remove_share  # if pref is off, you should still be able to remove shares %]
675                                                                             <input type="hidden" name="shelfoff" value="[% shelfoff |html %]" />
676                                                                             <input type="hidden" name="REMSHR-[% shelveslooppri.shelf |html %]" value="1" />
677                                                                             </form>
678                                                                         [% END %]&nbsp;
679                                                                     </td>
680                                                                 </tr>
681                                                             [% END # / FOREACH shelveslooppri %]
682                                                         </tbody>
683                                                     </table>
684                                                     <div class="pages">[% pagination_bar %]</div>
685                                                 [% ELSE %]
686                                                     <p>No private lists.</p>
687                                                 [% END # / IF shelveslooppriv %]
688                                             [% END # / IF showprivateshelves %]
689                                         [% ELSE %]
690                                             [% IF Koha.Preference( 'opacuserlogin' ) == 1 %]
691                                                 <div class="alert alert-info"><a href="/cgi-bin/koha/opac-user.pl">Log in</a> to create new lists.</div>
692                                             [% END %]
693                                         [% END  # IF loggedinusername %]
694                                     </div><!-- / #privateshelves -->
695                                 [% END # / IF showprivateshelves %]
696                                 [% IF ( showpublicshelves ) %]
697                                     <div id="publicshelves" class="ui-tabs-panel ui-widget-content ui-corner-bottom" style="display:block;">
698
699                                     [% IF ( loggedinusername ) %]
700                                         <div id="toolbar" class="toolbar"> <a class="newshelf" href="/cgi-bin/koha/opac-shelves.pl?shelves=1">New list</a></div>
701                                     [% ELSE %]
702                                         [% IF Koha.Preference( 'opacuserlogin' ) == 1 %]
703                                             <div class="alert alert-info"><a href="/cgi-bin/koha/opac-user.pl">Log in</a> to create new lists.</div>
704                                         [% END %]
705                                     [% END # / IF loggedinusername %]
706
707                                     [% IF ( shelvesloop ) %]
708                                         <table class="table">
709                                             <thead>
710                                                 <tr>
711                                                     <th>List name</th>
712                                                     <th>Contents</th>
713                                                     <th>Type</th><th>&nbsp;</th>
714                                                 </tr>
715                                             </thead>
716                                             <tbody>
717                                                 [% FOREACH shelvesloo IN shelvesloop %]
718                                                     <tr>
719                                                         <td><a class="title" href="/cgi-bin/koha/opac-shelves.pl?viewshelf=[% shelvesloo.shelf %]&amp;sortfield=[% shelvesloo.sortfield %]">[% shelvesloo.shelfname |html %]</a></td>
720                                                         <td>[% shelvesloo.count %] [% IF ( shelvesloo.single ) %]item[% ELSE %]item(s)[% END %]</td>
721                                                         <td>
722                                                             [% IF ( shelvesloo.viewcategory2 ) %]Public[% END %]
723                                                         </td>
724                                                         <td>
725                                                             [% IF ( shelvesloo.mine ) %]
726                                                                 <form action="/cgi-bin/koha/opac-shelves.pl" method="get" class="form-inline">
727                                                                     <input type="hidden" name="shelfnumber" value="[% shelvesloo.shelf %]" />
728                                                                     <input type="hidden" name="op" value="modif" />
729                                                                     <input type="hidden" name="display" value="publicshelves" />
730                                                                     <input type="submit" class="editshelf" value="Edit" />
731                                                                 </form>
732                                                                 <form action="opac-shelves.pl" method="post" class="form-inline">
733                                                                     <input type="hidden" name="shelves" value="1" />
734                                                                     <input type="hidden" name="DEL-[% shelvesloo.shelf %]" value="1" />
735                                                                     [% IF ( shelvesloo.confirm ) %]
736                                                                         <input type="hidden" name="CONFIRM-[% shelvesloo.confirm %]" value="1" />
737                                                                         <input type="submit" class="btn btn-danger confirm" value="Confirm" />
738                                                                     [% ELSE %]
739                                                                         <input type="submit" class="deleteshelf" onclick="return confirmDelete(MSG_CONFIRM_DELETE_LIST);" value="Delete" />
740                                                                     [% END %]
741                                                                 </form>
742                                                             [% END %]&nbsp;
743                                                         </td>
744                                                     </tr>
745                                                 [% END # / FOREACH shelvesloop %]
746                                             </tbody>
747                                         </table>
748                                         [% IF ( pagination_bar ) %]<div class="pages">[% pagination_bar %]</div>[% END %]
749                                     [% ELSE %]
750                                         [% IF ( showpublicshelves ) %]<p>No public lists.</p>[% END %]
751                                     [% END # / IF shelvesloop %]
752
753                                     </div><!-- / # publicshelves -->
754                                 [% END # / IF showprivateshelves %]
755                                 </div> <!-- / .ui-tabs-panel -->
756                             [% END # / UNLESS shelves %]
757                         [% END # / UNLESS viewshelf %]
758                     [% END # / UNLESS edit %]
759
760                     [% IF ( shelves ) %]
761                         <div id="addshelf">
762                             <form method="post" action="/cgi-bin/koha/opac-shelves.pl">
763                                 <fieldset class="rows">
764                                     <legend>Create a new list</legend>
765                                     <input type="hidden" name="shelves" value="1" />
766                                     <ol>
767                                         <li>
768                                             <label class="required" for="addshelf">List name:</label>
769                                             [% IF ( already ) %]
770                                               <input id="addshelf" type="text" name="addshelf" value="[% already %]" maxlength="255" class="input-fluid" />
771                                             [% ELSE %]
772                                               <input id="addshelf" type="text" name="addshelf" maxlength="255" class="input-fluid" />
773                                             [% END %]
774                                             <input type="hidden" name="owner" id="owner" value="[% loggedinuser %]" />
775                                         </li>
776                                         <li>
777                                             <label for="sortfield" >Sort this list by: </label>
778                                             <select name="sortfield" id="sortfield">
779                                               <option value="title">Title</option>
780                                               <option value="author">Author</option>
781                                               <option value="copyrightdate">Year</option>
782                                               <option value="itemcallnumber">Call number</option>
783                                             </select>
784                                         </li>
785                                         [% IF (OpacAllowPublicListCreation) %]
786                                             <li>
787                                                 <label for="category">Category:</label>
788                                                 <select name="category" id="category">
789                                                     <option value="1">Private</option>
790                                                     <option value="2">Public</option>
791                                                 </select>
792                                             </li>
793                                             [% INCLUDE list_permissions %]
794                                         [% END %]
795                                     </ol>
796                                     [% UNLESS (OpacAllowPublicListCreation) %]
797                                         <input type="hidden" name="category" value="1" />
798                                     [% END %]
799                                 </fieldset>
800                                 <fieldset class="action">
801                                     <input type="submit" onclick="Check(this.form); return false;" value="Save" class="btn" />
802                                     <a class="cancel" href="/cgi-bin/koha/opac-shelves.pl">Cancel</a>
803                                 </fieldset>
804                             </form>
805                         </div> <!-- / #addshelf -->
806                     [% END # / IF shelves %]
807
808                 </div> <!-- / #usershelves -->
809                 </div> <!-- / .span10/12 -->
810       </div> <!-- / .row-fluid -->
811     </div> <!-- / .container-fluid -->
812   </div> <!-- / .main -->
813
814 <div class="modal hide" id="modalWin" role="dialog" aria-hidden="true" tabindex="-1">
815     <div class="modal-content">
816         <div class="modal-body">
817             <div style="margin:1em;padding:1em;font-size:150%;">
818                 <img src="[% interface %]/[% theme %]/images/loading.gif" /> Loading
819             </div>
820         </div>
821     </div>
822 </div>
823
824 <!-- DEBUG -->
825     <div id="debug"></div>
826 <!-- /DEBUG -->
827
828 [% INCLUDE 'opac-bottom.inc' %]
829 [% BLOCK jsinclude %]
830 <script type="text/javascript" src="[% interface %]/[% theme %]/lib/jquery/plugins/jquery.checkboxes.min.js"></script>
831 <script type="text/javascript">
832 //<![CDATA[
833 var MSG_REMOVE_FROM_LIST = _("Are you sure you want to remove these items from the list?");
834 var MSG_REMOVE_ONE_FROM_LIST = _("Are you sure you want to remove this item from the list?");
835 var MSG_CONFIRM_DELETE_LIST = _("Are you sure you want to delete this list?");
836 var MSG_CONFIRM_REMOVE_SHARE = _("Are you sure you want to remove this share?");
837
838 [% IF ( ( Koha.Preference( 'opacuserlogin' ) == 1 ) && ( Koha.Preference( 'RequestOnOpac' ) == 1 ) ) %]
839     function holdSelections() {
840         var checkedBoxes = $("input:checkbox:checked");
841         if ($(checkedBoxes).size() == 0) {
842             alert(MSG_NO_RECORD_SELECTED);
843         } else {
844             var bibs = "";
845             $(checkedBoxes).each(function(){
846                 var name = $(this).attr("name");
847                 bib = name.substr(4);
848                 bibs += bib + "/";
849             });
850             document.location = "/cgi-bin/koha/opac-reserve.pl?biblionumbers="+bibs;
851         }
852     }
853 [% END %]
854 [% IF ( TagsInputEnabled && loggedinusername ) %]
855     function tagSelected() {
856         var checkedBoxes = $("input:checkbox:checked");
857         if ($(checkedBoxes).size()) {
858             $("#tagsel_tag").hide();
859             $(".tag_hides").hide();
860             $("#tagsel_form").show();
861         } else {
862             alert(MSG_NO_RECORD_SELECTED);
863         }
864     }
865
866     function tagCanceled() {
867         $("#tagsel_form").hide();
868         $("#tagsel_tag").show();
869         $(".tag_hides").show();
870         $("#tagsel_new").val("");
871         $(".tagstatus").empty().hide();
872     }
873
874     function tagAdded() {
875         var checkedBoxes = $("input:checkbox:checked");
876         if (!$(checkedBoxes).size()) {
877             alert(MSG_NO_RECORD_SELECTED);
878             return false;
879         }
880
881         var tag = $("#tagsel_new").val();
882         if (!tag || (tag == "")) {
883             alert(MSG_NO_TAG_SPECIFIED);
884             return false;
885         }
886
887         var bibs = [];
888         for (var i = 0; i < $(checkedBoxes).size(); i++) {
889             var box = $(checkedBoxes).get(i);
890             bibs[i] = $(box).val();
891         }
892
893         KOHA.Tags.add_multitags_button(bibs, tag);
894         return false;
895     }
896 [% END %]
897
898 function enableCheckboxActions(){
899     // Enable/disable controls if checkboxes are checked
900     var checkedBoxes = $(".checkboxed input:checkbox:checked");
901     if ($(checkedBoxes).size()) {
902       $("#selections").html(_("With selected titles: "));
903       $("#selections-toolbar .links a").removeClass("disabled");
904     } else {
905       $("#selections").html(_("Select titles to: "));
906       $("#selections-toolbar .links a").addClass("disabled");
907     }
908 }
909
910 $(function() {
911     [% IF Koha.Preference( 'opacbookbag' ) == 1 %]$(".addtocart,.cartRemove").removeClass("hidden");[% END %]
912     $("span.clearall").html("<a id=\"CheckNone\" href=\"#\">"+_("Clear all")+"<\/a>");
913     $("span.checkall").html("<a id=\"CheckAll\" href=\"#\">"+_("Select all")+"<\/a>");
914     $("a.print").show();
915
916     [% IF ( ( Koha.Preference( 'opacuserlogin' ) == 1 ) && ( Koha.Preference( 'RequestOnOpac' ) == 1 ) ) %]
917         $("#placehold").html("<a href=\"#\" class=\"hold tag_hides disabled\">"+_("Place hold")+"<\/a>");
918         $("#selections-toolbar a.hold").click(function(){
919             holdSelections();
920             return false;
921         });
922     [% END %]
923
924     // If JS is enabled add paramter to download link
925     var dialoglink = $(".download").attr("href");
926     dialoglink += "&context=modal";
927     $(".download").attr("href",dialoglink);
928
929     $("#CheckAll").click(function(){
930         $(".checkboxed").checkCheckboxes();
931         enableCheckboxActions();
932         return false;
933     });
934     $("#CheckNone").click(function(){
935         $(".checkboxed").unCheckCheckboxes();
936         enableCheckboxActions();
937         return false;
938     });
939
940     $(".cb").click(function(){
941       enableCheckboxActions();
942     });
943     enableCheckboxActions();
944
945     [% IF ( TagsInputEnabled && loggedinusername ) %]
946         var tagAdd = $(".tag_add");
947         tagAdd.removeClass("hidden");
948         $("#tagsel_tag").click(function(){
949             tagSelected();
950             return false;
951         });
952         $("#tagsel_cancel").click(function(){
953             tagCanceled();
954             return false;
955         });
956         $("#tagsel_button").click(function(){
957             tagAdded();
958             return false;
959         });
960
961         tagAdd.click(function(){
962             var thisid = $(this).attr("id");
963             thisid = thisid.replace("tag_add","");
964             $(this).hide();
965             $("#tagform"+thisid).show();
966             $("#newtag"+thisid).focus();
967             $("#newtag"+thisid+"_status").empty().hide();
968             return false;
969         });
970         $(".cancel_tag_add").click(function(){
971             var thisid = $(this).attr("id");
972             thisid = thisid.replace("cancel","");
973             $("#tagform"+thisid).hide();
974             $("#tag_add"+thisid).show();
975             $("#newtag"+thisid).val("");
976             $("#newtag"+thisid+"_status").empty().hide();
977             return false;
978         });
979         $(".tagbutton").click(function(){
980           var thisid = $(this).attr("title");
981           var tag = $("#newtag"+thisid).val();
982           if (!tag || (tag == "")) {
983               alert(MSG_NO_TAG_SPECIFIED);
984               return false;
985           }
986           KOHA.Tags.add_tag_button(thisid, tag);
987           return false;
988         });
989     [% END %]
990
991     [% IF ( loggedinusername && allowremovingitems ) %]
992         var removeFromListLinks = $(".removefromlist");
993         removeFromListLinks.removeClass("hidden");
994         // "remove from list" appearing on each line of the list output
995         removeFromListLinks.on("click",function(){
996             $(".checkboxed").unCheckCheckboxes();
997             var listitem = $("input[name="+this.id+"]");
998             listitem.prop("checked",true);
999             $("#myform").submit();
1000         });
1001
1002         $("#myform").submit(function(){
1003             var checkedBoxes = $(".checkboxed input:checkbox:checked");
1004             var numchecked = $(checkedBoxes).size();
1005             if (numchecked) {
1006                 if( numchecked > 1 ){
1007                     return confirmDelete(MSG_REMOVE_FROM_LIST);
1008                 } else {
1009                     return confirmDelete(MSG_REMOVE_ONE_FROM_LIST);
1010                 }
1011             } else {
1012                 alert(MSG_NO_RECORD_SELECTED);
1013                 return false;
1014             }
1015         });
1016         $("#removeitems").html("<a href=\"#\" class=\"removeitems tag_hides disabled\">"+_("Remove from list")+"</a>")
1017         .click(function(){
1018             $("#myform").submit();
1019             return false;
1020         });
1021     [% END %]
1022     [% IF OpenLibraryCovers %]KOHA.OpenLibrary.GetCoverFromIsbn();[% END %]
1023     [% IF OPACLocalCoverImages %]KOHA.LocalCover.GetCoverFromBibnumber(false);[% END %]
1024     [% IF ( GoogleJackets ) %]KOHA.Google.GetCoverFromIsbn();[% END %]
1025     $('#sort-submit').hide();
1026
1027     [% IF print %]
1028         window.print();
1029         setTimeout('window.close()', 1);
1030     [% END %]
1031 }); // document.ready
1032
1033 function Check(f) {
1034     var _alertString="";
1035     var alertString2;
1036
1037     if(f.addshelf.value.length ==0){
1038         _alertString += _("- You must enter a list name") + "\n";
1039     }
1040
1041     if (_alertString.length==0) {
1042         f.submit();
1043     } else {
1044         alertString2 = _("Form not submitted because of the following problem(s)");
1045         alertString2 += "\n------------------------------------------------------------------------------------\n\n";
1046         alertString2 += _alertString;
1047         alert(alertString2);
1048     }
1049 }
1050 //]]>
1051 </script>
1052 [% END %]