From cccb132c81e82cc01ca7f014d185c1ecce864377 Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Sat, 21 Apr 2001 14:19:20 +0000 Subject: - Addition: added a "promote" field to the node table, which makes "promoting nodes" to the main page possible. Stories and reviews could be promoted by default, but - on accasion a good book entry could be manually promoted too. Thus all existing content types can be shown on the main page, not just stories. Requires a SQL update, see 2.00-to-x.xx.sql! - Addition: implemented "auto-post new submissions" feature to disable or by-pass the moderation queue in addition to "moderate new submissions". TODO: admin moderation versus registered user moderation. - Addition: added category and topic support to page.module. --- modules/book.module | 2 +- modules/book/book.module | 2 +- modules/node.module | 7 +++++-- modules/node/node.module | 7 +++++-- modules/page.module | 4 +++- modules/page/page.module | 4 +++- modules/story.module | 2 +- modules/story/story.module | 2 +- modules/structure.module | 47 ++++++++++++++++++++++------------------------ 9 files changed, 42 insertions(+), 35 deletions(-) (limited to 'modules') diff --git a/modules/book.module b/modules/book.module index 355366e3e..8fe3aea9f 100644 --- a/modules/book.module +++ b/modules/book.module @@ -157,7 +157,7 @@ function book_form($edit = array()) { } function book_save($edit) { - node_save(array_diff(array_merge($edit, array(nid => $edit[nid], type => "book", comment => category_comment($edit[cid]))), array(userid => $edit[userid]))); + node_save(array_diff(array_merge($edit, array(nid => $edit[nid], type => "book")), array(userid => $edit[userid]))); } function book_tree($parent = "", $depth = 0) { diff --git a/modules/book/book.module b/modules/book/book.module index 355366e3e..8fe3aea9f 100644 --- a/modules/book/book.module +++ b/modules/book/book.module @@ -157,7 +157,7 @@ function book_form($edit = array()) { } function book_save($edit) { - node_save(array_diff(array_merge($edit, array(nid => $edit[nid], type => "book", comment => category_comment($edit[cid]))), array(userid => $edit[userid]))); + node_save(array_diff(array_merge($edit, array(nid => $edit[nid], type => "book")), array(userid => $edit[userid]))); } function book_tree($parent = "", $depth = 0) { diff --git a/modules/node.module b/modules/node.module index 58b77fd99..3c377a2a4 100644 --- a/modules/node.module +++ b/modules/node.module @@ -27,7 +27,8 @@ function node_admin_view($id) { $output .= "Title:
". check_output($node->title) ."

\n"; $output .= "Author:
". format_username($node->userid) ."

\n"; $output .= "Status:
". $rstatus[$node->status] ."

\n"; - $output .= "Comment:
". comment_status($node->comment) ."

\n"; + $output .= "Comment:
". node_comment_status($node->comment) ."

\n"; + $output .= "Promote:
". node_promote_status($node->promote) ."

\n"; $output .= "Date:
". format_date($node->timestamp) ."

\n"; $output .= "\n"; $output .= "\n"; @@ -44,13 +45,15 @@ function node_admin_edit($id) { foreach (array($node->userid => $node->author, $user->userid => $user->id) as $value=>$key) $author .= " \n"; foreach (array(format_date($node->timestamp) ." (original)" => $node->timestamp, format_date(time()) ." (current)" => time()) as $value=>$key) $timestamp .= " \n"; foreach (node_status($node) as $value) $display .= " \n"; - foreach (comment_status() as $key=>$value) $comment .= " \n"; + foreach (node_comment_status() as $key=>$value) $comment .= " \n"; + foreach (node_promote_status() as $key=>$value) $promote .= " \n"; $output .= "

nid\" METHOD=\"post\">\n"; $output .= "Title:
". check_output($node->title) ."

\n"; $output .= "Author:

\n"; $output .= "Status:

\n"; $output .= "Comment:

\n"; + $output .= "Promote:

\n"; $output .= "Date:

\n"; $output .= "nid\">\n"; $output .= "\n"; diff --git a/modules/node/node.module b/modules/node/node.module index 58b77fd99..3c377a2a4 100644 --- a/modules/node/node.module +++ b/modules/node/node.module @@ -27,7 +27,8 @@ function node_admin_view($id) { $output .= "Title:
". check_output($node->title) ."

\n"; $output .= "Author:
". format_username($node->userid) ."

\n"; $output .= "Status:
". $rstatus[$node->status] ."

\n"; - $output .= "Comment:
". comment_status($node->comment) ."

\n"; + $output .= "Comment:
". node_comment_status($node->comment) ."

\n"; + $output .= "Promote:
". node_promote_status($node->promote) ."

\n"; $output .= "Date:
". format_date($node->timestamp) ."

\n"; $output .= "\n"; $output .= "\n"; @@ -44,13 +45,15 @@ function node_admin_edit($id) { foreach (array($node->userid => $node->author, $user->userid => $user->id) as $value=>$key) $author .= " \n"; foreach (array(format_date($node->timestamp) ." (original)" => $node->timestamp, format_date(time()) ." (current)" => time()) as $value=>$key) $timestamp .= " \n"; foreach (node_status($node) as $value) $display .= " \n"; - foreach (comment_status() as $key=>$value) $comment .= " \n"; + foreach (node_comment_status() as $key=>$value) $comment .= " \n"; + foreach (node_promote_status() as $key=>$value) $promote .= " \n"; $output .= "nid\" METHOD=\"post\">\n"; $output .= "Title:
". check_output($node->title) ."

\n"; $output .= "Author:

\n"; $output .= "Status:

\n"; $output .= "Comment:

\n"; + $output .= "Promote:

\n"; $output .= "Date:

\n"; $output .= "nid\">\n"; $output .= "\n"; diff --git a/modules/page.module b/modules/page.module index 3886cf04b..9cf760933 100644 --- a/modules/page.module +++ b/modules/page.module @@ -36,9 +36,11 @@ function page_form($edit = array()) { $output .= "\n"; - $output .= "Name:
\n"; + $output .= "Subject:
\n"; $output .= "

\n"; + $output .= structure_form("page", $edit); + $output .= "Body:
\n"; $output .= "

\n"; diff --git a/modules/page/page.module b/modules/page/page.module index 3886cf04b..9cf760933 100644 --- a/modules/page/page.module +++ b/modules/page/page.module @@ -36,9 +36,11 @@ function page_form($edit = array()) { $output .= "\n"; - $output .= "Name:
\n"; + $output .= "Subject:
\n"; $output .= "

\n"; + $output .= structure_form("page", $edit); + $output .= "Body:
\n"; $output .= "

\n"; diff --git a/modules/story.module b/modules/story.module index 88550443a..484574d35 100644 --- a/modules/story.module +++ b/modules/story.module @@ -106,7 +106,7 @@ function story_form($edit = array()) { } function story_save($edit) { - node_save(array_diff(array_merge($edit, array(nid => $edit[nid], type => "story", comment => category_comment($edit[cid]))), array(userid => $edit[userid]))); + node_save(array_diff(array_merge($edit, array(nid => $edit[nid], type => "story")), array(userid => $edit[userid]))); } function story_block() { diff --git a/modules/story/story.module b/modules/story/story.module index 88550443a..484574d35 100644 --- a/modules/story/story.module +++ b/modules/story/story.module @@ -106,7 +106,7 @@ function story_form($edit = array()) { } function story_save($edit) { - node_save(array_diff(array_merge($edit, array(nid => $edit[nid], type => "story", comment => category_comment($edit[cid]))), array(userid => $edit[userid]))); + node_save(array_diff(array_merge($edit, array(nid => $edit[nid], type => "story")), array(userid => $edit[userid]))); } function story_block() { diff --git a/modules/structure.module b/modules/structure.module index 5fa361bd9..8bcc21978 100644 --- a/modules/structure.module +++ b/modules/structure.module @@ -2,15 +2,13 @@ $module = array("admin" => "structure_admin"); -$mstatus = array("post new submissions", "moderate new submissions"); - function content_types($name, $module) { global $types; if ($module[type]) $types[$name] = $name; } function category_form($edit = array()) { - global $types, $mstatus; + 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); @@ -29,25 +27,26 @@ function category_form($edit = array()) { $output .= "
\n"; $output .= "The content type to bind or associate this category with.

\n"; - $output .= "Comment settings:
\n"; - foreach (comment_status() as $key=>$value) $options2 .= ""; + $output .= "Comment:
\n"; + foreach (node_comment_status() as $key=>$value) $options2 .= ""; $output .= "
\n"; - $output .= "Allow or dissallow users to post comments in this category.

\n"; - - $output .= "Submission settings:
\n"; - foreach ($mstatus as $key=>$value) $options3 .= ""; - $output .= "
\n"; - $output .= "What to do with new submissions in this category.

\n"; - - $output .= "Post, dump and expiration threshold:
\n"; - foreach ($threshold_post as $value) $options4 .= ""; - $output .= "\n"; - foreach ($threshold_dump as $value) $options5 .= ""; - $output .= "\n"; - foreach ($threshold_expire as $value) $options6 .= ""; - $output .= "
\n"; - - $output .= "Specify the post, dump and expiration threshold for moderation purpose.

\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"; if ($edit[cid]) { $output .= "\n"; @@ -64,14 +63,12 @@ function category_form($edit = array()) { } function category_overview() { - global $mstatus; - $result = db_query("SELECT * FROM category ORDER BY name"); $output .= "\n"; - $output .= " \n"; + $output .= " \n"; while ($category = db_fetch_object($result)) { - $output .= " \n"; + $output .= " \n"; } $output .= "
nametypecommentssubmissionsoperations
nametypecommentpromotesubmissionsoperations
". check_output($category->name) ."". check_output($category->type) ."". comment_status($category->comment) ."". check_output($mstatus[$category->submission]) ."". ($category->submission ? "
post: $category->post, dump: $category->dump, expire: $category->expire" : "") ."
cid\">edit category
". check_output($category->name) ."". check_output($category->type) ."". node_comment_status($category->comment) ."". node_promote_status($category->promote) ."". node_submission_status($category->submission) ."". ($category->submission ? "
post: $category->post, dump: $category->dump, expire: $category->expire" : "") ."
cid\">edit category
\n"; return $output; -- cgit v1.2.3