From 0154d6303245040f7c8a47e5da5d56271341327e Wed, 30 Nov 2011 20:40:13 +0100
From: Bram Goffings <bramgoffings@gmail.com>
Date: Wed, 30 Nov 2011 20:40:07 +0100
Subject: [PATCH] maintenance page



diff --git a/core/includes/common.inc b/core/includes/common.inc
index c6a29b7..792f594 100644
--- a/core/includes/common.inc
+++ b/core/includes/common.inc
@@ -6600,7 +6600,7 @@
     // From theme.maintenance.inc.
     'maintenance_page' => array(
       'variables' => array('content' => NULL, 'show_messages' => TRUE),
-      'template' => 'maintenance-page',
+      'template' => 'maintenance',
     ),
     'update_page' => array(
       'variables' => array('content' => NULL, 'show_messages' => TRUE),
diff --git a/core/includes/theme.inc b/core/includes/theme.inc
index 902907a..c6ac16a 100644
--- a/core/includes/theme.inc
+++ b/core/includes/theme.inc
@@ -2570,13 +2570,8 @@
     drupal_add_html_head_link(array('rel' => 'shortcut icon', 'href' => drupal_strip_dangerous_protocols($favicon), 'type' => $type));
   }
 
-  global $theme;
-  // Retrieve the theme data to list all available regions.
-  $theme_data = list_themes();
-  $regions = $theme_data[$theme]->info['regions'];
-
-  // Get all region content set with drupal_add_region_content().
-  foreach (array_keys($regions) as $region) {
+  $regions = array('sidebar_first', 'sidebar_second', 'content', 'page_top', 'page_bottom');
+  foreach($region as $region) {
     // Assign region to a region variable.
     $region_content = drupal_get_region_content($region);
     isset($variables[$region]) ? $variables[$region] .= $region_content : $variables[$region] = $region_content;
@@ -2610,20 +2605,13 @@
 
   $variables['head_title_array']  = $head_title;
   $variables['head_title']        = implode(' | ', $head_title);
-  $variables['base_path']         = base_path();
   $variables['front_page']        = url();
-  $variables['breadcrumb']        = '';
-  $variables['feed_icons']        = '';
   $variables['help']              = '';
   $variables['language']          = $language;
-  $variables['language']->dir     = $language->direction ? 'rtl' : 'ltr';
   $variables['logo']              = theme_get_setting('logo');
   $variables['messages']          = $variables['show_messages'] ? theme('status_messages') : '';
-  $variables['main_menu']         = array();
-  $variables['secondary_menu']    = array();
   $variables['site_name']         = (theme_get_setting('toggle_name') ? variable_get('site_name', 'Drupal') : '');
   $variables['site_slogan']       = (theme_get_setting('toggle_slogan') ? variable_get('site_slogan', '') : '');
-  $variables['tabs']              = '';
   $variables['title']             = drupal_get_title();
 
   // Compile a list of classes that are going to be applied to the body element.
@@ -2641,6 +2629,14 @@
     $variables['classes_array'][] = 'one-sidebar sidebar-' . $variables['layout'];
   }
 
+  // Initializes attributes which are specific to the html and body elements.
+  $variables['html_attributes_array'] = array();
+  $variables['body_attributes_array'] = array();
+
+  // HTML element attributes.
+  $variables['html_attributes_array']['lang'] = $language;
+  $variables['html_attributes_array']['dir'] = $language->direction ? 'rtl' : 'ltr';
+
   // Dead databases will show error messages so supplying this template will
   // allow themers to override the page and the content completely.
   if (isset($variables['db_is_active']) && !$variables['db_is_active']) {
@@ -2655,6 +2651,10 @@
  * @see maintenance-page.tpl.php
  */
 function template_process_maintenance_page(&$variables) {
+  // Flatten out html_attributes and body_attributes.
+  $variables['html_attributes'] = drupal_attributes($variables['html_attributes_array']);
+  $variables['body_attributes'] = drupal_attributes($variables['body_attributes_array']);
+
   $variables['head']    = drupal_get_html_head();
   $variables['css']     = drupal_add_css();
   $variables['styles']  = drupal_get_css();
diff --git a/core/includes/theme.maintenance.inc b/core/includes/theme.maintenance.inc
index d663d14..8b18933 100644
--- a/core/includes/theme.maintenance.inc
+++ b/core/includes/theme.maintenance.inc
@@ -138,7 +138,7 @@
  */
 function theme_install_page($variables) {
   drupal_add_http_header('Content-Type', 'text/html; charset=utf-8');
-  return theme('maintenance_page', $variables);
+  return theme('maintenance', $variables);
 }
 
 /**
@@ -154,7 +154,7 @@
  */
 function theme_update_page($variables) {
   drupal_add_http_header('Content-Type', 'text/html; charset=utf-8');
-  return theme('maintenance_page', $variables);
+  return theme('maintenance', $variables);
 }
 
 /**
diff --git a/core/modules/system/maintenance-page.tpl.php b/core/modules/system/maintenance-page.tpl.php
deleted file mode 100644
index 31de3bb..0000000
--- a/core/modules/system/maintenance-page.tpl.php
+++ /dev/null
@@ -1,93 +0,0 @@
-<?php
-
-/**
- * @file
- * Default theme implementation to display a single Drupal page while offline.
- *
- * All the available variables are mirrored in html.tpl.php and page.tpl.php.
- * Some may be blank but they are provided for consistency.
- *
- * @see template_preprocess()
- * @see template_preprocess_maintenance_page()
- */
-?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
-  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php print $language->language ?>" lang="<?php print $language->language ?>" dir="<?php print $language->dir ?>">
-
-<head>
-  <title><?php print $head_title; ?></title>
-  <?php print $head; ?>
-  <?php print $styles; ?>
-  <?php print $scripts; ?>
-</head>
-<body class="<?php print $classes; ?>">
-  <div id="page">
-    <div id="header">
-      <div id="logo-title">
-
-        <?php if (!empty($logo)): ?>
-          <a href="<?php print $base_path; ?>" title="<?php print t('Home'); ?>" rel="home" id="logo">
-            <img src="<?php print $logo; ?>" alt="<?php print t('Home'); ?>" />
-          </a>
-        <?php endif; ?>
-
-        <div id="name-and-slogan">
-          <?php if (!empty($site_name)): ?>
-            <h1 id="site-name">
-              <a href="<?php print $base_path ?>" title="<?php print t('Home'); ?>" rel="home"><span><?php print $site_name; ?></span></a>
-            </h1>
-          <?php endif; ?>
-
-          <?php if (!empty($site_slogan)): ?>
-            <div id="site-slogan"><?php print $site_slogan; ?></div>
-          <?php endif; ?>
-        </div> <!-- /name-and-slogan -->
-      </div> <!-- /logo-title -->
-
-      <?php if (!empty($header)): ?>
-        <div id="header-region">
-          <?php print $header; ?>
-        </div>
-      <?php endif; ?>
-
-    </div> <!-- /header -->
-
-    <div id="container" class="clearfix">
-
-      <?php if (!empty($sidebar_first)): ?>
-        <div id="sidebar-first" class="column sidebar">
-          <?php print $sidebar_first; ?>
-        </div> <!-- /sidebar-first -->
-      <?php endif; ?>
-
-      <div id="main" class="column"><div id="main-squeeze">
-
-        <div id="content">
-          <?php if (!empty($title)): ?><h1 class="title" id="page-title"><?php print $title; ?></h1><?php endif; ?>
-          <?php if (!empty($messages)): print $messages; endif; ?>
-          <div id="content-content" class="clearfix">
-            <?php print $content; ?>
-          </div> <!-- /content-content -->
-        </div> <!-- /content -->
-
-      </div></div> <!-- /main-squeeze /main -->
-
-      <?php if (!empty($sidebar_second)): ?>
-        <div id="sidebar-second" class="column sidebar">
-          <?php print $sidebar_second; ?>
-        </div> <!-- /sidebar-second -->
-      <?php endif; ?>
-
-    </div> <!-- /container -->
-
-    <div id="footer-wrapper">
-      <div id="footer">
-        <?php if (!empty($footer)): print $footer; endif; ?>
-      </div> <!-- /footer -->
-    </div> <!-- /footer-wrapper -->
-
-  </div> <!-- /page -->
-
-</body>
-</html>
diff --git a/core/modules/system/maintenance.tpl.php b/core/modules/system/maintenance.tpl.php
new file mode 100644
index 0000000..719a1d6
--- /dev/null
+++ b/core/modules/system/maintenance.tpl.php
@@ -0,0 +1,89 @@
+<?php
+
+/**
+ * @file
+ * Default theme implementation to display a single Drupal page while offline.
+ *
+ * All the available variables are mirrored in html.tpl.php and page.tpl.php.
+ * Some may be blank but they are provided for consistency.
+ *
+ * @see template_preprocess()
+ * @see template_preprocess_maintenance_page()
+ */
+?><!DOCTYPE html>
+<html<?php print $html_attributes; ?>>
+ <head>
+   <title><?php print $head_title; ?></title>
+   <?php print $head; ?>
+   <?php print $styles; ?>
+   <?php print $scripts; ?>
+ </head>
+<body class="<?php print $classes; ?>"<?php print $body_attributes; ?>>
+   <div id="page">
+    <header id="header" role="banner">
+
+      <?php if ($logo): ?>
+        <a href="<?php print $front_page; ?>" title="<?php print t('Home'); ?>" rel="home" id="logo">
+          <img src="<?php print $logo; ?>" alt="<?php print t('Home'); ?>" />
+        </a>
+      <?php endif; ?>
+
+      <?php if ($site_name || $site_slogan): ?>
+         <div id="name-and-slogan">
+          <?php if ($site_name): ?>
+            <?php if ($title): ?>
+              <p id="site-name"><strong>
+                <a href="<?php print $front_page; ?>" title="<?php print t('Home'); ?>" rel="home"><?php print $site_name; ?></a>
+              </strong></p>
+            <?php else: /* Use h1 when the content title is empty */ ?>
+              <h1 id="site-name">
+                <a href="<?php print $front_page; ?>" title="<?php print t('Home'); ?>" rel="home"><?php print $site_name; ?></a>
+              </h1>
+            <?php endif; ?>
+           <?php endif; ?>
+
+          <?php if ($site_slogan): ?>
+            <p id="site-slogan"><?php print $site_slogan; ?></p>
+           <?php endif; ?>
+        </div><!-- #name-and-slogan -->
+       <?php endif; ?>
+
+      <?php print render($page['header']); ?>
+
+    </header>
+
+    <?php if ($messages): ?>
+      <div id="messages"><?php print $messages; ?></div>
+    <?php endif; ?>
+
+    <div id="main" role="main" class="clearfix">
+
+      <div id="content" class="column">
+        <?php print render($title_prefix); ?>
+        <?php if (!empty($title)): ?><h1 class="title" id="page-title"><?php print $title; ?></h1><?php endif; ?>
+        <?php print render($title_suffix); ?>
+        <?php print $content; ?>
+      </div><!-- #content -->
+
+      <?php if (!empty($page['sidebar_first'])): ?>
+        <div id="sidebar-first" class="column sidebar">
+          <?php print render($page['sidebar_first']); ?>
+        </div><!-- #sidebar-first -->
+      <?php endif; ?>
+
+      <?php if (!empty($page['sidebar_second'])): ?>
+         <div id="sidebar-second" class="column sidebar">
+          <?php print render($page['sidebar_second']); ?>
+        </div><!-- #sidebar-second -->
+       <?php endif; ?>
+
+    </div><!-- #main -->
+
+    <footer id="footer" role="contentinfo">
+      <?php print render($page['footer']); ?>
+    </footer>
+
+  </div><!-- #page -->
+
+</body>
+</html>
