diff options
author | Dries Buytaert <dries@buytaert.net> | 2003-05-13 19:05:02 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2003-05-13 19:05:02 +0000 |
commit | 0215c5032f5df1cf74c6e86b2a853c95b5ed1e4d (patch) | |
tree | 39e47f1c644df59355d957af835f4eb54d484e59 /modules | |
parent | c2d2fb73095a32394dd95e72421aec49fa2cd6f6 (diff) | |
download | brdo-0215c5032f5df1cf74c6e86b2a853c95b5ed1e4d.tar.gz brdo-0215c5032f5df1cf74c6e86b2a853c95b5ed1e4d.tar.bz2 |
- 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.
Diffstat (limited to 'modules')
-rw-r--r-- | modules/book.module | 15 | ||||
-rw-r--r-- | modules/book/book.module | 15 |
2 files changed, 18 insertions, 12 deletions
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 .= "<table border=\"1\" cellpadding=\"2\" cellspacing=\"2\">"; - $output .= " <tr><th>title</th><th colspan=\"2\">operations</th></tr>"; + $output .= "<h3>Orphan pages</h3>"; + $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 .= "<tr><td>". l($node->title, "node/view/$node->nid") ."</td><td>". l(t("edit page"), "admin/node/edit/$node->nid") ."</td><td>". l(t("delete page"), "admin/node/delete/$node->nid") ."</td>"; + $rows[] = book_admin_view_line($node, $depth); + $rows = array_merge($rows, book_admin_view_book($node->nid, $depth + 1)); } } - $output .= "</table>"; + $output .= table($header, $rows); } return $output; diff --git a/modules/book/book.module b/modules/book/book.module index bc30b2546..c350d9017 100644 --- a/modules/book/book.module +++ b/modules/book/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 .= "<table border=\"1\" cellpadding=\"2\" cellspacing=\"2\">"; - $output .= " <tr><th>title</th><th colspan=\"2\">operations</th></tr>"; + $output .= "<h3>Orphan pages</h3>"; + $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 .= "<tr><td>". l($node->title, "node/view/$node->nid") ."</td><td>". l(t("edit page"), "admin/node/edit/$node->nid") ."</td><td>". l(t("delete page"), "admin/node/delete/$node->nid") ."</td>"; + $rows[] = book_admin_view_line($node, $depth); + $rows = array_merge($rows, book_admin_view_book($node->nid, $depth + 1)); } } - $output .= "</table>"; + $output .= table($header, $rows); } return $output; |