[Koha-patches] [PATCH 1/2] [SIGNED-OFF] Bug 1997: new OPACNoResultsFound pref
Katrin Fischer
Katrin.Fischer.83 at web.de
Sat Dec 11 21:17:55 CET 2010
From: Nicole Engard <nengard at bywatersolutions.com>
This patch adds a new preference to allow librarians to
add content to the no results found page if they want.
Signed-off-by: Katrin Fischer <Katrin.Fischer.83 at web.de>
Changed surrounding <p> in template to <div id="noresultsfound">
Will send follow up patch adding sys pref to translated sql files
---
installer/data/mysql/en/mandatory/sysprefs.sql | 1 +
installer/data/mysql/updatedatabase.pl | 11 +++++++++++
.../prog/en/modules/admin/preferences/opac.pref | 5 +++++
koha-tmpl/opac-tmpl/prog/en/includes/masthead.inc | 8 +++++++-
opac/opac-search.pl | 1 +
5 files changed, 25 insertions(+), 1 deletions(-)
diff --git a/installer/data/mysql/en/mandatory/sysprefs.sql b/installer/data/mysql/en/mandatory/sysprefs.sql
index d4fb9a2..be7b6c9 100644
--- a/installer/data/mysql/en/mandatory/sysprefs.sql
+++ b/installer/data/mysql/en/mandatory/sysprefs.sql
@@ -73,6 +73,7 @@ INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('opacheader','','Add HTML to be included as a custom header in the OPAC','70|10','Textarea');
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('opaclayoutstylesheet','opac.css','Enter the name of the layout CSS stylesheet to use in the OPAC','','free');
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OpacMaintenance',0,'If ON, enables maintenance warning in OPAC','','YesNo');
+INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OPACNoResultsFound','','Display this HTML when no results are found for a search in the OPAC','70|10','Textarea');
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OpacMainUserBlock','Welcome to Koha...\r\n<hr>','A user-defined block of HTML in the main content area of the opac main page','70|10','Textarea');
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OpacNav','Important links here.','Use HTML tags to add navigational links to the left-hand navigational bar in OPAC','70|10','Textarea');
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OpacPasswordChange',1,'If ON, enables patron-initiated password change in OPAC (disable it when using LDAP auth)',NULL,'YesNo');
diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl
index d093946..e3ee37a 100755
--- a/installer/data/mysql/updatedatabase.pl
+++ b/installer/data/mysql/updatedatabase.pl
@@ -3876,6 +3876,17 @@ VALUES
SetVersion ($DBversion);
};
+
+$DBversion = '3.03.00.XXX';
+if (C4::Context->preference('Version') < TransformToNum($DBversion)){
+ $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('OPACNoResultsFound','','Display this HTML when no results are found for a search in the OPAC','70|10','Textarea')");
+ print "Upgrade to $DBversion done adding syspref OPACNoResultsFound to control what displays when no results are found for a search in the OPAC.";
+ SetVersion ($DBversion);
+}
+
+=item DropAllForeignKeys($table)
+
+
=head1 FUNCTIONS
=head2 DropAllForeignKeys($table)
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref
index 55560d3..acab30a 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref
@@ -147,6 +147,11 @@ OPAC:
yes: Add
no: "Don't add"
- a library select pulldown menu on the OPAC masthead.
+ -
+ - 'Display this HTML when no results are found for a search in the OPAC:'
+ - pref: OPACNoResultsFound
+ type: textarea
+ class: code
Features:
-
- pref: opacuserlogin
diff --git a/koha-tmpl/opac-tmpl/prog/en/includes/masthead.inc b/koha-tmpl/opac-tmpl/prog/en/includes/masthead.inc
index 878a412..236f296 100644
--- a/koha-tmpl/opac-tmpl/prog/en/includes/masthead.inc
+++ b/koha-tmpl/opac-tmpl/prog/en/includes/masthead.inc
@@ -173,7 +173,7 @@
<!-- TMPL_IF NAME="searchdesc" --><p><!-- TMPL_IF name="total" --><strong>“<!-- TMPL_VAR NAME="query_desc" ESCAPE="HTML"--> <!-- TMPL_VAR NAME="limit_desc" ESCAPE="HTML"-->” </strong>returned <!-- TMPL_VAR NAME="total" ESCAPE="HTML"--> results. <!-- TMPL_IF NAME="related" --> (related searches: <!-- TMPL_LOOP NAME="related" --><!-- TMPL_VAR NAME="related_search" --><!-- /TMPL_LOOP -->). <!-- /TMPL_IF -->
<a href="<!-- TMPL_VAR NAME="OPACBaseURL" -->/cgi-bin/koha/opac-search.pl?<!-- TMPL_VAR name="query_cgi" ESCAPE="HTML" --><!-- TMPL_VAR NAME="limit_cgi" ESCAPE="HTML" --><!-- TMPL_IF NAME="sort_by" -->&sort_by=<!-- TMPL_VAR NAME="sort_by" ESCAPE="HTML" --><!-- /TMPL_IF -->&format=rss2"><img src="/opac-tmpl/prog/images/feed-icon-16x16.png" alt="Subscribe to this search" title="Subscribe to this search" border="0" /></a>
<!-- TMPL_ELSE -->
-<strong>No Result found!</strong>
+<strong>No Results Found!</strong>
<p>
<!-- TMPL_IF NAME="searchdesc" -->
No results match your search for <span style="font-weight: bold;">“<!-- TMPL_VAR NAME="query_desc" ESCAPE="HTML" --> <!-- TMPL_VAR NAME="limit_desc" ESCAPE="HTML"-->”</span> in <!-- TMPL_VAR NAME="LibraryName" --> Catalog. <a href="<!-- TMPL_VAR NAME="OPACBaseURL" -->/cgi-bin/koha/opac-search.pl?<!-- TMPL_VAR name="query_cgi" ESCAPE="HTML" --><!-- TMPL_VAR NAME="limit_cgi" ESCAPE="HTML" -->&format=rss2"><img src="/opac-tmpl/prog/images/feed-icon-16x16.png" alt="Subscribe to this search" title="Subscribe to this search" border="0" /></a>
@@ -181,5 +181,11 @@
You did not specify any search criteria.
<!-- /TMPL_IF -->
</p>
+<!-- TMPL_IF name="OPACNoResultsFound" -->
+<div id="noresultsfound">
+<!-- TMPL_VAR NAME="OPACNoResultsFound" -->
+</div>
+<!-- /TMPL_IF -->
+
</div>
<!-- /TMPL_IF --></p><!-- /TMPL_IF --></div>
diff --git a/opac/opac-search.pl b/opac/opac-search.pl
index 2bfcb6d..88f3a2f 100755
--- a/opac/opac-search.pl
+++ b/opac/opac-search.pl
@@ -97,6 +97,7 @@ elsif (C4::Context->preference("marcflavour") eq "MARC21" ) {
$template->param('usmarc' => 1);
}
$template->param( 'AllowOnShelfHolds' => C4::Context->preference('AllowOnShelfHolds') );
+$template->param( 'OPACNoResultsFound' => C4::Context->preference('OPACNoResultsFound') );
if (C4::Context->preference('BakerTaylorEnabled')) {
$template->param(
--
1.7.1
More information about the Koha-patches
mailing list