- Committed Nick's _content improvements.

4.3.x
Dries Buytaert 2003-09-20 15:11:41 +00:00
parent 2fbc7fcf27
commit 00a62647bc
17 changed files with 318 additions and 254 deletions

View File

@ -42,8 +42,8 @@ class BaseTheme {
return "misc/$name"; return "misc/$name";
} }
function breadcrumb($trail) { function breadcrumb($breadcrumb) {
print "<div class=\"breadcrumb\">". implode($trail, " &raquo; ") ."</div>"; print "<div class=\"breadcrumb\">". implode($breadcrumb, " &raquo; ") ."</div>";
} }
function node($node, $main) { function node($node, $main) {

View File

@ -125,10 +125,10 @@ function blog_page_user($uid) {
$account = user_load(array((is_numeric($uid) ? "uid" : "name") => $uid, "status" => 1)); $account = user_load(array((is_numeric($uid) ? "uid" : "name") => $uid, "status" => 1));
// Breadcrumb navigation: // Breadcrumb navigation:
$trail[] = l(t("Home"), NULL); $breadcrumb[] = l(t("Home"), NULL);
$trail[] = l(t("Blogs"), "blog"); $breadcrumb[] = l(t("Blogs"), "blog");
$trail[] = t("%name's blog", array("%name" => $account->name)); $breadcrumb[] = t("%name's blog", array("%name" => $account->name));
theme("breadcrumb", $trail); 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)); $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)) { while ($node = db_fetch_object($result)) {
@ -142,9 +142,9 @@ function blog_page_last() {
global $user; global $user;
// Breadcrumb navigation: // Breadcrumb navigation:
$trail[] = l(t("Home"), NULL); $breadcrumb[] = l(t("Home"), NULL);
$trail[] = t("Blogs"); $breadcrumb[] = t("Blogs");
theme("breadcrumb", $trail); 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)); $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) { function blog_content($node) {
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");
}
$node->teaser = check_output($node->teaser); $node->teaser = check_output($node->teaser);
$node->body = check_output($node->body); $node->body = check_output($node->body);
return $node; 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) { function blog_link($type, $node = 0, $main) {
global $user; global $user;

View File

@ -125,10 +125,10 @@ function blog_page_user($uid) {
$account = user_load(array((is_numeric($uid) ? "uid" : "name") => $uid, "status" => 1)); $account = user_load(array((is_numeric($uid) ? "uid" : "name") => $uid, "status" => 1));
// Breadcrumb navigation: // Breadcrumb navigation:
$trail[] = l(t("Home"), NULL); $breadcrumb[] = l(t("Home"), NULL);
$trail[] = l(t("Blogs"), "blog"); $breadcrumb[] = l(t("Blogs"), "blog");
$trail[] = t("%name's blog", array("%name" => $account->name)); $breadcrumb[] = t("%name's blog", array("%name" => $account->name));
theme("breadcrumb", $trail); 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)); $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)) { while ($node = db_fetch_object($result)) {
@ -142,9 +142,9 @@ function blog_page_last() {
global $user; global $user;
// Breadcrumb navigation: // Breadcrumb navigation:
$trail[] = l(t("Home"), NULL); $breadcrumb[] = l(t("Home"), NULL);
$trail[] = t("Blogs"); $breadcrumb[] = t("Blogs");
theme("breadcrumb", $trail); 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)); $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) { function blog_content($node) {
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");
}
$node->teaser = check_output($node->teaser); $node->teaser = check_output($node->teaser);
$node->body = check_output($node->body); $node->body = check_output($node->body);
return $node; 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) { function blog_link($type, $node = 0, $main) {
global $user; global $user;

View File

@ -346,29 +346,9 @@ function book_next($node) {
} }
} }
function book_body($node) { function book_content($node) {
$op = $_POST["op"]; $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 ** Always display the most recently approved revision of a node
** (if any) unless we have to display this page in the context of ** (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. ** 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 ** 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 ** the node as a page in the book with extra links to the previous
@ -397,32 +396,37 @@ function book_view($node, $main = 0, $return = 0) {
*/ */
if ($main) { if ($main) {
return $node; theme("node", $node, $main);
} }
else { 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) { if ($node->moderate) {
$node->body = $node->body . "<div class=\"log\"><div class=\"title\">". t("Log") .":</div>$node->log</div>"; $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); $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) { function book_show($node, $cid) {
$node = node_view($node,0,1); if (node_access("view", $node)) {
if ($node->type == "book") {
book_view($node,0);
}
else {
if (module_hook($node->type, "content")) {
$node = node_invoke($node, "content");
/* /*
** Add the book navigation ** 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)); $book = db_fetch_object(db_query("SELECT * FROM {book} WHERE nid = %d", $node->nid));
@ -443,11 +447,18 @@ function book_show($node, $cid) {
/* /*
** View the node ** View the node
*/ */
theme("breadcrumb", $node->breadcrumb);
if (node_access("view", $node)) {
theme("breadcrumb", $node->trail);
theme("node",$node, 0); 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) { if (function_exists("comment_render") && $node->comment) {
comment_render($node, $cid); comment_render($node, $cid);
} }
@ -463,14 +474,17 @@ function book_navigation($node) {
$path = book_location($node); $path = book_location($node);
if ($node->type != "book") { /*
$node->trail = ""; // Overwrite the trail with a book trail. ** Construct the breadcrumb:
$node->trail[] = l(t("Home"), ""); */
$node->trail[] = l(t("Books"), "book");
$node->breadcrumb = ""; // Overwrite the trail with a book trail.
$node->breadcrumb[] = l(t("Home"), "");
$node->breadcrumb[] = l(t("Books"), "book");
foreach ($path as $level) { foreach ($path as $level) {
$node->trail[] = l($level->title, "book/view/$level->nid"); $node->breadcrumb[] = l($level->title, "book/view/$level->nid");
}
} }
/* /*
** Construct the "next" and "previous" links: ** Construct the "next" and "previous" links:
*/ */
@ -501,6 +515,10 @@ function book_navigation($node) {
if ($node->parent) { if ($node->parent) {
$links .= "<div class=\"up\">"; $links .= "<div class=\"up\">";
$links .= l(t("up"), "book/view/$node->parent", array("title" => t("View this page's parent section."))); $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>"; $links .= "</div>";
} }
$output .= "<div class=\"nav\">"; $output .= "<div class=\"nav\">";
@ -598,16 +616,13 @@ function book_render() {
// load the node: // load the node:
$node = node_load(array("nid" => $page->nid)); $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) { if ($node) {
// take the most recent approved revision, extract the page and check output:
$node = book_content($node);
// output the content: // output the content:
$output .= "<div class=\"book\">"; $output .= "<div class=\"book\">";
$output .= "<div class=\"title\">". l($node->title, "book/view/$node->nid") ."</div>"; $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>"; $output .= "</div>";
} }
} }
@ -649,15 +664,13 @@ function book_print($id = "", $depth = 1) {
// load the node: // load the node:
$node = node_load(array("nid" => $page->nid)); $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) { if ($node) {
$node = node_view($node, 0, 1);
// output the content: // 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>"; $output .= "<h1 id=\"$node->nid\" name=\"$node->nid\" class=\"book-h$depth\">$node->title</h1>";
if ($node->body) { if ($node->body) {
$output .= $node->body; $output .= $node->body;
} }
@ -688,8 +701,11 @@ function book_print_recurse($parent = "", $depth = 1) {
if ($node) { if ($node) {
// output the content: // 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>"; $output .= "<h1 id=\"$node->nid\" name=\"$node->nid\" class=\"book-h$depth\">$node->title</h1>";
$node = node_view($node, 0, 1);
if ($node->body) { if ($node->body) {
$output .= "<ul>". $node->body ."</ul>"; $output .= "<ul>". $node->body ."</ul>";
} }

View File

@ -346,29 +346,9 @@ function book_next($node) {
} }
} }
function book_body($node) { function book_content($node) {
$op = $_POST["op"]; $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 ** Always display the most recently approved revision of a node
** (if any) unless we have to display this page in the context of ** (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. ** 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 ** 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 ** the node as a page in the book with extra links to the previous
@ -397,32 +396,37 @@ function book_view($node, $main = 0, $return = 0) {
*/ */
if ($main) { if ($main) {
return $node; theme("node", $node, $main);
} }
else { 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) { if ($node->moderate) {
$node->body = $node->body . "<div class=\"log\"><div class=\"title\">". t("Log") .":</div>$node->log</div>"; $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); $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) { function book_show($node, $cid) {
$node = node_view($node,0,1); if (node_access("view", $node)) {
if ($node->type == "book") {
book_view($node,0);
}
else {
if (module_hook($node->type, "content")) {
$node = node_invoke($node, "content");
/* /*
** Add the book navigation ** 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)); $book = db_fetch_object(db_query("SELECT * FROM {book} WHERE nid = %d", $node->nid));
@ -443,11 +447,18 @@ function book_show($node, $cid) {
/* /*
** View the node ** View the node
*/ */
theme("breadcrumb", $node->breadcrumb);
if (node_access("view", $node)) {
theme("breadcrumb", $node->trail);
theme("node",$node, 0); 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) { if (function_exists("comment_render") && $node->comment) {
comment_render($node, $cid); comment_render($node, $cid);
} }
@ -463,14 +474,17 @@ function book_navigation($node) {
$path = book_location($node); $path = book_location($node);
if ($node->type != "book") { /*
$node->trail = ""; // Overwrite the trail with a book trail. ** Construct the breadcrumb:
$node->trail[] = l(t("Home"), ""); */
$node->trail[] = l(t("Books"), "book");
$node->breadcrumb = ""; // Overwrite the trail with a book trail.
$node->breadcrumb[] = l(t("Home"), "");
$node->breadcrumb[] = l(t("Books"), "book");
foreach ($path as $level) { foreach ($path as $level) {
$node->trail[] = l($level->title, "book/view/$level->nid"); $node->breadcrumb[] = l($level->title, "book/view/$level->nid");
}
} }
/* /*
** Construct the "next" and "previous" links: ** Construct the "next" and "previous" links:
*/ */
@ -501,6 +515,10 @@ function book_navigation($node) {
if ($node->parent) { if ($node->parent) {
$links .= "<div class=\"up\">"; $links .= "<div class=\"up\">";
$links .= l(t("up"), "book/view/$node->parent", array("title" => t("View this page's parent section."))); $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>"; $links .= "</div>";
} }
$output .= "<div class=\"nav\">"; $output .= "<div class=\"nav\">";
@ -598,16 +616,13 @@ function book_render() {
// load the node: // load the node:
$node = node_load(array("nid" => $page->nid)); $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) { if ($node) {
// take the most recent approved revision, extract the page and check output:
$node = book_content($node);
// output the content: // output the content:
$output .= "<div class=\"book\">"; $output .= "<div class=\"book\">";
$output .= "<div class=\"title\">". l($node->title, "book/view/$node->nid") ."</div>"; $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>"; $output .= "</div>";
} }
} }
@ -649,15 +664,13 @@ function book_print($id = "", $depth = 1) {
// load the node: // load the node:
$node = node_load(array("nid" => $page->nid)); $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) { if ($node) {
$node = node_view($node, 0, 1);
// output the content: // 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>"; $output .= "<h1 id=\"$node->nid\" name=\"$node->nid\" class=\"book-h$depth\">$node->title</h1>";
if ($node->body) { if ($node->body) {
$output .= $node->body; $output .= $node->body;
} }
@ -688,8 +701,11 @@ function book_print_recurse($parent = "", $depth = 1) {
if ($node) { if ($node) {
// output the content: // 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>"; $output .= "<h1 id=\"$node->nid\" name=\"$node->nid\" class=\"book-h$depth\">$node->title</h1>";
$node = node_view($node, 0, 1);
if ($node->body) { if ($node->body) {
$output .= "<ul>". $node->body ."</ul>"; $output .= "<ul>". $node->body ."</ul>";
} }

View File

@ -207,8 +207,7 @@ function comment_reply($pid, $nid) {
comment_view($comment); comment_view($comment);
} }
else if (user_access("access content")) { else if (user_access("access content")) {
$node = node_view(node_load(array("nid" => $nid)),0,1); node_view(node_load(array("nid" => $nid)));
theme("box", $node->title, $node->body);
$pid = 0; $pid = 0;
} }
@ -259,8 +258,7 @@ function comment_preview($edit) {
comment_view($comment); comment_view($comment);
} }
else { else {
$node = node_view(node_load(array("nid" => $edit["nid"])), 0, 1); node_view(node_load(array("nid" => $edit["nid"])));
theme("box", $node->title, $node->body);
$edit["pid"] = 0; $edit["pid"] = 0;
} }
} }

View File

@ -207,8 +207,7 @@ function comment_reply($pid, $nid) {
comment_view($comment); comment_view($comment);
} }
else if (user_access("access content")) { else if (user_access("access content")) {
$node = node_view(node_load(array("nid" => $nid)),0,1); node_view(node_load(array("nid" => $nid)));
theme("box", $node->title, $node->body);
$pid = 0; $pid = 0;
} }
@ -259,8 +258,7 @@ function comment_preview($edit) {
comment_view($comment); comment_view($comment);
} }
else { else {
$node = node_view(node_load(array("nid" => $edit["nid"])), 0, 1); node_view(node_load(array("nid" => $edit["nid"])));
theme("box", $node->title, $node->body);
$edit["pid"] = 0; $edit["pid"] = 0;
} }
} }

View File

@ -143,6 +143,12 @@ function forum_link($type, $node = 0, $main = 0) {
return $links; 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) { function forum_view($node, $main = 0) {
if ($main == 0) { if ($main == 0) {
@ -152,16 +158,17 @@ function forum_view($node, $main = 0) {
$term_data = taxonomy_get_term($node->taxonomy[0]); $term_data = taxonomy_get_term($node->taxonomy[0]);
} }
$voc = taxonomy_get_vocabulary($term_data->vid); $voc = taxonomy_get_vocabulary($term_data->vid);
// Breadcrumb navigation
$node->trail[] = l(t("Home"), NULL); $breadcrumb[] = l(t("Home"), NULL);
$node->trail[] = l(t("Forums"), "forum"); $breadcrumb[] = l(t("Forums"), "forum");
$node->trail[] = l($term_data->name, "forum/$term_data->tid"); $breadcrumb[] = l($term_data->name, "forum/$term_data->tid");
// print the breadcrumb
theme("breadcrumb",$breadcrumb);
} }
// prepair the node content
$node->teaser = check_output($node->teaser); $node = forum_content($node);
$node->body = check_output($node->body); // print the node
theme("node", $node, $main);
return $node;
} }
function forum_validate(&$node) { function forum_validate(&$node) {
@ -463,8 +470,8 @@ function forum_theme_display($forums, $topics, $parents, $tid, $sortby, $forum_p
** Breadcrumb navigation: ** Breadcrumb navigation:
*/ */
$trail[] = l(t("Home"), ""); $breadcrumb[] = l(t("Home"), "");
$trail[] = l(t("Forums"), "forum"); $breadcrumb[] = l(t("Forums"), "forum");
if ($parents) { if ($parents) {
$parents = array_reverse($parents); $parents = array_reverse($parents);
@ -473,7 +480,7 @@ function forum_theme_display($forums, $topics, $parents, $tid, $sortby, $forum_p
$title = $p->name; $title = $p->name;
} }
else { 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>"; $output .= "</div>";
theme("header"); theme("header");
theme("breadcrumb", $trail); theme("breadcrumb", $breadcrumb);
theme("box", $title, $output); theme("box", $title, $output);
theme("footer"); theme("footer");
} }

View File

@ -143,6 +143,12 @@ function forum_link($type, $node = 0, $main = 0) {
return $links; 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) { function forum_view($node, $main = 0) {
if ($main == 0) { if ($main == 0) {
@ -152,16 +158,17 @@ function forum_view($node, $main = 0) {
$term_data = taxonomy_get_term($node->taxonomy[0]); $term_data = taxonomy_get_term($node->taxonomy[0]);
} }
$voc = taxonomy_get_vocabulary($term_data->vid); $voc = taxonomy_get_vocabulary($term_data->vid);
// Breadcrumb navigation
$node->trail[] = l(t("Home"), NULL); $breadcrumb[] = l(t("Home"), NULL);
$node->trail[] = l(t("Forums"), "forum"); $breadcrumb[] = l(t("Forums"), "forum");
$node->trail[] = l($term_data->name, "forum/$term_data->tid"); $breadcrumb[] = l($term_data->name, "forum/$term_data->tid");
// print the breadcrumb
theme("breadcrumb",$breadcrumb);
} }
// prepair the node content
$node->teaser = check_output($node->teaser); $node = forum_content($node);
$node->body = check_output($node->body); // print the node
theme("node", $node, $main);
return $node;
} }
function forum_validate(&$node) { function forum_validate(&$node) {
@ -463,8 +470,8 @@ function forum_theme_display($forums, $topics, $parents, $tid, $sortby, $forum_p
** Breadcrumb navigation: ** Breadcrumb navigation:
*/ */
$trail[] = l(t("Home"), ""); $breadcrumb[] = l(t("Home"), "");
$trail[] = l(t("Forums"), "forum"); $breadcrumb[] = l(t("Forums"), "forum");
if ($parents) { if ($parents) {
$parents = array_reverse($parents); $parents = array_reverse($parents);
@ -473,7 +480,7 @@ function forum_theme_display($forums, $topics, $parents, $tid, $sortby, $forum_p
$title = $p->name; $title = $p->name;
} }
else { 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>"; $output .= "</div>";
theme("header"); theme("header");
theme("breadcrumb", $trail); theme("breadcrumb", $breadcrumb);
theme("box", $title, $output); theme("box", $title, $output);
theme("footer"); theme("footer");
} }

View File

@ -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); $node = array2object($node);
@ -389,7 +389,7 @@ function node_view($node, $main = 0, $return = 0) {
*/ */
if (module_hook($node->type, "view")) { if (module_hook($node->type, "view")) {
$node = node_invoke($node, "view", $main, $return); node_invoke($node, "view", $main);
} }
else { else {
@ -399,17 +399,9 @@ function node_view($node, $main = 0, $return = 0) {
$node->teaser = check_output($node->teaser); $node->teaser = check_output($node->teaser);
$node->body = check_output($node->body); $node->body = check_output($node->body);
}
if (!$return) {
if ($node->trail) {
theme("breadcrumb", $node->trail);
}
theme("node", $node, $main); theme("node", $node, $main);
} }
else {
return $node;
}
} }
function node_show($node, $cid) { function node_show($node, $cid) {

View File

@ -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); $node = array2object($node);
@ -389,7 +389,7 @@ function node_view($node, $main = 0, $return = 0) {
*/ */
if (module_hook($node->type, "view")) { if (module_hook($node->type, "view")) {
$node = node_invoke($node, "view", $main, $return); node_invoke($node, "view", $main);
} }
else { else {
@ -399,17 +399,9 @@ function node_view($node, $main = 0, $return = 0) {
$node->teaser = check_output($node->teaser); $node->teaser = check_output($node->teaser);
$node->body = check_output($node->body); $node->body = check_output($node->body);
}
if (!$return) {
if ($node->trail) {
theme("breadcrumb", $node->trail);
}
theme("node", $node, $main); theme("node", $node, $main);
} }
else {
return $node;
}
} }
function node_show($node, $cid) { function node_show($node, $cid) {

View File

@ -102,7 +102,7 @@ function page_link($type) {
return $links; 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 ** Extract the page body. If body is dynamic (using PHP code), the body
** will be generated. ** will be generated.
@ -123,6 +123,13 @@ function page_view($node, $main = 0) {
return $node; 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) { function page_form(&$node, &$help, &$error) {
if (function_exists("taxonomy_node_form")) { if (function_exists("taxonomy_node_form")) {
$output .= implode("", taxonomy_node_form("page", $node)); $output .= implode("", taxonomy_node_form("page", $node));

View File

@ -102,7 +102,7 @@ function page_link($type) {
return $links; 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 ** Extract the page body. If body is dynamic (using PHP code), the body
** will be generated. ** will be generated.
@ -123,6 +123,13 @@ function page_view($node, $main = 0) {
return $node; 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) { function page_form(&$node, &$help, &$error) {
if (function_exists("taxonomy_node_form")) { if (function_exists("taxonomy_node_form")) {
$output .= implode("", taxonomy_node_form("page", $node)); $output .= implode("", taxonomy_node_form("page", $node));

View File

@ -54,7 +54,7 @@ function poll_block($op = "list", $delta = 0) {
$poll = node_load(array("type" => "poll", "created" => $timestamp, "moderate" => "0", "status" => "1")); $poll = node_load(array("type" => "poll", "created" => $timestamp, "moderate" => "0", "status" => "1"));
if ($poll->nid) { if ($poll->nid) {
// Poll_view dumps the output into $poll->body // 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)); $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; 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 // We also use poll_view() for the side-block
if (!$block) { if (!$block) {
return $node; theme("node", $node, $main);
} }
} }

View File

@ -54,7 +54,7 @@ function poll_block($op = "list", $delta = 0) {
$poll = node_load(array("type" => "poll", "created" => $timestamp, "moderate" => "0", "status" => "1")); $poll = node_load(array("type" => "poll", "created" => $timestamp, "moderate" => "0", "status" => "1"));
if ($poll->nid) { if ($poll->nid) {
// Poll_view dumps the output into $poll->body // 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)); $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; 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 // We also use poll_view() for the side-block
if (!$block) { if (!$block) {
return $node; theme("node", $node, $main);
} }
} }

View File

@ -92,4 +92,9 @@ function story_form(&$node, &$help, &$error) {
return $output; return $output;
} }
function story_content($node) {
$node->teaser = check_output($node->teaser);
$node->body = check_output($node->body);
return $node;
}
?> ?>

View File

@ -92,4 +92,9 @@ function story_form(&$node, &$help, &$error) {
return $output; return $output;
} }
function story_content($node) {
$node->teaser = check_output($node->teaser);
$node->body = check_output($node->body);
return $node;
}
?> ?>