diff options
author | Dries Buytaert <dries@buytaert.net> | 2003-04-15 19:50:04 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2003-04-15 19:50:04 +0000 |
commit | 2de4c1c643d3c23e814bc9f765ffa3e0eabdd696 (patch) | |
tree | 852ae736da509bf40636f9ba2a0e574d5c51286b /modules/node.module | |
parent | 86ddee8dc586e57456c9bc8fc97fe1c15b4b1c4e (diff) | |
download | brdo-2de4c1c643d3c23e814bc9f765ffa3e0eabdd696.tar.gz brdo-2de4c1c643d3c23e814bc9f765ffa3e0eabdd696.tar.bz2 |
- Node API improvements by Moshe:
"implemented pieces of kjartan's original nodeAPI patch. the mingling
of other modules into node.module logic decreases (a good thing). for
example, the string "taxonomy" now appears nowhere in node.module
- moved the saving of taxonomy terms when submitting a node out of
node.module and into taxonomy.module
- moved the deletion of comments while deleting a node out of
node.module and into comment.module
- improved usability of node forms by including node type in the title
of the box and page"
Diffstat (limited to 'modules/node.module')
-rw-r--r-- | modules/node.module | 45 |
1 files changed, 10 insertions, 35 deletions
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)); |