Fix for Bug 4997, More searches menu not on OPAC MARC and ISBD detail pages
authorOwen Leonard <oleonard@myacpl.org>
Thu, 16 Dec 2010 02:33:59 +0000 (21:33 -0500)
committerChris Cormack <chrisc@catalyst.net.nz>
Thu, 16 Dec 2010 21:50:07 +0000 (10:50 +1300)
Signed-off-by: Nicole Engard <nengard@bywatersolutions.com>
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
koha-tmpl/opac-tmpl/prog/en/modules/opac-ISBDdetail.tmpl
koha-tmpl/opac-tmpl/prog/en/modules/opac-MARCdetail.tmpl
opac/opac-ISBDdetail.pl
opac/opac-MARCdetail.pl

index 039e2ea..475d681 100644 (file)
@@ -5,6 +5,20 @@
        $(document).ready(function() {
                $('#bibliodescriptions > ul').tabs();
        }); 
+    YAHOO.util.Event.onContentReady("furtherm", function () {
+        $("#furtherm").css("display","block").css("visibility","hidden");
+        $("#furthersearches").parent().show();
+        var furthersearchesMenu = new YAHOO.widget.Menu("furtherm");
+            furthersearchesMenu.render();
+            furthersearchesMenu.cfg.setProperty("context", ["furthersearches", "tr", "br"]);
+            furthersearchesMenu.subscribe("beforeShow",positionfurthersearchesMenu);
+            furthersearchesMenu.subscribe("show", furthersearchesMenu.focus);
+            function positionfurthersearchesMenu() {
+                        furthersearchesMenu.align("tr", "br");
+            }
+            YAHOO.util.Event.addListener("furthersearches", "click", furthersearchesMenu.show, null, furthersearchesMenu);
+            YAHOO.widget.Overlay.windowResizeEvent.subscribe(positionfurthersearchesMenu);
+     });
 //]]>
 </script>
 <!-- TMPL_IF NAME="OPACXSLTDetailsDisplay" --><script type="text/javascript">
         <!-- TMPL_IF NAME="opacbookbag" --><li><a class="addtocart" href="#" onclick="addRecord('<!-- TMPL_VAR NAME="biblionumber" -->'); return false;">
             Add to Your Cart
         </a></li><!-- /TMPL_IF -->
+               <li style="display:none;"><a href="#" id="furthersearches">More searches</a></li>
 </ul>
 
+<!-- TMPL_IF name="OPACSearchForTitleIn" -->
+<div id="furtherm" class="yuimenu">
+<div class="bd">
+<h4>Search for this title in:</h4>
+<ul class="first-of-type">
+
+<!-- TMPL_VAR NAME="OPACSearchForTitleIn" -->
+
+</ul>
+</div>
+</div>
+<!-- /TMPL_IF -->
+
                <div id="export">
                <form method="get" action="/cgi-bin/koha/opac-export.pl">
                <label for="format">Save Record:</label>
index 319d0d7..8f5182e 100644 (file)
@@ -1,8 +1,27 @@
 <!-- TMPL_INCLUDE NAME="doc-head-open.inc" --><!-- TMPL_IF NAME="LibraryNameTitle" --><!-- TMPL_VAR NAME="LibraryNameTitle" --><!-- TMPL_ELSE -->Koha Online<!-- /TMPL_IF --> Catalog &rsaquo;  MARC Details for Record No. <!-- TMPL_VAR name="biblionumber" -->
 <!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
-<!-- TMPL_IF NAME="OPACXSLTDetailsDisplay" --><script type="text/javascript">
+<script type="text/javascript">
+//<![CDATA[
+    YAHOO.util.Event.onContentReady("furtherm", function () {
+        $("#furtherm").css("display","block").css("visibility","hidden");
+        $("#furthersearches").parent().show();
+        var furthersearchesMenu = new YAHOO.widget.Menu("furtherm");
+            furthersearchesMenu.render();
+            furthersearchesMenu.cfg.setProperty("context", ["furthersearches", "tr", "br"]);
+            furthersearchesMenu.subscribe("beforeShow",positionfurthersearchesMenu);
+            furthersearchesMenu.subscribe("show", furthersearchesMenu.focus);
+            function positionfurthersearchesMenu() {
+                        furthersearchesMenu.align("tr", "br");
+            }
+            YAHOO.util.Event.addListener("furthersearches", "click", furthersearchesMenu.show, null, furthersearchesMenu);
+            YAHOO.widget.Overlay.windowResizeEvent.subscribe(positionfurthersearchesMenu);
+     });
+<!-- TMPL_IF NAME="OPACXSLTDetailsDisplay" -->
     var GB_ROOT_DIR = "/opac-tmpl/prog/en/lib/greybox/";
