From ba0ff1a9b7805cde4521d07ca0f039506173bb6b Mon Sep 17 00:00:00 2001 From: Steven Wittens Date: Fri, 2 Mar 2007 09:40:27 +0000 Subject: #117018: Use Garland theme for installer/maintenance pages, and add task list in the sidebar. - Refactor partial-page handling for the maintenance page. It's an exotic quirk for update.php and belongs there. --- includes/theme.inc | 124 ++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 84 insertions(+), 40 deletions(-) (limited to 'includes') diff --git a/includes/theme.inc b/includes/theme.inc index 7d1972ac8..d4a412751 100644 --- a/includes/theme.inc +++ b/includes/theme.inc @@ -423,72 +423,116 @@ function theme_page($content) { return $output; } -function theme_maintenance_page($content, $messages = TRUE, $partial = FALSE) { +/** + * Generate a themed maintenance page. + * + * Note: this function is not themable. + * + * @param $content + * The page content to show. + * @param $messages + * Whether to output status and error messages. + */ +function theme_maintenance_page($content, $messages = TRUE) { + // Set required headers. drupal_set_header('Content-Type: text/html; charset=utf-8'); drupal_set_html_head(''); drupal_set_html_head(''); drupal_set_html_head(''); drupal_set_html_head(''); - $output = "\n"; - $output .= ''; - $output .= ''; - $output .= ' '. strip_tags(drupal_get_title()) .''; - $output .= drupal_get_html_head(); - $output .= drupal_get_js(); - $output .= ''; - $output .= ''; - $output .= '

' . drupal_get_title() . '

'; - - if ($messages) { - $output .= theme('status_messages'); - } + // Prepare variables. + $variables = array( + 'head_title' => strip_tags(drupal_get_title()), + 'head' => drupal_get_html_head(), + 'styles' => '', + 'scripts' => drupal_get_js(), + 'sidebar_left' => drupal_get_content('left'), + 'sidebar_right' => drupal_get_content('right'), + 'base_path' => base_path(), + 'path_to_theme' => base_path() .'themes/garland/minnelli', + 'logo' => base_path() .'themes/garland/minnelli/logo.png', + 'site_title' => t('Drupal'), + 'title' => drupal_get_title(), + 'messages' => theme('status_messages'), + 'content' => $content, + ); - $output .= "\n\n"; - $output .= $content; - $output .= "\n\n"; - - if (!$partial) { - $output .= ''; - } + // Render simplified PHPTemplate. + include_once './themes/engines/phptemplate/phptemplate.engine'; + $output = _phptemplate_render('misc/maintenance.tpl.php', $variables); return $output; } +/** + * Generate a themed installation page. + * + * Note: this function is not themable. + * + * @param $content + * The page content to show. + */ function theme_install_page($content) { drupal_set_header('Content-Type: text/html; charset=utf-8'); drupal_add_css('misc/maintenance.css', 'module', 'all', FALSE); drupal_set_html_head(''); - $output = "\n"; - $output .= ''; - $output .= ''; - $output .= ' '. strip_tags(drupal_get_title()) .''; - $output .= drupal_get_html_head(); - $output .= drupal_get_css(); - $output .= drupal_get_js(); - $output .= ''; - $output .= ''; - $output .= '

' . drupal_get_title() . '

'; + $variables = array( + 'head_title' => strip_tags(drupal_get_title()), + 'head' => drupal_get_html_head(), + 'styles' => drupal_get_css(), + 'scripts' => drupal_get_js(), + 'sidebar_left' => drupal_get_content('left'), + 'sidebar_right' => drupal_get_content('right'), + 'base_path' => base_path(), + 'path_to_theme' => base_path() .'themes/garland/minnelli', + 'logo' => base_path() .'themes/garland/minnelli/logo.png', + 'site_title' => st('Drupal Installation'), + 'title' => drupal_get_title(), + 'messages' => '', + 'content' => $content, + ); + + // Special handling of error messages $messages = drupal_set_message(); if (isset($messages['error'])) { $title = count($messages['error']) > 1 ? st('The following errors must be resolved before you can continue the installation process') : st('The following error must be resolved before you can continue the installation process'); - $output .= '

' .$title. ':

'; - $output .= theme('status_messages', 'error'); + $variables['messages'] .= '

'. $title .':

'; + $variables['messages'] .= theme('status_messages', 'error'); } + // Special handling of status messages if (isset($messages['status'])) { $warnings = count($messages['status']) > 1 ? st('The following installation warnings should be carefully reviewed, but in most cases may be safely ignored') : st('The following installation warning should be carefully reviewed, but in most cases may be safely ignored'); - $output .= '

' .$title. ':

'; - $output .= theme('status_messages', 'status'); + $variables['messages'] .= '

'. $title .':

'; + $variables['messages'] .= theme('status_messages', 'status'); } - $output .= "\n\n"; - $output .= $content; - $output .= "\n\n"; - - $output .= ''; + // Render simplified PHPTemplate. + include_once './themes/engines/phptemplate/phptemplate.engine'; + return _phptemplate_render('misc/maintenance.tpl.php', $variables); +} +/** + * Return a themed list of maintenance tasks to perform. + * + * Note: this function is not themable. + */ +function theme_task_list($items, $active = NULL) { + $done = isset($items[$active]) || $active == NULL; + $output = '
    '; + foreach ($items as $k => $item) { + if ($active == $k) { + $class = 'active'; + $done = false; + } + else { + $class = $done ? 'done' : ''; + } + $output .= '
  1. '. $item .'
  2. '; + } + $output .= '
'; return $output; } -- cgit v1.2.3