Commit a0deb476 authored by Kjartan's avatar Kjartan

- Changed _nodeapi("conf") to _nodeapi("settings").

- Changed node settings page to use table().
- Minor code beautification here and there.
parent b0859dcb
......@@ -216,7 +216,7 @@ function table_cell($cell, $header = 0) {
function table($header, $rows) {
$output .= "<table>\n";
$output = "<table>\n";
/*
** Emit the table header:
......
......@@ -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":
......
......@@ -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":
......
......@@ -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));
......
......@@ -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));
......
......@@ -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":
......
......@@ -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];
}
......
......@@ -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];
}
......
......@@ -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");
......
......@@ -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");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment