From 4e030f77264f7f7a11029a4390bc4ec990d65829 Mon Sep 17 00:00:00 2001 From: James Fournie Date: Fri, 22 Feb 2013 17:28:29 -0800 Subject: [PATCH] Server maintenance message via Apache config This adds a custom maintenance message which you can issue in your Apache config by setting the environment variable "MAINTENANCE_MESSAGE" and restarting/reloading Apache. This message appears in the TPAC for both staff and patrons in the form of a red banner across the top of the screen. Signed-off-by: James Fournie 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/opac/css/style.css.tt2 | 10 +++++++++- Open-ILS/src/templates/opac/parts/topnav.tt2 | 5 +++++ Open-ILS/web/opac/skin/default/xml/home/index_body.xml | 6 ++++++ 5 files changed, 25 insertions(+), 1 deletion(-) diff --git a/Open-ILS/examples/apache/eg.conf.in b/Open-ILS/examples/apache/eg.conf.in index d095e15b2a..53347df13e 100644 --- a/Open-ILS/examples/apache/eg.conf.in +++ b/Open-ILS/examples/apache/eg.conf.in @@ -149,3 +149,6 @@ 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 0838a29eb5..e2de1e8a85 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader.pm @@ -243,6 +243,8 @@ 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/opac/css/style.css.tt2 b/Open-ILS/src/templates/opac/css/style.css.tt2 index 63c20bfbca..00d90d975d 100644 --- a/Open-ILS/src/templates/opac/css/style.css.tt2 +++ b/Open-ILS/src/templates/opac/css/style.css.tt2 @@ -1527,4 +1527,12 @@ a.preflib_change { padding-top: 1em; padding-bottom: 0.5em; font-style: italic; -} \ No newline at end of file +} + +#maintenance_message { + padding: 5px; + width: 100%; + background-color: [% css_colors.text_alert %]; + color: [% css_colors.text_invert %]; + text-align: center; +} diff --git a/Open-ILS/src/templates/opac/parts/topnav.tt2 b/Open-ILS/src/templates/opac/parts/topnav.tt2 index 7ac772888f..b6ba5e72b9 100644 --- a/Open-ILS/src/templates/opac/parts/topnav.tt2 +++ b/Open-ILS/src/templates/opac/parts/topnav.tt2 @@ -1,3 +1,8 @@ +[% IF ctx.maintenance_message %] +
+[%= ctx.maintenance_message %] +
+[% END %] [% IF !ctx.is_staff %]