Bug 21850: (follow-up) Add query information in title attribute
[srvgit] / koha-tmpl / opac-tmpl / bootstrap / en / modules / opac-results.tt
index e711428..e35af15 100644 (file)
@@ -3,11 +3,17 @@
 [% USE Koha %]
 [% SET TagsShowEnabled = ( ( Koha.Preference( 'TagsEnabled' ) == 1 ) && TagsShowOnList ) %]
 [% SET TagsInputEnabled = ( ( Koha.Preference( 'opacuserlogin' ) == 1 ) && ( Koha.Preference( 'TagsEnabled' ) == 1 ) && TagsInputOnList ) %]
+[% SET AdlibrisEnabled = Koha.Preference('AdlibrisCoversEnabled') %]
+[% SET AdlibrisURL = Koha.Preference('AdlibrisCoversURL') %]
 
 [% INCLUDE 'doc-head-open.inc' %]
 <title>[% IF ( LibraryNameTitle ) %][% LibraryNameTitle | html %][% ELSE %]Koha online[% END %] catalog &rsaquo;
 [% IF ( searchdesc ) %]
-    Results of search [% IF ( query_desc ) %]for '[% query_desc | html %]'[% END %][% IF ( limit_desc ) %]&nbsp;with limit(s):&nbsp;'[% limit_desc | html %]'[% END %]
+    [% IF ( ms_value ) %]
+        Results of search for '[% ms_value | html %]'
+    [% ELSE %]
+        Search results
+    [% END %]
 [% ELSE %]
     You did not specify any search criteria.
 [% END %]</title>
@@ -18,7 +24,7 @@
     [% END %]
 [% END %]
 
-<link rel="alternate" type="application/rss+xml" title="[% LibraryName | html %] Search RSS feed" href="[% OPACBaseURL | html %]/cgi-bin/koha/opac-search.pl?[% query_cgi | url %][% limit_cgi |uri %]&amp;count=[% countrss |uri %]&amp;sort_by=acqdate_dsc&amp;format=rss2" />
+<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=rss2" />
 </head>
 
 [% INCLUDE 'bodytag.inc' bodyid='results' bodyclass='scrollto' %]
     <div class="main">
         <ul class="breadcrumb">
             <li><a href="/cgi-bin/koha/opac-main.pl">Home</a> <span class="divider">&rsaquo;</span></li>
-            <li>
                 [% IF ( searchdesc ) %]
-                    <a href="#">Results of search [% IF ( query_desc ) %]for '[% query_desc | html %]'[% END %][% IF ( limit_desc ) %]&nbsp;with limit(s):&nbsp;'[% limit_desc | html %]'[% END %]</a>
+                    [% IF ( ReturnPath ) %]
+                        <li>
+                            <a href="[% ReturnPath | url %]">Advanced search</a> <span class="divider">&rsaquo;</span>
+                        </li>
+                    [% END %]
+                    <li>
+                        [% IF ( ms_value ) %]
+                            <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>
+                        [% ELSE %]
+                            <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>
+                        [% END %]
+                    </li>
                 [% ELSE %]
-                    <a href="#">You did not specify any search criteria</a>
+                    <li>
+                        <a href="#">You did not specify any search criteria</a>
+                    </li>
                 [% END %]
-            </li>
         </ul>
 
         [% UNLESS ( total ) %]
                         <strong>No results found!</strong>
                         <p>
                             [% IF ( searchdesc ) %]
-                                No results found for that in [% LibraryName | html %] catalog. <a href="[% OPACBaseURL | html %]/cgi-bin/koha/opac-search.pl?[% query_cgi | url %][% limit_cgi | html | url %]&amp;format=rss2" class="rsssearchlink noprint"><img src="[% interface | html %]/[% theme | html %]/images/feed-icon-16x16.png" alt="Subscribe to this search" title="Subscribe to this search" border="0" class="rsssearchicon"/></a>
+                                No results found for that in [% LibraryName | html %] catalog. <a href="[% OPACBaseURL | url %]/cgi-bin/koha/opac-search.pl?[% query_cgi | $raw %][% limit_cgi | $raw %]&amp;format=rss2" class="rsssearchlink noprint"><img src="[% interface | html %]/[% theme | html %]/images/feed-icon-16x16.png" alt="Subscribe to this search" title="Subscribe to this search" border="0" class="rsssearchicon"/></a>
                             [% ELSE %]
                                 You did not specify any search criteria.
                             [% END %]
                         </p>
                         [% IF ( ReturnPath ) %]
                            <div class="returntosearch">
