summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorKjartan Mannes <kjartan@2.no-reply.drupal.org>2002-11-08 13:23:29 +0000
committerKjartan Mannes <kjartan@2.no-reply.drupal.org>2002-11-08 13:23:29 +0000
commit756639bc4b4e3bc0ff912ae7c1adad91c4c81878 (patch)
treeb8073b786954e060284dbeb598463d7a02b12204 /modules
parentb3abbc4b544cd8b3369924261dae948c1f860246 (diff)
downloadbrdo-756639bc4b4e3bc0ff912ae7c1adad91c4c81878.tar.gz
brdo-756639bc4b4e3bc0ff912ae7c1adad91c4c81878.tar.bz2
- removed next/prev links when forum node is shown on main page.
- title is no longer modified when shown on main page. - commented out a chunk of code in forum_view that is no in use. - coding sytle fixes.
Diffstat (limited to 'modules')
-rw-r--r--modules/forum.module25
-rw-r--r--modules/forum/forum.module25
2 files changed, 34 insertions, 16 deletions
diff --git a/modules/forum.module b/modules/forum.module
index 02619f6fe..f7a78c7d2 100644
--- a/modules/forum.module
+++ b/modules/forum.module
@@ -30,7 +30,7 @@ function forum_conf_options() {
foreach (taxonomy_get_vocabularies("forum") as $vid => $voc) {
$vocs[$vid] = $voc->name;
}
- $output .= "<a name=\"image_nav_vocabulary\"></a>";
+ $output = "<a name=\"image_nav_vocabulary\"></a>";
$output .= form_select("Forum vocabulary", "forum_nav_vocabulary", variable_get("forum_nav_vocabulary", ""), $vocs, t("The taxonomy vocabulary that will be used as the navigation tree."));
$output .= _taxonomy_term_select("Containers", "forum_containers", variable_get("forum_containers", array()), variable_get("forum_nav_vocabulary", ""), t("You can choose forums which will not have topics, but will be just containers for other forums."), 1, t("<none>"));
@@ -124,7 +124,7 @@ function forum_block($op = "list", $delta = 0) {
return $blocks;
}
-function forum_link($type, $node) {
+function forum_link($type, $node = 0, $main = 0) {
if ($type == "page" && user_access("access content")) {
$links[] = lm(t("forum"), array("mod" => "forum"));
}
@@ -134,7 +134,7 @@ function forum_link($type, $node) {
#$links[] = lm(t("create forum topic"), array("mod" => "node", "op" => "add", "type" => "forum"), "", array("title" => t("Start a new forum topic.")));
}
- if ($type == "node" && $node->type == "forum") {
+ if (!$main && $type == "node" && $node->type == "forum") {
// get previous and next topic
$sql = "SELECT n.nid, title, body, GREATEST(n.created, MAX(c.timestamp)) AS date_sort, COUNT(c.nid) AS num_comments FROM node n, term_node t, forum f LEFT JOIN comments c ON c.nid = n.nid WHERE n.nid = t.nid AND n.nid = f.nid AND t.tid = '%d' AND f.shadow = 0 AND n.status = 1 GROUP BY n.nid ORDER BY ". _forum_get_topic_order(isset($user->sortby) ? $user->sortby : variable_get("forum_order",1));
@@ -181,14 +181,19 @@ 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 .= "<p>"._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 .= " / <b>". check_output($node->title) ."</b><br>".t("%a by %b", array("%a" => format_date($node->created), "%b" => format_name($node)))."</p><p>". check_output($node->body, 1) ."</p>";
$output .= "<p>". $theme->links(link_node($node, $main)) ."</p>";
#$theme->box(t("Discussion forum"), $output);
+ */
- $node->title = _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)) . " / <b>". check_output($node->title) ."</b>";
+ if (!$main) {
+ $node->title = _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)) . " / <b>". check_output($node->title) ."</b>";
+ }
$theme->node($node, $main);
}
@@ -198,14 +203,16 @@ function forum_form(&$node, &$help, &$error) {
if ($node->nid) {
if ($node->taxonomy) {
$tid = $node->taxonomy;
- } else {
+ }
+ else {
// editing: load category from taxonomy
$tid = implode(",", array_keys(taxonomy_node_get_terms($node->nid)));
}
//$output .= implode("<p>", taxonomy_node_form("forum", $node));
$output .= "<input type=\"hidden\" name=\"edit[old_container]\" value=\"".implode(",", array_keys(taxonomy_node_get_terms($node->nid)))."\">";
$output .= form_checkbox(t("Leave shadow?"), "shadow", 1, 1, t("If you move this topic, you can leave a link in the old forum to the new forum."));
- } else {
+ }
+ else {
if ($node->taxonomy) {
$tid = $node->taxonomy;
}
@@ -250,7 +257,8 @@ function forum_insert($node) {
$node->icon = _forum_decode_icon($node);
if (!$node->shadow) {
db_query("INSERT INTO forum (nid, icon) VALUES ('%d', '%s')", $node->nid, $node->icon);
- } else {
+ }
+ else {
// we created a shadow, a link to a moved topic in a new forum
db_query("INSERT INTO forum (nid, icon, shadow) VALUES ('%d', '%s', '%d')", $node->nid, $node->icon, $node->shadow);
}
@@ -556,7 +564,8 @@ function forum_forum_list($forums, $parents, $tid) {
foreach ($forums as $forum) {
if ($forum->container) {
$output .= " <tr><td colspan=\"5\">". lm(check_output($forum->name), array("mod" => "forum", "tid" => $forum->tid))."<br /><small>". ($forum->description ? check_output($forum->description, 1) : "") ."</small></td></tr>";
- } else {
+ }
+ else {
if ($user->uid) $new_topics = $forum->num_topics - $forum->old_topics;
$icon = _forum_get_folder_icon($new_topics);
$output .= " <tr><td>&nbsp;</td><td>$icon</td>";
diff --git a/modules/forum/forum.module b/modules/forum/forum.module
index 02619f6fe..f7a78c7d2 100644
--- a/modules/forum/forum.module
+++ b/modules/forum/forum.module
@@ -30,7 +30,7 @@ function forum_conf_options() {
foreach (taxonomy_get_vocabularies("forum") as $vid => $voc) {
$vocs[$vid] = $voc->name;
}
- $output .= "<a name=\"image_nav_vocabulary\"></a>";
+ $output = "<a name=\"image_nav_vocabulary\"></a>";
$output .= form_select("Forum vocabulary", "forum_nav_vocabulary", variable_get("forum_nav_vocabulary", ""), $vocs, t("The taxonomy vocabulary that will be used as the navigation tree."));
$output .= _taxonomy_term_select("Containers", "forum_containers", variable_get("forum_containers", array()), variable_get("forum_nav_vocabulary", ""), t("You can choose forums which will not have topics, but will be just containers for other forums."), 1, t("<none>"));
@@ -124,7 +124,7 @@ function forum_block($op = "list", $delta = 0) {
return $blocks;
}
-function forum_link($type, $node) {
+function forum_link($type, $node = 0, $main = 0) {
if ($type == "page" && user_access("access content")) {
$links[] = lm(t("forum"), array("mod" => "forum"));
}
@@ -134,7 +134,7 @@ function forum_link($type, $node) {
#$links[] = lm(t("create forum topic"), array("mod" => "node", "op" => "add", "type" => "forum"), "", array("title" => t("Start a new forum topic.")));
}
- if ($type == "node" && $node->type == "forum") {
+ if (!$main && $type == "node" && $node->type == "forum") {
// get previous and next topic
$sql = "SELECT n.nid, title, body, GREATEST(n.created, MAX(c.timestamp)) AS date_sort, COUNT(c.nid) AS num_comments FROM node n, term_node t, forum f LEFT JOIN comments c ON c.nid = n.nid WHERE n.nid = t.nid AND n.nid = f.nid AND t.tid = '%d' AND f.shadow = 0 AND n.status = 1 GROUP BY n.nid ORDER BY ". _forum_get_topic_order(isset($user->sortby) ? $user->sortby : variable_get("forum_order",1));
@@ -181,14 +181,19 @@ 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 .= "<p>"._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 .= " / <b>". check_output($node->title) ."</b><br>".t("%a by %b", array("%a" => format_date($node->created), "%b" => format_name($node)))."</p><p>". check_output($node->body, 1) ."</p>";
$output .= "<p>". $theme->links(link_node($node, $main)) ."</p>";
#$theme->box(t("Discussion forum"), $output);
+ */
- $node->title = _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)) . " / <b>". check_output($node->title) ."</b>";
+ if (!$main) {
+ $node->title = _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)) . " / <b>". check_output($node->title) ."</b>";
+ }
$theme->node($node, $main);
}
@@ -198,14 +203,16 @@ function forum_form(&$node, &$help, &$error) {
if ($node->nid) {
if ($node->taxonomy) {
$tid = $node->taxonomy;
- } else {
+ }
+ else {
// editing: load category from taxonomy
$tid = implode(",", array_keys(taxonomy_node_get_terms($node->nid)));
}
//$output .= implode("<p>", taxonomy_node_form("forum", $node));
$output .= "<input type=\"hidden\" name=\"edit[old_container]\" value=\"".implode(",", array_keys(taxonomy_node_get_terms($node->nid)))."\">";
$output .= form_checkbox(t("Leave shadow?"), "shadow", 1, 1, t("If you move this topic, you can leave a link in the old forum to the new forum."));
- } else {
+ }
+ else {
if ($node->taxonomy) {
$tid = $node->taxonomy;
}
@@ -250,7 +257,8 @@ function forum_insert($node) {
$node->icon = _forum_decode_icon($node);
if (!$node->shadow) {
db_query("INSERT INTO forum (nid, icon) VALUES ('%d', '%s')", $node->nid, $node->icon);
- } else {
+ }
+ else {
// we created a shadow, a link to a moved topic in a new forum
db_query("INSERT INTO forum (nid, icon, shadow) VALUES ('%d', '%s', '%d')", $node->nid, $node->icon, $node->shadow);
}
@@ -556,7 +564,8 @@ function forum_forum_list($forums, $parents, $tid) {
foreach ($forums as $forum) {
if ($forum->container) {
$output .= " <tr><td colspan=\"5\">". lm(check_output($forum->name), array("mod" => "forum", "tid" => $forum->tid))."<br /><small>". ($forum->description ? check_output($forum->description, 1) : "") ."</small></td></tr>";
- } else {
+ }
+ else {
if ($user->uid) $new_topics = $forum->num_topics - $forum->old_topics;
$icon = _forum_get_folder_icon($new_topics);
$output .= " <tr><td>&nbsp;</td><td>$icon</td>";