Bug 25004: Search results place hold button not enabled when checking result checkbox...
[koha.git] / koha-tmpl / opac-tmpl / bootstrap / en / modules / opac-results.tt
1 [% USE raw %]
2 [% USE Asset %]
3 [% USE Koha %]
4 [% SET TagsShowEnabled = ( ( Koha.Preference( 'TagsEnabled' ) == 1 ) && TagsShowOnList ) %]
5 [% SET TagsInputEnabled = ( ( Koha.Preference( 'opacuserlogin' ) == 1 ) && ( Koha.Preference( 'TagsEnabled' ) == 1 ) && TagsInputOnList ) %]
6 [% SET AdlibrisEnabled = Koha.Preference('AdlibrisCoversEnabled') %]
7 [% SET AdlibrisURL = Koha.Preference('AdlibrisCoversURL') %]
8
9 [% IF firstPage %]
10      [% SET OverDriveEnabled = Koha.Preference('OverDriveLibraryID') && Koha.Preference('OverDriveClientKey') && Koha.Preference('OverDriveClientSecret') %]
11      [% SET RecordedBooksEnabled = Koha.Preference('RecordedBooksLibraryID') && Koha.Preference('RecordedBooksClientSecret') %]
12 [% END %]
13
14 [% INCLUDE 'doc-head-open.inc' %]
15 <title>[% IF ( LibraryNameTitle ) %][% LibraryNameTitle | html %][% ELSE %]Koha online[% END %] catalog &rsaquo;
16 [% IF ( searchdesc ) %]
17     [% IF ( ms_value ) %]
18         Results of search for '[% ms_value | html %]'
19     [% ELSE %]
20         Search results
21     [% END %]
22 [% ELSE %]
23     You did not specify any search criteria.
24 [% END %]</title>
25 [% INCLUDE 'doc-head-close.inc' %]
26
27 <link rel="alternate" type="application/rss+xml" title="[% LibraryName | html %] Search RSS feed" href="[% OPACBaseURL | url %]/cgi-bin/koha/opac-search.pl?[% query_cgi | $raw %][% limit_cgi | $raw %]&amp;count=[% countrss |uri %]&amp;sort_by=acqdate_dsc&amp;format=rss" />
28 </head>
29 [% BLOCK cssinclude %][% END %]
30 [% INCLUDE 'bodytag.inc' bodyid='results' bodyclass='scrollto' %]
31 [% INCLUDE 'masthead.inc' %]
32
33     <div class="main">
34         <ul class="breadcrumb">
35             <li><a href="/cgi-bin/koha/opac-main.pl">Home</a> <span class="divider">&rsaquo;</span></li>
36                 [% IF ( searchdesc ) %]
37                     [% IF ( ReturnPath ) %]
38                         <li>
39                             <a href="[% ReturnPath | url %]">Advanced search</a> <span class="divider">&rsaquo;</span>
40                         </li>
41                     [% END %]
42                     <li>
43                         [% IF ( ms_value ) %]
44                             <a href="#" title="You searched [% IF ( query_desc ) %] for '[% query_desc | html %]'[% END %][% IF ( limit_desc ) %] with limit(s): '[% limit_desc | html %]'[% END %]">Results of search for '[% ms_value | html %]'</a>
45                         [% ELSE %]
46                             <a href="#" title="You searched [% IF ( query_desc ) %] for '[% query_desc | html %]'[% END %][% IF ( limit_desc ) %] with limit(s): '[% limit_desc | html %]'[% END %]">Search results</a>
47                         [% END %]
48                     </li>
49                 [% ELSE %]
50                     <li>
51                         <a href="#">You did not specify any search criteria</a>
52                     </li>
53                 [% END %]
54         </ul>
55
56         [% UNLESS ( total ) %]
57             <div class="container-fluid maincontent">
58                 <div class="row-fluid">
59                     <div class="span12">
60                         <strong>No results found!</strong>
61                         <p>
62                             [% IF ( searchdesc ) %]
63                                 No results found for that in [% LibraryName | html %] catalog.
64                                 <a href="[% OPACBaseURL | url %]/cgi-bin/koha/opac-search.pl?[% query_cgi | $raw %][% limit_cgi | $raw %]&amp;format=rss" class="btn btn-link rsssearchlink noprint">
65                                     <i class="fa fa-rss rsssearchicon" title="Subscribe to this search"></i>
66                                 </a>
67                             [% ELSE %]
68                                 You did not specify any search criteria.
69                             [% END %]
70                         </p>
71                         [% IF ( ReturnPath ) %]
72                            <div class="returntosearch">
73                                 <p><a href="[% ReturnPath | url %]">Return to the last advanced search</a></p>
74                             </div>
75                         [% END %]
76                         [% IF ( OPACNoResultsFound ) %]
77                             <div id="noresultsfound">
78                                 [% OPACNoResultsFound | $raw %]
79                             </div>
80                         [% END %]
81                     </div> <!-- / .span12 -->
82                 </div> <!-- / .row-fluid -->
83             </div> <!-- / .container-fluid -->
84         [% END # / UNLESS searchdesc %]
85
86         <div id="maincontent" class="container-fluid">
87             <div class="row-fluid">
88                 [% IF ( opacfacets && total ) %]
89                     <div class="span2">
90                         <div id="facetcontainer">
91                             <!-- FACETS START -->
92                             [% INCLUDE 'opac-facets.inc' %]
93                             <!-- FACETS END -->
94                         </div>
95                     </div>
96                 [% END %]
97
98                 [% IF ( opacfacets && total ) %]<div class="span10 maincontent">[% ELSE %]<div class="span12 maincontent">[% END %]
99
100                 [% IF ( searchdesc ) %]
101                     <p id="numresults">
102                     [% IF ( total ) %]<strong>Your search returned [% total | html %] results.</strong>
103                         [% IF ( related ) %]
104                             (related searches:
105                                 [% FOREACH relate IN related %]
106                                     [% relate.related_search | html %]
107                                 [% END %]
108                             ).
109                         [% END %]
110                         <a href="[% OPACBaseURL | url %]/cgi-bin/koha/opac-search.pl?[% query_cgi | $raw %][% limit_cgi | $raw %]&amp;format=rss" class="btn btn-link rsssearchlink noprint">
111                             <i class="fa fa-rss rsssearchicon" title="Subscribe to this search"></i>
112                         </a>
113                     [% END # / IF total %]
114                     </p>
115                 [% END # / IF searchdesc %]
116
117                 <div id="userresults">
118                     [% IF ( DidYouMean ) %]
119                         <div id="didyoumean">Not what you expected? Check for <a href="/cgi-bin/koha/svc/suggestion?render=standalone&amp;q=[% querystring | uri %]">suggestions</a></div>
120                     [% END %]
121
122                     [% IF ( koha_spsuggest ) %]
123                         Did you mean:
124                         <ul style="list-style: none;">
125                             [% FOREACH SPELL_SUGGES IN SPELL_SUGGEST %]
126                             <li>
127                                 <a href="/cgi-bin/koha/opac-search.pl?q=[% SPELL_SUGGES.spsuggestion | uri %]">[% SPELL_SUGGES.spsuggestion | html %]</a>
128                             </li>
129                             [% END %]
130                         </ul>
131                     [% END # / IF koha_spsuggest%]
132                     [% IF ( total ) %]
133                         [% IF ( ReturnPath ) %]
134                             <div class="returntosearch">
135                                 <p><a href="[% ReturnPath | url %]">Return to the last advanced search</a></p>
136                             </div>
137                         [% END %]
138                     [% END %]
139                     [% IF ( query_error ) %]
140                         <div class="dialog alert">
141                             <h4>Error:</h4>
142                             [% query_error | html %]
143                         </div>
144                     [% END %]
145
146                     <!-- Search Results Table -->
147                     [% IF ( total ) %]
148
149                         <div class="searchresults">
150                             <form action="/cgi-bin/koha/opac-search.pl" method="get" name="bookbag_form" id="bookbag_form" class="checkboxed">
151                                 [% IF ( searchdesc ) %]
152                                     [% FOREACH QUERY_INPUT IN QUERY_INPUTS %]
153                                         <input type="hidden" name="[% QUERY_INPUT.input_name | html %]" value="[% QUERY_INPUT.input_value | html %]"/>
154                                     [% END %]
155                                     [% FOREACH LIMIT_INPUT IN LIMIT_INPUTS %]
156                                         <input type="hidden" name="[% LIMIT_INPUT.input_name | html %]" value="[% LIMIT_INPUT.input_value | html %]"/>
157                                     [% END %]
158                                 [% END # IF /searchdesc %]
159
160                                 <div id="floating">
161                                     <div id="toolbar" class="toolbar clearfix">
162                                         <div id="top-pages" class="pull-left">[% INCLUDE 'page-numbers.inc' %]</div>
163                                         [% UNLESS tag %]
164                                             <div class="sort_by pull-right">
165                                                 <select id="sort_by" class="resort" name="sort_by"> [% INCLUDE 'resort_form.inc' %] </select>
166
167                                                 [% IF Koha.Preference('OPACnumSearchResultsDropdown') %]
168                                                     <label for="results_per_page">Results per page: </label>
169                                                     <select id="results_per_page" name="count">
170                                                         [% IF Koha.Preference('OPACnumSearchResults') %]
171                                                             [% IF results_per_page == Koha.Preference('OPACnumSearchResults') %]
172                                                                 <option value="[% Koha.Preference('OPACnumSearchResults') | html %]" selected="selected">Library default: [% Koha.Preference('OPACnumSearchResults') | html %]</option>
173                                                             [% ELSE %]
174                                                                 <option value="[% Koha.Preference('OPACnumSearchResults') | html %]">Library default: [% Koha.Preference('OPACnumSearchResults') | html %]</option>
175                                                             [% END %]
176                                                         [% END %]
177                                                         [% IF results_per_page == '20' %]<option value="20" selected="selected">20</option>[% ELSE %]<option value="20">20</option>[% END %]
178                                                         [% IF results_per_page == '40' %]<option value="40" selected="selected">40</option>[% ELSE %]<option value="40">40</option>[% END %]
179                                                         [% IF results_per_page == '60' %]<option value="60" selected="selected">60</option>[% ELSE %]<option value="60">60</option>[% END %]
180                                                         [% IF results_per_page == '80' %]<option value="80" selected="selected">80</option>[% ELSE %]<option value="80">80</option>[% END %]
181                                                         [% IF results_per_page == '100' %]<option value="100" selected="selected">100</option>[% ELSE %]<option value="100">100</option>[% END %]
182                                                     </select>
183                                                 [% END %]
184
185                                                 <input type="submit" class="btn btn-sm clearfix" id="sortsubmit" value="Go" />
186                                             </div>
187                                         [% END %]
188                                     </div> <!-- / #toolbar -->
189
190                                     <div id="selections-toolbar" class="toolbar noprint">
191                                         [% IF ( OpacHighlightedWords ) %]
192                                             <div class="highlight_controls noprint">
193                                                 <a href="#" class="btn btn-link highlight_toggle" id="highlight_toggle_off"><i class="fa fa-fw fa-pencil"></i> Unhighlight</a>
194                                                 <a href="#" class="btn btn-link highlight_toggle" id="highlight_toggle_on"><i class="fa fa-fw fa-pencil"></i> Highlight</a>
195                                             </div>
196                                             <span class="sep">|</span>
197                                         [% END %]
198                                         <!-- checkall, clearall are now needed for placehold -->
199                                         <span class="checkall"></span>
200                                         <span class="clearall"></span> <span class="sep">|</span>
201
202                                             <span class="links">
203                                                 [% IF ( ( Koha.Preference( 'opacbookbag' ) == 1 ) || ( Koha.Preference( 'virtualshelves' ) == 1 ) ) %]
204                                                     <span class="addto"></span>
205                                                 [% END %]
206                                                 <span id="placehold"></span>
207
208                                                 [% IF ( TagsInputEnabled && loggedinusername ) %]
209                                                     <span id="tagsel_span">
210                                                         <button id="tagsel_tag" class="btn btn-link disabled" type="submit" style="display:none"><i class="fa fa-fw fa-tag"></i> Tag</button>
211                                                     </span>
212                                                     <div id="tagsel_form" style="display:none">
213                                                         <label for="tagsel_new">New tag:</label>
214                                                         <input type="text" name="tagsel_new" id="tagsel_new" maxlength="100" />
215                                                         <input id="tagsel_button" name="tagsel_button" class="tagsel_button btn btn-small" title="Add" type="submit" value="Add" />
216                                                         <a href="#" id="tagsel_cancel">(done)</a>
217                                                     </div>
218                                                     <div id="tagsel_status" class="tagsel_tatus" style="display:none;">
219                                                         Tag status here.
220                                                     </div>
221                                                 [% END %]
222                                             </span> <!-- / .links -->
223                                     </div> <!-- / #selections-toolbar -->
224                                 </div> <!-- /#floating -->
225
226                                 <!-- TABLE RESULTS START -->
227                                 <table class="table table-striped">
228
229                                     <!-- Actual Search Results -->
230                                     [% FOREACH SEARCH_RESULT IN SEARCH_RESULTS %]
231                                         <tr>
232                                             [% # Cell 1: Checkbox %]
233                                             <td class="select selectcol">
234                                                 [% IF Koha.Preference( 'opacbookbag' ) == 1 %]
235                                                     <input type="checkbox" class="cb" id="bib[% SEARCH_RESULT.biblionumber | html %]" name="biblionumber" value="[% SEARCH_RESULT.biblionumber | html %]" /> <label for="bib[% SEARCH_RESULT.biblionumber | html %]"></label>
236                                                 [% ELSE %]
237                                                     [% IF Koha.Preference( 'virtualshelves' ) == 1 %]
238                                                         <input type="checkbox" class="cb" id="bib[% SEARCH_RESULT.biblionumber | html %]" name="biblionumber" value="[% SEARCH_RESULT.biblionumber | html %]" /> <label for="bib[% SEARCH_RESULT.biblionumber | html %]"></label>
239                                                     [% ELSE %]
240                                                         [% IF Koha.Preference( 'RequestOnOpac' ) == 1 %]
241                                                             [% UNLESS ( SEARCH_RESULT.norequests ) %]
242                                                                 [% IF Koha.Preference( 'opacuserlogin' ) == 1 %]<input type="checkbox" class="cb" id="bib[% SEARCH_RESULT.biblionumber | html %]" name="biblionumber" value="[% SEARCH_RESULT.biblionumber | html %]" /> <label for="bib[% SEARCH_RESULT.biblionumber | html %]"></label>
243                                                                 [% END %]
244                                                             [% END %]
245                                                         [% END # IF RequestOnOpac %]
246                                                     [% END # IF virtualshelves %]
247                                                 [% END # IF opacbookbag%]
248                                             </td>
249                                             [% # Cell 2: Show result number if OpacHiddenItems is empty %]
250                                             <td class="select selectcol">
251                                                 [% UNLESS suppress_result_number %]
252                                                     [% SEARCH_RESULT.result_number | html %].
253                                                 [% END %]
254                                             </td>
255
256                                             [% IF ( !item_level_itypes && !noItemTypeImages ) %]
257                                                 [% # Cell 3: Show item type image %]
258                                                 <td class="itypecol">
259                                                     [% IF ( SEARCH_RESULT.imageurl ) %]
260                                                         <img src="[% SEARCH_RESULT.imageurl | html %]" title="[% SEARCH_RESULT.description | html %]" alt="[% SEARCH_RESULT.description | html %]" />
261                                                     [% END %]
262                                                     [% IF ( SEARCH_RESULT.score_avg ) %]
263                                                         <img src="[% themelang | html %]/../images/bonus.png" title="bonus" style="max-height: 35px;"/>
264                                                     [% END %]
265                                                 </td>
266                                             [% END %]
267
268                                             [% # Cell 4: Search result details and controls %]
269                                             <td class="bibliocol">
270                                                 <div class="coverimages itemtype_[% SEARCH_RESULT.itemtype | html %]">
271                                                     <a class="p1" href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% SEARCH_RESULT.biblionumber | uri %]">
272                                                         [% IF ( OPACLocalCoverImages ) %]
273                                                             <span title="[% SEARCH_RESULT.biblionumber |url %]" class="[% SEARCH_RESULT.biblionumber | html %]" id="local-thumbnail[% loop.count | html %]"></span>
274                                                         [% END %]
275
276                                                         [% IF ( AdlibrisEnabled && SEARCH_RESULT.normalized_isbn ) %]
277                                                             <span title="[% SEARCH_RESULT.biblionumber | html %]" id="adlibris-thumbnail[% loop.count | html %]">
278                                                                 <img src="[% AdlibrisURL | html %]?isbn=[% SEARCH_RESULT.normalized_isbn | html %]"
279                                                                      alt="Adlibris thumbnail for ISBN: [% SEARCH_RESULT.normalized_isbn | html %]" class="adlibris-cover" />
280                                                             </span>
281                                                         [% END %]
282                                                         [% IF ( OPACAmazonCoverImages ) %]
283                                                             [% IF ( SEARCH_RESULT.normalized_isbn ) %]
284                                                                     <span title="[% SEARCH_RESULT.biblionumber | html %]" id="amazon-thumbnail[% loop.count | html %]"><img src="https://images-na.ssl-images-amazon.com/images/P/[% SEARCH_RESULT.normalized_isbn | html %].01.TZZZZZZZ.jpg" alt="" class="item-thumbnail" /></span>
285                                                             [% ELSE %]
286                                                                 <span class="no-image">No cover image available</span>
287                                                             [% END %]
288                                                         [% END %]
289
290                                                         [% IF ( SyndeticsEnabled && SyndeticsCoverImages ) %]
291                                                             [% IF ( SEARCH_RESULT.normalized_isbn || SEARCH_RESULT.normalized_upc || SEARCH_RESULT.normalized_oclc ) %]
292                                                                     <span title="[% SEARCH_RESULT.biblionumber | html %]" id="syndetics-thumbnail[% loop.count | html %]"><img src="https://secure.syndetics.com/index.aspx?isbn=[% SEARCH_RESULT.normalized_isbn | html %]/SC.GIF&amp;client=[% SyndeticsClientCode | html %]&amp;type=xw10&amp;upc=[% SEARCH_RESULT.normalized_upc | html %]&amp;oclc=[% SEARCH_RESULT.normalized_oclc | html %]" alt="" class="item-thumbnail" /></span>
293                                                             [% ELSE %]
294                                                                 <span class="no-image">No cover image available</span>
295                                                             [% END %]
296                                                         [% END %]
297
298                                                         [% IF ( GoogleJackets ) %]
299                                                             [% IF ( SEARCH_RESULT.normalized_isbn ) %]
300                                                                 <span title="[% SEARCH_RESULT.biblionumber |url %]" class="[% SEARCH_RESULT.normalized_isbn | html %]" id="gbs-thumbnail[% loop.count | html %]"></span>
301                                                             [% ELSE %]
302                                                                 <span class="no-image">No cover image available</span>
303                                                             [% END %]
304                                                         [% END %]
305
306                                                         [% IF ( Koha.Preference('OpacCoce') && Koha.Preference('CoceProviders') ) %]
307                                                           [% coce_id = SEARCH_RESULT.normalized_ean || SEARCH_RESULT.normalized_isbn | html %]
308                                                           [% IF ( coce_id ) %]
309                                                             <span title="[% SEARCH_RESULT.biblionumber |url %]" class="[% coce_id | html %]" id="coce-thumbnail[% loop.count | html %]"></span>
310                                                           [% ELSE %]
311                                                             <span class="no-image">No cover image available</span>
312                                                           [% END %]
313                                                         [% END %]
314
315                                                         [% IF OpenLibraryCovers %]
316                                                             [% IF SEARCH_RESULT.normalized_isbn %]
317                                                                 <span title="[% SEARCH_RESULT.biblionumber | html %]" class="[% SEARCH_RESULT.normalized_isbn | html %]" id="openlibrary-thumbnail[% loop.count | html %]"></span>
318                                                             [% ELSE %]
319                                                                 <span class="no-image">No cover image available</span>
320                                                             [% END %]
321                                                         [% END %]
322
323                                                         [% IF ( BakerTaylorEnabled && !BakerTaylorBookstoreURL ) %]
324                                                             [% bt_id = ( SEARCH_RESULT.normalized_upc || SEARCH_RESULT.normalized_isbn ) %]
325                                                             [% IF ( bt_id ) %]
326                                                                 <img alt="See Baker &amp; Taylor" src="[% BakerTaylorImageURL | html %][% bt_id | html %]" />
327                                                             [% ELSE %]
328                                                                 <span class="no-image">No cover image available</span>
329                                                             [% END %]
330                                                         [% END %]
331                                                     </a>
332
333                                                     [% IF ( BakerTaylorEnabled && BakerTaylorBookstoreURL ) %]
334                                                         [% bt_id = ( SEARCH_RESULT.normalized_upc || SEARCH_RESULT.normalized_isbn ) %]
335                                                         [% IF ( bt_id ) %]
336                                                             <a href="https://[% BakerTaylorBookstoreURL | url %][% bt_id | url %]">
337                                                                 <img alt="See Baker &amp; Taylor" src="[% BakerTaylorImageURL | html %][% bt_id | html %]" />
338                                                             </a>
339                                                         [% ELSE %]
340                                                             <span class="no-image">No cover image available</span>
341                                                         [% END %]
342                                                     [% END %]
343
344                                                     [% IF Koha.Preference('OPACCustomCoverImages') AND Koha.Preference('CustomCoverImagesURL') %]
345                                                          [% IF ( OPACURLOpenInNewWindow ) %]
346                                                             <a class="custom_cover_image" href="[% SEARCH_RESULT.biblio_object.custom_cover_image_url | url %]" target="_blank" rel="noreferrer"><img alt="Cover image" src="[% SEARCH_RESULT.biblio_object.custom_cover_image_url | url %]" /></a>
347                                                         [% ELSE %]
348                                                             <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 %]" /></a>
349                                                         [% END %]
350                                                     [% END %]
351
352                                                 </div>
353                                                 [% IF ( COinSinOPACResults && SEARCH_RESULT.coins ) %]
354                                                     <!-- COinS / Openurl -->
355                                                     <span class="Z3988" title="[% SEARCH_RESULT.coins | html %]"></span>
356                                                 [% END %]
357                                                 <div id="title_summary_[% SEARCH_RESULT.biblionumber | html %]" class="title_summary">
358                                                 [% IF ( OPACXSLTResultsDisplay ) %]
359                                                     [% SEARCH_RESULT.XSLTResultsRecord | $raw %]
360                                                 [% ELSE %]
361                                                     [% IF ( BiblioDefaultViewmarc ) %]
362                                                         <a class="title" href="/cgi-bin/koha/opac-MARCdetail.pl?biblionumber=[% SEARCH_RESULT.biblionumber | url %]" title="View details for this title">
363                                                     [% ELSE %]
364                                                         [% IF ( BiblioDefaultViewisbd ) %]
365                                                             <a class="title" href="/cgi-bin/koha/opac-ISBDdetail.pl?biblionumber=[% SEARCH_RESULT.biblionumber | url %]" title="View details for this title">
366                                                         [% ELSE %]
367                                                             <a class="title" href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% SEARCH_RESULT.biblionumber | url %]" title="View details for this title">
368                                                         [% END %]
369                                                     [% END %]
370
371                                                     [% INCLUDE 'biblio-title.inc' biblio=SEARCH_RESULT %]
372
373                                                     [% IF ( SEARCH_RESULT.author ) %]
374                                                         by <a href="/cgi-bin/koha/opac-search.pl?q=au:[% SEARCH_RESULT.author | url %]" title="Search for works by this author" class="author">[% SEARCH_RESULT.author | html %]</a>
375                                                     [% ELSE %]
376                                                         &nbsp;
377                                                     [% END %]
378
379                                                     <span class="results_summary publisher">
380                                                         <span class="label">Publication:</span>
381                                                             [% IF ( SEARCH_RESULT.place ) %][% SEARCH_RESULT.place | html %] [% END %]
382                                                             [% IF ( SEARCH_RESULT.publishercode ) %][% SEARCH_RESULT.publishercode | html %][% END %]
383                                                             [% IF ( SEARCH_RESULT.publicationyear ) %]
384                                                                 [% SEARCH_RESULT.publicationyear | html %]
385                                                             [% ELSE %]
386                                                                 [% IF ( SEARCH_RESULT.copyrightdate ) %]
387                                                                     [% SEARCH_RESULT.copyrightdate | html %]
388                                                                 [% END %]
389                                                             [% END %]
390                                                             [% IF ( SEARCH_RESULT.pages ) %]. [% SEARCH_RESULT.pages | html %][% END %]
391                                                             [% IF ( SEARCH_RESULT.notes ) %], [% SEARCH_RESULT.notes | html %][% END %]
392                                                             [% IF ( SEARCH_RESULT.size ) %] [% SEARCH_RESULT.size | html %][% END %]
393                                                             [% IF ( SEARCH_RESULT.timestamp ) %] <i>(modified on [% SEARCH_RESULT.timestamp | html %])</i>[% END %]
394                                                     </span>
395
396                                                     [% IF ( SEARCH_RESULT.summary ) %]
397                                                         <span class="result_summary">
398                                                             [% SEARCH_RESULT.summary | html %]
399                                                         </span>
400                                                     [% END %]
401
402                                                     [% IF ( SEARCH_RESULT.copyrightdate ) %]
403                                                         <span class="results_summary date">
404                                                             <span class="label">Date:</span>
405                                                             [% SEARCH_RESULT.copyrightdate | html %]
406                                                         </span>
407                                                     [% END %]
408
409                                                     <span class="results_summary">
410                                                         <span class="label">Availability:</span>
411                                                             [% IF ( SEARCH_RESULT.available_items_loop.size() ) %]
412                                                                 <span class="available"><strong>Items available:</strong>
413                                                                     [% FOREACH available_items_loo IN SEARCH_RESULT.available_items_loop %]
414                                                                         [% IF available_items_loo.this_branch %]
415                                                                             <span class="highlight-row-results">
416                                                                         [% ELSE %]
417                                                                             <span>
418                                                                         [% END %]
419
420                                                                         [% IF ( singleBranchMode ) %]
421                                                                             <span class="shelvingloc">[% available_items_loo.location | html %]</span>
422                                                                         [% ELSE %]
423                                                                             [% available_items_loo.branchname | html %]
424                                                                         [% END %]
425
426                                                                         [% IF ( OPACItemsResultsDisplay ) %]
427                                                                             [% UNLESS ( singleBranchMode ) %]<span class="shelvingloc">[% available_items_loo.location | html %]</span>[% END %]
428                                                                             [% IF ( available_items_loo.itemcallnumber ) %][<a href="/cgi-bin/koha/opac-search.pl?q=callnum:%22[% available_items_loo.itemcallnumber | url %]%22">[% available_items_loo.itemcallnumber | html %]</a>][% END %]
429                                                                         [% END %]
430                                                                         ([% available_items_loo.count | html %]),
431                                                                         </span>
432                                                                     [% END # / FOREACH available_items_loo %]
433                                                                 </span>
434                                                             [% ELSE %]
435                                                                 [% IF ( SEARCH_RESULT.ALTERNATEHOLDINGS ) %]
436                                                                     [% FOREACH ALTERNATEHOLDING IN SEARCH_RESULT.ALTERNATEHOLDINGS %]
437                                                                         &nbsp;<span id="alternateholdings">[% ALTERNATEHOLDING.holding | html %]</span>,
438                                                                     [% END %]
439                                                                 [% ELSE %]
440                                                                     <span class="unavailable">No items available:</span>
441                                                                 [% END %]
442                                                             [% END # / IF SEARCH_RESULT.available_items_loop.size %]
443
444                                                             <span class="unavailable">
445                                                                 [% IF ( SEARCH_RESULT.onloancount ) %] Checked out ([% SEARCH_RESULT.onloancount | html %]), [% END %]
446                                                                 [% IF ( SEARCH_RESULT.withdrawncount ) %] Withdrawn ([% SEARCH_RESULT.withdrawncount | html %]), [% END %]
447                                                                 [% UNLESS ( SEARCH_RESULT.hidelostitems ) %][% IF ( SEARCH_RESULT.itemlostcount ) %] Lost ([% SEARCH_RESULT.itemlostcount | html %]),[% END %][% END %]
448                                                                 [% IF ( SEARCH_RESULT.damagedcount ) %] Damaged ([% SEARCH_RESULT.damagedcount | html %]),[% END %]
449                                                                 [% IF ( SEARCH_RESULT.orderedcount ) %] On order ([% SEARCH_RESULT.orderedcount | html %]),[% END %]
450                                                                 [% IF ( SEARCH_RESULT.onholdcount ) %] On hold ([% SEARCH_RESULT.onholdcount | html %]),[% END %]
451                                                                 [% IF ( SEARCH_RESULT.intransitcount ) %] In transit ([% SEARCH_RESULT.intransitcount | html %]),[% END %]
452                                                             </span>
453                                                     </span> <!-- / .results_summary -->
454                                                 [% END # / IF OPACXSLTResultsDisplay %]
455
456                                                 [% IF ( SEARCH_RESULT.score_avg ) %]
457                                                     <div class="results_summary">
458                                                         [% FOREACH i  IN [ 1 2 3 4 5  ] %]
459                                                             [% IF ( SEARCH_RESULT.score_int >= i ) %]
460                                                                 <div class="star-rating rater-[% i | html %] star star-rating-applied star-rating-readonly star-rating-on"><a title="[% i | html %]">[% i | html %]</a></div>
461                                                             [% ELSE   %]
462                                                                 <div class="star-rating rater-[% i | html %] star star-rating-applied star-rating-readonly"><a title="[% i | html %]">[% i | html %]</a></div>
463                                                             [% END %]
464                                                         [% END %]
465                                                         <span id="babeltheque-rating_total_[% SEARCH_RESULT.biblionumber | html %]">&nbsp;&nbsp; [% SEARCH_RESULT.score_avg | html %] / 5 (on [% SEARCH_RESULT.num_scores | html %] rates)</span>
466
467                                                         [% IF ( SEARCH_RESULT.num_critics ) %]
468                                                             <span class="social_data">[% SEARCH_RESULT.num_critics | html %] Internet user critics</span>
469                                                         [% END %]
470                                                         [% IF ( SEARCH_RESULT.num_critics_pro ) %]
471                                                             <span class="social_data">[% SEARCH_RESULT.num_critics_pro | html %] Professional critics</span>
472                                                         [% END %]
473                                                         [% IF ( SEARCH_RESULT.num_videos ) %]
474                                                             <span class="social_data">[% SEARCH_RESULT.num_videos | html %] Video extracts</span>
475                                                         [% END %]
476                                                         [% IF ( SEARCH_RESULT.num_quotations ) %]
477                                                             <span class="social_data">[% SEARCH_RESULT.num_quotations | html %] Quotations</span>
478                                                         [% END %]
479                                                     </div> <!-- / .results_summary -->
480                                                 [% END # / IF SEARCH_RESULT.score_avg %]
481
482                                                 [% IF ( LibraryThingForLibrariesID ) %]
483                                                     <div class="ltfl_reviews"></div>
484                                                 [% END %]
485
486                                                 [% IF ( TagsShowEnabled && SEARCH_RESULT.TagLoop.size ) %]
487                                                     <div class="results_summary tags">
488                                                         <span class="label">Tags:</span>
489                                                         <ul>
490                                                             [% FOREACH TagLoo IN SEARCH_RESULT.TagLoop %]
491                                                                 <li>
492                                                                     <a href="/cgi-bin/koha/opac-search.pl?tag=[% TagLoo.term | url %]&amp;q=[% TagLoo.term |url %]">[% TagLoo.term | html %]</a>
493                                                                     <span class="weight">([% TagLoo.weight_total | html %])</span>
494                                                                 </li>
495                                                             [% END %]
496                                                         </ul>
497                                                     </div>
498                                                 [% END %]
499
500                                                 [% IF Koha.Preference('virtualshelves') AND SEARCH_RESULT.shelves.count %]
501                                                     <div class="results_summary shelves">
502                                                         <span class="label">Lists:</span>
503                                                         <ul>
504                                                             [% FOREACH shelf IN SEARCH_RESULT.shelves %]
505                                                                 <li>
506                                                                     <a href="/cgi-bin/koha/opac-shelves.pl?op=view&amp;shelfnumber=[% shelf.shelfnumber | uri %]">[% shelf.shelfname | html %]</a>
507                                                                     [%~ UNLESS loop.last %], [% ELSE %].[% END ~%]
508                                                                 </li>
509                                                             [% END %]
510                                                         </ul>
511                                                     </div>
512                                                 [% END %]
513
514                                                 [% IF ( SEARCH_RESULT.searchhighlightblob ) %]
515                                                     <span class="results_summary">
516                                                         <span class="label">Match:</span>
517                                                         [% SEARCH_RESULT.searchhighlightblob | html %]
518                                                     </span>
519                                                 [% END %]
520
521                                                 [% IF ( OpacStarRatings == 'all' ) %]
522                                                     <div class="results_summary ratings">
523                                                         [% SET rating_avg = SEARCH_RESULT.ratings.get_avg_rating() %]
524                                                         [% rating_avg_int = BLOCK %][% rating_avg | format("%.0f") %][% END %]
525                                                         <div class="br-wrapper br-theme-fontawesome-stars">
526                                                             <div class="br-widget br-readonly">
527                                                                 [% FOREACH i IN [ 1 2 3 4 5  ] %]
528                                                                     [% IF rating_avg_int == i %]
529                                                                         <a href="#" class="br-selected br-current"></a>
530                                                                     [% ELSIF rating_avg_int > i %]
531                                                                         <a href="#" class="br-selected"></a>
532                                                                     [% ELSE %]
533                                                                         <a href="#"></a>
534                                                                     [% END %]
535                                                                 [% END %]
536                                                             </div>
537                                                         </div>
538
539                                                         [% IF SEARCH_RESULT.ratings.count > 0  %]
540                                                             <span id="rating_total_[% SEARCH_RESULT.biblionumber | html %]">&nbsp;&nbsp;([% SEARCH_RESULT.ratings.count | html %] votes)</span>
541                                                         [% ELSE %]
542                                                             <br />
543                                                         [% END %]
544                                                     </div> <!-- / .results_summary -->
545                                                 [% END # / IF OpacStarRatings %]
546
547                                                     [% INCLUDE 'title-actions-menu.inc' items=SEARCH_RESULT %]
548
549                                                 </div>
550                                                 [% INCLUDE "openlibrary-readapi.inc" bib = SEARCH_RESULT %]
551
552                                             </td>
553                                         </tr>
554                                     [% END # / FOREACH SEARCH_RESULT %]
555                                 </table>
556                             </form> <!-- / #bookbag_form -->
557
558                             <form id="hold_form" name="hold_form" method="get" action="/cgi-bin/koha/opac-reserve.pl">
559                                 <!-- The value will be set by holdBiblioNums() in basket.js -->
560                                 <input id="hold_form_biblios" type="hidden" name="biblionumbers" value=""/>
561                             </form>
562                         </div> <!-- / .searchresults -->
563
564                         <div id="bottom-pages">[% INCLUDE 'page-numbers.inc' %]</div>
565
566                     [% END # / IF total %]
567
568                     [%# Display "Not finding what you're looking for" for suggestion or ILL %]
569                     [% IF Koha.Preference( 'suggestion' ) == 1 && ( Koha.Preference( 'AnonSuggestions' ) == 1 || loggedinusername ) || ( Koha.Preference( 'ILLModule' ) == 1 && loggedinusername ) %]
570                         <div class="suggestion">
571                             Not finding what you're looking for?
572                             <ul>
573                                 [% IF Koha.Preference( 'suggestion' ) == 1 %]
574                                     [% IF Koha.Preference( 'AnonSuggestions' ) == 1 %]
575                                         <li>Make a <a href="/cgi-bin/koha/opac-suggestions.pl?op=add">purchase suggestion</a></li>
576                                     [% ELSIF loggedinusername %]
577                                         <li>Make a <a href="/cgi-bin/koha/opac-suggestions.pl?op=add">purchase suggestion</a></li>
578                                     [% END %]
579                                 [% END %]
580                                 [% IF Koha.Preference( 'ILLModule' ) == 1 && loggedinusername %]
581                                     <li>Make an <a href="/cgi-bin/koha/opac-illrequests.pl?op=create">Interlibrary loan request</a></li>
582                                 [% END %]
583                             </ul>
584                         </div>
585                     [% END %]
586                     </div> <!-- / #userresults -->
587                 </div> <!-- /.span10/12 -->
588             </div> <!-- / .row-fluid -->
589         </div> <!-- / .container-fluid -->
590     </div><!-- / .main -->
591
592 [% INCLUDE 'opac-bottom.inc' %]
593 [% BLOCK jsinclude %]
594 [% IF ( LibraryThingForLibrariesID ) %]
595     <script src="https://ltfl.librarything.com/forlibraries/widget.js?id=[% LibraryThingForLibrariesID | html %]&amp;systype=koha"></script>
596 [% END %]
597 [% IF ( OverDriveEnabled ) %][% Asset.js("js/overdrive.js") | $raw %][% END %]
598 [% IF ( RecordedBooksEnabled ) %][% Asset.js("js/recordedbooks.js") | $raw %][% END %]
599 [% Asset.js("lib/jquery/plugins/jquery.checkboxes.min.js") | $raw %]
600 [% Asset.js("js/authtoresults.js") | $raw %]
601 [% Asset.js("lib/hc-sticky.js") | $raw %]
602 [% IF ( OpacHighlightedWords ) %][% Asset.js("lib/jquery/plugins/jquery.highlight-3.js") | $raw %]
603 [% END %]<script>
604 [% IF ( Koha.Preference( 'opacuserlogin' ) == 1 ) && ( Koha.Preference( 'RequestOnOpac' ) == 1 ) %]
605 function holdMultiple() {
606     var checkedBiblioNums = ""; // Separated by "/"
607     var checkedCount = 0;
608     if(document.bookbag_form.biblionumber.length > 0) {
609         for (var i=0; i < document.bookbag_form.biblionumber.length; i++) {
610             if (document.bookbag_form.biblionumber[i].checked) {
611                 checkedBiblioNums += (document.bookbag_form.biblionumber[i].value + "/");
612                 checkedCount++;
613             }
614         }
615     }
616
617     if (checkedCount > 0) {
618         holdBiblioNums(checkedBiblioNums);
619     } else {
620         alert(MSG_NO_RECORD_SELECTED);
621     }
622 }
623
624 function holdBiblioNums(numList) {
625     // numList: biblio numbers separated by "/"
626     $("#hold_form_biblios").attr("value", numList);
627     $("#hold_form").submit();
628 }[% END %]
629
630 [% IF ( TagsInputEnabled && loggedinusername ) %]
631 function tagSelected() {
632     var checkedBoxes = $(".searchresults :checkbox:checked");
633     if ($(checkedBoxes).size() == 0) {
634         alert(MSG_NO_RECORD_SELECTED);
635     } else {
636         $("#tagsel_tag").hide();
637         $(".resort").hide();
638         $("#tagsel_form").show();
639     }
640 }
641
642 function tagCanceled() {
643     $("#tagsel_form").hide();
644     $("#tagsel_tag").show();
645     $(".resort").show();
646     $("#tagsel_new").val("");
647     $("#tagsel_status, .tagstatus").empty().hide();
648 }
649
650 function tagAdded() {
651     var checkedBoxes = $(".searchresults :checkbox:checked");
652     if ($(checkedBoxes).size() == 0) {
653         alert(MSG_NO_RECORD_SELECTED);
654         return false;
655     }
656
657     var tag = $("#tagsel_new").val();
658     if (!tag || (tag == "")) {
659         alert(MSG_NO_TAG_SPECIFIED);
660         return false;
661     }
662
663     var bibs = [];
664     for (var i = 0; i < $(checkedBoxes).size(); i++) {
665         var box = $(checkedBoxes).get(i);
666         bibs[i] = $(box).val();
667     }
668
669     KOHA.Tags.add_multitags_button(bibs, tag);
670     return false;
671 }[% END %]
672
673
674 function enableCheckboxActions(){
675     // Enable/disable controls if checkboxes are checked
676     var checkedBoxes = $(".checkboxed input:checkbox:checked");
677     var controls = $("#selections-toolbar .links a, #selections-toolbar .links input, #selections-toolbar .links select, #selections-toolbar .links label, #selections-toolbar .links button");
678     if ($(checkedBoxes).size()) {
679       $("#selections").html(_("With selected titles: "));
680       $(controls).removeClass("disabled");
681     } else {
682       $("#selections").html(_("Select titles to: "));
683       $(controls).addClass("disabled");
684     }
685 }
686
687 [% IF ( OpacHighlightedWords ) %]
688 var q_array = new Array();  // holds search terms if available
689
690 function highlightOff() {
691     $("td").removeHighlight();
692     $(".highlight_toggle").toggle();
693 }
694 function highlightOn() {
695     var x;
696     for (x in q_array) {
697         q_array[x] = q_array[x].replace(/\w*:([\w])/, "$1");
698         q_array[x] = q_array[x].toLowerCase();
699         var myStopwords = "[% Koha.Preference('NotHighlightedWords') | html %]".toLowerCase().split('|');
700         if ( (q_array[x].length > 0) && ($.inArray(q_array[x], myStopwords) == -1) ) {
701             $(".title").highlight(q_array[x]);
702             $(".author").highlight(q_array[x]);
703             $(".results_summary").highlight(q_array[x]);
704         }
705     }
706     $(".highlight_toggle").toggle();
707 }
708 [% END %]
709 $(document).ready(function(){
710
711     $(".moretoggle").click(function(e){
712         e.preventDefault();
713         $(this).siblings(".collapsible-facet").toggle();
714         $(this).siblings(".moretoggle").toggle();
715         $(this).toggle();
716     });
717
718     [% IF ( OpacHighlightedWords ) %]
719         $('a.title').each(function() {
720             $(this).attr("href", $(this).attr("href") + "&query_desc=[% query_desc | uri %]");
721         });
722     [% END %]
723
724     $(".cb").click(function(){
725       enableCheckboxActions();
726     });
727     enableCheckboxActions();
728
729     $(".br-readonly a").on("click", function(e){
730         e.preventDefault();
731     });
732
733     var param1 = "";
734     [% IF ( ( Koha.Preference( 'opacbookbag' ) == 1 ) || ( Koha.Preference( 'virtualshelves' ) == 1 ) || loggedinusername ) %]
735     param1 += "<span id=\"selections\">"+_("Select titles to: ")+"</span>";
736     [% END %]
737
738 [% IF Koha.Preference( 'opacbookbag' ) == 1 OR Koha.Preference('virtualshelves') %]
739     param1 += "<select class=\"disabled\" name=\"addto\" id=\"addto\"><option>"+_("Add to...")+"</option>";
740
741     [% IF Koha.Preference( 'opacbookbag' ) == 1 %]
742         param1 += "<option value=\"addtocart\">"+_("Cart")+"<\/option>";
743     [% END %]
744     [% IF Koha.Preference('virtualshelves') %]
745         [% IF loggedinusername AND add_to_some_private_shelves.count %]
746             param1 += "<optgroup label=\""+_("Your lists:")+"\">";
747             [% SET number_of_private_shelves = 0 %]
748             [% FOREACH s IN add_to_some_private_shelves %]
749                 [% IF shelfnumber != s.shelfnumber %]
750                     param1 += "<option id=\"s[% s.shelfnumber | html %]\" value=\"addtolist\">[% s.shelfname | html %]<\/option>";
751                     [% SET number_of_private_shelves = number_of_private_shelves + 1 %]
752                     [% IF number_of_private_shelves == 10 %][% LAST %][% END %]
753                 [% END %]
754             [% END %]
755             param1 += "<\/optgroup>";
756         [% END %]
757         [% IF add_to_some_public_shelves.count %]
758             param1 += "<optgroup label=\""+_("Public lists:")+"\">";
759             [% SET number_of_public_shelves = 0 %]
760             [% FOREACH s IN add_to_some_public_shelves %]
761                 [% IF shelfnumber != s.shelfnumber %]
762                     param1 += "<option id=\"s[% s.shelfnumber | html %]\" value=\"addtolist\">[% s.shelfname | html %]<\/option>";
763                     [% SET number_of_public_shelves = number_of_public_shelves + 1 %]
764                     [% IF number_of_public_shelves == 10 %][% LAST %][% END %]
765                 [% END %]
766             [% END %]
767             param1 += "<\/optgroup>";
768         [% END %]
769         [% IF ( add_to_some_private_shelves and add_to_some_private_shelves.count > 10 ) or ( add_to_some_public_shelves and add_to_some_public_shelves.count > 10 ) %]
770             param1 += "<option value=\"morelists\">[ "+_("More lists")+" ]<\/option>";
771         [% END %]
772         param1 +="<option value=\"newlist\">"+_("[ New list ]")+"<\/option>"
773     [% END %]
774     param1 += "<\/select> <input type=\"submit\" class=\"btn btn-small\" value=\""+_("Save")+"\" />";
775 [% END %]
776
777     $('.resort').change(function() {
778         $('#bookbag_form').submit();
779     });
780
781     $('#results_per_page').change(function() {
782         $('#bookbag_form').submit();
783     });
784
785     $("span.clearall").html("<a id=\"CheckNone\" href=\"#\">"+_("Clear all")+"<\/a>");
786     $("span.checkall").html("<a id=\"CheckAll\" href=\"#\">"+_("Select all")+"<\/a>");
787
788 [% IF Koha.Preference( 'opacbookbag' ) == 1 %]
789     $("span.addto").html(param1);
790 [% ELSE %]
791     [% IF ( ( Koha.Preference( 'virtualshelves' ) == 1 ) && loggedinusername ) %]
792         $("span.addto").html(param1);
793     [% END %]
794 [% END %]
795
796 [% IF ( ( Koha.Preference( 'opacbookbag' ) == 1 ) || ( Koha.Preference( 'virtualshelves' ) == 1 ) ) %]
797     [% IF Koha.Preference( 'virtualshelves' ) == 1 %]
798         $("#addto").on("change",function(){
799             cartList();
800         });
801         $(".addto").find("input:submit").click(function(){
802             cartList();
803             return false;
804         });
805     [% ELSE %]
806         $("#addto").on("click",function(){
807             cartList();
808             return false;
809         });
810     [% END %]
811 [% END %]
812
813     function cartList(){
814         addtoOption = $("#addto").find("option:selected");
815         addtoval = addtoOption.val();
816         if(addtoval == "addtolist"){
817             var shelfnumber = addtoOption.attr("id").replace("s","");
818             if (vShelfAdd()) {
819                 Dopop('/cgi-bin/koha/opac-addbybiblionumber.pl?selectedshelf='+shelfnumber+'&' + vShelfAdd());
820             }
821             return false;
822         } else if(addtoval == "newlist"){
823             [% IF ( loggedinusername ) %]if (vShelfAdd()) {
824                 Dopop('/cgi-bin/koha/opac-addbybiblionumber.pl?newshelf=1&' + vShelfAdd());
825             }[% ELSE %]
826                 alert(_("You must be logged in to create or add to lists"));
827             [% END %]
828             return false;
829         } else if(addtoval == "morelists"){
830             [% IF ( loggedinusername ) %]
831                 if (vShelfAdd()) {
832                     Dopop('/cgi-bin/koha/opac-addbybiblionumber.pl?' + vShelfAdd());
833                 }
834             [% ELSE %]
835                 alert(_("You must be logged in to create or add to lists"));
836             [% END %]
837             return false;
838         }
839         if(addtoval == "addtocart" || $("#addto").attr("class") == "addtocart"){
840             addMultiple();
841             return false;
842          }
843     }
844     $("#CheckAll").click(function(){
845         $("#bookbag_form").checkCheckboxes();
846         enableCheckboxActions();
847         return false;
848     });
849     $("#CheckNone").click(function(){
850         $("#bookbag_form").unCheckCheckboxes();
851         enableCheckboxActions();
852         return false;
853     });
854
855 [% IF ( ( Koha.Preference( 'RequestOnOpac' ) == 1 ) && ( Koha.Preference( 'opacuserlogin' ) == 1 ) && DisplayMultiPlaceHold ) %]
856     $("#placehold").html("<button class=\"btn btn-link hold disabled\" type=\"submit\"><i class=\"fa fa-fw fa-bookmark\"></i>" + _("Place hold") + "</button>");
857     $("#placehold").find("button.hold").click(function(){
858         holdMultiple();
859         return false;
860     });
861 [% END %]
862
863 [% IF ( query_desc ) %]
864     var query_desc = "[% query_desc |replace("'", "\'") |replace('\n', '\\n') |replace('\r', '\\r') | html %]";
865     var querystring = "[% querystring |replace("'", "\'") |replace('\n', '\\n') |replace('\r', '\\r') | html %]";
866     [% IF ( OpacHighlightedWords ) %]
867         q_array = query_desc.split(" ");
868         // ensure that we don't have "" at the end of the array, which can
869         // break the highlighter
870         while (q_array.length > 0 && q_array[q_array.length-1] == "") {
871             q_array = q_array.splice(0,-1);
872         }
873         highlightOn();
874         $("#highlight_toggle_on" ).hide().click(function() {highlightOn() ;});
875         $("#highlight_toggle_off").show().click(function() {highlightOff();});
876     [% END %]
877     [% IF ( OverDriveEnabled ) %]
878         var $overdrive_results = $( '<div id="overdrive-results">' + MSG_SEARCHING.format('OverDrive') + ' <img class="throbber" src="[% interface | html %]/lib/jquery/plugins/themes/classic/throbber.gif" /></div>' );
879         $( '#numresults' ) .append( ' ' )
880             .append( $overdrive_results );
881         KOHA.OverDrive.Search( "[% Koha.Preference('OverDriveLibraryID') | html %]", querystring, 1, 0, function( data ) {
882             if ( data.error ) {
883                 $overdrive_results.html( MSG_ERROR_SEARCHING_COLLECTION.format('OverDrive') );
884                 return;
885             }
886
887             if ( data.totalItems ) {
888                 $overdrive_results.html( '<a href="/cgi-bin/koha/opac-overdrive-search.pl?q=' + escape( querystring ) + '">' + MSG_RESULTS_FOUND_IN_COLLECTION.format(data.totalItems, 'OverDrive') + '</a>' );
889             } else {
890                 $overdrive_results.remove();
891             }
892         } );
893     [% END %]
894     [% IF ( RecordedBooksEnabled ) %]
895         var $recordedbooks_results = $( '<div id="recordedbooks-results">' + MSG_SEARCHING.format('RecordedBooks') + ' <img class="throbber" src="[% interface | html %]/lib/jquery/plugins/themes/classic/throbber.gif" /></div>' );
896         $( '#numresults' ) .append( ' ' )
897             .append( $recordedbooks_results );
898         KOHA.RecordedBooks.search( querystring, [% OPACnumSearchResults || "null" | html %], null, function( data ) {
899             if ( data.error ) {
900                 $recordedbooks_results.html( MSG_ERROR_SEARCHING_COLLECTION.format('RecordedBooks')  + ': ' + data.error);
901                 return;
902             }
903
904             // data.total can be either 42 or "60+"
905             if ( typeof(data.total) === 'string' && data.total.charAt(0) > 0 || typeof(data.total) === 'number' && data.total > 0 ) {
906                 $recordedbooks_results.html( '<a href="/cgi-bin/koha/opac-recordedbooks-search.pl?q=' + escape( querystring ) + '">' + MSG_RESULTS_FOUND_IN_COLLECTION.format(data.total, 'RecordedBooks') + '</a>' );
907             } else {
908                 $recordedbooks_results.remove();
909             }
910         } );
911     [% END %]
912     [% IF ( OpenLibrarySearch ) %]
913         var $openlibrary_results = $( '<div id="openlibrary-results">' + MSG_SEARCHING.format('OpenLibrary' ) + ' <img class="throbber" src="[% interface | html %]/lib/jquery/plugins/themes/classic/throbber.gif" /></div>' );
914         $( '#numresults' ) .append( ' ' )
915             .append( $openlibrary_results );
916         KOHA.OpenLibrary.search( querystring, null, function( data ) {
917             if ( data.error ) {
918                 $openlibrary_results.html( MSG_ERROR_SEARCHING_COLLECTION.format('OpenLibrary') );
919                 return;
920             }
921
922             if ( data.numFound > 0 ) {
923                 $openlibrary_results.html( '<a href="' + KOHA.OpenLibrary.searchUrl(querystring) + '" target="openlibrary">'  + MSG_RESULTS_FOUND_IN_COLLECTION.format(data.numFound, 'OpenLibrary') + '</a>' );
924             } else {
925                 $openlibrary_results.remove();
926             }
927         } );
928     [% END %]
929 [% END %]
930
931 [% IF ( TagsInputEnabled && loggedinusername ) %]
932     $("#tagsel_tag").show().click(function(){
933         tagSelected();
934         return false;
935     });
936     $("#tagsel_cancel").click(function(){
937         tagCanceled();
938         return false;
939     });
940     $("#tagsel_button").click(function(){
941         tagAdded();
942         return false;
943     });
944
945     $(".tag_add").click(function(){
946         var thisid = $(this).attr("id");
947         thisid = thisid.replace("tag_add","");
948         $(this).addClass("hidden");
949         $("#tagform"+thisid).show();
950         $("#newtag"+thisid).focus();
951         $("#newtag"+thisid+"_status").empty().hide();
952         return false;
953     });
954     $(".cancel_tag_add").click(function(){
955         var thisid = $(this).attr("id");
956         thisid = thisid.replace("cancel","");
957         $("#tagform"+thisid).hide();
958         $("#tag_add"+thisid).removeClass("hidden");
959         $("#newtag"+thisid).val("");
960         $("#newtag"+thisid+"_status").empty().hide();
961         return false;
962     });
963     $(".tagbutton").click(function(){
964         var thisid = $(this).attr("title");
965         var tag = $("#newtag"+thisid).val();
966         if (!tag || (tag == "")) {
967             alert(MSG_NO_TAG_SPECIFIED);
968             return false;
969         }
970         KOHA.Tags.add_tag_button(thisid, tag);
971         return false;
972     });
973 [% END %]
974
975 [% IF OpenLibraryCovers %]KOHA.OpenLibrary.GetCoverFromIsbn();[% END %]
976 [% IF OPACLocalCoverImages %]KOHA.LocalCover.GetCoverFromBibnumber(false);[% END %]
977 [% IF ( GoogleJackets ) %]KOHA.Google.GetCoverFromIsbn();[% END %]
978 [% IF ( Koha.Preference('OpacCoce') && Koha.Preference('CoceProviders') ) %]
979     KOHA.coce.getURL('[% Koha.Preference('CoceHost') | html %]', '[% Koha.Preference('CoceProviders') | html %]');
980 [% END %]
981
982 [% IF ( DidYouMean ) %]
983     $("#didyoumean").load("/cgi-bin/koha/svc/suggestion?render=stub&q=[% querystring |uri %]",
984         function() {
985             $(this).addClass("dym-loaded");
986         });
987 [% END %]
988
989 $("input.newtag").on('keydown', function(e){
990     if (e.keyCode == 13) { e.preventDefault(); }
991 });
992
993     Sticky = $("#floating");
994     Sticky.hcSticky({
995         stickTo: ".searchresults",
996         stickyClass: "floating"
997     });
998
999 });
1000 </script>
1001 [% END %]