diff options
author | Dries Buytaert <dries@buytaert.net> | 2001-04-16 18:21:22 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2001-04-16 18:21:22 +0000 |
commit | b1c66cb5de4b37a5292c6901628b5b0697e8a459 (patch) | |
tree | a579df0abc46247f5261453a3e9c642c72137dda /modules | |
parent | 2f898ebcff1d5a1125fa46aa85f0e2def1c650f4 (diff) | |
download | brdo-b1c66cb5de4b37a5292c6901628b5b0697e8a459.tar.gz brdo-b1c66cb5de4b37a5292c6901628b5b0697e8a459.tar.bz2 |
Another big update so please read this carefully because there is important information hidden in it.
Made it so that we can disable/enable comments on a category by category basis. In order to accomplish this I had to make a few (*temporary*) changes.
I moved all comment code from the "module level" (eg. story.module) to the "node level". It was nothing but the logical next step in nodifying drupal. This enables us to add comments to all existing content types including book entries. But also for book entries, this to can be toggled on and off. :-)
Moreover module writers don't have to worry about the complex comment logic: it is "abstracted" away. This implies that story.module got smaller, faster and easier to comprehend. :-)
In order to accomplish this, I had to update ALL THEMES, which I did - and on my way I updated Goofy, Oranzh and UnConeD - with the previous changes. All themes are up-to-date now! I also had to remove the [ reply to this story ] links, and temporally re-introcuded the "Add comment" button in the "Comment control". Tempora lly that is, UnConeD. ;)
I plan to upgrade drop.org either tommorow or wednesday so test away if you have some time to kill. ;)
Oh, I also fixed a few bugs and made various small improvements.
Diffstat (limited to 'modules')
-rw-r--r-- | modules/book.module | 12 | ||||
-rw-r--r-- | modules/book/book.module | 12 | ||||
-rw-r--r-- | modules/moderation.module | 2 | ||||
-rw-r--r-- | modules/node.module | 6 | ||||
-rw-r--r-- | modules/node/node.module | 6 | ||||
-rw-r--r-- | modules/page.module | 2 | ||||
-rw-r--r-- | modules/page/page.module | 2 | ||||
-rw-r--r-- | modules/story.module | 58 | ||||
-rw-r--r-- | modules/story/story.module | 58 | ||||
-rw-r--r-- | modules/structure.module | 2 |
10 files changed, 30 insertions, 130 deletions
diff --git a/modules/book.module b/modules/book.module index 1924072ec..1f483b94c 100644 --- a/modules/book.module +++ b/modules/book.module @@ -36,7 +36,7 @@ function book_type() { return array("book", t("book page")); } -function book_view($node, $page = 1) { +function book_view($node, $main = 0) { global $theme; if ($node->nid && $node->parent) { @@ -67,9 +67,7 @@ function book_view($node, $page = 1) { $output .= " <TR><TD ALIGN=\"left\" WIDTH=\"33%\">". ($prev ? "<SMALL>". check_output($prev->title) ."</SMALL>" : " ") ."</TD><TD ALIGN=\"center\" WIDTH=\"34%\">". ($node->parent ? "<A HREF=\"node.php?id=$node->parent\">". t("up") ."</A>" : t("up")) ."</TD><TD ALIGN=\"right\" WIDTH=\"33%\">". ($next ? "<SMALL>". check_output($next->title) ."</SMALL>" : " ") ."</TD></TR>\n"; $output .= "</TABLE>\n"; - if ($page) $theme->header(); - $theme->box(t("Book"), $output); - if ($page) $theme->footer(); + $theme->box(t("Handbook"), $output); } function book_find($keys) { @@ -211,7 +209,7 @@ function book_admin() { print book_tree(); break; case t("Preview"): - book_view(new Book(($edit[nid] ? $edit[nid] : -1), ($edit[userid] ? $edit[userid] : $user->userid), $edit[title], $edit[body], $edit[parent], $edit[weight], ($edit[timestamp] ? $edit[timestamp] : time())), 0); + book_view(new Book(($edit[nid] ? $edit[nid] : -1), ($edit[userid] ? $edit[userid] : $user->userid), $edit[title], $edit[body], $edit[parent], $edit[weight], ($edit[timestamp] ? $edit[timestamp] : time()))); print book_form($edit); break; case t("Submit"): @@ -232,7 +230,7 @@ function book_page() { } $theme->header(); - $theme->box(t("Book"), "<DL>$output</DL>"); + $theme->box(t("Handbook"), "<DL>$output</DL>"); $theme->footer(); } @@ -262,7 +260,7 @@ function book_user() { $theme->box($title, book_update($id)); break; case t("Preview"): - book_view(new Book(($edit[nid] ? $edit[nid] : -1), $user->userid, $edit[title], $edit[body], $edit[parent], $edit[weight], ($edit[timestamp] ? $edit[timestamp] : time())), 0); + book_view(new Book(($edit[nid] ? $edit[nid] : -1), $user->userid, $edit[title], $edit[body], $edit[parent], $edit[weight], ($edit[timestamp] ? $edit[timestamp] : time()))); $theme->box($title, book_form($edit)); break; case t("Submit"): diff --git a/modules/book/book.module b/modules/book/book.module index 1924072ec..1f483b94c 100644 --- a/modules/book/book.module +++ b/modules/book/book.module @@ -36,7 +36,7 @@ function book_type() { return array("book", t("book page")); } -function book_view($node, $page = 1) { +function book_view($node, $main = 0) { global $theme; if ($node->nid && $node->parent) { @@ -67,9 +67,7 @@ function book_view($node, $page = 1) { $output .= " <TR><TD ALIGN=\"left\" WIDTH=\"33%\">". ($prev ? "<SMALL>". check_output($prev->title) ."</SMALL>" : " ") ."</TD><TD ALIGN=\"center\" WIDTH=\"34%\">". ($node->parent ? "<A HREF=\"node.php?id=$node->parent\">". t("up") ."</A>" : t("up")) ."</TD><TD ALIGN=\"right\" WIDTH=\"33%\">". ($next ? "<SMALL>". check_output($next->title) ."</SMALL>" : " ") ."</TD></TR>\n"; $output .= "</TABLE>\n"; - if ($page) $theme->header(); - $theme->box(t("Book"), $output); - if ($page) $theme->footer(); + $theme->box(t("Handbook"), $output); } function book_find($keys) { @@ -211,7 +209,7 @@ function book_admin() { print book_tree(); break; case t("Preview"): - book_view(new Book(($edit[nid] ? $edit[nid] : -1), ($edit[userid] ? $edit[userid] : $user->userid), $edit[title], $edit[body], $edit[parent], $edit[weight], ($edit[timestamp] ? $edit[timestamp] : time())), 0); + book_view(new Book(($edit[nid] ? $edit[nid] : -1), ($edit[userid] ? $edit[userid] : $user->userid), $edit[title], $edit[body], $edit[parent], $edit[weight], ($edit[timestamp] ? $edit[timestamp] : time()))); print book_form($edit); break; case t("Submit"): @@ -232,7 +230,7 @@ function book_page() { } $theme->header(); - $theme->box(t("Book"), "<DL>$output</DL>"); + $theme->box(t("Handbook"), "<DL>$output</DL>"); $theme->footer(); } @@ -262,7 +260,7 @@ function book_user() { $theme->box($title, book_update($id)); break; case t("Preview"): - book_view(new Book(($edit[nid] ? $edit[nid] : -1), $user->userid, $edit[title], $edit[body], $edit[parent], $edit[weight], ($edit[timestamp] ? $edit[timestamp] : time())), 0); + book_view(new Book(($edit[nid] ? $edit[nid] : -1), $user->userid, $edit[title], $edit[body], $edit[parent], $edit[weight], ($edit[timestamp] ? $edit[timestamp] : time()))); $theme->box($title, book_form($edit)); break; case t("Submit"): diff --git a/modules/moderation.module b/modules/moderation.module index 75a6df1b8..4c447d282 100644 --- a/modules/moderation.module +++ b/modules/moderation.module @@ -99,7 +99,7 @@ function moderation_node($id) { $output .= "</FORM>\n"; $theme->header(); - node_view($node, 0); + node_view($node); $theme->box(t("Moderate"), $output); $theme->footer(); } diff --git a/modules/node.module b/modules/node.module index 4c12ba5a7..7d0a5b3a5 100644 --- a/modules/node.module +++ b/modules/node.module @@ -5,13 +5,13 @@ $module = array("admin" => "node_admin"); function node_overview($query = array()) { global $user, $rstatus; - $result = db_query("SELECT n.*, u.userid FROM node n LEFT JOIN users u ON n.author = u.id $query[1] LIMIT 50"); + $result = db_query("SELECT n.*, u.userid, c.name AS category FROM node n LEFT JOIN users u ON n.author = u.id LEFT JOIN category c ON n.cid = c.cid $query[1] LIMIT 50"); $output .= status($query[0]); $output .= "<TABLE BORDER=\"1\" CELLPADDING=\"2\" CELLSPACING=\"2\">\n"; - $output .= " <TR><TH>title</TH><TH>type</TH><TH>status</TH><TH>author</TH><TH>date</TH><TH COLSPAN=\"3\">operations</TH></TR>\n"; + $output .= " <TR><TH>title</TH><TH>category</TH><TH>status</TH><TH>author</TH><TH>date</TH><TH COLSPAN=\"3\">operations</TH></TR>\n"; while ($node = db_fetch_object($result)) { - $output .= " <TR><TD><A HREF=\"node.php?id=$node->nid\">". check_output($node->title) ."</A></TD><TD ALIGN=\"center\">$node->type</TD><TD>". $rstatus[$node->status] ."</TD><TD>". format_username($node->userid) ."</TD><TD>". format_date($node->timestamp, "small") ."</TD><TD>". (user_access($user, "node") ? "<A HREF=\"admin.php?mod=node&op=view&id=$node->nid\">view node</A></TD>" : "view node") ."</TD><TD>". (user_access($user, "node") ? "<A HREF=\"admin.php?mod=node&op=edit&id=$node->nid\">edit node</A></TD>" : "edit node") ."</TD><TD>". (user_access($user, $node->type) ? "<A HREF=\"admin.php?mod=$node->type&op=edit&id=$node->nid\">edit $node->type</A></TD>" : "edit $node->type") ."</TD></TR>\n"; + $output .= " <TR><TD><A HREF=\"node.php?id=$node->nid\">". check_output($node->title) ."</A></TD><TD ALIGN=\"center\">". check_output($node->category ? $node->category : $node->type) ."</TD><TD>". $rstatus[$node->status] ."</TD><TD>". format_username($node->userid) ."</TD><TD>". format_date($node->timestamp, "small") ."</TD><TD>". (user_access($user, "node") ? "<A HREF=\"admin.php?mod=node&op=view&id=$node->nid\">view node</A></TD>" : "view node") ."</TD><TD>". (user_access($user, "node") ? "<A HREF=\"admin.php?mod=node&op=edit&id=$node->nid\">edit node</A></TD>" : "edit node") ."</TD><TD>". (user_access($user, $node->type) ? "<A HREF=\"admin.php?mod=$node->type&op=edit&id=$node->nid\">edit $node->type</A></TD>" : "edit $node->type") ."</TD></TR>\n"; } $output .= "</TABLE>\n"; diff --git a/modules/node/node.module b/modules/node/node.module index 4c12ba5a7..7d0a5b3a5 100644 --- a/modules/node/node.module +++ b/modules/node/node.module @@ -5,13 +5,13 @@ $module = array("admin" => "node_admin"); function node_overview($query = array()) { global $user, $rstatus; - $result = db_query("SELECT n.*, u.userid FROM node n LEFT JOIN users u ON n.author = u.id $query[1] LIMIT 50"); + $result = db_query("SELECT n.*, u.userid, c.name AS category FROM node n LEFT JOIN users u ON n.author = u.id LEFT JOIN category c ON n.cid = c.cid $query[1] LIMIT 50"); $output .= status($query[0]); $output .= "<TABLE BORDER=\"1\" CELLPADDING=\"2\" CELLSPACING=\"2\">\n"; - $output .= " <TR><TH>title</TH><TH>type</TH><TH>status</TH><TH>author</TH><TH>date</TH><TH COLSPAN=\"3\">operations</TH></TR>\n"; + $output .= " <TR><TH>title</TH><TH>category</TH><TH>status</TH><TH>author</TH><TH>date</TH><TH COLSPAN=\"3\">operations</TH></TR>\n"; while ($node = db_fetch_object($result)) { - $output .= " <TR><TD><A HREF=\"node.php?id=$node->nid\">". check_output($node->title) ."</A></TD><TD ALIGN=\"center\">$node->type</TD><TD>". $rstatus[$node->status] ."</TD><TD>". format_username($node->userid) ."</TD><TD>". format_date($node->timestamp, "small") ."</TD><TD>". (user_access($user, "node") ? "<A HREF=\"admin.php?mod=node&op=view&id=$node->nid\">view node</A></TD>" : "view node") ."</TD><TD>". (user_access($user, "node") ? "<A HREF=\"admin.php?mod=node&op=edit&id=$node->nid\">edit node</A></TD>" : "edit node") ."</TD><TD>". (user_access($user, $node->type) ? "<A HREF=\"admin.php?mod=$node->type&op=edit&id=$node->nid\">edit $node->type</A></TD>" : "edit $node->type") ."</TD></TR>\n"; + $output .= " <TR><TD><A HREF=\"node.php?id=$node->nid\">". check_output($node->title) ."</A></TD><TD ALIGN=\"center\">". check_output($node->category ? $node->category : $node->type) ."</TD><TD>". $rstatus[$node->status] ."</TD><TD>". format_username($node->userid) ."</TD><TD>". format_date($node->timestamp, "small") ."</TD><TD>". (user_access($user, "node") ? "<A HREF=\"admin.php?mod=node&op=view&id=$node->nid\">view node</A></TD>" : "view node") ."</TD><TD>". (user_access($user, "node") ? "<A HREF=\"admin.php?mod=node&op=edit&id=$node->nid\">edit node</A></TD>" : "edit node") ."</TD><TD>". (user_access($user, $node->type) ? "<A HREF=\"admin.php?mod=$node->type&op=edit&id=$node->nid\">edit $node->type</A></TD>" : "edit $node->type") ."</TD></TR>\n"; } $output .= "</TABLE>\n"; diff --git a/modules/page.module b/modules/page.module index 08d5c6946..b5d0f86cf 100644 --- a/modules/page.module +++ b/modules/page.module @@ -10,7 +10,7 @@ function page_type() { return array("page", "static page"); } -function page_view($node) { +function page_view($node, $main = 0) { global $format, $theme; switch ($format[$node->format]) { diff --git a/modules/page/page.module b/modules/page/page.module index 08d5c6946..b5d0f86cf 100644 --- a/modules/page/page.module +++ b/modules/page/page.module @@ -10,7 +10,7 @@ function page_type() { return array("page", "static page"); } -function page_view($node) { +function page_view($node, $main = 0) { global $format, $theme; switch ($format[$node->format]) { diff --git a/modules/story.module b/modules/story.module index feb65cc32..484574d35 100644 --- a/modules/story.module +++ b/modules/story.module @@ -47,57 +47,9 @@ function story_type() { return array("story", t("story")); } -function story_view($node, $page = 1) { - global $id, $cid, $op, $moderate, $pid, $subject, $comment, $theme, $mode, $order, $threshold, $PHP_SELF; - - if ($page == 1) { - switch($op) { - case t("Preview comment"): - $theme->header(); - comment_preview(check_input($pid), check_input($id), $subject, $comment); - $theme->footer(); - break; - case t("Post comment"): - comment_post(check_input($pid), check_input($id), check_input($subject), check_input($comment)); - $theme->header(); - $theme->story($node, "[ <A HREF=\"node.php?op=reply&id=$node->nid&pid=0\">". t("reply to this story") ."</A> ]"); - comment_render($id, $cid); - $theme->footer(); - break; - case "reply": - $theme->header(); - comment_reply(check_input($pid), check_input($id)); - $theme->footer(); - break; - case t("Update settings"): - comment_settings(check_input($mode), check_input($order), check_input($threshold)); - $theme->header(); - $theme->story($node, "[ <A HREF=\"node.php?op=reply&id=$node->nid&pid=0\">". t("reply to this story") ."</A> ]"); - comment_render($id, $cid); - $theme->footer(); - break; - case t("Moderate comments"): - comment_moderate($moderate); - $theme->header(); - $theme->story($node, "[ <A HREF=\"node.php?op=reply&id=$node->nid&pid=0\">". t("reply to this story") ."</A> ]"); - comment_render($id, $cid); - $theme->footer(); - break; - case "reply": - $theme->header(); - comment_reply(check_input($pid), check_input($id)); - $theme->footer(); - break; - default: - $theme->header(); - $theme->story($node, "[ <A HREF=\"node.php?op=reply&id=$node->nid&pid=0\">". t("reply to this story") ."</A> ]"); - comment_render($id, $cid); - $theme->footer(); - } - } - else { - $theme->story($node, ($PHP_SELF == "/node.php" ? "[ <A HREF=\"node.php?op=reply&id=$node->nid&pid=0\">". t("reply to this story") ."</A> ]" : 0)); - } +function story_view($node, $main = 0) { + global $theme; + $theme->story($node, $main); } function story_form($edit = array()) { @@ -226,7 +178,7 @@ function story_admin() { print search_data($keys, $mod); break; case t("Preview"): - story_view(new Story($edit),0); + story_view(new Story($edit)); print story_form($edit); break; case t("Submit"): @@ -243,7 +195,7 @@ function story_user() { switch($op) { case t("Preview"): - story_view(new Story($edit), 0); + story_view(new Story($edit)); $theme->box(t("Submit"), story_form($edit)); break; case t("Submit"): diff --git a/modules/story/story.module b/modules/story/story.module index feb65cc32..484574d35 100644 --- a/modules/story/story.module +++ b/modules/story/story.module @@ -47,57 +47,9 @@ function story_type() { return array("story", t("story")); } -function story_view($node, $page = 1) { - global $id, $cid, $op, $moderate, $pid, $subject, $comment, $theme, $mode, $order, $threshold, $PHP_SELF; - - if ($page == 1) { - switch($op) { - case t("Preview comment"): - $theme->header(); - comment_preview(check_input($pid), check_input($id), $subject, $comment); - $theme->footer(); - break; - case t("Post comment"): - comment_post(check_input($pid), check_input($id), check_input($subject), check_input($comment)); - $theme->header(); - $theme->story($node, "[ <A HREF=\"node.php?op=reply&id=$node->nid&pid=0\">". t("reply to this story") ."</A> ]"); - comment_render($id, $cid); - $theme->footer(); - break; - case "reply": - $theme->header(); - comment_reply(check_input($pid), check_input($id)); - $theme->footer(); - break; - case t("Update settings"): - comment_settings(check_input($mode), check_input($order), check_input($threshold)); - $theme->header(); - $theme->story($node, "[ <A HREF=\"node.php?op=reply&id=$node->nid&pid=0\">". t("reply to this story") ."</A> ]"); - comment_render($id, $cid); - $theme->footer(); - break; - case t("Moderate comments"): - comment_moderate($moderate); - $theme->header(); - $theme->story($node, "[ <A HREF=\"node.php?op=reply&id=$node->nid&pid=0\">". t("reply to this story") ."</A> ]"); - comment_render($id, $cid); - $theme->footer(); - break; - case "reply": - $theme->header(); - comment_reply(check_input($pid), check_input($id)); - $theme->footer(); - break; - default: - $theme->header(); - $theme->story($node, "[ <A HREF=\"node.php?op=reply&id=$node->nid&pid=0\">". t("reply to this story") ."</A> ]"); - comment_render($id, $cid); - $theme->footer(); - } - } - else { - $theme->story($node, ($PHP_SELF == "/node.php" ? "[ <A HREF=\"node.php?op=reply&id=$node->nid&pid=0\">". t("reply to this story") ."</A> ]" : 0)); - } +function story_view($node, $main = 0) { + global $theme; + $theme->story($node, $main); } function story_form($edit = array()) { @@ -226,7 +178,7 @@ function story_admin() { print search_data($keys, $mod); break; case t("Preview"): - story_view(new Story($edit),0); + story_view(new Story($edit)); print story_form($edit); break; case t("Submit"): @@ -243,7 +195,7 @@ function story_user() { switch($op) { case t("Preview"): - story_view(new Story($edit), 0); + story_view(new Story($edit)); $theme->box(t("Submit"), story_form($edit)); break; case t("Submit"): diff --git a/modules/structure.module b/modules/structure.module index 35e7cbf5a..6e921ec0d 100644 --- a/modules/structure.module +++ b/modules/structure.module @@ -2,7 +2,7 @@ $module = array("admin" => "structure_admin"); -$cstatus = array("disabled", "enabled: incl. anonymous", "enabled: excl. anonymous"); +$cstatus = array("disabled", "enabled"); $mstatus = array("post new submissions", "moderate new submissions"); function content_types($name, $module) { |