- Patch #251758 by Stefan, dvessel, quicksketch et al: clean up Garland's page.tpl.php.

merge-requests/26/head
Dries Buytaert 2008-04-28 09:25:27 +00:00
parent c14ac959c4
commit ab6c47cd3d
8 changed files with 69 additions and 92 deletions

View File

@ -45,7 +45,7 @@ function _password_itoa64() {
* @return * @return
* Encoded string * Encoded string
*/ */
function _password_base64_encode($input, $count) { function _password_base64_encode($input, $count) {
$output = ''; $output = '';
$i = 0; $i = 0;
$itoa64 = _password_itoa64(); $itoa64 = _password_itoa64();

View File

@ -241,6 +241,7 @@ function template_preprocess_maintenance_page(&$variables) {
} }
$variables['head_title'] = implode(' | ', $head_title); $variables['head_title'] = implode(' | ', $head_title);
$variables['base_path'] = base_path(); $variables['base_path'] = base_path();
$variables['front_page'] = url();
$variables['breadcrumb'] = ''; $variables['breadcrumb'] = '';
$variables['feed_icons'] = ''; $variables['feed_icons'] = '';
$variables['footer_message'] = filter_xss_admin(variable_get('site_footer', FALSE)); $variables['footer_message'] = filter_xss_admin(variable_get('site_footer', FALSE));

View File

@ -20,10 +20,10 @@
<?php print $styles ?> <?php print $styles ?>
<?php print $scripts ?> <?php print $scripts ?>
<!--[if lt IE 7]> <!--[if lt IE 7]>
<?php print phptemplate_get_ie_styles(); ?> <?php print garland_get_ie_styles(); ?>
<![endif]--> <![endif]-->
</head> </head>
<body<?php print phptemplate_body_class($left, $right); ?>> <body class="<?php print $body_classes ?>">
<!-- Layout --> <!-- Layout -->
<div id="header-region" class="clear-block"><?php print $header; ?></div> <div id="header-region" class="clear-block"><?php print $header; ?></div>
@ -68,9 +68,9 @@
<?php endif; ?> <?php endif; ?>
<div id="center"><div id="squeeze"><div class="right-corner"><div class="left-corner"> <div id="center"><div id="squeeze"><div class="right-corner"><div class="left-corner">
<?php if ($title): print '<h2' . ($tabs ? ' class="with-tabs"' : '') . '>' . $title . '</h2>'; endif; ?> <?php if ($title): ?><h2><?php print $title ?></h2><?php endif; ?>
<?php print $help; ?>
<?php print $messages; ?> <?php print $messages; ?>
<?php print $help; ?>
<div class="clear-block"> <div class="clear-block">
<?php print $content ?> <?php print $content ?>
</div> </div>

View File

@ -4,7 +4,7 @@ body #wrapper #container {
width: 560px; width: 560px;
} }
body.sidebars #wrapper #container { body.two-sidebars #wrapper #container {
width: 980px; width: 980px;
} }

View File

