diff --git a/includes/theme.inc b/includes/theme.inc index 5f5c69c49e1..36cfbaaaf86 100644 --- a/includes/theme.inc +++ b/includes/theme.inc @@ -42,8 +42,8 @@ class BaseTheme { return "misc/$name"; } - function breadcrumb($trail) { - print "
". implode($trail, " » ") ."
"; + function breadcrumb($breadcrumb) { + print "
". implode($breadcrumb, " » ") ."
"; } function node($node, $main) { diff --git a/modules/blog.module b/modules/blog.module index b3fb6ca8eb2..852d1c58e54 100644 --- a/modules/blog.module +++ b/modules/blog.module @@ -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; diff --git a/modules/blog/blog.module b/modules/blog/blog.module index b3fb6ca8eb2..852d1c58e54 100644 --- a/modules/blog/blog.module +++ b/modules/blog/blog.module @@ -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; diff --git a/modules/book.module b/modules/book.module index 0a74dda55df..af0119679a3 100644 --- a/modules/book.module +++ b/modules/book.module @@ -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 . "
". t("Log") .":
$node->log
"; } - 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 .= "
"; $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 .= "
"; @@ -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 .= "
"; $output .= "
". l($node->title, "book/view/$node->nid") ."
"; - $output .= "
". book_body($node) ."
"; + $output .= "
". $node->body ."
"; $output .= "
"; } } @@ -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 .= "

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

"; + 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 .= "

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

"; - $node = node_view($node, 0, 1); + if ($node->body) { $output .= ""; } diff --git a/modules/book/book.module b/modules/book/book.module index 0a74dda55df..af0119679a3 100644 --- a/modules/book/book.module +++ b/modules/book/book.module @@ -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 . "
". t("Log") .":
$node->log
"; } - 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 .= "
"; $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 .= "
"; @@ -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 .= "
"; $output .= "
". l($node->title, "book/view/$node->nid") ."
"; - $output .= "
". book_body($node) ."
"; + $output .= "
". $node->body ."
"; $output .= "
"; } } @@ -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 .= "

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

"; + 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 .= "

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

"; - $node = node_view($node, 0, 1); + if ($node->body) { $output .= ""; } diff --git a/modules/comment.module b/modules/comment.module index 930e2cdf485..d45fec719d6 100644 --- a/modules/comment.module +++ b/modules/comment.module @@ -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; } } diff --git a/modules/comment/comment.module b/modules/comment/comment.module index 930e2cdf485..d45fec719d6 100644 --- a/modules/comment/comment.module +++ b/modules/comment/comment.module @@ -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; } } diff --git a/modules/forum.module b/modules/forum.module index 1cffa5b77ae..1f7c6e26e8e 100644 --- a/modules/forum.module +++ b/modules/forum.module @@ -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 .= "
"; theme("header"); - theme("breadcrumb", $trail); + theme("breadcrumb", $breadcrumb); theme("box", $title, $output); theme("footer"); } diff --git a/modules/forum/forum.module b/modules/forum/forum.module index 1cffa5b77ae..1f7c6e26e8e 100644 --- a/modules/forum/forum.module +++ b/modules/forum/forum.module @@ -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 .= "
"; theme("header"); - theme("breadcrumb", $trail); + theme("breadcrumb", $breadcrumb); theme("box", $title, $output); theme("footer"); } diff --git a/modules/node.module b/modules/node.module index 1d0a3ff771c..38b6d019553 100644 --- a/modules/node.module +++ b/modules/node.module @@ -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) { diff --git a/modules/node/node.module b/modules/node/node.module index 1d0a3ff771c..38b6d019553 100644 --- a/modules/node/node.module +++ b/modules/node/node.module @@ -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) { diff --git a/modules/page.module b/modules/page.module index e83cf33c35c..842f90e14a6 100644 --- a/modules/page.module +++ b/modules/page.module @@ -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)); diff --git a/modules/page/page.module b/modules/page/page.module index e83cf33c35c..842f90e14a6 100644 --- a/modules/page/page.module +++ b/modules/page/page.module @@ -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)); diff --git a/modules/poll.module b/modules/poll.module index 79a1a9704b8..ab8fbe9ea85 100644 --- a/modules/poll.module +++ b/modules/poll.module @@ -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); } } diff --git a/modules/poll/poll.module b/modules/poll/poll.module index 79a1a9704b8..ab8fbe9ea85 100644 --- a/modules/poll/poll.module +++ b/modules/poll/poll.module @@ -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); } } diff --git a/modules/story.module b/modules/story.module index 1b6a4b1ea08..3357e27c41e 100644 --- a/modules/story.module +++ b/modules/story.module @@ -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; +} ?> diff --git a/modules/story/story.module b/modules/story/story.module index 1b6a4b1ea08..3357e27c41e 100644 --- a/modules/story/story.module +++ b/modules/story/story.module @@ -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; +} ?>