diff options
author | Dries Buytaert <dries@buytaert.net> | 2001-11-05 22:59:11 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2001-11-05 22:59:11 +0000 |
commit | db47bac35ec035388cfdab0a9fb27e97f8099742 (patch) | |
tree | f1ae2de16fdaa0ab39199d61828076e9eeb9af45 /modules/node.module | |
parent | f88cfaa2dd205846843068175931e68c582bb037 (diff) | |
download | brdo-db47bac35ec035388cfdab0a9fb27e97f8099742.tar.gz brdo-db47bac35ec035388cfdab0a9fb27e97f8099742.tar.bz2 |
- node.module:
+ Changed node_form() to use good ol' tables instead of div/CSS-tags.
+ Revised the "revision API": I think we have both an easy and powerful
API now that should make everyone happy.
+ Improved the usability of the rollback functionality a bit.
+ Removed the "view node" link from the "node overview" page in the
admin section and added a "delete node" link instead.
+ Added a few missing translations; there might be missing more
translations though.
- book.module:
+ Made the book module use the "revision API" instead of having it poke
and use the innards and underlying details of the revision system.
- queue.module:
+ Made the queue module use the improved revision number.
- module.inc:
+ Applied Moshe's patch: added more arguments to module_invoke()
- mail-to-sql.pl:
+ Added support for more header fields and for folded fields
Notes:
- no database updates required
Diffstat (limited to 'modules/node.module')
-rw-r--r-- | modules/node.module | 65 |
1 files changed, 47 insertions, 18 deletions
diff --git a/modules/node.module b/modules/node.module index 26d40dc08..2c1b6d3b1 100644 --- a/modules/node.module +++ b/modules/node.module @@ -234,6 +234,18 @@ function node_admin_nodes() { return $output; } +/* +** Return the revision with the specified revision number. +*/ + +function node_revision_load($node, $revision) { + return $node->revisions[$revision]["node"]; +} + +/* +** Create and return a new revision of the given node. +*/ + function node_revision_create($node) { global $user; @@ -252,14 +264,12 @@ function node_revision_create($node) { return $node; } -function node_revision_rollback($nid, $revision) { - global $user; +/* +** Roll-back to the revision with the specified revision number. +*/ - /* - ** Load the original/current node: - */ - - $node = node_load(array("nid" => $nid)); +function node_revision_rollback($node, $revision) { + global $user; /* ** Extract the specified revision: @@ -298,8 +308,11 @@ function node_revision_rollback($nid, $revision) { watchdog("special", "node: rollbacked to revision #$revision of '$node->title'"); } -function node_revision_delete($nid, $revision) { - $node = node_load(array("nid" => $nid)); +/* +** Delete the revision with specified revision number. +*/ + +function node_revision_delete($node, $revision) { unset($node->revisions[$revision]); @@ -308,8 +321,17 @@ function node_revision_delete($nid, $revision) { watchdog("special", "node: removed revision #$revision of '$node->title'"); } -function node_revision_previous($node) { - return end(array_keys($node->revisions)); +/* +** Return a list of all the existing revision numbers. +*/ + +function node_revision_list($node) { + if (is_array($node->revisions)) { + return array_keys($node->revisions); + } + else { + return array(); + } } function node_admin() { @@ -344,10 +366,12 @@ function node_admin() { print node_admin_edit($id); break; case "rollback revision": - print node_revision_rollback($id, $revision); + print node_revision_rollback(node_load(array("nid" => $id)), $revision); + print node_admin_edit($id); break; case "delete revision": - print node_revision_delete($id, $revision); + print node_revision_delete(node_load(array("nid" => $id)), $revision); + print node_admin_edit($id); break; case t("Preview"): print node_preview($edit); @@ -492,7 +516,6 @@ function node_form($edit) { $form .= $function(&$edit, &$help, &$error); } - $output .= "<div style=\"margin-right: 40px; float: left;\">"; /* ** Add the help text: @@ -502,6 +525,10 @@ function node_form($edit) { $output .= "<p>$help</p>"; } + $output .= "<table border=\"0\" cellpadding=\"2\" cellspacing=\"2\">"; + $output .= " <tr>"; + $output .= " <td valign=\"top\">"; + /* ** Add the default fields: */ @@ -554,14 +581,13 @@ function node_form($edit) { $output .= form_submit(t("Delete")); } - $output .= "</div>"; - /* ** Add the admin specific parts: */ if (user_access("administer nodes")) { - $output .= "<div style=\"float: right;\">"; + $output .= "</td><td valign=\"top\">"; + $output .= form_textfield(t("Authored by"), "name", $edit->name, 20, 25, $error["name"]); $output .= form_textfield(t("Authored on"), "date", $edit->date, 20, 25, $error["date"]); $output .= "<br />"; @@ -569,9 +595,12 @@ function node_form($edit) { $output .= form_select(t("Allow users comments"), "comment", $edit->comment, array("Disabled", "Enabled")); $output .= form_select(t("Promote to front page"), "promote", $edit->promote, array("Disabled", "Enabled")); $output .= form_select(t("Create new revision"), "revision", $edit->revision, array("Disabled", "Enabled")); - $output .= "</div>"; } + $output .= " </td>"; + $output .= " </tr>"; + $output .= "</table>"; + return form($output); } |