summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
Diffstat (limited to 'modules')
-rw-r--r--modules/comment.module5
-rw-r--r--modules/comment/comment.module5
-rw-r--r--modules/node.module45
-rw-r--r--modules/node/node.module45
-rw-r--r--modules/taxonomy.module32
-rw-r--r--modules/taxonomy/taxonomy.module32
6 files changed, 84 insertions, 80 deletions
diff --git a/modules/comment.module b/modules/comment.module
index f3f53577a..8ada37458 100644
--- a/modules/comment.module
+++ b/modules/comment.module
@@ -1466,7 +1466,10 @@ function comment_nodeapi(&$node, $op, $arg = 0) {
$node->comment = variable_get("comment_$node->type", 2);
}
break;
+ case "delete":
+ db_query("DELETE FROM comments WHERE nid = '$node->nid'");
+ break;
}
}
-?>
+?> \ No newline at end of file
diff --git a/modules/comment/comment.module b/modules/comment/comment.module
index f3f53577a..8ada37458 100644
--- a/modules/comment/comment.module
+++ b/modules/comment/comment.module
@@ -1466,7 +1466,10 @@ function comment_nodeapi(&$node, $op, $arg = 0) {
$node->comment = variable_get("comment_$node->type", 2);
}
break;
+ case "delete":
+ db_query("DELETE FROM comments WHERE nid = '$node->nid'");
+ break;
}
}
-?>
+?> \ No newline at end of file
diff --git a/modules/node.module b/modules/node.module
index 84588cdf9..846b9dfff 100644
--- a/modules/node.module
+++ b/modules/node.module
@@ -1180,7 +1180,7 @@ function node_preview($node, $error = NULL) {
}
/*
- ** Exctract a teaser:
+ ** Extract a teaser:
*/
$node->teaser = node_teaser($node->body);
@@ -1197,7 +1197,7 @@ function node_preview($node, $error = NULL) {
}
/*
- ** Display a prenode of the node:
+ ** Display a preview of the node:
*/
if ($view->teaser && $view->teaser != $view->body) {
@@ -1245,17 +1245,8 @@ function node_submit($node) {
if (node_access("update", $node)) {
$nid = node_save($node);
-
- /*
- ** Update terms of the node
- */
-
- if (function_exists("taxonomy_node_save")) {
- taxonomy_node_save($nid, $node->taxonomy);
- }
-
watchdog("special", "$node->type: updated '$node->title'", l("view post", "node/view/$node->nid"));
- $output = t("The node has been updated.");
+ $output = t("The %name has been updated.", array ("%name" => module_invoke($node->type, "node", "name")));
}
}
else {
@@ -1275,15 +1266,6 @@ function node_submit($node) {
throttle("node", variable_get("max_node_rate", 900));
$nid = node_save($node);
-
- /*
- ** Insert terms of the node
- */
-
- if (function_exists("taxonomy_node_save")) {
- taxonomy_node_save($nid, $node->taxonomy);
- }
-
watchdog("special", "$node->type: added '$node->title'", l("view post", "node/view/$nid"));
$output = t("Thanks for your submission.");
}
@@ -1326,17 +1308,10 @@ function node_delete($edit) {
if ($edit["confirm"]) {
/*
- ** Delete the specified node and its comments:
+ ** Delete the specified node:
*/
db_query("DELETE FROM node WHERE nid = '$node->nid'");
- db_query("DELETE FROM comments WHERE nid = '$node->nid'");
-
- /*
- ** Delete any taxonomy terms
- */
-
- module_invoke("taxonomy", "node_delete", $node->nid);
/*
** Call the node specific callback (if any):
@@ -1381,26 +1356,26 @@ function node_page() {
}
theme("header");
-
+ $name = module_invoke(arg(2), "node", "name");
switch ($op) {
case "add":
- theme("box", t("Create new post"), node_add(arg(2)));
+ theme("box", t("Create new $name"), node_add(arg(2)));
break;
case "edit":
- theme("box", t("Edit post"), node_edit(arg(2)));
+ theme("box", t("Edit $name"), node_edit(arg(2)));
break;
case "view":
print node_show(arg(2), arg(3));
break;
case t("Preview"):
$edit = node_validate($edit, $error);
- theme("box", t("Preview post"), node_preview($edit, $error));
+ theme("box", t("Preview $name"), node_preview($edit, $error));
break;
case t("Submit"):
- theme("box", t("Submit post"), node_submit($edit));
+ theme("box", t("Submit $name"), node_submit($edit));
break;
case t("Delete"):
- theme("box", t("Delete post"), node_delete($edit));
+ theme("box", t("Delete $name"), node_delete($edit));
break;
default:
$result = pager_query("SELECT nid, type FROM node WHERE promote = '1' AND status = '1' ORDER BY static DESC, created DESC", variable_get("default_nodes_main", 10));
diff --git a/modules/node/node.module b/modules/node/node.module
index 84588cdf9..846b9dfff 100644
--- a/modules/node/node.module
+++ b/modules/node/node.module
@@ -1180,7 +1180,7 @@ function node_preview($node, $error = NULL) {
}
/*
- ** Exctract a teaser:
+ ** Extract a teaser:
*/
$node->teaser = node_teaser($node->body);
@@ -1197,7 +1197,7 @@ function node_preview($node, $error = NULL) {
}
/*
- ** Display a prenode of the node:
+ ** Display a preview of the node:
*/
if ($view->teaser && $view->teaser != $view->body) {
@@ -1245,17 +1245,8 @@ function node_submit($node) {
if (node_access("update", $node)) {
$nid = node_save($node);
-
- /*
- ** Update terms of the node
- */
-
- if (function_exists("taxonomy_node_save")) {
- taxonomy_node_save($nid, $node->taxonomy);
- }
-
watchdog("special", "$node->type: updated '$node->title'", l("view post", "node/view/$node->nid"));
- $output = t("The node has been updated.");
+ $output = t("The %name has been updated.", array ("%name" => module_invoke($node->type, "node", "name")));
}
}
else {
@@ -1275,15 +1266,6 @@ function node_submit($node) {
throttle("node", variable_get("max_node_rate", 900));
$nid = node_save($node);
-
- /*
- ** Insert terms of the node
- */
-
- if (function_exists("taxonomy_node_save")) {
- taxonomy_node_save($nid, $node->taxonomy);
- }
-
watchdog("special", "$node->type: added '$node->title'", l("view post", "node/view/$nid"));
$output = t("Thanks for your submission.");
}
@@ -1326,17 +1308,10 @@ function node_delete($edit) {
if ($edit["confirm"]) {
/*
- ** Delete the specified node and its comments:
+ ** Delete the specified node:
*/
db_query("DELETE FROM node WHERE nid = '$node->nid'");
- db_query("DELETE FROM comments WHERE nid = '$node->nid'");
-
- /*
- ** Delete any taxonomy terms
- */
-
- module_invoke("taxonomy", "node_delete", $node->nid);
/*
** Call the node specific callback (if any):
@@ -1381,26 +1356,26 @@ function node_page() {
}
theme("header");
-
+ $name = module_invoke(arg(2), "node", "name");
switch ($op) {
case "add":
- theme("box", t("Create new post"), node_add(arg(2)));
+ theme("box", t("Create new $name"), node_add(arg(2)));
break;
case "edit":
- theme("box", t("Edit post"), node_edit(arg(2)));
+ theme("box", t("Edit $name"), node_edit(arg(2)));
break;
case "view":
print node_show(arg(2), arg(3));
break;
case t("Preview"):
$edit = node_validate($edit, $error);
- theme("box", t("Preview post"), node_preview($edit, $error));
+ theme("box", t("Preview $name"), node_preview($edit, $error));
break;
case t("Submit"):
- theme("box", t("Submit post"), node_submit($edit));
+ theme("box", t("Submit $name"), node_submit($edit));
break;
case t("Delete"):
- theme("box", t("Delete post"), node_delete($edit));
+ theme("box", t("Delete $name"), node_delete($edit));
break;
default:
$result = pager_query("SELECT nid, type FROM node WHERE promote = '1' AND status = '1' ORDER BY static DESC, created DESC", variable_get("default_nodes_main", 10));
diff --git a/modules/taxonomy.module b/modules/taxonomy.module
index 10c1f3317..256e0364b 100644
--- a/modules/taxonomy.module
+++ b/modules/taxonomy.module
@@ -36,6 +36,15 @@ function taxonomy_link($type, $node = NULL) {
menu("admin/taxonomy/help", "help", "taxonomy_admin", NULL, 9);
}
else if ($type == "taxonomy terms" && $node != NULL) {
+
+ if ($node->taxonomy) {
+ foreach ($node->taxonomy as $tid) {
+ $term = taxonomy_get_term($tid);
+ $links[] = l($term->name, "taxonomy/page/or/$term->tid", $term->description ? array("title" => $term->description) : array());
+ }
+ }
+ else {
+
/*
** Themes can print taxonomy links with:
**
@@ -44,12 +53,12 @@ function taxonomy_link($type, $node = NULL) {
** }
*/
- $links = array();
+ $links = array();
+ foreach (taxonomy_node_get_terms($node->nid) as $term) {
+ $links[] = l($term->name, "taxonomy/page/or/$term->tid", $term->description ? array("title" => $term->description) : array());
+ }
- foreach (taxonomy_node_get_terms($node->nid) as $term) {
- $links[] = l($term->name, "taxonomy/page/or/$term->tid", $term->description ? array("title" => $term->description) : array());
}
-
return $links;
}
}
@@ -676,6 +685,21 @@ function taxonomy_render_nodes($result) {
print pager_display_default(NULL, variable_get("default_nodes_main", 10), 0);
}
+function taxonomy_nodeapi($node, $op, $arg = 0) {
+
+ switch ($op) {
+ case "insert":
+ taxonomy_node_save($node->nid, $node->taxonomy);
+ break;
+ case "update":
+ taxonomy_node_save($node->nid, $node->taxonomy);
+ break;
+ case "delete":
+ taxonomy_node_delete($node->nid);
+ break;
+ }
+}
+
function taxonomy_page() {
diff --git a/modules/taxonomy/taxonomy.module b/modules/taxonomy/taxonomy.module
index 10c1f3317..256e0364b 100644
--- a/modules/taxonomy/taxonomy.module
+++ b/modules/taxonomy/taxonomy.module
@@ -36,6 +36,15 @@ function taxonomy_link($type, $node = NULL) {
menu("admin/taxonomy/help", "help", "taxonomy_admin", NULL, 9);
}
else if ($type == "taxonomy terms" && $node != NULL) {
+
+ if ($node->taxonomy) {
+ foreach ($node->taxonomy as $tid) {
+ $term = taxonomy_get_term($tid);
+ $links[] = l($term->name, "taxonomy/page/or/$term->tid", $term->description ? array("title" => $term->description) : array());
+ }
+ }
+ else {
+
/*
** Themes can print taxonomy links with:
**
@@ -44,12 +53,12 @@ function taxonomy_link($type, $node = NULL) {
** }
*/
- $links = array();
+ $links = array();
+ foreach (taxonomy_node_get_terms($node->nid) as $term) {
+ $links[] = l($term->name, "taxonomy/page/or/$term->tid", $term->description ? array("title" => $term->description) : array());
+ }
- foreach (taxonomy_node_get_terms($node->nid) as $term) {
- $links[] = l($term->name, "taxonomy/page/or/$term->tid", $term->description ? array("title" => $term->description) : array());
}
-
return $links;
}
}
@@ -676,6 +685,21 @@ function taxonomy_render_nodes($result) {
print pager_display_default(NULL, variable_get("default_nodes_main", 10), 0);
}
+function taxonomy_nodeapi($node, $op, $arg = 0) {
+
+ switch ($op) {
+ case "insert":
+ taxonomy_node_save($node->nid, $node->taxonomy);
+ break;
+ case "update":
+ taxonomy_node_save($node->nid, $node->taxonomy);
+ break;
+ case "delete":
+ taxonomy_node_delete($node->nid);
+ break;
+ }
+}
+
function taxonomy_page() {