diff options
author | Kjartan Mannes <kjartan@2.no-reply.drupal.org> | 2003-03-08 14:35:42 +0000 |
---|---|---|
committer | Kjartan Mannes <kjartan@2.no-reply.drupal.org> | 2003-03-08 14:35:42 +0000 |
commit | a0deb476faf8d35794c8e1286037ced22959bd07 (patch) | |
tree | 1ea62b601ba7538fd5ac19bae3e38ed367faffce /modules | |
parent | b0859dcbd4f3b9b73ca8e43b73a248f17d81a80c (diff) | |
download | brdo-a0deb476faf8d35794c8e1286037ced22959bd07.tar.gz brdo-a0deb476faf8d35794c8e1286037ced22959bd07.tar.bz2 |
- Changed _nodeapi("conf") to _nodeapi("settings").
- Changed node settings page to use table().
- Minor code beautification here and there.
Diffstat (limited to 'modules')
-rw-r--r-- | modules/comment.module | 2 | ||||
-rw-r--r-- | modules/comment/comment.module | 2 | ||||
-rw-r--r-- | modules/node.module | 36 | ||||
-rw-r--r-- | modules/node/node.module | 36 | ||||
-rw-r--r-- | modules/queue.module | 2 | ||||
-rw-r--r-- | modules/story.module | 1 | ||||
-rw-r--r-- | modules/story/story.module | 1 | ||||
-rw-r--r-- | modules/system.module | 2 | ||||
-rw-r--r-- | modules/system/system.module | 2 |
9 files changed, 57 insertions, 27 deletions
diff --git a/modules/comment.module b/modules/comment.module index c6182d09f..aa018de76 100644 --- a/modules/comment.module +++ b/modules/comment.module @@ -1491,7 +1491,7 @@ function comment_update_index() { function comment_nodeapi(&$node, $op, $arg = 0) { switch ($op) { - case "conf": + case "settings": $output[t("Comment")] = form_select("", "comment_$node->type", variable_get("comment_$node->type", 2), array("Disabled", "Read only", "Read/Write")); return $output; case "fields": diff --git a/modules/comment/comment.module b/modules/comment/comment.module index c6182d09f..aa018de76 100644 --- a/modules/comment/comment.module +++ b/modules/comment/comment.module @@ -1491,7 +1491,7 @@ function comment_update_index() { function comment_nodeapi(&$node, $op, $arg = 0) { switch ($op) { - case "conf": + case "settings": $output[t("Comment")] = form_select("", "comment_$node->type", variable_get("comment_$node->type", 2), array("Disabled", "Read only", "Read/Write")); return $output; case "fields": diff --git a/modules/node.module b/modules/node.module index e8a583c55..1c7101039 100644 --- a/modules/node.module +++ b/modules/node.module @@ -548,22 +548,38 @@ function node_admin_settings($edit) { } } - $output = "<h3>" . t("Content settings") . "</h3>\n"; + $header = array_merge(array(t("Node")), array_keys(node_invoke_all($node, "nodeapi", "settings"))); + foreach (module_list() as $name) { + if (module_hook($name, "node")) { + $node->type = $name; + $cols = array(); + foreach (node_invoke_all($node, "nodeapi", "settings") as $setting) { + $cols[] = array("data" => $setting, "align" => "center", "width" => 55); + } + $rows[] = array_merge(array(module_invoke($name, "node", "name")), $cols); + } + } - $output .= "<table border=\"1\" cellpadding=\"2\" cellspacing=\"2\">\n"; - $output .= "<tr><th>". t("Node") ."</th><th>\n"; - $output .= implode("</th><th>", array_keys(node_invoke_all($node, "nodeapi", "conf"))); - $output .= "</th></tr>\n"; + $output = table($header, $rows); + /* This is an idea for the future. foreach (module_list() as $name) { if (module_hook($name, "node")) { $node->type = $name; - $output .= "<tr><td><p>$name</p></td><td align=\"center\">"; - $output .= implode("</td><td align=\"center\">", node_invoke_all($node, "nodeapi", "conf")); - $output .= "</td></tr>\n"; + + // Create table() data: + $header = array_keys(node_invoke_all($node, "nodeapi", "settings")); + $cols = array(); + foreach (node_invoke_all($node, "nodeapi", "settings") as $setting) { + $cols[] = array("data" => $setting, "align" => "center", "width" => 75); + } + + $output .= "<h2>". module_invoke($name, "node", "name") ."</h2>"; + $output .= table($header, array($cols)); + $output .= "<br /><br />"; } } - $output .= "</table><br />"; + */ $output .= form_submit(t("Save configuration")); $output .= form_submit(t("Reset to defaults")); @@ -1346,7 +1362,7 @@ function node_update_index() { function node_nodeapi(&$node, $op, $arg = 0) { switch ($op) { - case "conf": + 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)); diff --git a/modules/node/node.module b/modules/node/node.module index e8a583c55..1c7101039 100644 --- a/modules/node/node.module +++ b/modules/node/node.module @@ -548,22 +548,38 @@ function node_admin_settings($edit) { } } - $output = "<h3>" . t("Content settings") . "</h3>\n"; + $header = array_merge(array(t("Node")), array_keys(node_invoke_all($node, "nodeapi", "settings"))); + foreach (module_list() as $name) { + if (module_hook($name, "node")) { + $node->type = $name; + $cols = array(); + foreach (node_invoke_all($node, "nodeapi", "settings") as $setting) { + $cols[] = array("data" => $setting, "align" => "center", "width" => 55); + } + $rows[] = array_merge(array(module_invoke($name, "node", "name")), $cols); + } + } - $output .= "<table border=\"1\" cellpadding=\"2\" cellspacing=\"2\">\n"; - $output .= "<tr><th>". t("Node") ."</th><th>\n"; - $output .= implode("</th><th>", array_keys(node_invoke_all($node, "nodeapi", "conf"))); - $output .= "</th></tr>\n"; + $output = table($header, $rows); + /* This is an idea for the future. foreach (module_list() as $name) { if (module_hook($name, "node")) { $node->type = $name; - $output .= "<tr><td><p>$name</p></td><td align=\"center\">"; - $output .= implode("</td><td align=\"center\">", node_invoke_all($node, "nodeapi", "conf")); - $output .= "</td></tr>\n"; + + // Create table() data: + $header = array_keys(node_invoke_all($node, "nodeapi", "settings")); + $cols = array(); + foreach (node_invoke_all($node, "nodeapi", "settings") as $setting) { + $cols[] = array("data" => $setting, "align" => "center", "width" => 75); + } + + $output .= "<h2>". module_invoke($name, "node", "name") ."</h2>"; + $output .= table($header, array($cols)); + $output .= "<br /><br />"; } } - $output .= "</table><br />"; + */ $output .= form_submit(t("Save configuration")); $output .= form_submit(t("Reset to defaults")); @@ -1346,7 +1362,7 @@ function node_update_index() { function node_nodeapi(&$node, $op, $arg = 0) { switch ($op) { - case "conf": + 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)); diff --git a/modules/queue.module b/modules/queue.module index 9a538a9ab..3c57cbf64 100644 --- a/modules/queue.module +++ b/modules/queue.module @@ -221,7 +221,7 @@ function queue_block($op = "list", $delta = 0) { function queue_nodeapi(&$node, $op, $arg = 0) { switch ($op) { - case "conf": + case "settings": $output[t("Queue")] = form_checkbox("", "queue_$node->type", 1, variable_get("queue_$node->type", 0)); return $output; case "fields": diff --git a/modules/story.module b/modules/story.module index 4597d1f2c..163db2b4e 100644 --- a/modules/story.module +++ b/modules/story.module @@ -22,7 +22,6 @@ function story_settings() { function story_node($field) { $info["name"] = t("story"); $info["description"] = t("A story is a post that is submitted to the attention of other users and is queued in the submission queue. Users and moderators vote on the posts they like or dislike, promoting or demoting them. When a post gets above a certain threshold it gets automatically published to front page."); - return $info[$field]; } diff --git a/modules/story/story.module b/modules/story/story.module index 4597d1f2c..163db2b4e 100644 --- a/modules/story/story.module +++ b/modules/story/story.module @@ -22,7 +22,6 @@ function story_settings() { function story_node($field) { $info["name"] = t("story"); $info["description"] = t("A story is a post that is submitted to the attention of other users and is queued in the submission queue. Users and moderators vote on the posts they like or dislike, promoting or demoting them. When a post gets above a certain threshold it gets automatically published to front page."); - return $info[$field]; } diff --git a/modules/system.module b/modules/system.module index 4c32056a4..2f351580d 100644 --- a/modules/system.module +++ b/modules/system.module @@ -318,7 +318,7 @@ function system_init() { } function system_admin() { - global $HTTP_POST_VARS, $system_init_status; + global $system_init_status; if (user_access("administer site configuration")) { session_register("system_init_status"); diff --git a/modules/system/system.module b/modules/system/system.module index 4c32056a4..2f351580d 100644 --- a/modules/system/system.module +++ b/modules/system/system.module @@ -318,7 +318,7 @@ function system_init() { } function system_admin() { - global $HTTP_POST_VARS, $system_init_status; + global $system_init_status; if (user_access("administer site configuration")) { session_register("system_init_status"); |