diff options
author | Dries Buytaert <dries@buytaert.net> | 2001-11-01 17:04:20 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2001-11-01 17:04:20 +0000 |
commit | 23ca7a2d8832aa16107cf7002c35170ae2b87a1c (patch) | |
tree | 7878082b9e4bd2b0d20380d11c6404b72cd44d32 /modules/page/page.module | |
parent | 3d47ad359ded4cb947b7ada9b3418640cfb3c642 (diff) | |
download | brdo-23ca7a2d8832aa16107cf7002c35170ae2b87a1c.tar.gz brdo-23ca7a2d8832aa16107cf7002c35170ae2b87a1c.tar.bz2 |
- Another batch of updates/improvements:
+ introduced basic node permissions ("create", "delete", "update" and
"view") at the node level: it's up to the "<$node->type>_module" to
hide gory details (if any).
+ made the "blog it"-feature in the blog and import module work with
the new node system, in specific with the new centralized forms.
+ made it possible to update blogs.
+ made the page module work with the new node system.
+ various smaller improvements.
Diffstat (limited to 'modules/page/page.module')
-rw-r--r-- | modules/page/page.module | 41 |
1 files changed, 32 insertions, 9 deletions
diff --git a/modules/page/page.module b/modules/page/page.module index 84488f296..bb1affd35 100644 --- a/modules/page/page.module +++ b/modules/page/page.module @@ -3,6 +3,33 @@ $GLOBALS["format"] = array(0 => "HTML", 1 => "PHP", 2 => "text"); +function page_node($field) { + $info = array("name" => "static page"); + + return $info[$field]; +} + +function page_access($op, $node) { + + if ($op == "view") { + return $node->nid && $node->status && !$node->moderate; + } + + return user_access("administer nodes"); +} + +function page_insert($node) { + db_query("INSERT INTO page (nid, format, link) VALUES ('$node->nid', '$node->format', '$node->link')"); +} + +function page_update($node) { + db_query("UPDATE page SET format = '$node->format', link = '$node->link' WHERE nid = '$node->nid'"); +} + +function page_delete($node) { + db_query("DELETE FROM page WHERE nid = '$node->nid'"); +} + function page_link($type) { if ($type == "page") { $result = db_query("SELECT nid,link FROM page WHERE link != '' ORDER BY link"); @@ -42,7 +69,8 @@ function page_form($node) { $node->body = addslashes($node->body); } - $output .= form_textarea("Body", "body", $node->body, 60, 30); + $output .= form_textarea("Body", "body", $node->body, 60, 20); + $output .= form_textfield("Link", "link", $node->link, 60, 64); $output .= form_select("Type", "format", $node->format, $format); return $output; @@ -50,16 +78,11 @@ function page_form($node) { function page_save() { - if (user_access("administer nodes")) { - if ($node->nid) { - return array(); - } - else { - return array("promote" => 0, "moderate" => 0, "status" => 1); - } + if ($node->nid) { + return array("format", "link"); } else { - return 0; + return array("format", "link", "promote" => 0, "moderate" => 0, "status" => 1); } } |