@@ -, +, @@ additional contents - In the staff client, go to Tools -> HTML customizations and verify that the content from OpacMaintenanceNotice is now stored there. - The HTML customization entry form should offer OpacMaintenanceNotice as a choice under "Display location." - Update and reinstall active translations (for instance fr-FR): - perl misc/translator/translate update fr-FR - perl misc/translator/translate install fr-FR - Enable the translation if necessary under Administration -> System preferences -> language. - Enable the "opaclanguagesdisplay" preference if necessary. - Enable the "OpacMaintenance" system preference. - Edit the OpacMaintenanceNotice HTML customization and add unique content to the "fr-FR" tab. - Try to view any page in the OPAC. You should see the content you added to the OpacMaintenanceNotice HTML customization. - Switch to your updated translation. The page should redisplay with your translated content. - Go to Administration -> System preferences and search for "OpacMaintenanceNotice." The search should return no results. --- ...aintenanceNotice-to-additional-contents.pl | 29 +++++++++++++++ installer/data/mysql/mandatory/sysprefs.sql | 1 - .../en/modules/admin/preferences/opac.pref | 8 +--- .../en/modules/tools/additional-contents.tt | 2 +- .../bootstrap/en/includes/opac-bottom.inc | 4 +- .../bootstrap/en/modules/maintenance.tt | 37 +++++++++++++++++-- opac/maintenance.pl | 13 +++++-- 7 files changed, 77 insertions(+), 17 deletions(-) create mode 100755 installer/data/mysql/atomicupdate/bug-23798-move-OpacMaintenanceNotice-to-additional-contents.pl --- a/installer/data/mysql/atomicupdate/bug-23798-move-OpacMaintenanceNotice-to-additional-contents.pl +++ a/installer/data/mysql/atomicupdate/bug-23798-move-OpacMaintenanceNotice-to-additional-contents.pl @@ -0,0 +1,29 @@ +use Modern::Perl; + +return { + bug_number => "23798", + description => "Convert OpacMaintenanceNotice system preference to additional contents", + up => sub { + my ($args) = @_; + my ( $dbh, $out ) = @$args{qw(dbh out)}; + + # Get any existing value from the OpacMaintenanceNotice system preference + my ($opacmaintenancenotice) = $dbh->selectrow_array( + q| + SELECT value FROM systempreferences WHERE variable='OpacMaintenanceNotice'; + | + ); + if ($opacmaintenancenotice) { + + # Insert any values found from system preference into additional_contents + $dbh->do( + "INSERT INTO additional_contents ( category, code, location, branchcode, title, content, lang, published_on ) VALUES ('html_customizations', 'OpacMaintenanceNotice', 'OpacMaintenanceNotice', NULL, 'OpacMaintenanceNotice default', ?, 'default', CAST(NOW() AS date) )", + undef, $opacmaintenancenotice + ); + + # Remove old system preference + $dbh->do("DELETE FROM systempreferences WHERE variable='OpacMaintenanceNotice'"); + say $out "Bug 23798 update done"; + } + } + } --- a/installer/data/mysql/mandatory/sysprefs.sql +++ a/installer/data/mysql/mandatory/sysprefs.sql @@ -483,7 +483,6 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('OpacLocationOnDetail','holding','holding|home|both|column','In the OPAC detail, display the shelving location on its own column or under a library columns.', 'Choice'), ('OPACMandatoryHoldDates', '', '|start|end|both', 'Define which hold dates are required on OPAC reserve form', 'Choice'), ('OpacMaintenance','0','','If ON, enables maintenance warning in OPAC','YesNo'), -('OpacMaintenanceNotice','','','A user-defined block of HTML to appear on screen when OpacMaintenace is enabled','Textarea'), ('OpacMaxItemsToDisplay','50','','Max items to display at the OPAC on a biblio detail','Integer'), ('OpacMetaDescription','','','This description will show in search engine results (160 characters).','Textarea'), ('OPACMySummaryHTML','','70|10','Enter the HTML that will appear in a column on the \'my summary\' and \'my checkout history\' tabs when a user is logged in to the OPAC. Enter {BIBLIONUMBER}, {TITLE}, {AUTHOR}, or {ISBN} in place of their respective variables in the HTML. Leave blank to disable.','Textarea'), --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref @@ -55,13 +55,7 @@ OPAC: choices: 1: Show 0: "Don't show" - - "a warning that the OPAC is under maintenance, instead of the OPAC itself. Note: this shows the same warning as when the database needs to be upgraded, but unconditionally." - - - - 'Show the following HTML when OpacMaintenance is enabled:' - - pref: OpacMaintenanceNotice - type: textarea - syntax: text/html - class: code + - "a warning that the OPAC is under maintenance, instead of the OPAC itself. Note: this shows the same warning as when the database needs to be upgraded, but unconditionally. A custom message can be shown on OPAC maintenance page by creating an HTML customization in the OpacMaintenanceNotice region." - - "This description will show in search engine results (160 characters)." - pref: OpacMetaDescription --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/additional-contents.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/additional-contents.tt @@ -524,7 +524,7 @@ [% END %] [% END %] [% ELSE %] - [% SET opac_available_options = [ 'OpacNavRight', 'opacheader', 'OpacCustomSearch', 'OpacMainUserBlock', 'opaccredits', 'OpacLoginInstructions', 'OpacNav', 'OpacNavBottom', 'OpacSuggestionInstructions', 'ArticleRequestsDisclaimerText', 'OpacMoreSearches', 'OpacMySummaryNote', 'OpacLibraryInfo', 'CatalogConcernHelp', 'CatalogConcernTemplate', 'CookieConsentBar', 'CookieConsentPopup' ] %] + [% SET opac_available_options = [ 'OpacNavRight', 'opacheader', 'OpacCustomSearch', 'OpacMainUserBlock', 'opaccredits', 'OpacLoginInstructions', 'OpacNav', 'OpacNavBottom', 'OpacSuggestionInstructions', 'ArticleRequestsDisclaimerText', 'OpacMoreSearches', 'OpacMySummaryNote', 'OpacLibraryInfo', 'OpacMaintenanceNotice', 'CatalogConcernHelp', 'CatalogConcernTemplate', 'CookieConsentBar', 'CookieConsentPopup' ] %] [% FOREACH l IN opac_available_options.sort %] [% IF l == location %] --- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-bottom.inc +++ a/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-bottom.inc @@ -55,8 +55,8 @@ [% IF OpacLangSelectorMode == 'both' || OpacLangSelectorMode == 'footer' %] - [% IF ( opaclanguagesdisplay ) %] - [% IF ( languages_loop && opaclanguagesdisplay ) %] + [% IF ( Koha.Preference('opaclanguagesdisplay') ) %] + [% IF ( languages_loop ) %] [% UNLESS ( one_language_enabled ) %]