summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2004-11-15 12:49:59 +0000
committerDries Buytaert <dries@buytaert.net>2004-11-15 12:49:59 +0000
commitf67c046d402b53b1c63cd680f98c6ded598c0dbc (patch)
tree532405084bd26ff35bbfdbd77ed28b4f0d94c707 /modules
parent918d33f41fa1cb693c4c7e23c6954dfb208e5b1e (diff)
downloadbrdo-f67c046d402b53b1c63cd680f98c6ded598c0dbc.tar.gz
brdo-f67c046d402b53b1c63cd680f98c6ded598c0dbc.tar.bz2
- Modified patch #8552 by Gerhard: added 'add child page' link to book pages you can edit.
Diffstat (limited to 'modules')
-rw-r--r--modules/book.module6
-rw-r--r--modules/book/book.module6
2 files changed, 10 insertions, 2 deletions
diff --git a/modules/book.module b/modules/book.module
index 858518eac..5f5400a9c 100644
--- a/modules/book.module
+++ b/modules/book.module
@@ -65,6 +65,9 @@ function book_link($type, $node = 0, $main = 0) {
if ($type == 'node' && $node->type == 'book') {
if (!$main) {
+ if (book_access('create', $node)) {
+ $links[] = l(t('add child page'), "node/add/book/parent/$node->nid");
+ }
$links[] = l(t('printer-friendly version'), 'book/print/'. $node->nid, array('title' => t('Show a printer-friendly version of this book page and its sub-pages.')));
}
}
@@ -223,7 +226,8 @@ function book_form(&$node) {
global $user;
$op = $_POST['op'];
- $output = form_select(t('Parent'), 'parent', $node->parent, book_toc($node->nid), t('The parent that this page belongs in. Note that pages whose parent is &lt;top-level&gt; are regarded as independent, top-level books.'));
+
+ $output = form_select(t('Parent'), 'parent', ($node->parent ? $node->parent : arg(4)), book_toc($node->nid), t('The parent that this page belongs in. Note that pages whose parent is &lt;top-level&gt; are regarded as independent, top-level books.'));
if (function_exists('taxonomy_node_form')) {
$output .= implode('', taxonomy_node_form('book', $node));
diff --git a/modules/book/book.module b/modules/book/book.module
index 858518eac..5f5400a9c 100644
--- a/modules/book/book.module
+++ b/modules/book/book.module
@@ -65,6 +65,9 @@ function book_link($type, $node = 0, $main = 0) {
if ($type == 'node' && $node->type == 'book') {
if (!$main) {
+ if (book_access('create', $node)) {
+ $links[] = l(t('add child page'), "node/add/book/parent/$node->nid");
+ }
$links[] = l(t('printer-friendly version'), 'book/print/'. $node->nid, array('title' => t('Show a printer-friendly version of this book page and its sub-pages.')));
}
}
@@ -223,7 +226,8 @@ function book_form(&$node) {
global $user;
$op = $_POST['op'];
- $output = form_select(t('Parent'), 'parent', $node->parent, book_toc($node->nid), t('The parent that this page belongs in. Note that pages whose parent is &lt;top-level&gt; are regarded as independent, top-level books.'));
+
+ $output = form_select(t('Parent'), 'parent', ($node->parent ? $node->parent : arg(4)), book_toc($node->nid), t('The parent that this page belongs in. Note that pages whose parent is &lt;top-level&gt; are regarded as independent, top-level books.'));
if (function_exists('taxonomy_node_form')) {
$output .= implode('', taxonomy_node_form('book', $node));