Commit 47c6fce5 authored by Dries's avatar Dries

- added a comment() function to the base theme: you don't have to overload
  it in your custom themes

- moved 'theme_account()' to the base theme as '$theme->user()' so that it
  can be themed.
parent 458f9510
......@@ -150,9 +150,7 @@ function comment_moderation($comment) {
$options .= " <option value=\"$key\"". ($moderate->score == $key ? " selected=\"selected\"" : "") .">$value</option>\n";
}
$output .= "<div align=\"center\">";
$output .= " <select name=\"moderate[comment][$comment->cid]\">$options</select><br />". ($comment->score ? $comment->score : "--") ." / $comment->votes";
$output .= "</div>";
$output .= "<select name=\"moderate[comment][$comment->cid]\">$options</select><br />". ($comment->score ? $comment->score : "--") ." / $comment->votes";
return $output;
}
......
......@@ -22,6 +22,9 @@
"Internet explorer, Netscape, Opera, Lynx"),
"Goofy" => array(
"themes/goofy/goofy.theme",
"Internet explorer, Netscape, Opera"),
"Trillian" => array(
"themes/trillian/trillian.theme",
"Internet explorer, Netscape, Opera"));
#
......
......@@ -9,42 +9,11 @@ function image($name) {
return "misc/$name";
}
function comment_controls($threshold = 1, $mode = 3, $order = 1) {
global $user, $id;
if ($user->uid) {
$output .= form_item(t("Node rating"), node_moderation($id) ." <input type=\"submit\" name=\"op\" value=\"". t("Update ratings") ."\" />", t("Nodes and comments can be moderated by assigning them a score: content with a high rating is made more visible."));
}
$output .= form_item(t("Comment viewing options"), comment_mode($mode) . comment_order($order) . comment_threshold($threshold) ." <input type=\"submit\" name=\"op\" value=\"". t("Update settings") ."\" />", t("Select your prefered way to display the comments and click 'Update settings' to active your changes."));
if (user_access("post comment")) {
$output .= form_item(t("Add a comment"), "<input type=\"submit\" name=\"op\" value=\"". t("Add comment") ."\" />", t("Click 'Add comment' to start a new thread in the discussion."));
}
return $output;
}
}
function theme_init() {
global $user, $themes;
if ($user->theme && file_exists($themes[$user->theme][0])) {
include_once $themes[$user->theme][0];
}
else {
include_once $themes[variable_get("theme_default", key($themes))][0];
}
return new Theme();
}
function theme_account($region, $theme) {
function user($region, $theme) {
global $user;
if ($user->uid) {
// Display account settings:
$content .= "<table><tr><td nowrap=\"nowrap\">\n";
foreach (module_list() as $name) {
if (module_hook($name, "link")) {
......@@ -54,12 +23,10 @@ function theme_account($region, $theme) {
}
if (user_access("access administration pages")) {
$content .= "<p />\n";
$content .= "<br />\n";
$content .= "<a href=\"admin.php\">". strtr(t("administer %a"), array("%a" => variable_get("site_name", "drupal"))) ."</a><BR>\n";
}
$content .= "</td></tr></table>\n";
$theme->box($user->name, $content, $region);
}
else {
......@@ -74,7 +41,48 @@ function theme_account($region, $theme) {
$theme->box(t("Log in"), $output, $region);
}
}
function comment_controls($threshold = 1, $mode = 3, $order = 1) {
global $user, $id;
if ($user->uid) {
$output .= form_item(t("Node rating"), node_moderation($id) ." <input type=\"submit\" name=\"op\" value=\"". t("Update ratings") ."\" />", t("Nodes and comments can be moderated by assigning them a score: content with a high rating is made more visible."));
}
$output .= form_item(t("Comment viewing options"), comment_mode($mode) . comment_order($order) . comment_threshold($threshold) ." <input type=\"submit\" name=\"op\" value=\"". t("Update settings") ."\" />", t("Select your prefered way to display the comments and click 'Update settings' to active your changes."));
if (user_access("post comment")) {
$output .= form_item(t("Add a comment"), "<input type=\"submit\" name=\"op\" value=\"". t("Add comment") ."\" />", t("Click 'Add comment' to start a new thread in the discussion."));
}
return $output;
}
function comment($comment, $link = 0) {
$output .= "<a name=\"$comment->cid\"></a>";
$output .= "<div style=\"border: 1px solid; padding: 10px;\">";
$output .= "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\">";
$output .= " <tr><td><div style=\"font-size: 110%; font-weight: bold;\">". check_output($comment->subject) ."</div></td><td align=\"right\" rowspan=\"2\" valign=\"top\">". comment_moderation($comment) ."</td></tr>";
$output .= " <tr><td><div style=\"margin-left: 10px; padding-bottom: 10px; font-size: 90%;\">". sprintf(t("by %s on %s"), format_name($comment), format_date($comment->timestamp)) ."</div></td></tr>";
$output .= " <tr><td colspan=\"2\">". check_output($comment->comment, 1) ."</td></tr>";
$output .= " <tr><td align=\"right\" colspan=\"2\">$link</td></tr>";
$output .= "</table>";
$output .= "</div><br />";
print $output;
}
}
function theme_init() {
global $user, $themes;
if ($user->theme && file_exists($themes[$user->theme][0])) {
include_once $themes[$user->theme][0];
}
else {
include_once $themes[variable_get("theme_default", key($themes))][0];
}
return new Theme();
}
function theme_blocks($region, $theme) {
......
......@@ -169,7 +169,7 @@ function footer() {
global $PHP_SELF;
theme_account("right", $this);
$this->user("right", $this);
theme_blocks("right", $this);
?>
......
......@@ -139,7 +139,7 @@ function footer() {
</td>
<td valign="top">
<?php
theme_account("all", $this);
$this->user("all", $this);
theme_blocks("all", $this);
?>
</td>
......
......@@ -140,7 +140,7 @@ function footer() {
</td>
<td valign="top" width="200">
<?php
theme_account("all", $this);
$this->user("all", $this);
theme_blocks("all", $this);
?>
</td>
......
......@@ -43,10 +43,9 @@ function node($node, $main = 0) {
if ($date != date("dny", $node->timestamp)) {
$date = date("dny", $node->timestamp);
print "<br />";
print "<table width=\"100%\" cellspacing=\"1\" cellpadding=\"0\" border=\"0\">";
print "<tr><td align=\"left\"> &nbsp; <div style=\"font-weight: bold;\">". format_date($node->timestamp, "custom", "l, F d, Y") ."</div></td><td align=\"right\"><img src=\"themes/trillian/images/icon.gif\" alt=\"\" /></td><tr>";
print " <tr valign=\"bottom\"><td colspan=\"2\" bgcolor=\"#000000\" width=\"100%\"><spacer type=\"block\" height=\"100\" /></td></tr>\n";
print " <tr valign=\"bottom\"><td colspan=\"2\" bgcolor=\"green\" width=\"100%\"><spacer type=\"block\" height=\"100\" /></td></tr>\n";
print "</table>";
print "<br />";
}
......
......@@ -190,7 +190,7 @@ function footer() {
</TD>
<TD VALIGN="top" WIDTH="20%">
<?php
theme_account("all", $this);
$this->user("all", $this);
theme_blocks("all", $this);
?>
</TD>
......
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