Bug 1934: Add system preference to handle editing of 'More searches'
authorNicole Engard <nengard@gmail.com>
Sun, 23 Aug 2009 09:41:34 +0000 (05:41 -0400)
committerGalen Charlton <gmcharlt@gmail.com>
Sun, 23 Aug 2009 23:55:31 +0000 (19:55 -0400)
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.

Signed-off-by: Galen Charlton <gmcharlt@gmail.com>
admin/systempreferences.pl
installer/data/mysql/en/mandatory/sysprefs.sql
installer/data/mysql/updatedatabase.pl
koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tmpl
opac/opac-detail.pl

index 222f96c..4c856da 100755 (executable)
@@ -314,6 +314,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";
index b83cfdf..ec042d4 100644 (file)
@@ -256,3 +256,4 @@ INSERT INTO `systempreferences` ( `variable` , `value` , `options` , `explanatio
 INSERT INTO `systempreferences` ( `variable` , `value` , `options` , `explanation` , `type` ) VALUES ( 'ReturnToShelvingCart', '0', '', 'If set, when any item is ''checked in'', it''s location code will be changed to CART.', 'YesNo');
 INSERT INTO `systempreferences` ( `variable` , `value` , `options` , `explanation` , `type` ) VALUES ( 'DisplayClearScreenButton', '0', '', 'If set to yes, a clear screen button will appear on the circulation page.', 'YesNo');
 INSERT INTO systempreferences (variable,value,options,explanation,type)VALUES('HidePatronName', '0', '', 'If this is switched on, patron''s cardnumber will be shown instead of their name on the holds and catalog screens', 'YesNo');
+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')
index 4cdff40..567aeb1 100755 (executable)
@@ -2593,6 +2593,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
index 7ee17cf..12a5003 100644 (file)
@@ -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">
index f0ba0c5..dd73cfc 100755 (executable)
@@ -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;