From 03adba6a62dc8216ce1c1175c1d71e62549d75e3 Mon Sep 17 00:00:00 2001 From: Robin Sheat Date: Wed, 25 Jun 2014 14:42:18 +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. Signed-off-by: Owen Leonard Works as advertised. Seems like it would be really easy to screw up your OPAC with this feature, but since we already offer other easy ways to screw up your OPAC I guess this fits in. New patch changes: removed the bootstrap code, changed the entry in syspref.sql --- installer/data/mysql/sysprefs.sql | 2 + installer/data/mysql/updatedatabase.pl | 12 ++ .../prog/en/modules/admin/preferences/opac.pref | 5 + .../opac-tmpl/bootstrap/en/includes/masthead.inc | 197 +++++++++++---------- 4 files changed, 120 insertions(+), 96 deletions(-) diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql index 5e4ce7c..1ed0975 100644 --- a/installer/data/mysql/sysprefs.sql +++ b/installer/data/mysql/sysprefs.sql @@ -225,6 +225,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('OpacBrowseResults','1',NULL,'Disable/enable browsing and paging search results from the OPAC detail page.','YesNo'), ('OpacCloud','0',NULL,'If ON, enables subject cloud on OPAC','YesNo'), ('opaccolorstylesheet','colors.css','','Define an auxiliary stylesheet for OPAC use, to override specified settings from the primary opac.css stylesheet. Enter the filename (if the file is in the server\'s css directory) or a complete URL beginning with http (if the file lives on a remote server).','free'), +('OpacCustomSearch','','70|10','Replace the search box on the OPAC with the provided HTML','Textarea'), ('opaccredits','','70|10','Define HTML Credits at the bottom of the OPAC page','Textarea'), ('OPACdefaultSortField','relevance','relevance|popularity|call_number|pubdate|acqdate|title|author','Specify the default field used for sorting','Choice'), ('OPACdefaultSortOrder','dsc','asc|dsc|za|az','Specify the default sort order','Choice'), @@ -446,3 +447,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); diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index c68ba51..4f0bd40 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -8560,6 +8560,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 1304cef..40b3e61 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 @@ -316,6 +316,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 %] -- 1.8.3.2