Bug 33569: Fix sort by relevance in catalog search
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / catalogue / results.tt
1 [% USE raw %]
2 [% USE To %]
3 [% USE Asset %]
4 [% USE Koha %]
5 [% USE Biblio %]
6 [% USE KohaDates %]
7 [% PROCESS 'i18n.inc' %]
8 [% SET footerjs = 1 %]
9 [% USE AuthorisedValues %]
10 [% INCLUDE 'doc-head-open.inc' %]
11
12 <title>[% 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 %] &rsaquo; Catalog &rsaquo; Koha</title>
13 [% INCLUDE 'doc-head-close.inc' %]
14 </head>
15
16 <body id="catalog_results" class="catalog">
17 [% WRAPPER 'header.inc' %]
18     [% INCLUDE 'cat-search.inc' %]
19 [% END %]
20
21 [% IntranetCoce    = Koha.Preference('IntranetCoce') %]
22 [% CoceProviders   = Koha.Preference('CoceProviders') %]
23 [% CoceHost        = Koha.Preference('CoceHost') %]
24 [% SyndeticsCovers = Koha.Preference('SyndeticsEnabled') && Koha.Preference('SyndeticsCoverImages') %]
25 [% SyndeticsCoverImageSize = Koha.Preference('SyndeticsCoverImageSize') %]
26
27 [% WRAPPER 'sub-header.inc' %]
28     [% WRAPPER breadcrumbs %]
29         [% WRAPPER breadcrumb_item %]
30             <a href="/cgi-bin/koha/catalogue/search.pl">Catalog</a>
31         [% END %]
32         [% WRAPPER breadcrumb_item bc_active= 1 %]
33             [% IF ( query_desc ) %]
34                 [% IF ( limit_desc ) %]
35                     <span>Search for '[% query_desc | html %]' with limit(s): '[% limit_desc | html %]'</span>
36                 [% ELSE %]
37                     <span>Search for '[% query_desc | html %]'</span>
38                 [% END %]
39             [% ELSE %]
40                 <span>Search</span>
41             [% END %]
42         [% END %]
43     [% END #/ WRAPPER breadcrumbs %]
44 [% END #/ WRAPPER sub-header.inc %]
45
46 <div class="main container-fluid">
47     <div class="row">
48         <div class="col-sm-10 col-sm-push-2">
49             <main>
50
51             <h1>Search results</h1>
52
53                 [% IF ( outer_sup_results_loop ) %]
54                     <div class="row">
55                         <div class="col-sm-8">
56                 [% END %]
57
58                 [% IF ( koha_spsuggest ) %]
59                     <div style="font-size: 12px;">Did you mean:
60                         <ul style="list-style: none;">
61                             [% FOREACH SPELL_SUGGES IN SPELL_SUGGEST %]
62                                 <li>
63                                     <a href="/cgi-bin/koha/catalogue/search.pl?q=[% SPELL_SUGGES.spsuggestion | uri %]">[% SPELL_SUGGES.spsuggestion | html %]</a>
64                                 </li>
65                             [% END %]
66                         </ul>
67                     </div>
68                 [% END %]
69
70                 [% IF ( total ) %]
71
72                     <h3>
73                         [% 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 %].
74                     </h3>
75
76                 [% UNLESS scan %]
77                     <a href="/cgi-bin/koha/catalogue/search.pl?advsearch=1&edit_search=1&[% query_cgi | $raw %]&[% limit_cgi | $raw %]&sort_by=[% sort_by | $raw %]">Edit this search</a>
78                     [% IF ( Koha.Preference('SavedSearchFilters') && CAN_user_parameters_manage_search_filters ) %]
79                         | <a href="#" id="save_search_filter">Save search as filter</a>
80                     [% END %]
81
82                     <div id="search_within_results">
83                         <form id="refine_search">
84                             <label for="limit">Search within results</label>
85                             [% IF ( Koha.Preference('IntranetCatalogSearchPulldown') ) %]
86                                 [% INCLUDE 'search_indexes.inc' ms_kw = 1 refiner = 1 %]
87                             [% END %]
88                             <input name="limit" id="refiner" type="text"  title="Search results">
89                             <input type="submit" id="refine" class="btn btn-primary btn-xs" value="Search" />
90                         </form>
91                     </div>
92
93                     <div class="searchheader" id="searchheader">
94                         <div id="selection_ops">
95                             <a href="#" class="btn btn-link" id="select_all"><i class="fa fa-check"></i> Select all</a>
96                             <a href="#" class="btn btn-link" id="clear_all"><i class="fa fa-remove"></i> Clear all</a>
97                             |
98                             [% IF Koha.Preference("StaffHighlightedWords") == 1 %]
99                                 <a href="#" class="highlight_toggle" id="highlight_toggle_off">Unhighlight</a>
100                                 <a href="#" class="highlight_toggle" id="highlight_toggle_on">Highlight</a>
101                                 |
102                             [% END %]
103
104                             [% IF (Koha.Preference("intranetbookbag")) %]
105                                 <div class="btn-group">
106                                     <a id="cartsubmit" class="btn btn-default btn-xs" href="#"><i class="fa fa-shopping-cart"></i> Add to cart</a>
107                                 </div>
108                             [% END %]
109
110                             [% IF Koha.Preference('virtualshelves') %]
111                                 <div class="btn-group">
112                                     <button type="button" class="btn btn-default btn-xs dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
113                                         <i class="fa fa-list"></i> Add to list <span class="caret"></span>
114                                     </button>
115                                     <ul class="dropdown-menu">
116                                         [% IF add_to_some_private_shelves.count %]
117                                             <li class="dropdown-header">Your lists</li>
118                                             [% SET number_of_private_shelves = 0 %]
119                                             [% FOREACH s IN add_to_some_private_shelves %]
120                                                 [% IF shelfnumber != s.shelfnumber %]
121                                                     <li>
122                                                         <a href="#" class="addtolist" data-shelfnumber="[% s.shelfnumber | html %]">[% s.shelfname | html %]</a>
123                                                     </li>
124                                                     [% SET number_of_private_shelves = number_of_private_shelves + 1 %]
125                                                     [% IF number_of_private_shelves == 10 %][% LAST %][% END %]
126                                                 [% END %]
127                                             [% END %]
128                                         [% END %]
129                                         [% IF add_to_some_public_shelves.count %]
130                                             <li class="dropdown-header">Public lists</li>
131                                             [% SET number_of_public_shelves = 0 %]
132                                             [% FOREACH s IN add_to_some_public_shelves %]
133                                                 [% IF shelfnumber != s.shelfnumber %]
134                                                     <li>
135                                                         <a href="#" data-shelfnumber="[% s.shelfnumber | html %]" class="addtolist">[% s.shelfname | html %]</a>
136                                                     </li>
137                                                     [% SET number_of_public_shelves = number_of_public_shelves + 1 %]
138                                                     [% IF number_of_public_shelves == 10 %][% LAST %][% END %]
139                                                 [% END %]
140                                             [% END %]
141                                         [% END %]
142                                         <li role="separator" class="divider"></li>
143                                         [% IF add_to_some_private_shelves.count > 10 or add_to_some_public_shelves.count > 10 %]
144                                             <li>
145                                                 <a href="#" class="addtolist morelists">More lists</a>
146                                             </li>
147                                         [% END %]
148                                         <li>
149                                             <a href="#" class="addtolist newlist">New list</a>
150                                         </li>
151                                     </ul>
152                                 </div>
153                             [% END # /IF virtualshelves %]
154
155                             [% IF ( CAN_user_reserveforothers_place_holds && DisplayMultiPlaceHold ) %]
156                                 [% IF ( holdfor or holdforclub ) %]
157                                     <div id="placeholdc" class="btn-group">
158                                         <button class="btn btn-default btn-xs placehold"><i class="fa fa-sticky-note-o"></i> Place hold</button>
159                                         <button class="btn btn-default btn-xs dropdown-toggle" data-toggle="dropdown">
160                                         <span class="caret"></span>
161                                         </button>
162                                         <ul class="dropdown-menu">
163                                             <li><a href="#" class="placehold">Place hold</a></li>
164                                             [% IF holdfor %]
165                                             <li><a href="#" class="placeholdfor">Place hold for [% INCLUDE 'patron-title.inc' patron => holdfor_patron no_title => 1 no_cardnumber => 1 %]</a></li>
166                                                 <li class="divider"></li>
167                                                 <li><a href="#" id="forgetholdfor">Forget [% INCLUDE 'patron-title.inc' patron => holdfor_patron no_title => 1 no_cardnumber => 1 %]</a></li>
168                                             [% END %]
169                                             [% IF holdforclub %]
170                                                 <li><a href="#" class="placeholdforclub">Place hold for [% holdforclub_name | html %]</a></li>
171                                                 <li class="divider"></li>
172                                                 <li><a href="#" id="forgetholdforclub">Forget  [% holdforclub_name | html %]</a></li>
173                                             [% END %]
174                                         </ul>
175                                     </div>
176                                 [% ELSE %]
177                                     <div id="placeholdc" class="btn-group">
178                                         <a class="btn btn-default btn-xs placehold" href="#"><i class="fa fa-sticky-note-o"></i> Place hold</a>
179                                     </div>
180                                 [% END # /IF holfor %]
181                             [% END # /IF CAN_user_reserveforothers_place_holds %]
182
183                             [% IF Koha.Preference('BrowseResultSelection') %]
184                                 <div id="browse_selection" class="btn-group">
185                                     <a class="btn btn-default btn-xs browse_selection" href="#"><i class="fa fa-sticky-note-o"></i> Browse selected records</a>
186                                 </div>
187                             [% END %]
188
189                             [% IF ( CAN_user_editcatalogue_edit_catalogue ) %]
190                                 <div class="btn-group">
191                                     <a class="btn btn-default btn-xs" id="z3950submit" href="#"><i class="fa fa-search"></i> Z39.50/SRU search</a>
192                                 </div>
193                                 <div class="btn-group">
194                                     <button type="button" id="results_batch_ops" class="btn btn-default btn-xs dropdown-toggle disabled" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
195                                         <i class="fa fa-pencil"></i> Edit <span class="caret"></span>
196                                     </button>
197                                     [% IF ( CAN_user_tools_records_batchmod || CAN_user_tools_records_batchdel || CAN_user_editcatalogue_edit_catalogue ) %]
198                                     <ul class="dropdown-menu">
199                                         [% IF ( CAN_user_tools_records_batchmod ) %]
200                                         <li><a class="results_batch_op" data-op="edit" href="#">Batch edit records</a></li>
201                                         [% END %]
202                                         [% IF ( CAN_user_tools_records_batchdel ) %]
203                                         <li><a class="results_batch_op" data-op="delete" href="#">Batch delete records</a></li>
204                                         [% END %]
205                                         <li><a class="results_batch_op" data-op="merge" href="#">Merge records</a></li>
206                                     </ul>
207                                     [% END %]
208                                 </div>
209                             [% END %]
210
211                             [% IF ( searchdesc ) %]
212                                 [% BLOCK sort_search_query ~%]
213                                     [%~ FOREACH QUERY_INPUT IN QUERY_INPUTS ~%]
214                                         &amp;[% QUERY_INPUT.input_name | uri %]=[% QUERY_INPUT.input_value | uri %]
215                                     [%~ END ~%]
216                                     [%~ FOREACH LIMIT_INPUT IN LIMIT_INPUTS ~%]
217                                         &amp;[% LIMIT_INPUT.input_name | uri %]=[% LIMIT_INPUT.input_value | uri %]
218                                     [%~ END ~%]
219                                 [%~ END %]
220                             [% END %]
221
222                             <div class="btn-group">
223                                 <button type="button" class="btn btn-default btn-xs dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
224                                     Sort <span class="caret"></span>
225                                 </button>
226                                 <ul class="dropdown-menu">
227                                     [% IF ( sort_by == "relevance" ) %]
228                                         <li><a href="/cgi-bin/koha/catalogue/search.pl?count=[% results_per_page | uri %]&sort_by=relevance[% PROCESS sort_search_query %]"><i class="fa fa-check"></i> Relevance</a></li>
229                                     [% ELSE %]
230                                         <li><a href="/cgi-bin/koha/catalogue/search.pl?count=[% results_per_page | uri %]&sort_by=relevance[% PROCESS sort_search_query %]">Relevance</a></li>
231                                     [% END %]
232                                     <li class="dropdown-header">Popularity</li>
233                                     [% IF ( sort_by == "popularity_dsc" ) %]
234                                         <li><a href="/cgi-bin/koha/catalogue/search.pl?count=[% results_per_page | uri %]&sort_by=popularity_dsc[% PROCESS sort_search_query %]"><i class="fa fa-check"></i> Popularity (most to least)</a></li>
235                                     [% ELSE %]
236                                         <li><a href="/cgi-bin/koha/catalogue/search.pl?count=[% results_per_page | uri %]&sort_by=popularity_dsc[% PROCESS sort_search_query %]">Popularity (most to least)</a></li>
237                                     [% END %]
238
239                                     [% IF ( sort_by == "popularity_asc" ) %]
240                                         <li><a href="/cgi-bin/koha/catalogue/search.pl?count=[% results_per_page | uri %]&sort_by=popularity_asc[% PROCESS sort_search_query %]"><i class="fa fa-check"></i> Popularity (least to most)</a></li>
241                                     [% ELSE %]
242                                         <li><a href="/cgi-bin/koha/catalogue/search.pl?count=[% results_per_page | uri %]&sort_by=popularity_asc[% PROCESS sort_search_query %]">Popularity (least to most)</a></li>
243                                     [% END %]
244
245                                     <li class="dropdown-header">Author</li>
246
247                                     [% IF ( sort_by == "author_az" || sort_by == "author_asc" ) %]
248                                         <li><a href="/cgi-bin/koha/catalogue/search.pl?count=[% results_per_page | uri %]&sort_by=author_a[% PROCESS sort_search_query %]z"><i class="fa fa-check"></i> Author (A-Z)</a></li>
249                                     [% ELSE %]
250                                         <li><a href="/cgi-bin/koha/catalogue/search.pl?count=[% results_per_page | uri %]&sort_by=author_az[% PROCESS sort_search_query %]">Author (A-Z)</a></li>
251                                     [% END %]
252
253                                     [% IF ( sort_by == "author_za" || sort_by == "author_dsc" ) %]
254                                         <li><a href="/cgi-bin/koha/catalogue/search.pl?count=[% results_per_page | uri %]&sort_by=author_za[% PROCESS sort_search_query %]"><i class="fa fa-check"></i> Author (Z-A)</a></li>
255                                     [% ELSE %]
256                                         <li><a href="/cgi-bin/koha/catalogue/search.pl?count=[% results_per_page | uri %]&sort_by=author_za[% PROCESS sort_search_query %]">Author (Z-A)</a></li>
257                                     [% END %]
258
259                                     <li class="dropdown-header">Call number</li>
260
261                                     [% IF ( sort_by == "call_number_asc" ) %]
262                                         <li><a href="/cgi-bin/koha/catalogue/search.pl?count=[% results_per_page | uri %]&sort_by=call_number_asc[% PROCESS sort_search_query %]"><i class="fa fa-check"></i> Call number (0-9 to A-Z)</a></li>
263                                     [% ELSE %]
264                                         <li><a href="/cgi-bin/koha/catalogue/search.pl?count=[% results_per_page | uri %]&sort_by=call_number_asc[% PROCESS sort_search_query %]">Call number (0-9 to A-Z)</a></li>
265                                     [% END %]
266
267                                     [% IF ( sort_by == "call_number_dsc" ) %]
268                                         <li><a href="/cgi-bin/koha/catalogue/search.pl?count=[% results_per_page | uri %]&sort_by=call_number_dsc[% PROCESS sort_search_query %]"><i class="fa fa-check"></i> Call number (Z-A to 9-0)</a></li>
269                                     [% ELSE %]
270                                         <li><a href="/cgi-bin/koha/catalogue/search.pl?count=[% results_per_page | uri %]&sort_by=call_number_dsc[% PROCESS sort_search_query %]">Call number (Z-A to 9-0)</a></li>
271                                     [% END %]
272
273                                     <li class="dropdown-header">Dates</li>
274                                     [% IF ( sort_by == "pubdate_dsc" ) %]
275                                         <li><a href="/cgi-bin/koha/catalogue/search.pl?count=[% results_per_page | uri %]&sort_by=pubdate_dsc[% PROCESS sort_search_query %]"><i class="fa fa-check"></i> Publication/Copyright date: newest to oldest</a></li>
276                                     [% ELSE %]
277                                         <li><a href="/cgi-bin/koha/catalogue/search.pl?count=[% results_per_page | uri %]&sort_by=pubdate_dsc[% PROCESS sort_search_query %]">Publication/Copyright date: newest to oldest</a></li>
278                                     [% END %]
279
280                                     [% IF ( sort_by == "pubdate_asc" ) %]
281                                         <li><a href="/cgi-bin/koha/catalogue/search.pl?count=[% results_per_page | uri %]&sort_by=pubdate_asc[% PROCESS sort_search_query %]"><i class="fa fa-check"></i> Publication/Copyright date: oldest to newest</a></li>
282                                     [% ELSE %]
283                                         <li><a href="/cgi-bin/koha/catalogue/search.pl?count=[% results_per_page | uri %]&sort_by=pubdate_asc[% PROCESS sort_search_query %]">Publication/Copyright date: oldest to newest</a></li>
284                                     [% END %]
285
286                                     [% IF ( sort_by == "acqdate_dsc" ) %]
287                                         <li><a href="/cgi-bin/koha/catalogue/search.pl?count=[% results_per_page | uri %]&sort_by=acqdate_dsc[% PROCESS sort_search_query %]"><i class="fa fa-check"></i> Acquisition date: newest to oldest</a></li>
288                                     [% ELSE %]
289                                         <li><a href="/cgi-bin/koha/catalogue/search.pl?count=[% results_per_page | uri %]&sort_by=acqdate_dsc[% PROCESS sort_search_query %]">Acquisition date: newest to oldest</a></li>
290                                     [% END %]
291
292                                     [% IF ( sort_by == "acqdate_asc" ) %]
293                                         <li><a href="/cgi-bin/koha/catalogue/search.pl?count=[% results_per_page | uri %]&sort_by=acqdate_asc[% PROCESS sort_search_query %]"><i class="fa fa-check"></i> Acquisition date: oldest to newest</a></li>
294                                     [% ELSE %]
295                                         <li><a href="/cgi-bin/koha/catalogue/search.pl?count=[% results_per_page | uri %]&sort_by=acqdate_asc[% PROCESS sort_search_query %]">Acquisition date: oldest to newest</a></li>
296                                     [% END %]
297
298                                     <li class="dropdown-header">Title</li>
299                                     [% IF ( sort_by == "title_az" || sort_by == "title_asc" ) %]
300                                         <li><a href="/cgi-bin/koha/catalogue/search.pl?count=[% results_per_page | uri %]&sort_by=title_az[% PROCESS sort_search_query %]"><i class="fa fa-check"></i> Title (A-Z)</a></li>
301                                     [% ELSE %]
302                                         <li><a href="/cgi-bin/koha/catalogue/search.pl?count=[% results_per_page | uri %]&sort_by=title_az[% PROCESS sort_search_query %]">Title (A-Z)</a></li>
303                                     [% END %]
304
305                                     [% IF ( sort_by == "title_za" || sort_by == "title_dsc" ) %]
306                                         <li><a href="/cgi-bin/koha/catalogue/search.pl?count=[% results_per_page | uri %]&sort_by=title_za[% PROCESS sort_search_query %]"><i class="fa fa-check"></i> Title (Z-A)</a></li>
307                                     [% ELSE %]
308                                         <li><a href="/cgi-bin/koha/catalogue/search.pl?count=[% results_per_page | uri %]&sort_by=title_za[% PROCESS sort_search_query %]">Title (Z-A)</a></li>
309                                     [% END %]
310                                 </ul>
311                             </div> <!-- /.btn-group -->
312
313                             [% IF Koha.Preference('numSearchResultsDropdown') %]
314                                 <div class="btn-group">
315                                     <button type="button" class="btn btn-default btn-xs dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
316                                         Results per page: [% results_per_page | html %] <span class="caret"></span>
317                                     </button>
318                                     <ul class="dropdown-menu">
319                                         [% IF Koha.Preference('numSearchResults') %]
320                                             <li><a href="/cgi-bin/koha/catalogue/search.pl?count=[% Koha.Preference('numSearchResults') | uri %][% PROCESS sort_search_query %]" id="resultsperpage-default">
321                                                 [% IF results_per_page == Koha.Preference('numSearchResults') %]
322                                                     <i class="fa fa-check"></i>
323                                                 [% END %] [% Koha.Preference('numSearchResults') | html %] (default)
324                                             </a></li>
325                                         [% END %]
326                                         <li><a href="/cgi-bin/koha/catalogue/search.pl?count=20[% PROCESS sort_search_query %]">[% IF results_per_page == '20' %]<i class="fa fa-check"></i>[% END %] 20</a></li>
327                                         <li><a href="/cgi-bin/koha/catalogue/search.pl?count=40[% PROCESS sort_search_query %]" id="resultsperpage-40">[% IF results_per_page == '40' %]<i class="fa fa-check"></i>[% END %] 40</a></li>
328                                         <li><a href="/cgi-bin/koha/catalogue/search.pl?count=60[% PROCESS sort_search_query %]" id="resultsperpage-60">[% IF results_per_page == '60' %]<i class="fa fa-check"></i>[% END %] 60</a></li>
329                                         <li><a href="/cgi-bin/koha/catalogue/search.pl?count=80[% PROCESS sort_search_query %]" id="resultsperpage-80">[% IF results_per_page == '80' %]<i class="fa fa-check"></i>[% END %] 80</a></li>
330                                         <li><a href="/cgi-bin/koha/catalogue/search.pl?count=100[% PROCESS sort_search_query %]" id="resultsperpage-100">[% IF results_per_page == '100' %]<i class="fa fa-check"></i>[% END %] 100</a></li>
331                                     </ul>
332                                 </div> <!-- /.btn-group -->
333                             [% END %]
334
335                         </div> <!-- /#selection_ops -->
336                     </div> <!-- /#searchheader -->
337                 [% END %]
338
339                 [% ELSE # /IF total %]
340                     <form method="post" name="fz3950" class="fz3950bigrpad">
341                         <div id="toolbar" class="btn-toolbar" style="background-color:transparent"><div>
342                             <button class="btn btn-default" type="button" id="z3950submit"><i class="fa fa-search"></i> Z39.50/SRU search</button>
343                         </div></div>
344                     </form>
345
346                     <div id="searchheader">
347                         <h3>No results found</h3>
348                         [% IF ( searchdesc ) %]
349                             <p>
350                                 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 %].
351                             </p>
352                             [% IF CAN_user_acquisition_order_manage && searchtoorder_basketno && searchtoorder_vendorid %][%# Coming from the basket or vendor view %]
353                                 <p><a href="/cgi-bin/koha/acqui/basket.pl?basketno=[% searchtoorder_basketno | uri %]">View basket<a></p>
354                             [% END %]
355                             <a href="/cgi-bin/koha/catalogue/search.pl?advsearch=1&edit_search=1&[% query_cgi | $raw %]&[% limit_cgi | $raw %]&sort_by=[% sort_by | $raw %]">Edit this search</a>
356                             [% IF ( Koha.Preference('SavedSearchFilters') && CAN_user_parameters_manage_search_filters ) %]
357                                 | <a href="#" id="save_search_filter">Save search as filter</a>
358                             [% END %]
359                         [% ELSE %]
360                             <p>You did not specify any search criteria.</p>
361                         [% END %]
362                     </div>
363                 [% END # /IF total %]
364
365                 [% IF ( query_error ) %]
366                     <div class="dialog alert"><p><strong>Error:</strong> [% query_error | html %]</p></div>
367                 [% END %]
368
369                 <!-- Search Results Table -->
370                 [% IF ( total ) %]
371                     [% IF ( scan ) %]
372                     <div class="page-section">
373                         <h2>Scan index</h2>
374                         <form action="/cgi-bin/koha/catalogue/search.pl" method="get">
375                            <label for="scan-index">Scan index:</label>
376                             <select name="idx" id="scan-index">
377                                 [% IF ( header_pulldown == "" ) %]<option selected="selected" value="">Any word</option>
378                                 [% ELSE %]<option selected="selected" value="">Any word</option>[% END %]
379                                 [% IF ( header_pulldown == "ms_anycommaphr" ) %]<option selected="selected" value="any,phr">Any phrase</option>
380                                 [% ELSE %]<option value="any,phr">Any phrase</option>[% END %]
381                                 [% IF ( header_pulldown == "ms_ti" ) %]<option selected="selected" value="ti">Title</option>
382                                 [% ELSE %]<option value="ti">Title</option>[% END %]
383                                 [% IF ( header_pulldown == "ms_ticommaphr" ) %]<option selected="selected" value="ti,phr">Title phrase</option>
384                                 [% ELSE %]<option value="ti,phr">Title phrase</option>[% END %]
385                                 [% IF ( header_pulldown == ( "ms_au" || "ms_aucommaphr" ) ) %]<option selected="selected" value="au,phr">Author</option>
386                                 [% ELSE %]<option value="au,phr">Author</option>[% END %]
387                                 [% IF ( header_pulldown == "ms_su" ) %]<option selected="selected" value="su">Subject</option>
388                                 [% ELSE %]<option value="su">Subject</option>[% END %]
389                                 [% IF ( header_pulldown == "ms_sucommaphr" ) %]<option selected="selected" value="su,phr">Subject phrase</option>
390                                 [% ELSE %]<option value="su,phr">Subject phrase</option>[% END %]
391                                 [% IF ( header_pulldown ==  "ms_se" ) %]<option selected="selected" value="se">Series</option>
392                                 [% ELSE %]<option value="se">Series</option>[% END %]
393                                 [% IF ( header_pulldown ==  "ms_pb" ) %]<option selected="selected" value="pb">Publisher</option>
394                                 [% ELSE %]<option value="pb">Publisher</option>[% END %]
395                                 [% IF ( header_pulldown ==  "ms_nt" ) %]<option selected="selected" value="nt">Notes</option>
396                                 [% ELSE %]<option value="nt">Notes</option>[% END %]
397                                 [% IF ( header_pulldown ==  "ms_sn" ) %]<option selected="selected" value="sn">ISBN</option>
398                                 [% ELSE %]<option value="sn">ISBN</option>[% END %]
399                                 [% IF ( header_pulldown ==  "ms_ss" ) %]<option selected="selected" value="ss">ISSN</option>
400                                 [% ELSE %]<option value="ss">ISSN</option>[% END %]
401                             </select>
402                             [% IF ( scan_search_term_to_use ) %]
403                                  <input type="text" name="q" id="scan-index-term" size="35" value="[% scan_search_term_to_use | html %]" />
404                             [% ELSE %]
405                                 Scan index for: <input type="text" name="q" id="scan-index-term" size="35" value="" />
406                             [% END %]
407                             <input type="hidden" name="scan" value="1" />
408                             <input class="submit" type="submit" value="Submit" />
409                         </form>
410
411                         <form action="/cgi-bin/koha/catalogue/search.pl" method="get">
412                             <table>
413                                 <tr>
414                                     <th>Term/Phrase</th>
415                                     <th>Count</th>
416                                 </tr>
417                                 [% FOREACH SEARCH_RESULT IN SEARCH_RESULTS %]
418                                     <tr>
419                                         <td>
420                                             <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>
421                                         </td>
422                                         <td>
423                                             [% SEARCH_RESULT.author | html %]
424                                         </td>
425                                     </tr>
426                                 [% END %]
427                             </table>
428                         </form>
429                     </div>
430                     [% ELSE # /IF scan %]
431
432                         <div id="searchresults">
433                             [% INCLUDE 'page-numbers.inc' %]
434
435                             <form action="/cgi-bin/koha/catalogue/search.pl" method="get" name="bookbag_form" id="bookbag_form">
436                                 [% IF ( searchdesc ) %]
437                                     [% FOREACH QUERY_INPUT IN QUERY_INPUTS %]
438                                         <input type="hidden" name="[% QUERY_INPUT.input_name | html %]" value="[% QUERY_INPUT.input_value | html %]"/>
439                                     [% END %]
440                                     [% FOREACH LIMIT_INPUT IN LIMIT_INPUTS %]
441                                         <input type="hidden" name="[% LIMIT_INPUT.input_name | html %]" value="[% LIMIT_INPUT.input_value | html %]"/>
442                                     [% END %]
443                                 [% END %]
444
445                                 <!-- TABLE RESULTS START -->
446                                 <table>
447                                     <thead>
448                                     <tr>
449                                         [% IF ( AmazonCoverImages  || LocalCoverImages || ( SyndeticsCovers ) || (Koha.Preference('CustomCoverImages') && Koha.Preference('CustomCoverImagesURL')) ) %]
450                                             <th>&nbsp;</th>
451                                         [% END %]
452                                         <th colspan="2">Results</th>
453                                         <th>Location</th>
454                                     </tr>
455                                     </thead>
456                                     <!-- Actual Search Results -->
457                                     [% SET MaxSearchResultsItemsPerRecordStatusCheck = Koha.Preference('MaxSearchResultsItemsPerRecordStatusCheck') %]
458                                     <tbody>
459                                     [% FOREACH SEARCH_RESULT IN SEARCH_RESULTS %]
460                                         <tr id="row[% SEARCH_RESULT.biblionumber | html %]">
461                                             [% IF ( AmazonCoverImages  || LocalCoverImages || IntranetCoce || ( SyndeticsCovers ) || (Koha.Preference('CustomCoverImages') && Koha.Preference('CustomCoverImagesURL')) ) %]
462     <td class="bookcoverimg">
463         <div id="cover-slides-[% SEARCH_RESULT.biblionumber | html %]" class="cover-slides" data-biblionumber="[% SEARCH_RESULT.biblionumber | html %]">
464             [% IF ( LocalCoverImages ) %][% SEARCH_RESULT.localimage | html %]
465                 <div id="local-coverimg-[% SEARCH_RESULT.biblionumber | html %]" class="cover-image local-coverimg">
466                     <a href="[% PROCESS biblio_a_href biblionumber => SEARCH_RESULT.biblionumber %]">
467                         <img src="/cgi-bin/koha/catalogue/image.pl?thumbnail=1&amp;biblionumber=[% SEARCH_RESULT.biblionumber | uri %]" alt="Local cover image" />
468                     </a>
469                     <div class="hint">Local cover image</div>
470                 </div>
471             [% END %]
472
473             [% IF ( AmazonCoverImages && SEARCH_RESULT.normalized_isbn ) %]
474                 <div id="amazon-bookcoverimg-[% SEARCH_RESULT.biblionumber | html %]" class="cover-image amazon-bookcoverimg">
475                     <a href="[% PROCESS biblio_a_href biblionumber => SEARCH_RESULT.biblionumber %]">
476                         <img src="https://images-na.ssl-images-amazon.com/images/P/[% SEARCH_RESULT.normalized_isbn | html %].01.TZZZZZZZ.jpg" alt="Cover image from Amazon.com" />
477                     </a>
478                     <div class="hint">Amazon cover image</div>
479                 </div>
480             [% END # /IF AmazonCoverImages %]
481
482             [% IF ( SyndeticsCovers ) %]
483                     [% IF ( SEARCH_RESULT.normalized_isbn || SEARCH_RESULT.normalized_upc || SEARCH_RESULT.normalized_oclc ) %]
484                         <div id="syndetics-bookcoverimg-[% SEARCH_RESULT.biblionumber | html %]" class="cover-image syndetics-bookcoverimg">
485                             <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% SEARCH_RESULT.biblionumber | uri %]">
486                                 <img src="https://secure.syndetics.com/index.aspx?isbn=[% SEARCH_RESULT.normalized_isbn | html %]/[% SyndeticsCoverImageSize | uri %].GIF&amp;client=[% Koha.Preference('SyndeticsClientCode') | html %]&amp;type=xw10&amp;upc=[% SEARCH_RESULT.normalized_upc | html %]&amp;oclc=[% SEARCH_RESULT.normalized_oclc | html %]" alt="Cover from Syndetics" />
487                             </a>
488                             <div class="hint">Syndetics cover image</div>
489                         </div>
490                     [% END %]
491             [% END %]
492
493             [% IF ( IntranetCoce && CoceProviders && SEARCH_RESULT.normalized_isbn ) %]
494                 [% coce_id = SEARCH_RESULT.normalized_ean || SEARCH_RESULT.normalized_isbn %]
495                 [% IF ( coce_id ) %]
496                     <div id="coce-coverimg-[% SEARCH_RESULT.biblionumber | html %]" class="cover-image coce-coverimg">
497                         <a href="[% PROCESS biblio_a_href biblionumber => SEARCH_RESULT.biblionumber %]">
498                             <span style="block" title="[% SEARCH_RESULT.biblionumber | url %]" class="[% coce_id | html %]" id="coce-thumbnail[% SEARCH_RESULT.biblionumber | html %]"></span>
499                         </a>
500                         <div class="hint">Coce cover image</div>
501                     </div>
502                 [% END %]
503             [% END %]
504
505             [% IF Koha.Preference('CustomCoverImages') && Koha.Preference('CustomCoverImagesURL') %]
506                 [% SET custom_cover_image_url = SEARCH_RESULT.biblio_object.custom_cover_image_url %]
507                 [% IF custom_cover_image_url %]
508                     <div id="custom-coverimg-[% SEARCH_RESULT.biblionumber | html %]" class="cover-image custom-coverimg">
509                         <a class="custom_cover_image" href="[% custom_cover_image_url | url %]">
510                             <img alt="Custom cover image" src="[% custom_cover_image_url | url %]" />
511                         </a>
512                         <div class="hint">Custom cover image</div>
513                     </div>
514                 [% END %]
515             [% END %]
516         </div>
517     </td>
518 [% END # /IF( AmazonCoverImages || LocalCoverImages || IntranetCoce )%]
519
520                                             <td>
521                                                 <input type="checkbox" class="selection" id="bib[% SEARCH_RESULT.biblionumber | html %]" name="biblionumber" value="[% SEARCH_RESULT.biblionumber | html %]" style="display:none" />
522                                             </td>
523
524                                             <td>
525                                                 [% IF ( !item_level_itypes ) || Koha.Preference('BiblioItemtypeInfo') %]
526                                                     <div class="result-biblio-itemtype">
527                                                         [% IF !noItemTypeImages && SEARCH_RESULT.imageurl %]
528                                                             <img src="[% SEARCH_RESULT.imageurl | html %]" alt="[%  SEARCH_RESULT.description | html %]" />
529                                                         [% END %]
530                                                         <span class="itypetext">[% SEARCH_RESULT.description | html %]</span>
531                                                     </div>
532                                                 [% END %]
533
534                                                 [% SEARCH_RESULT.result_number | html %].
535                                                 [% SEARCH_RESULT.XSLTResultsRecord | $raw %]
536
537                                                 <p class="hold">
538                                                     [% IF ( SEARCH_RESULT.norequests ) %]
539                                                         <span class="noholdstext">No holds allowed</span>
540                                                     [% ELSE %]
541                                                         [% IF CAN_user_reserveforothers_place_holds %]
542                                                             <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>
543                                                             [% IF ( holdfor ) %] <span class="holdforlink">| <a href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% SEARCH_RESULT.biblionumber | uri %]&amp;findborrower=[% holdfor_patron.cardnumber | uri %]">Place hold for [% INCLUDE 'patron-title.inc' patron => holdfor_patron no_title => 1 no_cardnumber => 1 %]</a></span>[% END %]
544                                                             [% 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 %]
545                                                         [% ELSE %]
546                                                             <span>Holds ([% Biblio.HoldsCount( SEARCH_RESULT.biblionumber ) | html %])</span>
547                                                         [% END %]
548                                                     [% END # /IF SEARCH_RESULT.norequests %]
549                                                     [% IF Koha.Preference('UseRecalls') and CAN_user_recalls %]
550                                                         | <a id="recall_[% SEARCH_RESULT.biblionumber | html %]" href="/cgi-bin/koha/recalls/request.pl?biblionumber=[% SEARCH_RESULT.biblionumber | html %]">Recalls ([% Biblio.RecallsCount( SEARCH_RESULT.biblionumber ) | html %])</a>
551                                                     [% END %]
552
553                                                     [% IF Koha.Preference('intranetbookbag') == 1 %]
554                                                         [% IF ( SEARCH_RESULT.incart ) %]
555                                                             | <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>
556                                                         [% ELSE %]
557                                                             | <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>
558                                                         [% END %]
559                                                     [% END # / IF intranetbookbag %]
560
561                                                     [% IF Koha.Preference('ArticleRequests') %]
562                                                         | <a id="requst_article_[% SEARCH_RESULT.biblionumber | html %]" href="/cgi-bin/koha/circ/request-article.pl?biblionumber=[% SEARCH_RESULT.biblionumber | html %]">Request article</a>
563                                                     [% END %]
564
565                                                     [% IF ( CAN_user_editcatalogue_edit_catalogue ) %]
566                                                         | <a href="/cgi-bin/koha/cataloguing/addbiblio.pl?biblionumber=[% SEARCH_RESULT.biblionumber | uri %]">Edit record</a>
567                                                     [% END %]
568                                                     [% IF ( CAN_user_editcatalogue_edit_items ) %]
569                                                         | <a href="/cgi-bin/koha/cataloguing/additem.pl?biblionumber=[% SEARCH_RESULT.biblionumber | uri %]">Edit items</a>
570                                                     [% END %]
571
572                                                     [% IF ( CAN_user_acquisition_order_manage ) %]
573                                                         [% IF ( searchtoorder_basketno && searchtoorder_vendorid ) %]
574                                                             | <a href="/cgi-bin/koha/acqui/neworderempty.pl?booksellerid=[% searchtoorder_vendorid | uri %]&amp;basketno=[% searchtoorder_basketno | uri %]&amp;biblionumber=[% SEARCH_RESULT.biblionumber | uri %]">Add order</a>
575                                                         [% END %]
576                                                     [% END %]
577
578                                                     [% IF ( OPACBaseURL ) %]
579                                                         <span class="view-in-opac">
580                                                             | <a href="[% Koha.Preference('OPACBaseURL') | url %]/cgi-bin/koha/opac-detail.pl?biblionumber=[% SEARCH_RESULT.biblionumber | uri %]" target="_blank">OPAC view</a>
581                                                         </span>
582                                                     [% END %]
583                                                 </p> <!-- /.holds -->
584                                             </td>
585
586                                             <td>
587                                                 <div class="availability">
588                                                     [% IF ( SEARCH_RESULT.items_count ) %]
589                                                         <div class="results_available_count">
590                                                             [% IF MaxSearchResultsItemsPerRecordStatusCheck && SEARCH_RESULT.items_count > MaxSearchResultsItemsPerRecordStatusCheck %]
591                                                                 <span class="blocker inaccurate-item-statuses" title="Item statuses may be inaccurate. Please view the record details for accurate item statuses">
592                                                             [% END %]
593
594                                                             [% tnx('{count} item', '{count} items', SEARCH_RESULT.items_count, {count = SEARCH_RESULT.items_count}) | html %][% IF ( SEARCH_RESULT.availablecount ) %], [% SEARCH_RESULT.availablecount | html %] <span>available:</span>[% ELSE %], <span>None available</span>[% END %]
595
596                                                             [% IF MaxSearchResultsItemsPerRecordStatusCheck && SEARCH_RESULT.items_count > MaxSearchResultsItemsPerRecordStatusCheck %]
597                                                                 </span>
598                                                             [% END %]
599                                                         </div> <!-- /.results_available_count -->
600
601                                                         [% BLOCK search_result_items %]
602                                                             [% IF status_count == "onloancount" %]
603                                                                 [% IF SEARCH_RESULT.${status_count} > 0 %]
604                                                                     <div class="results_checkedout">[% SEARCH_RESULT.${status_count} | html %] checked out:</div>
605                                                                 [% END %]
606                                                             [% ELSIF status_count == "othercount" %]
607                                                                 [% IF SEARCH_RESULT.${status_count} > 0 %]
608                                                                     <div class="results_unavailable">[% SEARCH_RESULT.${status_count} | html %] unavailable:</div>
609                                                                 [% END %]
610                                                             [% END %]
611                                                             [% IF SEARCH_RESULT.${items_loop}.size > 0 %]
612                                                                 <ul class="[% items_loop | html %]_items">
613                                                                     [% FOREACH items_loo IN SEARCH_RESULT.${items_loop} %]
614                                                                         [% IF item_level_itypes && !noItemTypeImages && items_loo.imageurl %]
615                                                                             <li class="result_itype_image">
616                                                                                 <img src="[% items_loo.imageurl | html %]" title="[% items_loo.description | html %]" alt="[% items_loo.description | html %]" />
617                                                                         [% ELSE %]
618                                                                             <li>
619                                                                         [% END %]
620                                                                         [% IF ( items_loo.branchname ) %]
621                                                                             [% items_loo.branchname | html %]
622                                                                         [% END %]
623                                                                         [% IF ( items_loo.location ) %]
624                                                                             <span class="shelvingloc">[% items_loo.location | html %]</span>
625                                                                         [% END %]
626
627                                                                             [% IF ( items_loo.itemcallnumber ) %]
628                                                                                 <a href="/cgi-bin/koha/catalogue/search.pl?idx=callnum&amp;q=%22[% items_loo.itemcallnumber |uri %]%22">[% items_loo.itemcallnumber | html %]</a>
629                                                                             [% END %]
630                                                                             <div class="result_item_details">
631                                                                                 [% IF ( items_loo.withdrawn ) %]
632                                                                                     ([% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.withdrawn', authorised_value => items_loo.withdrawn ) | html %])
633                                                                                 [% END %]
634                                                                                 [% IF ( items_loo.itemlost ) %]
635                                                                                     ([% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.itemlost', authorised_value => items_loo.itemlost ) | html %])
636                                                                                 [% END %]
637                                                                                 [% IF ( items_loo.damaged ) %]
638                                                                                     ([% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.damaged', authorised_value => items_loo.damaged ) | html %])
639                                                                                 [% END %]
640                                                                                 [% IF ( items_loo.intransit ) %]
641                                                                                     (<span>In transit</span>)
642                                                                                 [% END %]
643                                                                                 [% IF ( items_loo.onhold ) %]
644                                                                                     (<span>On hold</span>)
645                                                                                 [% END %]
646                                                                                 [% IF ( items_loo.notforloan ) %]
647                                                                                     [% items_loo.notforloan | html %]
648                                                                                 [% END %]
649                                                                                 <span class="item_count">[% items_loo.count | html %]</span>
650                                                                             </div> <!-- /.result_item_details -->
651
652                                                                             [% IF status_count == "onloancount" %]
653                                                                                 <span class="item-date-due">
654                                                                                     Due: [% items_loo.due_date | $KohaDates %]
655                                                                                 </span>
656                                                                             [% END %]
657
658                                                                             [% IF item_level_itypes && items_loo.description %]
659                                                                                 <span class="item-itype-desc itypetext">[% items_loo.description | html %]</span>
660                                                                             [% END %]
661                                                                         </li>
662                                                                     [% END # /FOREACH other_items_loo %]
663                                                                 </ul> <!-- /.[% items_loop | html %]_items -->
664                                                             [% END # /IF SEARCH_RESULT.${items_loop}.size %]
665                                                         [% END # /BLOCK search_result_items %]
666
667                                                         [% PROCESS search_result_items status_count="availablecount" items_loop="available_items_loop" %]
668
669                                                         [% PROCESS search_result_items status_count="onloancount" items_loop="onloan_items_loop" %]
670
671                                                         [% PROCESS search_result_items status_count="othercount" items_loop="other_items_loop" %]
672
673
674                                                     [% ELSE # /IF ( SEARCH_RESULT.items_count ) %]
675
676                                                         [% IF ( SEARCH_RESULT.ALTERNATEHOLDINGS.size ) %]
677                                                             <strong id="altholdings_heading">Other holdings:</strong>
678                                                             <ul>
679                                                                 [% FOREACH ALTERNATEHOLDING IN SEARCH_RESULT.ALTERNATEHOLDINGS %]
680                                                                     <li id="alternateholdings">[% ALTERNATEHOLDING.holding | html %]</li>
681                                                                 [% END %]
682                                                             </ul>
683                                                         [% ELSE %]
684                                                             <span class="unavailable">No items</span>
685                                                         [% END %]
686                                                     [% END # /IF ( SEARCH_RESULT.items_count ) %]
687                                                 </div> <!-- /.availability -->
688                                             </td>
689                                         </tr>
690                                     [% END # /FOREACH SEARCH_RESULT %]
691                                     </tbody>
692                                 </table>
693                             </form>
694                         </div> <!-- /#bookbag_form -->
695                     [% END # /IF scan %]
696                     [% INCLUDE 'page-numbers.inc' %]
697                 [% ELSE #/IF total %]
698                     <!-- No Results Found -->
699                 [% END #/IF total %]
700
701                 [% IF ( outer_sup_results_loop ) %]
702                     </div>
703                     <div class="col-sm-4">
704                         [% FOREACH outer_sup_results_loo IN outer_sup_results_loop %]
705                             [% IF ( outer_sup_results_loo.inner_sup_results_loop ) %]
706                                 [% outer_sup_results_loo.servername | html %]
707                                 [% FOREACH inner_sup_results_loo IN outer_sup_results_loo.inner_sup_results_loop %]
708                                     <div>
709                                         <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>
710                                     </div>
711                                 [% END %]
712                             [% END %]
713                         [% END # FOREACH outer_sup_results_loo %]
714                     </div> <!-- /.col-sm-4 -->
715                 </div>
716                 [% END #/IF outer_sup_results_loop %]
717
718                 [% IF ( Koha.Preference('SavedSearchFilters') && CAN_user_parameters_manage_search_filters ) %]
719                     <div id="search_filters_modal" class="modal" role="dialog" aria-hidden="true">
720                         <div class="modal-dialog">
721                         <div class="modal-content">
722                             <div class="modal-header">
723                                 <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
724                                 <h3 id="search_filters_label">Save: '[% query_desc | html %]' with limits '[% limit_desc | html %]' as filter</h3>
725                             </div>
726                             <div class="modal-body">
727                                 <h6>Visibility:</h6>
728                                 <label for="show_filter_opac">Show in OPAC?</label>
729                                 <input type="checkbox" id="show_filter_opac" name="show_filter_opac">
730                                 <label for="show_filter_staff_client">Show in staff interface?</label>
731                                 <input type="checkbox" id="show_filter_staff_client" name="show_filter_staff_client">
732                                 <hr>
733                                 <h6>Save as new search filter:</h6>
734                                 <label for="new_filter">Name:</label>
735                                 <input id="new_filter" name="new_filter" type="text">
736                                 <a id="save_new_filter" class="btn btn-default btn-xs" href="#">Save</a>
737                                 <span class="existing_filters_section">
738                                     </br>OR</br>
739                                     <h6>Replace existing search filter:</h6>
740                                     <label for="existing_filters">Choose</label>
741                                     <select id="existing_filters" name="existing_filters" class="search_filters_list"></select>
742                                     <a id="replace_existing_filter" class="btn btn-default btn-xs" href="#">Replace</a>
743                                 </span>
744                             </div>
745                             <div class="modal-footer">
746                                 <a href="#" data-dismiss="modal" aria-hidden="true" class="cancel">Cancel</a>
747                             </div>
748                         </div>
749                         </div>
750                     </div>
751                 [% END %]
752
753                 <form id="hold_form" method="get" action="/cgi-bin/koha/reserve/request.pl">
754                     <!-- Value will be set here by placeHold() -->
755                     <input type="hidden" name="findborrower" id="holdFor" value="" />
756                     <input type="hidden" name="club" id="holdForClub" value="" />
757                 </form>
758
759                 <form id="list_form" method="get" action="/cgi-bin/koha/reserve/request.pl">
760                     <!-- Value will be set here by addToList() -->
761                     <input type="hidden" name="multi_listadd" value="1"/>
762                 </form>
763
764             </main>
765         </div> <!-- /.col-sm-10.col-sm-push-2 -->
766
767         <div class="col-sm-2 col-sm-pull-10">
768             <aside>
769                 [% INCLUDE 'facets.inc' %]
770             </aside>
771         </div> <!-- /.col-sm-2.col-sm-pull-10 -->
772      </div> <!-- /.row -->
773
774 [% MACRO jsinclude BLOCK %]
775     [% Asset.js("js/browser.js") | $raw %]
776     [% Asset.js("lib/hc-sticky.js") | $raw %]
777     [% Asset.js("js/coce.js") | $raw %]
778     [% Asset.css("css/humanmsg.css") | $raw %]
779     [% Asset.js("lib/jquery/plugins/humanmsg.js") | $raw %]
780     [% INCLUDE 'select2.inc' %]
781     <script>
782         var PREF_AmazonCoverImages = parseInt( "[% Koha.Preference('AmazonCoverImages') | html %]", 10);
783         var q_array = new Array();  // will hold search terms, if present
784         var PREF_LocalCoverImages = parseInt( "[% Koha.Preference('LocalCoverImages') | html %]", 10);
785         var PREF_IntranetCoce = parseInt( "[% Koha.Preference('IntranetCoce') | html %]", 10);
786         var PREF_CoceProviders = "[% Koha.Preference('CoceProviders') | html %]";
787         var CoceHost = "[% CoceHost | html %]";
788         var CoceProviders = "[% CoceProviders | html %]";
789         var PREF_BrowseResultSelection = parseInt( "[% Koha.Preference('BrowseResultSelection') | html %]", 10);
790         var PREF_StaffHighlightedWords = "[% Koha.Preference('StaffHighlightedWords') | html %]";
791         var PREF_NotHighlightedWords = "[% Koha.Preference('NotHighlightedWords') | html %]";
792         var biblionumber = "[% biblionumber | html %]";
793         var holdfor_cardnumber = "[% holdfor_patron.cardnumber | html %]";
794         var holdforclub = "[% holdforclub | html %]";
795         [% IF SEARCH_RESULTS %]
796             var SEARCH_RESULTS = 1;
797         [% ELSE %]
798             var SEARCH_RESULTS = 0;
799         [% END %]
800         var new_results_browser = [
801             [%- FOREACH result IN SEARCH_RESULTS -%]
802                 [%- result.biblionumber | html -%],
803             [%- END -%]
804         ];
805         var strQuery="&frameworkcode=";
806         [%- FOREACH z3950_search_param IN z3950_search_params -%]
807             strQuery += "&" + "[% z3950_search_param.name |uri %]" + "=" + "[% z3950_search_param.value |uri %]";
808         [%- END -%]
809
810         var search_result = {
811             query_desc: "[% To.json( query_desc ) | html %]",
812             query_cgi: "[% query_cgi | html %]",
813             limit_cgi: "[% limit_cgi | html %]",
814             query_json: [% query_json | $raw %],
815             limit_json: [% limit_json | $raw %],
816             sort_by: "[% sort_by | html %]",
817             gotoPage: "[% gotoPage | html %]",
818             gotoNumber: "[% gotoNumber | html %]",
819             searchid: "[% searchid | html %]",
820             total: "[% total | html %]",
821             first_result_number: "[% SEARCH_RESULTS.first.result_number | html %]",
822             first_biblionumber: "[% SEARCH_RESULTS.first.biblionumber | html %]",
823             last_biblionumber: "[% SEARCH_RESULTS.last.biblionumber | html %]",
824         }
825
826         $("#refine_search").on('submit',function(e){
827             e.preventDefault();
828             var index = $("#refine_search #refiner_idx").val() || "";
829             if( index){index += ":";}
830             window.location.href = "/cgi-bin/koha/catalogue/search.pl?[% query_cgi | $raw %]&[% limit_cgi | $raw %]&[% sort_cgi | $raw %]&limit="+index+escape_str( $("#refiner").val() );
831         });
832
833         [% IF ( CAN_user_parameters_manage_search_filters ) %]
834             function getFilters(id) {
835                 const select = $("#existing_filters");
836                 $("option[value!='']", select).remove();
837                 return new Promise(function(resolve, reject) {
838                     $.ajax("/api/v1/search_filters")
839                     .then(resolve, reject);
840                 })
841                 .then(function(filters) {
842                     if( filters.length == 0 ){
843                        $(".existing_filters_section").hide();
844                     } else {
845                        $(".existing_filters_section").show();
846                     }
847                     filters.forEach(function(filter) {
848                         const opt = $("<option/>");
849                         select.append(opt);
850                         if(id && filter.search_filter_id == id) {
851                             opt.prop('selected', true);
852                         }
853                         opt.attr("value", filter.search_filter_id);
854                         opt.attr("title", "Query:" + filter.query + " Limit:"+filter.limits);
855                         opt.text(filter.name);
856                         opt.data("filter", filter);
857                     });
858                 })
859                 .then(function(){
860                     select.change();
861                 });
862             }
863             $("#save_search_filter").click(function(){
864                 getFilters();
865                 $("#search_filters_modal").modal('show');
866             });
867             $("#save_new_filter").click(function(){
868                 let name = $("#new_filter").val().trim();
869                 if(!name){
870                     humanMsg.displayAlert( _("You must provide a name for the new filter"), { className: 'human Error' } );
871                     return;
872                 }
873                 let opac = $("#show_filter_opac").prop('checked');
874                 let staff = $("#show_filter_staff_client").prop('checked');
875                 save_search_filter(name,null,opac,staff);
876             });
877             $("#replace_existing_filter").click(function(){
878                 let id = $("#existing_filters").val();
879                 let name = $("#existing_filters option[value="+id+"]").text();
880                 save_search_filter(name,id);
881             });
882             function save_search_filter(name,id,opac,staff){
883                 let options = {
884                     url: '/api/v1/search_filters',
885                     contentType: "application/json",
886                     data: JSON.stringify({
887                         name: name,
888                         query: JSON.stringify(search_result.query_json),
889                         limits: JSON.stringify(search_result.limit_json),
890                         opac: opac,
891                         staff_client: staff,
892                     })
893                 };
894                 if (id){
895                     options.method = "PUT";
896                     options.url = options.url+"/"+id
897                 } else {
898                     options.method = "POST";
899                 }
900                 $.ajax(options)
901                     .then(function(result) {
902                         $("#search_filters_modal").modal('hide');
903                         humanMsg.displayAlert( _("Saved filter: ") + name  , { className: 'human Success' } );
904                         getFilters();
905                     })
906                     .fail(function(err) {
907                         humanMsg.displayAlert( _("There was an error during saving:") + err.responseText, { className: 'humanError' } );
908                     });
909             }
910
911         [% END %]
912     </script>
913     [% Asset.js("js/pages/results.js") | $raw %]
914 [% END %]
915
916 [% INCLUDE 'intranet-bottom.inc' %]