summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
Diffstat (limited to 'modules')
-rw-r--r--modules/account.module14
-rw-r--r--modules/book.module33
-rw-r--r--modules/book/book.module33
-rw-r--r--modules/conf.module2
-rw-r--r--modules/meta.module6
-rw-r--r--modules/node.module72
-rw-r--r--modules/node/node.module72
-rw-r--r--modules/story.module4
-rw-r--r--modules/story/story.module4
-rw-r--r--modules/watchdog.module2
-rw-r--r--modules/watchdog/watchdog.module2
11 files changed, 157 insertions, 87 deletions
diff --git a/modules/account.module b/modules/account.module
index 3ef4632e3..fe654f5a6 100644
--- a/modules/account.module
+++ b/modules/account.module
@@ -169,36 +169,36 @@ function account_save($edit, &$name) {
}
}
db_query("UPDATE users SET $query access = '' WHERE userid = '$name'");
-
+
if ($edit[access]) {
foreach ($edit[access] as $key=>$value) {
$account = user_load($name);
db_query("UPDATE users SET access = '". field_set($account->access, $value, 1) ."' WHERE id = $account->id");
}
}
-
+
watchdog("account", "account: modified user '$name'");
}
else {
$edit[userid] = trim($edit[userid]);
$edit[real_email] = trim($edit[real_email]);
$edit[name] = $edit[realname];
-
+
if ($error = account_validate($edit)) {
return $error;
}
else {
$edit[passwd] = account_password();
$edit[hash] = substr(md5("$edit[userid]. ". time()), 0, 12);
-
+
$user = user_save("", array("userid" => $edit[userid], "real_email" => $edit[real_email], "passwd" => $edit[passwd], "status" => 1, "hash" => $edit[hash]));
-
+
$link = path_uri() ."account.php?op=confirm&name=$edit[userid]&hash=$edit[hash]";
$subject = strtr(t("Account details for %a"), array("%a" => variable_get(site_name, "drupal")));
$message = strtr(t("%a,\n\n\nsomeone signed up for a user account on %b and supplied this e-mail address as their contact. If it wasn't you, don't get your panties in a knot and simply ignore this mail. If this was you, you will have to confirm your account first or you will not be able to login. To confirm your account visit the URL below:\n\n %c\n\nOnce confirmed you can login using the following username and password:\n\n username: %a\n password: %d\n\n\n-- %b team\n"), array("%a" => $edit[userid], "%b" => variable_get(site_name, "drupal"), "%c" => $link, "%d" => $edit[passwd]));
-
+
watchdog("account", "new account: `$edit[userid]' <$edit[real_email]>");
-
+
mail($edit[real_email], $subject, $message, "From: noreply");
$name = $edit[userid];
}
diff --git a/modules/book.module b/modules/book.module
index 8d226800d..87e6bff58 100644
--- a/modules/book.module
+++ b/modules/book.module
@@ -116,10 +116,8 @@ function book_form($edit = array()) {
$form .= form_hidden(userid, $edit[userid]);
$form .= form_textfield(t("Subject"), "title", $edit[title], 50, 64);
- if ($edit[pid]) {
- $node = node_get_object(array("nid" => $edit[pid]));
- $form .= form_item(t("Parent"), "<A HREF=\"node.php?id=$node->id\">". check_output($node->title) ."</A>", t("The parent subject or category the page belongs in."));
- $form .= form_hidden("parent", $edit[parent]);
+ if ($edit[pid] > 0) {
+ $form .= form_hidden("pid", $edit[pid]);
}
else {
$form .= form_select(t("Parent"), "parent", $edit[parent], book_toc(), t("The parent subject or category the page belongs in."));
@@ -133,11 +131,10 @@ function book_form($edit = array()) {
}
if ($edit[nid] > 0) {
- $form .= form_hidden("pid", $edit[pid]);
$form .= form_hidden("nid", $edit[nid]);
}
- if (!$edit[title]) {
+ if ($edit && !$edit[title]) {
$form .= "<FONT COLOR=\"red\">". t("Warning: you did not supply a title.") ."</FONT><P>\n";
$form .= form_submit(t("Preview"));
}
@@ -153,13 +150,31 @@ function book_save($edit) {
global $status, $user;
if (!$edit[nid]) {
- node_save($edit, array(author => $user->id, body, comment => variable_get("book_comment", 0), log, moderate => variable_get("book_moderate", ""), parent, promote => variable_get("book_promote", 0), score => 0, status => variable_get("book_status", $status[queued]), timestamp => time(), title, type => "book", votes => 0, weight));
+ node_save($edit, array(author => $user->id, body, comment => variable_get("book_comment", 0), log, moderate => variable_get("book_moderate", ""), parent, pid, promote => variable_get("book_promote", 0), score => 0, status => variable_get("book_status", $status[queued]), timestamp => time(), title, type => "book", votes => 0, weight));
}
else if (user_access($user)) {
node_save($edit, array(body, log, parent, title, type => "book", weight));
}
}
+function book_delete($node) {
+ if ($node->pid && $node->status == node_status("posted")) {
+ db_query("UPDATE node SET status = '". node_status("posted") ."' WHERE nid = '$node->pid'");
+ }
+}
+
+function book_insert($node) {
+ if ($node->pid && $node->status == node_status("posted")) {
+ db_query("UPDATE node SET status = '". node_status("expired") ."' WHERE nid = '$node->pid'");
+ }
+}
+
+function book_update($node) {
+ if ($node->pid && $node->status == node_status("posted")) {
+ db_query("UPDATE node SET status = '". node_status("expired") ."' WHERE nid = '$node->pid'");
+ }
+}
+
function book_parent($nid) {
global $status;
if ($node = node_get_object(array("nid" => $nid))) {
@@ -206,7 +221,7 @@ function book_page() {
$theme->footer();
}
-function book_update($id) {
+function book_edit($id) {
global $status;
if ($node = node_get_object(array("nid" => $id))) {
@@ -229,7 +244,7 @@ function book_user() {
switch($op) {
case "update":
- $theme->box($title, book_update($id));
+ $theme->box($title, book_edit($id));
break;
case t("Preview"):
$theme->box($title, book_form($edit));
diff --git a/modules/book/book.module b/modules/book/book.module
index 8d226800d..87e6bff58 100644
--- a/modules/book/book.module
+++ b/modules/book/book.module
@@ -116,10 +116,8 @@ function book_form($edit = array()) {
$form .= form_hidden(userid, $edit[userid]);
$form .= form_textfield(t("Subject"), "title", $edit[title], 50, 64);
- if ($edit[pid]) {
- $node = node_get_object(array("nid" => $edit[pid]));
- $form .= form_item(t("Parent"), "<A HREF=\"node.php?id=$node->id\">". check_output($node->title) ."</A>", t("The parent subject or category the page belongs in."));
- $form .= form_hidden("parent", $edit[parent]);
+ if ($edit[pid] > 0) {
+ $form .= form_hidden("pid", $edit[pid]);
}
else {
$form .= form_select(t("Parent"), "parent", $edit[parent], book_toc(), t("The parent subject or category the page belongs in."));
@@ -133,11 +131,10 @@ function book_form($edit = array()) {
}
if ($edit[nid] > 0) {
- $form .= form_hidden("pid", $edit[pid]);
$form .= form_hidden("nid", $edit[nid]);
}
- if (!$edit[title]) {
+ if ($edit && !$edit[title]) {
$form .= "<FONT COLOR=\"red\">". t("Warning: you did not supply a title.") ."</FONT><P>\n";
$form .= form_submit(t("Preview"));
}
@@ -153,13 +150,31 @@ function book_save($edit) {
global $status, $user;
if (!$edit[nid]) {
- node_save($edit, array(author => $user->id, body, comment => variable_get("book_comment", 0), log, moderate => variable_get("book_moderate", ""), parent, promote => variable_get("book_promote", 0), score => 0, status => variable_get("book_status", $status[queued]), timestamp => time(), title, type => "book", votes => 0, weight));
+ node_save($edit, array(author => $user->id, body, comment => variable_get("book_comment", 0), log, moderate => variable_get("book_moderate", ""), parent, pid, promote => variable_get("book_promote", 0), score => 0, status => variable_get("book_status", $status[queued]), timestamp => time(), title, type => "book", votes => 0, weight));
}
else if (user_access($user)) {
node_save($edit, array(body, log, parent, title, type => "book", weight));
}
}
+function book_delete($node) {
+ if ($node->pid && $node->status == node_status("posted")) {
+ db_query("UPDATE node SET status = '". node_status("posted") ."' WHERE nid = '$node->pid'");
+ }
+}
+
+function book_insert($node) {
+ if ($node->pid && $node->status == node_status("posted")) {
+ db_query("UPDATE node SET status = '". node_status("expired") ."' WHERE nid = '$node->pid'");
+ }
+}
+
+function book_update($node) {
+ if ($node->pid && $node->status == node_status("posted")) {
+ db_query("UPDATE node SET status = '". node_status("expired") ."' WHERE nid = '$node->pid'");
+ }
+}
+
function book_parent($nid) {
global $status;
if ($node = node_get_object(array("nid" => $nid))) {
@@ -206,7 +221,7 @@ function book_page() {
$theme->footer();
}
-function book_update($id) {
+function book_edit($id) {
global $status;
if ($node = node_get_object(array("nid" => $id))) {
@@ -229,7 +244,7 @@ function book_user() {
switch($op) {
case "update":
- $theme->box($title, book_update($id));
+ $theme->box($title, book_edit($id));
break;
case t("Preview"):
$theme->box($title, book_form($edit));
diff --git a/modules/conf.module b/modules/conf.module
index fc5055683..340308c90 100644
--- a/modules/conf.module
+++ b/modules/conf.module
@@ -31,7 +31,7 @@ function conf_view_system() {
// node settings:
$output .= "<H3>Node settings</H3>\n";
- $output .= form_select(t("Default number of nodes to display"), "default_nodes_main", variable_get("default_nodes_main", 10), array(10 => 10, 15 => 15, 20 => 20, 25 => 25, 30 => 30), t("The default maximum number of nodes to display on the main page."));
+ $output .= form_select(t("Default number of nodes to display"), "default_nodes_main", variable_get("default_nodes_main", 10), array(1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5, 6 => 6, 7 => 7, 8 => 8, 9 => 9, 10 => 10, 15 => 15, 20 => 20, 25 => 25, 30 => 30), t("The default maximum number of nodes to display on the main page."));
$output .= "<HR>\n";
// comment settings:
diff --git a/modules/meta.module b/modules/meta.module
index 8ff9640d8..32af339e7 100644
--- a/modules/meta.module
+++ b/modules/meta.module
@@ -22,7 +22,7 @@ function meta_form($type, $edit = array()) {
function meta_save($type, $edit = array()) {
$result = db_query("SELECT * FROM collection WHERE types LIKE '%". check_input($type) ."%'");
while ($collection = db_fetch_object($result)) {
- $output = field_merge($output, $edit[$collection->name]);
+ $output .= ", ". $edit[$collection->name];
}
return $output;
}
@@ -54,8 +54,8 @@ function meta_form_tag($edit = array()) {
global $REQUEST_URI;
$form .= form_textfield("Meta-tag name", "name", $edit[name], 50, 64, "Required. The name for this meta-tag. Example: 'Apache'.");
- $form .= form_textfield("Attributes", "attributes", $edit[attributes], 50, 64, htmlentities("Required. Format: <type>=<value>,<type>=<value>;. Example: 'software=apache,type=webserver,os=linux,'."));
- $form .= form_textfield("Collections", "collections", $edit[collections], 50, 64, "Required. A comma-seperated list of collections you want to associate this meta-tag with. Example: 'Software, Internet'");
+ $form .= form_textfield("Attributes", "attributes", $edit[attributes], 50, 64, "Required. A comma-seperated list of keywords you want to associate this meta-tag with. Example: 'Computers, Software, Webservers'.");
+ $form .= form_textfield("Collections", "collections", $edit[collections], 50, 64, "Required. A comma-seperated list of collections you want to associate this meta-tag with. Example: 'Section'.");
$form .= form_submit("Submit");
if ($edit[tid]) {
diff --git a/modules/node.module b/modules/node.module
index 0d53b94ec..5a68ec7dd 100644
--- a/modules/node.module
+++ b/modules/node.module
@@ -60,6 +60,18 @@ function node_cron() {
db_query("UPDATE node SET status = '". node_status("dumped") ."', timestamp_posted = '' WHERE timestamp_hidden > 0 AND timestamp_hidden < ". time());
}
+function node_link($nid, $type) {
+ global $op;
+
+ $link[] = ($op == "view") ? "view node" : "<A HREF=\"node.php?id$nid\">view node</A>";
+ $link[] = ($op == "content") ? "edit content" : "<A HREF=\"admin.php?mod=node&type=$type&op=content&id=$nid\">edit content</A>";
+ $link[] = ($op == "option") ? "edit options" : "<A HREF=\"admin.php?mod=node&op=option&id=$nid\">edit options</A>";
+ $link[] = ($op == "status") ? "edit status" : "<A HREF=\"admin.php?mod=node&op=status&id=$nid\">edit status</A>";
+ $link[] = ($op == "attribute") ? "edit attribute" : "<A HREF=\"admin.php?mod=node&op=attribute&id=$nid\">edit attributes</A>";
+ $link[] = ($op == "delete") ? "delete node" : "<A HREF=\"admin.php?mod=node&op=delete&id=$nid\">delete node</A>";
+ return $link;
+}
+
function node_overview($query) {
global $user;
@@ -73,18 +85,10 @@ function node_overview($query) {
$output .= " <TR><TH>title</TH><TH>type</TH><TH>status</TH><TH>meta attributes</TH><TH>author</TH><TH>date</TH></TR>\n";
while ($node = db_fetch_object($result)) {
- unset ($link);
-
- $link[] = "<A HREF=\"admin.php?mod=node&type=$node->type&op=edit&id=$node->nid\">edit content</A>";
- $link[] = "<A HREF=\"admin.php?mod=node&op=option&id=$node->nid\">edit options</A>";
- $link[] = "<A HREF=\"admin.php?mod=node&op=status&id=$node->nid\">edit status</A>";
- $link[] = "<A HREF=\"admin.php?mod=node&op=attribute&id=$node->nid\">edit attributes</A>";
- $link[] = "<A HREF=\"admin.php?mod=node&op=delete&id=$node->nid\">delete node</A>";
-
$bg = $color[$i++ % sizeof($color)];
$output .= " <TR BGCOLOR=\"$bg\"><TD><A HREF=\"node.php?id=$node->nid\">". check_output($node->title) ."</A></TD><TD ALIGN=\"center\">$node->type</TD><TD>". node_status($node->status) ."</TD><TD>". check_output($node->attributes) ."</TD><TD>". format_username($node->userid) ."</TD><TD>". format_date($node->timestamp, "small") ."</TD></TR>\n";
- $output .= " <TR BGCOLOR=\"$bg\"><TD ALIGN=\"right\" COLSPAN=\"6\"><SMALL>". implode(", ", $link) ."</SMALL></TD>\n";
+ $output .= " <TR BGCOLOR=\"$bg\"><TD ALIGN=\"right\" COLSPAN=\"6\"><SMALL>". implode(", ", node_link($node->nid, $node->type)) ."</SMALL></TD>\n";
}
$output .= "</TABLE>\n";
@@ -96,9 +100,10 @@ function node_edit_option($id) {
$node = node_get_object(array("nid" => $id));
- $form .= form_item("Document title", check_output($node->title));
- $form .= form_select("Comment", "comment", $node->comment, node_comment_status(), "Allow users to post comments to this document.");
- $form .= form_select("Promote", "promote", $node->promote, node_promote_status(), "Promote this document on the main page.");
+ $form .= form_item("Title", check_output($node->title));
+ $form .= form_item("Operations", implode("<br />", node_link($node->nid, $node->type)));
+ $form .= form_select("Comment", "comment", $node->comment, node_comment_status(), "Allow users to post comments to this node.");
+ $form .= form_select("Promote", "promote", $node->promote, node_promote_status(), "Promote this node on the main page.");
$form .= form_textfield("Moderate", "moderate", $node->moderate, 35, 255, t("A comma-seperated list of the moderators their usernames."));
$form .= form_hidden("nid", $node->nid);
$form .= form_submit("Save node");
@@ -111,8 +116,9 @@ function node_edit_attribute($id) {
$node = node_get_object(array("nid" => $id));
- $form .= form_item("Document title", check_output($node->title));
- $form .= form_textfield("Attributes", "attributes", $node->attributes, 50, 128, htmlentities("A list meta attributes. Format: <type>:<value>;<type>:<value>;. Example: 'software=apache,type=webserver,os=linux,'."));
+ $form .= form_item("Title", check_output($node->title));
+ $form .= form_item("Operations", implode("<br />", node_link($node->nid, $node->type)));
+ $form .= form_textfield("Attributes", "attributes", $node->attributes, 64, 128, "A comma-seperated list of attributes. Example: 'Software, Webserver, Apache'.");
$form .= form_hidden("nid", $node->nid);
$form .= form_submit("Save node");
@@ -124,7 +130,8 @@ function node_edit_status($id) {
$node = node_get_object(array("nid" => $id));
- $form .= form_item("Document title", check_output($node->title));
+ $form .= form_item("Title", check_output($node->title));
+ $form .= form_item("Operations", implode("<br />", node_link($node->nid, $node->type)));
$form .= form_select("Current status", "status", $node->status, node_status($node->type));
$form .= form_textfield("Automatically post document", "timestamp_posted", ($node->timestamp_posted ? format_date($node->timestamp_posted) : ""), 30, 55, "The date at which your document will be automatically posted. Leave empty if you don't want to schedule this document, or fill out a string containing an English date format. Example input: '". date("j F Y G:i") ."', '". date("m/d/y H:i") ."', '". date("F j, Y H:i") ."', ...");
$form .= form_textfield("Automatically queue document", "timestamp_queued", ($node->timestamp_queued ? format_date($node->timestamp_queued) : ""), 30, 55, "The date at which your document will be automatically queued. Leave empty if you don't want to schedule this document, or fill out a string containing an English date format. Example input: '". date("j F Y G:i") ."', '". date("m/d/y H:i") ."', '". date("F j, Y H:i") ."', ...");
@@ -135,8 +142,18 @@ function node_edit_status($id) {
return form($REQUEST_URI, $form);
}
+function node_edit_content($edit, $type) {
+ $edit[type] = $type;
+ return node_invoke($edit, "form");
+}
+
+function node_save_content($edit, $type) {
+ $edit[type] = $type;
+ return node_invoke($edit, "save");
+}
+
function node_delete($id) {
- return (node_del(array("nid" => $id)) ? "node has been deleted." : "failed to delete node: node must be dumped first.");
+ return (node_del(array("nid" => $id)) ? "node has been deleted." : "failed to delete node: set node status to 'dumped' first.");
}
function node_query($type = -1) {
@@ -230,14 +247,11 @@ function node_module_find() {
return $output;
}
-function node_module_edit($edit, $type) {
- $edit[type] = $type;
- return node_invoke($edit, "form");
-}
-function node_module_save($edit, $type) {
- $edit[type] = $type;
- return node_invoke($edit, "save");
+function node_edit($node) {
+ $output .= form_item("Title", $node->title);
+ $output .= form_item("Operations", implode("<br />", node_link($node->nid, $node->type)));
+ return $output;
}
function node_admin() {
@@ -273,6 +287,9 @@ function node_admin() {
case "attribute":
print node_edit_attribute($id);
break;
+ case "content":
+ print node_edit_content(node_get_array(array("nid" => $id)), $type);
+ break;
case "default":
print node_setting();
break;
@@ -296,13 +313,16 @@ function node_admin() {
print node_overview($query);
break;
case "edit":
- print node_module_edit(node_get_array(array("nid" => $id)), $type);
+ print node_edit(node_get_object(array("nid" => $id)));
+ break;
+ case "view":
+ print node_module_view(node_get_array(array("nid" => $id)), $type);
break;
case "Preview":
- print node_module_edit($edit, $type);
+ print node_edit_content($edit, $type);
break;
case "Submit":
- print status(node_module_save($edit, $type));
+ print status(node_save_content($edit, $type));
// fall through:
default:
print node_overview($query);
diff --git a/modules/node/node.module b/modules/node/node.module
index 0d53b94ec..5a68ec7dd 100644
--- a/modules/node/node.module
+++ b/modules/node/node.module
@@ -60,6 +60,18 @@ function node_cron() {
db_query("UPDATE node SET status = '". node_status("dumped") ."', timestamp_posted = '' WHERE timestamp_hidden > 0 AND timestamp_hidden < ". time());
}
+function node_link($nid, $type) {
+ global $op;
+
+ $link[] = ($op == "view") ? "view node" : "<A HREF=\"node.php?id$nid\">view node</A>";
+ $link[] = ($op == "content") ? "edit content" : "<A HREF=\"admin.php?mod=node&type=$type&op=content&id=$nid\">edit content</A>";
+ $link[] = ($op == "option") ? "edit options" : "<A HREF=\"admin.php?mod=node&op=option&id=$nid\">edit options</A>";
+ $link[] = ($op == "status") ? "edit status" : "<A HREF=\"admin.php?mod=node&op=status&id=$nid\">edit status</A>";
+ $link[] = ($op == "attribute") ? "edit attribute" : "<A HREF=\"admin.php?mod=node&op=attribute&id=$nid\">edit attributes</A>";
+ $link[] = ($op == "delete") ? "delete node" : "<A HREF=\"admin.php?mod=node&op=delete&id=$nid\">delete node</A>";
+ return $link;
+}
+
function node_overview($query) {
global $user;
@@ -73,18 +85,10 @@ function node_overview($query) {
$output .= " <TR><TH>title</TH><TH>type</TH><TH>status</TH><TH>meta attributes</TH><TH>author</TH><TH>date</TH></TR>\n";
while ($node = db_fetch_object($result)) {
- unset ($link);
-
- $link[] = "<A HREF=\"admin.php?mod=node&type=$node->type&op=edit&id=$node->nid\">edit content</A>";
- $link[] = "<A HREF=\"admin.php?mod=node&op=option&id=$node->nid\">edit options</A>";
- $link[] = "<A HREF=\"admin.php?mod=node&op=status&id=$node->nid\">edit status</A>";
- $link[] = "<A HREF=\"admin.php?mod=node&op=attribute&id=$node->nid\">edit attributes</A>";
- $link[] = "<A HREF=\"admin.php?mod=node&op=delete&id=$node->nid\">delete node</A>";
-
$bg = $color[$i++ % sizeof($color)];
$output .= " <TR BGCOLOR=\"$bg\"><TD><A HREF=\"node.php?id=$node->nid\">". check_output($node->title) ."</A></TD><TD ALIGN=\"center\">$node->type</TD><TD>". node_status($node->status) ."</TD><TD>". check_output($node->attributes) ."</TD><TD>". format_username($node->userid) ."</TD><TD>". format_date($node->timestamp, "small") ."</TD></TR>\n";
- $output .= " <TR BGCOLOR=\"$bg\"><TD ALIGN=\"right\" COLSPAN=\"6\"><SMALL>". implode(", ", $link) ."</SMALL></TD>\n";
+ $output .= " <TR BGCOLOR=\"$bg\"><TD ALIGN=\"right\" COLSPAN=\"6\"><SMALL>". implode(", ", node_link($node->nid, $node->type)) ."</SMALL></TD>\n";
}
$output .= "</TABLE>\n";
@@ -96,9 +100,10 @@ function node_edit_option($id) {
$node = node_get_object(array("nid" => $id));
- $form .= form_item("Document title", check_output($node->title));
- $form .= form_select("Comment", "comment", $node->comment, node_comment_status(), "Allow users to post comments to this document.");
- $form .= form_select("Promote", "promote", $node->promote, node_promote_status(), "Promote this document on the main page.");
+ $form .= form_item("Title", check_output($node->title));
+ $form .= form_item("Operations", implode("<br />", node_link($node->nid, $node->type)));
+ $form .= form_select("Comment", "comment", $node->comment, node_comment_status(), "Allow users to post comments to this node.");
+ $form .= form_select("Promote", "promote", $node->promote, node_promote_status(), "Promote this node on the main page.");
$form .= form_textfield("Moderate", "moderate", $node->moderate, 35, 255, t("A comma-seperated list of the moderators their usernames."));
$form .= form_hidden("nid", $node->nid);
$form .= form_submit("Save node");
@@ -111,8 +116,9 @@ function node_edit_attribute($id) {
$node = node_get_object(array("nid" => $id));
- $form .= form_item("Document title", check_output($node->title));
- $form .= form_textfield("Attributes", "attributes", $node->attributes, 50, 128, htmlentities("A list meta attributes. Format: <type>:<value>;<type>:<value>;. Example: 'software=apache,type=webserver,os=linux,'."));
+ $form .= form_item("Title", check_output($node->title));
+ $form .= form_item("Operations", implode("<br />", node_link($node->nid, $node->type)));
+ $form .= form_textfield("Attributes", "attributes", $node->attributes, 64, 128, "A comma-seperated list of attributes. Example: 'Software, Webserver, Apache'.");
$form .= form_hidden("nid", $node->nid);
$form .= form_submit("Save node");
@@ -124,7 +130,8 @@ function node_edit_status($id) {
$node = node_get_object(array("nid" => $id));
- $form .= form_item("Document title", check_output($node->title));
+ $form .= form_item("Title", check_output($node->title));
+ $form .= form_item("Operations", implode("<br />", node_link($node->nid, $node->type)));
$form .= form_select("Current status", "status", $node->status, node_status($node->type));
$form .= form_textfield("Automatically post document", "timestamp_posted", ($node->timestamp_posted ? format_date($node->timestamp_posted) : ""), 30, 55, "The date at which your document will be automatically posted. Leave empty if you don't want to schedule this document, or fill out a string containing an English date format. Example input: '". date("j F Y G:i") ."', '". date("m/d/y H:i") ."', '". date("F j, Y H:i") ."', ...");
$form .= form_textfield("Automatically queue document", "timestamp_queued", ($node->timestamp_queued ? format_date($node->timestamp_queued) : ""), 30, 55, "The date at which your document will be automatically queued. Leave empty if you don't want to schedule this document, or fill out a string containing an English date format. Example input: '". date("j F Y G:i") ."', '". date("m/d/y H:i") ."', '". date("F j, Y H:i") ."', ...");
@@ -135,8 +142,18 @@ function node_edit_status($id) {
return form($REQUEST_URI, $form);
}
+function node_edit_content($edit, $type) {
+ $edit[type] = $type;
+ return node_invoke($edit, "form");
+}
+
+function node_save_content($edit, $type) {
+ $edit[type] = $type;
+ return node_invoke($edit, "save");
+}
+
function node_delete($id) {
- return (node_del(array("nid" => $id)) ? "node has been deleted." : "failed to delete node: node must be dumped first.");
+ return (node_del(array("nid" => $id)) ? "node has been deleted." : "failed to delete node: set node status to 'dumped' first.");
}
function node_query($type = -1) {
@@ -230,14 +247,11 @@ function node_module_find() {
return $output;
}
-function node_module_edit($edit, $type) {
- $edit[type] = $type;
- return node_invoke($edit, "form");
-}
-function node_module_save($edit, $type) {
- $edit[type] = $type;
- return node_invoke($edit, "save");
+function node_edit($node) {
+ $output .= form_item("Title", $node->title);
+ $output .= form_item("Operations", implode("<br />", node_link($node->nid, $node->type)));
+ return $output;
}
function node_admin() {
@@ -273,6 +287,9 @@ function node_admin() {
case "attribute":
print node_edit_attribute($id);
break;
+ case "content":
+ print node_edit_content(node_get_array(array("nid" => $id)), $type);
+ break;
case "default":
print node_setting();
break;
@@ -296,13 +313,16 @@ function node_admin() {
print node_overview($query);
break;
case "edit":
- print node_module_edit(node_get_array(array("nid" => $id)), $type);
+ print node_edit(node_get_object(array("nid" => $id)));
+ break;
+ case "view":
+ print node_module_view(node_get_array(array("nid" => $id)), $type);
break;
case "Preview":
- print node_module_edit($edit, $type);
+ print node_edit_content($edit, $type);
break;
case "Submit":
- print status(node_module_save($edit, $type));
+ print status(node_save_content($edit, $type));
// fall through:
default:
print node_overview($query);
diff --git a/modules/story.module b/modules/story.module
index 527523985..ca9ff6946 100644
--- a/modules/story.module
+++ b/modules/story.module
@@ -53,11 +53,11 @@ function story_form($edit = array()) {
$form .= form_hidden("nid", $edit[nid]);
}
- if (!$edit[title]) {
+ if ($edit && !$edit[title]) {
$form .= "<FONT COLOR=\"red\">". t("Warning: you did not supply a subject.") ."</FONT><P>\n";
$form .= form_submit(t("Preview"));
}
- else if (!$edit[abstract]) {
+ else if ($edit && !$edit[abstract]) {
$form .= "<FONT COLOR=\"red\">". t("Warning: you did not supply an abstract.") ."</FONT><P>\n";
$form .= form_submit(t("Preview"));
}
diff --git a/modules/story/story.module b/modules/story/story.module
index 527523985..ca9ff6946 100644
--- a/modules/story/story.module
+++ b/modules/story/story.module
@@ -53,11 +53,11 @@ function story_form($edit = array()) {
$form .= form_hidden("nid", $edit[nid]);
}
- if (!$edit[title]) {
+ if ($edit && !$edit[title]) {
$form .= "<FONT COLOR=\"red\">". t("Warning: you did not supply a subject.") ."</FONT><P>\n";
$form .= form_submit(t("Preview"));
}
- else if (!$edit[abstract]) {
+ else if ($edit && !$edit[abstract]) {
$form .= "<FONT COLOR=\"red\">". t("Warning: you did not supply an abstract.") ."</FONT><P>\n";
$form .= form_submit(t("Preview"));
}
diff --git a/modules/watchdog.module b/modules/watchdog.module
index 8abe4dc3f..02c7c23ca 100644
--- a/modules/watchdog.module
+++ b/modules/watchdog.module
@@ -55,7 +55,7 @@ function watchdog_view($id) {
function watchdog_admin() {
global $op, $id, $type, $order;
- print "<SMALL><A HREF=\"admin.php?mod=watchdog&type=account\">account messages</A> | <A HREF=\"admin.php?mod=watchdog&type=message\">regular messages</A> | <A HREF=\"admin.php?mod=watchdog&type=special\">special messages</A> | <A HREF=\"admin.php?mod=watchdog&type=warning\">warning messages</A> | <A HREF=\"admin.php?mod=watchdog&type=error\">error messages</A> | <A HREF=\"admin.php?mod=watchdog&type=httpd\">httpd messages</A> | <A HREF=\"admin.php?mod=watchdog\">overview</A> | <A HREF=\"admin.php?mod=watchdog&op=help\">help</A></SMALL><HR>\n";
+ print "<SMALL><A HREF=\"admin.php?mod=watchdog&type=account\">account messages</A> | <A HREF=\"admin.php?mod=watchdog&type=regular\">regular messages</A> | <A HREF=\"admin.php?mod=watchdog&type=special\">special messages</A> | <A HREF=\"admin.php?mod=watchdog&type=warning\">warning messages</A> | <A HREF=\"admin.php?mod=watchdog&type=error\">error messages</A> | <A HREF=\"admin.php?mod=watchdog&type=httpd\">httpd messages</A> | <A HREF=\"admin.php?mod=watchdog\">overview</A> | <A HREF=\"admin.php?mod=watchdog&op=help\">help</A></SMALL><HR>\n";
switch ($op) {
case "help":
diff --git a/modules/watchdog/watchdog.module b/modules/watchdog/watchdog.module
index 8abe4dc3f..02c7c23ca 100644
--- a/modules/watchdog/watchdog.module
+++ b/modules/watchdog/watchdog.module
@@ -55,7 +55,7 @@ function watchdog_view($id) {
function watchdog_admin() {
global $op, $id, $type, $order;
- print "<SMALL><A HREF=\"admin.php?mod=watchdog&type=account\">account messages</A> | <A HREF=\"admin.php?mod=watchdog&type=message\">regular messages</A> | <A HREF=\"admin.php?mod=watchdog&type=special\">special messages</A> | <A HREF=\"admin.php?mod=watchdog&type=warning\">warning messages</A> | <A HREF=\"admin.php?mod=watchdog&type=error\">error messages</A> | <A HREF=\"admin.php?mod=watchdog&type=httpd\">httpd messages</A> | <A HREF=\"admin.php?mod=watchdog\">overview</A> | <A HREF=\"admin.php?mod=watchdog&op=help\">help</A></SMALL><HR>\n";
+ print "<SMALL><A HREF=\"admin.php?mod=watchdog&type=account\">account messages</A> | <A HREF=\"admin.php?mod=watchdog&type=regular\">regular messages</A> | <A HREF=\"admin.php?mod=watchdog&type=special\">special messages</A> | <A HREF=\"admin.php?mod=watchdog&type=warning\">warning messages</A> | <A HREF=\"admin.php?mod=watchdog&type=error\">error messages</A> | <A HREF=\"admin.php?mod=watchdog&type=httpd\">httpd messages</A> | <A HREF=\"admin.php?mod=watchdog\">overview</A> | <A HREF=\"admin.php?mod=watchdog&op=help\">help</A></SMALL><HR>\n";
switch ($op) {
case "help":