From 23ca7a2d8832aa16107cf7002c35170ae2b87a1c Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Thu, 1 Nov 2001 17:04:20 +0000 Subject: - 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. --- modules/book.module | 44 +++++++++++++++++++++++++++++++++----------- 1 file changed, 33 insertions(+), 11 deletions(-) (limited to 'modules/book.module') diff --git a/modules/book.module b/modules/book.module index 39be32c66..84c7d00de 100644 --- a/modules/book.module +++ b/modules/book.module @@ -1,6 +1,35 @@ "book page"); + + return $info[$field]; +} + +function book_access($op, $node) { + global $user; + + if ($op == "view") { + return $node->nid && $node->status && !$node->moderate; + } + + if ($op == "create") { + return 1; + } + + if ($op == "update") { + return 1; + } + + if ($op == "delete") { + return user_access("adminster nodes"); + } + +} + function book_link($type) { if ($type == "page" && user_access("access content")) { $links[] = "". t("collaborative book") .""; @@ -36,17 +65,11 @@ function book_delete($node) { } function book_save($node) { - if ($node->nid) { - if (user_access("administer nodes")) { - return array("moderate" => 1, "promote" => 0, "status" => 0, "log", "parent", "weight"); - } - else { - // TODO: temporay disabled book page updates by regular users - return 0; - } + if ($node->nid && user_access("administer nodes")) { + return array("pid", "log", "parent", "weight"); } else { - return array("pid", "log", "parent", "weight"); + return array("moderate" => 1, "promote" => 0, "status" => 0, "log", "parent", "weight"); } } @@ -80,8 +103,7 @@ function book_view($node, $main = 0) { $indent .= "-"; } - $output .= " $location"; -// TODO: ". node_control($node) ."\n"; + $output .= " $locationnid\">update\n"; $output .= "
"; $output .= " ". check_output($node->title) ."". ($node->body ? "
Last updated by ". format_name($node) ." on ". format_date($node->created) ." " : "") ."\n"; } -- cgit v1.2.3