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();
|
|
|
|
|
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');
|
|
|
|
|
2004-08-20 09:34:53 +00:00
|
|
|
$output = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n";
|
2008-01-24 09:42:53 +00:00
|
|
|
$output .= "<html xmlns=\"http://www.w3.org/1999/xhtml\" lang=\"$language\" xml:lang=\"$language\" dir=\"$direction\">\n";
|
2004-08-20 09:34:53 +00:00
|
|
|
$output .= "<head>\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;
|
|
|
|
}
|
|
|
|
|
2005-08-07 14:55:17 +00:00
|
|
|
function chameleon_node($node, $teaser = 0, $page = 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";
|
|
|
|
|
2007-06-11 15:21:14 +00:00
|
|
|
$submitted['node_submitted'] = theme_get_setting("toggle_node_info_$node->type") ? array(
|
|
|
|
'title' => t("By !author at @date", array('!author' => theme('username', $node), '@date' => format_date($node->created, 'small'))),
|
|
|
|
'html' => TRUE) : array();
|
2004-08-20 09:34:53 +00:00
|
|
|
|
2004-08-22 17:03:42 +00:00
|
|
|
$terms = array();
|
2006-08-20 05:57:41 +00:00
|
|
|
if (module_exists('taxonomy')) {
|
2004-08-20 09:34:53 +00:00
|
|
|
$terms = taxonomy_link("taxonomy terms", $node);
|
|
|
|
}
|
|
|
|
|
2005-05-27 05:20:08 +00:00
|
|
|
$links = array_merge($submitted, $terms);
|
2007-09-19 19:20:48 +00:00
|
|
|
if (isset($node->links)) {
|
2005-05-27 05:20:08 +00:00
|
|
|
$links = array_merge($links, $node->links);
|
|
|
|
}
|
|
|
|
if (count($links)) {
|
2008-04-14 17:48:46 +00:00
|
|
|
$output .= '<div class="links">' . theme('links', $links, array('class' => 'links inline')) . "</div>\n";
|
2004-08-20 09:34:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
$output .= "</div>\n";
|
|
|
|
|
|
|
|
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-04-14 17:48:46 +00:00
|
|
|
$output = "<div class=\"comment" . ' ' . $status . "\">\n";
|
|
|
|
$output .= " <h3 class=\"title\">" . l($comment->subject, $_GET['q'], array('fragment' => "comment-$comment->cid")) . "</h3>\n";
|
|
|
|
$output .= " <div class=\"content\">" . $comment->comment;
|
2007-10-25 10:37:25 +00:00
|
|
|
if (!empty($signature)) {
|
2007-04-01 05:04:20 +00:00
|
|
|
$output .= " <div class=\"clear-block\">";
|
|
|
|
$output .= "<div>—</div>\n";
|
2008-04-14 17:48:46 +00:00
|
|
|
$output .= $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
|
|
|
}
|
|
|
|
}
|
|
|
|
|