[Koha-patches] [PATCH] [SIGNED-OFF] Fix for Bug 4997, More searches menu not on OPAC MARC and ISBD detail pages

Nicole Engard nengard at bywatersolutions.com
Thu Dec 16 03:33:59 CET 2010


From: Owen Leonard <oleonard at myacpl.org>


Signed-off-by: Nicole Engard <nengard at bywatersolutions.com>
---
 .../opac-tmpl/prog/en/modules/opac-ISBDdetail.tmpl |   28 ++++++++++++++++
 .../opac-tmpl/prog/en/modules/opac-MARCdetail.tmpl |   35 +++++++++++++++++++-
 opac/opac-ISBDdetail.pl                            |   10 ++++++
 opac/opac-MARCdetail.pl                            |   10 ++++++
 4 files changed, 82 insertions(+), 1 deletions(-)

diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-ISBDdetail.tmpl b/koha-tmpl/opac-tmpl/prog/en/modules/opac-ISBDdetail.tmpl
index 039e2ea..475d681 100644
--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-ISBDdetail.tmpl
+++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-ISBDdetail.tmpl
@@ -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">
@@ -71,8 +85,22 @@
         <!-- 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>
diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-MARCdetail.tmpl b/koha-tmpl/opac-tmpl/prog/en/modules/opac-MARCdetail.tmpl
index 319d0d7..8f5182e 100644
--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-MARCdetail.tmpl
+++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-MARCdetail.tmpl
@@ -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>
@@ -188,7 +207,21 @@
         <!-- 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">
diff --git a/opac/opac-ISBDdetail.pl b/opac/opac-ISBDdetail.pl
index 88904da..d3ffecc 100755
--- a/opac/opac-ISBDdetail.pl
+++ b/opac/opac-ISBDdetail.pl
@@ -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 ) {
diff --git a/opac/opac-MARCdetail.pl b/opac/opac-MARCdetail.pl
index d127202..1a9dc34 100755
--- a/opac/opac-MARCdetail.pl
+++ b/opac/opac-MARCdetail.pl
@@ -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,
-- 
1.5.6.5



More information about the Koha-patches mailing list