summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2001-09-25 17:10:44 +0000
committerDries Buytaert <dries@buytaert.net>2001-09-25 17:10:44 +0000
commit9ef955b6e02fd9dbaef7d2c2b22b569447b4e913 (patch)
tree005b85140cf86c8b4adbad098ac76989a20456ef /modules
parent9792206895915a1c2073d408cc56f95d869eaf00 (diff)
downloadbrdo-9ef955b6e02fd9dbaef7d2c2b22b569447b4e913.tar.gz
brdo-9ef955b6e02fd9dbaef7d2c2b22b569447b4e913.tar.bz2
- bugfix #1: fixed the line that accidentically got cut off by incorrectly
applying a patch. Mea culpa. (reported by Axel) - bugfix #2: incorrect deactivation of the delete link in node_links(). (patch by Axel) - improvement: added confirmation page upon deletion of a node ("Do you really want to delete this node?"), and removed the old and confusing "node has to be blocked first". (patch by Axel)
Diffstat (limited to 'modules')
-rw-r--r--modules/node.module26
-rw-r--r--modules/node/node.module26
2 files changed, 44 insertions, 8 deletions
diff --git a/modules/node.module b/modules/node.module
index 428f3c4ba..c00522a8f 100644
--- a/modules/node.module
+++ b/modules/node.module
@@ -6,7 +6,7 @@ class Node {
$this->uid = $node[uid] ? $node[uid] : $user->uid;
$this->nid = $node[nid];
$this->type = $node[type];
- $this->comment = $node[comment] ? $node[comment] :
+ $this->comment = $node[comment] ? $node[comment] : variable_get($node[type]."_comment", 0);
$this->name = $node[name] ? $node[name] : $user->name;
$this->title = $node[title];
$this->attributes = $node[attributes];
@@ -36,6 +36,8 @@ function node_perm() {
function node_conf_options() {
$output .= form_select("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), "The default maximum number of nodes to display on the main page.");
+ $output .= form_select("Prompt for confirmation when deleting nodes", "default_nodes_confirm_delete", variable_get("default_nodes_confirm_delete", 1), array("Disabled", "Enabled"), "Prompt for confirmation when deleting nodes.");
+
return $output;
}
@@ -102,7 +104,7 @@ function node_links($nid, $type) {
$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>";
+ $link[] = "<a href=\"admin.php?mod=node&op=". (variable_get("default_nodes_confirm_delete", 1) ? "confirm+" : "") ."delete&id=$nid\">delete node</a>";
return $link;
}
@@ -184,7 +186,20 @@ function node_save_content($edit, $type) {
}
function node_delete($id) {
- return (node_del(array("nid" => $id)) ? "node has been deleted." : "failed to delete node: set node status to 'dumped' first.");
+ return (node_del(array("nid" => $id)) ? "node has been deleted." : "failed to delete node.");
+}
+
+
+function node_delete_confirmation($id) {
+
+ $node = node_get_object(array("nid" => $id));
+
+ $form .= form_item(t("Do you really want to delete this node"), check_output($node->title));
+ $form .= form_submit("Delete node");
+ $form .= form_submit("Keep node");
+
+ return form("admin.php?mod=node&id=$node->nid", $form);
+
}
function node_query($type = -1) {
@@ -325,8 +340,11 @@ function node_admin() {
print node_edit_content(node_get_array(array("nid" => $id)), $type);
break;
case "default":
- print node_setting();
break;
+ case "confirm delete":
+ print node_delete_confirmation($id);
+ break;
+ case "Delete node":
case "delete":
print status(node_delete($id));
print node_overview($query);
diff --git a/modules/node/node.module b/modules/node/node.module
index 428f3c4ba..c00522a8f 100644
--- a/modules/node/node.module
+++ b/modules/node/node.module
@@ -6,7 +6,7 @@ class Node {
$this->uid = $node[uid] ? $node[uid] : $user->uid;
$this->nid = $node[nid];
$this->type = $node[type];
- $this->comment = $node[comment] ? $node[comment] :
+ $this->comment = $node[comment] ? $node[comment] : variable_get($node[type]."_comment", 0);
$this->name = $node[name] ? $node[name] : $user->name;
$this->title = $node[title];
$this->attributes = $node[attributes];
@@ -36,6 +36,8 @@ function node_perm() {
function node_conf_options() {
$output .= form_select("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), "The default maximum number of nodes to display on the main page.");
+ $output .= form_select("Prompt for confirmation when deleting nodes", "default_nodes_confirm_delete", variable_get("default_nodes_confirm_delete", 1), array("Disabled", "Enabled"), "Prompt for confirmation when deleting nodes.");
+
return $output;
}
@@ -102,7 +104,7 @@ function node_links($nid, $type) {
$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>";
+ $link[] = "<a href=\"admin.php?mod=node&op=". (variable_get("default_nodes_confirm_delete", 1) ? "confirm+" : "") ."delete&id=$nid\">delete node</a>";
return $link;
}
@@ -184,7 +186,20 @@ function node_save_content($edit, $type) {
}
function node_delete($id) {
- return (node_del(array("nid" => $id)) ? "node has been deleted." : "failed to delete node: set node status to 'dumped' first.");
+ return (node_del(array("nid" => $id)) ? "node has been deleted." : "failed to delete node.");
+}
+
+
+function node_delete_confirmation($id) {
+
+ $node = node_get_object(array("nid" => $id));
+
+ $form .= form_item(t("Do you really want to delete this node"), check_output($node->title));
+ $form .= form_submit("Delete node");
+ $form .= form_submit("Keep node");
+
+ return form("admin.php?mod=node&id=$node->nid", $form);
+
}
function node_query($type = -1) {
@@ -325,8 +340,11 @@ function node_admin() {
print node_edit_content(node_get_array(array("nid" => $id)), $type);
break;
case "default":
- print node_setting();
break;
+ case "confirm delete":
+ print node_delete_confirmation($id);
+ break;
+ case "Delete node":
case "delete":
print status(node_delete($id));
print node_overview($query);