From 0215c5032f5df1cf74c6e86b2a853c95b5ed1e4d Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Tue, 13 May 2003 19:05:02 +0000 Subject: - The book_admin_orphan() function is using the table() function to render the orphan pages. Patch by Nick. - The "printer-friendly link" is only shown when the book page is not on the main page. Patch by Nick. --- modules/book.module | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'modules/book.module') diff --git a/modules/book.module b/modules/book.module index bc30b2546..c350d9017 100644 --- a/modules/book.module +++ b/modules/book.module @@ -73,7 +73,9 @@ function book_link($type, $node = 0, $main = 0) { if (book_access("update", $node)) { $links[] = l(t("edit this page"), "node/edit/$node->nid", array("title" => t("Suggest an update for this book page."))); } - $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."))); + if (!$main) { + $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."))); + } } if ($type == "admin" && user_access("maintain books")) { @@ -685,21 +687,22 @@ function book_admin_save($nid, $edit = array()) { function book_admin_orphan() { - $result = db_query("SELECT n.nid, n.title, b.parent FROM node n LEFT JOIN book b ON n.nid = b.nid WHERE n.type = 'book'"); + $result = db_query("SELECT n.nid, n.title, n.status, b.parent FROM node n LEFT JOIN book b ON n.nid = b.nid WHERE n.type = 'book'"); while ($page = db_fetch_object($result)) { $pages[$page->nid] = $page; } if ($pages) { - $output .= ""; - $output .= " "; + $output .= "

Orphan pages

"; + $header = array(t("title"), t("weight"), array("data" => t("operations"), "colspan" => 3)); foreach ($pages as $nid => $node) { if ($node->parent && empty($pages[$node->parent])) { - $output .= ""; + $rows[] = book_admin_view_line($node, $depth); + $rows = array_merge($rows, book_admin_view_book($node->nid, $depth + 1)); } } - $output .= "
titleoperations
". l($node->title, "node/view/$node->nid") ."". l(t("edit page"), "admin/node/edit/$node->nid") ."". l(t("delete page"), "admin/node/delete/$node->nid") ."
"; + $output .= table($header, $rows); } return $output; -- cgit v1.2.3