Bug 22592: Add index scan emulation to Elasticsearch
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / catalogue / results.tt
1 [% USE raw %]
2 [% USE Asset %]
3 [% USE Koha %]
4 [% USE Biblio %]
5 [% USE KohaDates %]
6 [% PROCESS 'i18n.inc' %]
7 [% SET footerjs = 1 %]
8 [% USE AuthorisedValues %]
9 [% SET AdlibrisEnabled = Koha.Preference('AdlibrisCoversEnabled') %]
10 [% SET AdlibrisURL = Koha.Preference('AdlibrisCoversURL') %]
11 [% IF BiblioDefaultViewmarc %]
12     [% SET DetailPage="MARCdetail.pl" %]
13 [% ELSIF BiblioDefaultViewlabeled_marc %]
14     [% SET DetailPage="labeledMARCdetail.pl" %]
15 [% ELSIF BiblioDefaultViewisbd %]
16     [% SET DetailPage="ISBDdetail.pl" %]
17 [% ELSE %]
18     [% SET DetailPage="detail.pl" %]
19 [% END %]
20 [% INCLUDE 'doc-head-open.inc' %]
21
22 <title>Koha &rsaquo; Catalog &rsaquo; [% IF ( searchdesc ) %]Results of search [% IF ( query_desc ) %]for '[% query_desc | html %]'[% END %][% IF ( limit_desc ) %]&nbsp;with limit(s):&nbsp;'[% limit_desc | html %]'[% END %][% ELSE %]You did not specify any search criteria[% END %]</title>
23 [% INCLUDE 'doc-head-close.inc' %]
24 </head>
25
26 <body id="catalog_results" class="catalog">
27 [% INCLUDE 'header.inc' %]
28 [% INCLUDE 'cat-search.inc' %]
29
30 [% IntranetCoce    = Koha.Preference('IntranetCoce') %]
31 [% CoceProviders   = Koha.Preference('CoceProviders') %]
32 [% CoceHost        = Koha.Preference('CoceHost') %]
33
34 <div id="breadcrumbs">
35     <a href="/cgi-bin/koha/mainpage.pl">Home</a>
36     &rsaquo; <a href="/cgi-bin/koha/catalogue/search.pl">Catalog</a>
37     &rsaquo; Search [% IF ( query_desc ) %]for '[% query_desc | html %]'[% END %][% IF ( limit_desc ) %]&nbsp;with limit(s):&nbsp;'[% limit_desc | html %]'[% END %]
38 </div>
39
40 <div class="main container-fluid">
41     <div class="row">
42         <div class="col-sm-10 col-sm-push-2">
43             <main>
44
45                 [% IF ( outer_sup_results_loop ) %]
46                     <div class="row">
47                         <div class="col-sm-8">
48                 [% END %]
49
50                 [% IF ( koha_spsuggest ) %]
51                     <div style="font-size: 12px;">Did you mean:
52                         <ul style="list-style: none;">
53                             [% FOREACH SPELL_SUGGES IN SPELL_SUGGEST %]
54                                 <li>
55                                     <a href="/cgi-bin/koha/catalogue/search.pl?q=[% SPELL_SUGGES.spsuggestion | uri %]">[% SPELL_SUGGES.spsuggestion | html %]</a>
56                                 </li>
57                             [% END %]
58                         </ul>
59                     </div>
60                 [% END %]
61
62                 [% IF ( total ) %]
63
64                     <h3>
65                         [% total | html %] result(s) found [% IF ( query_desc ) %]for <span class="results_query_desc">'[% query_desc | html %]'</span>[% END %][% IF limit_desc  %]&nbsp;with limit(s): <span class="results_limit_desc">'[% limit_desc | html %]'</span>[% END %][% IF ( LibraryName ) %] in [% LibraryName | html %] Catalog[% END %].
66                     </h3>
67
68                     <div id="searchheader">
69                         <div id="selection_ops">
70                             <a href="#" id="select_all"><i class="fa fa-check"></i> Select all</a>
71                             |
72                             <a href="#" id="clear_all"><i class="fa fa-remove"></i> Clear all</a>
73                             |
74                             <a href="#" class="highlight_toggle" id="highlight_toggle_off">Unhighlight</a>
75                             <a href="#" class="highlight_toggle" id="highlight_toggle_on">Highlight</a>
76                             |
77
78                             [% IF ( intranetbookbag ) %]
79                                 <div class="btn-group">
80                                     <a id="cartsubmit" class="btn btn-default btn-xs" href="#"><i class="fa fa-shopping-cart"></i> Add to cart</a>
81                                 </div>
82                             [% END %]
83
84                             [% IF Koha.Preference('virtualshelves') %]
85                                 <div class="btn-group">
86                                     <button type="button" class="btn btn-default btn-xs dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
87                                         <i class="fa fa-list"></i> Add to list <span class="caret"></span>
88                                     </button>
89                                     <ul class="dropdown-menu">
90                                         [% IF add_to_some_private_shelves.count %]
91                                             <li class="dropdown-header">Your lists</li>
92                                             [% SET number_of_private_shelves = 0 %]
93                                             [% FOREACH s IN add_to_some_private_shelves %]
94                                                 [% IF shelfnumber != s.shelfnumber %]
95                                                     <li>
96                                                         <a href="#" class="addtolist" data-shelfnumber="[% s.shelfnumber | html %]">[% s.shelfname | html %]</a>
97                                                     </li>
98                                                     [% SET number_of_private_shelves = number_of_private_shelves + 1 %]
99                                                     [% IF number_of_private_shelves == 10 %][% LAST %][% END %]
100                                                 [% END %]
101                                             [% END %]
102                                         [% END %]
103                                         [% IF add_to_some_public_shelves.count %]
104                                             <li class="dropdown-header">Public lists</li>
105                                             [% SET number_of_public_shelves = 0 %]
106                                             [% FOREACH s IN add_to_some_public_shelves %]
107                                                 [% IF shelfnumber != s.shelfnumber %]
108                                                     <li>
109                                                         <a href="#" data-shelfnumber="[% s.shelfnumber | html %]" class="addtolist">[% s.shelfname | html %]</a>
110                                                     </li>
111                                                     [% SET number_of_public_shelves = number_of_public_shelves + 1 %]
112                                                     [% IF number_of_public_shelves == 10 %][% LAST %][% END %]
113                                                 [% END %]
114                                             [% END %]
115                                         [% END %]
116                                         <li role="separator" class="divider"></li>
117                                         [% IF add_to_some_private_shelves.count > 10 or add_to_some_public_shelves.count > 10 %]
118                                             <li>
119                                                 <a href="#" class="addtolist morelists">More lists</a>
120                                             </li>
121                                         [% END %]
122                                         <li>
123                                             <a href="#" class="addtolist newlist">New list</a>
124                                         </li>
125                                     </ul>
126                                 </div>
127                             [% END # /IF virtualshelves %]
128
129                             [% IF ( CAN_user_reserveforothers_place_holds && DisplayMultiPlaceHold ) %]
130                                 [% IF ( holdfor or holdforclub ) %]
131                                     <div id="placeholdc" class="btn-group">
132                                         <button class="btn btn-default btn-xs placehold"><i class="fa fa-sticky-note-o"></i> Place hold</button>
133                                         <button class="btn btn-default btn-xs dropdown-toggle" data-toggle="dropdown">
134                                         <span class="caret"></span>
135                                         </button>
136                                         <ul class="dropdown-menu">
137                                             <li><a href="#" class="placehold">Place hold</a></li>
138                                             [% IF holdfor %]
139                                                 <li><a href="#" class="placeholdfor">Place hold for [% holdfor_firstname | html %] [% holdfor_surname | html %] ([% holdfor_cardnumber | html %])</a></li>
140                                                 <li class="divider"></li>
141                                                 <li><a href="#" id="forgetholdfor">Forget  [% holdfor_firstname | html %] [% holdfor_surname | html %] ([% holdfor_cardnumber | html %])</a></li>
142                                             [% END %]
143                                             [% IF holdforclub %]
144                                                 <li><a href="#" class="placeholdforclub">Place hold for [% holdforclub_name | html %]</a></li>
145                                                 <li class="divider"></li>
146                                                 <li><a href="#" id="forgetholdforclub">Forget  [% holdforclub_name | html %]</a></li>
147                                             [% END %]
148                                         </ul>
149                                     </div>
150                                 [% ELSE %]
151                                     <div id="placeholdc" class="btn-group">
152                                         <a class="btn btn-default btn-xs placehold" href="#"><i class="fa fa-sticky-note-o"></i> Place hold</a>
153                                     </div>
154                                 [% END # /IF holfor %]
155                             [% END # /IF CAN_user_reserveforothers_place_holds %]
156
157                             [% IF Koha.Preference('BrowseResultSelection') %]
158                                 <div id="browse_selection" class="btn-group">
159                                     <a class="btn btn-default btn-xs browse_selection" href="#"><i class="fa fa-sticky-note-o"></i> Browse selected records</a>
160                                 </div>
161                             [% END %]
162
163                             [% IF ( CAN_user_editcatalogue_edit_catalogue ) %]
164                                 <div class="btn-group">
165                                     <a class="btn btn-default btn-xs" id="z3950submit" href="#"><i class="fa fa-search"></i> Z39.50/SRU search</a>
166                                 </div>
167                             [% END %]
168
169                             [% IF ( searchdesc ) %]
170                                 [% BLOCK sort_search_query ~%]
171                                     [%~ FOREACH QUERY_INPUT IN QUERY_INPUTS ~%]
172                                         &amp;[% QUERY_INPUT.input_name | html %]=[% QUERY_INPUT.input_value | html %]
173                                     [%~ END ~%]
174                                     [%~ FOREACH LIMIT_INPUT IN LIMIT_INPUTS ~%]
175                                         &amp;[% LIMIT_INPUT.input_name | html %]=[% LIMIT_INPUT.input_value | html %]
176                                     [%~ END ~%]
177                                 [%~ END %]
178                             [% END %]
179
180                             <div class="btn-group">
181                                 <button type="button" class="btn btn-default btn-xs dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
182                                     Sort <span class="caret"></span>
183                                 </button>
184                                 <ul class="dropdown-menu">
185                                     [% IF ( sort_by == "relevance_dsc" ) %]
186                                         <li><a href="/cgi-bin/koha/catalogue/search.pl?sort_by=relevance[% PROCESS sort_search_query %]"><i class="fa fa-check"></i> Relevance</a></li>
187                                     [% ELSE %]
188                                         <li><a href="/cgi-bin/koha/catalogue/search.pl?sort_by=relevance[% PROCESS sort_search_query %]">Relevance</a></li>
189                                     [% END %]
190                                     <li class="dropdown-header">Popularity</li>
191                                     [% IF ( sort_by == "popularity_dsc" ) %]
192                                         <li><a href="/cgi-bin/koha/catalogue/search.pl?sort_by=popularity_dsc[% PROCESS sort_search_query %]"><i class="fa fa-check"></i> Popularity (most to least)</a></li>
193                                     [% ELSE %]
194                                         <li><a href="/cgi-bin/koha/catalogue/search.pl?sort_by=popularity_dsc[% PROCESS sort_search_query %]">Popularity (most to least)</a></li>
195                                     [% END %]
196
197                                     [% IF ( sort_by == "popularity_asc" ) %]
198                                         <li><a href="/cgi-bin/koha/catalogue/search.pl?sort_by=popularity_asc[% PROCESS sort_search_query %]"><i class="fa fa-check"></i> Popularity (least to most)</a></li>
199                                     [% ELSE %]
200                                         <li><a href="/cgi-bin/koha/catalogue/search.pl?sort_by=popularity_asc[% PROCESS sort_search_query %]">Popularity (least to most)</a></li>
201                                     [% END %]
202
203                                     <li class="dropdown-header">Author</li>
204
205                                     [% IF ( sort_by == "author_az" || sort_by == "author_asc" ) %]
206                                         <li><a href="/cgi-bin/koha/catalogue/search.pl?sort_by=author_a[% PROCESS sort_search_query %]z"><i class="fa fa-check"></i> Author (A-Z)</a></li>
207                                     [% ELSE %]
208                                         <li><a href="/cgi-bin/koha/catalogue/search.pl?sort_by=author_az[% PROCESS sort_search_query %]">Author (A-Z)</a></li>
209                                     [% END %]
210
211                                     [% IF ( sort_by == "author_za" || sort_by == "author_dsc" ) %]
212                                         <li><a href="/cgi-bin/koha/catalogue/search.pl?sort_by=author_za[% PROCESS sort_search_query %]"><i class="fa fa-check"></i> Author (Z-A)</a></li>
213                                     [% ELSE %]
214                                         <li><a href="/cgi-bin/koha/catalogue/search.pl?sort_by=author_za[% PROCESS sort_search_query %]">Author (Z-A)</a></li>
215                                     [% END %]
216
217                                     <li class="dropdown-header">Call number</li>
218
219                                     [% IF ( sort_by == "call_number_asc" ) %]
220                                         <li><a href="/cgi-bin/koha/catalogue/search.pl?sort_by=call_number_asc[% PROCESS sort_search_query %]"><i class="fa fa-check"></i> Call Number (0-9 to A-Z)</a></li>
221                                     [% ELSE %]
222                                         <li><a href="/cgi-bin/koha/catalogue/search.pl?sort_by=call_number_asc[% PROCESS sort_search_query %]">Call Number (0-9 to A-Z)</a></li>
223                                     [% END %]
224
225                                     [% IF ( sort_by == "call_number_dsc" ) %]
226                                         <li><a href="/cgi-bin/koha/catalogue/search.pl?sort_by=call_number_dsc[% PROCESS sort_search_query %]"><i class="fa fa-check"></i> Call number (Z-A to 9-0)</a></li>
227                                     [% ELSE %]
228                                         <li><a href="/cgi-bin/koha/catalogue/search.pl?sort_by=call_number_dsc[% PROCESS sort_search_query %]">Call number (Z-A to 9-0)</a></li>
229                                     [% END %]
230
231                                     <li class="dropdown-header">Dates</li>
232                                     [% IF ( sort_by == "pubdate_dsc" ) %]
233                                         <li><a href="/cgi-bin/koha/catalogue/search.pl?sort_by=pubdate_dsc[% PROCESS sort_search_query %]"><i class="fa fa-check"></i> Publication/Copyright date: newest to oldest</a></li>
234                                     [% ELSE %]
235                                         <li><a href="/cgi-bin/koha/catalogue/search.pl?sort_by=pubdate_dsc[% PROCESS sort_search_query %]">Publication/Copyright date: newest to oldest</a></li>
236                                     [% END %]
237
238                                     [% IF ( sort_by == "pubdate_asc" ) %]
239                                         <li><a href="/cgi-bin/koha/catalogue/search.pl?sort_by=pubdate_asc[% PROCESS sort_search_query %]"><i class="fa fa-check"></i> Publication/Copyright date: oldest to newest</a></li>
240                                     [% ELSE %]
241                                         <li><a href="/cgi-bin/koha/catalogue/search.pl?sort_by=pubdate_asc[% PROCESS sort_search_query %]">Publication/Copyright date: oldest to newest</a></li>
242                                     [% END %]
243
244                                     [% IF ( sort_by == "acqdate_dsc" ) %]
245                                         <li><a href="/cgi-bin/koha/catalogue/search.pl?sort_by=acqdate_dsc[% PROCESS sort_search_query %]"><i class="fa fa-check"></i> Acquisition date: newest to oldest</a></li>
246                                     [% ELSE %]
247                                         <li><a href="/cgi-bin/koha/catalogue/search.pl?sort_by=acqdate_dsc[% PROCESS sort_search_query %]">Acquisition date: newest to oldest</a></li>
248                                     [% END %]
249
250                                     [% IF ( sort_by == "acqdate_asc" ) %]
251                                         <li><a href="/cgi-bin/koha/catalogue/search.pl?sort_by=acqdate_asc[% PROCESS sort_search_query %]"><i class="fa fa-check"></i> Acquisition date: oldest to newest</a></li>
252                                     [% ELSE %]
253                                         <li><a href="/cgi-bin/koha/catalogue/search.pl?sort_by=acqdate_asc[% PROCESS sort_search_query %]">Acquisition date: oldest to newest</a></li>
254                                     [% END %]
255
256                                     <li class="dropdown-header">Title</li>
257                                     [% IF ( sort_by == "title_az" || sort_by == "title_asc" ) %]
258                                         <li><a href="/cgi-bin/koha/catalogue/search.pl?sort_by=title_az[% PROCESS sort_search_query %]"><i class="fa fa-check"></i> Title (A-Z)</a></li>
259                                     [% ELSE %]
260                                         <li><a href="/cgi-bin/koha/catalogue/search.pl?sort_by=title_az[% PROCESS sort_search_query %]">Title (A-Z)</a></li>
261                                     [% END %]
262
263                                     [% IF ( sort_by == "title_za" || sort_by == "title_dsc" ) %]
264                                         <li><a href="/cgi-bin/koha/catalogue/search.pl?sort_by=title_za[% PROCESS sort_search_query %]"><i class="fa fa-check"></i> Title (Z-A)</a></li>
265                                     [% ELSE %]
266                                         <li><a href="/cgi-bin/koha/catalogue/search.pl?sort_by=title_za[% PROCESS sort_search_query %]">Title (Z-A)</a></li>
267                                     [% END %]
268                                 </ul>
269                             </div> <!-- /.btn-group -->
270                         </div> <!-- /#selection_ops -->
271                     </div> <!-- /#searchheader -->
272
273                 [% ELSE # /IF total %]
274
275                     <div id="searchheader">
276                         <form method="post" name="fz3950" class="fz3950bigrpad">
277                             <button class="btn btn-default" type="button" id="z3950submit"><i class="fa fa-search"></i> Z39.50/SRU search</button>
278                         </form>
279                         <h3>No results found</h3>
280                         [% IF ( searchdesc ) %]
281                             <p>
282                                 No results match your search [% IF ( query_desc ) %]for <span style="font-weight: bold;">'[% query_desc | html %]'</span>[% END %][% IF ( limit_desc ) %]&nbsp;with limit(s): <span style="font-weight: bold;">'[% limit_desc | html %]'</span>[% END %][% IF ( LibraryName ) %] in [% LibraryName | html %] Catalog[% END %].
283                             </p>
284                         [% ELSE %]
285                             <p>You did not specify any search criteria.</p>
286                         [% END %]
287                     </div>
288                 [% END # /IF total %]
289
290                 [% IF ( query_error ) %]
291                     <div class="dialog alert"><p><strong>Error:</strong> [% query_error | html %]</p></div>
292                 [% END %]
293
294                 <!-- Search Results Table -->
295                 [% IF ( total ) %]
296                     [% IF ( scan ) %]
297                         <h1>Scan index:</h1>
298                         <form action="/cgi-bin/koha/catalogue/search.pl" method="get">
299                             <table>
300                                 <tr>
301                                     <td>
302                                         [% IF ( scan_search_term_to_use ) %]
303                                             Scan Index for: <input type="text" name="q" id="scan-index" size="35" value="[% scan_search_term_to_use | html %]" />
304                                         [% ELSE %]
305                                             Scan Index for: <input type="text" name="q" id="scan-index" size="35" value="" />
306                                         [% END %]
307                                     </td>
308                                 </tr>
309                                 <tr>
310                                     <td>
311                                         <label for="scan-index">Indexed in:</label>
312                                         <select name="idx" id="scan-index">
313                                             <option value="">Any word</option>
314                                             [% IF ( ms_anycommaphr) %]<option selected="selected" value="any,phr">Any phrase</option>
315                                             [% ELSE %]<option value="any,phr">Any phrase</option>[% END %]
316                                             [% IF ( ms_ti ) %]<option selected="selected" value="ti">Title</option>
317                                             [% ELSE %]<option value="ti">Title</option>[% END %]
318                                             [% IF ( ms_ticommaphr ) %]<option selected="selected" value="ti,phr">Title phrase</option>
319                                             [% ELSE %]<option value="ti,phr">Title phrase</option>[% END %]
320                                             [% IF ( ms_au || ms_aucommaphr ) %]<option selected="selected" value="au,phr">Author</option>
321                                             [% ELSE %]<option value="au,phr">Author</option>[% END %]
322                                             [% IF ( ms_su ) %]<option selected="selected" value="su">Subject</option>
323                                             [% ELSE %]<option value="su">Subject</option>[% END %]
324                                             [% IF ( ms_sucommaphr ) %]<option selected="selected" value="su,phr">Subject phrase</option>
325                                             [% ELSE %]<option value="su,phr">Subject phrase</option>[% END %]
326                                             [% IF ( ms_se ) %]<option selected="selected" value="se">Series</option>
327                                             [% ELSE %]<option value="su">Series</option>[% END %]
328                                             [% IF ( ms_pb ) %]<option selected="selected" value="pb">Publisher</option>
329                                             [% ELSE %]<option value="pb">Publisher</option>[% END %]
330                                             [% IF ( ms_nt ) %]<option selected="selected" value="nt">Notes</option>
331                                             [% ELSE %]<option value="nt">Notes</option>[% END %]
332                                             [% IF ( ms_sn ) %]<option selected="selected" value="sn">ISBN</option>
333                                             [% ELSE %]<option value="sn">ISBN</option>[% END %]
334                                             [% IF ( ms_ss ) %]<option selected="selected" value="ss">ISSN</option>
335                                             [% ELSE %]<option value="ss">ISSN</option>[% END %]
336                                         </select>
337                                         <input type="hidden" name="scan" value="1" />
338                                         <input class="submit" type="submit" value="Submit" />
339                                     </td>
340                                 </tr>
341                             </table>
342                         </form>
343
344                         <form action="/cgi-bin/koha/catalogue/search.pl" method="get">
345                             <table>
346                                 <tr>
347                                     <th>Term/Phrase</th>
348                                     <th>Count</th>
349                                 </tr>
350                                 [% FOREACH SEARCH_RESULT IN SEARCH_RESULTS %]
351                                     <tr>
352                                         <td>
353                                             <a href="/cgi-bin/koha/catalogue/search.pl?idx=[% scan_index_to_use | uri %]&amp;q=[% SEARCH_RESULT.scan_use |url %]&quot;[% SEARCH_RESULT.title | uri %]&quot;">[% SEARCH_RESULT.title | html %]</a>
354                                         </td>
355                                         <td>
356                                             [% SEARCH_RESULT.author | html %]
357                                         </td>
358                                     </tr>
359                                 [% END %]
360                             </table>
361                         </form>
362                     [% ELSE # /IF scan %]
363
364                         <div id="searchresults">
365                             [% INCLUDE 'page-numbers.inc' %]
366
367                             <form action="/cgi-bin/koha/catalogue/search.pl" method="get" name="bookbag_form" id="bookbag_form">
368                                 [% IF ( searchdesc ) %]
369                                     [% FOREACH QUERY_INPUT IN QUERY_INPUTS %]
370                                         <input type="hidden" name="[% QUERY_INPUT.input_name | html %]" value="[% QUERY_INPUT.input_value | html %]"/>
371                                     [% END %]
372                                     [% FOREACH LIMIT_INPUT IN LIMIT_INPUTS %]
373                                         <input type="hidden" name="[% LIMIT_INPUT.input_name | html %]" value="[% LIMIT_INPUT.input_value | html %]"/>
374                                     [% END %]
375                                 [% END %]
376
377                                 <!-- TABLE RESULTS START -->
378                                 <table>
379                                     <tr>
380                                         [% IF ( AmazonCoverImages  || LocalCoverImages || AdlibrisEnabled || (Koha.Preference('CustomCoverImages') && Koha.Preference('CustomCoverImagesURL')) ) %]
381                                             <th>&nbsp;</th>
382                                         [% END %]
383                                         <th colspan="2">Results</th>
384                                         <th>Location</th>
385                                     </tr>
386                                     <!-- Actual Search Results -->
387                                     [% SET MaxSearchResultsItemsPerRecordStatusCheck = Koha.Preference('MaxSearchResultsItemsPerRecordStatusCheck') %]
388                                     [% FOREACH SEARCH_RESULT IN SEARCH_RESULTS %]
389                                         <tr>
390                                             [% IF ( AmazonCoverImages  || LocalCoverImages || AdlibrisEnabled || IntranetCoce || (Koha.Preference('CustomCoverImages') && Koha.Preference('CustomCoverImagesURL')) ) %]
391                                                 <td>
392                                                     [% IF ( LocalCoverImages) %]
393                                                         <a class="p1" href="/cgi-bin/koha/catalogue/[% DetailPage | html %]?biblionumber=[% SEARCH_RESULT.biblionumber |url %]">
394                                                             <span title="[% SEARCH_RESULT.biblionumber |url %]" class="[% SEARCH_RESULT.biblionumber | html %]" id="local-thumbnail[% loop.count | html %]"></span>
395                                                         </a>
396                                                     [% END %]
397                                                     [% IF ( AdlibrisEnabled && SEARCH_RESULT.normalized_isbn ) %]
398                                                         <a href="[% AdlibrisURL | url %]?isbn=[% SEARCH_RESULT.normalized_isbn | uri %]"><img src="[% AdlibrisURL | url %]?isbn=[% SEARCH_RESULT.normalized_isbn | uri %]" class="adlibris-cover" alt="Adlibris cover image" /></a>
399                                                     [% END %]
400                                                     [% IF ( AmazonCoverImages ) %]
401                                                         [% IF ( SEARCH_RESULT.normalized_isbn ) %]
402                                                             <a class="p1" href="/cgi-bin/koha/catalogue/[% DetailPage | html %]?biblionumber=[% SEARCH_RESULT.biblionumber |url %]">
403                                                             <img src="https://images-na.ssl-images-amazon.com/images/P/[% SEARCH_RESULT.normalized_isbn | html %].01.TZZZZZZZ.jpg" alt="" class="thumbnail" />
404                                                         [% ELSIF ( !LocalCoverImages ) %]
405                                                             <a class="p1" href="/cgi-bin/koha/catalogue/[% DetailPage | html %]?biblionumber=[% SEARCH_RESULT.biblionumber |url %]">
406                                                             <span class="no-image">No cover image available</span>
407                                                         [% END %]
408                                                         </a>
409                                                     [% END # /IF AmazonCoverImages %]
410                                                     [% IF ( IntranetCoce && CoceProviders ) %]
411                                                         [% coce_id = SEARCH_RESULT.normalized_ean || SEARCH_RESULT.normalized_isbn %]
412                                                             <a class="p1" href="/cgi-bin/koha/catalogue/[% DetailPage | html %]?biblionumber=[% SEARCH_RESULT.biblionumber | url %]">
413                                                         [% IF ( coce_id ) %]
414                                                             <span style="block" title="[% SEARCH_RESULT.biblionumber | url %]" class="[% coce_id | html %]" id="coce-thumbnail[% loop.count | html %]"></span>
415                                                         [% ELSE %]
416                                                             <span class="no-image">No cover image available</span>
417                                                         [% END %]
418                                                             </a>
419                                                     [% END %]
420
421                                                     [% IF Koha.Preference('CustomCoverImages') && Koha.Preference('CustomCoverImagesURL') %]
422                                                         <a class="custom_cover_image" href="[% SEARCH_RESULT.biblio_object.custom_cover_image_url | url %]"><img alt="Cover image" src="[% SEARCH_RESULT.biblio_object.custom_cover_image_url | url %]" />
423                                                     [% END %]
424                                                 </td>
425                                             [% END # /IF( AmazonCoverImages || LocalCoverImages || AdlibrisEnabled || IntranetCoce )%]
426
427                                             <td>
428                                                 <input type="checkbox" class="selection" id="bib[% SEARCH_RESULT.biblionumber | html %]" name="biblionumber" value="[% SEARCH_RESULT.biblionumber | html %]" style="display:none" />
429                                             </td>
430
431                                             <td>
432                                                 [% UNLESS ( item_level_itypes ) %]
433                                                     <div class="result-biblio-itemtype">
434                                                         [% IF !noItemTypeImages && SEARCH_RESULT.imageurl %]
435                                                             <img src="[% SEARCH_RESULT.imageurl | html %]" alt="[%  SEARCH_RESULT.description | html %]" />
436                                                         [% END %]
437                                                         [% SEARCH_RESULT.description | html %]
438                                                     </div>
439                                                 [% END %]
440
441                                                 [% SEARCH_RESULT.result_number | html %].
442                                                 [% SEARCH_RESULT.XSLTResultsRecord | $raw %]
443
444                                                 <p class="hold">
445                                                     [% IF ( SEARCH_RESULT.norequests ) %]
446                                                         <span class="noholdstext">No holds allowed</span>
447                                                     [% ELSE %]
448                                                         [% IF CAN_user_reserveforothers_place_holds %]
449                                                             <a id="reserve_[% SEARCH_RESULT.biblionumber | html %]" href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% SEARCH_RESULT.biblionumber | html %]">Holds ([% Biblio.HoldsCount( SEARCH_RESULT.biblionumber ) | html %])</a>
450                                                             [% IF ( holdfor ) %] <span class="holdforlink">| <a href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% SEARCH_RESULT.biblionumber | uri %]&amp;findborrower=[% holdfor_cardnumber | uri %]">Place hold for [% holdfor_firstname | html %] [% holdfor_surname | html %] ([% holdfor_cardnumber | html %])</a></span>[% END %]
451                                                             [% IF ( holdforclub ) %] <span class="holdforlink">| <a href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% SEARCH_RESULT.biblionumber | uri %]&amp;club=[% holdforclub | uri %]">Place hold for [% holdforclub_name | html %]</a></span>[% END %]
452                                                         [% ELSE %]
453                                                             Holds ([% Biblio.HoldsCount( SEARCH_RESULT.biblionumber ) | html %])
454                                                         [% END %]
455                                                     [% END # /IF SEARCH_RESULT.norequests %]
456
457                                                     [% IF Koha.Preference('intranetbookbag') == 1 %]
458                                                         [% IF ( SEARCH_RESULT.incart ) %]
459                                                             | <a class="addtocart" id="cart[% SEARCH_RESULT.biblionumber | html %]" href="#">In your cart</a> <a class="cartRemove" id="cartR[% SEARCH_RESULT.biblionumber | html %]" href="#">(remove)</a>
460                                                         [% ELSE %]
461                                                             | <a class="addtocart" id="cart[% SEARCH_RESULT.biblionumber | html %]" href="#">Add to cart</a> <a style="display:none;" class="cartRemove" id="cartR[% SEARCH_RESULT.biblionumber | html %]" href="#">(remove)</a>
462                                                         [% END %]
463                                                     [% END # / IF intranetbookbag %]
464
465                                                     [% IF Koha.Preference('ArticleRequests') %]
466                                                         | <a id="requst_article_[% SEARCH_RESULT.biblionumber | html %]" href="/cgi-bin/koha/circ/request-article.pl?biblionumber=[% SEARCH_RESULT.biblionumber | html %]">Request article</a>
467                                                     [% END %]
468
469                                                     [% IF ( CAN_user_editcatalogue_edit_catalogue ) %]
470                                                         | <a href="/cgi-bin/koha/cataloguing/addbiblio.pl?biblionumber=[% SEARCH_RESULT.biblionumber | uri %]">Edit record</a>
471                                                     [% END %]
472                                                     [% IF ( CAN_user_editcatalogue_edit_items ) %]
473                                                         | <a href="/cgi-bin/koha/cataloguing/additem.pl?biblionumber=[% SEARCH_RESULT.biblionumber | uri %]">Edit items</a>
474                                                     [% END %]
475
476                                                     [% IF ( OPACBaseURL ) %]
477                                                         <span class="view-in-opac">
478                                                             | <a href="[% Koha.Preference('OPACBaseURL') | url %]/cgi-bin/koha/opac-detail.pl?biblionumber=[% SEARCH_RESULT.biblionumber | uri %]" target="_blank">OPAC view</a>
479                                                         </span>
480                                                     [% END %]
481                                                 </p> <!-- /.holds -->
482                                             </td>
483
484                                             <td>
485                                                 <div class="availability">
486                                                     [% IF ( SEARCH_RESULT.items_count ) %]
487                                                         <strong>
488                                                             [% IF MaxSearchResultsItemsPerRecordStatusCheck && SEARCH_RESULT.items_count > MaxSearchResultsItemsPerRecordStatusCheck %]
489                                                                 <span class="blocker inaccurate-item-statuses" title="Item statuses may be inaccurate. Please view the record details for accurate item statuses">
490                                                             [% END %]
491
492                                                             [% tnx('{count} item', '{count} items', SEARCH_RESULT.items_count, {count = SEARCH_RESULT.items_count}) | html %][% IF ( SEARCH_RESULT.availablecount ) %], [% SEARCH_RESULT.availablecount | html %] available:[% ELSE %], None available[% END %]
493
494                                                             [% IF MaxSearchResultsItemsPerRecordStatusCheck && SEARCH_RESULT.items_count > MaxSearchResultsItemsPerRecordStatusCheck %]
495                                                                 </span>
496                                                             [% END %]
497                                                         </strong>
498
499                                                         [% IF ( SEARCH_RESULT.availablecount ) %]
500                                                             <ul>
501                                                                 [% FOREACH available_items_loo IN SEARCH_RESULT.available_items_loop %]
502                                                                     [% IF item_level_itypes && !noItemTypeImages && available_items_loo.imageurl %]
503                                                                         <li style="list-style: none; list-style-type: none;">
504                                                                             <img src="[% available_items_loo.imageurl | html %]" title="[% available_items_loo.description | html %]" alt="[% available_items_loo.description | html %]" />
505                                                                     [% ELSE %]
506                                                                         <li>
507                                                                     [% END %]
508                                                                     [% IF ( available_items_loo.branchname ) %]
509                                                                         [% available_items_loo.branchname | html %]
510                                                                     [% END %]
511                                                                     [% IF ( available_items_loo.location ) %]
512                                                                         <span class="shelvingloc">[% available_items_loo.location | html %]</span>
513                                                                     [% END %]
514                                                                     [% IF ( available_items_loo.itemcallnumber ) %]
515                                                                         [<a href="/cgi-bin/koha/catalogue/search.pl?idx=callnum&amp;q=%22[% available_items_loo.itemcallnumber |uri %]%22">[% available_items_loo.itemcallnumber | html %]</a>]
516                                                                     [% END %]
517                                                                     ([% available_items_loo.count | html %])
518                                                                     [% IF item_level_itypes && available_items_loo.description %]
519                                                                         <br/>[% available_items_loo.description | html %]
520                                                                     [% END %]
521                                                                     </li>
522                                                                 [% END # /FOREACH available_items_loo %]
523                                                             </ul>
524                                                         [% END # /IF SEARCH_RESULT.availablecount %]
525
526                                                         [% IF ( SEARCH_RESULT.onloancount ) %]
527                                                             <span class="status">[% SEARCH_RESULT.onloancount | html %] on loan:</span>
528                                                             <ul>
529                                                                 [% FOREACH onloan_items_loo IN SEARCH_RESULT.onloan_items_loop %]
530                                                                     [% IF item_level_itypes && !noItemTypeImages && onloan_items_loo.imageurl %]
531                                                                         <li style="list-style: none; list-style-type: none;">
532                                                                             <img src="[% onloan_items_loo.imageurl | html %]" title="[% onloan_items_loo.description | html %]" alt="[% onloan_items_loo.description | html %]" />
533                                                                     [% ELSE %]
534                                                                         <li>
535                                                                     [% END %]
536                                                                     [% IF ( onloan_items_loo.branchname ) %]
537                                                                         [% onloan_items_loo.branchname | html %]
538                                                                     [% END %]
539                                                                     [% IF ( onloan_items_loo.location ) %]
540                                                                         <span class="shelvingloc">[% onloan_items_loo.location | html %]</span>
541                                                                     [% END %]
542                                                                     [% IF ( onloan_items_loo.itemcallnumber ) %]
543                                                                         [<a href="/cgi-bin/koha/catalogue/search.pl?idx=callnum&amp;q=%22[% onloan_items_loo.itemcallnumber |uri %]%22">[% onloan_items_loo.itemcallnumber | html %]</a>]
544                                                                     [% END %]
545                                                                     ([% onloan_items_loo.count | html %][% IF ( onloan_items_loo.longoverdue ) %], [% onloan_items_loo.longoverdue | html %] long overdue[% END %]) date due: [% onloan_items_loo.due_date | $KohaDates %]
546                                                                     [% IF item_level_itypes && onloan_items_loo.description %]
547                                                                     <br/>[% onloan_items_loo.description | html %]
548                                                                 [% END %]
549                                                                 </li>
550                                                                 [% END # /FOREACH onloan_items_loo %]
551                                                             </ul>
552                                                         [% END # IF SEARCH_RESULT.onloancount %]
553
554                                                         [% IF ( SEARCH_RESULT.othercount ) %]
555                                                             <span class="unavailable">[% SEARCH_RESULT.othercount | html %] unavailable:</span>
556                                                             <ul>
557                                                                 [% FOREACH other_items_loo IN SEARCH_RESULT.other_items_loop %]
558                                                                     [% IF item_level_itypes && !noItemTypeImages && other_items_loo.imageurl %]
559                                                                         <li style="list-style: none; list-style-type: none;">
560                                                                             <img src="[% other_items_loo.imageurl | html %]" title="[% other_items_loo.description | html %]" alt="[% other_items_loo.description | html %]" />
561                                                                     [% ELSE %]
562                                                                         <li>
563                                                                     [% END %]
564                                                                     [% IF ( other_items_loo.branchname ) %]
565                                                                         [% other_items_loo.branchname | html %]
566                                                                     [% END %]
567                                                                     [% IF ( other_items_loo.location ) %]
568                                                                         <span class="shelvingloc">[% other_items_loo.location | html %]</span>
569                                                                     [% END %]
570                                                                     [% IF ( other_items_loo.itemcallnumber ) %]
571                                                                         [<a href="/cgi-bin/koha/catalogue/search.pl?idx=callnum&amp;q=%22[% other_items_loo.itemcallnumber |uri %]%22">[% other_items_loo.itemcallnumber | html %]</a>]
572                                                                     [% END %]
573                                                                     [% IF ( other_items_loo.withdrawn ) %]
574                                                                         ([% AuthorisedValues.GetByCode( 'WITHDRAWN', other_items_loo.withdrawn ) | html %])
575                                                                     [% END %]
576                                                                     [% IF ( other_items_loo.itemlost ) %]
577                                                                         ([% AuthorisedValues.GetByCode( 'LOST', other_items_loo.itemlost ) | html %])
578                                                                     [% END %]
579                                                                     [% IF ( other_items_loo.damaged ) %]
580                                                                         ([% AuthorisedValues.GetByCode( 'DAMAGED', other_items_loo.damaged ) | html %])
581                                                                     [% END %]
582                                                                     [% IF ( other_items_loo.intransit ) %]
583                                                                         (In transit)
584                                                                     [% END %]
585                                                                     [% IF ( other_items_loo.onhold ) %]
586                                                                         (On hold)
587                                                                     [% END %]
588                                                                     [% IF ( other_items_loo.notforloan ) %]
589                                                                         [% other_items_loo.notforloan | html %]
590                                                                     [% END %]
591                                                                     ([% other_items_loo.count | html %])
592                                                                     [% IF item_level_itypes && other_items_loo.description %]
593                                                                         <br/>[% other_items_loo.description | html %]
594                                                                     [% END %]
595                                                                     </li>
596                                                                 [% END # /FOREACH other_items_loo %]
597                                                             </ul>
598                                                         [% END # /IF SEARCH_RESULT.othercount %]
599
600                                                     [% ELSE # /IF ( SEARCH_RESULT.items_count ) %]
601
602                                                         [% IF ( SEARCH_RESULT.ALTERNATEHOLDINGS.count ) %]
603                                                             <strong id="altholdings_heading">Other holdings:</strong>
604                                                             <ul>
605                                                                 [% FOREACH ALTERNATEHOLDING IN SEARCH_RESULT.ALTERNATEHOLDINGS %]
606                                                                     <li id="alternateholdings">[% ALTERNATEHOLDING.holding | html %]</li>
607                                                                 [% END %]
608                                                             </ul>
609                                                         [% ELSE %]
610                                                             <span class="unavailable">No items</span>
611                                                         [% END %]
612                                                     [% END # /IF ( SEARCH_RESULT.items_count ) %]
613                                                 </div> <!-- /.availability -->
614                                             </td>
615                                         </tr>
616                                     [% END # /FOREACH SEARCH_RESULT %]
617                                 </table>
618                             </form>
619                         </div> <!-- /#bookbag_form -->
620                     [% END # /IF scan %]
621                     [% INCLUDE 'page-numbers.inc' %]
622                 [% ELSE #/IF total %]
623                     <!-- No Results Found -->
624                 [% END #/IF total %]
625
626                 [% IF ( outer_sup_results_loop ) %]
627                     </div>
628                     <div class="col-sm-4">
629                         [% FOREACH outer_sup_results_loo IN outer_sup_results_loop %]
630                             [% IF ( outer_sup_results_loo.inner_sup_results_loop ) %]
631                                 [% outer_sup_results_loo.servername | html %]
632                                 [% FOREACH inner_sup_results_loo IN outer_sup_results_loo.inner_sup_results_loop %]
633                                     <div>
634                                         <a href="/cgi-bin/koha/catalogue/search.pl?[% inner_sup_results_loo.query_cgi | $raw %][% inner_sup_results_loo.limit_cgi | $raw %][% inner_sup_results_loo.sort_by | uri %][% inner_sup_results_loo.link | uri %]">[% inner_sup_results_loo.title | html %]</a>
635                                     </div>
636                                 [% END %]
637                             [% END %]
638                         [% END # FOREACH outer_sup_results_loo %]
639                     </div> <!-- /.col-sm-4 -->
640                 </div>
641                 [% END #/IF outer_sup_results_loop %]
642
643                 <form id="hold_form" method="get" action="/cgi-bin/koha/reserve/request.pl">
644                     <!-- Value will be set here by placeHold() -->
645                     <input id="hold_form_biblios" type="hidden" name="biblionumbers" value="" />
646                     <input type="hidden" name="findborrower" id="holdFor" value="" />
647                     <input type="hidden" name="club" id="holdForClub" value="" />
648                     <input type="hidden" name="multi_hold" value="1"/>
649                 </form>
650
651                 <form id="list_form" method="get" action="/cgi-bin/koha/reserve/request.pl">
652                     <!-- Value will be set here by addToList() -->
653                     <input id="list_form_biblios" type="hidden" name="biblionumbers" value="" />
654                     <input type="hidden" name="multi_listadd" value="1"/>
655                 </form>
656
657             </main>
658         </div> <!-- /.col-sm-10.col-sm-push-2 -->
659
660         <div class="col-sm-2 col-sm-pull-10">
661             <aside>
662                 [% INCLUDE 'facets.inc' %]
663             </aside>
664         </div> <!-- /.col-sm-2.col-sm-pull-10 -->
665      </div> <!-- /.row -->
666
667 [% MACRO jsinclude BLOCK %]
668     [% INCLUDE 'browser-strings.inc' %]
669     [% Asset.js("js/browser.js") | $raw %]
670     [% Asset.js("lib/hc-sticky.js") | $raw %]
671     [% Asset.js("lib/jquery/plugins/jquery.checkboxes.min.js") | $raw %]
672     [% Asset.js("js/coce.js") | $raw %]
673     <script>
674         var MSG_NO_ITEM_SELECTED = _("Nothing is selected.");
675         var MSG_NON_RESERVES_SELECTED = _("One or more selected items cannot be placed on hold.");
676         var q_array = new Array();  // will hold search terms, if present
677         [% IF ( AmazonCoverImages ) %]
678             // http://www.oreillynet.com/pub/a/javascript/2003/10/21/amazonhacks.html
679             function verify_images() {
680                 $("img").each(function(i){
681                     if ((this.src.indexOf('images-amazon.com') >= 0) || (this.src.indexOf('images.amazon.com') >=0)) {
682                         w = this.width;
683                         h = this.height;
684                         if ((w == 1) || (h == 1)) {
685                             $(this).parent().html('<span class="no-image">No cover image available</span>');
686                         } else if ((this.complete != null) && (!this.complete)) {
687                             $(this).parent().html('<span class="no-image">No cover image available</span>');
688                         }
689                     }
690                 });
691             }
692
693             $(window).load(function() {
694                 verify_images();
695             });
696         [% END %]
697         var Sticky;
698         $(document).ready(function() {
699
700             $(".moretoggle").click(function(e) {
701                 e.preventDefault();
702                 $(this).siblings(".collapsible-facet").toggle();
703                 $(this).siblings(".moretoggle").toggle();
704                 $(this).toggle();
705             });
706
707             Sticky = $("#searchheader");
708             Sticky.hcSticky({
709                 stickTo: "main",
710                 stickyClass: "floating"
711             });
712
713             $("#cartsubmit").click(function(e){
714                 e.preventDefault();
715                 addMultiple();
716             });
717
718             $(".addtolist").on("click",function(e){
719                 e.preventDefault();
720                 var shelfnumber = $(this).data("shelfnumber");
721                 var vshelf = vShelfAdd();
722                 if( vshelf ){
723                     if( $(this).hasClass("morelists") ){
724                         openWindow('/cgi-bin/koha/virtualshelves/addbybiblionumber.pl?' + vshelf);
725                     } else if( $(this).hasClass("newlist") ){
726                         openWindow('/cgi-bin/koha/virtualshelves/addbybiblionumber.pl?newshelf=1&' + vshelf);
727                     } else {
728                         openWindow('/cgi-bin/koha/virtualshelves/addbybiblionumber.pl?shelfnumber='+shelfnumber+'&confirm=1&' + vshelf);
729                     }
730                 }
731             });
732
733             $("#z3950submit").click(function(){
734                 PopupZ3950();
735                 return false;
736             });
737
738             $("#searchheader").on("click", ".browse_selection", function(){
739                 browse_selection();
740                 return false;
741             });
742
743             $("#searchheader").on("click",".placehold", function(){
744                 $("#holdFor").val("");
745                 $("#holdForClub").val("");
746                 placeHold();
747                 $(".btn-group").removeClass("open");
748                 return false;
749             });
750
751             $(".placeholdfor").click(function(){
752                 holdForPatron();
753                 $(".btn-group").removeClass("open");
754                 return false;
755             });
756
757             $(".placeholdforclub").click(function(){
758                 holdForClub();
759                 $(".btn-group").removeClass("open");
760                 return false;
761             });
762
763             $("#forgetholdfor, #forgetholdforclub").click(function(){
764                 forgetPatronAndClub();
765                 $(".btn-group").removeClass("open");
766                 return false;
767             });
768
769             $("#tagsel_span").html("<input id=\"tagsel_tag\" class=\"submit\" type=\"submit\" value=\"Tag\"/>");
770
771             $(".selection").show();
772
773             [% IF ( query_desc ) %]
774                 toHighlight = $("p,span.results_summary,a.title");
775                 var query_desc = "[% query_desc |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') | html %]";
776                 q_array = query_desc.split(" ");
777                 // ensure that we don't have "" at the end of the array, which can
778                 // break the highlighter
779                 while (q_array.length > 0 && q_array[q_array.length-1] == "") {
780                     q_array = q_array.splice(0,-1);
781                 }
782                 highlightOn();
783                 $("#highlight_toggle_on" ).hide().click(function(e) {
784                     e.preventDefault();
785                      highlightOn();
786                 });
787                 $("#highlight_toggle_off").show().click(function(e) {
788                     e.preventDefault();
789                     highlightOff();
790                 });
791             [% END %]
792
793             [% IF (SEARCH_RESULTS) %]
794                 var newresults = [
795                     [%- FOREACH result IN SEARCH_RESULTS -%]
796                         [%- result.biblionumber | html %],
797                     [%- END -%]
798                 ];
799                 var browser = KOHA.browser('[% searchid | html %]', parseInt('[% biblionumber | html %]', 10));
800                 browser.create([% SEARCH_RESULTS.first.result_number | html %], '[% query_cgi | html %]', '[% limit_cgi | html %]','[% sort_cgi | html %]',
801                        newresults, '[% total | html %]');
802             [% END %]
803
804             [% IF (gotoPage && gotoNumber) %]
805                 [% IF (gotoNumber == 'first') %]
806                     window.location = '/cgi-bin/koha/catalogue/[% gotoPage | html %]?biblionumber=' + [% SEARCH_RESULTS.first.biblionumber | html %] + '&searchid=[% searchid | html %]';
807                 [% ELSIF (gotoNumber == 'last') %]
808                     window.location = '/cgi-bin/koha/catalogue/[% gotoPage | html %]?biblionumber=' + [% SEARCH_RESULTS.last.biblionumber | html %] + '&searchid=[% searchid | html %]';
809                 [% END %]
810             [% END %]
811
812             [% IF LocalCoverImages %]
813                 KOHA.LocalCover.LoadResultsCovers();
814             [% END %]
815
816             [% IF ( IntranetCoce && CoceProviders ) %]
817                 KOHA.coce.getURL('[% CoceHost | html %]', '[% CoceProviders | html %]');
818             [% END %]
819
820             $("#select_all").on("click",function(e){
821                 e.preventDefault();
822                 selectAll();
823             });
824
825             $("#clear_all").on("click",function(e){
826                 e.preventDefault();
827                 clearAll();
828             });
829
830             $("#searchresults").on("click",".addtocart",function(e){
831                 e.preventDefault();
832                 var selection_id = this.id;
833                 var biblionumber = selection_id.replace("cart","");
834                 addRecord(biblionumber);
835             });
836
837             $("#searchresults").on("click",".cartRemove",function(e){
838                 e.preventDefault();
839                 var selection_id = this.id;
840                 var biblionumber = selection_id.replace("cartR","");
841                 delSingleRecord(biblionumber);
842             });
843
844             [% UNLESS Koha.Preference('BrowseResultSelection') %]
845                 resetSearchContext();
846             [% END %]
847             $(".selection").change(function(){
848                 if ( $(this).is(':checked') == true ) {
849                   addBibToContext( $(this).val() );
850                 } else {
851                   delBibToContext( $(this).val() );
852                 }
853             });
854             $("#bookbag_form").ready(function(){
855                 $("#bookbag_form").unCheckCheckboxes();
856                 var bibnums = getContextBiblioNumbers();
857                 if (bibnums) {
858                     for (var i=0; i < bibnums.length; i++) {
859                         var id = ('#bib' + bibnums[i]);
860                         if ($(id)) {
861                             $(id).attr('checked', true);
862                         }
863                     }
864                 }
865             });
866
867         });
868
869
870         [% IF ( query_desc ) %]
871             function highlightOff() {
872                 toHighlight.removeHighlight();
873                 $(".highlight_toggle").toggle();
874             }
875             function highlightOn() {
876                 var x;
877                 for (x in q_array) {
878                     q_array[x] = q_array[x].toLowerCase();
879                     var myStopwords = "[% Koha.Preference('NotHighlightedWords') | html %]".toLowerCase().split('|');
880                     if ( (q_array[x].length > 0) && ($.inArray(q_array[x], myStopwords) == -1) ) {
881                         toHighlight.highlight(q_array[x]);
882                     }
883                 }
884                 $(".highlight_toggle").toggle();
885             }
886         [% END %]
887
888         function selectAll () {
889             $("#bookbag_form").checkCheckboxes();
890             $("#bookbag_form").find("input[type='checkbox'][name='biblionumber']").each(function(){
891                 $(this).change();
892             } );
893             return false;
894         }
895         function clearAll () {
896             $("#bookbag_form").unCheckCheckboxes();
897             $("#bookbag_form").find("input[type='checkbox'][name='biblionumber']").each(function(){
898                 $(this).change();
899             } );
900             return false;
901         }
902         function placeHold () {
903             var checkedItems = $(".selection:checked");
904             if ($(checkedItems).size() == 0) {
905                 alert(MSG_NO_ITEM_SELECTED);
906                 return false;
907             }
908             var bibs = "";
909             var badBibs = false;
910             $(checkedItems).each(function() {
911                 var bib = $(this).val();
912                 if ($("#reserve_" + bib).size() == 0) {
913                     alert(MSG_NON_RESERVES_SELECTED);
914                     badBibs = true;
915                     return false;
916                 }
917                 bibs += bib + "/";
918             });
919             if (badBibs) {
920                 return false;
921             }
922             $("#hold_form_biblios").val(bibs);
923             $("#hold_form").submit();
924             return false;
925         }
926
927         function forgetPatronAndClub(){
928             $.removeCookie("holdfor", { path: '/' });
929             $.removeCookie("holdforclub", { path: '/' });
930             $(".holdforlink").remove();
931             $("#placeholdc").html("<a class=\"btn btn-default btn-xs placehold\" href=\"#\"><i class=\"fa fa-sticky-note-o\"></i> "+_("Place hold")+"</a>");
932         }
933
934         function browse_selection () {
935             var bibnums = getContextBiblioNumbers();
936             if ( bibnums && bibnums.length > 0 ) {
937                 var browser = KOHA.browser('', parseInt('[% biblionumber | html %]', 10));
938                 browser.create(1, '[% query_cgi | html %]', '[% limit_cgi | html %]','[% sort_cgi | html %]', bibnums, bibnums.length);
939                 window.location = '/cgi-bin/koha/catalogue/detail.pl?biblionumber=' + bibnums[0] + '&searchid='+browser.searchid;
940             } else {
941                 alert(MSG_NO_ITEM_SELECTED);
942             }
943             return false;
944         }
945
946         function addToList () {
947             var checkedItems = $(".selection:checked");
948             if ($(checkedItems).size() == 0) {
949                 alert(MSG_NO_ITEM_SELECTED);
950                 return false;
951             }
952             var bibs = "";
953             $(checkedItems).each(function() {
954                 bibs += $(this).val() + "/";
955             });
956
957             var url = "/cgi-bin/koha/virtualshelves/addbybiblionumber.pl?biblionumbers=" + bibs;
958             window.open(url, 'Add_to_virtualshelf', 'width=500, height=400, toolbar=false, scrollbars=yes');
959             return false;
960         }
961
962         /* this function open a popup to search on z3950 server.  */
963         function PopupZ3950() {
964             var strQuery = GetZ3950Terms();
965             if(strQuery){
966                 window.open("/cgi-bin/koha/cataloguing/z3950_search.pl?biblionumber=[% biblionumber | html %]"+strQuery,"z3950search",'width=740,height=450,location=yes,toolbar=no,scrollbars=yes,resize=yes');
967             }
968         }
969         /* provide Z3950 search points */
970         function GetZ3950Terms(){
971             var strQuery="&frameworkcode=";
972             [% FOREACH z3950_search_param IN z3950_search_params %]
973                 strQuery += "&" + "[% z3950_search_param.name |uri %]" + "=" + "[% z3950_search_param.value |uri %]";
974             [% END %]
975             return strQuery;
976         }
977
978         function holdfor(){
979             $("#holdFor").val("");
980             $("#holdForClub").val("");
981             placeHold();
982         }
983
984         function holdForPatron() {
985             $("#holdFor").val("[% holdfor_cardnumber | html %]");
986             placeHold();
987         }
988
989         function holdForClub() {
990             $("#holdForClub").val("[% holdforclub | html %]");
991             placeHold();
992         }
993     </script>
994 [% END %]
995
996 [% INCLUDE 'intranet-bottom.inc' %]