diff options
author | Gábor Hojtsy <gabor@hojtsy.hu> | 2007-11-30 12:19:10 +0000 |
---|---|---|
committer | Gábor Hojtsy <gabor@hojtsy.hu> | 2007-11-30 12:19:10 +0000 |
commit | e9f52b4248a5268630b51ee0746dcf8b6449d445 (patch) | |
tree | 2a75a607895da5e9ec5271971426a5344e8911a4 /modules/system | |
parent | 6d4b0a24fad35cfbbf48d3b3f82ff5dbc243e5cb (diff) | |
download | brdo-e9f52b4248a5268630b51ee0746dcf8b6449d445.tar.gz brdo-e9f52b4248a5268630b51ee0746dcf8b6449d445.tar.bz2 |
#141727 by merlinofchaos, dvessel, sun: restore themeability support for maintenance pages (regression)
Diffstat (limited to 'modules/system')
-rw-r--r-- | modules/system/maintenance-page.tpl.php | 98 | ||||
-rw-r--r-- | modules/system/maintenance.css | 23 | ||||
-rw-r--r-- | modules/system/system.module | 180 |
3 files changed, 215 insertions, 86 deletions
diff --git a/modules/system/maintenance-page.tpl.php b/modules/system/maintenance-page.tpl.php new file mode 100644 index 000000000..12037ab93 --- /dev/null +++ b/modules/system/maintenance-page.tpl.php @@ -0,0 +1,98 @@ +<?php +// $Id$ + +/** + * @file maintenance-page.tpl.php + * + * Theme implementation to display a single Drupal page while off-line. + * + * All the available variables are mirrored in page.tpl.php. Some may be left + * 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 ?>"> + +<head> + <title><?php print $head_title; ?></title> + <?php print $head; ?> + <?php print $styles; ?> + <?php print $scripts; ?> + <script type="text/javascript"><?php /* Needed to avoid Flash of Unstyled Content in IE */ ?> </script> +</head> +<body class="<?php print $body_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="clear-block"> + + <?php if (!empty($left)): ?> + <div id="sidebar-left" class="column sidebar"> + <?php print $left; ?> + </div> <!-- /sidebar-left --> + <?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="clear-block"> + <?php print $content; ?> + </div> <!-- /content-content --> + </div> <!-- /content --> + + </div></div> <!-- /main-squeeze /main --> + + <?php if (!empty($right)): ?> + <div id="sidebar-right" class="column sidebar"> + <?php print $right; ?> + </div> <!-- /sidebar-right --> + <?php endif; ?> + + </div> <!-- /container --> + + <div id="footer-wrapper"> + <div id="footer"> + <?php print $footer_message; ?> + <?php if (!empty($footer)): print $footer; endif; ?> + </div> <!-- /footer --> + </div> <!-- /footer-wrapper --> + + </div> <!-- /page --> + +</body> +</html> diff --git a/modules/system/maintenance.css b/modules/system/maintenance.css new file mode 100644 index 000000000..a18f10c1a --- /dev/null +++ b/modules/system/maintenance.css @@ -0,0 +1,23 @@ +/* $Id$ */ + +/* Update styles */ +#update-results { + margin-top: 3em; + padding: 0.25em; + border: 1px solid #ccc; + background: #eee; + font-size: smaller; +} +#update-results h2 { + margin-top: 0.25em; +} +#update-results h4 { + margin-bottom: 0.25em; +} +#update-results li.none { + color: #888; + font-style: italic; +} +#update-results li.failure strong { + color: #b63300; +} diff --git a/modules/system/system.module b/modules/system/system.module index d6997c2f1..ca8e54703 100644 --- a/modules/system/system.module +++ b/modules/system/system.module @@ -77,7 +77,7 @@ function system_help($path, $arg) { } function system_theme() { - return array_merge(drupal_common_themes(), array( + return array_merge(drupal_common_theme(), array( 'system_theme_select_form' => array( 'arguments' => array('form' => NULL), 'file' => 'system.admin.inc', @@ -711,111 +711,119 @@ function system_theme_default() { } /** - * Collect data about all currently available themes + * Collect data about all currently available themes. + * + * @return + * Array of all available themes and their data. */ function system_theme_data() { - // Find themes - $themes = drupal_system_listing('\.info$', 'themes'); + // Scan the installation theme .info files and their engines. + $themes = _system_theme_data(); - // Find theme engines - $engines = drupal_system_listing('\.engine$', 'themes/engines'); - - // Remove all theme engines from the system table - db_query("DELETE FROM {system} WHERE type = '%s'", 'theme_engine'); + // Extract current files from database. + system_get_files_database($themes, 'theme'); - foreach ($engines as $engine) { - // Insert theme engine into system table - drupal_get_filename('theme_engine', $engine->name, $engine->filename); - drupal_load('theme_engine', $engine->name); - db_query("INSERT INTO {system} (name, type, filename, status, throttle, bootstrap) VALUES ('%s', '%s', '%s', %d, %d, %d)", $engine->name, 'theme_engine', $engine->filename, 1, 0, 0); - } + db_query("DELETE FROM {system} WHERE type = 'theme'"); - $defaults = system_theme_default(); + foreach ($themes as $theme) { + if (!isset($theme->owner)) { + $theme->owner = ''; + } - $sub_themes = array(); - // Read info files for each theme - foreach ($themes as $key => $theme) { - $themes[$key]->info = drupal_parse_info_file($theme->filename) + $defaults; + db_query("INSERT INTO {system} (name, owner, info, type, filename, status, throttle, bootstrap) VALUES ('%s', '%s', '%s', '%s', '%s', %d, %d, %d)", $theme->name, $theme->owner, serialize($theme->info), 'theme', $theme->filename, isset($theme->status) ? $theme->status : 0, 0, 0); + } - // Invoke hook_system_info_alter() to give installed modules a chance to - // modify the data in the .info files if necessary. - drupal_alter('system_info', $themes[$key]->info, $themes[$key]); + return $themes; +} - if (!empty($themes[$key]->info['base theme'])) { - $sub_themes[] = $key; - } - if (empty($themes[$key]->info['engine'])) { - $filename = dirname($themes[$key]->filename) .'/'. $themes[$key]->name .'.theme'; - if (file_exists($filename)) { - $themes[$key]->owner = $filename; - $themes[$key]->prefix = $key; +/** + * Helper function to scan and collect theme .info data and their engines. + */ +function _system_theme_data() { + static $themes_info = array(); + + if (empty($theme_info)) { + // Find themes + $themes = drupal_system_listing('\.info$', 'themes'); + // Find theme engines + $engines = drupal_system_listing('\.engine$', 'themes/engines'); + + $defaults = system_theme_default(); + + $sub_themes = array(); + // Read info files for each theme + foreach ($themes as $key => $theme) { + $themes[$key]->info = drupal_parse_info_file($theme->filename) + $defaults; + + // Invoke hook_system_info_alter() to give installed modules a chance to + // modify the data in the .info files if necessary. + drupal_alter('system_info', $themes[$key]->info, $themes[$key]); + + if (!empty($themes[$key]->info['base theme'])) { + $sub_themes[] = $key; } - } - else { - $engine = $themes[$key]->info['engine']; - if (isset($engines[$engine])) { - $themes[$key]->owner = $engines[$engine]->filename; - $themes[$key]->prefix = $engines[$engine]->name; - $themes[$key]->template = TRUE; + if (empty($themes[$key]->info['engine'])) { + $filename = dirname($themes[$key]->filename) .'/'. $themes[$key]->name .'.theme'; + if (file_exists($filename)) { + $themes[$key]->owner = $filename; + $themes[$key]->prefix = $key; + } } - } - - // Give the stylesheets proper path information. - $pathed_stylesheets = array(); - foreach ($themes[$key]->info['stylesheets'] as $media => $stylesheets) { - foreach ($stylesheets as $stylesheet) { - $pathed_stylesheets[$media][$stylesheet] = dirname($themes[$key]->filename) .'/'. $stylesheet; + else { + $engine = $themes[$key]->info['engine']; + if (isset($engines[$engine])) { + $themes[$key]->owner = $engines[$engine]->filename; + $themes[$key]->prefix = $engines[$engine]->name; + $themes[$key]->template = TRUE; + } } - } - $themes[$key]->info['stylesheets'] = $pathed_stylesheets; - // Give the scripts proper path information. - $scripts = array(); - foreach ($themes[$key]->info['scripts'] as $script) { - $scripts[$script] = dirname($themes[$key]->filename) .'/'. $script; - } - $themes[$key]->info['scripts'] = $scripts; - // Give the screenshot proper path information. - if (!empty($themes[$key]->info['screenshot'])) { - $themes[$key]->info['screenshot'] = dirname($themes[$key]->filename) .'/'. $themes[$key]->info['screenshot']; - } - } + // Give the stylesheets proper path information. + $pathed_stylesheets = array(); + foreach ($themes[$key]->info['stylesheets'] as $media => $stylesheets) { + foreach ($stylesheets as $stylesheet) { + $pathed_stylesheets[$media][$stylesheet] = dirname($themes[$key]->filename) .'/'. $stylesheet; + } + } + $themes[$key]->info['stylesheets'] = $pathed_stylesheets; - // Now that we've established all our master themes, go back and fill in - // data for subthemes. - foreach ($sub_themes as $key) { - $base_key = system_find_base_theme($themes, $key); - if (!$base_key) { - continue; - } - // Copy the 'owner' and 'engine' over if the top level theme uses a - // theme engine. - if (isset($themes[$base_key]->owner)) { - if (isset($themes[$base_key]->info['engine'])) { - $themes[$key]->info['engine'] = $themes[$base_key]->info['engine']; - $themes[$key]->owner = $themes[$base_key]->owner; - $themes[$key]->prefix = $themes[$base_key]->prefix; + // Give the scripts proper path information. + $scripts = array(); + foreach ($themes[$key]->info['scripts'] as $script) { + $scripts[$script] = dirname($themes[$key]->filename) .'/'. $script; } - else { - $themes[$key]->prefix = $key; + $themes[$key]->info['scripts'] = $scripts; + // Give the screenshot proper path information. + if (!empty($themes[$key]->info['screenshot'])) { + $themes[$key]->info['screenshot'] = dirname($themes[$key]->filename) .'/'. $themes[$key]->info['screenshot']; } } - } - - // Extract current files from database. - system_get_files_database($themes, 'theme'); - db_query("DELETE FROM {system} WHERE type = 'theme'"); - - foreach ($themes as $theme) { - if (!isset($theme->owner)) { - $theme->owner = ''; + // Now that we've established all our master themes, go back and fill in + // data for subthemes. + foreach ($sub_themes as $key) { + $base_key = system_find_base_theme($themes, $key); + if (!$base_key) { + continue; + } + // Copy the 'owner' and 'engine' over if the top level theme uses a + // theme engine. + if (isset($themes[$base_key]->owner)) { + if (isset($themes[$base_key]->info['engine'])) { + $themes[$key]->info['engine'] = $themes[$base_key]->info['engine']; + $themes[$key]->owner = $themes[$base_key]->owner; + $themes[$key]->prefix = $themes[$base_key]->prefix; + } + else { + $themes[$key]->prefix = $key; + } + } } - - db_query("INSERT INTO {system} (name, owner, info, type, filename, status, throttle, bootstrap) VALUES ('%s', '%s', '%s', '%s', '%s', %d, %d, %d)", $theme->name, $theme->owner, serialize($theme->info), 'theme', $theme->filename, isset($theme->status) ? $theme->status : 0, 0, 0); + + $themes_info = $themes; } - return $themes; + return $themes_info; } /** |