2004-08-20 09:34:53 +00:00
|
|
|
<?php
|
|
|
|
// $Id$
|
|
|
|
|
2004-08-21 06:42:38 +00:00
|
|
|
/**
|
|
|
|
* @file
|
2006-08-23 18:32:39 +00:00
|
|
|
* A slim, CSS-driven theme which does not depend on a template engine like phptemplate
|
2004-08-21 06:42:38 +00:00
|
|
|
*/
|
|
|
|
|
2007-04-06 13:27:23 +00:00
|
|
|
/**
|
|
|
|
* Implementation of hook_theme. Auto-discover theme functions.
|
|
|
|
*/
|
2007-05-06 05:47:52 +00:00
|
|
|
function chameleon_theme($existing, $type, $theme, $path) {
|
2007-07-03 18:48:41 +00:00
|
|
|
return drupal_find_theme_functions($existing, array($theme));
|
2007-04-06 13:27:23 +00:00
|
|
|
}
|
|
|
|
|
2007-05-04 09:41:37 +00:00
|
|
|
function chameleon_page($content, $show_blocks = TRUE, $show_messages = TRUE) {
|
2008-01-24 09:42:53 +00:00
|
|
|
$language = $GLOBALS['language']->language;
|
|
|
|
$direction = $GLOBALS['language']->direction ? 'rtl' : 'ltr';
|
2004-09-09 13:36:01 +00:00
|
|
|
|
2005-05-25 06:03:18 +00:00
|
|
|
if (theme_get_setting('toggle_favicon')) {
|
2008-04-14 17:48:46 +00:00
|
|
|
drupal_set_html_head('<link rel="shortcut icon" href="' . check_url(theme_get_setting('favicon')) . '" type="image/x-icon" />');
|
2005-05-25 06:03:18 +00:00
|
|
|
}
|
|
|
|
|
2005-03-31 09:25:33 +00:00
|
|
|
$title = drupal_get_title();
|
2008-11-22 13:55:27 +00:00
|
|
|
$rdf_namespaces = drupal_get_rdf_namespaces();
|
2005-03-31 09:25:33 +00:00
|
|
|
|
2006-11-29 06:36:12 +00:00
|
|
|
// Get blocks before so that they can alter the header (JavaScript, Stylesheets etc.)
|
|
|
|
$blocks_left = theme_blocks('left');
|
|
|
|
$blocks_right = theme_blocks('right');
|
|
|
|
|
2008-11-22 13:55:27 +00:00
|
|
|
$output = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML+RDFa 1.0//EN\" \"http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd\">\n";
|
2008-11-24 15:27:13 +00:00
|
|
|
$output .= "<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"$language\" dir=\"$direction\"\n";
|
2008-11-23 16:54:49 +00:00
|
|
|
$output .= " $rdf_namespaces>\n";
|
2008-11-22 13:55:27 +00:00
|
|
|
$output .= "<head profile=\"http://ns.inria.fr/grddl/rdfa/\">\n";
|
2008-04-14 17:48:46 +00:00
|
|
|
$output .= " <title>" . ($title ? strip_tags($title) . " | " . variable_get("site_name", "Drupal") : variable_get("site_name", "Drupal") . " | " . variable_get("site_slogan", "")) . "</title>\n";
|
2004-08-20 09:34:53 +00:00
|
|
|
$output .= drupal_get_html_head();
|
2006-08-03 07:06:36 +00:00
|
|
|
$output .= drupal_get_css();
|
2006-08-22 09:00:31 +00:00
|
|
|
$output .= drupal_get_js();
|
2004-08-20 09:34:53 +00:00
|
|
|
$output .= "</head>";
|
2006-01-20 08:54:07 +00:00
|
|
|
$output .= "<body>\n";
|
2004-08-20 09:34:53 +00:00
|
|
|
$output .= " <div id=\"header\">";
|
|
|
|
|
2004-08-20 17:21:37 +00:00
|
|
|
if ($logo = theme_get_setting('logo')) {
|
2008-04-14 17:48:46 +00:00
|
|
|
$output .= " <a href=\"" . url() . "\" title=\"" . t('Home') . "\"><img src=\"$logo\" alt=\"" . t('Home') . "\" /></a>";
|
2004-08-20 09:34:53 +00:00
|
|
|
}
|
2004-08-20 17:21:37 +00:00
|
|
|
if (theme_get_setting('toggle_name')) {
|
2008-04-14 17:48:46 +00:00
|
|
|
$output .= " <h1 class=\"site-name title\">" . l(variable_get('site_name', 'drupal'), "") . "</h1>";
|
2004-08-20 09:34:53 +00:00
|
|
|
}
|
2004-08-20 17:21:37 +00:00
|
|
|
if (theme_get_setting('toggle_slogan')) {
|
2008-04-14 17:48:46 +00:00
|
|
|
$output .= " <div class=\"site-slogan\">" . variable_get('site_slogan', '') . "</div>";
|
2004-08-20 09:34:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
$output .= "</div>\n";
|
|
|
|
|
2008-06-25 09:12:25 +00:00
|
|
|
$main_menu = theme('links', menu_main_menu(), array('class' => 'links', 'id' => 'navlist'));
|
|
|
|
$secondary_menu = theme('links', menu_secondary_menu(), array('class' => 'links', 'id' => 'subnavlist'));
|
|
|
|
if (isset($main_menu) || isset($secondary_menu)) {
|
2004-08-20 09:34:53 +00:00
|
|
|
$output .= ' <div class="navlinks">';
|
2008-06-25 09:12:25 +00:00
|
|
|
if (isset($main_menu)) {
|
|
|
|
$output .= $main_menu;
|
2004-08-20 09:34:53 +00:00
|
|
|
}
|
2008-06-25 09:12:25 +00:00
|
|
|
if (isset($secondary_menu)) {
|
|
|
|
$output .= $secondary_menu;
|
2004-08-20 09:34:53 +00:00
|
|
|
}
|
|
|
|
$output .= " </div>\n";
|
|
|
|
}
|
|
|
|
|
2004-09-20 14:36:53 +00:00
|
|
|
$output .= " <table id=\"content\">\n";
|
2004-08-20 09:34:53 +00:00
|
|
|
$output .= " <tr>\n";
|
|
|
|
|
2006-11-29 06:36:12 +00:00
|
|
|
if ($show_blocks && !empty($blocks_left)) {
|
|
|
|
$output .= " <td id=\"sidebar-left\">$blocks_left</td>\n";
|
2004-08-20 09:34:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
$output .= " <td id=\"main\">\n";
|
|
|
|
|
2005-03-31 09:25:33 +00:00
|
|
|
if ($title) {
|
2004-08-20 09:34:53 +00:00
|
|
|
$output .= theme("breadcrumb", drupal_get_breadcrumb());
|
|
|
|
$output .= "<h2>$title</h2>";
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($tabs = theme('menu_local_tasks')) {
|
|
|
|
$output .= $tabs;
|
|
|
|
}
|
|
|
|
|
2007-05-04 09:41:37 +00:00
|
|
|
if ($show_messages) {
|
|
|
|
$output .= theme('status_messages');
|
|
|
|
}
|
2004-08-20 09:34:53 +00:00
|
|
|
|
2008-01-07 13:49:38 +00:00
|
|
|
$output .= theme('help');
|
|
|
|
|
2004-08-20 09:34:53 +00:00
|
|
|
$output .= "\n<!-- begin content -->\n";
|
|
|
|
$output .= $content;
|
2006-08-23 05:55:38 +00:00
|
|
|
$output .= drupal_get_feeds();
|
2004-08-20 09:34:53 +00:00
|
|
|
$output .= "\n<!-- end content -->\n";
|
|
|
|
|
|
|
|
if ($footer = variable_get('site_footer', '')) {
|
|
|
|
$output .= " <div id=\"footer\">$footer</div>\n";
|
|
|
|
}
|
|
|
|
|
2007-12-22 23:24:26 +00:00
|
|
|
$output .= " </td>\n";
|
2004-08-20 09:34:53 +00:00
|
|
|
|
2006-11-29 06:36:12 +00:00
|
|
|
if ($show_blocks && !empty($blocks_right)) {
|
|
|
|
$output .= " <td id=\"sidebar-right\">$blocks_right</td>\n";
|
2004-08-20 09:34:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
$output .= " </tr>\n";
|
|
|
|
$output .= " </table>\n";
|
|
|
|
|
|
|
|
$output .= theme_closure();
|
|
|
|
$output .= " </body>\n";
|
|
|
|
$output .= "</html>\n";
|
|
|
|
|
|
|
|
return $output;
|
|
|
|
}
|
|
|
|
|
2008-12-31 12:02:24 +00:00
|
|
|
function chameleon_node($node, $teaser = 0) {
|
2004-08-20 09:34:53 +00:00
|
|
|
|
2008-04-14 17:48:46 +00:00
|
|
|
$output = "<div class=\"node" . ((!$node->status) ? ' node-unpublished' : '') . (($node->sticky) ? ' sticky' : '') . "\">\n";
|
2004-08-20 09:34:53 +00:00
|
|
|
|
|
|
|
if (!$page) {
|
2008-04-14 17:48:46 +00:00
|
|
|
$output .= " <h2 class=\"title\">" . ($teaser ? l($node->title, "node/$node->nid") : check_plain($node->title)) . "</h2>\n";
|
2004-08-20 09:34:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
$output .= " <div class=\"content\">\n";
|
|
|
|
|
2005-08-07 14:55:17 +00:00
|
|
|
if ($teaser && $node->teaser) {
|
2004-08-20 09:34:53 +00:00
|
|
|
$output .= $node->teaser;
|
|
|
|
}
|
2007-09-19 19:20:48 +00:00
|
|
|
elseif (isset($node->body)) {
|
2004-08-20 09:34:53 +00:00
|
|
|
$output .= $node->body;
|
|
|
|
}
|
|
|
|
|
|
|
|
$output .= " </div>\n";
|
|
|
|
|
2008-12-16 22:05:51 +00:00
|
|
|
$submitted = '';
|
2009-01-09 16:19:56 +00:00
|
|
|
if (variable_get('node_submitted_' . $node->type, TRUE)) {
|
2008-12-16 22:05:51 +00:00
|
|
|
$submitted = t("By !author at @date", array('!author' => theme('username', $node), '@date' => format_date($node->created, 'small')));
|
2004-08-20 09:34:53 +00:00
|
|
|
}
|
|
|
|
|
2008-12-16 22:05:51 +00:00
|
|
|
$terms = '';
|
2008-12-26 10:46:54 +00:00
|
|
|
if (!empty($node->content['links']['terms'])) {
|
|
|
|
$terms = drupal_render($node->content['links']['terms']);
|
2008-12-16 22:05:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
$links = '';
|
|
|
|
if ($node->content['links']) {
|
|
|
|
$links = drupal_render($node->content['links']);
|
2005-05-27 05:20:08 +00:00
|
|
|
}
|
2008-12-16 22:05:51 +00:00
|
|
|
|
|
|
|
if (!empty($terms) || !empty($links)) {
|
|
|
|
$output .= '<div class="links">' . $terms . $links . $submitted . "</div>\n";
|
2004-08-20 09:34:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
$output .= "</div>\n";
|
2008-12-31 12:02:24 +00:00
|
|
|
|
|
|
|
if ($node->content['comments']) {
|
|
|
|
$output .= drupal_render($node->content['comments']);
|
|
|
|
}
|
2004-08-20 09:34:53 +00:00
|
|
|
|
|
|
|
return $output;
|
|
|
|
}
|
|
|
|
|
2007-10-25 10:37:25 +00:00
|
|
|
function chameleon_comment($comment, $node, $links = array()) {
|
2007-06-11 15:21:14 +00:00
|
|
|
$submitted['comment_submitted'] = array(
|
|
|
|
'title' => t('By !author at @date', array('!author' => theme('username', $comment), '@date' => format_date($comment->timestamp, 'small'))),
|
|
|
|
'html' => TRUE);
|
2004-08-20 09:34:53 +00:00
|
|
|
|
2008-12-28 08:26:51 +00:00
|
|
|
$output = "<div class=\"comment\">\n";
|
2008-04-14 17:48:46 +00:00
|
|
|
$output .= " <h3 class=\"title\">" . l($comment->subject, $_GET['q'], array('fragment' => "comment-$comment->cid")) . "</h3>\n";
|
|
|
|
$output .= " <div class=\"content\">" . $comment->comment;
|
2008-12-27 10:09:14 +00:00
|
|
|
if (!empty($comment->signature)) {
|
2007-04-01 05:04:20 +00:00
|
|
|
$output .= " <div class=\"clear-block\">";
|
|
|
|
$output .= "<div>—</div>\n";
|
2008-12-27 10:09:14 +00:00
|
|
|
$output .= $comment->signature . "\n";
|
2007-03-30 07:45:20 +00:00
|
|
|
$output .= " </div>\n";
|
|
|
|
}
|
|
|
|
$output .= " </div>\n";
|
2008-04-14 17:48:46 +00:00
|
|
|
$output .= " <div class=\"links\">" . theme('links', array_merge($submitted, $links)) . "</div>\n";
|
2004-08-20 09:34:53 +00:00
|
|
|
$output .= "</div>\n";
|
|
|
|
|
|
|
|
return $output;
|
|
|
|
}
|
2005-04-30 17:47:57 +00:00
|
|
|
|
|
|
|
function chameleon_help() {
|
|
|
|
if ($help = menu_get_active_help()) {
|
2008-04-14 17:48:46 +00:00
|
|
|
return '<div class="help">' . $help . '</div><hr />';
|
2005-04-30 17:47:57 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|