[PATCH] Bug 1934: Add system preference to handle editing of

Nicole Engard nengard at gmail.com
Sun Aug 23 11:41:34 CEST 2009


'More searches'
Content-Type: text/plain; charset="utf-8"

This preference allows librarians to control which links appear
in the 'More Searches' box on the opac detail page. If the
preference is left blank the 'More Searches' menu will not apear
on the opac detail page at all.
---
 admin/systempreferences.pl                         |    1 +
 installer/data/mysql/en/mandatory/sysprefs.sql     |    1 +
 installer/data/mysql/updatedatabase.pl             |    7 +++++++
 .../opac-tmpl/prog/en/modules/opac-detail.tmpl     |    8 +++++---
 opac/opac-detail.pl                                |    9 +++++++++
 5 files changed, 23 insertions(+), 3 deletions(-)

diff --git a/admin/systempreferences.pl b/admin/systempreferences.pl
index bb73d42..8f358d5 100755
--- a/admin/systempreferences.pl
+++ b/admin/systempreferences.pl
@@ -307,6 +307,7 @@ $tabsysprefs{OPACUserCSS}                = "OPAC";
 $tabsysprefs{OPACHighlightedWords}       = "OPAC";
 $tabsysprefs{OPACViewOthersSuggestions}  = "OPAC";
 $tabsysprefs{URLLinkText}                = "OPAC";
+$tabsysprefs{OPACSearchForTitleIn}       = "OPAC";
 $tabsysprefs{OPACShelfBrowser}           = "OPAC";
 $tabsysprefs{OPACDisplayRequestPriority} = "OPAC";
 $tabsysprefs{OPACAllowHoldDateInFuture}  = "OPAC";