-                                <p><a href="[% ReturnPath | html %]">Return to the last advanced search</a></p>
+                                <p><a href="[% ReturnPath | url %]">Return to the last advanced search</a></p>
                             </div>
                         [% END %]
                         [% IF ( OPACNoResultsFound ) %]
                                 [% END %]
                             ).
                         [% END %]
-                        <a href="[% OPACBaseURL | html %]/cgi-bin/koha/opac-search.pl?[% query_cgi | url %][% limit_cgi |html | url %]&amp;count=[% countrss | html %]&amp;sort_by=acqdate_dsc&amp;format=rss2" class="rsssearchlink noprint"><img src="[% interface | html %]/[% theme | html %]/images/feed-icon-16x16.png" alt="Subscribe to this search" title="Subscribe to this search" class="rsssearchicon"/></a>
+                        <a 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=rss2" class="rsssearchlink noprint"><img src="[% interface | html %]/[% theme | html %]/images/feed-icon-16x16.png" alt="Subscribe to this search" title="Subscribe to this search" class="rsssearchicon"/></a>
                     [% END # / IF total %]
                     </p>
                 [% END # / IF searchdesc %]
                         <ul style="list-style: none;">
                             [% FOREACH SPELL_SUGGES IN SPELL_SUGGEST %]
                             <li>
-                                <a href="/cgi-bin/koha/opac-search.pl?q=[% SPELL_SUGGES.spsuggestion | html %]">[% SPELL_SUGGES.spsuggestion | html %]</a>
+                                <a href="/cgi-bin/koha/opac-search.pl?q=[% SPELL_SUGGES.spsuggestion | uri %]">[% SPELL_SUGGES.spsuggestion | html %]</a>
                             </li>
                             [% END %]
                         </ul>
                     [% IF ( total ) %]
                         [% IF ( ReturnPath ) %]
                             <div class="returntosearch">
-                                <p><a href="[% ReturnPath | html %]">Return to the last advanced search</a></p>
+                                <p><a href="[% ReturnPath | url %]">Return to the last advanced search</a></p>
                             </div>
                         [% END %]
                     [% END %]
                                                 </span>
                                                 <div id="tagsel_form" style="display:none">
                                                     <label for="tagsel_new">New tag:</label>
-                                                    <input name="tagsel_new" id="tagsel_new" maxlength="100" />
+                                                    <input type="text" name="tagsel_new" id="tagsel_new" maxlength="100" />
                                                     <input id="tagsel_button" name="tagsel_button" class="tagsel_button btn btn-small" title="Add" type="submit" value="Add" />
                                                     <a href="#" id="tagsel_cancel">(done)</a>
                                                 </div>
                                                         [% IF ( OPACLocalCoverImages ) %]
                                                             <span title="[% SEARCH_RESULT.biblionumber |url %]" class="[% SEARCH_RESULT.biblionumber | html %]" id="local-thumbnail[% loop.count | html %]"></span>
                                                         [% END %]
+
+                                                        [% IF ( AdlibrisEnabled && SEARCH_RESULT.normalized_isbn ) %]
+                                                            <span title="[% SEARCH_RESULT.biblionumber | html %]" id="adlibris-thumbnail[% loop.count | html %]">
+                                                                <img src="[% AdlibrisURL | html %]?isbn=[% SEARCH_RESULT.normalized_isbn | html %]"
+                                                                     alt="Adlibris thumbnail for ISBN: [% SEARCH_RESULT.normalized_isbn | html %]" class="adlibris-cover" />
+                                                            </span>
+                                                        [% END %]
                                                         [% IF ( OPACAmazonCoverImages ) %]
                                                             [% IF ( SEARCH_RESULT.normalized_isbn ) %]
                                                                     <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>
                                                         [% END %]
 
                                                         [% IF ( Koha.Preference('Coce') && Koha.Preference('CoceProviders') ) %]
-                                                          [% coce_id = SEARCH_RESULT.normalized_ean || SEARCH_RESULT.normalized_isbn | html %]
+                                                          [% coce_id = SEARCH_RESULT.normalized_ean || SEARCH_RESULT.normalized_isbn %]
                                                           [% IF ( coce_id ) %]
                                                             <span title="[% SEARCH_RESULT.biblionumber |url %]" class="[% coce_id | html %]" id="coce-thumbnail[% loop.count | html %]"></span>
                                                           [% ELSE %]
                                                         [% END %]
 
                                                         [% IF ( BakerTaylorEnabled && !BakerTaylorBookstoreURL ) %]
-                                                            [% bt_id = ( SEARCH_RESULT.normalized_upc || SEARCH_RESULT.normalized_isbn ) | html %]
+                                                            [% bt_id = ( SEARCH_RESULT.normalized_upc || SEARCH_RESULT.normalized_isbn ) %]
                                                             [% IF ( bt_id ) %]
                                                                 <img alt="See Baker &amp; Taylor" src="[% BakerTaylorImageURL | html %][% bt_id | html %]" />
                                                             [% ELSE %]
                                                     </a>
 
                                                     [% IF ( BakerTaylorEnabled && BakerTaylorBookstoreURL ) %]
-                                                        [% bt_id = ( SEARCH_RESULT.normalized_upc || SEARCH_RESULT.normalized_isbn ) | html %]
+                                                        [% bt_id = ( SEARCH_RESULT.normalized_upc || SEARCH_RESULT.normalized_isbn ) %]
                                                         [% IF ( bt_id ) %]
-                                                            <a href="https://[% BakerTaylorBookstoreURL | html %][% bt_id | html %]">
+                                                            <a href="https://[% BakerTaylorBookstoreURL | uri %][% bt_id | uri %]">
                                                                 <img alt="See Baker &amp; Taylor" src="[% BakerTaylorImageURL | html %][% bt_id | html %]" />
                                                             </a>
                                                         [% ELSE %]
                                                     [% IF ( IDreamBooksResults && SEARCH_RESULT.normalized_isbn ) %]
                                                         <div class="idbresult" style="display: none;">
                                                             [% IF ( IDreamBooksReviews ) %]
-                                                                <a href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% SEARCH_RESULT.biblionumber | html %]#idb_critic_reviews">
+                                                                <a href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% SEARCH_RESULT.biblionumber | uri %]#idb_critic_reviews">
                                                             [% ELSE %]
