From a5b0525afd997ebfc4fbdc5c071c13b53f1e3bfe Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Wed, 21 Jan 2004 18:34:18 +0000 Subject: - Forum module improvements. --- modules/forum.module | 60 ++++++++++++++++++++++++++++------------------------ 1 file changed, 32 insertions(+), 28 deletions(-) (limited to 'modules/forum.module') diff --git a/modules/forum.module b/modules/forum.module index d5aa94832..8a41b4f91 100644 --- a/modules/forum.module +++ b/modules/forum.module @@ -232,7 +232,7 @@ function _forum_last_reply($nid) { function _forum_format($topic) { if ($topic) { - return t("%date
by %author", array("%date" => format_date($topic->timestamp, "small"), "%author" => format_name($topic))); + return t("%time ago
by %author", array("%time" => format_interval(time() - $topic->timestamp), "%author" => format_name($topic))); } else { return message_na(); @@ -517,47 +517,51 @@ function theme_forum_list($forums, $parents, $tid) { foreach ($forums as $forum) { if ($forum->container) { - $forum->num_topics = ""; - $forum->num_posts = ""; - $forum->last_post = ""; - $new_topics = 0; - $links = array(); + $description = "
depth * 30) ."px;\">\n"; + $description .= "
". l($forum->name, "forum/$forum->tid") ."
\n"; + + if ($forum->description) { + $description .= "
$forum->description
\n"; + } + $description .= "
\n"; + + $rows[] = array(array("data" => $description, "class" => "container", "colspan" => 4)); } else { if ($user->uid) { $new_topics = $forum->num_topics - $forum->old_topics; } + else { + $new_topics = 0; + } $links = array(); - if ($forum->last_post) { - $links[] = l(t("the most recent topic"), "node/view/". $forum->last_post->nid); - } - if ($new_topics) { - $links[] = l(t("the first new topic"), "forum/$forum->tid/new"); + $links[] = l(t("newest topic"), "forum/$forum->tid/new"); } - } - $description = "
depth * 30) ."px;\">\n"; - $description .= "
". l($forum->name, "forum/$forum->tid") ."
\n"; - - if ($forum->description) { - $description .= "
$forum->description
\n"; - } - if ($links) { - $description .= "
". t("Jump to: %links", array("%links" => implode(", ", $links))) .".
\n"; - } - $description .= "
\n"; + if ($forum->last_post) { + $links[] = l(t("active topic"), "node/view/". $forum->last_post->nid); + } - $rows[] = array( - array("data" => $description, "class" => "description"), - array("data" => $forum->num_topics . ($new_topics ? "
(". t("%a new", array("%a" => $new_topics)) .")" : ""), "class" => "topics"), - array("data" => $forum->num_posts, "class" => "posts"), - array("data" => ($forum->container ? "" : _forum_format($forum->last_post)), "class" => "last-reply") + $description = "
depth * 30) ."px;\">\n"; + $description .= "
". l($forum->name, "forum/$forum->tid") ."
\n"; - ); + if ($forum->description) { + $description .= "
$forum->description
\n"; + } + if ($links) { + $description .= "
". t("Jump to: %links", array("%links" => implode(", ", $links))) .".
\n"; + } + $description .= "
\n"; + $rows[] = array( + array("data" => $description, "class" => "forum"), + array("data" => $forum->num_topics . ($new_topics ? "
(". t("%a new", array("%a" => $new_topics)) .")" : ""), "class" => "topics"), + array("data" => $forum->num_posts, "class" => "posts"), + array("data" => _forum_format($forum->last_post), "class" => "last-reply")); + } } } -- cgit v1.2.3