+<!-- /TMPL_IF -->
+//]]>
 </script>
+<!-- TMPL_IF NAME="OPACXSLTDetailsDisplay" -->
 <script type="text/javascript" src="/opac-tmpl/prog/en/lib/greybox/AJS.js"></script>
 <script type="text/javascript" src="/opac-tmpl/prog/en/lib/greybox/AJS_fx.js"></script>
 <script type="text/javascript" src="/opac-tmpl/prog/en/lib/greybox/gb_scripts.js"></script>
         <!-- TMPL_IF NAME="opacbookbag" --><li><a class="addtocart" href="#" onclick="addRecord('<!-- TMPL_VAR NAME="biblionumber" -->'); return false;">
             Add to Your Cart
         </a></li><!-- /TMPL_IF -->
+        <li style="display:none;"><a href="#" id="furthersearches">More searches</a></li>
+</ul>
+
+<!-- TMPL_IF name="OPACSearchForTitleIn" -->
+<div id="furtherm" class="yuimenu">
+<div class="bd">
+<h4>Search for this title in:</h4>
+<ul class="first-of-type">
+
+<!-- TMPL_VAR NAME="OPACSearchForTitleIn" -->
+
 </ul>
+</div>
+</div>
+<!-- /TMPL_IF -->
 
                <div id="export">
                <form method="get" action="/cgi-bin/koha/opac-export.pl">
index 88904da..d3ffecc 100755 (executable)
@@ -155,6 +155,16 @@ $template->param(
     reviews             => $reviews,
 );
 
+#Search for title in links
+if (my $search_for_title = C4::Context->preference('OPACSearchForTitleIn')){
+    $dat->{author} ? $search_for_title =~ s/{AUTHOR}/$dat->{author}/g : $search_for_title =~ s/{AUTHOR}//g;
+    $dat->{title} =~ s/\/+$//; # remove trailing slash
+    $dat->{title} =~ s/\s+$//; # remove trailing space
+    $dat->{title} ? $search_for_title =~ s/{TITLE}/$dat->{title}/g : $search_for_title =~ s/{TITLE}//g;
+    $isbn ? $search_for_title =~ s/{ISBN}/$isbn/g : $search_for_title =~ s/{ISBN}//g;
+ $template->param('OPACSearchForTitleIn' => $search_for_title);
+}
+
 ## Amazon.com stuff
 #not used unless preference set
 if ( C4::Context->preference("OPACAmazonEnabled") == 1 ) {
index d127202..1a9dc34 100755 (executable)
@@ -269,6 +269,16 @@ if(C4::Context->preference("ISBD")) {
        $template->param(ISBD => 1);
 }
 
+#Search for title in links
+if (my $search_for_title = C4::Context->preference('OPACSearchForTitleIn')){
+    $biblio->{author} ? $search_for_title =~ s/{AUTHOR}/$biblio->{author}/g : $search_for_title =~ s/{AUTHOR}//g;
+    $biblio->{title} =~ s/\/+$//; # remove trailing slash
+    $biblio->{title} =~ s/\s+$//; # remove trailing space
+    $biblio->{title} ? $search_for_title =~ s/{TITLE}/$biblio->{title}/g : $search_for_title =~ s/{TITLE}//g;
+    $biblio->{isbn} ? $search_for_title =~ s/{ISBN}/$biblio->{isbn}/g : $search_for_title =~ s/{ISBN}//g;
+ $template->param('OPACSearchForTitleIn' => $search_for_title);
+}
+
 $template->param(
     item_loop        => \@item_value_loop,
     item_header_loop => \@header_value_loop,