@ -9,52 +9,31 @@
<?php print $styles ?> <?php print $styles ?>
<?php print $scripts ?> <?php print $scripts ?>
<!--[if lt IE 7]> <!--[if lt IE 7]>
<?php print phptemplate_get_ie_styles(); ?> <?php print $ie_styles ?>
<![endif]--> <![endif]-->
</head> </head>
<body<?php print phptemplate_body_class($left, $right); ?>> <body class="<?php print $body_classes ?>">
<!-- Layout --> <div id="header-region" class="clear-block"><?php print $header ?></div>
<div id="header-region" class="clear-block"><?php print $header; ?></div>
<div id="wrapper"> <div id="wrapper">
<div id="container" class="clear-block"> <div id="container" class="clear-block">
<div id="header"> <div id="header">
<div id="logo-floater"> <div id="logo-floater">
<?php <?php if ($logo || $site_title): ?>
// Prepare header <h1><a href=" <?php print $front_page ?>" title="<?php print $site_title ?>">
$site_fields = array(); <?php if ($logo): ?>
if ($site_name) { <img src="<?php print $logo ?>" alt="<?php print $site_title ?>" id="logo" />
$site_fields[] = check_plain($site_name); <?php endif; ?>
} <?php print $site_html ?>
if ($site_slogan) { </a></h1>
$site_fields[] = check_plain($site_slogan); <?php endif; ?>
}
$site_title = implode(' ', $site_fields);
if ($site_fields) {
$site_fields[0] = '<span>' . $site_fields[0] . '</span>';
}
$site_html = implode(' ', $site_fields);
if ($logo || $site_title) {
print '<h1><a href="' . check_url($front_page) . '" title="' . $site_title . '">';
if ($logo) {
print '<img src="' . check_url($logo) . '" alt="' . $site_title . '" id="logo" />';
}
print $site_html . '</a></h1>';
}
?>
</div> </div>
<?php if (isset($primary_links)) : ?> <?php if ($primary_nav): print $primary_nav; endif; ?>
<?php print theme('links', $primary_links, array('class' => 'links primary-links')) ?> <?php if ($secondary_nav): print $secondary_nav; endif; ?>
<?php endif; ?> </div> <!-- /#header -->
<?php if (isset($secondary_links)) : ?>
<?php print theme('links', $secondary_links, array('class' => 'links secondary-links')) ?>
<?php endif; ?>
</div> <!-- /header -->
<?php if ($left): ?> <?php if ($left): ?>
<div id="sidebar-left" class="sidebar"> <div id="sidebar-left" class="sidebar">
@ -65,11 +44,11 @@
<div id="center"><div id="squeeze"><div class="right-corner"><div class="left-corner"> <div id="center"><div id="squeeze"><div class="right-corner"><div class="left-corner">
<?php print $breadcrumb; ?> <?php print $breadcrumb; ?>
<?php if ($mission): print '<div id="mission">' . $mission . '</div>'; endif; ?> <?php if ($mission): ?><div id="mission"><?php print $mission ?></div><?php endif; ?>
<?php if ($tabs): print '<div id="tabs-wrapper" class="clear-block">'; endif; ?> <?php if ($tabs): ?><div id="tabs-wrapper" class="clear-block"><?php endif; ?>
<?php if ($title): print '<h2' . ($tabs ? ' class="with-tabs"' : '') . '>' . $title . '</h2>'; endif; ?> <?php if ($title): ?><h2<?php print $tabs ? ' class="with-tabs"' : '' ?>><?php print $title ?></h2><?php endif; ?>
<?php if ($tabs): print '<ul class="tabs primary">' . $tabs . '</ul></div>'; endif; ?> <?php if ($tabs): ?><ul class="tabs primary"><?php print $tabs ?></ul></div><?php endif; ?>
<?php if ($tabs2): print '<ul class="tabs secondary">' . $tabs2 . '</ul>'; endif; ?> <?php if ($tabs2): ?><ul class="tabs secondary"><?php print $tabs2 ?></ul><?php endif; ?>
<?php if ($show_messages && $messages): print $messages; endif; ?> <?php if ($show_messages && $messages): print $messages; endif; ?>
<?php print $help; ?> <?php print $help; ?>
<div class="clear-block"> <div class="clear-block">
@ -86,9 +65,8 @@
</div> </div>
<?php endif; ?> <?php endif; ?>
</div> <!-- /container --> </div> <!-- /#container -->
</div> </div> <!-- /#wrapper -->
<!-- /layout -->
<?php print $closure ?> <?php print $closure ?>
</body> </body>

View File

@ -12,12 +12,12 @@ ul.primary-links, ul.secondary-links,
display: none; display: none;
} }
body.sidebars, body.sidebar-left, body.sidebar-right, body { body.two-sidebars, body.sidebar-left, body.sidebar-right, body {
width: 640px; width: 640px;
} }
body.sidebar-left #center, body.sidebar-right #center, body.sidebars #center, body.sidebar-left #center, body.sidebar-right #center, body.two-sidebars #center,
body.sidebar-left #squeeze, body.sidebar-right #squeeze, body.sidebars #squeeze { body.sidebar-left #squeeze, body.sidebar-right #squeeze, body.two-sidebars #squeeze {
margin: 0; margin: 0;
} }

View File

@ -384,7 +384,7 @@ table .form-button, table .form-submit {
} }
/* With 3 columns, require a minimum width of 1000px to ensure there is enough horizontal space. */ /* With 3 columns, require a minimum width of 1000px to ensure there is enough horizontal space. */
body.sidebars { body.two-sidebars {
min-width: 980px; min-width: 980px;
} }
/* With 2 columns, require a minimum width of 800px. */ /* With 2 columns, require a minimum width of 800px. */
@ -405,7 +405,7 @@ body.sidebar-left #center {
body.sidebar-right #center { body.sidebar-right #center {
margin-right: -210px; margin-right: -210px;
} }
body.sidebars #center { body.two-sidebars #center {
margin: 0 -210px; margin: 0 -210px;
} }
@ -416,7 +416,7 @@ body.sidebar-left #squeeze {
body.sidebar-right #squeeze { body.sidebar-right #squeeze {
margin-right: 210px; margin-right: 210px;
} }
body.sidebars #squeeze { body.two-sidebars #squeeze {
margin: 0 210px; margin: 0 210px;
} }
@ -505,7 +505,7 @@ body.sidebar-right #footer {
margin-right: -210px; margin-right: -210px;
} }
body.sidebars #footer { body.two-sidebars #footer {
margin: 0 -210px; margin: 0 -210px;
} }

View File

