Bugzilla – Attachment 29341 Details for
Bug 12296
OPAC search box should be customisable
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
[PASSED QA] Bug 12296 - make search box customisable with OpacCustomSearch
PASSED-QA-Bug-12296---make-search-box-customisable.patch (text/plain), 19.49 KB, created by
Katrin Fischer
on 2014-06-28 10:37:31 UTC
(
hide
)
Description:
[PASSED QA] Bug 12296 - make search box customisable with OpacCustomSearch
Filename:
MIME Type:
Creator:
Katrin Fischer
Created:
2014-06-28 10:37:31 UTC
Size:
19.49 KB
patch
obsolete
>From 21ac2dd26fb27322ee212a6ffb076102b97ff078 Mon Sep 17 00:00:00 2001 >From: Robin Sheat <robin@catalyst.net.nz> >Date: Wed, 25 Jun 2014 14:42:18 +1200 >Subject: [PATCH] [PASSED QA] 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 <h1>Zuul</h1> >* Look at the OPAC again, you can no longer search, there is only Zuul. > >Signed-off-by: Owen Leonard <oleonard@myacpl.org> > >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 <Katrin.Fischer.83@web.de> >Works as described, passes QA script and tests. >The feature has some limitations, described on the bug. >--- > 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 %] > <div id="wrap"> > <div id="header-region"> > <div class="navbar navbar-inverse navbar-static-top"> >@@ -132,112 +133,116 @@ > [% ELSE %] > <div class="mastheadsearch"> > [% END %] >- <form name="searchform" method="get" action="/cgi-bin/koha/opac-search.pl" id="searchform" class="form-inline"> >- <label for="masthead_search"> Search >- [% UNLESS ( Koha.Preference( 'OpacAddMastheadLibraryPulldown' ) == 1 ) %] >- [% IF ( mylibraryfirst ) %] >- (in [% mylibraryfirst %] only) >+ [% IF Koha.Preference('OpacCustomSearch') == '' %] >+ <form name="searchform" method="get" action="/cgi-bin/koha/opac-search.pl" id="searchform" class="form-inline"> >+ <label for="masthead_search"> Search >+ [% UNLESS ( Koha.Preference( 'OpacAddMastheadLibraryPulldown' ) == 1 ) %] >+ [% IF ( mylibraryfirst ) %] >+ (in [% mylibraryfirst %] only) >+ [% END %] > [% END %] >- [% END %] >- </label> >+ </label> > >- <select name="idx" id="masthead_search"> >- [% IF ( ms_kw ) %] >- <option selected="selected" value="">Library catalog</option> >- [% ELSE %] >- <option value="">Library catalog</option> >- [% END # /ms_kw %] >- [% IF ( ms_ti ) %] >- <option selected="selected" value="ti">Title</option> >- [% ELSE %] >- <option value="ti">Title</option> >- [% END # /ms_ti %] >- [% IF ( ms_au ) %] >- <option selected="selected" value="au">Author</option> >- [% ELSE %] >- <option value="au">Author</option> >- [% END # /ms_au%] >- [% IF ( ms_su ) %] >- <option selected="selected" value="su">Subject</option> >- [% ELSE %] >- <option value="su">Subject</option> >- [% END # /ms_su %] >- [% IF ( ms_nb ) %] >- <option selected="selected" value="nb">ISBN</option> >- [% ELSE %] >- <option value="nb">ISBN</option> >- [% END # /ms_nb%] >- [% IF ( ms_se ) %] >- <option selected="selected" value="se">Series</option> >- [% ELSE %] >- <option value="se">Series</option> >- [% END # /ms_se %] >- [% IF ( numbersphr ) %] >- [% IF ( ms_callnum ) %] >- <option selected="selected" value="callnum,phr">Call number</option> >+ <select name="idx" id="masthead_search"> >+ [% IF ( ms_kw ) %] >+ <option selected="selected" value="">Library catalog</option> > [% ELSE %] >- <option value="callnum,phr">Call number</option> >- [% END #/ms_callnum %] >- [% ELSE %] >- [% IF ( ms_callnum ) %] >- <option selected="selected" value="callnum">Call number</option> >+ <option value="">Library catalog</option> >+ [% END # /ms_kw %] >+ [% IF ( ms_ti ) %] >+ <option selected="selected" value="ti">Title</option> >+ [% ELSE %] >+ <option value="ti">Title</option> >+ [% END # /ms_ti %] >+ [% IF ( ms_au ) %] >+ <option selected="selected" value="au">Author</option> >+ [% ELSE %] >+ <option value="au">Author</option> >+ [% END # /ms_au%] >+ [% IF ( ms_su ) %] >+ <option selected="selected" value="su">Subject</option> >+ [% ELSE %] >+ <option value="su">Subject</option> >+ [% END # /ms_su %] >+ [% IF ( ms_nb ) %] >+ <option selected="selected" value="nb">ISBN</option> > [% ELSE %] >- <option value="callnum">Call number</option> >- [% END # /ms_callnum %] >- [% END # /numbersphr %] >- </select> >+ <option value="nb">ISBN</option> >+ [% END # /ms_nb%] >+ [% IF ( ms_se ) %] >+ <option selected="selected" value="se">Series</option> >+ [% ELSE %] >+ <option value="se">Series</option> >+ [% END # /ms_se %] >+ [% IF ( numbersphr ) %] >+ [% IF ( ms_callnum ) %] >+ <option selected="selected" value="callnum,phr">Call number</option> >+ [% ELSE %] >+ <option value="callnum,phr">Call number</option> >+ [% END #/ms_callnum %] >+ [% ELSE %] >+ [% IF ( ms_callnum ) %] >+ <option selected="selected" value="callnum">Call number</option> >+ [% ELSE %] >+ <option value="callnum">Call number</option> >+ [% END # /ms_callnum %] >+ [% END # /numbersphr %] >+ </select> > >- [% UNLESS ( Koha.Preference( 'OpacAddMastheadLibraryPulldown' ) == 1 ) %] >- <div class="input-append nolibrarypulldown"> >- [% END %] >- [% IF ( ms_value ) %] >- <input type="text" title="Type search term" class="transl1" name="q" value="[% ms_value |html %]" /><span id="translControl"></span> >- [% ELSE %] >- <input type="text" title="Type search term" class="transl1" name="q" /><span id="translControl"></span> >- [% END # /ms_value %] >+ [% UNLESS ( Koha.Preference( 'OpacAddMastheadLibraryPulldown' ) == 1 ) %] >+ <div class="input-append nolibrarypulldown"> >+ [% END %] >+ [% IF ( ms_value ) %] >+ <input type="text" title="Type search term" class="transl1" name="q" value="[% ms_value |html %]" /><span id="translControl"></span> >+ [% ELSE %] >+ <input type="text" title="Type search term" class="transl1" name="q" /><span id="translControl"></span> >+ [% END # /ms_value %] > >- [% UNLESS ( Koha.Preference( 'OpacAddMastheadLibraryPulldown' ) == 1 ) %] >- <button type="submit" id="searchsubmit" class="btn btn-primary">Go</button> >- </div> >- [% END %] >+ [% UNLESS ( Koha.Preference( 'OpacAddMastheadLibraryPulldown' ) == 1 ) %] >+ <button type="submit" id="searchsubmit" class="btn btn-primary">Go</button> >+ </div> >+ [% END %] > >- [% IF ( Koha.Preference( 'OpacAddMastheadLibraryPulldown' ) == 1 ) %] >- <div class="input-append"> >- <select name="branch_group_limit" id="select_library"> >- <option value="">All libraries</option> >- [% IF BranchCategoriesLoop %]<optgroup label="Libraries">[% END %] >- [% FOREACH BranchesLoo IN BranchesLoop %] >- [% IF ( BranchesLoo.selected ) %]<option selected="selected" value="branch:[% BranchesLoo.value %]">[% BranchesLoo.branchname %]</option> >- [% ELSE %]<option value="branch:[% BranchesLoo.value %]">[% BranchesLoo.branchname %]</option>[% END %] >- [% END %] >- [% IF BranchCategoriesLoop %] >- </optgroup> >- <optgroup label="Groups"> >- [% FOREACH bc IN BranchCategoriesLoop %] >- [% IF ( bc.selected ) %] >- <option selected="selected" value="multibranchlimit-[% bc.categorycode %]">[% bc.categoryname %]</option> >- [% ELSE %] >- <option value="multibranchlimit-[% bc.categorycode %]">[% bc.categoryname %]</option> >- [% END # / bc.selected %] >+ [% IF ( Koha.Preference( 'OpacAddMastheadLibraryPulldown' ) == 1 ) %] >+ <div class="input-append"> >+ <select name="branch_group_limit" id="select_library"> >+ <option value="">All libraries</option> >+ [% IF BranchCategoriesLoop %]<optgroup label="Libraries">[% END %] >+ [% FOREACH BranchesLoo IN BranchesLoop %] >+ [% IF ( BranchesLoo.selected ) %]<option selected="selected" value="branch:[% BranchesLoo.value %]">[% BranchesLoo.branchname %]</option> >+ [% ELSE %]<option value="branch:[% BranchesLoo.value %]">[% BranchesLoo.branchname %]</option>[% END %] > [% END %] >- </optgroup> >- [% END # / BranchCategoriesLoop %] >- </select> >- <button type="submit" id="searchsubmit" class="btn btn-primary">Go</button> >- </div> >- [% ELSE %] >- [% IF ( opac_limit_override ) %] >- [% IF ( opac_search_limit ) %] >- <input name="limit" value="[% opac_search_limit %]" type="hidden" /> >- [% END %] >+ [% IF BranchCategoriesLoop %] >+ </optgroup> >+ <optgroup label="Groups"> >+ [% FOREACH bc IN BranchCategoriesLoop %] >+ [% IF ( bc.selected ) %] >+ <option selected="selected" value="multibranchlimit-[% bc.categorycode %]">[% bc.categoryname %]</option> >+ [% ELSE %] >+ <option value="multibranchlimit-[% bc.categorycode %]">[% bc.categoryname %]</option> >+ [% END # / bc.selected %] >+ [% END %] >+ </optgroup> >+ [% END # / BranchCategoriesLoop %] >+ </select> >+ <button type="submit" id="searchsubmit" class="btn btn-primary">Go</button> >+ </div> > [% ELSE %] >- [% IF ( mylibraryfirst ) %] >- <input name="limit" value="branch:[% mylibraryfirst %]" type="hidden" /> >- [% END %] >- [% END # / opac_limit_override %] >- [% END # / OpacAddMastheadLibraryPulldown %] >+ [% IF ( opac_limit_override ) %] >+ [% IF ( opac_search_limit ) %] >+ <input name="limit" value="[% opac_search_limit %]" type="hidden" /> >+ [% END %] >+ [% ELSE %] >+ [% IF ( mylibraryfirst ) %] >+ <input name="limit" value="branch:[% mylibraryfirst %]" type="hidden" /> >+ [% END %] >+ [% END # / opac_limit_override %] >+ [% END # / OpacAddMastheadLibraryPulldown %] > >- </form> >+ </form> >+ [% ELSE # / Koha.Preference('OpacCustomSearch') == '' %] >+ [% Koha.Preference('OpacCustomSearch') %] >+ [% END # / Koha.Preference('OpacCustomSearch') == '' %] > </div> <!-- / .mastheadsearch --> > [% END # / UNLESS advsearch %] > >-- >1.9.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 12296
:
28416
|
28476
|
28928
|
28942
|
29203
| 29341 |
32520