summaryrefslogtreecommitdiff
path: root/modules/book.module
diff options
context:
space:
mode:
Diffstat (limited to 'modules/book.module')
-rw-r--r--modules/book.module35
1 files changed, 17 insertions, 18 deletions
diff --git a/modules/book.module b/modules/book.module
index d3ab1f4e9..916bb1812 100644
--- a/modules/book.module
+++ b/modules/book.module
@@ -15,6 +15,10 @@ function book_node($field) {
return $info[$field];
}
+function book_perm() {
+ return array("maintain books");
+}
+
function book_access($op, $node) {
global $user;
@@ -35,7 +39,7 @@ function book_access($op, $node) {
** of the book module this is considered to be a good/safe idea.
*/
- return $user->uid;
+ return user_access("maintain books");
}
if ($op == "update") {
@@ -49,7 +53,7 @@ function book_access($op, $node) {
** are allowed.
*/
- return $user->uid && !$node->moderate && !$node->format && $node->revision;
+ return user_access("maintain books") && !$node->moderate && !$node->format && $node->revision;
}
}
@@ -62,10 +66,10 @@ function book_save($op, $node) {
if ($op == "create") {
if (user_access("administer nodes")) {
- return array("body" => filter($node->body), "teaser" => filter($node->teaser), "format", "parent", "weight", "log");
+ return array("teaser" => $node->body, "format", "parent", "weight", "log");
}
else {
- return array("body" => filter($node->body), "teaser" => filter($node->teaser), "format", "moderate" => 1, "parent", "promote" => 0, "status" => 1, "weight", "log");
+ return array("teaser" => $node->body, "format", "moderate" => 1, "parent", "promote" => 0, "status" => 1, "weight", "log");
}
}
@@ -80,7 +84,7 @@ function book_save($op, $node) {
** new revision unless we are explicitly instructed to.
*/
- return array("body" => filter($node->body), "teaser" => filter($node->teaser), "format", "parent", "weight", "log");
+ return array("teaser" => $node->body, "format", "parent", "weight", "log");
}
else {
/*
@@ -89,7 +93,7 @@ function book_save($op, $node) {
** and are not promoted by default. See also: book_load().
*/
- return array("body" => filter($node->body), "teaser" => filter($node->teaser), "created" => time(), "format", "moderate" => 1, "parent", "promote" => 0, "score" => 0, "status" => 1, "users" => "", "revisions", "votes" => 0, "weight", "log");
+ return array("teaser" => $node->body, "created" => time(), "format", "moderate" => 1, "parent", "promote" => 0, "score" => 0, "status" => 1, "users" => "", "revisions", "votes" => 0, "weight", "log");
}
}
@@ -100,11 +104,11 @@ function book_link($type, $node = 0, $main = 0) {
$links[] = lm(t("collaborative book"), array("mod" => "book"), "", array("title" => t("Read and contribute to the collaborative books.")));
}
- if ($type == "menu.create" && user_access("post content")) {
+ if ($type == "menu.create" && user_access("maintain books")) {
$links[] = lm(t("create book page"), array("mod" => "node", "op" => "add", "type" => "book"), "", array("title" => t("Add a new book page.")));
}
- if ($type == "admin" && user_access("administer nodes")) {
+ if ($type == "admin" && user_access("maintain books")) {
$links[] = la(t("collaborative book"), array("mod" => "book"));
}
@@ -191,11 +195,6 @@ function book_form(&$node, &$help, &$error) {
$node->body = addslashes($node->body);
}
}
- else {
- if ($node->teaser) {
- $output .= form_textarea(t("Teaser"), "teaser", $node->teaser, 60, 5, $error["teaser"]);
- }
- }
if (function_exists("taxonomy_node_form")) {
$output .= implode("", taxonomy_node_form("book", $node));
@@ -763,11 +762,11 @@ function book_help() {
<p>Book pages are a special, powerful node type. These nodes are specifically designed to be included in a book. Their special power comes from the bilility to embed PHP within the body of the page. This capability is only offerred to administrators, since malicious users could abuse this power. In addiiton, book pages contain a <i>log message</i> field which helps your users understand the motivation behind an edit of a book page. Each edited version of a book page is usually stored as a new revision of a node. This capability makes it easy to revert to an old version of a page, should that become desirable.</p>
-<p>Like other node types, book submissions and edits may be subject to moderation, depending on your configuration. Similarly, books use <? echo la("permissions", array("mod" => "user", "op" => "permission")) ?> to determine who may read and write to them. Only administrators are allowed to create new books, which are really just nodes whose parent is <i>&lt;root&gt;</i>. To include an existing node in your book, click on the "administer"-link in that node. At the bottom of this administration page, click on the <i>edit book outline</i> button. This enables you to place the node wherever you'd like within the book hierarchy. To add a new node into your book, use the <i>create book page</i> link.</p>
+<p>Like other node types, book submissions and edits may be subject to moderation, depending on your configuration. Similarly, books use <?php echo la("permissions", array("mod" => "user", "op" => "permission")) ?> to determine who may read and write to them. Only administrators are allowed to create new books, which are really just nodes whose parent is <i>&lt;root&gt;</i>. To include an existing node in your book, click on the "administer"-link in that node. At the bottom of this administration page, click on the <i>edit book outline</i> button. This enables you to place the node wherever you'd like within the book hierarchy. To add a new node into your book, use the <i>create book page</i> link.</p>
-<p>Administrators may review the hierarchy of their books by clicking on the <? echo la("collaborative book link", array("mod" => "book")) ?> in the adminstration pages. There, nodes may be edited, reorganized, removed from book, and deleted. This behavior may change in the future. When a parent node is deleted, he may leave behind child nodes.
-These nodes are now <i>orphans</i>. Administrators should periodically <? echo la("review their books for orphans", array("mod" => "book", "op" => "orphan")) ?> and reaffiliate those pages as desired. Finally, administrators may also
-<? echo la("export their books", array("mod" => "book", "op" => "print")) ?> to a single, flat HTML page which is suitable for printing.</p>
+<p>Administrators may review the hierarchy of their books by clicking on the <?php echo la("collaborative book link", array("mod" => "book")) ?> in the adminstration pages. There, nodes may be edited, reorganized, removed from book, and deleted. This behavior may change in the future. When a parent node is deleted, he may leave behind child nodes.
+These nodes are now <i>orphans</i>. Administrators should periodically <?php echo la("review their books for orphans", array("mod" => "book", "op" => "orphan")) ?> and reaffiliate those pages as desired. Finally, administrators may also
+<?php echo la("export their books", array("mod" => "book", "op" => "print")) ?> to a single, flat HTML page which is suitable for printing.</p>
<a name="faq"></a><h3>Maintain a FAQ using a collaborative book</i></h3>
@@ -782,7 +781,7 @@ These nodes are now <i>orphans</i>. Administrators should periodically <? echo l
<li>Any comments attached to those relevant posts which you designate as book pages will also be transported into your book. This is a great feature, since much wisdom is shared via comments. And remember that all future comments and edits will automatically be reflected in your book.</li>
<li>You may wish to edit the title and teaser of posts when adding them to your FAQ. This is done on the same page as the <i>Edit book outline</i> button. Clear titles help users navigate quickly to the information that they seek.</li>
<li>Book pages may come from any content type (blog, story, page, etc.). If you are creating a post solely for inclusion in your book, then use the <i>Create book page</i> link.</li>
- <li>If you don't see the <i>administer</i> link, then you probably have insufficient <? echo la("permissions", array("mod" => "user", "op" => "permission")) ?>.</li>
+ <li>If you don't see the <i>administer</i> link, then you probably have insufficient <?php echo la("permissions", array("mod" => "user", "op" => "permission")) ?>.</li>
<li>If you want to get really fancy, note that Books are one of the few content types which allow raw PHP in their <i>body</i>. So you've got lots of geeky possibilities there.</li>
</ul>
<?php