@ -1,29 +1,6 @@
<?php <?php
// $Id$ // $Id$
/**
* Sets the body-tag class attribute.
*
* Adds 'sidebar-left', 'sidebar-right' or 'sidebars' classes as needed.
*/
function phptemplate_body_class($left, $right) {
if ($left != '' && $right != '') {
$class = 'sidebars';
}
else {
if ($left != '') {
$class = 'sidebar-left';
}
if ($right != '') {
$class = 'sidebar-right';
}
}
if (isset($class)) {
print ' class="' . $class . '"';
}
}
/** /**
* Return a themed breadcrumb trail. * Return a themed breadcrumb trail.
* *
@ -31,7 +8,7 @@ function phptemplate_body_class($left, $right) {
* An array containing the breadcrumb links. * An array containing the breadcrumb links.
* @return a string containing the breadcrumb output. * @return a string containing the breadcrumb output.
*/ */
function phptemplate_breadcrumb($breadcrumb) { function garland_breadcrumb($breadcrumb) {
if (!empty($breadcrumb)) { if (!empty($breadcrumb)) {
return '<div class="breadcrumb">' . implode(' ', $breadcrumb) . '</div>'; return '<div class="breadcrumb">' . implode(' ', $breadcrumb) . '</div>';
} }
@ -40,7 +17,7 @@ function phptemplate_breadcrumb($breadcrumb) {
/** /**
* Allow themable wrapping of all comments. * Allow themable wrapping of all comments.
*/ */
function phptemplate_comment_wrapper($content, $node) { function garland_comment_wrapper($content, $node) {
if (!$content || $node->type == 'forum') { if (!$content || $node->type == 'forum') {
return '<div id="comments">' . $content . '</div>'; return '<div id="comments">' . $content . '</div>';
} }
@ -50,10 +27,27 @@ function phptemplate_comment_wrapper($content, $node) {
} }
/** /**
* Override or insert PHPTemplate variables into the templates. * Override or insert variables into the page template.
*/ */
function phptemplate_preprocess_page(&$vars) { function garland_preprocess_page(&$vars) {
$vars['tabs2'] = menu_secondary_local_tasks(); $vars['tabs2'] = menu_secondary_local_tasks();
$vars['primary_nav'] = isset($vars['primary_links']) ? theme('links', $vars['primary_links'], array('class' => 'links primary-links')) : FALSE;
$vars['secondary_nav'] = isset($vars['secondary_links']) ? theme('links', $vars['secondary_links'], array('class' => 'links secondary-links')) : FALSE;
$vars['ie_styles'] = garland_get_ie_styles();
// Prepare header
$site_fields = array();
if (!empty($vars['site_name'])) {
$site_fields[] = check_plain($vars['site_name']);
}
if (!empty($vars['site_slogan'])) {
$site_fields[] = check_plain($vars['site_slogan']);
}
$vars['site_title'] = implode(' ', $site_fields);
if (!empty($site_fields)) {
$site_fields[0] = '<span>'. $site_fields[0] .'</span>';
}
$vars['site_html'] = implode(' ', $site_fields);
// Hook into color.module // Hook into color.module
if (module_exists('color')) { if (module_exists('color')) {
@ -64,13 +58,14 @@ function phptemplate_preprocess_page(&$vars) {
/** /**
* Returns the rendered local tasks. The default implementation renders * Returns the rendered local tasks. The default implementation renders
* them as tabs. Overridden to split the secondary tasks. * them as tabs. Overridden to split the secondary tasks.
*
* @ingroup themeable
*/ */
function phptemplate_menu_local_tasks() { function garland_menu_local_tasks() {
return menu_primary_local_tasks(); return menu_primary_local_tasks();
} }
/**
* Format the "Submitted by username on date/time" for each comment.
*/
function phptemplate_comment_submitted($comment) { function phptemplate_comment_submitted($comment) {
return t('!datetime — !username', return t('!datetime — !username',
array( array(
@ -79,7 +74,10 @@ function phptemplate_comment_submitted($comment) {
)); ));
} }
function phptemplate_node_submitted($node) { /**
* Format the "Submitted by username on date/time" for each node.
*/
function garland_node_submitted($node) {
return t('!datetime — !username', return t('!datetime — !username',
array( array(
'!username' => theme('username', $node), '!username' => theme('username', $node),
@ -90,13 +88,13 @@ function phptemplate_node_submitted($node) {
/** /**
* Generates IE CSS links for LTR and RTL languages. * Generates IE CSS links for LTR and RTL languages.
*/ */
function phptemplate_get_ie_styles() { function garland_get_ie_styles() {
global $language; global $language;
$iecss = '<link type="text/css" rel="stylesheet" media="all" href="' . base_path() . path_to_theme() . '/fix-ie.css" />'; $ie_styles = '<link type="text/css" rel="stylesheet" media="all" href="' . base_path() . path_to_theme() . '/fix-ie.css" />'. "\n";
if (defined('LANGUAGE_RTL') && $language->direction == LANGUAGE_RTL) { if (defined('LANGUAGE_RTL') && $language->direction == LANGUAGE_RTL) {
$iecss .= '<style type="text/css" media="all">@import "' . base_path() . path_to_theme() . '/fix-ie-rtl.css";</style>'; $ie_styles .= ' <style type="text/css" media="all">@import "' . base_path() . path_to_theme() . '/fix-ie-rtl.css";</style>'. "\n";
} }
return $iecss; return $ie_styles;
} }