Bug 12481: Staff client detail-view "next" link is greyed out when the last search...
[koha_fer] / koha-tmpl / intranet-tmpl / prog / en / modules / catalogue / results.tt
index 2e71ba7..34296b6 100644 (file)
@@ -1,6 +1,11 @@
 [% INCLUDE 'doc-head-open.inc' %]
 <title>Koha &rsaquo; Catalog &rsaquo; [% IF ( searchdesc ) %]Results of search [% IF ( query_desc ) %]for '[% query_desc | html %]'[% END %][% IF ( limit_desc ) %]&nbsp;with limit(s):&nbsp;'[% limit_desc | html %]'[% END %][% ELSE %]You did not specify any search criteria[% END %]</title>
 [% INCLUDE 'doc-head-close.inc' %]
+[% INCLUDE 'browser-strings.inc' %]
+<!--[if lt IE 9]>
+<script type="text/javascript" src="[% interface %]/lib/shims/json2.min.js"></script>
+<![endif]-->
+<script type="text/javascript" src="[% interface %]/js/browser.js"></script>
 <script type="text/javascript">
 //<![CDATA[
 var MSG_NO_ITEM_SELECTED = _("Nothing is selected.");
@@ -14,9 +19,9 @@ function verify_images() {
             w = this.width;
             h = this.height;
             if ((w == 1) || (h == 1)) {
-                this.src = 'http://g-images.amazon.com/images/G/01/x-site/icons/no-img-sm.gif';
+                this.src = 'https://images-na.ssl-images-amazon.com/images/G/01/x-site/icons/no-img-sm.gif';
             } else if ((this.complete != null) && (!this.complete)) {
-                this.src = 'http://g-images.amazon.com/images/G/01/x-site/icons/no-img-sm.gif';
+                this.src = 'https://images-na.ssl-images-amazon.com/images/G/01/x-site/icons/no-img-sm.gif';
             }
         }
     });
