From c1c3943934a4af40b744ea942e4cc3137295a5e6 Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Thu, 10 May 2001 19:47:35 +0000 Subject: [PATCH] CHANGES: - "Formified" node.module and structure.module. - Added moderator capabilities to topics in structure.module; you can define the default moderators. --- modules/node.module | 46 ++++++++++----------- modules/node/node.module | 46 ++++++++++----------- modules/structure.module | 88 +++++++++++++++------------------------- updates/2.00-to-x.xx.sql | 5 ++- 4 files changed, 78 insertions(+), 107 deletions(-) diff --git a/modules/node.module b/modules/node.module index cff8e636d30..8b31f63c5cb 100644 --- a/modules/node.module +++ b/modules/node.module @@ -30,19 +30,17 @@ function node_overview($query = array()) { function node_admin_view($id) { $node = node_get_object("nid", $id); - $output .= "
nid\" METHOD=\"post\">\n"; - $output .= form_item("Title", check_output($node->title)); - $output .= form_item("Author", format_username($node->userid)); - $output .= form_item("Status", node_status($node, $node->status)); - $output .= form_item("Comment", node_comment_status($node->comment)); - $output .= form_item("Promote", node_promote_status($node->promote)); - $output .= form_item("Moderate", check_output($node->moderate)); - $output .= form_item("Date", format_date($node->timestamp)); - $output .= form_submit("Edit node"); - $output .= form_submit("Delete node"); - $output .= "
\n"; + $form .= form_item("Title", check_output($node->title)); + $form .= form_item("Author", format_username($node->userid)); + $form .= form_item("Status", node_status($node, $node->status)); + $form .= form_item("Comment", node_comment_status($node->comment)); + $form .= form_item("Promote", node_promote_status($node->promote)); + $form .= form_item("Moderate", check_output($node->moderate)); + $form .= form_item("Date", format_date($node->timestamp)); + $form .= form_submit("Edit node"); + $form .= form_submit("Delete node"); - return $output; + return form("admin.php?mod=node&id=$node->nid", $form); } function node_admin_edit($id) { @@ -50,20 +48,18 @@ function node_admin_edit($id) { $node = node_get_object("nid", $id); - $output .= "
nid\" METHOD=\"post\">\n"; - $output .= form_item("Title", check_output($node->title)); - $output .= form_select("Author", "author", $node->author, array($node->author => $node->userid, $user->id => $user->userid)); - $output .= form_select("Status", "status", $node->status, node_status($node)); - $output .= form_select("Comment", "comment", $node->comment, node_comment_status()); - $output .= form_select("Promote", "promote", $node->promote, node_promote_status()); - $output .= form_textfield("Moderate", "moderate", $node->moderate, 35, 255, t("A comma-seperated list of usernames.")); - $output .= form_select("Date", "timestamp", $node->timestamp, array($node->timestamp => format_date($node->timestamp) ." (original)", time() => format_date(time()) ." (current)")); - $output .= form_hidden("nid", $node->nid); - $output .= form_submit("View node"); - $output .= form_submit("Save node"); - $output .= "
\n"; + $form .= form_item("Title", check_output($node->title)); + $form .= form_select("Author", "author", $node->author, array($node->author => $node->userid, $user->id => $user->userid)); + $form .= form_select("Status", "status", $node->status, node_status($node)); + $form .= form_select("Comment", "comment", $node->comment, node_comment_status()); + $form .= form_select("Promote", "promote", $node->promote, node_promote_status()); + $form .= form_textfield("Moderate", "moderate", $node->moderate, 35, 255, t("Provide a comma-seperated list of the moderators their usernames.")); + $form .= form_select("Date", "timestamp", $node->timestamp, array($node->timestamp => format_date($node->timestamp) ." (original)", time() => format_date(time()) ." (current)")); + $form .= form_hidden("nid", $node->nid); + $form .= form_submit("View node"); + $form .= form_submit("Save node"); - return $output; + return form("admin.php?mod=node&id=$node->nid", $form); } function node_delete($id) { diff --git a/modules/node/node.module b/modules/node/node.module index cff8e636d30..8b31f63c5cb 100644 --- a/modules/node/node.module +++ b/modules/node/node.module @@ -30,19 +30,17 @@ function node_overview($query = array()) { function node_admin_view($id) { $node = node_get_object("nid", $id); - $output .= "
nid\" METHOD=\"post\">\n"; - $output .= form_item("Title", check_output($node->title)); - $output .= form_item("Author", format_username($node->userid)); - $output .= form_item("Status", node_status($node, $node->status)); - $output .= form_item("Comment", node_comment_status($node->comment)); - $output .= form_item("Promote", node_promote_status($node->promote)); - $output .= form_item("Moderate", check_output($node->moderate)); - $output .= form_item("Date", format_date($node->timestamp)); - $output .= form_submit("Edit node"); - $output .= form_submit("Delete node"); - $output .= "
\n"; + $form .= form_item("Title", check_output($node->title)); + $form .= form_item("Author", format_username($node->userid)); + $form .= form_item("Status", node_status($node, $node->status)); + $form .= form_item("Comment", node_comment_status($node->comment)); + $form .= form_item("Promote", node_promote_status($node->promote)); + $form .= form_item("Moderate", check_output($node->moderate)); + $form .= form_item("Date", format_date($node->timestamp)); + $form .= form_submit("Edit node"); + $form .= form_submit("Delete node"); - return $output; + return form("admin.php?mod=node&id=$node->nid", $form); } function node_admin_edit($id) { @@ -50,20 +48,18 @@ function node_admin_edit($id) { $node = node_get_object("nid", $id); - $output .= "
nid\" METHOD=\"post\">\n"; - $output .= form_item("Title", check_output($node->title)); - $output .= form_select("Author", "author", $node->author, array($node->author => $node->userid, $user->id => $user->userid)); - $output .= form_select("Status", "status", $node->status, node_status($node)); - $output .= form_select("Comment", "comment", $node->comment, node_comment_status()); - $output .= form_select("Promote", "promote", $node->promote, node_promote_status()); - $output .= form_textfield("Moderate", "moderate", $node->moderate, 35, 255, t("A comma-seperated list of usernames.")); - $output .= form_select("Date", "timestamp", $node->timestamp, array($node->timestamp => format_date($node->timestamp) ." (original)", time() => format_date(time()) ." (current)")); - $output .= form_hidden("nid", $node->nid); - $output .= form_submit("View node"); - $output .= form_submit("Save node"); - $output .= "
\n"; + $form .= form_item("Title", check_output($node->title)); + $form .= form_select("Author", "author", $node->author, array($node->author => $node->userid, $user->id => $user->userid)); + $form .= form_select("Status", "status", $node->status, node_status($node)); + $form .= form_select("Comment", "comment", $node->comment, node_comment_status()); + $form .= form_select("Promote", "promote", $node->promote, node_promote_status()); + $form .= form_textfield("Moderate", "moderate", $node->moderate, 35, 255, t("Provide a comma-seperated list of the moderators their usernames.")); + $form .= form_select("Date", "timestamp", $node->timestamp, array($node->timestamp => format_date($node->timestamp) ." (original)", time() => format_date(time()) ." (current)")); + $form .= form_hidden("nid", $node->nid); + $form .= form_submit("View node"); + $form .= form_submit("Save node"); - return $output; + return form("admin.php?mod=node&id=$node->nid", $form); } function node_delete($id) { diff --git a/modules/structure.module b/modules/structure.module index f51bc7f5e7c..e62571a7926 100644 --- a/modules/structure.module +++ b/modules/structure.module @@ -8,56 +8,32 @@ function content_types($name) { function category_form($edit = array()) { global $types; - $threshold_post = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 20, 25, 30, 35, 40, 45, 50, 60, 70, 80, 90, 100); - $threshold_dump = array(-1, -2, -3, -4, -5, -6, -7, -8, -9, -10, -11, -12, -13, -14, -15, -20, -25, -30); - $threshold_expire = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 20, 25, 30, 35, 40, 45, 50, 60, 70, 80, 90, 100); + $threshold_post = array(1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5, 6 => 6, 7 => 7, 8 => 8, 9 => 9, 10 => 10, 11 => 11, 12 => 12, 13 => 13, 14 => 14, 15 => 15, 20 => 20, 25 => 25, 30 => 30, 35 => 35, 40 => 40, 45 => 45, 50 => 50, 60 => 60, 70 => 70, 80 => 80, 90 => 90, 100 => 100); + $threshold_dump = array(-1 => -1, -2 => -2, -3 => -3, -4 => -4, -5 => -5, -6 => -6, -7 => -7, -8 => -8, -9 => -9, -10 => -10, -11 => -11, -12 => -12, -13 => -13, -14 => -14, -15 => -15, -20 => -20, -25 => -25, -30 => -30); + $threshold_expire = array(1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5, 6 => 6, 7 => 7, 8 => 8, 9 => 9, 10 => 10, 11 => 11, 12 => 12, 13 => 13, 14 => 14, 15 => 15, 20 => 20, 25 => 25, 30 => 30, 35 => 35, 40 => 40, 45 => 45, 50 => 50, 60 => 60, 70 => 70, 80 => 80, 90 => 90, 100 => 100); module_iterate("content_types"); - $output .= "
\n"; + $form .= form_textfield(t("Name"), "name", $edit[name], 30, 55, t("A unique name for this category like 'announcement', 'article', 'column', 'review', etc.")); + $form .= form_select(t("Content type"), "type", $edit[type], $types, t("The content type to bind or associate this category with.")); + $form .= form_select(t("Comment"), "comment", $edit[comment], node_comment_status(), t("By default, allow or dissallow users to post comments in this category.")); + $form .= form_select(t("Promote"), "promote", $edit[promote], node_promote_status(), t("By default, promote new submissions in this category to the front page.")); - $output .= "Name:
\n"; - $output .= "
\n"; - $output .= "A unique name for this category like 'announcement', 'article', 'column', 'review', etc.

\n"; - - $output .= "Content type:
\n"; - foreach ($types as $key=>$value) $options1 .= ""; - $output .= "
\n"; - $output .= "The content type to bind or associate this category with.

\n"; - - $output .= "Comment:
\n"; - foreach (node_comment_status() as $key=>$value) $options2 .= ""; - $output .= "
\n"; - $output .= "By default, allow or dissallow users to post comments in this category.

\n"; - - $output .= "Promote:
\n"; - foreach (node_promote_status() as $key=>$value) $options3 .= ""; - $output .= "
\n"; - $output .= "By default, promote new submissions in this category to the front page.

\n"; - - $output .= "Submission:
\n"; - foreach (node_submission_status() as $key=>$value) $options4 .= ""; - $output .= "
\n"; - foreach ($threshold_post as $value) $options5 .= ""; - $output .= "\n"; - foreach ($threshold_dump as $value) $options6 .= ""; - $output .= "\n"; - foreach ($threshold_expire as $value) $options7 .= ""; - $output .= "
\n"; - $output .= "What to do with new submissions in this category?
Specify the post, dump and expiration threshold for moderation purpose.

\n"; + $form .= form_select(t("Submission"), "submission", $edit[submission], node_submission_status(), t("What to do with new submissions in this category?")); + $form .= form_select(t("Post threshold"), "post", $edit[post], $threshold_post, t("If new submissions are subject to moderation, select a post threshold.")); + $form .= form_select(t("Dump threshold"), "dump", $edit[dump], $threshold_dump, t("If new submissions are subject to moderation, select a dump threshold.")); + $form .= form_select(t("Expiration threshold"), "expire", $edit[expire], $threshold_expire, t("If new submissions are subject to moderation, select a expiration threshold.")); if ($edit[cid]) { - $output .= "\n"; - $output .= "\n"; - $output .= "\n"; + $form .= form_hidden("cid", $edit[cid]); + $form .= form_submit(t("Save category")); + $form .= form_submit(t("Delete category")); } else { - $output .= "\n"; + $form .= form_submit(t("Save category")); } - $output .= "

\n"; - - return $output; + return form("admin.php?mod=structure&type=category", $form); } function category_overview() { @@ -76,36 +52,36 @@ function category_overview() { function topic_form($edit = array()) { - $output .= "
\n"; + $result = db_query("SELECT * FROM topic WHERE name != '$edit[name]' ORDER BY name DESC"); + while ($topic = db_fetch_object($result)) { + $topics[$topic->tid] = $topic->name; + } + $topics[0] = " "; - $output .= "Name:
\n"; - $output .= "
\n"; - $output .= "A unique name for this topic like 'science', 'internet', 'culture', etc.

\n"; - - $output .= "Parent:
\n"; - foreach (topic_tree() as $key=>$value) $options .= ""; - $output .= "
\n"; - $output .= "The parent topic this topic belongs in.

\n"; + $form .= form_textfield(t("Name"), "name", $edit[name], 30, 55, t("A unique name for this topic like 'science', 'internet', 'culture', etc.")); + $form .= form_select(t("Parent"), "pid", $edit[pid], $topics, t("The parent topic this topic belongs in.")); + $form .= form_textfield("Moderate", "moderate", $edit[moderate], 35, 255, t("Provide a comma-seperated list of the moderators their usernames.")); if ($edit[tid]) { - $output .= "\n"; - $output .= "\n"; - $output .= "\n"; + $form .= form_hidden("tid", $edit[tid]); + $form .= form_submit(t("Save topic")); + $form .= form_submit(t("Delete topic")); } else { - $output .= "\n"; + $form .= form_submit(t("Save topic")); } - return $output; + return form("admin.php?mod=structure&type=topic", $form); } function topic_overview() { $tree = topic_tree(); $output .= "\n"; - $output .= " \n"; + $output .= " \n"; foreach ($tree as $id=>$name) { - $output .= " \n"; + $topic = topic_get_object("tid", $id); + $output .= " \n"; } $output .= "
nameoperations
namemoderatorsoperations
". check_output($name) ."edit topic
". check_output($name) ."". check_output($topic->moderate) ."tid\">edit topic
\n"; return $output; diff --git a/updates/2.00-to-x.xx.sql b/updates/2.00-to-x.xx.sql index c823766443e..24365dd5737 100644 --- a/updates/2.00-to-x.xx.sql +++ b/updates/2.00-to-x.xx.sql @@ -132,4 +132,7 @@ CREATE TABLE forum ( ); # 01/05/2001: -ALTER TABLE node ADD moderate TEXT NOT NULL; \ No newline at end of file +ALTER TABLE node ADD moderate TEXT NOT NULL; + +# 10/05/2001: +ALTER TABLE topic ADD moderate TEXT NOT NULL;