diff options
-rw-r--r-- | includes/theme.inc | 4 | ||||
-rw-r--r-- | misc/drupal.css | 35 | ||||
-rw-r--r-- | modules/blog.module | 15 | ||||
-rw-r--r-- | modules/blog/blog.module | 15 | ||||
-rw-r--r-- | modules/book.module | 131 | ||||
-rw-r--r-- | modules/book/book.module | 131 | ||||
-rw-r--r-- | modules/comment.module | 33 | ||||
-rw-r--r-- | modules/comment/comment.module | 33 | ||||
-rw-r--r-- | modules/forum.module | 12 | ||||
-rw-r--r-- | modules/forum/forum.module | 12 | ||||
-rw-r--r-- | modules/node.module | 17 | ||||
-rw-r--r-- | modules/node/node.module | 17 | ||||
-rw-r--r-- | modules/page.module | 2 | ||||
-rw-r--r-- | modules/page/page.module | 2 | ||||
-rw-r--r-- | modules/poll.module | 6 | ||||
-rw-r--r-- | modules/poll/poll.module | 6 |
16 files changed, 316 insertions, 155 deletions
diff --git a/includes/theme.inc b/includes/theme.inc index 7e6f60212..b087b8f83 100644 --- a/includes/theme.inc +++ b/includes/theme.inc @@ -41,8 +41,8 @@ class BaseTheme { return "misc/$name"; } - function path($path) { - print "<div class=\"path\">". implode($path, " » ") ."</div>"; + function breadcrumb($trail) { + print "<div class=\"breadcrumb\">". implode($trail, " » ") ."</div>"; } function node($node, $main) { diff --git a/misc/drupal.css b/misc/drupal.css index 062510d82..fa8fa72c5 100644 --- a/misc/drupal.css +++ b/misc/drupal.css @@ -34,34 +34,30 @@ th { .book { margin-bottom: 2em; } -.book hr { - clear: both; - border: 0; - height: 1px; - background-color: #888; - color: #888; -} .book .title { font-weight: bold; font-size: 1.3em; + margin-bottom:1em; } -.book .last-updated { - font-size: 0.8em; - margin-top: 0.25em; +.book .tree { + margin-bottom: 2em; } -.book .body { - margin: 1em 0 1em 0; +.book .name { + padding-top:1em; + font-weight: bold; + font-size: 1em; } -.book .links { - clear: both; +.book .nav { border-top: 1px solid #888; - padding-top: 0.5em; + padding-top:0.5em; + padding-bottom: 2em; + border-bottom: 1px solid #888; + clear:both; } .book .nav .links { - margin-top: 2em; + clear: both; } -.book .nav { - margin: 1em 0; +.book .nav .titles { clear: both; } .book .nav .prev { @@ -77,9 +73,6 @@ th { .book .nav .up { text-align: center; } -.book .nav .titles { - clear: both; -} .calendar .row-week td a { display: block; } diff --git a/modules/blog.module b/modules/blog.module index dcae01074..b3fb6ca8e 100644 --- a/modules/blog.module +++ b/modules/blog.module @@ -128,7 +128,7 @@ function blog_page_user($uid) { $trail[] = l(t("Home"), NULL); $trail[] = l(t("Blogs"), "blog"); $trail[] = t("%name's blog", array("%name" => $account->name)); - theme("path", $trail, $trail); + theme("breadcrumb", $trail); $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)) { @@ -144,7 +144,7 @@ function blog_page_last() { // Breadcrumb navigation: $trail[] = l(t("Home"), NULL); $trail[] = t("Blogs"); - theme("path", $trail, $trail); + theme("breadcrumb", $trail); $result = pager_query("SELECT nid FROM {node} WHERE type = 'blog' AND status = 1 ORDER BY nid DESC", variable_get("default_nodes_main", 10)); @@ -232,13 +232,14 @@ function blog_page() { function blog_view($node, $main = 0) { if ($main == 0) { // Breadcrumb navigation: - $trail[] = l(t("Home"), NULL); - $trail[] = l(t("%name's blog", array("%name" => $node->name)), "blog/$node->uid"); - - theme("path", $trail, $trail); + $node->trail[] = l(t("Home"), NULL); + $node->trail[] = l(t("%name's blog", array("%name" => $node->name)), "blog/$node->uid"); } - theme("node", $node, $main); + $node->teaser = check_output($node->teaser); + $node->body = check_output($node->body); + + return $node; } function blog_link($type, $node = 0, $main) { diff --git a/modules/blog/blog.module b/modules/blog/blog.module index dcae01074..b3fb6ca8e 100644 --- a/modules/blog/blog.module +++ b/modules/blog/blog.module @@ -128,7 +128,7 @@ function blog_page_user($uid) { $trail[] = l(t("Home"), NULL); $trail[] = l(t("Blogs"), "blog"); $trail[] = t("%name's blog", array("%name" => $account->name)); - theme("path", $trail, $trail); + theme("breadcrumb", $trail); $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)) { @@ -144,7 +144,7 @@ function blog_page_last() { // Breadcrumb navigation: $trail[] = l(t("Home"), NULL); $trail[] = t("Blogs"); - theme("path", $trail, $trail); + theme("breadcrumb", $trail); $result = pager_query("SELECT nid FROM {node} WHERE type = 'blog' AND status = 1 ORDER BY nid DESC", variable_get("default_nodes_main", 10)); @@ -232,13 +232,14 @@ function blog_page() { function blog_view($node, $main = 0) { if ($main == 0) { // Breadcrumb navigation: - $trail[] = l(t("Home"), NULL); - $trail[] = l(t("%name's blog", array("%name" => $node->name)), "blog/$node->uid"); - - theme("path", $trail, $trail); + $node->trail[] = l(t("Home"), NULL); + $node->trail[] = l(t("%name's blog", array("%name" => $node->name)), "blog/$node->uid"); } - theme("node", $node, $main); + $node->teaser = check_output($node->teaser); + $node->body = check_output($node->body); + + return $node; } function blog_link($type, $node = 0, $main) { diff --git a/modules/book.module b/modules/book.module index 0128d84c4..450fde7a9 100644 --- a/modules/book.module +++ b/modules/book.module @@ -367,7 +367,7 @@ function book_body($node) { return $output; } -function book_view($node, $main = 0) { +function book_view($node, $main = 0, $return = 0) { /* ** Always display the most recently approved revision of a node @@ -397,67 +397,121 @@ function book_view($node, $main = 0) { */ if ($main) { - theme("node", $node, $main); + return $node; } 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") + $node = book_navigation($node); + } + return $node; + } +} + +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 (function_exists("comment_render") && $node->comment) { + comment_render($node, $cid); + } + /* - ** Construct the "next" and "previous" links: + ** Update the history table, stating that this user viewed this node. */ + node_tag_new($node->nid); + } +} - if ($node->nid) { - $prev = book_prev($node); - $next = book_next($node); - } +function book_navigation($node) { - // build the tree from bottom to top to have the book index in $level for navigation later $path = book_location($node); - $trail[] = l(t("Home"), ""); - $trail[] = l(t("Books"), "book"); - foreach ($path as $level) { - $trail[] = l($level->title, "node/view/$level->nid"); - } - theme("path", $trail); - $output .= "<div class=\"book\">"; - $output .= "<div class=\"body\">$node->body</div>"; + 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 "next" and "previous" links: + */ - if ($node->moderate) { - $output .= "<div class=\"log\"><div class=\"title\">". t("Log") .":</div>$node->log</div>"; + if ($node->nid) { + $prev = book_prev($node); + $next = book_next($node); } if ($node->nid) { + $output .= "<div class=\"book\">"; $output .= "<div class=\"tree\">". book_tree($node->nid) ."</div>"; if ($prev) { $links .= "<div class=\"prev\">"; - $links .= l(t("previous"), "node/view/$prev->nid", array("title" => t("View the previous page in this book."))); + $links .= l(t("previous"), "book/view/$prev->nid", array("title" => t("View the previous page in this book."))); $links .= "</div>"; $titles .= "<div class=\"prev\">$prev->title</div>"; } if ($next) { $links .= "<div class=\"next\">"; - $links .= l(t("next"), "node/view/$next->nid", array("title" => t("View the next page in this book."))); + $links .= l(t("next"), "book/view/$next->nid", array("title" => t("View the next page in this book."))); $links .= "</div>"; $titles .= "<div class=\"next\">$next->title</div>"; } + else { + $links .= "<div class=\"next\"> </div>"; // make an empty div to fill the space + } if ($node->parent) { $links .= "<div class=\"up\">"; - $links .= l(t("up"), "node/view/$node->parent", array("title" => t("View this page's parent section."))); - if ($node->parent != $level->nid) { - $links .= " | "; - $links .= l(t("index"), "node/view/$level->nid", array("title" => t("View this book's table of contents."))); - } + $links .= l(t("up"), "book/view/$node->parent", array("title" => t("View this page's parent section."))); $links .= "</div>"; } $output .= "<div class=\"nav\">"; $output .= "<div class=\"links\">$links</div>"; $output .= "<div class=\"titles\">$titles</div>"; $output .= "</div>"; + $output .= "</div>"; } - $output .= "</div>"; - $node->body = $output; - theme("node", $node, 0); + $node->body = $node->body.$output; + return $node; } -} function book_toc_recurse($nid, $indent, $toc, $children) { @@ -506,7 +560,7 @@ function book_tree_recurse($nid, $depth, $children) { if ($children[$nid]) { foreach ($children[$nid] as $foo => $node) { $output .= "<li>"; - $output .= l($node->title, "node/view/$node->nid"); + $output .= l($node->title, "book/view/$node->nid"); if ($tree = book_tree_recurse($node->nid, $depth - 1, $children)) { $output .= "<ul>$tree</ul>"; } @@ -552,7 +606,7 @@ function book_render() { if ($node) { // output the content: $output .= "<div class=\"book\">"; - $output .= "<div class=\"title\">". l($node->title, "node/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>"; } @@ -565,9 +619,14 @@ function book_render() { function book_page() { - if (user_access("access content")) { switch (arg(1)) { + case "view": + $node = node_load(array("nid" => arg(2)), 1); + theme("header"); + book_show($node, arg(3)); + theme("footer"); + break; case "print": print book_print(arg(2), $depth = 1); break; @@ -596,11 +655,11 @@ function book_print($id = "", $depth = 1) { } if ($node) { + $node = node_view($node, 0, 1); // output the content: $output .= "<h1 id=\"$node->nid\" name=\"$node->nid\" class=\"book-h$depth\">$node->title</h1>"; - if ($node->body) { - $output .= book_body($node); + $output .= $node->body; } } } @@ -630,9 +689,9 @@ function book_print_recurse($parent = "", $depth = 1) { if ($node) { // output the 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>". book_body($node) ."</ul>"; + $output .= "<ul>". $node->body ."</ul>"; } $output .= book_print_recurse($node->nid, $depth + 1); diff --git a/modules/book/book.module b/modules/book/book.module index 0128d84c4..450fde7a9 100644 --- a/modules/book/book.module +++ b/modules/book/book.module @@ -367,7 +367,7 @@ function book_body($node) { return $output; } -function book_view($node, $main = 0) { +function book_view($node, $main = 0, $return = 0) { /* ** Always display the most recently approved revision of a node @@ -397,67 +397,121 @@ function book_view($node, $main = 0) { */ if ($main) { - theme("node", $node, $main); + return $node; } 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") + $node = book_navigation($node); + } + return $node; + } +} + +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 (function_exists("comment_render") && $node->comment) { + comment_render($node, $cid); + } + /* - ** Construct the "next" and "previous" links: + ** Update the history table, stating that this user viewed this node. */ + node_tag_new($node->nid); + } +} - if ($node->nid) { - $prev = book_prev($node); - $next = book_next($node); - } +function book_navigation($node) { - // build the tree from bottom to top to have the book index in $level for navigation later $path = book_location($node); - $trail[] = l(t("Home"), ""); - $trail[] = l(t("Books"), "book"); - foreach ($path as $level) { - $trail[] = l($level->title, "node/view/$level->nid"); - } - theme("path", $trail); - $output .= "<div class=\"book\">"; - $output .= "<div class=\"body\">$node->body</div>"; + 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 "next" and "previous" links: + */ - if ($node->moderate) { - $output .= "<div class=\"log\"><div class=\"title\">". t("Log") .":</div>$node->log</div>"; + if ($node->nid) { + $prev = book_prev($node); + $next = book_next($node); } if ($node->nid) { + $output .= "<div class=\"book\">"; $output .= "<div class=\"tree\">". book_tree($node->nid) ."</div>"; if ($prev) { $links .= "<div class=\"prev\">"; - $links .= l(t("previous"), "node/view/$prev->nid", array("title" => t("View the previous page in this book."))); + $links .= l(t("previous"), "book/view/$prev->nid", array("title" => t("View the previous page in this book."))); $links .= "</div>"; $titles .= "<div class=\"prev\">$prev->title</div>"; } if ($next) { $links .= "<div class=\"next\">"; - $links .= l(t("next"), "node/view/$next->nid", array("title" => t("View the next page in this book."))); + $links .= l(t("next"), "book/view/$next->nid", array("title" => t("View the next page in this book."))); $links .= "</div>"; $titles .= "<div class=\"next\">$next->title</div>"; } + else { + $links .= "<div class=\"next\"> </div>"; // make an empty div to fill the space + } if ($node->parent) { $links .= "<div class=\"up\">"; - $links .= l(t("up"), "node/view/$node->parent", array("title" => t("View this page's parent section."))); - if ($node->parent != $level->nid) { - $links .= " | "; - $links .= l(t("index"), "node/view/$level->nid", array("title" => t("View this book's table of contents."))); - } + $links .= l(t("up"), "book/view/$node->parent", array("title" => t("View this page's parent section."))); $links .= "</div>"; } $output .= "<div class=\"nav\">"; $output .= "<div class=\"links\">$links</div>"; $output .= "<div class=\"titles\">$titles</div>"; $output .= "</div>"; + $output .= "</div>"; } - $output .= "</div>"; - $node->body = $output; - theme("node", $node, 0); + $node->body = $node->body.$output; + return $node; } -} function book_toc_recurse($nid, $indent, $toc, $children) { @@ -506,7 +560,7 @@ function book_tree_recurse($nid, $depth, $children) { if ($children[$nid]) { foreach ($children[$nid] as $foo => $node) { $output .= "<li>"; - $output .= l($node->title, "node/view/$node->nid"); + $output .= l($node->title, "book/view/$node->nid"); if ($tree = book_tree_recurse($node->nid, $depth - 1, $children)) { $output .= "<ul>$tree</ul>"; } @@ -552,7 +606,7 @@ function book_render() { if ($node) { // output the content: $output .= "<div class=\"book\">"; - $output .= "<div class=\"title\">". l($node->title, "node/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>"; } @@ -565,9 +619,14 @@ function book_render() { function book_page() { - if (user_access("access content")) { switch (arg(1)) { + case "view": + $node = node_load(array("nid" => arg(2)), 1); + theme("header"); + book_show($node, arg(3)); + theme("footer"); + break; case "print": print book_print(arg(2), $depth = 1); break; @@ -596,11 +655,11 @@ function book_print($id = "", $depth = 1) { } if ($node) { + $node = node_view($node, 0, 1); // output the content: $output .= "<h1 id=\"$node->nid\" name=\"$node->nid\" class=\"book-h$depth\">$node->title</h1>"; - if ($node->body) { - $output .= book_body($node); + $output .= $node->body; } } } @@ -630,9 +689,9 @@ function book_print_recurse($parent = "", $depth = 1) { if ($node) { // output the 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>". book_body($node) ."</ul>"; + $output .= "<ul>". $node->body ."</ul>"; } $output .= book_print_recurse($node->nid, $depth + 1); diff --git a/modules/comment.module b/modules/comment.module index be6743adc..a2a2bddd3 100644 --- a/modules/comment.module +++ b/modules/comment.module @@ -141,6 +141,17 @@ function comment_access($op, $comment) { } } +function comment_referer_save() { + $_SESSION["comment_referer"] = arg(0)."/".arg(1)."/".arg(2); +} + +/* +** Restores the referer from a persistent variable: +*/ + +function comment_referer_load() { + return $_SESSION["comment_referer"]; +} function comment_form($edit) { global $user; @@ -196,7 +207,8 @@ function comment_reply($pid, $nid) { comment_view($comment); } else if (user_access("access content")) { - node_view(node_load(array("nid" => $nid))); + $node = node_view(node_load(array("nid" => $nid)),0,1); + theme("box", $node->title, $node->body); $pid = 0; } @@ -247,7 +259,8 @@ function comment_preview($edit) { comment_view($comment); } else { - node_view(node_load(array("nid" => $edit["nid"]))); + $node = node_view(node_load(array("nid" => $edit["nid"])), 0, 1); + theme("box", $node->title, $node->body); $edit["pid"] = 0; } } @@ -464,7 +477,7 @@ function comment_links($comment, $return = 1) { */ if ($return) { - $links[] = l(t("parent"), "node/view/$comment->nid#$comment->cid"); + $links[] = l(t("parent"), comment_referer_load()."#$comment->cid"); } /* @@ -740,6 +753,11 @@ function comment_render($node, $cid = 0) { theme("box", t("Post new comment"), comment_form(array("nid" => $nid))); } + /* + ** Save were we come from so we can go back after a reply + */ + + comment_referer_save(); } } @@ -837,7 +855,7 @@ function comment_page() { case t("Moderate comments"): case t("Moderate comment"): comment_moderate($edit); - drupal_goto(url("node/view/". $edit["nid"])); + drupal_goto(url(comment_referer_load())); break; case "reply": theme("header"); @@ -857,7 +875,7 @@ function comment_page() { theme("footer"); } else { - drupal_goto(url("node/view/". $edit["nid"])); + drupal_goto(url(comment_referer_load())); } break; case t("Save settings"): @@ -867,7 +885,8 @@ function comment_page() { $comments_per_page = $_POST["comments_per_page"]; comment_save_settings(check_query($mode), check_query($order), check_query($threshold), check_query($comments_per_page)); - drupal_goto(url("node/view/". $edit["nid"], "mode=$mode&order=$order&threshold=$threshold&comments_per_page=$comments_per_page")); + //drupal_goto(url(comment_referer_load(), "mode=$mode&order=$order&threshold=$threshold&comments_per_page=$comments_per_page")); + drupal_goto(url(comment_referer_load())); break; } } @@ -1326,7 +1345,7 @@ function comment($comment, $links = 0) { } function comment_folded($comment) { - print "<div class=\"comment-folded\"><span class=\"subject\">". l($comment->subject, "node/view/$comment->nid/$comment->cid#$comment->cid") ."</span> <span class=\"credit\">". t("by") . " " . format_name($comment) ."</span></div>"; + print "<div class=\"comment-folded\"><span class=\"subject\">". l($comment->subject, comment_referer_load()."/$comment->cid#$comment->cid") ."</span> <span class=\"credit\">". t("by") . " " . format_name($comment) ."</span></div>"; } function comment_flat_collapsed($comment, $threshold) { diff --git a/modules/comment/comment.module b/modules/comment/comment.module index be6743adc..a2a2bddd3 100644 --- a/modules/comment/comment.module +++ b/modules/comment/comment.module @@ -141,6 +141,17 @@ function comment_access($op, $comment) { } } +function comment_referer_save() { + $_SESSION["comment_referer"] = arg(0)."/".arg(1)."/".arg(2); +} + +/* +** Restores the referer from a persistent variable: +*/ + +function comment_referer_load() { + return $_SESSION["comment_referer"]; +} function comment_form($edit) { global $user; @@ -196,7 +207,8 @@ function comment_reply($pid, $nid) { comment_view($comment); } else if (user_access("access content")) { - node_view(node_load(array("nid" => $nid))); + $node = node_view(node_load(array("nid" => $nid)),0,1); + theme("box", $node->title, $node->body); $pid = 0; } @@ -247,7 +259,8 @@ function comment_preview($edit) { comment_view($comment); } else { - node_view(node_load(array("nid" => $edit["nid"]))); + $node = node_view(node_load(array("nid" => $edit["nid"])), 0, 1); + theme("box", $node->title, $node->body); $edit["pid"] = 0; } } @@ -464,7 +477,7 @@ function comment_links($comment, $return = 1) { */ if ($return) { - $links[] = l(t("parent"), "node/view/$comment->nid#$comment->cid"); + $links[] = l(t("parent"), comment_referer_load()."#$comment->cid"); } /* @@ -740,6 +753,11 @@ function comment_render($node, $cid = 0) { theme("box", t("Post new comment"), comment_form(array("nid" => $nid))); } + /* + ** Save were we come from so we can go back after a reply + */ + + comment_referer_save(); } } @@ -837,7 +855,7 @@ function comment_page() { case t("Moderate comments"): case t("Moderate comment"): comment_moderate($edit); - drupal_goto(url("node/view/". $edit["nid"])); + drupal_goto(url(comment_referer_load())); break; case "reply": theme("header"); @@ -857,7 +875,7 @@ function comment_page() { theme("footer"); } else { - drupal_goto(url("node/view/". $edit["nid"])); + drupal_goto(url(comment_referer_load())); } break; case t("Save settings"): @@ -867,7 +885,8 @@ function comment_page() { $comments_per_page = $_POST["comments_per_page"]; comment_save_settings(check_query($mode), check_query($order), check_query($threshold), check_query($comments_per_page)); - drupal_goto(url("node/view/". $edit["nid"], "mode=$mode&order=$order&threshold=$threshold&comments_per_page=$comments_per_page")); + //drupal_goto(url(comment_referer_load(), "mode=$mode&order=$order&threshold=$threshold&comments_per_page=$comments_per_page")); + drupal_goto(url(comment_referer_load())); break; } } @@ -1326,7 +1345,7 @@ function comment($comment, $links = 0) { } function comment_folded($comment) { - print "<div class=\"comment-folded\"><span class=\"subject\">". l($comment->subject, "node/view/$comment->nid/$comment->cid#$comment->cid") ."</span> <span class=\"credit\">". t("by") . " " . format_name($comment) ."</span></div>"; + print "<div class=\"comment-folded\"><span class=\"subject\">". l($comment->subject, comment_referer_load()."/$comment->cid#$comment->cid") ."</span> <span class=\"credit\">". t("by") . " " . format_name($comment) ."</span></div>"; } function comment_flat_collapsed($comment, $threshold) { diff --git a/modules/forum.module b/modules/forum.module index 3ac6dc2ca..1cffa5b77 100644 --- a/modules/forum.module +++ b/modules/forum.module @@ -153,17 +153,15 @@ function forum_view($node, $main = 0) { } $voc = taxonomy_get_vocabulary($term_data->vid); - $trail[] = l(t("Home"), NULL); - $trail[] = l(t("Forums"), "forum"); - $trail[] = l($term_data->name, "forum/$term_data->tid"); - - theme("path", $trail); + $node->trail[] = l(t("Home"), NULL); + $node->trail[] = l(t("Forums"), "forum"); + $node->trail[] = l($term_data->name, "forum/$term_data->tid"); } $node->teaser = check_output($node->teaser); $node->body = check_output($node->body); - theme("node", $node, $main); + return $node; } function forum_validate(&$node) { @@ -490,7 +488,7 @@ function forum_theme_display($forums, $topics, $parents, $tid, $sortby, $forum_p $output .= "</div>"; theme("header"); - theme("path", $trail); + theme("breadcrumb", $trail); theme("box", $title, $output); theme("footer"); } diff --git a/modules/forum/forum.module b/modules/forum/forum.module index 3ac6dc2ca..1cffa5b77 100644 --- a/modules/forum/forum.module +++ b/modules/forum/forum.module @@ -153,17 +153,15 @@ function forum_view($node, $main = 0) { } $voc = taxonomy_get_vocabulary($term_data->vid); - $trail[] = l(t("Home"), NULL); - $trail[] = l(t("Forums"), "forum"); - $trail[] = l($term_data->name, "forum/$term_data->tid"); - - theme("path", $trail); + $node->trail[] = l(t("Home"), NULL); + $node->trail[] = l(t("Forums"), "forum"); + $node->trail[] = l($term_data->name, "forum/$term_data->tid"); } $node->teaser = check_output($node->teaser); $node->body = check_output($node->body); - theme("node", $node, $main); + return $node; } function forum_validate(&$node) { @@ -490,7 +488,7 @@ function forum_theme_display($forums, $topics, $parents, $tid, $sortby, $forum_p $output .= "</div>"; theme("header"); - theme("path", $trail); + theme("breadcrumb", $trail); theme("box", $title, $output); theme("footer"); } diff --git a/modules/node.module b/modules/node.module index ef26aedb9..eda827042 100644 --- a/modules/node.module +++ b/modules/node.module @@ -65,7 +65,7 @@ function node_system($field){ $output = ""; if ($field == "description") {$output = node_help("admin/system/modules"); } - else if ($field == "admin-help") {$output = node_help("admin/system/modules/node");}; + else if ($field == "admin_help") {$output = node_help("admin/system/modules/node");}; return $output; } @@ -372,7 +372,7 @@ function node_save($node) { } -function node_view($node, $main = 0) { +function node_view($node, $main = 0, $return = 0) { $node = array2object($node); @@ -389,7 +389,7 @@ function node_view($node, $main = 0) { */ if (module_hook($node->type, "view")) { - node_invoke($node, "view", $main); + $node = node_invoke($node, "view", $main, $return); } else { @@ -399,9 +399,17 @@ function node_view($node, $main = 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) { @@ -540,8 +548,7 @@ function node_link($type, $node = 0, $main = 0) { if ($main == 1 && $node->teaser && strlen($node->teaser) != strlen($node->body)) { - $links[] = l(t("read more"), "node/view/$node->nid", array("title" => t("Read -the rest of this posting."), "class" => "read-more")); + $links[] = l(t("read more"), "node/view/$node->nid", array("title" => t("Read the rest of this posting."), "class" => "read-more")); } if (user_access("administer nodes")) { diff --git a/modules/node/node.module b/modules/node/node.module index ef26aedb9..eda827042 100644 --- a/modules/node/node.module +++ b/modules/node/node.module @@ -65,7 +65,7 @@ function node_system($field){ $output = ""; if ($field == "description") {$output = node_help("admin/system/modules"); } - else if ($field == "admin-help") {$output = node_help("admin/system/modules/node");}; + else if ($field == "admin_help") {$output = node_help("admin/system/modules/node");}; return $output; } @@ -372,7 +372,7 @@ function node_save($node) { } -function node_view($node, $main = 0) { +function node_view($node, $main = 0, $return = 0) { $node = array2object($node); @@ -389,7 +389,7 @@ function node_view($node, $main = 0) { */ if (module_hook($node->type, "view")) { - node_invoke($node, "view", $main); + $node = node_invoke($node, "view", $main, $return); } else { @@ -399,9 +399,17 @@ function node_view($node, $main = 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) { @@ -540,8 +548,7 @@ function node_link($type, $node = 0, $main = 0) { if ($main == 1 && $node->teaser && strlen($node->teaser) != strlen($node->body)) { - $links[] = l(t("read more"), "node/view/$node->nid", array("title" => t("Read -the rest of this posting."), "class" => "read-more")); + $links[] = l(t("read more"), "node/view/$node->nid", array("title" => t("Read the rest of this posting."), "class" => "read-more")); } if (user_access("administer nodes")) { diff --git a/modules/page.module b/modules/page.module index 2ea0bd1ee..e83cf33c3 100644 --- a/modules/page.module +++ b/modules/page.module @@ -120,7 +120,7 @@ function page_view($node, $main = 0) { $node->teaser = $node->body = ob_get_contents(); ob_end_clean(); } - theme("node", $node, $main); + return $node; } function page_form(&$node, &$help, &$error) { diff --git a/modules/page/page.module b/modules/page/page.module index 2ea0bd1ee..e83cf33c3 100644 --- a/modules/page/page.module +++ b/modules/page/page.module @@ -120,7 +120,7 @@ function page_view($node, $main = 0) { $node->teaser = $node->body = ob_get_contents(); ob_end_clean(); } - theme("node", $node, $main); + return $node; } function page_form(&$node, &$help, &$error) { diff --git a/modules/poll.module b/modules/poll.module index a9a057478..bdf7a2ea1 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, 1); + poll_view($poll, 1, 0, 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, $block = 0) { +function poll_view(&$node, $main = 0, $return = 0, $block = 0) { global $user; /* @@ -361,7 +361,7 @@ function poll_view(&$node, $main = 0, $block = 0) { // We also use poll_view() for the side-block if (!$block) { - theme("node", $node, $main); + return $node; } } diff --git a/modules/poll/poll.module b/modules/poll/poll.module index a9a057478..bdf7a2ea1 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, 1); + poll_view($poll, 1, 0, 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, $block = 0) { +function poll_view(&$node, $main = 0, $return = 0, $block = 0) { global $user; /* @@ -361,7 +361,7 @@ function poll_view(&$node, $main = 0, $block = 0) { // We also use poll_view() for the side-block if (!$block) { - theme("node", $node, $main); + return $node; } } |