";
- $output .= "
". book_tree($node->nid) ."
";
- if ($prev) {
+
+ if ($tree = book_tree($node->nid)) {
+ $output .= "
". book_tree($node->nid) ."
";
+ }
+
+ if ($prev = book_prev($node)) {
$links .= "
";
- $links .= l(t("previous"), "book/view/$prev->nid", array("title" => t("View the previous page in this book.")));
+ $links .= l(t("previous"), "book/view/$prev->nid", array("title" => t("View the previous page.")));
$links .= "
";
$titles .= "
$prev->title
";
}
- if ($next) {
+ else {
+ $links .= "
"; // make an empty div to fill the space
+ }
+ if ($next = book_next($node)) {
$links .= "
";
- $links .= l(t("next"), "book/view/$next->nid", array("title" => t("View the next page in this book.")));
+ $links .= l(t("next"), "book/view/$next->nid", array("title" => t("View the next page.")));
$links .= "
";
$titles .= "
$next->title
";
}
@@ -519,15 +548,12 @@ function book_navigation($node) {
if ($node->parent) {
$links .= "
";
$links .= l(t("up"), "book/view/$node->parent", array("title" => t("View this page's parent section.")));
- //if ($node->parent != $path[0]->nid) {
- // $links .= " | ";
- // $links .= l(t("index"), "node/view/".$path[0]->nid."", array("title" => t("View this book's table of contents.")));
- //}
$links .= "
";
}
+
$output .= "
";
- $output .= "
$links
";
- $output .= "
$titles
";
+ $output .= "
$links
";
+ $output .= "
$titles
";
$output .= "
";
$output .= "
";
}
@@ -577,17 +603,29 @@ function book_toc($parent = 0, $indent = "", $toc = array()) {
}
-function book_tree_recurse($nid, $depth, $children) {
-
+function book_tree_recurse($nid, $depth, $children, $unfold = array()) {
if ($depth > 0) {
if ($children[$nid]) {
foreach ($children[$nid] as $foo => $node) {
- $output .= "";
- $output .= "
". book_tree($node->nid) ."
";
- if ($prev) {
+
+ if ($tree = book_tree($node->nid)) {
+ $output .= "
". book_tree($node->nid) ."
";
+ }
+
+ if ($prev = book_prev($node)) {
$links .= "
";
- $links .= l(t("previous"), "book/view/$prev->nid", array("title" => t("View the previous page in this book.")));
+ $links .= l(t("previous"), "book/view/$prev->nid", array("title" => t("View the previous page.")));
$links .= "
";
$titles .= "
$prev->title
";
}
- if ($next) {
+ else {
+ $links .= "
"; // make an empty div to fill the space
+ }
+ if ($next = book_next($node)) {
$links .= "
";
- $links .= l(t("next"), "book/view/$next->nid", array("title" => t("View the next page in this book.")));
+ $links .= l(t("next"), "book/view/$next->nid", array("title" => t("View the next page.")));
$links .= "
";
$titles .= "
$next->title
";
}
@@ -519,15 +548,12 @@ function book_navigation($node) {
if ($node->parent) {
$links .= "
";
$links .= l(t("up"), "book/view/$node->parent", array("title" => t("View this page's parent section.")));
- //if ($node->parent != $path[0]->nid) {
- // $links .= " | ";
- // $links .= l(t("index"), "node/view/".$path[0]->nid."", array("title" => t("View this book's table of contents.")));
- //}
$links .= "
";
}
+
$output .= "
";
- $output .= "
$links
";
- $output .= "
$titles
";
+ $output .= "
$links
";
+ $output .= "
$titles
";
$output .= "
";
$output .= "
";
}
@@ -577,17 +603,29 @@ function book_toc($parent = 0, $indent = "", $toc = array()) {
}
-function book_tree_recurse($nid, $depth, $children) {
-
+function book_tree_recurse($nid, $depth, $children, $unfold = array()) {
if ($depth > 0) {
if ($children[$nid]) {
foreach ($children[$nid] as $foo => $node) {
- $output .= "