-                                                                <a href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% SEARCH_RESULT.biblionumber | html %]">
+                                                                <a href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% SEARCH_RESULT.biblionumber | uri %]">
                                                             [% END %]
                                                             [% SEARCH_RESULT.normalized_isbn | html %]</a>
                                                         </div>
                                                         <span class="label">Lists:</span>
                                                             <ul>
                                                                 [% FOREACH shelf IN SEARCH_RESULT.shelves %]
-                                                                    <li><a href="/cgi-bin/koha/opac-shelves.pl?op=view&amp;shelfnumber=[% shelf.shelfnumber | html %]">[% shelf.shelfname | html %]</a></li>
+                                                                    <li><a href="/cgi-bin/koha/opac-shelves.pl?op=view&amp;shelfnumber=[% shelf.shelfnumber | uri %]">[% shelf.shelfname | html %]</a></li>
                                                                     [%~ UNLESS loop.last %], [% ELSE %].[% END ~%]
                                                                 [% END %]
                                                             </ul>
                                                         [% END # IF RequestOnOpac %]
 
                                                         [% IF ( Koha.Preference( 'opacuserlogin' ) == 1 ) %]
-                                                            [% IF Koha.Preference('ArticleRequests') %]
+                                                            [% IF SEARCH_RESULT.artreqpossible %]
                                                                 <span class="actions"><a class="article_request" href="/cgi-bin/koha/opac-request-article.pl?biblionumber=[% SEARCH_RESULT.biblionumber | html %]">Request article</a></span>
                                                             [% END %]
                                                         [% END %]
                                                         [% END # if TagsInputEnabled %]
 
                                                         [% IF ( ( Koha.Preference( 'opacuserlogin' ) == 1 ) && loggedinusername && ( Koha.Preference( 'virtualshelves' ) == 1 ) ) %]
-                                                            <span class="actions"><a class="addtoshelf" href="/cgi-bin/koha/opac-addbybiblionumber.pl?biblionumber=[% SEARCH_RESULT.biblionumber | html %]" onclick="Dopop('opac-addbybiblionumber.pl?biblionumber=[% SEARCH_RESULT.biblionumber | html %]'); return false;">Save to Lists</a></span>
+                                                            <span class="actions"><a class="addtoshelf" href="/cgi-bin/koha/opac-addbybiblionumber.pl?biblionumber=[% SEARCH_RESULT.biblionumber | html %]" onclick="Dopop('opac-addbybiblionumber.pl?biblionumber=[% SEARCH_RESULT.biblionumber | html %]'); return false;">Save to lists</a></span>
                                                         [% END %]
 
                                                         [% IF Koha.Preference( 'opacbookbag' ) == 1 %]
                                                             [% IF ( SEARCH_RESULT.incart ) %]
-                                                                <span class="actions"><a class="addtocart cart[% SEARCH_RESULT.biblionumber | html %]" href="#" onclick="addRecord('[% SEARCH_RESULT.biblionumber | html %]'); return false;">In your cart</a> <a class="cartRemove cartR[% SEARCH_RESULT.biblionumber | html %]" href="#" onclick="delSingleRecord('[% SEARCH_RESULT.biblionumber | html %]'); return false;">(remove)</a></span>
+                                                                <span class="actions"><a data-biblionumber="[% SEARCH_RESULT.biblionumber | html %]" class="addtocart cart[% SEARCH_RESULT.biblionumber | html %]" href="#">In your cart</a> <a data-biblionumber="[% SEARCH_RESULT.biblionumber | html %]" class="cartRemove cartR[% SEARCH_RESULT.biblionumber | html %]" href="#">(remove)</a></span>
                                                             [% ELSE %]
-                                                                <span class="actions"><a class="addtocart cart[% SEARCH_RESULT.biblionumber | html %]" href="#" onclick="addRecord('[% SEARCH_RESULT.biblionumber | html %]'); return false;">Add to cart</a> <a style="display:none;" class="cartRemove cartR[% SEARCH_RESULT.biblionumber | html %]" href="#" onclick="delSingleRecord('[% SEARCH_RESULT.biblionumber | html %]'); return false;">(remove)</a></span>
+                                                                <span class="actions"><a data-biblionumber="[% SEARCH_RESULT.biblionumber | html %]" class="addtocart cart[% SEARCH_RESULT.biblionumber | html %]" href="#">Add to your cart</a> <a style="display:none;" data-biblionumber="[% SEARCH_RESULT.biblionumber | html %]" class="cartRemove cartR[% SEARCH_RESULT.biblionumber | html %]" href="#">(remove)</a></span>
                                                             [% END %]
                                                         [% END # / IF opacbookbag %]
                                                 </div>
 [% END %]
 [% IF ( OpacStarRatings == 'all' || Koha.Preference('Babeltheque') ) %][% Asset.js("lib/jquery/plugins/jquery.rating.js") | $raw %][% END %]
 [% IF ( OverDriveEnabled ) %][% Asset.js("js/overdrive.js") | $raw %][% END %]
+[% IF ( RecordedBooksEnabled ) %][% Asset.js("js/recordedbooks.js") | $raw %][% END %]
 [% Asset.js("lib/jquery/plugins/jquery.checkboxes.min.js") | $raw %]
 [% Asset.js("js/authtoresults.js") | $raw %]
 [% IF ( OpacHighlightedWords ) %][% Asset.js("lib/jquery/plugins/jquery.highlight-3.js") | $raw %]
@@ -764,7 +789,7 @@ $(document).ready(function(){
                 [% IF shelfnumber != s.shelfnumber %]
                     param1 += "<option id=\"s[% s.shelfnumber | html %]\" value=\"addtolist\">[% s.shelfname | html %]<\/option>";
                     [% SET number_of_private_shelves = number_of_private_shelves + 1 %]
-                    [% IF number_of_private_shelves == 10 %][% LAST | html %][% END %]
+                    [% IF number_of_private_shelves == 10 %][% LAST %][% END %]
                 [% END %]
             [% END %]
             param1 += "<\/optgroup>";
@@ -776,7 +801,7 @@ $(document).ready(function(){
                 [% IF shelfnumber != s.shelfnumber %]
                     param1 += "<option id=\"s[% s.shelfnumber | html %]\" value=\"addtolist\">[% s.shelfname | html %]<\/option>";
                     [% SET number_of_public_shelves = number_of_public_shelves + 1 %]
-                    [% IF number_of_public_shelves == 10 %][% LAST | html %][% END %]
+                    [% IF number_of_public_shelves == 10 %][% LAST %][% END %]
                 [% END %]
             [% END %]
             param1 += "<\/optgroup>";
@@ -886,34 +911,52 @@ $(document).ready(function(){
         $("#highlight_toggle_off").show().click(function() {highlightOff();});
     [% END %]
     [% IF ( OverDriveEnabled ) %]
-        var $overdrive_results = $( '<div id="overdrive-results">' + _( 'Searching OverDrive...' ) + ' <img class="throbber" src="[% interface | html %]/lib/jquery/plugins/themes/classic/throbber.gif" /></div>' );
+        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>' );
         $( '#numresults' ) .append( ' ' )
             .append( $overdrive_results );
         KOHA.OverDrive.Search( "[% OverDriveLibraryID | html %]", querystring, 1, 0, function( data ) {
             if ( data.error ) {
-                $overdrive_results.html( _( 'Error searching OverDrive collection' ) );
+                $overdrive_results.html( MSG_ERROR_SEARCHING_COLLECTION.format('OverDrive') );
                 return;
             }
 
             if ( data.totalItems ) {
-                $overdrive_results.html( _( 'Found' ) + ' <a href="/cgi-bin/koha/opac-overdrive-search.pl?q=' + escape( querystring ) + '">' + data.totalItems + ' ' + _( 'results' ) + '</a> ' + _( 'in OverDrive collection' ) );
+                $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>' );
             } else {
                 $overdrive_results.remove();
             }
         } );
     [% END %]
+    [% IF ( RecordedBooksEnabled ) %]
+        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>' );
+        $( '#numresults' ) .append( ' ' )
+            .append( $recordedbooks_results );
+        KOHA.RecordedBooks.search( querystring, [% OPACnumSearchResults || "null" | html %], null, function( data ) {
+            if ( data.error ) {
+                $recordedbooks_results.html( MSG_ERROR_SEARCHING_COLLECTION.format('RecordedBooks')  + ': ' + data.error);
+                return;
+            }
+
+            // data.total can be either 42 or "60+"
+            if ( typeof(data.total) === 'string' && data.total.charAt(0) > 0 || typeof(data.total) === 'number' && data.total > 0 ) {
+                $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>' );
+            } else {
+                $recordedbooks_results.remove();
+            }
+        } );
+    [% END %]
     [% IF ( OpenLibrarySearch ) %]
-        var $openlibrary_results = $( '<div id="openlibrary-results">' + _( 'Searching Open Library...' ) + ' <img class="throbber" src="[% interface | html %]/lib/jquery/plugins/themes/classic/throbber.gif" /></div>' );
+        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>' );
         $( '#numresults' ) .append( ' ' )
             .append( $openlibrary_results );
         KOHA.OpenLibrary.search( querystring, null, function( data ) {
             if ( data.error ) {
-                $openlibrary_results.html( _( 'Error searching OpenLibrary collection' ) );
+                $openlibrary_results.html( MSG_ERROR_SEARCHING_COLLECTION.format('OpenLibrary') );
                 return;
             }
 
             if ( data.numFound > 0 ) {
-                $openlibrary_results.html( _( 'Found' ) + ' <a href="' + KOHA.OpenLibrary.searchUrl(querystring) + '" target="openlibrary">' + data.numFound + ' ' + _( 'results' ) + '</a> ' + _( 'in OpenLibrary collection' ) );
+                $openlibrary_results.html( '<a href="' + KOHA.OpenLibrary.searchUrl(querystring) + '" target="openlibrary">'  + MSG_RESULTS_FOUND_IN_COLLECTION.format(data.numFound, 'OpenLibrary') + '</a>' );
             } else {
                 $openlibrary_results.remove();
             }