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,6 +9,40 @@ function image($name) {
return "misc/$name";
}
function user($region, $theme) {
global $user;
if ($user->uid) {
// Display account settings:
foreach (module_list() as $name) {
if (module_hook($name, "link")) {
$links = module_invoke($name, "link", "menu");
foreach ($links as $link) $content .= "$link<br />\n";
}
}
if (user_access("access administration pages")) {
$content .= "<br />\n";
$content .= "<a href=\"admin.php\">". strtr(t("administer %a"), array("%a" => variable_get("site_name", "drupal"))) ."</a><BR>\n";
}
$theme->box($user->name, $content, $region);
}
else {
$output .= "<div align=\"center\">\n";
$output .= " <form action=\"module.php?mod=user&op=login\" method=\"post\">\n";
$output .= " <b>". t("Username") .":</b><br /><input name=\"edit[name]\" size=\"15\"><p />\n";
$output .= " <b>". t("Password") .":</b><br /><input name=\"edit[pass]\" size=\"15\" TYPE=\"password\"><br />\n";
$output .= " <input type=\"submit\" value=\"". t("Log in") ."\"><br />\n";
if (variable_get("account_register", 1)) $output .= " <a href=\"module.php?mod=user\">". t("REGISTER") ."</a>\n";
$output .= " </form>\n";
$output .= "</div>\n";
$theme->box(t("Log in"), $output, $region);
}
}
function comment_controls($threshold = 1, $mode = 3, $order = 1) {
global $user, $id;
......@@ -25,6 +59,18 @@ function comment_controls($threshold = 1, $mode = 3, $order = 1) {
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() {
......@@ -39,44 +85,6 @@ function theme_init() {
return new Theme();
}
function theme_account($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")) {
$links = module_invoke($name, "link", "menu");
foreach ($links as $link) $content .= "$link<br />\n";
}
}
if (user_access("access administration pages")) {
$content .= "<p />\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 {
$output .= "<div align=\"center\">\n";
$output .= " <form action=\"module.php?mod=user&op=login\" method=\"post\">\n";
$output .= " <b>". t("Username") .":</b><br /><input name=\"edit[name]\" size=\"15\"><p />\n";
$output .= " <b>". t("Password") .":</b><br /><input name=\"edit[pass]\" size=\"15\" TYPE=\"password\"><br />\n";
$output .= " <input type=\"submit\" value=\"". t("Log in") ."\"><br />\n";
if (variable_get("account_register", 1)) $output .= " <a href=\"module.php?mod=user\">". t("REGISTER") ."</a>\n";
$output .= " </form>\n";
$output .= "</div>\n";
$theme->box(t("Log in"), $output, $region);
}
}
function theme_blocks($region, $theme) {
global $id, $PHP_SELF, $user;
......
......@@ -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