summaryrefslogtreecommitdiff
path: root/modules/comment/comment.module
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2006-10-11 13:17:23 +0000
committerDries Buytaert <dries@buytaert.net>2006-10-11 13:17:23 +0000
commit7cb0c537c1108ad94cf368f81b204e68de10c59a (patch)
treef0b69e9e4c6a32800c30689c234b0f7dd5df047d /modules/comment/comment.module
parent416199b2810e735449984804042f93904832b63e (diff)
downloadbrdo-7cb0c537c1108ad94cf368f81b204e68de10c59a.tar.gz
brdo-7cb0c537c1108ad94cf368f81b204e68de10c59a.tar.bz2
- Patch #87995 by merlinofchaos: cleaned up CSS and simplified the code.
Diffstat (limited to 'modules/comment/comment.module')
-rw-r--r--modules/comment/comment.module26
1 files changed, 15 insertions, 11 deletions
diff --git a/modules/comment/comment.module b/modules/comment/comment.module
index 27bf4ab7d..f9f37912f 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 .= '<div class="indented">';
+ }
+ else if ($comment->depth < $last_depth) {
+ $divs--;
+ $output .= '</div>';
+ }
+ $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 .= '</div>';
+ }
$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 = '<div style="margin-left:'. ($comment->depth * 25) ."px;\">\n";
$output .= theme('comment_view', $comment, '', 0);
- $output .= "</div>\n";
return $output;
}
function theme_comment_thread_expanded($comment) {
$output = '';
- if ($comment->depth) {
- $output .= '<div style="margin-left:'. ($comment->depth * 25) ."px;\">\n";
- }
-
$output .= theme('comment_view', $comment, module_invoke_all('link', 'comment', $comment, 0));
-
- if ($comment->depth) {
- $output .= "</div>\n";
- }
return $output;
}