From 1a2576036b3377ec83a08b7238f59dc474053543 Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Thu, 12 Jun 2003 17:24:06 +0000 Subject: - Bugfix: charset fixes/clean-up. Patch #52 by Al. - Improvement: renamed some theme functions of the forum module for sake of consistency/readability. Patch #2 by Kristjan. - Improvement: usability improvements to the Xtemplate theme. Patch #3 by Kristjan. - Improvement: CSS'ified the book module pages. Patch #3 by Al. (I simplified the "l ocation" part. Al's approach gave you a bit more power but I'm not sure anyone wants to change that. Besides, this will change as soon we integrate the menu system so I kept it easy for now.) --- modules/book.module | 86 ++++++++++++++++++++++++++++++++++------------------- 1 file changed, 55 insertions(+), 31 deletions(-) (limited to 'modules/book.module') diff --git a/modules/book.module b/modules/book.module index e2e81fae6..2f4c0ec6a 100644 --- a/modules/book.module +++ b/modules/book.module @@ -410,40 +410,55 @@ function book_view($node, $main = 0) { $next = book_next($node); } - $output .= ""; - - if ($node->title) { - // build the tree from bottom to top to have the book index in $level for navigation later - $path = array_reverse(book_location($node)); - $i = count($path); - foreach ($path as $level) { - $indent = str_repeat("-", --$i); - $location = "$indent ". l($level->title, "node/view/$level->nid") ."
". $location; - } - - $output .= " "; - $output .= " "; - $output .= " "; + // build the tree from bottom to top to have the book index in $level for navigation later + $path = book_location($node); + foreach ($path as $level) { + $trail[] = l($level->title, "node/view/$level->nid"); } - if ($node->body) { - $output .= " "; + $output .= "
"; + if ($trail) { + $output .= "
". implode($trail, " » ") ."

"; } + $output .= "
$node->title
"; + $output .= "
". t("Last updated by %u on %d", array("%u" => format_name($node), "%d" => format_date($node->changed))) ."
"; + + $output .= "
$node->body
"; if ($node->moderate) { - $output .= "
"; + $output .= "
". t("Log") .":
$node->log
"; } if ($node->nid) { - $output .= " "; + $output .= "
". book_tree($node->nid) ."
"; + if ($prev) { + $links .= "
"; + $links .= l(t("previous"), "node/view/$prev->nid", array("title" => t("View the previous page in this book."))); + $links .= "
"; + $titles .= "
$prev->title
"; + } + if ($next) { + $links .= "
"; + $links .= l(t("next"), "node/view/$next->nid", array("title" => t("View the next page in this book."))); + $links .= "
"; + $titles .= "
$next->title
"; + } + if ($node->parent) { + $links .= "
"; + $links .= l(t("up"), "node/view/$node->parent", array("title" => t("View this page's parent section."))); + if ($node->parent != $level->nid) { + $links .= " | "; + $links .= l(t("index"), "node/view/$level->nid", array("title" => t("View this book's table of contents."))); + } + $links .= "
"; + } + $output .= "
"; + $output .= "
$links
"; + $output .= "
$titles
"; + $output .= "
"; } - - $output .= " "; - $output .= " "; - $output .= " "; - $output .= " "; - $output .= " "; - $output .= "
$location

$node->title". ($node->body ? "
". t("Last updated by %u on %d", array("%u" => format_name($node), "%d" => format_date($node->created))) ." " : "") ."

$node->body

". t("Log") .":
$node->log

". book_tree($node->nid) ."

". ($prev ? l(t("previous"), "node/view/$prev->nid", array("title" => t("View the previous page in this book."))) : " ") ."". ($node->parent ? l(t("up"), "node/view/$node->parent", array("title" => t("View this page's parent section."))) : " ") ."". ($next ? l(t("next"), "node/view/$next->nid", array("title" => t("View the next page in this book."))) : " ") ."
". ($prev ? "$prev->title" : " ") ."". ($node->parent && $node->parent != $level->nid ? l(t("index"), "node/view/$level->nid", array("title" => t("View this book's table of contents."))) : " ") ."". ($next ? "$next->title" : " ") ."

". theme("links", link_node($node, $main)) ."
"; + $output .= "
". theme("links", link_node($node, $main)) ."
"; + $output .= ""; theme("box", t("Handbook"), $output); } @@ -541,12 +556,15 @@ function book_render() { if ($node) { // output the content: - $output .= "
". l($node->title, "node/view/$node->nid") ."
". book_body($node) ."

"; + $output .= "
"; + $output .= "
". l($node->title, "node/view/$node->nid") ."
"; + $output .= "
". book_body($node) ."
"; + $output .= "
"; } } theme("header"); - theme("box", t("Handbook"), "
$output
"); + theme("box", t("Handbook"), "$output"); theme("footer"); } @@ -570,6 +588,7 @@ function book_page() { } function book_print($id = "", $depth = 1) { + global $base_url; $result = db_query("SELECT n.nid FROM node n INNER JOIN book b ON n.nid = b.nid WHERE n.status = 1 AND n.nid = %d AND (n.moderate = 0 OR n.revisions IS NOT NULL) ORDER BY b.weight, n.title", $id); while ($page = db_fetch_object($result)) { @@ -583,17 +602,22 @@ function book_print($id = "", $depth = 1) { if ($node) { // output the content: - $output .= "$node->title"; + $output .= "

nid\" name=\"$node->nid\" class=\"book-h$depth\">$node->title

"; if ($node->body) { - $output .= ""; + $output .= book_body($node); } } } $output .= book_print_recurse($id, $depth); - return $output; + $html = "$node->title"; + $html .= ""; + $html .= ""; + $html .= "". $output .""; + + return $html; } function book_print_recurse($parent = "", $depth = 1) { @@ -610,7 +634,7 @@ function book_print_recurse($parent = "", $depth = 1) { if ($node) { // output the content: - $output .= "$node->title"; + $output .= "

nid\" name=\"$node->nid\" class=\"book-h$depth\">$node->title

"; if ($node->body) { $output .= ""; -- cgit v1.2.3