Bugzilla – Attachment 99711 Details for
Bug 23796
Convert OpacCustomSearch system preference to news block
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 23796: Convert OpacCustomSearch system preference to news block
Bug-23796-Convert-OpacCustomSearch-system-preferen.patch (text/plain), 8.04 KB, created by
Owen Leonard
on 2020-02-27 18:07:15 UTC
(
hide
)
Description:
Bug 23796: Convert OpacCustomSearch system preference to news block
Filename:
MIME Type:
Creator:
Owen Leonard
Created:
2020-02-27 18:07:15 UTC
Size:
8.04 KB
patch
obsolete
>From b534a20e43593cc88817292c1f71835534281239 Mon Sep 17 00:00:00 2001 >From: Owen Leonard <oleonard@myacpl.org> >Date: Wed, 11 Dec 2019 18:20:46 +0000 >Subject: [PATCH] Bug 23796: Convert OpacCustomSearch system preference to news > block > >This patch moves the OpacCustomSearch system preference into the Koha >news system, making it possible to have language- and library-specific >content. > >To test you should have some content in the OpacCustomSearch system >preference. Apply the patch and run the database update process. > > - Go to the OPAC and confirm that the content which was previously in > the OpacCustomSearch system preference now displays correctly where > it was before. > - In the staff client, go to Tools -> News and verify that the content > from OpacCustomSearch is now stored in news items. There should be > one entry for each of the enabled translations in your system, for > instance 'OpacCustomSearch_en', 'OpacCustomSearch_fr-FR', > 'OpacCustomSearch_cs-CZ' > - Go to Administration -> System preferences and confirm that the > OpacCustomSearch preference has been removed. >--- > .../bug_23796-move-OpacCustomSearch-to-news.perl | 30 ++++++++++++++++++++++ > installer/data/mysql/sysprefs.sql | 1 - > .../prog/en/modules/admin/preferences/opac.pref | 6 ----- > .../prog/en/modules/tools/koha-news.tt | 2 +- > .../opac-tmpl/bootstrap/en/includes/masthead.inc | 9 ++++--- > 5 files changed, 36 insertions(+), 12 deletions(-) > create mode 100644 installer/data/mysql/atomicupdate/bug_23796-move-OpacCustomSearch-to-news.perl > >diff --git a/installer/data/mysql/atomicupdate/bug_23796-move-OpacCustomSearch-to-news.perl b/installer/data/mysql/atomicupdate/bug_23796-move-OpacCustomSearch-to-news.perl >new file mode 100644 >index 00000000000..0ae9e6e7598 >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/bug_23796-move-OpacCustomSearch-to-news.perl >@@ -0,0 +1,30 @@ >+$DBversion = 'XXX'; # will be replaced by the RM >+if( CheckVersion( $DBversion ) ) { >+ >+ # get list of installed translations >+ require C4::Languages; >+ my @langs; >+ my $tlangs = C4::Languages::getTranslatedLanguages(); >+ >+ foreach my $language ( @$tlangs ) { >+ foreach my $sublanguage ( @{$language->{'sublanguages_loop'}} ) { >+ push @langs, $sublanguage->{'rfc4646_subtag'}; >+ } >+ } >+ >+ # Get any existing value from the OpacCustomSearch system preference >+ my ($OpacCustomSearch) = $dbh->selectrow_array( q| >+ SELECT value FROM systempreferences WHERE variable='OpacCustomSearch'; >+ |); >+ if( $OpacCustomSearch ){ >+ foreach my $lang ( @langs ) { >+ print "Inserting OpacCustomSearch contents into $lang news item...\n"; >+ # If there is a value in the OpacCustomSearch preference, insert it into opac_news >+ $dbh->do("INSERT INTO opac_news (branchcode, lang, title, content ) VALUES (NULL, ?, '', ?)", undef, "OpacCustomSearch_$lang", $OpacCustomSearch); >+ } >+ } >+ # Remove the OpacCustomSearch system preference >+ $dbh->do("DELETE FROM systempreferences WHERE variable='OpacCustomSearch'"); >+ SetVersion ($DBversion); >+ print "Upgrade to $DBversion done (Bug 23796: Convert OpacCustomSearch system preference to news block)\n"; >+} >diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql >index b565b7f0bf2..9dcfe478b18 100644 >--- a/installer/data/mysql/sysprefs.sql >+++ b/installer/data/mysql/sysprefs.sql >@@ -370,7 +370,6 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` > ('OpacAdditionalStylesheet','','','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'), > ('OpacCoce','0', NULL, 'If on, enables cover retrieval from the configured Coce server in the OPAC', 'YesNo'), > ('OPACCustomCoverImages','0',NULL,'If enabled, the custom cover images will be displayed at the OPAC. CustomCoverImagesURL must be defined.','YesNo'), >-('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'), >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 9c9b2b7f009..ff54fc6f615 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 >@@ -357,12 +357,6 @@ OPAC: > syntax: text/html > class: code > - >- - "Replace the search box at the top of OPAC pages with the following HTML:" >- - pref: OpacCustomSearch >- type: textarea >- syntax: text/html >- class: code >- - > - "Display language selector on " > - pref: OpacLangSelectorMode > choices: >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/koha-news.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/koha-news.tt >index e73e613194b..282c989d300 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/koha-news.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/koha-news.tt >@@ -327,7 +327,7 @@ Edit news item[% ELSE %]Add news item[% END %][% ELSE %]News[% END %]</div> > [% END %] > [% FOREACH lang_lis IN lang_list %] > <optgroup label="[% lang_lis.language | html %]"> >- [% FOREACH location IN [ '', 'OpacNavRight', 'opacheader' ] %] >+ [% FOREACH location IN [ '', 'OpacNavRight', 'opacheader', 'OpacCustomSearch' ] %] > [% IF ( location == '' ) %] > [% SET location_lang = lang_lis.language %] > [% location = BLOCK %]OPAC news[% END %] >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc >index cef392338a4..2b514587947 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc >@@ -6,6 +6,7 @@ > [% PROCESS 'html_helpers.inc' %] > [% SET OpacLangSelectorMode = Koha.Preference('OpacLangSelectorMode') %] > [% SET OpacHeader = KohaNews.get( location => "opacheader", lang => lang, library => branchcode, blocktitle => 0 ) %] >+[% SET OpacCustomSearch = KohaNews.get( location => "OpacCustomSearch", lang => lang, library => branchcode, blocktitle => 0 ) %] > > <div id="wrap"> > <div id="header-region" class="noprint"> >@@ -170,7 +171,9 @@ > [% ELSE %] > <div class="mastheadsearch"> > [% END %] >- [% IF Koha.Preference('OpacCustomSearch') == '' %] >+ [% IF ( OpacCustomSearch ) %] >+ [% PROCESS koha_news_block news => OpacCustomSearch %] >+ [% ELSE %] > <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 ) %] >@@ -292,9 +295,7 @@ > [% END # / OpacAddMastheadLibraryPulldown %] > > </form> >- [% ELSE # / Koha.Preference('OpacCustomSearch') == '' %] >- [% Koha.Preference('OpacCustomSearch') | $raw %] >- [% END # / Koha.Preference('OpacCustomSearch') == '' %] >+ [% END # / ( OpacCustomSearch ) %] > </div> <!-- / .mastheadsearch --> > [% END # / UNLESS advsearch %] > >-- >2.11.0
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 23796
:
99711
|
103160
|
103324
|
106620