From 7cb0c537c1108ad94cf368f81b204e68de10c59a Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Wed, 11 Oct 2006 13:17:23 +0000 Subject: [PATCH] - Patch #87995 by merlinofchaos: cleaned up CSS and simplified the code. --- modules/comment/comment.module | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/modules/comment/comment.module b/modules/comment/comment.module index 27bf4ab7db6..f9f37912fdf 100644 --- a/modules/comment/comment.module +++ b/modules/comment/comment.module @@ -888,11 +888,23 @@ function comment_render($node, $cid = 0) { $output .= drupal_get_form('comment_controls', $mode, $order, $comments_per_page); } + $last_depth = 0; + drupal_add_css(drupal_get_path('module', 'comment') . '/comment.css'); while ($comment = db_fetch_object($result)) { $comment = drupal_unpack($comment); $comment->name = $comment->uid ? $comment->registered_name : $comment->name; $comment->depth = count(explode('.', $comment->thread)) - 1; + if ($comment->depth > $last_depth) { + $divs++; + $output .= '
'; + } + else if ($comment->depth < $last_depth) { + $divs--; + $output .= '
'; + } + $last_depth = $comment->depth; + if ($mode == COMMENT_MODE_FLAT_COLLAPSED) { $output .= theme('comment_flat_collapsed', $comment); } @@ -906,7 +918,9 @@ function comment_render($node, $cid = 0) { $output .= theme('comment_thread_expanded', $comment); } } - + for ($i = 0; $i < $divs; $i++) { + $output .= ''; + } $output .= theme('pager', NULL, $comments_per_page, 0); if (db_num_rows($result) && (variable_get('comment_controls', COMMENT_CONTROLS_HIDDEN) == COMMENT_CONTROLS_BELOW || variable_get('comment_controls', COMMENT_CONTROLS_HIDDEN) == COMMENT_CONTROLS_ABOVE_BELOW)) { @@ -1639,23 +1653,13 @@ function theme_comment_flat_expanded($comment) { } function theme_comment_thread_collapsed($comment) { - $output = '
\n"; $output .= theme('comment_view', $comment, '', 0); - $output .= "
\n"; return $output; } function theme_comment_thread_expanded($comment) { $output = ''; - if ($comment->depth) { - $output .= '
\n"; - } - $output .= theme('comment_view', $comment, module_invoke_all('link', 'comment', $comment, 0)); - - if ($comment->depth) { - $output .= "
\n"; - } return $output; }