Maintenance message: avoid Unicode corruption, support KPAC
authorDan Scott <dscott@laurentian.ca>
Thu, 11 Jul 2013 14:41:32 +0000 (10:41 -0400)
committerBen Shum <bshum@biblio.org>
Thu, 11 Jul 2013 15:02:49 +0000 (11:02 -0400)
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 <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/kpac/parts/base.tt2
Open-ILS/src/templates/opac/parts/config.tt2
Open-ILS/src/templates/opac/parts/topnav.tt2
Open-ILS/web/css/skin/default/kpac/style.css

index 53347df..d095e15 100644 (file)
@@ -149,6 +149,3 @@ 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 e2de1e8..0838a29 100644 (file)
@@ -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;
index 0685035..7af00ed 100644 (file)
@@ -10,6 +10,9 @@
         <title>[% l("Kid's Catalog - [_1]", ctx.page_title) %]</title>
     </head>
     <body>
+        [%- IF ctx.maintenance_message -%]
+        <div id="maintenance_message">[% ctx.maintenance_message %]</div>
+        [%- END -%]
         <div class="main_center">
             [% INCLUDE 'kpac/parts/header.tt2' %]
             <div class="main_wrapper"> [% content %] </div>
index c8e87ef..1ba05cc 100644 (file)
@@ -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.";
+
 %]
index b6ba5e7..46c497a 100644 (file)
@@ -1,8 +1,6 @@
-[% IF ctx.maintenance_message %]
-<div id="maintenance_message">
-[%= ctx.maintenance_message %]
-</div>
-[% END %]
+[%- 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 9e433e8..ed7e092 100755 (executable)
@@ -1023,3 +1023,10 @@ div.hr {
     display : none;\r
 }\r
 \r
+#maintenance_message {\r
+    padding: 5px;\r
+    width: 100%;\r
+    background-color: #c00;\r
+    color: #fff;\r
+    text-align: center;\r
+}\r