- Committed Nick's _content improvements.
parent
2fbc7fcf27
commit
00a62647bc
|
@ -42,8 +42,8 @@ class BaseTheme {
|
|||
return "misc/$name";
|
||||
}
|
||||
|
||||
function breadcrumb($trail) {
|
||||
print "<div class=\"breadcrumb\">". implode($trail, " » ") ."</div>";
|
||||
function breadcrumb($breadcrumb) {
|
||||
print "<div class=\"breadcrumb\">". implode($breadcrumb, " » ") ."</div>";
|
||||
}
|
||||
|
||||
function node($node, $main) {
|
||||
|
|
|
@ -125,10 +125,10 @@ function blog_page_user($uid) {
|
|||
$account = user_load(array((is_numeric($uid) ? "uid" : "name") => $uid, "status" => 1));
|
||||
|
||||
// Breadcrumb navigation:
|
||||
$trail[] = l(t("Home"), NULL);
|
||||
$trail[] = l(t("Blogs"), "blog");
|
||||
$trail[] = t("%name's blog", array("%name" => $account->name));
|
||||
theme("breadcrumb", $trail);
|
||||
$breadcrumb[] = l(t("Home"), NULL);
|
||||
$breadcrumb[] = l(t("Blogs"), "blog");
|
||||
$breadcrumb[] = t("%name's blog", array("%name" => $account->name));
|
||||
theme("breadcrumb", $breadcrumb);
|
||||
|
||||
$result = pager_query("SELECT nid FROM {node} WHERE type = 'blog' AND uid = '$account->uid' AND status = 1 ORDER BY nid DESC", variable_get("default_nodes_main", 10));
|
||||
while ($node = db_fetch_object($result)) {
|
||||
|
@ -142,9 +142,9 @@ function blog_page_last() {
|
|||
global $user;
|
||||
|
||||
// Breadcrumb navigation:
|
||||
$trail[] = l(t("Home"), NULL);
|
||||
$trail[] = t("Blogs");
|
||||
theme("breadcrumb", $trail);
|
||||
$breadcrumb[] = l(t("Home"), NULL);
|
||||
$breadcrumb[] = t("Blogs");
|
||||
theme("breadcrumb", $breadcrumb);
|
||||
|
||||
$result = pager_query("SELECT nid FROM {node} WHERE type = 'blog' AND status = 1 ORDER BY nid DESC", variable_get("default_nodes_main", 10));
|
||||
|
||||
|
@ -229,19 +229,26 @@ function blog_page() {
|
|||
|
||||
}
|
||||
|
||||
function blog_view($node, $main = 0) {
|
||||
if ($main == 0) {
|
||||
// Breadcrumb navigation:
|
||||
$node->trail[] = l(t("Home"), NULL);
|
||||
$node->trail[] = l(t("%name's blog", array("%name" => $node->name)), "blog/$node->uid");
|
||||
}
|
||||
|
||||
function blog_content($node) {
|
||||
$node->teaser = check_output($node->teaser);
|
||||
$node->body = check_output($node->body);
|
||||
|
||||
return $node;
|
||||
}
|
||||
|
||||
function blog_view($node, $main = 0) {
|
||||
if ($main == 0) {
|
||||
// Breadcrumb navigation
|
||||
$breadcrumb[] = l(t("Home"), NULL);
|
||||
$breadcrumb[] = l(t("%name's blog", array("%name" => $node->name)), "blog/$node->uid");
|
||||
// print the breadcrumb
|
||||
theme("breadcrumb",$breadcrumb);
|
||||
}
|
||||
// prepair the node content
|
||||
$node = blog_content($node);
|
||||
// print the node
|
||||
theme("node", $node, $main);
|
||||
}
|
||||
|
||||
function blog_link($type, $node = 0, $main) {
|
||||
global $user;
|
||||
|
||||
|
|
|
@ -125,10 +125,10 @@ function blog_page_user($uid) {
|
|||
$account = user_load(array((is_numeric($uid) ? "uid" : "name") => $uid, "status" => 1));
|
||||
|
||||
// Breadcrumb navigation:
|
||||
$trail[] = l(t("Home"), NULL);
|
||||
$trail[] = l(t("Blogs"), "blog");
|
||||
$trail[] = t("%name's blog", array("%name" => $account->name));
|
||||
theme("breadcrumb", $trail);
|
||||
$breadcrumb[] = l(t("Home"), NULL);
|
||||
$breadcrumb[] = l(t("Blogs"), "blog");
|
||||
$breadcrumb[] = t("%name's blog", array("%name" => $account->name));
|
||||
theme("breadcrumb", $breadcrumb);
|
||||
|
||||
$result = pager_query("SELECT nid FROM {node} WHERE type = 'blog' AND uid = '$account->uid' AND status = 1 ORDER BY nid DESC", variable_get("default_nodes_main", 10));
|
||||
while ($node = db_fetch_object($result)) {
|
||||
|
@ -142,9 +142,9 @@ function blog_page_last() {
|
|||
global $user;
|
||||
|
||||
// Breadcrumb navigation:
|
||||
$trail[] = l(t("Home"), NULL);
|
||||
$trail[] = t("Blogs");
|
||||
theme("breadcrumb", $trail);
|
||||
$breadcrumb[] = l(t("Home"), NULL);
|
||||
$breadcrumb[] = t("Blogs");
|
||||
theme("breadcrumb", $breadcrumb);
|
||||
|
||||
$result = pager_query("SELECT nid FROM {node} WHERE type = 'blog' AND status = 1 ORDER BY nid DESC", variable_get("default_nodes_main", 10));
|
||||
|
||||
|
@ -229,19 +229,26 @@ function blog_page() {
|
|||
|
||||
}
|
||||
|
||||
function blog_view($node, $main = 0) {
|
||||
if ($main == 0) {
|
||||
// Breadcrumb navigation:
|
||||
$node->trail[] = l(t("Home"), NULL);
|
||||
$node->trail[] = l(t("%name's blog", array("%name" => $node->name)), "blog/$node->uid");
|
||||
}
|
||||
|
||||
function blog_content($node) {
|
||||
$node->teaser = check_output($node->teaser);
|
||||
$node->body = check_output($node->body);
|
||||
|
||||
return $node;
|
||||
}
|
||||
|
||||
function blog_view($node, $main = 0) {
|
||||
if ($main == 0) {
|
||||
// Breadcrumb navigation
|
||||
$breadcrumb[] = l(t("Home"), NULL);
|
||||
$breadcrumb[] = l(t("%name's blog", array("%name" => $node->name)), "blog/$node->uid");
|
||||
// print the breadcrumb
|
||||
theme("breadcrumb",$breadcrumb);
|
||||
}
|
||||
// prepair the node content
|
||||
$node = blog_content($node);
|
||||
// print the node
|
||||
theme("node", $node, $main);
|
||||
}
|
||||
|
||||
function blog_link($type, $node = 0, $main) {
|
||||
global $user;
|
||||
|
||||
|
|
|
@ -346,29 +346,9 @@ function book_next($node) {
|
|||
}
|
||||
}
|
||||
|
||||
function book_body($node) {
|
||||
function book_content($node) {
|
||||
$op = $_POST["op"];
|
||||
|
||||
if ($node->format == 1) {
|
||||
// Make sure only authorized users can preview PHP pages.
|
||||
if ($op == t("Preview") && !user_access("create php content")) {
|
||||
return;
|
||||
}
|
||||
|
||||
ob_start();
|
||||
eval($node->body);
|
||||
$output = ob_get_contents();
|
||||
ob_end_clean();
|
||||
}
|
||||
else {
|
||||
$output = check_output($node->body);
|
||||
}
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
function book_view($node, $main = 0, $return = 0) {
|
||||
|
||||
/*
|
||||
** Always display the most recently approved revision of a node
|
||||
** (if any) unless we have to display this page in the context of
|
||||
|
@ -388,8 +368,27 @@ function book_view($node, $main = 0, $return = 0) {
|
|||
** will be generated.
|
||||
*/
|
||||
|
||||
$node->body = book_body($node);
|
||||
if ($node->format == 1) {
|
||||
// Make sure only authorized users can preview PHP pages.
|
||||
if ($op == t("Preview") && !user_access("create php content")) {
|
||||
return;
|
||||
}
|
||||
|
||||
ob_start();
|
||||
eval($node->body);
|
||||
$node->teaser = $node->body = ob_get_contents();
|
||||
ob_end_clean();
|
||||
}
|
||||
else {
|
||||
$node->teaser = check_output($node->teaser);
|
||||
$node->body = check_output($node->body);
|
||||
}
|
||||
|
||||
return $node;
|
||||
}
|
||||
|
||||
function book_view($node, $main = 0) {
|
||||
$node = book_content($node);
|
||||
/*
|
||||
** Display the node. If not displayed on the main page, we render
|
||||
** the node as a page in the book with extra links to the previous
|
||||
|
@ -397,57 +396,69 @@ function book_view($node, $main = 0, $return = 0) {
|
|||
*/
|
||||
|
||||
if ($main) {
|
||||
return $node;
|
||||
theme("node", $node, $main);
|
||||
}
|
||||
else {
|
||||
// build the tree from bottom to top to have the book index in $level for navigation later
|
||||
$path = book_location($node);
|
||||
$node->trail[] = l(t("Home"), "");
|
||||
$node->trail[] = l(t("Books"), "book");
|
||||
foreach ($path as $level) {
|
||||
$node->trail[] = l($level->title, "book/view/$level->nid");
|
||||
}
|
||||
if ($node->moderate) {
|
||||
$node->body = $node->body . "<div class=\"log\"><div class=\"title\">". t("Log") .":</div>$node->log</div>";
|
||||
}
|
||||
if (!$return) { // Add the navigation when we have a node/view and the output is for theme("node")
|
||||
// Add the navigation and the breadcrumb if we view a page
|
||||
if (arg(1) == "view") {
|
||||
$node = book_navigation($node);
|
||||
// Print the breadcrumb
|
||||
theme("breadcrumb", $node->breadcrumb);
|
||||
}
|
||||
return $node;
|
||||
// Print the node
|
||||
theme("node", $node, $main);
|
||||
}
|
||||
}
|
||||
|
||||
function book_show($node, $cid) {
|
||||
|
||||
$node = node_view($node,0,1);
|
||||
|
||||
/*
|
||||
** Add the book navigation
|
||||
*/
|
||||
|
||||
$book = db_fetch_object(db_query("SELECT * FROM {book} WHERE nid = %d", $node->nid));
|
||||
|
||||
if ($book) {
|
||||
foreach ($book as $key => $value) {
|
||||
$node->$key = $value;
|
||||
}
|
||||
$node = book_navigation($node);
|
||||
}
|
||||
|
||||
/*
|
||||
** make $node->type a book. This is for the links.
|
||||
*/
|
||||
|
||||
$node->type = "book";
|
||||
|
||||
/*
|
||||
** View the node
|
||||
*/
|
||||
|
||||
if (node_access("view", $node)) {
|
||||
theme("breadcrumb", $node->trail);
|
||||
theme("node",$node, 0);
|
||||
|
||||
if ($node->type == "book") {
|
||||
book_view($node,0);
|
||||
}
|
||||
else {
|
||||
|
||||
if (module_hook($node->type, "content")) {
|
||||
$node = node_invoke($node, "content");
|
||||
|
||||
/*
|
||||
** Add the book navigation if the node is in the book.
|
||||
*/
|
||||
|
||||
$book = db_fetch_object(db_query("SELECT * FROM {book} WHERE nid = %d", $node->nid));
|
||||
|
||||
if ($book) {
|
||||
foreach ($book as $key => $value) {
|
||||
$node->$key = $value;
|
||||
}
|
||||
$node = book_navigation($node);
|
||||
}
|
||||
|
||||
/*
|
||||
** make $node->type a book. This is for the links.
|
||||
*/
|
||||
|
||||
$node->type = "book";
|
||||
|
||||
/*
|
||||
** View the node
|
||||
*/
|
||||
theme("breadcrumb", $node->breadcrumb);
|
||||
theme("node",$node, 0);
|
||||
}
|
||||
else {
|
||||
|
||||
/*
|
||||
** We can't get the content of the node and just view the node.
|
||||
** We don't add breadcrums or links.
|
||||
*/
|
||||
node_view($node, 0);
|
||||
}
|
||||
}
|
||||
if (function_exists("comment_render") && $node->comment) {
|
||||
comment_render($node, $cid);
|
||||
}
|
||||
|
@ -463,14 +474,17 @@ function book_navigation($node) {
|
|||
|
||||
$path = book_location($node);
|
||||
|
||||
if ($node->type != "book") {
|
||||
$node->trail = ""; // Overwrite the trail with a book trail.
|
||||
$node->trail[] = l(t("Home"), "");
|
||||
$node->trail[] = l(t("Books"), "book");
|
||||
foreach ($path as $level) {
|
||||
$node->trail[] = l($level->title, "book/view/$level->nid");
|
||||
}
|
||||
/*
|
||||
** Construct the breadcrumb:
|
||||
*/
|
||||
|
||||
$node->breadcrumb = ""; // Overwrite the trail with a book trail.
|
||||
$node->breadcrumb[] = l(t("Home"), "");
|
||||
$node->breadcrumb[] = l(t("Books"), "book");
|
||||
foreach ($path as $level) {
|
||||
$node->breadcrumb[] = l($level->title, "book/view/$level->nid");
|
||||
}
|
||||
|
||||
/*
|
||||
** Construct the "next" and "previous" links:
|
||||
*/
|
||||
|
@ -501,6 +515,10 @@ function book_navigation($node) {
|
|||
if ($node->parent) {
|
||||
$links .= "<div class=\"up\">";
|
||||
$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 .= "</div>";
|
||||
}
|
||||
$output .= "<div class=\"nav\">";
|
||||
|
@ -511,7 +529,7 @@ function book_navigation($node) {
|
|||
}
|
||||
$node->body = $node->body.$output;
|
||||
return $node;
|
||||
}
|
||||
}
|
||||
|
||||
function book_toc_recurse($nid, $indent, $toc, $children) {
|
||||
|
||||
|
@ -598,16 +616,13 @@ function book_render() {
|
|||
// load the node:
|
||||
$node = node_load(array("nid" => $page->nid));
|
||||
|
||||
// take the most recent approved revision:
|
||||
if ($node->moderate) {
|
||||
$node = book_revision_load($node, array("moderate" => 0, "status" => 1));
|
||||
}
|
||||
|
||||
if ($node) {
|
||||
// take the most recent approved revision, extract the page and check output:
|
||||
$node = book_content($node);
|
||||
// output the content:
|
||||
$output .= "<div class=\"book\">";
|
||||
$output .= "<div class=\"title\">". l($node->title, "book/view/$node->nid") ."</div>";
|
||||
$output .= "<div class=\"body\">". book_body($node) ."</div>";
|
||||
$output .= "<div class=\"body\">". $node->body ."</div>";
|
||||
$output .= "</div>";
|
||||
}
|
||||
}
|
||||
|
@ -649,15 +664,13 @@ function book_print($id = "", $depth = 1) {
|
|||
// load the node:
|
||||
$node = node_load(array("nid" => $page->nid));
|
||||
|
||||
// take the most recent approved revision:
|
||||
if ($node->moderate) {
|
||||
$node = book_revision_load($node, array("moderate" => 0, "status" => 1));
|
||||
}
|
||||
|
||||
if ($node) {
|
||||
$node = node_view($node, 0, 1);
|
||||
// output the content:
|
||||
if (module_hook($node->type, "content")) {
|
||||
$node = node_invoke($node, "content");
|
||||
}
|
||||
$output .= "<h1 id=\"$node->nid\" name=\"$node->nid\" class=\"book-h$depth\">$node->title</h1>";
|
||||
|
||||
if ($node->body) {
|
||||
$output .= $node->body;
|
||||
}
|
||||
|
@ -688,8 +701,11 @@ function book_print_recurse($parent = "", $depth = 1) {
|
|||
|
||||
if ($node) {
|
||||
// output the content:
|
||||
if (module_hook($node->type, "content")) {
|
||||
$node = node_invoke($node, "content");
|
||||
}
|
||||
$output .= "<h1 id=\"$node->nid\" name=\"$node->nid\" class=\"book-h$depth\">$node->title</h1>";
|
||||
$node = node_view($node, 0, 1);
|
||||
|
||||
if ($node->body) {
|
||||
$output .= "<ul>". $node->body ."</ul>";
|
||||
}
|
||||
|
|
|
@ -346,29 +346,9 @@ function book_next($node) {
|
|||
}
|
||||
}
|
||||
|
||||
function book_body($node) {
|
||||
function book_content($node) {
|
||||
$op = $_POST["op"];
|
||||
|
||||
if ($node->format == 1) {
|
||||
// Make sure only authorized users can preview PHP pages.
|
||||
if ($op == t("Preview") && !user_access("create php content")) {
|
||||
return;
|
||||
}
|
||||
|
||||
ob_start();
|
||||
eval($node->body);
|
||||
$output = ob_get_contents();
|
||||
ob_end_clean();
|
||||
}
|
||||
else {
|
||||
$output = check_output($node->body);
|
||||
}
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
function book_view($node, $main = 0, $return = 0) {
|
||||
|
||||
/*
|
||||
** Always display the most recently approved revision of a node
|
||||
** (if any) unless we have to display this page in the context of
|
||||
|
@ -388,8 +368,27 @@ function book_view($node, $main = 0, $return = 0) {
|
|||
** will be generated.
|
||||
*/
|
||||
|
||||
$node->body = book_body($node);
|
||||
if ($node->format == 1) {
|
||||
// Make sure only authorized users can preview PHP pages.
|
||||
if ($op == t("Preview") && !user_access("create php content")) {
|
||||
return;
|
||||
}
|
||||
|
||||
ob_start();
|
||||
eval($node->body);
|
||||
$node->teaser = $node->body = ob_get_contents();
|
||||
ob_end_clean();
|
||||
}
|
||||
else {
|
||||
$node->teaser = check_output($node->teaser);
|
||||
$node->body = check_output($node->body);
|
||||
}
|
||||
|
||||
return $node;
|
||||
}
|
||||
|
||||
function book_view($node, $main = 0) {
|
||||
$node = book_content($node);
|
||||
/*
|
||||
** Display the node. If not displayed on the main page, we render
|
||||
** the node as a page in the book with extra links to the previous
|
||||
|
@ -397,57 +396,69 @@ function book_view($node, $main = 0, $return = 0) {
|
|||
*/
|
||||
|
||||
if ($main) {
|
||||
return $node;
|
||||
theme("node", $node, $main);
|
||||
}
|
||||
else {
|
||||
// build the tree from bottom to top to have the book index in $level for navigation later
|
||||
$path = book_location($node);
|
||||
$node->trail[] = l(t("Home"), "");
|
||||
$node->trail[] = l(t("Books"), "book");
|
||||
foreach ($path as $level) {
|
||||
$node->trail[] = l($level->title, "book/view/$level->nid");
|
||||
}
|
||||
if ($node->moderate) {
|
||||
$node->body = $node->body . "<div class=\"log\"><div class=\"title\">". t("Log") .":</div>$node->log</div>";
|
||||
}
|
||||
if (!$return) { // Add the navigation when we have a node/view and the output is for theme("node")
|
||||
// Add the navigation and the breadcrumb if we view a page
|
||||
if (arg(1) == "view") {
|
||||
$node = book_navigation($node);
|
||||
// Print the breadcrumb
|
||||
theme("breadcrumb", $node->breadcrumb);
|
||||
}
|
||||
return $node;
|
||||
// Print the node
|
||||
theme("node", $node, $main);
|
||||
}
|
||||
}
|
||||
|
||||
function book_show($node, $cid) {
|
||||
|
||||
$node = node_view($node,0,1);
|
||||
|
||||
/*
|
||||
** Add the book navigation
|
||||
*/
|
||||
|
||||
$book = db_fetch_object(db_query("SELECT * FROM {book} WHERE nid = %d", $node->nid));
|
||||
|
||||
if ($book) {
|
||||
foreach ($book as $key => $value) {
|
||||
$node->$key = $value;
|
||||
}
|
||||
$node = book_navigation($node);
|
||||
}
|
||||
|
||||
/*
|
||||
** make $node->type a book. This is for the links.
|
||||
*/
|
||||
|
||||
$node->type = "book";
|
||||
|
||||
/*
|
||||
** View the node
|
||||
*/
|
||||
|
||||
if (node_access("view", $node)) {
|
||||
theme("breadcrumb", $node->trail);
|
||||
theme("node",$node, 0);
|
||||
|
||||
if ($node->type == "book") {
|
||||
book_view($node,0);
|
||||
}
|
||||
else {
|
||||
|
||||
if (module_hook($node->type, "content")) {
|
||||
$node = node_invoke($node, "content");
|
||||
|
||||
/*
|
||||
** Add the book navigation if the node is in the book.
|
||||
*/
|
||||
|
||||
$book = db_fetch_object(db_query("SELECT * FROM {book} WHERE nid = %d", $node->nid));
|
||||
|
||||
if ($book) {
|
||||
foreach ($book as $key => $value) {
|
||||
$node->$key = $value;
|
||||
}
|
||||
$node = book_navigation($node);
|
||||
}
|
||||
|
||||
/*
|
||||
** make $node->type a book. This is for the links.
|
||||
*/
|
||||
|
||||
$node->type = "book";
|
||||
|
||||
/*
|
||||
** View the node
|
||||
*/
|
||||
theme("breadcrumb", $node->breadcrumb);
|
||||
theme("node",$node, 0);
|
||||
}
|
||||
else {
|
||||
|
||||
/*
|
||||
** We can't get the content of the node and just view the node.
|
||||
** We don't add breadcrums or links.
|
||||
*/
|
||||
node_view($node, 0);
|
||||
}
|
||||
}
|
||||
if (function_exists("comment_render") && $node->comment) {
|
||||
comment_render($node, $cid);
|
||||
}
|
||||
|
@ -463,14 +474,17 @@ function book_navigation($node) {
|
|||
|
||||
$path = book_location($node);
|
||||
|
||||
if ($node->type != "book") {
|
||||
$node->trail = ""; // Overwrite the trail with a book trail.
|
||||
$node->trail[] = l(t("Home"), "");
|
||||
$node->trail[] = l(t("Books"), "book");
|
||||
foreach ($path as $level) {
|
||||
$node->trail[] = l($level->title, "book/view/$level->nid");
|
||||
}
|
||||
/*
|
||||
** Construct the breadcrumb:
|
||||
*/
|
||||
|
||||
$node->breadcrumb = ""; // Overwrite the trail with a book trail.
|
||||
$node->breadcrumb[] = l(t("Home"), "");
|
||||
$node->breadcrumb[] = l(t("Books"), "book");
|
||||
foreach ($path as $level) {
|
||||
$node->breadcrumb[] = l($level->title, "book/view/$level->nid");
|
||||
}
|
||||
|
||||
/*
|
||||
** Construct the "next" and "previous" links:
|
||||
*/
|
||||
|
@ -501,6 +515,10 @@ function book_navigation($node) {
|
|||
if ($node->parent) {
|
||||
$links .= "<div class=\"up\">";
|
||||
$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 .= "</div>";
|
||||
}
|
||||
$output .= "<div class=\"nav\">";
|
||||
|
@ -511,7 +529,7 @@ function book_navigation($node) {
|
|||
}
|
||||
$node->body = $node->body.$output;
|
||||
return $node;
|
||||
}
|
||||
}
|
||||
|
||||
function book_toc_recurse($nid, $indent, $toc, $children) {
|
||||
|
||||
|
@ -598,16 +616,13 @@ function book_render() {
|
|||
// load the node:
|
||||
$node = node_load(array("nid" => $page->nid));
|
||||
|
||||
// take the most recent approved revision:
|
||||
if ($node->moderate) {
|
||||
$node = book_revision_load($node, array("moderate" => 0, "status" => 1));
|
||||
}
|
||||
|
||||
if ($node) {
|
||||
// take the most recent approved revision, extract the page and check output:
|
||||
$node = book_content($node);
|
||||
// output the content:
|
||||
$output .= "<div class=\"book\">";
|
||||
$output .= "<div class=\"title\">". l($node->title, "book/view/$node->nid") ."</div>";
|
||||
$output .= "<div class=\"body\">". book_body($node) ."</div>";
|
||||
$output .= "<div class=\"body\">". $node->body ."</div>";
|
||||
$output .= "</div>";
|
||||
}
|
||||
}
|
||||
|
@ -649,15 +664,13 @@ function book_print($id = "", $depth = 1) {
|
|||
// load the node:
|
||||
$node = node_load(array("nid" => $page->nid));
|
||||
|
||||
// take the most recent approved revision:
|
||||
if ($node->moderate) {
|
||||
$node = book_revision_load($node, array("moderate" => 0, "status" => 1));
|
||||
}
|
||||
|
||||
if ($node) {
|
||||
$node = node_view($node, 0, 1);
|
||||
// output the content:
|
||||
if (module_hook($node->type, "content")) {
|
||||
$node = node_invoke($node, "content");
|
||||
}
|
||||
$output .= "<h1 id=\"$node->nid\" name=\"$node->nid\" class=\"book-h$depth\">$node->title</h1>";
|
||||
|
||||
if ($node->body) {
|
||||
$output .= $node->body;
|
||||
}
|
||||
|
@ -688,8 +701,11 @@ function book_print_recurse($parent = "", $depth = 1) {
|
|||
|
||||
if ($node) {
|
||||
// output the content:
|
||||
if (module_hook($node->type, "content")) {
|
||||
$node = node_invoke($node, "content");
|
||||
}
|
||||
$output .= "<h1 id=\"$node->nid\" name=\"$node->nid\" class=\"book-h$depth\">$node->title</h1>";
|
||||
$node = node_view($node, 0, 1);
|
||||
|
||||
if ($node->body) {
|
||||
$output .= "<ul>". $node->body ."</ul>";
|
||||
}
|
||||
|
|
|
@ -207,8 +207,7 @@ function comment_reply($pid, $nid) {
|
|||
comment_view($comment);
|
||||
}
|
||||
else if (user_access("access content")) {
|
||||
$node = node_view(node_load(array("nid" => $nid)),0,1);
|
||||
theme("box", $node->title, $node->body);
|
||||
node_view(node_load(array("nid" => $nid)));
|
||||
$pid = 0;
|
||||
}
|
||||
|
||||
|
@ -259,8 +258,7 @@ function comment_preview($edit) {
|
|||
comment_view($comment);
|
||||
}
|
||||
else {
|
||||
$node = node_view(node_load(array("nid" => $edit["nid"])), 0, 1);
|
||||
theme("box", $node->title, $node->body);
|
||||
node_view(node_load(array("nid" => $edit["nid"])));
|
||||
$edit["pid"] = 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -207,8 +207,7 @@ function comment_reply($pid, $nid) {
|
|||
comment_view($comment);
|
||||
}
|
||||
else if (user_access("access content")) {
|
||||
$node = node_view(node_load(array("nid" => $nid)),0,1);
|
||||
theme("box", $node->title, $node->body);
|
||||
node_view(node_load(array("nid" => $nid)));
|
||||
$pid = 0;
|
||||
}
|
||||
|
||||
|
@ -259,8 +258,7 @@ function comment_preview($edit) {
|
|||
comment_view($comment);
|
||||
}
|
||||
else {
|
||||
$node = node_view(node_load(array("nid" => $edit["nid"])), 0, 1);
|
||||
theme("box", $node->title, $node->body);
|
||||
node_view(node_load(array("nid" => $edit["nid"])));
|
||||
$edit["pid"] = 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -143,6 +143,12 @@ function forum_link($type, $node = 0, $main = 0) {
|
|||
return $links;
|
||||
}
|
||||
|
||||
function forum_content($node) {
|
||||
$node->teaser = check_output($node->teaser);
|
||||
$node->body = check_output($node->body);
|
||||
return $node;
|
||||
}
|
||||
|
||||
function forum_view($node, $main = 0) {
|
||||
|
||||
if ($main == 0) {
|
||||
|
@ -152,16 +158,17 @@ function forum_view($node, $main = 0) {
|
|||
$term_data = taxonomy_get_term($node->taxonomy[0]);
|
||||
}
|
||||
$voc = taxonomy_get_vocabulary($term_data->vid);
|
||||
|
||||
$node->trail[] = l(t("Home"), NULL);
|
||||
$node->trail[] = l(t("Forums"), "forum");
|
||||
$node->trail[] = l($term_data->name, "forum/$term_data->tid");
|
||||
// Breadcrumb navigation
|
||||
$breadcrumb[] = l(t("Home"), NULL);
|
||||
$breadcrumb[] = l(t("Forums"), "forum");
|
||||
$breadcrumb[] = l($term_data->name, "forum/$term_data->tid");
|
||||
// print the breadcrumb
|
||||
theme("breadcrumb",$breadcrumb);
|
||||
}
|
||||
|
||||
$node->teaser = check_output($node->teaser);
|
||||
$node->body = check_output($node->body);
|
||||
|
||||
return $node;
|
||||
// prepair the node content
|
||||
$node = forum_content($node);
|
||||
// print the node
|
||||
theme("node", $node, $main);
|
||||
}
|
||||
|
||||
function forum_validate(&$node) {
|
||||
|
@ -463,8 +470,8 @@ function forum_theme_display($forums, $topics, $parents, $tid, $sortby, $forum_p
|
|||
** Breadcrumb navigation:
|
||||
*/
|
||||
|
||||
$trail[] = l(t("Home"), "");
|
||||
$trail[] = l(t("Forums"), "forum");
|
||||
$breadcrumb[] = l(t("Home"), "");
|
||||
$breadcrumb[] = l(t("Forums"), "forum");
|
||||
|
||||
if ($parents) {
|
||||
$parents = array_reverse($parents);
|
||||
|
@ -473,7 +480,7 @@ function forum_theme_display($forums, $topics, $parents, $tid, $sortby, $forum_p
|
|||
$title = $p->name;
|
||||
}
|
||||
else {
|
||||
$trail[] = l($p->name, "forum/$p->tid");
|
||||
$breadcrumb[] = l($p->name, "forum/$p->tid");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -488,7 +495,7 @@ function forum_theme_display($forums, $topics, $parents, $tid, $sortby, $forum_p
|
|||
$output .= "</div>";
|
||||
|
||||
theme("header");
|
||||
theme("breadcrumb", $trail);
|
||||
theme("breadcrumb", $breadcrumb);
|
||||
theme("box", $title, $output);
|
||||
theme("footer");
|
||||
}
|
||||
|
|
|
@ -143,6 +143,12 @@ function forum_link($type, $node = 0, $main = 0) {
|
|||
return $links;
|
||||
}
|
||||
|
||||
function forum_content($node) {
|
||||
$node->teaser = check_output($node->teaser);
|
||||
$node->body = check_output($node->body);
|
||||
return $node;
|
||||
}
|
||||
|
||||
function forum_view($node, $main = 0) {
|
||||
|
||||
if ($main == 0) {
|
||||
|
@ -152,16 +158,17 @@ function forum_view($node, $main = 0) {
|
|||
$term_data = taxonomy_get_term($node->taxonomy[0]);
|
||||
}
|
||||
$voc = taxonomy_get_vocabulary($term_data->vid);
|
||||
|
||||
$node->trail[] = l(t("Home"), NULL);
|
||||
$node->trail[] = l(t("Forums"), "forum");
|
||||
$node->trail[] = l($term_data->name, "forum/$term_data->tid");
|
||||
// Breadcrumb navigation
|
||||
$breadcrumb[] = l(t("Home"), NULL);
|
||||
$breadcrumb[] = l(t("Forums"), "forum");
|
||||
$breadcrumb[] = l($term_data->name, "forum/$term_data->tid");
|
||||
// print the breadcrumb
|
||||
theme("breadcrumb",$breadcrumb);
|
||||
}
|
||||
|
||||
$node->teaser = check_output($node->teaser);
|
||||
$node->body = check_output($node->body);
|
||||
|
||||
return $node;
|
||||
// prepair the node content
|
||||
$node = forum_content($node);
|
||||
// print the node
|
||||
theme("node", $node, $main);
|
||||
}
|
||||
|
||||
function forum_validate(&$node) {
|
||||
|
@ -463,8 +470,8 @@ function forum_theme_display($forums, $topics, $parents, $tid, $sortby, $forum_p
|
|||
** Breadcrumb navigation:
|
||||
*/
|
||||
|
||||
$trail[] = l(t("Home"), "");
|
||||
$trail[] = l(t("Forums"), "forum");
|
||||
$breadcrumb[] = l(t("Home"), "");
|
||||
$breadcrumb[] = l(t("Forums"), "forum");
|
||||
|
||||
if ($parents) {
|
||||
$parents = array_reverse($parents);
|
||||
|
@ -473,7 +480,7 @@ function forum_theme_display($forums, $topics, $parents, $tid, $sortby, $forum_p
|
|||
$title = $p->name;
|
||||
}
|
||||
else {
|
||||
$trail[] = l($p->name, "forum/$p->tid");
|
||||
$breadcrumb[] = l($p->name, "forum/$p->tid");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -488,7 +495,7 @@ function forum_theme_display($forums, $topics, $parents, $tid, $sortby, $forum_p
|
|||
$output .= "</div>";
|
||||
|
||||
theme("header");
|
||||
theme("breadcrumb", $trail);
|
||||
theme("breadcrumb", $breadcrumb);
|
||||
theme("box", $title, $output);
|
||||
theme("footer");
|
||||
}
|
||||
|
|
|
@ -372,7 +372,7 @@ function node_save($node) {
|
|||
|
||||
}
|
||||
|
||||
function node_view($node, $main = 0, $return = 0) {
|
||||
function node_view($node, $main = 0) {
|
||||
|
||||
$node = array2object($node);
|
||||
|
||||
|
@ -389,7 +389,7 @@ function node_view($node, $main = 0, $return = 0) {
|
|||
*/
|
||||
|
||||
if (module_hook($node->type, "view")) {
|
||||
$node = node_invoke($node, "view", $main, $return);
|
||||
node_invoke($node, "view", $main);
|
||||
}
|
||||
else {
|
||||
|
||||
|
@ -399,17 +399,9 @@ function node_view($node, $main = 0, $return = 0) {
|
|||
|
||||
$node->teaser = check_output($node->teaser);
|
||||
$node->body = check_output($node->body);
|
||||
}
|
||||
|
||||
if (!$return) {
|
||||
if ($node->trail) {
|
||||
theme("breadcrumb", $node->trail);
|
||||
}
|
||||
theme("node", $node, $main);
|
||||
}
|
||||
else {
|
||||
return $node;
|
||||
}
|
||||
}
|
||||
|
||||
function node_show($node, $cid) {
|
||||
|
|
|
@ -372,7 +372,7 @@ function node_save($node) {
|
|||
|
||||
}
|
||||
|
||||
function node_view($node, $main = 0, $return = 0) {
|
||||
function node_view($node, $main = 0) {
|
||||
|
||||
$node = array2object($node);
|
||||
|
||||
|
@ -389,7 +389,7 @@ function node_view($node, $main = 0, $return = 0) {
|
|||
*/
|
||||
|
||||
if (module_hook($node->type, "view")) {
|
||||
$node = node_invoke($node, "view", $main, $return);
|
||||
node_invoke($node, "view", $main);
|
||||
}
|
||||
else {
|
||||
|
||||
|
@ -399,17 +399,9 @@ function node_view($node, $main = 0, $return = 0) {
|
|||
|
||||
$node->teaser = check_output($node->teaser);
|
||||
$node->body = check_output($node->body);
|
||||
}
|
||||
|
||||
if (!$return) {
|
||||
if ($node->trail) {
|
||||
theme("breadcrumb", $node->trail);
|
||||
}
|
||||
theme("node", $node, $main);
|
||||
}
|
||||
else {
|
||||
return $node;
|
||||
}
|
||||
}
|
||||
|
||||
function node_show($node, $cid) {
|
||||
|
|
|
@ -102,7 +102,7 @@ function page_link($type) {
|
|||
return $links;
|
||||
}
|
||||
|
||||
function page_view($node, $main = 0) {
|
||||
function page_content($node) {
|
||||
/*
|
||||
** Extract the page body. If body is dynamic (using PHP code), the body
|
||||
** will be generated.
|
||||
|
@ -123,6 +123,13 @@ function page_view($node, $main = 0) {
|
|||
return $node;
|
||||
}
|
||||
|
||||
function page_view($node, $main) {
|
||||
// prepair the node content
|
||||
$node = page_content($node);
|
||||
// print the node
|
||||
theme("node", $node, $main);
|
||||
}
|
||||
|
||||
function page_form(&$node, &$help, &$error) {
|
||||
if (function_exists("taxonomy_node_form")) {
|
||||
$output .= implode("", taxonomy_node_form("page", $node));
|
||||
|
|
|
@ -102,7 +102,7 @@ function page_link($type) {
|
|||
return $links;
|
||||
}
|
||||
|
||||
function page_view($node, $main = 0) {
|
||||
function page_content($node) {
|
||||
/*
|
||||
** Extract the page body. If body is dynamic (using PHP code), the body
|
||||
** will be generated.
|
||||
|
@ -123,6 +123,13 @@ function page_view($node, $main = 0) {
|
|||
return $node;
|
||||
}
|
||||
|
||||
function page_view($node, $main) {
|
||||
// prepair the node content
|
||||
$node = page_content($node);
|
||||
// print the node
|
||||
theme("node", $node, $main);
|
||||
}
|
||||
|
||||
function page_form(&$node, &$help, &$error) {
|
||||
if (function_exists("taxonomy_node_form")) {
|
||||
$output .= implode("", taxonomy_node_form("page", $node));
|
||||
|
|
|
@ -54,7 +54,7 @@ function poll_block($op = "list", $delta = 0) {
|
|||
$poll = node_load(array("type" => "poll", "created" => $timestamp, "moderate" => "0", "status" => "1"));
|
||||
if ($poll->nid) {
|
||||
// Poll_view dumps the output into $poll->body
|
||||
poll_view($poll, 1, 0, 1);
|
||||
poll_view($poll, 1, 1);
|
||||
}
|
||||
}
|
||||
$block["subject"] = t("Poll: %t", array("%t" => $poll->title));
|
||||
|
@ -325,7 +325,7 @@ function poll_view_processvote(&$node) {
|
|||
}
|
||||
}
|
||||
|
||||
function poll_view(&$node, $main = 0, $return = 0, $block = 0) {
|
||||
function poll_view(&$node, $main = 0, $block = 0) {
|
||||
global $user;
|
||||
|
||||
/*
|
||||
|
@ -361,7 +361,7 @@ function poll_view(&$node, $main = 0, $return = 0, $block = 0) {
|
|||
|
||||
// We also use poll_view() for the side-block
|
||||
if (!$block) {
|
||||
return $node;
|
||||
theme("node", $node, $main);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -54,7 +54,7 @@ function poll_block($op = "list", $delta = 0) {
|
|||
$poll = node_load(array("type" => "poll", "created" => $timestamp, "moderate" => "0", "status" => "1"));
|
||||
if ($poll->nid) {
|
||||
// Poll_view dumps the output into $poll->body
|
||||
poll_view($poll, 1, 0, 1);
|
||||
poll_view($poll, 1, 1);
|
||||
}
|
||||
}
|
||||
$block["subject"] = t("Poll: %t", array("%t" => $poll->title));
|
||||
|
@ -325,7 +325,7 @@ function poll_view_processvote(&$node) {
|
|||
}
|
||||
}
|
||||
|
||||
function poll_view(&$node, $main = 0, $return = 0, $block = 0) {
|
||||
function poll_view(&$node, $main = 0, $block = 0) {
|
||||
global $user;
|
||||
|
||||
/*
|
||||
|
@ -361,7 +361,7 @@ function poll_view(&$node, $main = 0, $return = 0, $block = 0) {
|
|||
|
||||
// We also use poll_view() for the side-block
|
||||
if (!$block) {
|
||||
return $node;
|
||||
theme("node", $node, $main);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -92,4 +92,9 @@ function story_form(&$node, &$help, &$error) {
|
|||
return $output;
|
||||
}
|
||||
|
||||
function story_content($node) {
|
||||
$node->teaser = check_output($node->teaser);
|
||||
$node->body = check_output($node->body);
|
||||
return $node;
|
||||
}
|
||||
?>
|
||||
|
|
|
@ -92,4 +92,9 @@ function story_form(&$node, &$help, &$error) {
|
|||
return $output;
|
||||
}
|
||||
|
||||
function story_content($node) {
|
||||
$node->teaser = check_output($node->teaser);
|
||||
$node->body = check_output($node->body);
|
||||
return $node;
|
||||
}
|
||||
?>
|
||||
|
|
Loading…
Reference in New Issue