From 343e71c8ebdea6dafbd085782b5d042a7a60f2c3 Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Wed, 2 May 2001 20:52:19 +0000 Subject: CHANGES: - Added moderator permissions to nodes. - Added moderator support to structure.module. - Added new moderate.module. - Renamed moderation.module to queue.module to avoid confusing. Updated theme yaroon as it seems to have a hard-coded reference to moderation.module. - Polished on: + account.module: improved access list + fixed HTML typo in node.module ACTIONS: - Jeroen: can jeroen2.theme be removed from ./themes/yaroon? --- modules/account.module | 2 +- modules/book.module | 2 +- modules/book/book.module | 2 +- modules/comment.module | 14 +++-- modules/comment/comment.module | 14 +++-- modules/forum.module | 8 +-- modules/forum/forum.module | 8 +-- modules/moderate.module | 106 ++++++++++++++++++++++++++++++++++ modules/moderation.module | 126 ----------------------------------------- modules/node.module | 12 ++-- modules/node/node.module | 12 ++-- modules/page.module | 4 +- modules/page/page.module | 4 +- modules/queue.module | 126 +++++++++++++++++++++++++++++++++++++++++ modules/story.module | 7 +-- modules/story/story.module | 7 +-- 16 files changed, 281 insertions(+), 173 deletions(-) create mode 100644 modules/moderate.module delete mode 100644 modules/moderation.module create mode 100644 modules/queue.module (limited to 'modules') diff --git a/modules/account.module b/modules/account.module index 6dbf54977..aeb1f3fc2 100644 --- a/modules/account.module +++ b/modules/account.module @@ -155,7 +155,7 @@ function account_edit($name) { function access($name, $module) { global $access, $account; - $access .= ""; + if ($module["admin"]) $access .= ""; } $status = array("blocked", "not confirmed", "open"); diff --git a/modules/book.module b/modules/book.module index 78d4e5680..61a3f5946 100644 --- a/modules/book.module +++ b/modules/book.module @@ -92,7 +92,7 @@ function book_toc($parent = 0, $indent = "", $toc = array()) { } function book_form($edit = array()) { - global $allowed_html, $PHP_SELF, $REQUEST_URI, $user; + global $allowed_html, $REQUEST_URI, $user; $form .= form_item(t("Author"), format_username(($edit[userid] ? $edit[userid] : $user->userid))); $form .= form_hidden(userid, $edit[userid]); diff --git a/modules/book/book.module b/modules/book/book.module index 78d4e5680..61a3f5946 100644 --- a/modules/book/book.module +++ b/modules/book/book.module @@ -92,7 +92,7 @@ function book_toc($parent = 0, $indent = "", $toc = array()) { } function book_form($edit = array()) { - global $allowed_html, $PHP_SELF, $REQUEST_URI, $user; + global $allowed_html, $REQUEST_URI, $user; $form .= form_item(t("Author"), format_username(($edit[userid] ? $edit[userid] : $user->userid))); $form .= form_hidden(userid, $edit[userid]); diff --git a/modules/comment.module b/modules/comment.module index 5c2f9005f..e87e6d2c9 100644 --- a/modules/comment.module +++ b/modules/comment.module @@ -14,15 +14,17 @@ function comment_find($keys) { } function comment_edit($id) { + global $REQUEST_URI; + $result = db_query("SELECT c.*, u.userid FROM comments c LEFT JOIN users u ON c.author = u.id WHERE c.cid = '$id'"); $comment = db_fetch_object($result); $form .= form_item(t("Author"), format_username($comment->userid)); $form .= form_textfield(t("Subject"), "subject", $comment->subject, 50, 128); $form .= form_textarea(t("Comment"), "comment", $comment->comment, 50, 10); - $form .= form_submit("Save comment"); + $form .= form_submit("Submit"); - return form("admin.php?mod=comment&id=$id", $form); + return form($REQUEST_URI, $form); } function comment_save($id, $edit) { @@ -30,7 +32,7 @@ function comment_save($id, $edit) { watchdog("message", "comment: modified '$edit[subject]'"); } -function comment_display() { +function comment_overview() { $result = db_query("SELECT c.*, u.userid FROM comments c LEFT JOIN users u ON u.id = c.author ORDER BY timestamp DESC LIMIT 50"); $output .= "\n"; @@ -56,12 +58,12 @@ function comment_admin() { print search_form($keys); print search_data($keys, $mod); break; - case "Save comment": + case "Submit": print status(comment_save(check_input($id), $edit)); - print comment_display(); + print comment_overview(); break; default: - print comment_display(); + print comment_overview(); } } diff --git a/modules/comment/comment.module b/modules/comment/comment.module index 5c2f9005f..e87e6d2c9 100644 --- a/modules/comment/comment.module +++ b/modules/comment/comment.module @@ -14,15 +14,17 @@ function comment_find($keys) { } function comment_edit($id) { + global $REQUEST_URI; + $result = db_query("SELECT c.*, u.userid FROM comments c LEFT JOIN users u ON c.author = u.id WHERE c.cid = '$id'"); $comment = db_fetch_object($result); $form .= form_item(t("Author"), format_username($comment->userid)); $form .= form_textfield(t("Subject"), "subject", $comment->subject, 50, 128); $form .= form_textarea(t("Comment"), "comment", $comment->comment, 50, 10); - $form .= form_submit("Save comment"); + $form .= form_submit("Submit"); - return form("admin.php?mod=comment&id=$id", $form); + return form($REQUEST_URI, $form); } function comment_save($id, $edit) { @@ -30,7 +32,7 @@ function comment_save($id, $edit) { watchdog("message", "comment: modified '$edit[subject]'"); } -function comment_display() { +function comment_overview() { $result = db_query("SELECT c.*, u.userid FROM comments c LEFT JOIN users u ON u.id = c.author ORDER BY timestamp DESC LIMIT 50"); $output .= "
\n"; @@ -56,12 +58,12 @@ function comment_admin() { print search_form($keys); print search_data($keys, $mod); break; - case "Save comment": + case "Submit": print status(comment_save(check_input($id), $edit)); - print comment_display(); + print comment_overview(); break; default: - print comment_display(); + print comment_overview(); } } diff --git a/modules/forum.module b/modules/forum.module index 0936f4eb5..755e5947a 100644 --- a/modules/forum.module +++ b/modules/forum.module @@ -21,15 +21,15 @@ function forum_view($node) { } function forum_form($edit = array()) { - global $format; + global $format, $REQUEST_URI; $form .= form_textfield(t("Subject"), "title", $edit[title], 50, 64); $form .= structure_form("forum", $edit); $form .= form_textarea(t("Body"), "body", $edit[body], 50, 10); $form .= form_hidden("nid", $edit[nid]); - $form .= form_submit("Save forum"); + $form .= form_submit("Submit"); - return form("admin.php?mod=forum", $form); + return form($REQUEST_URI, $form); } function forum_save($edit) { @@ -83,7 +83,7 @@ function forum_admin() { case "edit": print forum_form(node_get_array(nid, $id)); break; - case "Save forum": + case "Submit": print status(forum_save($edit)); // fall through: default: diff --git a/modules/forum/forum.module b/modules/forum/forum.module index 0936f4eb5..755e5947a 100644 --- a/modules/forum/forum.module +++ b/modules/forum/forum.module @@ -21,15 +21,15 @@ function forum_view($node) { } function forum_form($edit = array()) { - global $format; + global $format, $REQUEST_URI; $form .= form_textfield(t("Subject"), "title", $edit[title], 50, 64); $form .= structure_form("forum", $edit); $form .= form_textarea(t("Body"), "body", $edit[body], 50, 10); $form .= form_hidden("nid", $edit[nid]); - $form .= form_submit("Save forum"); + $form .= form_submit("Submit"); - return form("admin.php?mod=forum", $form); + return form($REQUEST_URI, $form); } function forum_save($edit) { @@ -83,7 +83,7 @@ function forum_admin() { case "edit": print forum_form(node_get_array(nid, $id)); break; - case "Save forum": + case "Submit": print status(forum_save($edit)); // fall through: default: diff --git a/modules/moderate.module b/modules/moderate.module new file mode 100644 index 000000000..02f4974b5 --- /dev/null +++ b/modules/moderate.module @@ -0,0 +1,106 @@ + "moderate_admin"); + +function moderate_comment_access($cid) { + global $user; + return db_fetch_object(db_query("SELECT n.moderate FROM comments c LEFT JOIN node n ON c.lid = n.nid WHERE c.cid = '". check_input($cid) ."' AND n.moderate LIKE '%$user->userid%'")); +} + +function moderate_overview($query = array()) { + global $user; + + $result = db_query("SELECT n.*, u.userid FROM node n LEFT JOIN users u ON n.author = u.id WHERE n.moderate LIKE '%$user->userid%' ORDER BY n.timestamp DESC LIMIT 15"); + + $output .= status($query[0]); + $output .= "
\n"; + $output .= " \n"; + + $r1 = db_query("SELECT n.*, u.userid FROM node n LEFT JOIN users u ON n.author = u.id WHERE n.moderate LIKE '%$user->userid%' ORDER BY n.timestamp DESC LIMIT 30"); + while ($node = db_fetch_object($r1)) { + $output .= " \n"; + + $r2 = db_query("SELECT c.*, u.userid FROM comments c LEFT JOIN users u ON c.author = u.id WHERE c.lid = '$node->nid' ORDER BY c.timestamp DESC"); + while ($comment = db_fetch_object($r2)) { + $output .= "\n"; + } + } + $output .= "
nodecategory / topicstatusauthordateoperations
nid\">". check_output($node->title) ."". category_name($node->cid) ." / ". topic_name($node->tid) ."". node_status($node, $node->status) ."". format_username($node->userid) ."". format_date($node->timestamp, "small") ."nid\">edit $node->type
 - lid&cid=$comment->cid&pid=$comment->pid#$comment->cid\">". check_output($comment->subject) ."". format_username($user->userid) ."". format_date($node->timestamp, "small") ."cid\">edit comment
\n"; + + return $output; +} + +function moderate_node_edit($id) { + global $user; + + $node = node_get_array("nid", $id); + if ($node && strstr($node[moderate], $user->userid)) { + return node_form($node); + } + else { + return "access denied"; + } +} + +function moderate_node_save($edit) { + global $user; + + $node = node_get_array("nid", $edit[nid]); + if ($node && strstr($node[moderate], $user->userid)) { + $edit[type] = $node[type]; + return node_invoke($edit, "save"); + } + else { + return "access denied"; + } +} + +function moderate_comment_edit($id) { + if (moderate_comment_access($id)) { + return comment_edit($id); + } + else { + return "access denied"; + } +} + +function moderate_comment_save($id, $edit) { + if (moderate_comment_access($id)) { + return comment_save($id, $edit); + } + else { + return "access denied"; + } +} + +function moderate_admin() { + global $op, $id, $edit, $type; + + switch ($type) { + case "comment": + switch ($op) { + case "edit": + print moderate_comment_edit($id); + break; + case "Submit": + print status(moderate_comment_save($id, $edit)); + // fall through: + default: + print moderate_overview(); + } + break; + default: + switch ($op) { + case "edit": + print moderate_node_edit($id); + break; + case "Submit": + print status(moderate_node_save($edit)); + // fall through: + default: + print moderate_overview(); + } + } +} + +?> diff --git a/modules/moderation.module b/modules/moderation.module deleted file mode 100644 index 4c447d282..000000000 --- a/modules/moderation.module +++ /dev/null @@ -1,126 +0,0 @@ - "+ 0", - "post it (+1)" => "+ 1", - "dump it (-1)" => "- 1"); - -$module = array("menu" => "moderation_menu", - "page" => "moderation_page"); - -function moderation_menu() { - return array("". t("moderation queue") ." (". moderation_count() .")"); -} - -function moderation_count() { - global $status; - $result = db_query("SELECT COUNT(nid) FROM node WHERE status = '$status[queued]'"); - return ($result) ? db_result($result, 0) : 0; -} - -function moderation_score($id) { - $result = db_query("SELECT score FROM node WHERE nid = '$id'"); - return ($result) ? db_result($result, 0) : 0; -} - -function moderation_vote($id, $vote) { - global $status, $user; - - if (!user_get($user, "history", "n$id")) { - // Update submission's score- and votes-field: - db_query("UPDATE node SET score = score $vote, votes = votes + 1 WHERE nid = $id"); - - // Update user's history record: - $user = user_set($user, "history", "n$id", $vote); - - if ($node = node_get_object(nid, $id)) { - if (variable_get("post_threshold", 4, $node) <= $node->score) { - node_save(array(nid => $id, status => $status[posted])); - watchdog("message", "node: posted '$node->title' - moderation"); - } - else if (variable_get("dump_threshold", -2, $node) >= $node->score) { - node_save(array(nid => $id, status => $status[dumped])); - watchdog("message", "node: dumped '$node->title' - moderation"); - } - else if (variable_get("expire_threshold", 8, $node) <= $node->votes) { - node_save(array(nid => $id, status => $status[expired])); - watchdog("message", "node: expired '$node->title' - moderation"); - } - } - } -} - -function moderation_overview() { - global $status, $theme, $user; - - $result = db_query("SELECT n.*, u.userid FROM node n LEFT JOIN users u ON n.author = u.id WHERE n.status = '$status[queued]'"); - - $content .= "\n"; - $content .= " \n"; - while ($node = db_fetch_object($result)) { - if ($user->id == $node->author || user_get($user, "history", "n$node->nid")) $content .= " \n"; - else $content .= " \n"; - } - $content .= "
". t("Subject") ."". t("Author") ."". t("Type") ."". t("Score") ."
nid\">". check_output($node->title) ."". format_username($node->userid) ."". check_output($node->type) ."". moderation_score($node->nid) ."
nid\">". check_output($node->title) ."". format_username($node->userid) ."". check_output($node->type) ."nid\">". t("vote") ."
\n"; - - $theme->header(); - $theme->box(t("Moderation queue"), $content); - $theme->footer(); -} - -function moderation_node($id) { - global $theme, $user, $moderation_votes; - - $node = node_get_object(nid, $id); - - if ($user->id == $node->author || user_get($user, "history", "n$node->nid")) { - header("Location: node.php?id=$node->nid"); - } - else { - if ($n = node_get_object("nid", $node->pid)) { - $output .= " ". t("The above node is a proposed update of an existing node:") ." \"nid\">". check_output($n->title) ."\"."; - } - - if ($node->log) { - $output .= " ". t("The log message to accompany this submission is given below:") ."

". check_output($node->log, 1) ."

"; - } - - // moderation form: - $output .= "
\n"; - foreach ($moderation_votes as $key=>$value) $options .= " \n"; - $output .= "\n"; - $output .= "nid\">\n"; - $output .= "\n"; - $output .= "
\n"; - - $theme->header(); - node_view($node); - $theme->box(t("Moderate"), $output); - $theme->footer(); - } -} - -function moderation_page() { - global $id, $op, $user, $vote; - - if ($user->id) { - switch($op) { - case "Vote"; - moderation_vote(check_input($id), check_input($vote)); - // fall through: - case "view": - moderation_node(check_input($id)); - break; - default: - moderation_overview(); - break; - } - } -} - -?> diff --git a/modules/node.module b/modules/node.module index d88f852d7..bdc4b30d6 100644 --- a/modules/node.module +++ b/modules/node.module @@ -3,15 +3,15 @@ $module = array("admin" => "node_admin"); function node_overview($query = array()) { - global $user, $rstatus; + global $user; $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 .= "\n"; - $output .= " \n"; + $output .= " \n"; while ($node = db_fetch_object($result)) { - $output .= " " : "view node") ."" : "edit node") ."" : "edit $node->type") ."\n"; + $output .= " \n"; } $output .= "
titlecategorystatusauthordateoperations
titlecategorystatusauthordateoperations
nid\">". check_output($node->title) ."". check_output($node->category ? $node->category : $node->type) ."". $rstatus[$node->status] ."". format_username($node->userid) ."". format_date($node->timestamp, "small") ."". (user_access($user, "node") ? "nid\">view node". (user_access($user, "node") ? "nid\">edit node". (user_access($user, $node->type) ? "type&op=edit&id=$node->nid\">edit $node->type
nid\">". check_output($node->title) ."". check_output($node->category ? $node->category : $node->type) ."". node_status($node, $node->status) ."". format_username($node->userid) ."". format_date($node->timestamp, "small") ."". (user_access($user, "node") ? "nid\">edit node" : "edit node") ."". (user_access($user, $node->type) ? "type&op=edit&id=$node->nid\">edit $node->type" : "edit $node->type") ."
\n"; @@ -19,16 +19,15 @@ function node_overview($query = array()) { } function node_admin_view($id) { - global $rstatus; - $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", $rstatus[$node->status]); + $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"); @@ -48,6 +47,7 @@ function node_admin_edit($id) { $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"); diff --git a/modules/node/node.module b/modules/node/node.module index d88f852d7..bdc4b30d6 100644 --- a/modules/node/node.module +++ b/modules/node/node.module @@ -3,15 +3,15 @@ $module = array("admin" => "node_admin"); function node_overview($query = array()) { - global $user, $rstatus; + global $user; $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 .= "\n"; - $output .= " \n"; + $output .= " \n"; while ($node = db_fetch_object($result)) { - $output .= " " : "view node") ."" : "edit node") ."" : "edit $node->type") ."\n"; + $output .= " \n"; } $output .= "
titlecategorystatusauthordateoperations
titlecategorystatusauthordateoperations
nid\">". check_output($node->title) ."". check_output($node->category ? $node->category : $node->type) ."". $rstatus[$node->status] ."". format_username($node->userid) ."". format_date($node->timestamp, "small") ."". (user_access($user, "node") ? "nid\">view node". (user_access($user, "node") ? "nid\">edit node". (user_access($user, $node->type) ? "type&op=edit&id=$node->nid\">edit $node->type
nid\">". check_output($node->title) ."". check_output($node->category ? $node->category : $node->type) ."". node_status($node, $node->status) ."". format_username($node->userid) ."". format_date($node->timestamp, "small") ."". (user_access($user, "node") ? "nid\">edit node" : "edit node") ."". (user_access($user, $node->type) ? "type&op=edit&id=$node->nid\">edit $node->type" : "edit $node->type") ."
\n"; @@ -19,16 +19,15 @@ function node_overview($query = array()) { } function node_admin_view($id) { - global $rstatus; - $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", $rstatus[$node->status]); + $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"); @@ -48,6 +47,7 @@ function node_admin_edit($id) { $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"); diff --git a/modules/page.module b/modules/page.module index c6a2fbb86..f29d529dd 100644 --- a/modules/page.module +++ b/modules/page.module @@ -38,7 +38,7 @@ function page_form($edit = array()) { $form .= form_textarea(t("Body"), "body", $edit[body], 50, 10); $form .= form_select(t("Type"), "format", $edit[format], $format); $form .= form_hidden("nid", $edit[nid]); - $form .= form_submit("Save page"); + $form .= form_submit("Submit"); return form($REQUEST_URI, $form); } @@ -75,7 +75,7 @@ function page_admin() { case "listing": print node_listing(page_query()); break; - case "Save page": + case "Submit": print status(page_save($edit)); // fall through: default: diff --git a/modules/page/page.module b/modules/page/page.module index c6a2fbb86..f29d529dd 100644 --- a/modules/page/page.module +++ b/modules/page/page.module @@ -38,7 +38,7 @@ function page_form($edit = array()) { $form .= form_textarea(t("Body"), "body", $edit[body], 50, 10); $form .= form_select(t("Type"), "format", $edit[format], $format); $form .= form_hidden("nid", $edit[nid]); - $form .= form_submit("Save page"); + $form .= form_submit("Submit"); return form($REQUEST_URI, $form); } @@ -75,7 +75,7 @@ function page_admin() { case "listing": print node_listing(page_query()); break; - case "Save page": + case "Submit": print status(page_save($edit)); // fall through: default: diff --git a/modules/queue.module b/modules/queue.module new file mode 100644 index 000000000..31087d5f3 --- /dev/null +++ b/modules/queue.module @@ -0,0 +1,126 @@ + "+ 0", + "post it (+1)" => "+ 1", + "dump it (-1)" => "- 1"); + +$module = array("menu" => "queue_menu", + "page" => "queue_page"); + +function queue_menu() { + return array("". t("moderation queue") ." (". queue_count() .")"); +} + +function queue_count() { + global $status; + $result = db_query("SELECT COUNT(nid) FROM node WHERE status = '$status[queued]'"); + return ($result) ? db_result($result, 0) : 0; +} + +function queue_score($id) { + $result = db_query("SELECT score FROM node WHERE nid = '$id'"); + return ($result) ? db_result($result, 0) : 0; +} + +function queue_vote($id, $vote) { + global $status, $user; + + if (!user_get($user, "history", "n$id")) { + // Update submission's score- and votes-field: + db_query("UPDATE node SET score = score $vote, votes = votes + 1 WHERE nid = $id"); + + // Update user's history record: + $user = user_set($user, "history", "n$id", $vote); + + if ($node = node_get_object(nid, $id)) { + if (variable_get("post_threshold", 4, $node) <= $node->score) { + node_save(array(nid => $id, status => $status[posted])); + watchdog("message", "node: posted '$node->title' - moderation"); + } + else if (variable_get("dump_threshold", -2, $node) >= $node->score) { + node_save(array(nid => $id, status => $status[dumped])); + watchdog("message", "node: dumped '$node->title' - moderation"); + } + else if (variable_get("expire_threshold", 8, $node) <= $node->votes) { + node_save(array(nid => $id, status => $status[expired])); + watchdog("message", "node: expired '$node->title' - moderation"); + } + } + } +} + +function queue_overview() { + global $status, $theme, $user; + + $result = db_query("SELECT n.*, u.userid FROM node n LEFT JOIN users u ON n.author = u.id WHERE n.status = '$status[queued]'"); + + $content .= "\n"; + $content .= " \n"; + while ($node = db_fetch_object($result)) { + if ($user->id == $node->author || user_get($user, "history", "n$node->nid")) $content .= " \n"; + else $content .= " \n"; + } + $content .= "
". t("Subject") ."". t("Author") ."". t("Type") ."". t("Score") ."
nid\">". check_output($node->title) ."". format_username($node->userid) ."". check_output($node->type) ."". queue_score($node->nid) ."
nid\">". check_output($node->title) ."". format_username($node->userid) ."". check_output($node->type) ."nid\">". t("vote") ."
\n"; + + $theme->header(); + $theme->box(t("Moderation queue"), $content); + $theme->footer(); +} + +function queue_node($id) { + global $theme, $user, $queue_votes; + + $node = node_get_object(nid, $id); + + if ($user->id == $node->author || user_get($user, "history", "n$node->nid")) { + header("Location: node.php?id=$node->nid"); + } + else { + if ($n = node_get_object("nid", $node->pid)) { + $output .= " ". t("The above node is a proposed update of an existing node:") ." \"nid\">". check_output($n->title) ."\"."; + } + + if ($node->log) { + $output .= " ". t("The log message to accompany this submission is given below:") ."

". check_output($node->log, 1) ."

"; + } + + // moderation form: + $output .= "\n"; + foreach ($queue_votes as $key=>$value) $options .= " \n"; + $output .= "\n"; + $output .= "nid\">\n"; + $output .= "\n"; + $output .= "
\n"; + + $theme->header(); + node_view($node); + $theme->box(t("Moderate"), $output); + $theme->footer(); + } +} + +function queue_page() { + global $id, $op, $user, $vote; + + if ($user->id) { + switch($op) { + case "Vote"; + queue_vote(check_input($id), check_input($vote)); + // fall through: + case "view": + queue_node(check_input($id)); + break; + default: + queue_overview(); + break; + } + } +} + +?> diff --git a/modules/story.module b/modules/story.module index 665f221b1..30482f50e 100644 --- a/modules/story.module +++ b/modules/story.module @@ -62,10 +62,9 @@ function story_form($edit = array()) { $form .= form_textarea(t("Abstract"), "abstract", $edit[abstract], 50, 10, t("Allowed HTML tags") .": ". htmlspecialchars($allowed_html)); $form .= form_textarea(t("Body"), "body", $edit[body], 50, 15, t("Allowed HTML tags") .": ". htmlspecialchars($allowed_html)); - if (user_access($user, "story")) { - $form .= form_hidden("timestamp", $edit[timestamp]); - $form .= form_hidden("nid", $edit[nid]); - } + // hidden fields: + $form .= form_hidden("timestamp", $edit[timestamp]); + $form .= form_hidden("nid", $edit[nid]); if (!$edit) { $form .= form_submit(t("Preview")); diff --git a/modules/story/story.module b/modules/story/story.module index 665f221b1..30482f50e 100644 --- a/modules/story/story.module +++ b/modules/story/story.module @@ -62,10 +62,9 @@ function story_form($edit = array()) { $form .= form_textarea(t("Abstract"), "abstract", $edit[abstract], 50, 10, t("Allowed HTML tags") .": ". htmlspecialchars($allowed_html)); $form .= form_textarea(t("Body"), "body", $edit[body], 50, 15, t("Allowed HTML tags") .": ". htmlspecialchars($allowed_html)); - if (user_access($user, "story")) { - $form .= form_hidden("timestamp", $edit[timestamp]); - $form .= form_hidden("nid", $edit[nid]); - } + // hidden fields: + $form .= form_hidden("timestamp", $edit[timestamp]); + $form .= form_hidden("nid", $edit[nid]); if (!$edit) { $form .= form_submit(t("Preview")); -- cgit v1.2.3