diff options
author | Dries Buytaert <dries@buytaert.net> | 2001-04-21 14:19:20 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2001-04-21 14:19:20 +0000 |
commit | cccb132c81e82cc01ca7f014d185c1ecce864377 (patch) | |
tree | 2814a3444025cc756968c6e273b65c6475c9012e /modules | |
parent | 3f1979aa3cfa2d50789e88bd0a857dec6babb44b (diff) | |
download | brdo-cccb132c81e82cc01ca7f014d185c1ecce864377.tar.gz brdo-cccb132c81e82cc01ca7f014d185c1ecce864377.tar.bz2 |
- 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.
Diffstat (limited to 'modules')
-rw-r--r-- | modules/book.module | 2 | ||||
-rw-r--r-- | modules/book/book.module | 2 | ||||
-rw-r--r-- | modules/node.module | 7 | ||||
-rw-r--r-- | modules/node/node.module | 7 | ||||
-rw-r--r-- | modules/page.module | 4 | ||||
-rw-r--r-- | modules/page/page.module | 4 | ||||
-rw-r--r-- | modules/story.module | 2 | ||||
-rw-r--r-- | modules/story/story.module | 2 | ||||
-rw-r--r-- | modules/structure.module | 47 |
9 files changed, 42 insertions, 35 deletions
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 .= "<B>Title:</B><BR>". check_output($node->title) ."<P>\n"; $output .= "<B>Author:</B><BR>". format_username($node->userid) ."<P>\n"; $output .= "<B>Status:</B><BR>". $rstatus[$node->status] ."<P>\n"; - $output .= "<B>Comment:</B><BR>". comment_status($node->comment) ."<P>\n"; + $output .= "<B>Comment:</B><BR>". node_comment_status($node->comment) ."<P>\n"; + $output .= "<B>Promote:</B><BR>". node_promote_status($node->promote) ."<P>\n"; $output .= "<B>Date:</B><BR>". format_date($node->timestamp) ."<P>\n"; $output .= "<INPUT TYPE=\"submit\" NAME=\"op\" VALUE=\"Edit node\">\n"; $output .= "<INPUT TYPE=\"submit\" NAME=\"op\" VALUE=\"Delete node\">\n"; @@ -44,13 +45,15 @@ function node_admin_edit($id) { foreach (array($node->userid => $node->author, $user->userid => $user->id) as $value=>$key) $author .= " <OPTION VALUE=\"$key\"". (($node->author == $key) ? " SELECTED" : "") .">$value</OPTION>\n"; foreach (array(format_date($node->timestamp) ." (original)" => $node->timestamp, format_date(time()) ." (current)" => time()) as $value=>$key) $timestamp .= " <OPTION VALUE=\"$key\"". (($node->timestamp == $key) ? " SELECTED" : "") .">$value</OPTION>\n"; foreach (node_status($node) as $value) $display .= " <OPTION VALUE=\"". $status[$value] ."\"". (($node->status == $status[$value]) ? " SELECTED" : "") .">$value</OPTION>\n"; - foreach (comment_status() as $key=>$value) $comment .= " <OPTION VALUE=\"$key\"". ($node->comment == $key ? " SELECTED" : "") .">$value</OPTION>\n"; + foreach (node_comment_status() as $key=>$value) $comment .= " <OPTION VALUE=\"$key\"". ($node->comment == $key ? " SELECTED" : "") .">$value</OPTION>\n"; + foreach (node_promote_status() as $key=>$value) $promote .= " <OPTION VALUE=\"$key\"". ($node->promote == $key ? " SELECTED" : "") .">$value</OPTION>\n"; $output .= "<FORM ACTION=\"admin.php?mod=node&id=$node->nid\" METHOD=\"post\">\n"; $output .= "<B>Title:</B><BR>". check_output($node->title) ."<P>\n"; $output .= "<B>Author:</B><BR><SELECT NAME=\"edit[author]\">$author</SELECT><P>\n"; $output .= "<B>Status:</B><BR><SELECT NAME=\"edit[status]\">$display</SELECT><P>\n"; $output .= "<B>Comment:</B><BR><SELECT NAME=\"edit[comment]\">$comment</SELECT><P>\n"; + $output .= "<B>Promote:</B><BR><SELECT NAME=\"edit[promote]\">$promote</SELECT><P>\n"; $output .= "<B>Date:</B><BR><SELECT NAME=\"edit[timestamp]\">$timestamp</SELECT><P>\n"; $output .= "<INPUT TYPE=\"hidden\" NAME=\"edit[nid]\" VALUE=\"$node->nid\">\n"; $output .= "<INPUT TYPE=\"submit\" NAME=\"op\" VALUE=\"View node\">\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 .= "<B>Title:</B><BR>". check_output($node->title) ."<P>\n"; $output .= "<B>Author:</B><BR>". format_username($node->userid) ."<P>\n"; $output .= "<B>Status:</B><BR>". $rstatus[$node->status] ."<P>\n"; - $output .= "<B>Comment:</B><BR>". comment_status($node->comment) ."<P>\n"; + $output .= "<B>Comment:</B><BR>". node_comment_status($node->comment) ."<P>\n"; + $output .= "<B>Promote:</B><BR>". node_promote_status($node->promote) ."<P>\n"; $output .= "<B>Date:</B><BR>". format_date($node->timestamp) ."<P>\n"; $output .= "<INPUT TYPE=\"submit\" NAME=\"op\" VALUE=\"Edit node\">\n"; $output .= "<INPUT TYPE=\"submit\" NAME=\"op\" VALUE=\"Delete node\">\n"; @@ -44,13 +45,15 @@ function node_admin_edit($id) { foreach (array($node->userid => $node->author, $user->userid => $user->id) as $value=>$key) $author .= " <OPTION VALUE=\"$key\"". (($node->author == $key) ? " SELECTED" : "") .">$value</OPTION>\n"; foreach (array(format_date($node->timestamp) ." (original)" => $node->timestamp, format_date(time()) ." (current)" => time()) as $value=>$key) $timestamp .= " <OPTION VALUE=\"$key\"". (($node->timestamp == $key) ? " SELECTED" : "") .">$value</OPTION>\n"; foreach (node_status($node) as $value) $display .= " <OPTION VALUE=\"". $status[$value] ."\"". (($node->status == $status[$value]) ? " SELECTED" : "") .">$value</OPTION>\n"; - foreach (comment_status() as $key=>$value) $comment .= " <OPTION VALUE=\"$key\"". ($node->comment == $key ? " SELECTED" : "") .">$value</OPTION>\n"; + foreach (node_comment_status() as $key=>$value) $comment .= " <OPTION VALUE=\"$key\"". ($node->comment == $key ? " SELECTED" : "") .">$value</OPTION>\n"; + foreach (node_promote_status() as $key=>$value) $promote .= " <OPTION VALUE=\"$key\"". ($node->promote == $key ? " SELECTED" : "") .">$value</OPTION>\n"; $output .= "<FORM ACTION=\"admin.php?mod=node&id=$node->nid\" METHOD=\"post\">\n"; $output .= "<B>Title:</B><BR>". check_output($node->title) ."<P>\n"; $output .= "<B>Author:</B><BR><SELECT NAME=\"edit[author]\">$author</SELECT><P>\n"; $output .= "<B>Status:</B><BR><SELECT NAME=\"edit[status]\">$display</SELECT><P>\n"; $output .= "<B>Comment:</B><BR><SELECT NAME=\"edit[comment]\">$comment</SELECT><P>\n"; + $output .= "<B>Promote:</B><BR><SELECT NAME=\"edit[promote]\">$promote</SELECT><P>\n"; $output .= "<B>Date:</B><BR><SELECT NAME=\"edit[timestamp]\">$timestamp</SELECT><P>\n"; $output .= "<INPUT TYPE=\"hidden\" NAME=\"edit[nid]\" VALUE=\"$node->nid\">\n"; $output .= "<INPUT TYPE=\"submit\" NAME=\"op\" VALUE=\"View node\">\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 .= "<FORM ACTION=\"admin.php?mod=page\" METHOD=\"post\">\n"; - $output .= "<B>Name:</B><BR>\n"; + $output .= "<B>Subject:</B><BR>\n"; $output .= "<INPUT NAME=\"edit[title]\" SIZE=\"55\" VALUE=\"". check_textfield($edit[title]) ."\"><P>\n"; + $output .= structure_form("page", $edit); + $output .= "<B>Body:</B><BR>\n"; $output .= "<TEXTAREA NAME=\"edit[body]\" COLS=\"55\" ROWS=\"10\" WRAP=\"virtual\">". check_textarea($edit[body]) ."</TEXTAREA><P>\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 .= "<FORM ACTION=\"admin.php?mod=page\" METHOD=\"post\">\n"; - $output .= "<B>Name:</B><BR>\n"; + $output .= "<B>Subject:</B><BR>\n"; $output .= "<INPUT NAME=\"edit[title]\" SIZE=\"55\" VALUE=\"". check_textfield($edit[title]) ."\"><P>\n"; + $output .= structure_form("page", $edit); + $output .= "<B>Body:</B><BR>\n"; $output .= "<TEXTAREA NAME=\"edit[body]\" COLS=\"55\" ROWS=\"10\" WRAP=\"virtual\">". check_textarea($edit[body]) ."</TEXTAREA><P>\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 .= "<SELECT NAME=\"edit[type]\">$options1</SELECT><BR>\n"; $output .= "<SMALL><I>The content type to bind or associate this category with.</I></SMALL><P>\n"; - $output .= "<B>Comment settings:</B><BR>\n"; - foreach (comment_status() as $key=>$value) $options2 .= "<OPTION VALUE=\"$key\"". ($edit[comment] == $key ? " SELECTED" : "") .">". check_select($value) ."</OPTION>"; + $output .= "<B>Comment:</B><BR>\n"; + foreach (node_comment_status() as $key=>$value) $options2 .= "<OPTION VALUE=\"$key\"". ($edit[comment] == $key ? " SELECTED" : "") .">". check_select($value) ."</OPTION>"; $output .= "<SELECT NAME=\"edit[comment]\">$options2</SELECT><BR>\n"; - $output .= "<SMALL><I>Allow or dissallow users to post comments in this category.</I></SMALL><P>\n"; - - $output .= "<B>Submission settings:</B><BR>\n"; - foreach ($mstatus as $key=>$value) $options3 .= "<OPTION VALUE=\"$key\"". ($edit[submission] == $key ? " SELECTED" : "") .">". check_select($value) ."</OPTION>"; - $output .= "<SELECT NAME=\"edit[submission]\">$options3</SELECT><BR>\n"; - $output .= "<SMALL><I>What to do with new submissions in this category.</I></SMALL><P>\n"; - - $output .= "<B>Post, dump and expiration threshold:</B><BR>\n"; - foreach ($threshold_post as $value) $options4 .= "<OPTION VALUE=\"$value\"". ($edit[post] == $value ? " SELECTED" : "") .">". format_plural($value, "point", "points") ."</OPTION>"; - $output .= "<SELECT NAME=\"edit[post]\">$options4</SELECT>\n"; - foreach ($threshold_dump as $value) $options5 .= "<OPTION VALUE=\"$value\"". ($edit[dump] == $value ? " SELECTED" : "") .">". format_plural($value, "point", "points") ."</OPTION>"; - $output .= "<SELECT NAME=\"edit[dump]\">$options5</SELECT>\n"; - foreach ($threshold_expire as $value) $options6 .= "<OPTION VALUE=\"$value\"". ($edit[expire] == $value ? " SELECTED" : "") .">". format_plural($value, "vote", "votes") ."</OPTION>"; - $output .= "<SELECT NAME=\"edit[expire]\">$options6</SELECT><BR>\n"; - - $output .= "<SMALL><I>Specify the post, dump and expiration threshold for moderation purpose.</I></SMALL><P>\n"; + $output .= "<SMALL><I>By default, allow or dissallow users to post comments in this category.</I></SMALL><P>\n"; + + $output .= "<B>Promote:</B><BR>\n"; + foreach (node_promote_status() as $key=>$value) $options3 .= "<OPTION VALUE=\"$key\"". ($edit[promote] == $key ? " SELECTED" : "") .">". check_select($value) ."</OPTION>"; + $output .= "<SELECT NAME=\"edit[promote]\">$options3</SELECT><BR>\n"; + $output .= "<SMALL><I>By default, promote new submissions in this category to the front page.</I></SMALL><P>\n"; + + $output .= "<B>Submission:</B><BR>\n"; + foreach (node_submission_status() as $key=>$value) $options4 .= "<OPTION VALUE=\"$key\"". ($edit[submission] == $key ? " SELECTED" : "") .">". check_select($value) ."</OPTION>"; + $output .= "<SELECT NAME=\"edit[submission]\">$options4</SELECT><BR>\n"; + foreach ($threshold_post as $value) $options5 .= "<OPTION VALUE=\"$value\"". ($edit[post] == $value ? " SELECTED" : "") .">". format_plural($value, "point", "points") ."</OPTION>"; + $output .= "<SELECT NAME=\"edit[post]\">$options5</SELECT>\n"; + foreach ($threshold_dump as $value) $options6 .= "<OPTION VALUE=\"$value\"". ($edit[dump] == $value ? " SELECTED" : "") .">". format_plural($value, "point", "points") ."</OPTION>"; + $output .= "<SELECT NAME=\"edit[dump]\">$options6</SELECT>\n"; + foreach ($threshold_expire as $value) $options7 .= "<OPTION VALUE=\"$value\"". ($edit[expire] == $value ? " SELECTED" : "") .">". format_plural($value, "vote", "votes") ."</OPTION>"; + $output .= "<SELECT NAME=\"edit[expire]\">$options7</SELECT><BR>\n"; + $output .= "<SMALL><I>What to do with new submissions in this category?<BR>Specify the post, dump and expiration threshold for moderation purpose.</I></SMALL><P>\n"; if ($edit[cid]) { $output .= "<INPUT TYPE=\"hidden\" NAME=\"edit[cid]\" VALUE=\"$edit[cid]\">\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 .= "<TABLE BORDER=\"1\" CELLPADDING=\"2\" CELLSPACING=\"2\">\n"; - $output .= " <TR><TH>name</TH><TH>type</TH><TH>comments</TH><TH>submissions</TH><TH>operations</TH></TR>\n"; + $output .= " <TR><TH>name</TH><TH>type</TH><TH>comment</TH><TH>promote</TH><TH>submissions</TH><TH>operations</TH></TR>\n"; while ($category = db_fetch_object($result)) { - $output .= " <TR><TD>". check_output($category->name) ."</TD><TD>". check_output($category->type) ."</TD><TD>". comment_status($category->comment) ."</TD><TD>". check_output($mstatus[$category->submission]) ."". ($category->submission ? "<BR><SMALL>post: $category->post, dump: $category->dump, expire: $category->expire</SMALL>" : "") ."</TD><TD><A HREF=\"admin.php?mod=structure&type=category&op=edit&id=$category->cid\">edit category</A></TD></TR>\n"; + $output .= " <TR><TD>". check_output($category->name) ."</TD><TD>". check_output($category->type) ."</TD><TD>". node_comment_status($category->comment) ."</TD><TD>". node_promote_status($category->promote) ."</TD><TD>". node_submission_status($category->submission) ."". ($category->submission ? "<BR><SMALL>post: $category->post, dump: $category->dump, expire: $category->expire</SMALL>" : "") ."</TD><TD><A HREF=\"admin.php?mod=structure&type=category&op=edit&id=$category->cid\">edit category</A></TD></TR>\n"; } $output .= "</TABLE>\n"; return $output; |