Commit e274f97c authored by Dries's avatar Dries

- Removed the Xtemplate engine and added the PHPTemplate engine.

- Converted the Bluemarine theme from XTemplate to PHPTemplate.
- Moved the the Pushbutton theme and the Xtemplate engine to the contributions repository.
parent 00212935
......@@ -3,6 +3,10 @@ Drupal x.x.x, xxxx-xx-xx (Development version)
- added free tagging support (folksonomies).
- added a site-wide contact form.
- theme system:
* removed the Xtemplate theme engine.
* added the PHPTemplate theme engine.
* converted the bluemarine theme from XTemplate to PHPTemplate.
- reworked the 'request new password' functionality.
- profiles:
* added a block to display author information along with posts.
......
......@@ -2407,6 +2407,24 @@ function update_132() {
return $ret;
}
function update_130() {
$ret = array();
if ($GLOBALS['db_type'] == 'mysql') {
$ret[] = update_sql("ALTER TABLE {locales_source} CHANGE location location varchar(255) NOT NULL default ''");
}
elseif ($GLOBALS['db_type'] == 'pgsql') {
$ret[] = update_sql("ALTER TABLE {locales_source} RENAME location TO location_old");
$ret[] = update_sql("ALTER TABLE {locales_source} ADD location varchar(255)");
$ret[] = update_sql("ALTER TABLE {locales_source} ALTER location SET NOT NULL");
$ret[] = update_sql("ALTER TABLE {locales_source} ALTER location SET DEFAULT ''");
$ret[] = update_sql("UPDATE {locales_source} SET location = location_old");
$ret[] = update_sql("ALTER TABLE {locales_source} DROP location_old");
}
return $ret;
}
function update_133() {
$ret[] = update_sql("CREATE TABLE {contact} (
subject varchar(255) NOT NULL default '',
......
......@@ -211,8 +211,8 @@ function path_to_theme() {
*/
function theme_get_settings($key = NULL) {
$defaults = array(
'primary_links' => l(t('edit primary links'), 'admin/themes/settings'),
'secondary_links' => l(t('edit secondary links'), 'admin/themes/settings'),
'primary_links' => array(),
'secondary_links' => array(),
'mission' => '',
'default_logo' => 1,
'logo_path' => '',
......
......@@ -652,9 +652,44 @@ function system_theme_settings($key = '') {
// System wide only settings.
if (!$key) {
// Menu settings
$group = form_textarea(t('Primary links'), "$var][primary_links", $settings['primary_links'], 70, 8, t('The HTML code for the primary links.'));
$group .= form_textarea(t('Secondary links'), "$var][secondary_links", $settings['secondary_links'], 70, 8, t('The HTML code for the secondary links.'));
$form .= form_group(t('Menu Settings'), $group, t('Customize the menus that are displayed at the top and/or bottom of the page. This configuration screen is only available in the site wide display configuration.'));
$header = array(t('link text'), t('url'), t('description'));
foreach (array('Primary', 'Secondary') as $utype) {
$group = '';
$rows = array();
//Use $utype field , and strtolower() it to get the type field.. to avoid issues with ucfirst() and unicode.
$type = strtolower($utype);
$value = theme_get_setting($type . '_links');
if (!is_array($value)) {
$value = array();
}
//Increment the link count, if the user has requested more links.
if (variable_get($type . '_links_more', false)) {
variable_del($type . '_links_more');
variable_set($type . '_link_count', variable_get($type . '_link_count', 5) + 5);
}
//Get the amount of links to show, possibly expanding if there are more links defined than the count specifies.
$count = variable_get($type . '_link_count', 5);
$count = ($count > sizeof($value['link'])) ? $count : sizeof($value['link']);
if (variable_get($type . '_link_count', 5) != $count) {
variable_set($type . '_link_count', $count);
}
for ($i = 0; $i < $count; $i++) {
$row = array();
foreach (array('text', 'link', 'description') as $field) {
$row[] = form_textfield('', $var . '][' . $type . '_links][' . $field . '][' . $i, $value[$field][$i], 15, 90);
}
$rows[] = $row;
}
$group .= form_item('', theme("table", $header, $rows), t('You can specify your _TYPE_ links here, one link per line.<br /> The link text field is the text you want to link.<br /> The url field is the location the link points to.<br /> The description field is an optional description of where the link points.', array('_TYPE_' => $type)));
$group .= form_checkbox(t('I need more _TYPE_ links.', array('_TYPE_' => $type)), $type . '_links_more', 1, FALSE, t('Checking this box will give you 5 additional _TYPE_ links.', array('_TYPE_' => $type)));
$form .= form_group(t('_TYPE_ link settings', array('_TYPE_' => $utype)), $group);
}
// Toggle node display.
$group = '';
......
......@@ -652,9 +652,44 @@ function system_theme_settings($key = '') {
// System wide only settings.
if (!$key) {
// Menu settings
$group = form_textarea(t('Primary links'), "$var][primary_links", $settings['primary_links'], 70, 8, t('The HTML code for the primary links.'));
$group .= form_textarea(t('Secondary links'), "$var][secondary_links", $settings['secondary_links'], 70, 8, t('The HTML code for the secondary links.'));
$form .= form_group(t('Menu Settings'), $group, t('Customize the menus that are displayed at the top and/or bottom of the page. This configuration screen is only available in the site wide display configuration.'));
$header = array(t('link text'), t('url'), t('description'));
foreach (array('Primary', 'Secondary') as $utype) {
$group = '';
$rows = array();
//Use $utype field , and strtolower() it to get the type field.. to avoid issues with ucfirst() and unicode.
$type = strtolower($utype);
$value = theme_get_setting($type . '_links');
if (!is_array($value)) {
$value = array();
}
//Increment the link count, if the user has requested more links.
if (variable_get($type . '_links_more', false)) {
variable_del($type . '_links_more');
variable_set($type . '_link_count', variable_get($type . '_link_count', 5) + 5);
}
//Get the amount of links to show, possibly expanding if there are more links defined than the count specifies.
$count = variable_get($type . '_link_count', 5);
$count = ($count > sizeof($value['link'])) ? $count : sizeof($value['link']);
if (variable_get($type . '_link_count', 5) != $count) {
variable_set($type . '_link_count', $count);
}
for ($i = 0; $i < $count; $i++) {
$row = array();
foreach (array('text', 'link', 'description') as $field) {
$row[] = form_textfield('', $var . '][' . $type . '_links][' . $field . '][' . $i, $value[$field][$i], 15, 90);
}
$rows[] = $row;
}
$group .= form_item('', theme("table", $header, $rows), t('You can specify your _TYPE_ links here, one link per line.<br /> The link text field is the text you want to link.<br /> The url field is the location the link points to.<br /> The description field is an optional description of where the link points.', array('_TYPE_' => $type)));
$group .= form_checkbox(t('I need more _TYPE_ links.', array('_TYPE_' => $type)), $type . '_links_more', 1, FALSE, t('Checking this box will give you 5 additional _TYPE_ links.', array('_TYPE_' => $type)));
$form .= form_group(t('_TYPE_ link settings', array('_TYPE_' => $utype)), $group);
}
// Toggle node display.
$group = '';
......
<div class="block block-<?php print $block->module; ?>" id="block-<?php print $block->module; ?>-<?php print $block->delta; ?>">
<h2 class="title"><?php print $block->title; ?></h2>
<div class="content"><?php print $block->content; ?></div>
</div>
<div class="box">
<h2 class="title"><?php print $title; ?></h2>
<div class="content"><?php print $content; ?></div>
</div>
<div class="comment">
<?php if ($picture) {
print $picture;
} ?>
<h3 class="title"><?php print $title; ?></h3><?php if ($new != '') { ?><span class="new"><?php print $new; ?></span><?php } ?>
<div class="submitted"><?php print $submitted; ?></div>
<div class="content"><?php print $content; ?></div>
<div class="links">&raquo; <?php print $links; ?></div>
</div>
<div class="node<?php if ($sticky) { print " sticky"; } ?>">
<?php if ($picture) {
print $picture;
}?>
<h2 class="title"><a href="<?php print $node_url?>"><?php print $title?></a></h2>
<span class="submitted"><?php print $submitted?></span>
<span class="taxonomy"><?php print $terms?></span>
<div class="content"><?php print $content?></div>
<div class="links">&raquo; <?php print $links?></div>
</div>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><?php global $theme ?>
<html xmlns="http://www.w3.org/1999/xhtml" lang="<?php print $language ?>" xml:lang="<?php print $language ?>">
<head>
<title><?php print $head_title ?></title>
<?php print $head ?>
<?php print $styles ?>
<script type="text/javascript"> </script>
</head>
<body<?php print $onload_attributes ?>>
<table border="0" cellpadding="0" cellspacing="0" id="header">
<tr>
<td id="logo">
<a href="./" title="Home"><img src="<?php print $logo ?>" alt="Home" border="0" /></a>
<h1 class='site-name'><a href="./" title="Home"><?php print $site_name ?></a></h1>
<div class='site-slogan'><?php print $site_slogan ?></div>
</td>
<td id="menu">
<div id="secondary"><?php print (is_array($secondary_links) && count($secondary_links) > 0) ? theme('links', $secondary_links) : l(t('edit secondary links'),'admin/themes/settings') ?></div>
<div id="primary"><?php print (is_array($primary_links) && count($primary_links) > 0) ? theme('links', $primary_links) : l(t('edit primary links'), 'admin/themes/settings') ?></div>
<?php if ($search_box) { ?><form action="<?php print $search_url ?>" method="post">
<div id="search">
<input class="form-text" type="text" size="15" value="" name="keys" alt="<?php print $search_description ?>" />
<input class="form-submit" type="submit" value="<?php print $search_button_text ?>" />
</div>
</form><?php } ?>
</td>
</tr>
</table>
<table border="0" cellpadding="0" cellspacing="0" id="content">
<tr>
<?php if ($sidebar_left) { ?><td id="sidebar-left">
<?php print $sidebar_left ?>
</td><?php } ?>
<td valign="top">
<?php if ($mission) { ?><div id="mission"><?php print $mission ?></div><?php } ?>
<div id="main">
<?php print $breadcrumb ?>
<h1 class="title"><?php print $title ?></h1>
<div class="tabs"><?php print $tabs ?></div>
<div id="help"><?php print $help ?></div>
<?php print $messages ?>
<?php print $content; ?>
</div>
</td>
<?php if ($sidebar_right) { ?><td id="sidebar-right">
<?php print $sidebar_right ?>
</td><?php } ?>
</tr>
</table>
<div id="footer">
<?php print $footer_message ?>
</div>
<?php print $closure ?>
</body>
</html>
......@@ -14,7 +14,7 @@ tr.dark td, tr.light td {
padding: 0.3em;
}
h1, h2, h3, h4, h5, h6 {
margin-bottom: 0.5em;
margin: 0.5;
}
h1 {
font-size: 1.3em;
......@@ -25,10 +25,6 @@ h2 {
h3, h4, h5, h6 {
font-size: 1.1em;
}
p {
margin-top: 0.5em;
margin-bottom: 0.9em;
}
a {
text-decoration: none;
font-weight: bold;
......@@ -87,7 +83,6 @@ table {
#logo img {
float: left;
padding: 0em 1.0em 0em 1em;
border: 0;
}
#menu {
padding: 0.5em 0.5em 0 0.5em;
......
<div class="<?php print "block block-$block->module" ?>" id="<?php print "block-$block->module-$block->delta"; ?>">
<h2><?php print $block->subject ?></h2>
<div class="content"><?php print $block->content ?></div>
</div>
<div class="box">
<h2><?php print $title ?></h2>
<div class="content"><?php print $content ?></div>
</div>
<div class="comment <?php print ($comment->new) ? 'comment-new' : '' ?>">
<?php if ($comment->new) : ?>
<a id="new"></a>
<span class="new"><?php print $new ?></span>
<?php endif; ?>
<div class="title"><?php print $title ?></div>
<?php print $picture ?>
<div class="author"><?php print $submitted ?></div>
<div class="content"><?php print $content ?></div>
<?php if ($picture) : ?>
<br class="clear" />
<?php endif; ?>
<div class="links"><?php print $links ?></div>
</div>
<!-- PHPTemplate was instructed to override the <?php print $hook ?> theme function, but no valid template file was found. -->
<div class="node<?php print ($sticky) ? " sticky" : ""; ?>">
<?php if ($page == 0): ?>
<h2><a href="<?php print $node_url ?>" title="<?php print $title ?>"><?php print $title ?></a></h2>
<?php endif; ?>
<?php print $picture ?>
<div class="info"><?php print $submitted ?><span class="terms"><?php print $terms ?></span></div>
<div class="content">
<?php print $content ?>
</div>
<?php if ($links): ?>
<?php if ($picture): ?>
<br class='clear' />
<?php endif; ?>
<div class="links"><?php print $links ?></div>
<?php endif; ?>
</div>
This diff is collapsed.
<?php
// $Id$
/**
* @file
* Handles the interface between XTemplate files and the Drupal theme system.
*/
// Initialize the xtemplate engine.
function xtemplate_init($template) {
// We cannot use the theme() or path_to_theme() functions here
if (!class_exists('XTemplate')) {
include_once(dirname(__FILE__) . '/xtemplate.inc');
}
$GLOBALS["xtemplate"] = new StdClass();
$dir = dirname($template->filename);
$GLOBALS['xtemplate']->template = new XTemplate(basename($template->filename), $dir);
$GLOBALS['xtemplate']->template->assign(array('directory' => $dir));
$GLOBALS['xtemplate']->template->SetNullBlock(' '); // '' doesn't work!
}
function xtemplate_templates() {
return system_listing('^xtemplate\.xtmpl$', 'themes', 'filename');
}
function xtemplate_features() {
return array(
'logo',
'toggle_name',
'toggle_search',
'toggle_slogan',
'toggle_mission',
'toggle_primary_links',
'toggle_secondary_links',
'toggle_node_user_picture',
'toggle_comment_user_picture');
}
function xtemplate_node($node, $main = 0, $page = 0) {
global $xtemplate;
$xtemplate->template->assign(array(
"submitted" => theme_get_setting("toggle_node_info_$node->type") ?
t("Submitted by %a on %b.",
array("%a" => format_name($node),
"%b" => format_date($node->created))) : '',
"link" => url("node/$node->nid"),
"title" => check_plain($node->title),
"author" => format_name($node),
"date" => format_date($node->created),
"sticky" => ($main && $node->sticky) ? 'sticky' : '',
"content" => ($main && $node->teaser) ? $node->teaser : $node->body));
if ($page == 0) {
$xtemplate->template->parse("node.title");
}
if (theme_get_setting('toggle_node_user_picture') && $picture = theme('user_picture', $node)) {
$xtemplate->template->assign("picture", $picture);
$xtemplate->template->parse("node.picture");
}
if (module_exist("taxonomy") && ($taxonomy = taxonomy_link("taxonomy terms", $node))) {
$xtemplate->template->assign("taxonomy", theme_links($taxonomy));
$xtemplate->template->parse("node.taxonomy");
}
if ($node->links) {
$xtemplate->template->assign("links", theme_links($node->links));
$xtemplate->template->parse("node.links");
}
$xtemplate->template->parse("node");
$output = $xtemplate->template->text("node");
$xtemplate->template->reset("node");
return $output;
}
function xtemplate_comment($comment, $links = 0) {
global $xtemplate;
$xtemplate->template->assign(array (
"new" => t("new"),
"submitted" => t("Submitted by %a on %b.",
array("%a" => format_name($comment),
"%b" => format_date($comment->timestamp))),
"title" => l($comment->subject, $_GET['q'], NULL, NULL, "comment-$comment->cid"),
"author" => format_name($comment),
"date" => format_date($comment->timestamp),
"content" => $comment->comment
));
if ($comment->new) {
$xtemplate->template->parse("comment.new");
}
if (theme_get_setting('toggle_comment_user_picture') && $picture = theme('user_picture', $comment)) {
$xtemplate->template->assign("picture", $picture);
$xtemplate->template->parse("comment.picture");
}
if ($links) {
$xtemplate->template->assign("links", $links);
$xtemplate->template->parse("comment.links");
}
$xtemplate->template->parse("comment");
$output = $xtemplate->template->text("comment");
$xtemplate->template->reset("comment");
return $output;
}
function xtemplate_page($content) {
global $xtemplate;
$xtemplate->template->assign(array(
"language" => $GLOBALS['locale'],
"head_title" => (drupal_get_title() ? strip_tags(drupal_get_title()) ." | ". variable_get("site_name", "drupal") : variable_get("site_name", "drupal") ." | ". variable_get("site_slogan", "")),
"head" => drupal_get_html_head(),
"styles" => theme_get_styles(),
"onload_attributes" => theme_onload_attribute(),
"primary_links" => theme_get_setting('primary_links'),
"secondary_links" => theme_get_setting('secondary_links')
));
if ($logo = theme_get_setting('logo')) {
$xtemplate->template->assign('logo', $logo);
$xtemplate->template->parse('header.logo');
}
if (theme_get_setting('toggle_name')) {
$xtemplate->template->assign('site_name', variable_get('site_name', ''));
$xtemplate->template->parse('header.site_name');
}
if (theme_get_setting('toggle_slogan')) {
$xtemplate->template->assign('site_slogan', variable_get('site_slogan', ''));
$xtemplate->template->parse('header.site_slogan');
}
if ($tabs = theme('menu_local_tasks')) {
$xtemplate->template->assign("tabs", $tabs);
$xtemplate->template->parse("header.title.tabs");
}
if ($title = drupal_get_title()) {
$xtemplate->template->assign("title", $title);
$xtemplate->template->assign("breadcrumb", theme("breadcrumb", drupal_get_breadcrumb()));
$xtemplate->template->parse("header.title");
}
if ($help = theme('help')) {
$xtemplate->template->assign("help", $help);
$xtemplate->template->parse("header.help");
}
if ($message = theme('status_messages')) {
$xtemplate->template->assign("message", $message);
$xtemplate->template->parse("header.message");
}
if (theme_get_setting('toggle_search')) {
$xtemplate->template->assign(array(
//"search" => search_form(),
"search_url" => url("search"),
"search_button_text" => t("Search"),
"search_description" => t("Enter the terms you wish to search for.")
));
$xtemplate->template->parse("header.search_box");
}
// only parse the mission block if we are on the frontpage ...
if ($_GET["q"] == variable_get("site_frontpage", "node") && theme_get_setting('toggle_mission') && ($mission = theme_get_setting('mission'))) {
$xtemplate->template->assign("mission", $mission);
$xtemplate->template->parse("header.mission");
}
if ($blocks = theme("blocks", "left")) {
$xtemplate->template->assign("blocks", $blocks);
$xtemplate->template->parse("header.blocks");
}
$xtemplate->template->parse("header");
$output = $xtemplate->template->text("header");
$output .= "\n<!-- begin content -->\n";
$output .= $content;
$output .= "\n<!-- end content -->\n";
if ($blocks = theme("blocks", "right")) {
$xtemplate->template->assign("blocks", $blocks);
$xtemplate->template->parse("footer.blocks");
}
// only parse the footer block if site_footer is set
if ($footer_message = variable_get("site_footer", FALSE)) {
$xtemplate->template->assign("footer_message", $footer_message);
$xtemplate->template->parse("footer.message");
}
$xtemplate->template->assign("footer", theme_closure());
$xtemplate->template->parse("footer");
$output .= $xtemplate->template->text("footer");
return $output;
}
function xtemplate_block(&$block) {
global $xtemplate;
// create template variables for all block variables (module, delta, region, subject, content, ...)
foreach ($block as $key => $value) {
$xtemplate->template->assign($key == "subject" ? "title" : $key, $value); // TODO: standardize on 'title' (ie. rename all $block["subject"] to "title")
}
$xtemplate->template->parse("block");
$output = $xtemplate->template->text("block");
$xtemplate->template->reset("block");
return $output;
}
function xtemplate_box($title, $content, $region = "main") {
global $xtemplate;
$xtemplate->template->assign(array(
"title" => $title,
"content" => $content));
$xtemplate->template->parse("box");
$output = $xtemplate->template->text("box");
$xtemplate->template->reset("box");
return $output;
}
?>
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
<!-- BEGIN: header --><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="{language}" xml:lang="{language}">
<head>
<title>{head_title}</title>
{head}
{styles}
<script type="text/javascript"> </script>
</head>
<body bgcolor="#ffffff" {onload_attributes}>
<div class="hide"><a href="#content" title="Skip navigation." accesskey="2">Skip navigation</a>.</div>
<table id="primary-menu" summary="Navigation elements." border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td id="home" width="10%">
<!-- BEGIN: logo -->
<a href="./" title="Home"><img src="{logo}" alt="Home" width="144" height="63" border="0" /></a>
<!-- END: logo -->
</td>
<td id="site-info" width="20%">
<!-- BEGIN: site_name -->
<div class='site-name'><a href="./" title="Home">{site_name}</a></div>
<!-- END: site_name -->
<!-- BEGIN: site_slogan -->
<div class='site-slogan'>{site_slogan}</div>
<!-- END: site_slogan -->
</td>
<td class="primary-links" width="70%" align="center" valign="middle">
{primary_links}
</td>
</tr>
</table>
<table id="secondary-menu" summary="Navigation elements." border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td class="secondary-links" width="75%" align="center" valign="middle">
{secondary_links}
</td>
<td width="25%" align="center" valign="middle">
<!-- BEGIN: search_box -->
<form action="{search_url}" method="post">
<div id="search">
<input class="form-text" type="text" size="15" value="" name="edit[keys]" alt="{search_description}" />
<input class="form-submit" type="submit" value="{search_button_text}" alt="submit" />
</div>
</form>
<!-- END: search_box -->
</td>
</tr>
</table>
<table id="content" border="0" cellpadding="15" cellspacing="0" width="100%">
<tr>
<!-- BEGIN: blocks -->
<td id="sidebar-left">
{blocks}
</td>
<!-- END: blocks -->
<td valign="top">
<!-- BEGIN: mission -->
<div id="mission">{mission}</div>
<!-- END: mission -->
<div id="main">