diff --git a/installer/data/mysql/en/mandatory/sysprefs.sql
b/installer/data/mysql/en/mandatory/sysprefs.sql
index 1921948..74fde20 100644
--- a/installer/data/mysql/en/mandatory/sysprefs.sql
+++ b/installer/data/mysql/en/mandatory/sysprefs.sql
@@ -250,3 +250,4 @@ INSERT INTO systempreferences
(variable,value,explanation,options,type)VALUES('F
 INSERT INTO systempreferences
(variable,value,options,explanation,type)VALUES('SpineLabelFormat',
'<itemcallnumber><copynumber>', '30|10', 'This preference defines the
format for the quick spine label printer. Just list the fields you
would like to see in the order you would like to see them, surrounded
by <>, for example <itemcallnumber>.', 'Textarea');
 INSERT INTO systempreferences
(variable,value,options,explanation,type)VALUES('SpineLabelAutoPrint',
'0', '', 'If this setting is turned on, a print dialog will
automatically pop up for the quick spine label printer.', 'YesNo');
 INSERT INTO `systempreferences`
(variable,value,explanation,options,type)
VALUES('AWSPrivateKey','','See:  http://aws.amazon.com.  Note that
this is required after 2009/08/15 in order to retrieve any enhanced
content other than book covers from Amazon.','','free');
+INSERT INTO `systempreferences`
(variable,value,explanation,options,type) VALUES
('OPACSearchForTitleIn','<li class="yuimenuitem"><a target="_blank"
class="yuimenuitemlabel"
href="http://worldcat.org/search?q=TITLE"">Other Libraries
(WorldCat)</a></li>\n<li class="yuimenuitem"><a
class="yuimenuitemlabel"
href="http://www.scholar.google.com/scholar?q=TITLE"
target="_blank">Other Databases (Google Scholar)</a></li>\n<li
class="yuimenuitem"><a class="yuimenuitemlabel"
href="http://www.bookfinder.com/search/?author=AUTHOR&amp;title=TITLE&amp;st=xl&amp;ac=qr"
target="_blank">Online Stores (Bookfinder.com)</a></li>','Enter the
HTML that will appear in the \'Search for this title in\' box on the
detail page in the OPAC.  Enter TITLE, AUTHOR, or ISBN in place of
their respective variables in the URL. Leave blank to disable \'More
Searches\' menu.','70|10','Textarea')
\ No newline at end of file
diff --git a/installer/data/mysql/updatedatabase.pl
b/installer/data/mysql/updatedatabase.pl
index 293d9fa..4aab44e 100755
--- a/installer/data/mysql/updatedatabase.pl
+++ b/installer/data/mysql/updatedatabase.pl
@@ -2536,6 +2536,13 @@ if (C4::Context->preference("Version") <
TransformToNum($DBversion)) {
     print " Upgrade to $DBversion done (changed catalogue to catalog
per the standard)\n";
 }

+$DBversion = '3.01.00.XXX';
+     if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
+     $dbh->do("INSERT INTO `systempreferences`
(variable,value,explanation,options,type) VALUES
('OPACSearchForTitleIn','<li class="yuimenuitem"><a target="_blank"
class="yuimenuitemlabel"
href="http://worldcat.org/search?q=TITLE"">Other Libraries
(WorldCat)</a></li>\n<li class="yuimenuitem"><a
class="yuimenuitemlabel"
href="http://www.scholar.google.com/scholar?q=TITLE"
target="_blank">Other Databases (Google Scholar)</a></li>\n<li
class="yuimenuitem"><a class="yuimenuitemlabel"
href="http://www.bookfinder.com/search/?author=AUTHOR&amp;title=TITLE&amp;st=xl&amp;ac=qr"
target="_blank">Online Stores (Bookfinder.com)</a></li>','Enter the
HTML that will appear in the \'Search for this title in\' box on the
detail page in the OPAC.  Enter TITLE, AUTHOR, or ISBN in place of
their respective variables in the URL.  Leave blank to disable \'More
Searches\' menu.','70|10','Textarea')");
+     SetVersion ($DBversion);
+     print "Add OPACSearchForTitleIn system preference which will
hold the links found on opac_detail under 'More Searches')\n";
+     }
+
 =item DropAllForeignKeys($table)

   Drop all foreign keys of the table $table
diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tmpl
b/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tmpl
index 7ee17cf..12a5003 100644
--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tmpl
+++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tmpl
@@ -762,16 +762,18 @@ YAHOO.util.Event.onContentReady("furtherm", function () {
 		<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">
-<li class="yuimenuitem"><!-- TMPL_IF NAME="OPACURLOpenInNewWindow"
--><a class="yuimenuitemlabel" href="http://worldcat.org/search?q=<!--
TMPL_VAR NAME="title" ESCAPE="url" -->" target="_blank">Other
Libraries (WorldCat)</a><!-- TMPL_ELSE --><a class="yuimenuitemlabel"
href="http://worldcat.org/search?q=<!-- TMPL_VAR NAME="title"
ESCAPE="url" -->">Other Libraries (WorldCat)</a><!-- /TMPL_IF --></li>
-<li class="yuimenuitem"><!-- TMPL_IF NAME="OPACURLOpenInNewWindow"
--><a class="yuimenuitemlabel"
href="http://www.scholar.google.com/scholar?q=<!-- TMPL_VAR
NAME="title" ESCAPE="url" -->" target="_blank">Other Databases (Google
Scholar)</a><!-- TMPL_ELSE --><a class="yuimenuitemlabel"
href="http://www.scholar.google.com/scholar?q=<!-- TMPL_VAR
NAME="title" ESCAPE="url" -->">Other Databases (Google
Scholar)</a><!-- /TMPL_IF --></li>
-<li class="yuimenuitem"><!-- TMPL_IF NAME="OPACURLOpenInNewWindow"
--><a class="yuimenuitemlabel"
href="http://www.bookfinder.com/search/?author=<!-- TMPL_VAR
NAME="author" -->&amp;title=<!-- TMPL_VAR NAME="title"
-->&amp;st=xl&amp;ac=qr" target="_blank">Online Stores
(Bookfinder.com)</a><!-- TMPL_ELSE --><a class="yuimenuitemlabel"
href="http://www.bookfinder.com/search/?author=<!-- TMPL_VAR
NAME="author" -->&amp;title=<!-- TMPL_VAR NAME="title"
-->&amp;st=xl&amp;ac=qr">Online Stores (Bookfinder.com)</a><!--
/TMPL_IF --></li>
+
+<!-- TMPL_VAR NAME="OPACSearchForTitleIn" -->
+
 </ul>
 </div>
 </div>
+<!-- /TMPL_IF -->

         <div id="export" class="detailtagcell">
         <form method="get" action="/cgi-bin/koha/opac-export.pl">
diff --git a/opac/opac-detail.pl b/opac/opac-detail.pl
index f0ba0c5..dd73cfc 100755
--- a/opac/opac-detail.pl
+++ b/opac/opac-detail.pl
@@ -542,4 +542,13 @@ if (C4::Context->preference('TagsEnabled') and
$tag_quantity = C4::Context->pref
 								'sort'=>'-weight', limit=>$tag_quantity}));
 }

+#Search for title in links
+if (my $search_for_title = C4::Context->preference('OPACSearchForTitleIn')){
+    $search_for_title =~ s/AUTHOR/$dat->{author}/g;
+    $search_for_title =~ s/TITLE/$dat->{title}/g;
+    $search_for_title =~ s/ISBN/$isbn/g;
+ $template->param('OPACSearchForTitleIn' => $search_for_title);
+}
+
+
 output_html_with_http_headers $query, $cookie, $template->output;
-- 
1.5.6.5


More information about the Koha-patches mailing list