Commit fb1948cb authored by Dries's avatar Dries
Browse files

- Patch #171652 by dvessel et al: cleanup some old cruft. Dvessel is on a patch spree ...

parent ff61e73a
......@@ -983,8 +983,8 @@ function theme_maintenance_page($content, $show_messages = TRUE) {
'head' => drupal_get_html_head(),
'styles' => '',
'scripts' => drupal_get_js(),
'sidebar_left' => drupal_get_content('left'),
'sidebar_right' => drupal_get_content('right'),
'left' => drupal_get_content('left'),
'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',
......@@ -1017,8 +1017,8 @@ function theme_install_page($content) {
'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'),
'left' => drupal_get_content('left'),
'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',
......@@ -1616,7 +1616,7 @@ function template_preprocess(&$variables, $hook) {
static $count = array();
// Track run count for each hook to provide zebra striping.
// See "template_preprocess_block()" which provides the same feature for sidebar blocks.
// See "template_preprocess_block()" which provides the same feature specific to blocks.
$count[$hook] = isset($count[$hook]) && is_int($count[$hook]) ? $count[$hook] : 1;
$variables['zebra'] = ($count[$hook] % 2) ? 'odd' : 'even';
$variables['id'] = $count[$hook]++;
......@@ -1657,44 +1657,29 @@ function template_preprocess_page(&$variables) {
drupal_set_html_head('<link rel="shortcut icon" href="'. check_url(theme_get_setting('favicon')) .'" type="image/x-icon" />');
}
/**
* Populate sidebars.
*/
$variables['sidebar_left'] = NULL;
$variables['sidebar_right'] = NULL;
$layout = 'none';
if ($variables['show_blocks']) {
global $sidebar_indicator;
/**
* Sidebar_indicator tells the block counting code to count sidebars separately.
*/
$sidebar_indicator = 'left';
$variables['sidebar_left'] = theme('blocks', 'left');
if ($variables['sidebar_left'] != '') {
$layout = 'left';
}
$sidebar_indicator = 'right';
$variables['sidebar_right'] = theme('blocks', 'right');
if ($variables['sidebar_right'] != '') {
$variables['layout'] = ($layout == 'left') ? 'both' : 'right';
}
$sidebar_indicator = NULL;
}
$variables['layout'] = $layout;
global $theme;
global $user;
// Populate the rest of the regions.
// Populate all block regions.
$regions = system_region_list($theme);
// Load all region content assigned via blocks.
foreach (array_keys($regions) as $region) {
// Skip blocks in this region that have already been loaded.
// This pre-loading is necessary because phptemplate uses variable names different from
// the region names, e.g., 'sidebar_left' instead of 'left'.
if (!in_array($region, array('left', 'right', 'footer'))) {
isset($variables[$region]) ? $variables[$region] .= theme('blocks', $region) : $variables[$region] = theme('blocks', $region);
// Prevent left and right regions from rendering blocks when 'show_blocks' == FALSE.
if (!(!$variables['show_blocks'] && ($region == 'left' || $region == 'right'))) {
$blocks = theme('blocks', $region);
}
else {
$blocks = '';
}
// Assign region to a region variable.
isset($variables[$region]) ? $variables[$region] .= $blocks : $variables[$region] = $blocks;
}
// Setup layout variable.
$variables['layout'] = 'none';
if (!empty($variables['left'])) {
$variables['layout'] = 'left';
}
if (!empty($variables['right'])) {
$variables['layout'] = ($variables['layout'] == 'left') ? 'both' : 'right';
}
// Construct page title
......@@ -1711,7 +1696,7 @@ function template_preprocess_page(&$variables) {
$variables['base_path'] = base_path();
$variables['breadcrumb'] = theme('breadcrumb', drupal_get_breadcrumb());
$variables['feed_icons'] = drupal_get_feeds();
$variables['footer_message'] = filter_xss_admin(variable_get('site_footer', FALSE)) . "\n" . theme('blocks', 'footer');
$variables['footer_message'] = filter_xss_admin(variable_get('site_footer', FALSE));
$variables['head'] = drupal_get_html_head();
$variables['help'] = theme('help');
$variables['language'] = $GLOBALS['language'];
......@@ -1739,9 +1724,9 @@ function template_preprocess_page(&$variables) {
// This allows advanced theming based on context (home page, node of certain type, etc.).
$body_classes = array();
// Add a class that tells us whether we're on the front page or not.
$body_classes[] = (drupal_is_front_page()) ? 'front' : 'not-front';
$body_classes[] = $variables['is_front'] ? 'front' : 'not-front';
// Add a class that tells us whether the page is viewed by an authenticated user or not.
$body_classes[] = ($user->uid > 0) ? 'logged-in' : 'not-logged-in';
$body_classes[] = $variables['logged_in'] ? 'logged-in' : 'not-logged-in';
// Add arg(0) to make it possible to theme the page depending on the current page
// type (e.g. node, admin, user, etc.). To avoid illegal characters in the class,
// we're removing everything disallowed. We are not using 'a-z' as that might leave
......@@ -1752,13 +1737,13 @@ function template_preprocess_page(&$variables) {
$body_classes[] = 'node-type-'. form_clean_id($variables['node']->type);
}
// Add information about the number of sidebars.
if ($variables['sidebar_left'] && $variables['sidebar_right']) {
if ($variables['left'] && $variables['right']) {
$body_classes[] = 'two-sidebars';
}
elseif ($variables['sidebar_left']) {
elseif ($variables['left']) {
$body_classes[] = 'one-sidebar sidebar-left';
}
elseif ($variables['sidebar_right']) {
elseif ($variables['right']) {
$body_classes[] = 'one-sidebar sidebar-right';
}
else {
......@@ -1869,12 +1854,15 @@ function template_preprocess_node(&$variables) {
* @see block.tpl.php
*/
function template_preprocess_block(&$variables) {
global $sidebar_indicator;
$count['block_counter'][$sidebar_indicator] = isset($count['block_counter'][$sidebar_indicator]) && is_int($count['block_counter'][$sidebar_indicator]) ? $count['block_counter'][$sidebar_indicator] : 1;
$variables['block_zebra'] = ($count['block_counter'][$sidebar_indicator] % 2) ? 'odd' : 'even';
static $block_counter = array();
// All blocks get an independent counter for each region.
if (!isset($block_counter[$variables['block']->region])) {
$block_counter[$variables['block']->region] = 1;
}
// Same with zebra striping.
$variables['block_zebra'] = ($block_counter[$variables['block']->region] % 2) ? 'odd' : 'even';
$variables['block_id'] = $block_counter[$variables['block']->region]++;
$variables['block_id'] = $count['block_counter'][$sidebar_indicator]++;
$variables['template_files'][] = 'block-' . $variables['block']->region;
$variables['template_files'][] = 'block-' . $variables['block']->module;
$variables['template_files'][] = 'block-' . $variables['block']->module .'-'. $variables['block']->delta;
......
......@@ -15,7 +15,7 @@
</head>
<body class="<?php
$classes = array('', 'sidebar-left', 'sidebar-right', 'sidebar-both');
print $classes[((bool)$sidebar_left) + 2 * ((bool)$sidebar_right)];
print $classes[((bool)$left) + 2 * ((bool)$right)];
?>">
<!-- Layout -->
......@@ -30,9 +30,9 @@
</div>
</div> <!-- /header -->
<?php if ($sidebar_left): ?>
<?php if ($left): ?>
<div id="sidebar-left" class="sidebar">
<?php print $sidebar_left ?>
<?php print $left ?>
</div>
<?php endif; ?>
......@@ -47,9 +47,9 @@
</div></div></div></div> <!-- /.left-corner, /.right-corner, /#squeeze, /#center -->
<?php if ($sidebar_right): ?>
<?php if ($right): ?>
<div id="sidebar-right" class="sidebar">
<?php print $sidebar_right ?>
<?php print $right ?>
</div>
<?php endif; ?>
......
......@@ -14,10 +14,9 @@
* - $block->region: The block region embedding the current block.
*
* Helper variables:
* - $block_zebra: Outputs 'odd' and 'even' dependent on the default sidebar
* block regions.
* - $block_zebra: Outputs 'odd' and 'even' dependent on each block region.
* - $zebra: Same output as $block_zebra but independent of any block region.
* - $block_id: counter within the default sidebar block regions.
* - $block_id: Counter dependent on each block region.
* - $id: Same output as $block_id but independent of any block region.
* - $is_front: Flags true when presented in the front page.
* - $logged_in: Flags true when the current user is a logged-in member.
......
......@@ -48,7 +48,7 @@
* the site, if they have been configured.
*
* Page content (in order of occurrance in the default page.tpl.php):
* - $sidebar_left: The HTML for the left sidebar.
* - $left: The HTML for the left sidebar.
*
* - $breadcrumb: The breadcrumb trail for the current page.
* - $title: The page title, for use in the actual HTML content.
......@@ -59,11 +59,12 @@
*
* - $content: The main content of the current Drupal page.
*
* - $sidebar_right: The HTML for the right sidebar.
* - $right: The HTML for the right sidebar.
*
* Footer/closing data:
* - $feed_icons: A string of all feed icons for the current page.
* - $footer_message: The footer message as defined in the admin settings.
* - $footer : The footer region.
* - $closure: Final closing markup from any modules that have altered the page.
* This variable should always be output last, after all other dynamic content.
*
......@@ -134,9 +135,9 @@
<div id="container" class="clear-block">
<?php if (!empty($sidebar_left)): ?>
<?php if (!empty($left)): ?>
<div id="sidebar-left" class="column sidebar">
<?php print $sidebar_left; ?>
<?php print $left; ?>
</div> <!-- /sidebar-left -->
<?php endif; ?>
......@@ -157,9 +158,9 @@
</div></div> <!-- /main-squeeze /main -->
<?php if (!empty($sidebar_right)): ?>
<?php if (!empty($right)): ?>
<div id="sidebar-right" class="column sidebar">
<?php print $sidebar_right; ?>
<?php print $right; ?>
</div> <!-- /sidebar-right -->
<?php endif; ?>
......@@ -168,6 +169,7 @@
<div id="footer-wrapper">
<div id="footer">
<?php print $footer_message; ?>
<?php if (!empty($footer)): print $footer; endif; ?>
</div> <!-- /footer -->
</div> <!-- /footer-wrapper -->
......
......@@ -33,8 +33,8 @@
<table border="0" cellpadding="0" cellspacing="0" id="content">
<tr>
<?php if ($sidebar_left) { ?><td id="sidebar-left">
<?php print $sidebar_left ?>
<?php if ($left) { ?><td id="sidebar-left">
<?php print $left ?>
</td><?php } ?>
<td valign="top">
<?php if ($mission) { ?><div id="mission"><?php print $mission ?></div><?php } ?>
......@@ -48,14 +48,15 @@
<?php print $feed_icons; ?>
</div>
</td>
<?php if ($sidebar_right) { ?><td id="sidebar-right">
<?php print $sidebar_right ?>
<?php if ($right) { ?><td id="sidebar-right">
<?php print $right ?>
</td><?php } ?>
</tr>
</table>
<div id="footer">
<?php print $footer_message ?>
<?php print $footer ?>
</div>
<?php print $closure ?>
</body>
......
......@@ -12,7 +12,7 @@
<link type="text/css" rel="stylesheet" media="all" href="<?php print base_path() . path_to_theme() ?>/fix-ie.css" />
<![endif]-->
</head>
<body<?php print phptemplate_body_class($sidebar_left, $sidebar_right); ?>>
<body<?php print phptemplate_body_class($left, $right); ?>>
<!-- Layout -->
<div id="header-region" class="clear-block"><?php print $header; ?></div>
......@@ -54,10 +54,10 @@
</div> <!-- /header -->
<?php if ($sidebar_left): ?>
<?php if ($left): ?>
<div id="sidebar-left" class="sidebar">
<?php if ($search_box): ?><div class="block block-theme"><?php print $search_box ?></div><?php endif; ?>
<?php print $sidebar_left ?>
<?php print $left ?>
</div>
<?php endif; ?>
......@@ -76,13 +76,13 @@
<?php print $content ?>
<span class="clear"></span>
<?php print $feed_icons ?>
<div id="footer"><?php print $footer_message ?></div>
<div id="footer"><?php print $footer_message . $footer ?></div>
</div></div></div></div> <!-- /.left-corner, /.right-corner, /#squeeze, /#center -->
<?php if ($sidebar_right): ?>
<?php if ($right): ?>
<div id="sidebar-right" class="sidebar">
<?php if (!$sidebar_left && $search_box): ?><div class="block block-theme"><?php print $search_box ?></div><?php endif; ?>
<?php print $sidebar_right ?>
<?php if (!$left && $search_box): ?><div class="block block-theme"><?php print $search_box ?></div><?php endif; ?>
<?php print $right ?>
</div>
<?php endif; ?>
......
......@@ -6,15 +6,15 @@
*
* Adds 'sidebar-left', 'sidebar-right' or 'sidebars' classes as needed.
*/
function phptemplate_body_class($sidebar_left, $sidebar_right) {
if ($sidebar_left != '' && $sidebar_right != '') {
function phptemplate_body_class($left, $right) {
if ($left != '' && $right != '') {
$class = 'sidebars';
}
else {
if ($sidebar_left != '') {
if ($left != '') {
$class = 'sidebar-left';
}
if ($sidebar_right != '') {
if ($right != '') {
$class = 'sidebar-right';
}
}
......
......@@ -52,9 +52,9 @@
<table id="content" border="0" cellpadding="15" cellspacing="0" width="100%">
<tr>
<?php if ($sidebar_left != ""): ?>
<?php if ($left != ""): ?>
<td id="sidebar-left">
<?php print $sidebar_left ?>
<?php print $left ?>
</td>
<?php endif; ?>
......@@ -89,9 +89,9 @@
</div><!-- main -->
</td>
<?php if ($sidebar_right != ""): ?>
<?php if ($right != ""): ?>
<td id="sidebar-right">
<?php print $sidebar_right ?>
<?php print $right ?>
</td>
<?php endif; ?>
</tr>
......@@ -110,9 +110,9 @@
</tr>
</table>
<?php if ($footer_message) : ?>
<?php if ($footer_message || $footer) : ?>
<div id="footer-message">
<p><?php print $footer_message;?></p>
<p><?php print $footer_message . $footer;?></p>
</div>
<?php endif; ?>
<?php print $closure;?>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment