From 259c53be118ad8168739f3104b3cb96e07bf5edf Mon Sep 17 00:00:00 2001 From: Robin Sheat Date: Wed, 21 May 2014 16:38:31 +1200 Subject: [PATCH] Bug 12296 - make search box customisable with OpacCustomSearch This allows the search box to be replaced by some custom HTML, useful when you're needing to integrate with some other search system, and don't want to maintain a template change across upgrades. Test plan: * Install patch * Look at the OPAC, see that nothing has changed. * Change the OpacCustomSearch syspref to something like

Zuul

* Look at the OPAC again, you can no longer search, there is only Zuul. Note: * should work on both prog and bootstrap --- installer/data/mysql/sysprefs.sql | 1 + installer/data/mysql/updatedatabase.pl | 12 ++ .../prog/en/modules/admin/preferences/opac.pref | 5 + .../opac-tmpl/bootstrap/en/includes/masthead.inc | 197 +++++++++++---------- koha-tmpl/opac-tmpl/prog/en/includes/masthead.inc | 7 +- 5 files changed, 125 insertions(+), 97 deletions(-) diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql index be2f63f..e7cb594 100644 --- a/installer/data/mysql/sysprefs.sql +++ b/installer/data/mysql/sysprefs.sql @@ -441,3 +441,4 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('z3950AuthorAuthFields','701,702,700',NULL,'Define the MARC biblio fields for Personal Name Authorities to fill biblio.author','free'), ('z3950NormalizeAuthor','0','','If ON, Personal Name Authorities will replace authors in biblio.author','YesNo') ; +INSERT INTO systempreferences (variable,value) VALUES('OpacCustomSearch',''); diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index 8bd0f53..ed5ee05 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -8483,6 +8483,18 @@ if ( CheckVersion($DBversion) ) { SetVersion ($DBversion); } +$DBversion = "XXX"; +if ( CheckVersion($DBversion) ) { + $dbh->do( + q{ +INSERT INTO systempreferences (variable,value) VALUES('OpacCustomSearch',''); +} + ); + print +"Upgrade to $DBversion done (Bug 12296 - search box replaceable with a system preference)\n"; + SetVersion($DBversion); +} + =head1 FUNCTIONS =head2 TableExists($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 428f569..b553d62 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 @@ -300,6 +300,11 @@ OPAC: - pref: NoLoginInstructions type: textarea class: code + - + - "Replace the search box at the top of OPAC pages with the following HTML:" + - pref: OpacCustomSearch + type: textarea + class: code Features: - - pref: opacuserlogin diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc index d17f893..69845d8 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc +++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc @@ -1,3 +1,4 @@ +[% USE Koha %]
[% END # / UNLESS advsearch %] diff --git a/koha-tmpl/opac-tmpl/prog/en/includes/masthead.inc b/koha-tmpl/opac-tmpl/prog/en/includes/masthead.inc index 28449fc..f899652 100644 --- a/koha-tmpl/opac-tmpl/prog/en/includes/masthead.inc +++ b/koha-tmpl/opac-tmpl/prog/en/includes/masthead.inc @@ -28,7 +28,9 @@ [% IF ( OpacPublic ) %]
-[% UNLESS ( advsearch ) %]
+[% UNLESS ( advsearch ) %] +[% IF Koha.Preference('OpacCustomSearch') == '' %] +