Server maintenance message via Apache config
authorJames Fournie <jfournie@sitka.bclibraries.ca>
Sat, 23 Feb 2013 01:28:29 +0000 (17:28 -0800)
committerBen Shum <bshum@biblio.org>
Thu, 11 Jul 2013 01:19:43 +0000 (21:19 -0400)
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 <jfournie@sitka.bclibraries.ca>
Signed-off-by: Dan Scott <dscott@laurentian.ca>
Signed-off-by: Ben Shum <bshum@biblio.org>
Open-ILS/examples/apache/eg.conf.in
Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader.pm
Open-ILS/src/templates/opac/css/style.css.tt2
Open-ILS/src/templates/opac/parts/topnav.tt2
Open-ILS/web/opac/skin/default/xml/home/index_body.xml

index d095e15..53347df 100644 (file)
@@ -149,3 +149,6 @@ NameVirtualHost *:443
     Include eg_vhost.conf
 </VirtualHost>
 
+# 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."
index 0838a29..e2de1e8 100644 (file)
@@ -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;
index 63c20bf..00d90d9 100644 (file)
@@ -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;
+}
index 7ac7728..b6ba5e7 100644 (file)
@@ -1,3 +1,8 @@
+[% IF ctx.maintenance_message %]
+<div id="maintenance_message">
+[%= ctx.maintenance_message %]
+</div>
+[% END %]
 [% IF !ctx.is_staff %]
 <div id="header-wrap">
 <div id="header">
index c7d20f6..d65a6f7 100644 (file)
@@ -8,6 +8,12 @@
                </p>
        </noscript>
 
+<!--#if expr="$MAINTENANCE_MESSAGE"-->
+    <div style="padding: 5px; width: 100%; background-color: #f00; color: #fff; text-align: center;">
+            <!--#echo var="MAINTENANCE_MESSAGE"-->
+    </div>
+<!--#endif-->
+
        <table id='toptable' width='100%' style='border-collapse: collapse;'>
                <tbody>
                        <tr>