Bug 17153: Redirect to search when logging in from search
[koha.git] / koha-tmpl / opac-tmpl / bootstrap / en / modules / opac-results.tt
index 2456625..b0bf5a6 100644 (file)
@@ -1,25 +1,26 @@
+[% USE Asset %]
 [% USE Koha %]
 [% SET TagsShowEnabled = ( ( Koha.Preference( 'TagsEnabled' ) == 1 ) && TagsShowOnList ) %]
 [% SET TagsInputEnabled = ( ( Koha.Preference( 'opacuserlogin' ) == 1 ) && ( Koha.Preference( 'TagsEnabled' ) == 1 ) && TagsInputOnList ) %]
 
 [% INCLUDE 'doc-head-open.inc' %]
-[% IF ( LibraryNameTitle ) %][% LibraryNameTitle %][% ELSE %]Koha online[% END %] catalog ›
+<title>[% IF ( LibraryNameTitle ) %][% LibraryNameTitle %][% 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 %]
 [% ELSE %]
     You did not specify any search criteria.
-[% END %]
+[% END %]</title>
 [% INCLUDE 'doc-head-close.inc' %]
 [% IF ( OpacStarRatings == 'all' || Koha.Preference('Babeltheque') ) %]
     [% BLOCK cssinclude %]
-        <link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/jquery.rating.css" />
+        [% Asset.css("css/jquery.rating.css") %]
     [% END %]
 [% END %]
 
-<link rel="alternate" type="application/rss+xml" title="[% LibraryName |html %] Search RSS feed" href="[% OPACBaseURL %]/cgi-bin/koha/opac-search.pl?[% query_cgi |uri %][% 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 %]/cgi-bin/koha/opac-search.pl?[% query_cgi | url %][% limit_cgi |uri %]&amp;count=[% countrss |uri %]&amp;sort_by=acqdate_dsc&amp;format=rss2" />
 </head>
 
-<body id="results" class="scrollto">
+[% INCLUDE 'bodytag.inc' bodyid='results' bodyclass='scrollto' %]
 [% INCLUDE 'masthead.inc' %]
 
     <div class="main">
                         <strong>No results found!</strong>
                         <p>
                             [% IF ( searchdesc ) %]
-                                No results found for that in [% LibraryName %] catalog. <a href="[% OPACBaseURL %]/cgi-bin/koha/opac-search.pl?[% query_cgi | html | url %][% limit_cgi | html | url %]&amp;format=rss2" class="rsssearchlink"><img src="[% interface %]/[% theme %]/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 %] catalog. <a href="[% OPACBaseURL %]/cgi-bin/koha/opac-search.pl?[% query_cgi | url %][% limit_cgi | html | url %]&amp;format=rss2" class="rsssearchlink noprint"><img src="[% interface %]/[% theme %]/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 %]">Return to the last advanced search</a></p>
+                            </div>
+                        [% END %]
                         [% IF ( OPACNoResultsFound ) %]
                             <div id="noresultsfound">
                                 [% OPACNoResultsFound %]
@@ -80,7 +86,7 @@
                                 [% END %]
                             ).
                         [% END %]
