[Koha-patches] [PATCH] [SIGNED-OFF] Enh 6165: Add OPACResultsSidebar system preference

Nicole C. Engard nengard at bywatersolutions.com
Thu Sep 8 12:33:14 CEST 2011


From: Ian Walls <ian.walls at bywatersolutions.com>

Adds a system preference for displaying content under the "Refine your Search" menu
on OPAC search results.  Arbitrary HTML can be added, like OpacNav, opacheader, opaccredits
and other such system preferences

Signed-off-by: Nicole C. Engard <nengard at bywatersolutions.com>
---
 installer/data/mysql/sysprefs.sql                  |    1 +
 installer/data/mysql/updatedatabase.pl             |    7 +++++++
 .../prog/en/modules/admin/preferences/opac.pref    |    5 +++++
 .../opac-tmpl/prog/en/includes/opac-facets.inc     |    5 +++++
 opac/opac-search.pl                                |    1 +
 5 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql
index 8407505..79d4893 100755
--- a/installer/data/mysql/sysprefs.sql
+++ b/installer/data/mysql/sysprefs.sql
@@ -85,6 +85,7 @@ INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES
 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');
 INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OpacPrivacy', '0', 'if ON, allows patrons to define their privacy rules (reading history)',NULL,'YesNo');
 INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('opacreadinghistory',1,'If ON, enables display of Patron Circulation History in OPAC','','YesNo');
+INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OPACResultsSidebar','','Define HTML to be included on the search results page, underneath the facets sidebar','70|10','Textarea');
 INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('opacsmallimage','','Enter a complete URL to an image to replace the default Koha logo','','free');
 INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('opacstylesheet','','Enter a complete URL to use an alternate layout stylesheet in OPAC','','free');
 INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('opacthemes','prog','Define the current theme for the OPAC interface.','','Themes');
diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl
index bdfc9ac..afdd954 100755
--- a/installer/data/mysql/updatedatabase.pl
+++ b/installer/data/mysql/updatedatabase.pl
@@ -4439,6 +4439,13 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
     SetVersion($DBversion);
 }
 
+$DBversion = "3.05.00.XXX";
+if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
+    $dbh->do("INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OPACResultsSidebar','','Define HTML to be included on the search results page, underneath the facets sidebar','70|10','Textarea')");
+    print "Upgrade to $DBversion done (add OPACResultsSidebar syspref (enh 6165))\n";
+    SetVersion($DBversion);
+}
+
 
 =head1 FUNCTIONS
 
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 4a7c652..8bbf692 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
@@ -165,6 +165,11 @@ OPAC:
               type: textarea
               class: code
         -
+            - "Include the following HTML under the facets in OPAC search results:"
+            - pref: OPACResultsSidebar
+              type: textarea
+              class: code
+        -
             - pref: OpacAddMastheadLibraryPulldown
               choices: 
                   yes: Add
diff --git a/koha-tmpl/opac-tmpl/prog/en/includes/opac-facets.inc b/koha-tmpl/opac-tmpl/prog/en/includes/opac-facets.inc
index 7a2b743..4e6c935 100644
--- a/koha-tmpl/opac-tmpl/prog/en/includes/opac-facets.inc
+++ b/koha-tmpl/opac-tmpl/prog/en/includes/opac-facets.inc
@@ -25,5 +25,10 @@
 [% END %]
 </ul>
 </div>
+[% IF ( OPACResultsSidebar ) %]
+<div id="opacresultssidebar">
+[% OPACResultsSidebar %]
+</div>
+[% END %]
 [% END %]
 [% END %]
diff --git a/opac/opac-search.pl b/opac/opac-search.pl
index 8f6b67a..dfe4d74 100755
--- a/opac/opac-search.pl
+++ b/opac/opac-search.pl
@@ -405,6 +405,7 @@ if (C4::Context->preference('OpacSuppression')) {
 }
 
 $template->param ( LIMIT_INPUTS => \@limit_inputs );
+$template->param ( OPACResultsSidebar => C4::Context->preference('OPACResultsSidebar'));
 
 ## II. DO THE SEARCH AND GET THE RESULTS
 my $total = 0; # the total results for the whole set
-- 
1.7.2.3



More information about the Koha-patches mailing list