From ecb1e046a62546939a29334b7e47a06285097914 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 Signed-off-by: Katrin Fischer Works as described, passes QA script and tests. The feature has some limitations, described on the bug. Signed-off-by: Tomas Cohen Arazi --- installer/data/mysql/sysprefs.sql | 2 + installer/data/mysql/updatedatabase.pl | 9 + .../en/modules/admin/preferences/opac.pref | 5 + .../bootstrap/en/includes/masthead.inc | 197 +++++++++--------- 4 files changed, 117 insertions(+), 96 deletions(-) diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql index b845d53371..408dc68925 100644 --- a/installer/data/mysql/sysprefs.sql +++ b/installer/data/mysql/sysprefs.sql @@ -228,6 +228,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','','','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'), @@ -448,3 +449,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 eb12838d40..3fd02bd1bf 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -8800,6 +8800,15 @@ if ( CheckVersion($DBversion) ) { SetVersion($DBversion); } +$DBversion = "3.17.00.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 2770e53e54..7a5bfe5f76 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 @@ -308,6 +308,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 ca85378443..5355d756d9 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 %] -- 2.39.5