From 6a25b321280371818281ea180cdbf4e90509acc2 Mon Sep 17 00:00:00 2001 From: Dan Scott Date: Thu, 11 Jul 2013 10:41:32 -0400 Subject: [PATCH] Maintenance message: avoid Unicode corruption, support KPAC By shifting from an Apache config environment variable to a config.tt2 variable, we gain the advantage of more robust Unicode support as well as the ability to turn maintenance messages on or off without requiring a reload of Apache. However, we do lose the convenience of per-vhost maintenance messages; sites requiring this functionality can use the ctx.hostname variable to provide conditional per-host messages. This also adds support for displaying the maintenance message in the KPAC. Signed-off-by: Dan Scott Signed-off-by: Ben Shum --- Open-ILS/examples/apache/eg.conf.in | 3 --- Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader.pm | 2 -- Open-ILS/src/templates/kpac/parts/base.tt2 | 3 +++ Open-ILS/src/templates/opac/parts/config.tt2 | 5 +++++ Open-ILS/src/templates/opac/parts/topnav.tt2 | 8 +++----- Open-ILS/web/css/skin/default/kpac/style.css | 7 +++++++ 6 files changed, 18 insertions(+), 10 deletions(-) diff --git a/Open-ILS/examples/apache/eg.conf.in b/Open-ILS/examples/apache/eg.conf.in index 53347df13e..d095e15b2a 100644 --- a/Open-ILS/examples/apache/eg.conf.in +++ b/Open-ILS/examples/apache/eg.conf.in @@ -149,6 +149,3 @@ NameVirtualHost *:443 Include eg_vhost.conf -# Set a maintenance message for notifying OPAC users of scheduled downtime -# This can be put in specific vhosts as needed -#SetEnv MAINTENANCE_MESSAGE "The system will be down tomorrow night so use the card catalog at that time." diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader.pm index e2de1e8a85..0838a29eb5 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader.pm @@ -243,8 +243,6 @@ sub load_common { return $self->redirect_ssl unless $self->cgi->https; } - $ctx->{maintenance_message} = $self->apache->subprocess_env("MAINTENANCE_MESSAGE"); - $ctx->{referer} = $self->cgi->referer; $ctx->{path_info} = $self->cgi->path_info; $ctx->{full_path} = $ctx->{base_path} . $self->cgi->path_info; diff --git a/Open-ILS/src/templates/kpac/parts/base.tt2 b/Open-ILS/src/templates/kpac/parts/base.tt2 index 0685035855..7af00eda0c 100644 --- a/Open-ILS/src/templates/kpac/parts/base.tt2 +++ b/Open-ILS/src/templates/kpac/parts/base.tt2 @@ -10,6 +10,9 @@ [% l("Kid's Catalog - [_1]", ctx.page_title) %] + [%- IF ctx.maintenance_message -%] +
[% ctx.maintenance_message %]
+ [%- END -%]
[% INCLUDE 'kpac/parts/header.tt2' %]
[% content %]
diff --git a/Open-ILS/src/templates/opac/parts/config.tt2 b/Open-ILS/src/templates/opac/parts/config.tt2 index c8e87ef95f..1ba05cc121 100644 --- a/Open-ILS/src/templates/opac/parts/config.tt2 +++ b/Open-ILS/src/templates/opac/parts/config.tt2 @@ -149,4 +149,9 @@ search.basic_config = { # Set to 1 or 'true' to enable ctx.google_books_preview = 0; +############################################################################## +# Set a maintenance message to display in the catalogue +# +# ctx.maintenance_message = "The system will not be available February 29, 2104."; + %] diff --git a/Open-ILS/src/templates/opac/parts/topnav.tt2 b/Open-ILS/src/templates/opac/parts/topnav.tt2 index b6ba5e72b9..46c497a7a6 100644 --- a/Open-ILS/src/templates/opac/parts/topnav.tt2 +++ b/Open-ILS/src/templates/opac/parts/topnav.tt2 @@ -1,8 +1,6 @@ -[% IF ctx.maintenance_message %] -
-[%= ctx.maintenance_message %] -
-[% END %] +[%- IF ctx.maintenance_message -%] +
[% ctx.maintenance_message %]
+[%- END -%] [% IF !ctx.is_staff %]