-                        <a href="[% OPACBaseURL %]/cgi-bin/koha/opac-search.pl?[% query_cgi |html |url %][% limit_cgi |html | url %]&amp;count=[% countrss |html %]&amp;sort_by=acqdate_dsc&amp;format=rss2" class="rsssearchlink"><img src="[% interface %]/[% theme %]/images/feed-icon-16x16.png" alt="Subscribe to this search" title="Subscribe to this search" class="rsssearchicon"/></a>
+                        <a href="[% OPACBaseURL %]/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 %]/[% theme %]/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 %]
                             [% END %]
                         </ul>
                     [% END # / IF koha_spsuggest%]
-
+                    [% IF ( total ) %]
+                        [% IF ( ReturnPath ) %]
+                            <div class="returntosearch">
+                                <p><a href="[% ReturnPath %]">Return to the last advanced search</a></p>
+                            </div>
+                        [% END %]
+                    [% END %]
                     [% IF ( query_error ) %]
                         <div class="dialog alert">
                             <h4>Error:</h4>
 
                                 <div id="toolbar" class="toolbar clearfix">
                                     [% IF ( OpacHighlightedWords ) %]
-                                        <div class="highlight_controls">
+                                        <div class="highlight_controls noprint">
                                             <a href="#" class="highlight_toggle" id="highlight_toggle_off">Unhighlight</a>
                                             <a href="#" class="highlight_toggle" id="highlight_toggle_on">Highlight</a>
                                         </div>
                                     [% END %]
-                                    <div class="sort_by pull-right">
-                                        <select id="sort_by" class="resort" name="sort_by"> [% INCLUDE 'resort_form.inc' %] </select>
-                                        <input type="submit" class="btn btn-small clearfix" id="sortsubmit" value="Go" />
-                                    </div>
+                                    [% UNLESS tag %]
+                                        <div class="sort_by pull-right">
+                                            <select id="sort_by" class="resort" name="sort_by"> [% INCLUDE 'resort_form.inc' %] </select>
+                                            <input type="submit" class="btn btn-small clearfix" id="sortsubmit" value="Go" />
+                                        </div>
+                                    [% END %]
                                 </div> <!-- / #toolbar -->
 
-                                <div id="selections-toolbar" class="toolbar">
+                                <div id="selections-toolbar" class="toolbar noprint">
                                     <!-- checkall, clearall are now needed for placehold -->
                                     <span class="checkall"></span>
                                     <span class="clearall"></span> <span class="sep">|</span>
                                                 </td>
                                             [% END %]
 
-                                            [% IF ( AuthorisedValueImages ) %]
-                                                [% # Cell 4: Show Authorized value image %]
-                                                <td class="authvalcol">
-                                                    [% FOREACH authorised_value_image IN SEARCH_RESULT.authorised_value_images %]
-                                                        [% IF ( authorised_value_image.imageurl ) %]
-                                                            <img src="[% authorised_value_image.imageurl %]" alt="[% authorised_value_image.label %]" title="[% authorised_value_image.label %]">
-                                                        [% END %]
-                                                    [% END %]
-                                                </td>
-                                            [% END %]
-
-                                            [% # Cell 5: Search result details and controls %]
+                                            [% # Cell 4: Search result details and controls %]
                                             <td class="bibliocol">
-                                                <div class="coverimages">
+                                                <div class="coverimages itemtype_[% SEARCH_RESULT.itemtype %]">
                                                     <a class="p1" href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% SEARCH_RESULT.biblionumber %]">
                                                         [% IF ( OPACLocalCoverImages ) %]
                                                             <span title="[% SEARCH_RESULT.biblionumber |url %]" class="[% SEARCH_RESULT.biblionumber %]" id="local-thumbnail[% loop.count %]"></span>
                                                         [% END %]
                                                         [% IF ( OPACAmazonCoverImages ) %]
                                                             [% IF ( SEARCH_RESULT.normalized_isbn ) %]
-                                                                [% IF ( using_https ) %]
                                                                     <span title="[% SEARCH_RESULT.biblionumber %]" id="amazon-thumbnail[% loop.count %]"><img src="https://images-na.ssl-images-amazon.com/images/P/[% SEARCH_RESULT.normalized_isbn %].01.TZZZZZZZ.jpg" alt="" class="item-thumbnail" /></span>
-                                                                [% ELSE %]
-                                                                <span title="[% SEARCH_RESULT.biblionumber %]" id="amazon-thumbnail[% loop.count %]"><img src="http://images.amazon.com/images/P/[% SEARCH_RESULT.normalized_isbn %].01.TZZZZZZZ.jpg" alt="" class="item-thumbnail" /></span>
-                                                                [% END %]
                                                             [% ELSE %]
                                                                 <span class="no-image">No cover image available</span>
                                                             [% END %]
                                                         [% END %]
 
                                                         [% IF ( SyndeticsEnabled && SyndeticsCoverImages ) %]
-                                                            [% IF SEARCH_RESULT.normalized_isbn %]
+                                                            [% IF ( SEARCH_RESULT.normalized_isbn || SEARCH_RESULT.normalized_upc || SEARCH_RESULT.normalized_oclc ) %]
                                                                     [% IF ( using_https ) %]
                                                                         <span title="[% SEARCH_RESULT.biblionumber %]" id="syndetics-thumbnail[% loop.count %]"><img src="https://secure.syndetics.com/index.aspx?isbn=[% SEARCH_RESULT.normalized_isbn %]/SC.GIF&amp;client=[% SyndeticsClientCode %]&amp;type=xw10&amp;upc=[% SEARCH_RESULT.normalized_upc %]&amp;oclc=[% SEARCH_RESULT.normalized_oclc %]" alt="" class="item-thumbnail" /></span>
                                                                     [% ELSE %]
                                                             [% END %]
                                                         [% END %]
 
+                                                        [% IF ( Koha.Preference('Coce') && Koha.Preference('CoceProviders') ) %]
+                                                          [% coce_id = SEARCH_RESULT.normalized_ean || SEARCH_RESULT.normalized_isbn %]
+                                                          [% IF ( coce_id ) %]
+                                                            <span style="block" title="[% SEARCH_RESULT.biblionumber |url %]" class="[% coce_id %]" id="coce-thumbnail[% loop.count %]"></span>
+                                                          [% ELSE %]
+                                                            <span class="no-image">No cover image available</span>
+                                                          [% END %]
+                                                        [% END %]
+
                                                         [% IF OpenLibraryCovers %]
                                                             [% IF SEARCH_RESULT.normalized_isbn %]
                                                                 <span style="block" title="[% SEARCH_RESULT.biblionumber %]" class="[% SEARCH_RESULT.normalized_isbn %]" id="openlibrary-thumbnail[% loop.count %]"></span>
                                                                 <span class="no-image">No cover image available</span>
                                                             [% END %]
                                                         [% END %]
+
+                                                        [% IF ( BakerTaylorEnabled && !BakerTaylorBookstoreURL ) %]
+                                                            [% bt_id = ( SEARCH_RESULT.normalized_upc || SEARCH_RESULT.normalized_isbn ) %]
+                                                            [% IF ( bt_id ) %]
+                                                                <img alt="See Baker &amp; Taylor" src="[% BakerTaylorImageURL |html %][% bt_id %]" />
+                                                            [% ELSE %]
+                                                                <span class="no-image">No cover image available</span>
+                                                            [% END %]
+                                                        [% END %]
                                                     </a>
 
-                                                    [% IF ( BakerTaylorEnabled ) %]
-                                                        [% IF ( SEARCH_RESULT.normalized_isbn ) %]
-                                                            <a href="https://[% BakerTaylorBookstoreURL |html %][% SEARCH_RESULT.normalized_isbn %]"><img alt="See Baker &amp; Taylor" src="[% BakerTaylorImageURL |html %][% SEARCH_RESULT.normalized_isbn %]" /></a>
+                                                    [% IF ( BakerTaylorEnabled && BakerTaylorBookstoreURL ) %]
+                                                        [% bt_id = ( SEARCH_RESULT.normalized_upc || SEARCH_RESULT.normalized_isbn ) %]
+                                                        [% IF ( bt_id ) %]
+                                                            <a href="https://[% BakerTaylorBookstoreURL |html %][% bt_id %]">
+                                                                <img alt="See Baker &amp; Taylor" src="[% BakerTaylorImageURL |html %][% bt_id %]" />
+                                                            </a>
                                                         [% ELSE %]
                                                             <span class="no-image">No cover image available</span>
                                                         [% END %]
 
                                                                         [% IF ( OPACItemsResultsDisplay ) %]
                                                                             [% UNLESS ( singleBranchMode ) %][% available_items_loo.location %][% END %]
-                                                                            [% IF ( available_items_loo.itemcallnumber ) %][<a href="/cgi-bin/koha/opac-search.pl?q=callnum:[% available_items_loo.itemcallnumber |url %]">[% available_items_loo.itemcallnumber %]</a>][% END %]
+                                                                            [% 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 %]</a>][% END %]
                                                                         [% END %]
                                                                         ([% available_items_loo.count %]),
                                                                         </span>
                                                     </div>
                                                 [% END %]
 
+                                                [% IF Koha.Preference('virtualshelves') AND SEARCH_RESULT.shelves.count %]
+                                                    <div class="results_summary shelves">
+                                                        <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 %]">[% shelf.shelfname %]</a></li>
+                                                                    [%~ UNLESS loop.last %], [% ELSE %].[% END ~%]
+                                                                [% END %]
+                                                            </ul>
+                                                        </span>
+                                                    </div>
+                                                [% END %]
+
                                                 [% IF ( SEARCH_RESULT.searchhighlightblob ) %]
                                                     <span class="results_summary">
                                                         <span class="label">Match:</span>
 
                                                 [% IF ( OpacStarRatings == 'all' ) %]
                                                     <div class="results_summary ratings">
+                                                      [% SET rating_avg = SEARCH_RESULT.ratings.get_avg_rating() %]
+                                                      [% rating_avg_int = BLOCK %][% rating_avg | format("%.0f") %][% END %]
                                                         [% FOREACH i  IN [ 1 2 3 4 5  ] %]
-                                                            [% IF ( SEARCH_RESULT.rating_avg == i ) %]
+                                                            [% IF rating_avg_int == i %]
                                                                 <input class="star" type="radio"  name="rating-[% SEARCH_RESULT.biblionumber %]" value="[% i %]" checked="checked" disabled="disabled"   />
-                                                            [% ELSE   %]
+                                                            [% ELSE %]
                                                                 <input class="star" type="radio"  name="rating-[% SEARCH_RESULT.biblionumber %]" value="[% i %]" disabled="disabled"   />
                                                             [% END %]
                                                         [% END %]
 
-                                                        <input type="hidden" name="biblionumber"  value="[% SEARCH_RESULT.biblionumber %]" />
-                                                        <input type="hidden" name="loggedinuser"  value="[% loggedinuser %]" />
-
-                                                        [% IF (  SEARCH_RESULT.rating_total ) > 0  %]
-                                                            <span id="rating_total_[% SEARCH_RESULT.biblionumber %]">&nbsp;&nbsp;([% SEARCH_RESULT.rating_total %] votes)</span>
+                                                        [% IF SEARCH_RESULT.ratings.count > 0  %]
+                                                            <span id="rating_total_[% SEARCH_RESULT.biblionumber %]">&nbsp;&nbsp;([% SEARCH_RESULT.ratings.count %] votes)</span>
                                                         [% ELSE %]
                                                             <br />
                                                         [% END %]
                                                     </div> <!-- / .results_summary -->
                                                 [% END # / IF OpacStarRatings %]
 
-                                                <div class="actions-menu">
+                                                <div class="actions-menu noprint">
                                                         [% IF Koha.Preference( 'RequestOnOpac' ) == 1 %]
                                                             [% UNLESS ( SEARCH_RESULT.norequests ) %]
-                                                                [% IF ( ( Koha.Preference( 'opacuserlogin' ) == 1 ) && AllowOnShelfHolds ) %]
+                                                                [% IF ( Koha.Preference( 'opacuserlogin' ) == 1 ) %]
                                                                     <span class="actions"><a class="hold" href="/cgi-bin/koha/opac-reserve.pl?biblionumber=[% SEARCH_RESULT.biblionumber %]">Place hold</a></span><!-- add back when available 0 holds in queue-->
-                                                                [% ELSE %]
-                                                                    [% IF ( SEARCH_RESULT.itemsissued ) %]
-                                                                        <a class="hold" href="/cgi-bin/koha/opac-reserve.pl?biblionumber=[% SEARCH_RESULT.biblionumber %]">Place hold</a><!-- add back when available 0 holds in queue-->
-                                                                    [% END %]
-                                                                [% END # / IF opacuserlogin && AllowOnShelfHolds %]
+                                                                [% END # / IF opacuserlogin && holdable %]
                                                             [% END # UNLESS SEARCH_RESULT.norequests %]
                                                         [% END # IF RequestOnOpac %]
 
+                                                        [% IF ( Koha.Preference( 'opacuserlogin' ) == 1 ) %]
+                                                            [% IF Koha.Preference('ArticleRequests') %]
+                                                                <span class="actions"><a class="article_request" href="/cgi-bin/koha/opac-request-article.pl?biblionumber=[% SEARCH_RESULT.biblionumber %]">Request article</a></span>
+                                                            [% END %]
+                                                        [% END %]
+
                                                         [% IF ( TagsInputEnabled ) %]
                                                             [% IF ( loggedinusername ) %]
                                                                 <span class="actions"><a class="tag_add" id="tag_add[% SEARCH_RESULT.biblionumber %]" href="#">Add tag</a></span>
                                                                 <div id="tagform[% SEARCH_RESULT.biblionumber %]" class="tag_results_input" style="display:none;">
                                                                         <label for="newtag[% SEARCH_RESULT.biblionumber %]">New tag(s), separated by a comma:</label>
-                                                                        <input type="text" name="newtag[% SEARCH_RESULT.biblionumber %]" id="newtag[% SEARCH_RESULT.biblionumber %]" maxlength="100" />
+                                                                        <input type="text" name="newtag[% SEARCH_RESULT.biblionumber %]" id="newtag[% SEARCH_RESULT.biblionumber %]" class="newtag" maxlength="100" />
                                                                         <input name="tagbutton" class="btn btn-small tagbutton" title="[% SEARCH_RESULT.biblionumber %]" type="submit" value="Add" />
                                                                         <a class="cancel_tag_add" id="cancel[% SEARCH_RESULT.biblionumber %]" href="#">(done)</a>
                                                                 </div>
                                                             [% END %]
                                                         [% END # / IF opacbookbag %]
                                                 </div>
+
+                                                [% INCLUDE "openlibrary-readapi.inc" bib = SEARCH_RESULT %]
+
                                             </td>
                                         </tr>
                                     [% END # / FOREACH SEARCH_RESULT %]
 
                     [% END # / IF total %]
 
-                    [% IF Koha.Preference( 'suggestion' ) == 1 %]
-                        [% IF Koha.Preference( 'AnonSuggestions' ) == 1 %]
-                            <div class="suggestion">Not finding what you're looking for?<br />  Make a <a href="/cgi-bin/koha/opac-suggestions.pl?op=add">purchase suggestion</a></div>
-                        [% ELSE %]
-                            [% IF ( loggedinusername ) %]
-                                <div class="suggestion">
-                                    Not finding what you're looking for?<br />  Make a <a href="/cgi-bin/koha/opac-suggestions.pl?op=add">purchase suggestion</a>
-                                </div>
-                            [% END %]
-                        [% END %]
+                    [% IF Koha.Preference( 'suggestion' ) == 1 && ( Koha.Preference( 'AnonSuggestions' ) == 1 || loggedinusername || Koha.Preference( 'ILLModule' ) == 1 )   %]
+                        <div class="suggestion">
+                            Not finding what you're looking for?
+                            <ul>
+                                [% IF Koha.Preference( 'AnonSuggestions' ) == 1 %]
+                                    <li>Make a <a href="/cgi-bin/koha/opac-suggestions.pl?op=add">purchase suggestion</a></li>
+                                [% ELSE %]
+                                    [% IF ( loggedinusername ) %]
+                                        <li>Make a <a href="/cgi-bin/koha/opac-suggestions.pl?op=add">purchase suggestion</a></li>
+                                    [% END %]
+                                [% END %]
+                                [% IF Koha.Preference( 'ILLModule' ) == 1 && loggedinusername %]
+                                    <li>Make an <a href="/cgi-bin/koha/opac-illrequests.pl?op=create">Interlibrary loan request</a></li>
+                                [% END %]
+                            </ul>
+                        </div>
                     [% END %]
                     </div> <!-- / #userresults -->
                 </div> <!-- /.span10/12 -->
 [% INCLUDE 'opac-bottom.inc' %]
 [% BLOCK jsinclude %]
 [% IF ( LibraryThingForLibrariesID ) %]
-    [% IF ( using_https ) %]
-        <script src="https://ltfl.librarything.com/forlibraries/widget.js?id=[% LibraryThingForLibrariesID %]&amp;systype=koha" type="text/javascript"></script>
-    [% ELSE %]
-        <script src="http://ltfl.librarything.com/forlibraries/widget.js?id=[% LibraryThingForLibrariesID %]&amp;systype=koha" type="text/javascript"></script>
-    [% END %]
+    <script src="https://ltfl.librarything.com/forlibraries/widget.js?id=[% LibraryThingForLibrariesID %]&amp;systype=koha"></script>
 [% END %]
-[% IF ( OpacStarRatings == 'all' || Koha.Preference('Babeltheque') ) %]<script type="text/javascript" src="[% interface %]/[% theme %]/lib/jquery/plugins/jquery.rating.js"></script>[% END %]
-[% IF ( OverDriveEnabled ) %]<script type="text/javascript" src="[% interface %]/[% theme %]/js/overdrive.js"></script>[% END %]
-<script type="text/javascript" src="[% interface %]/[% theme %]/lib/jquery/plugins/jquery.checkboxes.min.js"></script>
-[% IF ( OpacHighlightedWords ) %]<script type="text/javascript" src="[% interface %]/[% theme %]/lib/jquery/plugins/jquery.highlight-3.js"></script>
-[% END %]<script type="text/javascript">
+[% IF ( OpacStarRatings == 'all' || Koha.Preference('Babeltheque') ) %][% Asset.js("lib/jquery/plugins/jquery.rating.js") %][% END %]
+[% IF ( OverDriveEnabled ) %][% Asset.js("js/overdrive.js") %][% END %]
+[% Asset.js("lib/jquery/plugins/jquery.checkboxes.min.js") %]
+[% Asset.js("js/authtoresults.js") %]
+[% IF ( OpacHighlightedWords ) %][% Asset.js("lib/jquery/plugins/jquery.highlight-3.js") %]
+[% END %]<script>
 //<![CDATA[
 [% IF ( Koha.Preference( 'opacuserlogin' ) == 1 ) && ( Koha.Preference( 'RequestOnOpac' ) == 1 ) %]
 function holdMultiple() {
@@ -683,12 +723,12 @@ $(document).ready(function(){
             if ($.browser.msie && parseInt($.browser.version, 10) >= 8 && window.XDomainRequest) {
             // Use Microsoft XDR for IE version 8 or above
                 var xdr = new XDomainRequest();
-                xdr.open("get", "http://idreambooks.com/newbooks/api.json?q="+encodeURIComponent(isbn)+"&key=8bf66516232d1b72f3e47df939653e1e");
+                xdr.open("get", "https://idreambooks.com/newbooks/api.json?q="+encodeURIComponent(isbn)+"&key=8bf66516232d1b72f3e47df939653e1e");
                 xdr.onload = function() {
                     json = 'json = '+xdr.responseText; // the string now looks like..  json = { ... };
                     eval(json); // json is now a regular JSON object
                     if(json.total_results > 0 && json.book.rating > 0){
-                        $(element).children('a').html("<img src='"+json.book.to_read_or_not_small+"' alt='"+json.book.title+" by "+json.book.author+"' title='Rating based on reviews of "+json.book.title+"'>"+json.book.rating+"%");
+                        $(element).children('a').html("<img src='"+json.book.to_read_or_not_small+"' alt='"+json.book.title+_(" by ")+json.book.author+"' title='"+_("Rating based on reviews of ")+json.book.title+"'>"+json.book.rating+"%");
                         $(element).show();
                     } else {
                         $(element).remove();
@@ -696,9 +736,9 @@ $(document).ready(function(){
                 }
                 xdr.send();
             } else {
-                $.getJSON("http://idreambooks.com/newbooks/api.json?q="+encodeURIComponent(isbn)+"&key=8bf66516232d1b72f3e47df939653e1e", function(json){
+                $.getJSON("https://idreambooks.com/newbooks/api.json?q="+encodeURIComponent(isbn)+"&key=8bf66516232d1b72f3e47df939653e1e", function(json){
                     if(json.total_results > 0 && json.book.rating > 0){
-                        $(element).children('a').html("<img src='"+json.book.to_read_or_not_small+"' alt='"+json.book.title+" by "+json.book.author+"' title='Rating based on reviews of "+json.book.title+"'>"+json.book.rating+"%");
+                        $(element).children('a').html("<img src='"+json.book.to_read_or_not_small+"' alt='"+json.book.title+_(" by ")+json.book.author+"' title='"+_("Rating based on reviews of ")+json.book.title+"'>"+json.book.rating+"%");
                         $(element).show();
                     } else {
                         $(element).remove();
@@ -713,37 +753,43 @@ $(document).ready(function(){
     param1 += "<span id=\"selections\">"+_("Select titles to: ")+"</span>";
     [% END %]
 
-[% IF Koha.Preference( 'opacbookbag' ) == 1 %]
-    [% IF Koha.Preference( 'virtualshelves' ) == 1 %]
+[% IF Koha.Preference( 'opacbookbag' ) == 1 OR Koha.Preference('virtualshelves') %]
     param1 += "<select class=\"disabled\" name=\"addto\" id=\"addto\"><option>"+_("Add to...")+"</option>";
-    [% IF Koha.Preference( 'opacbookbag' ) == 1 %]    param1 += "<option value=\"addtocart\">"+_("Cart")+"<\/option>";
-    [% END %][% IF Koha.Preference( 'virtualshelves' ) == 1 %][% IF ( loggedinusername ) %][% IF ( addbarshelves ) %]
-    param1 += "<optgroup label=\""+_("Your lists:")+"\">";[% FOREACH addbarshelvesloo IN addbarshelvesloop %]
-    param1 += "<option id=\"s[% addbarshelvesloo.shelfnumber %]\" value=\"addtolist\">[% addbarshelvesloo.shelfname |html %]<\/option>";[% END %]
-    param1 += "<\/optgroup>";[% END %]
-    [% IF ( addpubshelves ) %]param1 += "<optgroup label=\""+_("Public lists:")+"\">"[% FOREACH addpubshelvesloo IN addpubshelvesloop %]+"<option id=\"s[% addpubshelvesloo.shelfnumber %]\" value=\"addtolist\">[% addpubshelvesloo.shelfname |html %]<\/option>"[% END %];
-    param1 += "<\/optgroup>";[% END %]
-    [% IF (( addbarshelvesloop && addbarshelvesloop.size>9) || (addpubshelvesloop && addpubshelvesloop.size>9 )) %]
-        param1 += "<option value=\"morelists\">[ "+_("More lists")+" ]<\/option>";
-    [% END %]
-    param1 += "<option value=\"newlist\">[ "+_("New list")+" ]<\/option>";
+
+    [% IF Koha.Preference( 'opacbookbag' ) == 1 %]
+        param1 += "<option value=\"addtocart\">"+_("Cart")+"<\/option>";
     [% END %]
+    [% IF Koha.Preference('virtualshelves') %]
+        [% IF loggedinusername AND add_to_some_private_shelves.count %]
+            param1 += "<optgroup label=\""+_("Your lists:")+"\">";
+            [% SET number_of_private_shelves = 0 %]
+            [% FOREACH s IN add_to_some_private_shelves %]
+                [% IF shelfnumber != s.shelfnumber %]
+                    param1 += "<option id=\"s[% s.shelfnumber %]\" value=\"addtolist\">[% s.shelfname |html %]<\/option>";
+                    [% SET number_of_private_shelves = number_of_private_shelves + 1 %]
+                    [% IF number_of_private_shelves == 10 %][% LAST %][% END %]
+                [% END %]
+            [% END %]
+            param1 += "<\/optgroup>";
+        [% END %]
+        [% IF add_to_some_public_shelves.count %]
+            param1 += "<optgroup label=\""+_("Public lists:")+"\">";
+            [% SET number_of_public_shelves = 0 %]
+            [% FOREACH s IN add_to_some_public_shelves %]
+                [% IF shelfnumber != s.shelfnumber %]
+                    param1 += "<option id=\"s[% s.shelfnumber %]\" value=\"addtolist\">[% s.shelfname |html %]<\/option>";
+                    [% SET number_of_public_shelves = number_of_public_shelves + 1 %]
+                    [% IF number_of_public_shelves == 10 %][% LAST %][% END %]
+                [% END %]
+            [% END %]
+            param1 += "<\/optgroup>";
+        [% END %]
+        [% 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 ) %]
+            param1 += "<option value=\"morelists\">[ "+_("More lists")+" ]<\/option>";
+        [% END %]
+        param1 +="<option value=\"newlist\">"+_("[ New list ]")+"<\/option>"
     [% END %]
     param1 += "<\/select> <input type=\"submit\" class=\"btn btn-small\" value=\""+_("Save")+"\" />";
-    [% ELSE %]
-        param1 += "<a id=\"addto\" class=\"addtocart\" href=\"#\">" + _("Add to cart") + "<\/a>";
-    [% END %]
-[% ELSE %]
-        param1 += "<select name=\"addto\" id=\"addto\"><option value=\"\">"+_("Add to list: ")+"<\/option>";
-[% IF Koha.Preference( 'virtualshelves' ) == 1 %][% IF ( loggedinusername ) %][% IF ( addbarshelves ) %]
-    param1 += "<optgroup label=\""+_("Your lists:")+"\">";[% FOREACH addbarshelvesloo IN addbarshelvesloop %]
-    param1 += "<option id=\"s[% addbarshelvesloo.shelfnumber %]\" value=\"addtolist\">[% addbarshelvesloo.shelfname |html %]<\/option>";[% END %]
-    param1 += "<\/optgroup>";[% END %]
-    [% IF ( addpubshelves ) %]param1 += "<optgroup label=\""+_("Public lists:")+"\">"[% FOREACH addpubshelvesloo IN addpubshelvesloop %]+"<option id=\"s[% addpubshelvesloo.shelfnumber %]\" value=\"addtolist\">[% addpubshelvesloo.shelfname |html %]<\/option>"[% END %][% END %]
-    param1 +="<\/optgroup><option value=\"newlist\">[ "+_("New list")+" ]<\/option>"
-    [% END %]
-    [% END %]
-    param1 += "<\/select> <input type=\"submit\" class=\"btn btn-small disabled\" value=\""+_("Save")+"\" />";
 [% END %]
 
     $('#sortsubmit').hide();
@@ -843,7 +889,7 @@ $(document).ready(function(){
         $("#highlight_toggle_off").show().click(function() {highlightOff();});
     [% END %]
     [% IF ( OverDriveEnabled ) %]
-        var $overdrive_results = $( '<span id="overdrive-results">' + _( 'Searching OverDrive...' ) + ' <img class="throbber" src="[% interface %]/lib/jquery/plugins/themes/classic/throbber.gif" /></span>' );
+        var $overdrive_results = $( '<div id="overdrive-results">' + _( 'Searching OverDrive...' ) + ' <img class="throbber" src="[% interface %]/lib/jquery/plugins/themes/classic/throbber.gif" /></div>' );
         $( '#numresults' ) .append( ' ' )
             .append( $overdrive_results );
         KOHA.OverDrive.Search( "[% OverDriveLibraryID %]", querystring, 1, 0, function( data ) {
@@ -859,6 +905,23 @@ $(document).ready(function(){
             }
         } );
     [% END %]
+    [% IF ( OpenLibrarySearch ) %]
+        var $openlibrary_results = $( '<div id="openlibrary-results">' + _( 'Searching Open Library...' ) + ' <img class="throbber" src="[% interface %]/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' ) );
+                return;
+            }
+
+            if ( data.numFound > 0 ) {
+                $openlibrary_results.html( _( 'Found' ) + ' <a href="' + KOHA.OpenLibrary.searchUrl(querystring) + '" target="openlibrary">' + data.numFound + ' ' + _( 'results' ) + '</a> ' + _( 'in OpenLibrary collection' ) );
+            } else {
+                $openlibrary_results.remove();
+            }
+        } );
+    [% END %]
 [% END %]
 
 [% IF ( TagsInputEnabled && loggedinusername ) %]
@@ -908,17 +971,21 @@ $(document).ready(function(){
 [% IF OpenLibraryCovers %]KOHA.OpenLibrary.GetCoverFromIsbn();[% END %]
 [% IF OPACLocalCoverImages %]KOHA.LocalCover.GetCoverFromBibnumber(false);[% END %]
 [% IF ( GoogleJackets ) %]KOHA.Google.GetCoverFromIsbn();[% END %]
+[% IF ( Koha.Preference('Coce') && Koha.Preference('CoceProviders') ) %]
+    KOHA.coce.getURL('[% Koha.Preference('CoceHost') %]', '[% Koha.Preference('CoceProviders') %]');
+[% END %]
 
 [% IF ( DidYouMean ) %]
     $("#didyoumean").load("/cgi-bin/koha/svc/suggestion?render=stub&q=[% querystring |uri %]",
         function() {
-            $(".searchsuggestion").parent().parent().css({
-                "border-color": "#F4ECBE",
-                "background-color": "#FFFBEA"
-            });
+            $(this).addClass("dym-loaded");
         });
 [% END %]
 
+$("input.newtag").on('keydown', function(e){
+    if (e.keyCode == 13) { e.preventDefault(); }
+});
+
 });
 //]]>
 </script>