From 562df8fe43f8794317c974dae463f5470cfdc497 Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Sat, 9 Nov 2002 13:59:36 +0000 Subject: * Added Jeremy's pager: "This is a simple, generic pager for Drupal-CVS. It is designed to be easily themeable and expandable. The code is highly-commented to enhance readability." "Pagers are constructed by combining the provided pieces (all of which can be easily modified to display the text or image you prefer) into your custom pager." * Statistics module fixes by Jeremy: - removed superfluous check for existence of watchdog() - saving changes in admin page displays status and returns same page - no longer return 1971/01/01 in "view statistics" table - switched from "!=" to "<>" in SQL queries for ANSI-SQL compliance - switched from "MAX(timestamp) as timestamp" to "MAX(timestamp) as max_timestamp" moving towards ANSI-SQL compliance. * Added a "theme_item_list" function to format itemized lists. Also changed a couple of modules to take advantage of it. Makes for a more consistent UI. --- modules/forum.module | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'modules/forum.module') diff --git a/modules/forum.module b/modules/forum.module index f7a78c7d2..81308d5dd 100644 --- a/modules/forum.module +++ b/modules/forum.module @@ -96,18 +96,21 @@ function forum_block($op = "list", $delta = 0) { } if (!$content) { - $content = "". t("Active forum topics:") ."
"; + unset($items); $result = db_query("SELECT n.nid, n.title, n.body, GREATEST(n.created, MAX(c.timestamp)) AS sort FROM node n, forum f LEFT JOIN comments c ON c.nid = n.nid WHERE n.type = 'forum' AND n.nid = f.nid AND f.shadow = 0 AND n.status = 1 GROUP BY n.nid ORDER BY sort DESC LIMIT ". variable_get("forum_block_num", "5")); while ($node = db_fetch_object($result)) { - $content .= "- ". l(check_output($node->title), array("id" => $node->nid), "node", "", array("title" => substr(strip_tags($node->body), 0, 100)."...")) ."
"; + $items[] = l(check_output($node->title), array("id" => $node->nid), "node", "", array("title" => substr(strip_tags($node->body), 0, 100)."...")); } + $content .= theme_invoke("theme_item_list", $items, t("Active forum topics:")); $content .= "
"; - $content .= "". t("New forum topics:") ."
"; + + unset ($items); $result = db_query("SELECT n.nid, n.title, n.body FROM node n LEFT JOIN forum f ON n.nid = f.nid WHERE n.type = 'forum' ORDER BY n.nid DESC LIMIT ". variable_get("forum_block_num", "5")); while ($node = db_fetch_object($result)) { - $content .= "- ". l(check_output($node->title), array("id" => $node->nid), "node", "", array("title" => substr(strip_tags($node->body), 0, 100)."...")) ."
"; + $items[] = l(check_output($node->title), array("id" => $node->nid), "node", "", array("title" => substr(strip_tags($node->body), 0, 100)."...")); } + $content .= theme_invoke("theme_item_list", $items, t("New forum topics:")); if ($content) { $content .= "
". lm(t("more"), array("mod" => "forum")) ."
"; @@ -182,7 +185,7 @@ function forum_view($node, $main = 0) { $voc = taxonomy_get_vocabulary($term_data->vid); /* TODO: find out what this code was ment to do and either use it or not. - + $output .= "

"._forum_get_icon($node)." ".lm(check_output($voc->name), array("mod" => "forum"))." : ".lm(check_output($term_data->name), array("mod" => "forum", "tid" => $term_data->tid)); $output .= " / ". check_output($node->title) ."
".t("%a by %b", array("%a" => format_date($node->created), "%b" => format_name($node)))."

". check_output($node->body, 1) ."

"; -- cgit v1.2.3