Koha/opac/maintenance.pl
Owen Leonard b7f0b58ee8
Bug 23798: Convert OpacMaintenanceNotice system preference to additional contents
This patch moves the OpacMaintenanceNotice system preference into HTML
customizations, making it possible to have language-specific content.

The patch modifies the OPAC maintenance page template so that the
language selection menu can be shown correctly according to the
OpacLangSelectorMode preference.

To test you should have some content in the OpacMaintenanceNotice
system preference before applying the patch. Apply the patch and run the
database update process.

- 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.

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-11-08 17:41:27 -03:00

52 lines
1.6 KiB
Perl
Executable file

#!/usr/bin/perl
# This file is part of Koha.
#
# Koha is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# Koha is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Koha; if not, see <http://www.gnu.org/licenses>.
use Modern::Perl;
use CGI qw ( -utf8 );
use C4::Auth qw( get_template_and_user );
use C4::Output qw( output_html_with_http_headers );
use Koha;
my $query = CGI->new;
my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
{
template_name => "maintenance.tt",
type => "opac",
query => $query,
authnotrequired => ( C4::Context->preference("OpacPublic") ? 1 : 0 ),
}
);
my $koha_db_version = C4::Context->preference('Version');
my $kohaversion = Koha::version();
# Strip dots from version
$kohaversion =~ s/\.//g if defined $kohaversion;
$koha_db_version =~ s/\.//g if defined $koha_db_version;
if ( !defined $koha_db_version || # DB not populated
$kohaversion > $koha_db_version || # Update needed
C4::Context->preference('OpacMaintenance') ) { # Maintenance mode enabled
output_html_with_http_headers $query, '', $template->output;
}
else {
print $query->redirect("/cgi-bin/koha/opac-main.pl");
}
1;