From 258b5760202eeb7140021cf15e6b7c51eba5127d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A1bor=20Hojtsy?= Date: Fri, 4 Jan 2008 19:24:24 +0000 Subject: #199809 by theborg: comment templates were not checking status properly (fix notice, allows themes to theme in-preview comments differently) --- modules/comment/comment.module | 7 +++++++ modules/comment/comment.tpl.php | 4 +++- themes/bluemarine/comment.tpl.php | 2 +- themes/chameleon/chameleon.theme | 2 +- themes/garland/comment.tpl.php | 2 +- themes/pushbutton/comment.tpl.php | 2 +- 6 files changed, 14 insertions(+), 5 deletions(-) diff --git a/modules/comment/comment.module b/modules/comment/comment.module index 2c2330d1a..4c00cf191 100644 --- a/modules/comment/comment.module +++ b/modules/comment/comment.module @@ -1680,6 +1680,13 @@ function template_preprocess_comment(&$variables) { $variables['submitted'] = theme('comment_submitted', $comment); $variables['title'] = l($comment->subject, $_GET['q'], array('fragment' => "comment-$comment->cid")); $variables['template_files'][] = 'comment-'. $node->type; + // set status to a string representation of comment->status. + if (isset($comment->preview)) { + $variables['status'] = 'comment-preview'; + } + else { + $variables['status'] = ($comment->status == COMMENT_NOT_PUBLISHED) ? 'comment-unpublished' : 'comment-published'; + } } /** diff --git a/modules/comment/comment.tpl.php b/modules/comment/comment.tpl.php index 0a5f9579b..68cc55268 100644 --- a/modules/comment/comment.tpl.php +++ b/modules/comment/comment.tpl.php @@ -13,6 +13,8 @@ * - $new: New comment marker. * - $picture: Authors picture. * - $signature: Authors signature. + * - $status: Comment status. Possible values are: + * comment-unpublished, comment-published or comment-review. * - $submitted: By line with date and time. * - $title: Linked title. * @@ -24,7 +26,7 @@ * @see theme_comment() */ ?> -
+
new): ?> diff --git a/themes/bluemarine/comment.tpl.php b/themes/bluemarine/comment.tpl.php index 1aa1e193a..bd1249119 100644 --- a/themes/bluemarine/comment.tpl.php +++ b/themes/bluemarine/comment.tpl.php @@ -1,7 +1,7 @@ -
+
diff --git a/themes/chameleon/chameleon.theme b/themes/chameleon/chameleon.theme index f86ccfceb..aeac570d9 100644 --- a/themes/chameleon/chameleon.theme +++ b/themes/chameleon/chameleon.theme @@ -157,7 +157,7 @@ function chameleon_comment($comment, $node, $links = array()) { 'title' => t('By !author at @date', array('!author' => theme('username', $comment), '@date' => format_date($comment->timestamp, 'small'))), 'html' => TRUE); - $output = "
status == COMMENT_NOT_PUBLISHED ? ' comment-unpublished' : '') ."\">\n"; + $output = "
\n"; $output .= "

". l($comment->subject, $_GET['q'], array('fragment' => "comment-$comment->cid")) ."

\n"; $output .= "
". $comment->comment; if (!empty($signature)) { diff --git a/themes/garland/comment.tpl.php b/themes/garland/comment.tpl.php index 07ea0bca6..ea83a24d8 100644 --- a/themes/garland/comment.tpl.php +++ b/themes/garland/comment.tpl.php @@ -1,7 +1,7 @@ -
+
diff --git a/themes/pushbutton/comment.tpl.php b/themes/pushbutton/comment.tpl.php index 5311b6aed..264561b69 100644 --- a/themes/pushbutton/comment.tpl.php +++ b/themes/pushbutton/comment.tpl.php @@ -1,7 +1,7 @@ -
+
-- cgit v1.2.3