@@ -30,38 +35,59 @@ function Dopop(link) {
         newin=window.open(link,'popup','width=500,height=500,toolbar=false,scrollbars=yes,resizeable=yes');
 }
 function cartList(){
+    var checkboxes = $("#searchresults").find(":checkbox");
+    var vshelf = vShelfAdd(checkboxes);
     if($("#addto").find("option:selected").attr("value") == "addtolist"){
         var shelfnumber = $("#addto").find("option:selected").attr("id").replace("s","");
-        if (vShelfAdd()) {
-             Dopop('/cgi-bin/koha/virtualshelves/addbybiblionumber.pl?shelfnumber='+shelfnumber+'&confirm=1&' + vShelfAdd());
+        if (vshelf) {
+             Dopop('/cgi-bin/koha/virtualshelves/addbybiblionumber.pl?shelfnumber='+shelfnumber+'&confirm=1&' + vshelf);
         }
         return false;
     } else if($("#addto").find("option:selected").attr("value") == "newlist"){
-        if (vShelfAdd()) {
-            Dopop('/cgi-bin/koha/virtualshelves/addbybiblionumber.pl?newshelf=1&' + vShelfAdd());
+        if (vshelf) {
+            Dopop('/cgi-bin/koha/virtualshelves/addbybiblionumber.pl?newshelf=1&' + vshelf);
         }
         return false;
     } else if($("#addto").find("option:selected").attr("value") == "morelists"){
-        if (vShelfAdd()) {
-            Dopop('/cgi-bin/koha/virtualshelves/addbybiblionumber.pl?' + vShelfAdd());
+        if (vshelf) {
+            Dopop('/cgi-bin/koha/virtualshelves/addbybiblionumber.pl?' + vshelf);
         }
         return false;
     }
     if($("#addto").find("option:selected").attr("value") == "addtocart"){
-        addMultiple();
+        addMultiple(checkboxes);
         return false;
     }
 }
-$(window).load(function() {
-        new YAHOO.widget.Button("cartsubmit", { onclick: { fn: cartList }});
-});
 $(document).ready(function() {
-$("#placeholdc").empty();
+$("#cartsubmit").click(function(){
+    cartList();
+    return false;
+});
+$("#z3950submit").click(function(){
+    PopupZ3950();
+    return false;
+});
+
+$("#searchheader").on("click",".placehold", function(){
+    placeHold();
+    $(".btn-group").removeClass("open");
+    return false;
+});
+$(".placeholdfor").click(function(){
+    holdForPatron();
+    $(".btn-group").removeClass("open");
+    return false;
+});
+$("#forgetholdfor").click(function(){
+    forgetPatron();
+    $(".btn-group").removeClass("open");
+    return false;
+});
 $('#sortbyform').find("input:submit").hide();
 $('#sort_by').change(function() {
         $('#sortbyform').submit();
     });
-$(".addtocart").show();
         var param1 = "<label for=\"addto\">"+_("Add to:")+"<\/label><select name=\"addto\" id=\"addto\"><option value=\"\"><\/option>";
         [% IF ( intranetbookbag ) %]     param1 += "<option value=\"addtocart\">"+_("Cart")+"<\/option>"; [% END %]
         [% IF ( virtualshelves ) %][% IF ( addbarshelves ) %]
@@ -105,6 +131,27 @@ $(".addtocart").show();
         $("#highlight_toggle_on" ).hide().click(function() {highlightOn() ;});
         $("#highlight_toggle_off").show().click(function() {highlightOff();});
     [% END %]
+
+    [% IF (SEARCH_RESULTS) %]
+        var newresults = [
+            [%- FOREACH result IN SEARCH_RESULTS -%]
+                [%- result.biblionumber %],
+            [%- END -%]
+        ];
+        var browser = KOHA.browser('[% searchid %]', parseInt('[% biblionumber %]', 10));
+        browser.create([% SEARCH_RESULTS.first.result_number %], '[% query_cgi | uri %]', '[% limit_cgi | uri %]','[% sort_cgi | uri %]',
+               newresults, '[% total %]');
+    [% END %]
+    [% IF (gotoPage && gotoNumber) %]
+        [% IF (gotoNumber == 'first') %]
+            window.location = '/cgi-bin/koha/catalogue/[% gotoPage %]?biblionumber=' + [% SEARCH_RESULTS.first.biblionumber %] + '&searchid=[% searchid %]';
+        [% ELSIF (gotoNumber == 'last') %]
+            window.location = '/cgi-bin/koha/catalogue/[% gotoPage %]?biblionumber=' + [% SEARCH_RESULTS.last.biblionumber %] + '&searchid=[% searchid %]';
+        [% END %]
+    [% END %]
+
+[% IF LocalCoverImages %]KOHA.LocalCover.GetCoverFromBibnumber(false);[% END %]
+
 });
 
 
@@ -115,7 +162,9 @@ $(".addtocart").show();
 function highlightOn() {
     var x;
     for (x in q_array) {
-        toHighlight.highlight(q_array[x]);
+        if ( q_array[x].length > 0 ) {
+            toHighlight.highlight(q_array[x]);
+        }
     }
     $(".highlight_toggle").toggle();
 }[% END %]
@@ -154,14 +203,7 @@ function placeHold () {
 function forgetPatron(){
     $.cookie("holdfor",null, { path: "/", expires: 0 });
     $(".holdforlink").remove();
-    $("#placeholdc").empty();
-    new YAHOO.widget.Button({
-    id: "placehold",
-    type: "button",
-    label: _("Place hold"),
-    container: "placeholdc",
-    onclick: { fn: placeHold }
- });
+    $("#placeholdc").html("<a class=\"btn btn-mini placehold\" href=\"#\"><i class=\"icon-hold\"></i> "+_("Place hold")+"</a>");
 }
 
 function addToList () {
@@ -191,45 +233,19 @@ function PopupZ3950() {
 function GetZ3950Terms(){
        var strQuery="&frameworkcode=";
        [% FOREACH z3950_search_param IN z3950_search_params %]
-               strQuery += "&" + "[% z3950_search_param.name %]" + "=" + "[% z3950_search_param.encvalue %]";
+        strQuery += "&" + "[% z3950_search_param.name |uri %]" + "=" + "[% z3950_search_param.value |uri %]";
        [% END %]
        return strQuery;
 }
 
-YAHOO.util.Event.onContentReady("searchheader", function () {
-        new YAHOO.widget.Button( "z3950submit", { onclick: { fn: PopupZ3950 }});
-        [% IF ( holdfor ) %]
-        var holdFor = function (){
-            $("#holdFor").val("");
-            placeHold();
-        }
-        var holdForPatron = function () {
-            $("#holdFor").val("[% holdfor_cardnumber %]");
-            placeHold();
-        }
-        var HoldForButtonMenu = [
-            { text: _("Place hold"), onclick: { fn: holdFor }},
-            { text: _("Place hold for") + " [% holdfor_firstname %] [% holdfor_surname %] ([% holdfor_cardnumber %])", onclick: { fn: holdForPatron }},
-            { text: _("Forget") + " [% holdfor_firstname %] [% holdfor_surname %] ([% holdfor_cardnumber %])", onclick: { fn: forgetPatron }}];
-
-        var HoldForButton = new YAHOO.widget.Button({
-                type: "split",
-                label: _("Place hold"),
-                name: "holdfor",
-                menu: HoldForButtonMenu,
-                container: "placeholdc",
-                onclick: { fn: holdFor }
-        });
-        [% ELSE %]
-        new YAHOO.widget.Button({
-            id: "placehold",
-            type: "button",
-            label: _("Place hold"),
-            container: "placeholdc",
-            onclick: { fn: placeHold }
-         });
-        [% END %]
-}); // YAHOO onContentReady
+var holdFor = function (){
+    $("#holdFor").val("");
+    placeHold();
+}
+var holdForPatron = function () {
+    $("#holdFor").val("[% holdfor_cardnumber %]");
+    placeHold();
+}
 //]]>
 </script>
 </head>
@@ -296,13 +312,26 @@ YAHOO.util.Event.onContentReady("searchheader", function () {
                 <a href="#" class="highlight_toggle" id="highlight_toggle_on">Highlight</a>
                 |
                <span class="addto"></span>
-                [% IF ( CAN_user_reserveforothers ) %]
-                    [% IF ( DisplayMultiPlaceHold ) %]
-                  | <span id="placeholdc"><input type="button" id="placehold" onclick="placeHold(); return false;" value="Place Hold"/></span>
-                    [% END %]
+                [% IF ( CAN_user_reserveforothers && DisplayMultiPlaceHold ) %]
+                [% IF ( holdfor ) %]
+                    <div id="placeholdc" class="btn-group">
+                        <button class="btn btn-mini placehold"><i class="icon-hold"></i> Place hold</button>
+                        <button class="btn btn-mini dropdown-toggle" data-toggle="dropdown">
+                        <span class="caret"></span>
+                        </button>
+                        <ul class="dropdown-menu">
+                            <li><a href="#" class="placehold">Place hold</a></li>
+                            <li><a href="#" class="placeholdfor">Place hold for [% holdfor_firstname %] [% holdfor_surname %] ([% holdfor_cardnumber %])</a></li>
+                            <li class="divider"></li>
+                            <li><a href="#" id="forgetholdfor">Forget  [% holdfor_firstname %] [% holdfor_surname %] ([% holdfor_cardnumber %])</a></li>
+                        </ul>
+                    </div>
+                [% ELSE %]
+                    <div id="placeholdc" class="btn-group"><a class="btn btn-mini placehold" href="#"><i class="icon-hold"></i> Place hold</a></div>
+                [% END %]
                 [% END %]
 
-                               [% IF ( CAN_user_editcatalogue_edit_catalogue ) %] | <input type="button" id="z3950submit" onclick="PopupZ3950(); return false;" value="Z39.50 Search"/>[% END %]
+                [% IF ( CAN_user_editcatalogue_edit_catalogue ) %] <div class="btn-group"><a class="btn btn-mini" id="z3950submit" href="#"><i class="icon-search"></i> Z39.50 search</a></div>[% END %]
             </div>
         </div>
     [% IF ( stopwords_removed ) %]<div><p class="tip">Ignored the following common words: "[% stopwords_removed %]"<p></div>[% END %]
@@ -349,7 +378,7 @@ YAHOO.util.Event.onContentReady("searchheader", function () {
                             [% IF ( ms_ticommaphr ) %]<option selected="selected" value="ti,phr">Title phrase</option>
                             [% ELSE %]<option value="ti,phr">Title phrase</option>[% END %]
                             [% IF ( ms_aucommaphr ) %]<option selected="selected" value="au,phr">Author</option>
-                            [% ELSE %]<option value"au,phr">Author</option>[% END %]
+                            [% ELSE %]<option value="au,phr">Author</option>[% END %]
                             [% IF ( ms_su ) %]<option selected="selected" value="su">Subject</option>
                             [% ELSE %]<option value="su">Subject</option>[% END %]
                             [% IF ( ms_sucommaphr ) %]<option selected="selected" value="su,phr">Subject phrase</option>
@@ -391,46 +420,6 @@ YAHOO.util.Event.onContentReady("searchheader", function () {
             </form>
         [% ELSE %]
 
-                [% IF ( NoZebra ) %]
-                <!-- ######### -->
-                <div id="facets">
-                <dl>
-                <!-- FACETS START -->
-                [% IF ( opacfacets ) %]
-                    <dt id="facets1" onclick="var Elt=document.getElementById('facets_list');if (Elt.style.display!='block'){Elt.style.display='block';} else {Elt.style.display='none';}">
-                    Refine your search
-                    </dt>
-                    <dd id="facets_list" style="display:none;">
-                    <ul>
-                    [% FOREACH facets_loo IN facets_loop %]
-                    <li id="[% facets_loo.type_id %]">[% facets_loo.type_label %]
-                        <ul>
-                        [% FOREACH facet IN facets_loo.facets %]
-                            <li>
-                                <a href="/cgi-bin/koha/catalogue/search.pl?q=[% facet.searchdesc %] and [% facet.type_link_value %]:[% facet.facet_link_value %]" title="[% facet.facet_title_value %]">
-                                    [% facet.facet_label_value %]
-                                </a> ([% facet.facet_count %])
-                            </li>
-                        [% END %]
-                        [% IF ( facets_loo.expandable ) %]
-                            <li class="showmore">
-                                <a href="/cgi-bin/koha/catalogue/search.pl?q=[% facets_loo.searchdesc %][% IF ( offset ) %]&amp;offset=[% offset %][% END %]&amp;expand=[% facets_loo.expand %]#[% facets_loo.type_id %]">
-                                    Show more
-                                </a>
-                            </li>
-                        [% END %]
-                        </ul>
-                    </li>
-                    [% END %]
-                    </ul>
-                    </dd>
-                [% END %]
-                <!-- FACETS END -->
-                </dl>
-            </div>
-            <!-- ######### -->
-            <!-- NoZebra -->[% END %]
-
             <div id="searchresults">
                 <form action="/cgi-bin/koha/catalogue/search.pl" method="get" name="bookbag_form" id="bookbag_form">
                 [% IF ( searchdesc ) %]
@@ -445,19 +434,24 @@ YAHOO.util.Event.onContentReady("searchheader", function () {
                     <!-- TABLE RESULTS START -->
                 <table>
                     <tr>
-                        [% IF ( AmazonCoverImages ) %]<th>&nbsp;</th>[% END %]
+                        [% IF ( AmazonCoverImages || LocalCoverImages ) %]<th>&nbsp;</th>[% END %]
                         <th colspan="2">Results</th>
                         <th>Location</th>
                     </tr>
                         <!-- Actual Search Results -->
                         [% FOREACH SEARCH_RESULT IN SEARCH_RESULTS %]
                          [% IF ( loop.odd ) %]<tr>[% ELSE %]<tr class="highlight">[% END %]
-                            [% IF ( AmazonCoverImages ) %]
+                            [% IF ( AmazonCoverImages || LocalCoverImages ) %]
                                 <td>
-                                    <a class="p1" href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% SEARCH_RESULT.biblionumber |url %]">
-                                                                       
-                                        <img src="[% IF ( SEARCH_RESULT.normalized_isbn ) %]http://images.amazon.com/images/P/[% SEARCH_RESULT.normalized_isbn %].01.TZZZZZZZ.jpg[% ELSE %]http://g-images.amazon.com/images/G/01/x-site/icons/no-img-sm.gif[% END %]" alt="" class="thumbnail" />
-                                    </a></td>
+                                    [% IF ( LocalCoverImages ) %]
+                                        <span title="[% SEARCH_RESULT.biblionumber |url %]" class="[% SEARCH_RESULT.biblionumber %]" id="local-thumbnail[% loop.count %]"></span>
+                                    [% END %]
+                                    [% IF ( AmazonCoverImages ) %]
+                                        <a class="p1" href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% SEARCH_RESULT.biblionumber |url %]">
+                                            <img src="[% IF ( SEARCH_RESULT.normalized_isbn ) %]https://images-na.ssl-images-amazon.com/images/P/[% SEARCH_RESULT.normalized_isbn %].01.TZZZZZZZ.jpg[% ELSE %]https://images-na.ssl-images-amazon.com/images/G/01/x-site/icons/no-img-sm.gif[% END %]" alt="" class="thumbnail" />
+                                        </a>
+                                    [% END %]
+                                </td>
                             [% END %]
                             <td>
                                 <input type="checkbox" class="selection" id="bib[% SEARCH_RESULT.biblionumber %]" name="biblionumber" value="[% SEARCH_RESULT.biblionumber %]" style="display:none" />
@@ -474,7 +468,8 @@ YAHOO.util.Event.onContentReady("searchheader", function () {
                                             <b>[% IF ( SEARCH_RESULT.title ) %][% SEARCH_RESULT.title |html %][% ELSE %]No title[% END %]</b>
                                             </a>
                                         [% FOREACH subtitl IN SEARCH_RESULT.subtitle %], [% subtitl.subfield %][% END %]
-                                                                               [% IF ( SEARCH_RESULT.volume ) %],[% SEARCH_RESULT.volume %][% END %] [% IF ( SEARCH_RESULT.volumeddesc ) %], [% SEARCH_RESULT.volumeddesc %][% END %]
+                                        [% IF ( SEARCH_RESULT.seriestitle ) %][% SEARCH_RESULT.seriestitle %][% END %]
+                                        [% IF ( SEARCH_RESULT.volume ) %][% SEARCH_RESULT.volume %][% END %] [% IF ( SEARCH_RESULT.volumeddesc ) %], [% SEARCH_RESULT.volumeddesc %][% END %]
                                 </p>
                                 [% IF ( SEARCH_RESULT.summary ) %]
                                         [% IF ( SEARCH_RESULT.author ) %]
@@ -600,7 +595,7 @@ YAHOO.util.Event.onContentReady("searchheader", function () {
                                         [% IF ( other_items_loo.branchname ) %][% other_items_loo.branchname %][% END %]
                                         [% IF ( other_items_loo.location ) %][% other_items_loo.location %][% END %]
                                         [% IF ( other_items_loo.itemcallnumber ) %][<a href="/cgi-bin/koha/catalogue/search.pl?idx=callnum&amp;q=[% other_items_loo.itemcallnumber |url %]">[% other_items_loo.itemcallnumber %]</a>][% END %]
-                                        [% IF ( other_items_loo.wthdrawn ) %](Withdrawn)[% END %]
+                                        [% IF ( other_items_loo.withdrawn ) %](Withdrawn)[% END %]
                                         [% IF ( other_items_loo.itemlost ) %](Lost)[% END %]
                                         [% IF ( other_items_loo.damaged ) %](Damaged)[% END %]
                                         [% IF ( other_items_loo.intransit ) %](In transit)[% END %]
@@ -621,7 +616,7 @@ YAHOO.util.Event.onContentReady("searchheader", function () {
                                     [% FOREACH ALTERNATEHOLDING IN SEARCH_RESULT.ALTERNATEHOLDINGS %]
                                     <li id="alternateholdings">[% ALTERNATEHOLDING.holding %]</li>
                                     [% END %]
-                                    </li>
+                                    </ul>
                                     [% ELSE %]
                                     <span class="unavailable">No items</span>
                                     [% END %]