From 1421c878d16f7d88bcc85c0dfc4b7c006b267526 Mon Sep 17 00:00:00 2001
From: Kjartan Mannes <kjartan@2.no-reply.drupal.org>
Date: Sun, 9 Mar 2003 17:19:50 +0000
Subject: [PATCH] - Moved moderation logic back into node module.     * After
 having a chat with Dries we have agreed on the logics (or       more
 specifically he told me how its supposed to work). The queue       module is
 just a method to make moderation public, but its not       necessarily the
 only way. This brings the power back. - Minor interface tweaks (names, case
 changes, etc). - Fixed error that would show when you tried to view the
 profile of a   blocked user.

---
 modules/comment.module         |  2 +-
 modules/comment/comment.module |  2 +-
 modules/node.module            | 29 +++++++++++++++++------------
 modules/node/node.module       | 29 +++++++++++++++++------------
 modules/queue.module           | 14 +-------------
 modules/user.module            |  7 ++++---
 modules/user/user.module       |  7 ++++---
 7 files changed, 45 insertions(+), 45 deletions(-)

diff --git a/modules/comment.module b/modules/comment.module
index aa018de76326..1d7ec04a6cdf 100644
--- a/modules/comment.module
+++ b/modules/comment.module
@@ -1492,7 +1492,7 @@ function comment_update_index() {
 function comment_nodeapi(&$node, $op, $arg = 0) {
   switch ($op) {
     case "settings":
-      $output[t("Comment")] = form_select("", "comment_$node->type", variable_get("comment_$node->type", 2), array("Disabled", "Read only", "Read/Write"));
+      $output[t("comment")] = form_select("", "comment_$node->type", variable_get("comment_$node->type", 2), array("Disabled", "Read only", "Read/Write"));
       return $output;
     case "fields":
       return array("comment");
diff --git a/modules/comment/comment.module b/modules/comment/comment.module
index aa018de76326..1d7ec04a6cdf 100644
--- a/modules/comment/comment.module
+++ b/modules/comment/comment.module
@@ -1492,7 +1492,7 @@ function comment_update_index() {
 function comment_nodeapi(&$node, $op, $arg = 0) {
   switch ($op) {
     case "settings":
-      $output[t("Comment")] = form_select("", "comment_$node->type", variable_get("comment_$node->type", 2), array("Disabled", "Read only", "Read/Write"));
+      $output[t("comment")] = form_select("", "comment_$node->type", variable_get("comment_$node->type", 2), array("Disabled", "Read only", "Read/Write"));
       return $output;
     case "fields":
       return array("comment");
diff --git a/modules/node.module b/modules/node.module
index 1c71010396de..d8c3743b0f43 100644
--- a/modules/node.module
+++ b/modules/node.module
@@ -449,9 +449,10 @@ function node_link($type, $node = 0, $main = 0) {
   if ($type == "admin" && user_access("administer nodes")) {
     $help["search"] = "On this page you can search for a post.  For example, one may search for 'br' and Drupal might return 'bread brakers', 'our daily bread' and 'brenda'.";
 
-    menu("admin/node", "node management", "node_admin");
+    menu("admin/node", "content management", "node_admin");
     menu("admin/node/nodes", "post overview");
     menu("admin/node/nodes/0", "new or updated posts", "node_admin", NULL, 0);
+    menu("admin/node/nodes/1", "approval queue", "node_admin", NULL, 1);
     menu("admin/node/search", "search posts", "node_admin", $help["search"], 8);
     menu("admin/node/help", "help", "node_help", NULL, 9);
     menu("admin/node/edit", "edit node", "node_admin", NULL, 0, 1);
@@ -527,7 +528,7 @@ function node_admin_nodes() {
 
 function node_admin_settings($edit) {
   global $op;
-
+  
   if ($op == t("Save configuration")) {
     /*
     ** Save the configuration options:
@@ -536,6 +537,7 @@ function node_admin_settings($edit) {
     foreach ($edit as $name => $value) {
       variable_set($name, $value);
     }
+    $output = status(t("the content settings have been saved."));
   }
 
   if ($op == t("Reset to defaults")) {
@@ -546,9 +548,10 @@ function node_admin_settings($edit) {
     foreach ($edit as $name => $value) {
       variable_del($name);
     }
+    $output = status(t("the content settings have been reset to their default values."));
   }
 
-  $header = array_merge(array(t("Node")), array_keys(node_invoke_all($node, "nodeapi", "settings")));
+  $header = array_merge(array(t("content type")), array_keys(node_invoke_all($node, "nodeapi", "settings")));
   foreach (module_list() as $name) {
     if (module_hook($name, "node")) {
       $node->type = $name;
@@ -560,7 +563,7 @@ function node_admin_settings($edit) {
     }
   }
   
-  $output = table($header, $rows);
+  $output .= table($header, $rows);
 
   /* This is an idea for the future.
   foreach (module_list() as $name) {
@@ -584,7 +587,7 @@ function node_admin_settings($edit) {
   $output .= form_submit(t("Save configuration"));
   $output .= form_submit(t("Reset to defaults"));
   
-  return form($output);
+  print form($output);
 
 }
 
@@ -910,7 +913,7 @@ function node_form($edit, $error = NULL) {
   }
 
   // Prepend extra node form:
-  $form = implode("", node_invoke_all($edit, "nodeapi", "form.pre", $error));
+  $form = implode("", node_invoke_all($edit, "nodeapi", "form pre", $error));
 
   /*
   ** Get the node specific bits:
@@ -922,7 +925,7 @@ function node_form($edit, $error = NULL) {
   }
   
   // Append extra node form:
-  $form .= implode("", node_invoke_all($edit, "nodeapi", "form.post", $error));
+  $form .= implode("", node_invoke_all($edit, "nodeapi", "form post", $error));
 
   /*
   ** Add the help text:
@@ -995,6 +998,7 @@ function node_form($edit, $error = NULL) {
     $output .= "<br />";
     $output .= form_select(t("Set public/published"), "status", isset($edit->status) ? $edit->status : variable_get("node_status_$edit->type", 1), array(t("Disabled"), t("Enabled")));
     $output .= form_select(t("Promote to front page"), "promote", isset($edit->promote) ? $edit->promote : variable_get("node_promote_$edit->type", 1), array(t("Disabled"), t("Enabled")));
+    $output .= form_select(t("Moderation status"), "moderate", isset($node->moderate) ? $node->moderate : variable_get("node_moderate_$edit->type", 0), array(t("Approved"), t("Awaiting approval")));
     $output .= form_select(t("Static on front page"), "static", isset($edit->static) ? $edit->static : variable_get("node_static_$edit->type", 0), array(t("Disabled"), t("Enabled")));
     $output .= implode("", node_invoke_all($edit, "nodeapi", "form admin"));
     $output .= form_select(t("Create new revision"), "revision", isset($edit->revision) ? $edit->revision : variable_get("node_revision_$edit->type", 0), array(t("Disabled"), t("Enabled")));
@@ -1363,13 +1367,14 @@ function node_update_index() {
 function node_nodeapi(&$node, $op, $arg = 0) {
   switch ($op) {
     case "settings":
-      $output[t("Publish")] = form_checkbox("", "node_status_$node->type", 1, variable_get("node_status_$node->type", 1));
-      $output[t("Promote")] = form_checkbox("", "node_promote_$node->type", 1, variable_get("node_promote_$node->type", 1));
-      $output[t("Static")] = form_checkbox("", "node_static_$node->type", 1, variable_get("node_static_$node->type", 0));
-      $output[t("Revision")] = form_checkbox("", "node_revision_$node->type", 1, variable_get("node_revision_$node->type", 0));
+      $output[t("publish")] = form_checkbox("", "node_status_$node->type", 1, variable_get("node_status_$node->type", 1));
+      $output[t("promote")] = form_checkbox("", "node_promote_$node->type", 1, variable_get("node_promote_$node->type", 1));
+      $output[t("moderate")] = form_checkbox("", "node_moderate_$node->type", 1, variable_get("node_moderate_$node->type", 0));
+      $output[t("static")] = form_checkbox("", "node_static_$node->type", 1, variable_get("node_static_$node->type", 0));
+      $output[t("revision")] = form_checkbox("", "node_revision_$node->type", 1, variable_get("node_revision_$node->type", 0));
       return $output;
     case "fields":
-      return array("nid", "uid", "type", "title", "teaser", "body", "revisions", "status", "promote", "static", "created", "changed");
+      return array("nid", "uid", "type", "title", "teaser", "body", "revisions", "status", "promote", "moderate", "static", "created", "changed");
   }
 }
 
diff --git a/modules/node/node.module b/modules/node/node.module
index 1c71010396de..d8c3743b0f43 100644
--- a/modules/node/node.module
+++ b/modules/node/node.module
@@ -449,9 +449,10 @@ function node_link($type, $node = 0, $main = 0) {
   if ($type == "admin" && user_access("administer nodes")) {
     $help["search"] = "On this page you can search for a post.  For example, one may search for 'br' and Drupal might return 'bread brakers', 'our daily bread' and 'brenda'.";
 
-    menu("admin/node", "node management", "node_admin");
+    menu("admin/node", "content management", "node_admin");
     menu("admin/node/nodes", "post overview");
     menu("admin/node/nodes/0", "new or updated posts", "node_admin", NULL, 0);
+    menu("admin/node/nodes/1", "approval queue", "node_admin", NULL, 1);
     menu("admin/node/search", "search posts", "node_admin", $help["search"], 8);
     menu("admin/node/help", "help", "node_help", NULL, 9);
     menu("admin/node/edit", "edit node", "node_admin", NULL, 0, 1);
@@ -527,7 +528,7 @@ function node_admin_nodes() {
 
 function node_admin_settings($edit) {
   global $op;
-
+  
   if ($op == t("Save configuration")) {
     /*
     ** Save the configuration options:
@@ -536,6 +537,7 @@ function node_admin_settings($edit) {
     foreach ($edit as $name => $value) {
       variable_set($name, $value);
     }
+    $output = status(t("the content settings have been saved."));
   }
 
   if ($op == t("Reset to defaults")) {
@@ -546,9 +548,10 @@ function node_admin_settings($edit) {
     foreach ($edit as $name => $value) {
       variable_del($name);
     }
+    $output = status(t("the content settings have been reset to their default values."));
   }
 
-  $header = array_merge(array(t("Node")), array_keys(node_invoke_all($node, "nodeapi", "settings")));
+  $header = array_merge(array(t("content type")), array_keys(node_invoke_all($node, "nodeapi", "settings")));
   foreach (module_list() as $name) {
     if (module_hook($name, "node")) {
       $node->type = $name;
@@ -560,7 +563,7 @@ function node_admin_settings($edit) {
     }
   }
   
-  $output = table($header, $rows);
+  $output .= table($header, $rows);
 
   /* This is an idea for the future.
   foreach (module_list() as $name) {
@@ -584,7 +587,7 @@ function node_admin_settings($edit) {
   $output .= form_submit(t("Save configuration"));
   $output .= form_submit(t("Reset to defaults"));
   
-  return form($output);
+  print form($output);
 
 }
 
@@ -910,7 +913,7 @@ function node_form($edit, $error = NULL) {
   }
 
   // Prepend extra node form:
-  $form = implode("", node_invoke_all($edit, "nodeapi", "form.pre", $error));
+  $form = implode("", node_invoke_all($edit, "nodeapi", "form pre", $error));
 
   /*
   ** Get the node specific bits:
@@ -922,7 +925,7 @@ function node_form($edit, $error = NULL) {
   }
   
   // Append extra node form:
-  $form .= implode("", node_invoke_all($edit, "nodeapi", "form.post", $error));
+  $form .= implode("", node_invoke_all($edit, "nodeapi", "form post", $error));
 
   /*
   ** Add the help text:
@@ -995,6 +998,7 @@ function node_form($edit, $error = NULL) {
     $output .= "<br />";
     $output .= form_select(t("Set public/published"), "status", isset($edit->status) ? $edit->status : variable_get("node_status_$edit->type", 1), array(t("Disabled"), t("Enabled")));
     $output .= form_select(t("Promote to front page"), "promote", isset($edit->promote) ? $edit->promote : variable_get("node_promote_$edit->type", 1), array(t("Disabled"), t("Enabled")));
+    $output .= form_select(t("Moderation status"), "moderate", isset($node->moderate) ? $node->moderate : variable_get("node_moderate_$edit->type", 0), array(t("Approved"), t("Awaiting approval")));
     $output .= form_select(t("Static on front page"), "static", isset($edit->static) ? $edit->static : variable_get("node_static_$edit->type", 0), array(t("Disabled"), t("Enabled")));
     $output .= implode("", node_invoke_all($edit, "nodeapi", "form admin"));
     $output .= form_select(t("Create new revision"), "revision", isset($edit->revision) ? $edit->revision : variable_get("node_revision_$edit->type", 0), array(t("Disabled"), t("Enabled")));
@@ -1363,13 +1367,14 @@ function node_update_index() {
 function node_nodeapi(&$node, $op, $arg = 0) {
   switch ($op) {
     case "settings":
-      $output[t("Publish")] = form_checkbox("", "node_status_$node->type", 1, variable_get("node_status_$node->type", 1));
-      $output[t("Promote")] = form_checkbox("", "node_promote_$node->type", 1, variable_get("node_promote_$node->type", 1));
-      $output[t("Static")] = form_checkbox("", "node_static_$node->type", 1, variable_get("node_static_$node->type", 0));
-      $output[t("Revision")] = form_checkbox("", "node_revision_$node->type", 1, variable_get("node_revision_$node->type", 0));
+      $output[t("publish")] = form_checkbox("", "node_status_$node->type", 1, variable_get("node_status_$node->type", 1));
+      $output[t("promote")] = form_checkbox("", "node_promote_$node->type", 1, variable_get("node_promote_$node->type", 1));
+      $output[t("moderate")] = form_checkbox("", "node_moderate_$node->type", 1, variable_get("node_moderate_$node->type", 0));
+      $output[t("static")] = form_checkbox("", "node_static_$node->type", 1, variable_get("node_static_$node->type", 0));
+      $output[t("revision")] = form_checkbox("", "node_revision_$node->type", 1, variable_get("node_revision_$node->type", 0));
       return $output;
     case "fields":
-      return array("nid", "uid", "type", "title", "teaser", "body", "revisions", "status", "promote", "static", "created", "changed");
+      return array("nid", "uid", "type", "title", "teaser", "body", "revisions", "status", "promote", "moderate", "static", "created", "changed");
   }
 }
 
diff --git a/modules/queue.module b/modules/queue.module
index 3c57cbf64d9f..ad9506bedc8d 100644
--- a/modules/queue.module
+++ b/modules/queue.module
@@ -28,10 +28,6 @@ function queue_link($type) {
     $links[] = l(t("view submissions"), "queue", array("title" => t("Moderate the content in the submission queue."))) ." (<span style=\"color: red;\">". queue_count() ."</span>)";
   }
 
-  if ($type == "admin" && user_access("administer nodes")) {
-    menu("admin/node/nodes/1", "approval queue", "node_admin", NULL, 1);
-  }
-
   return $links ? $links : array();
 }
 
@@ -221,16 +217,8 @@ function queue_block($op = "list", $delta = 0) {
 
 function queue_nodeapi(&$node, $op, $arg = 0) {
   switch ($op) {
-    case "settings":
-      $output[t("Queue")] = form_checkbox("", "queue_$node->type", 1, variable_get("queue_$node->type", 0));
-      return $output;
     case "fields":
-      return array("moderate", "score", "users", "votes");
-    case "form admin":
-      if (user_access("administer moderation")) {
-        return form_select(t("Moderation status"), "moderate", isset($node->moderate) ? $node->moderate : variable_get("queue_$node->type", 0), array(t("Approved"), t("Awaiting approval")));
-      }
-      break;
+      return array("score", "users", "votes");
     case "validate":
       $node->promote = $node->moderate ? 0 : 1;
       if ($node->nid && $node->moderate) {
diff --git a/modules/user.module b/modules/user.module
index 425a8029c5ca..132b61db115a 100644
--- a/modules/user.module
+++ b/modules/user.module
@@ -1046,8 +1046,9 @@ function user_view($uid = 0) {
     theme("footer");
   }
   else {
+    $output = user_login();
     theme("header");
-    theme("box", t("Log in"), user_login());
+    theme("box", t("Log in"), $output);
     if (variable_get("user_register", 1)) {
       theme("box", t("Create new user account"), user_register());
     }
@@ -1500,10 +1501,10 @@ function user_admin_account() {
     $rows[] = array(format_name($account), format_date($account->timestamp, "small"), l(t("edit account"), "admin/user/edit/$account->uid"));
   }
 
-  if ($pager = pager_display(NULL, 50, 0, "admin")) {
+  $pager = pager_display(NULL, 50, 0, "admin");
+  if (!empty($pager)) {
     $rows[] = array(array("data" => $pager, "colspan" => 3));
   }
-
   return table($header, $rows);
 }
 
diff --git a/modules/user/user.module b/modules/user/user.module
index 425a8029c5ca..132b61db115a 100644
--- a/modules/user/user.module
+++ b/modules/user/user.module
@@ -1046,8 +1046,9 @@ function user_view($uid = 0) {
     theme("footer");
   }
   else {
+    $output = user_login();
     theme("header");
-    theme("box", t("Log in"), user_login());
+    theme("box", t("Log in"), $output);
     if (variable_get("user_register", 1)) {
       theme("box", t("Create new user account"), user_register());
     }
@@ -1500,10 +1501,10 @@ function user_admin_account() {
     $rows[] = array(format_name($account), format_date($account->timestamp, "small"), l(t("edit account"), "admin/user/edit/$account->uid"));
   }
 
-  if ($pager = pager_display(NULL, 50, 0, "admin")) {
+  $pager = pager_display(NULL, 50, 0, "admin");
+  if (!empty($pager)) {
     $rows[] = array(array("data" => $pager, "colspan" => 3));
   }
-
   return table($header, $rows);
 }
 
-- 
GitLab