diff options
Diffstat (limited to 'modules/comment')
-rw-r--r-- | modules/comment/comment.css | 3 | ||||
-rw-r--r-- | modules/comment/comment.module | 27 | ||||
-rw-r--r-- | modules/comment/comment.pages.inc | 2 |
3 files changed, 26 insertions, 6 deletions
diff --git a/modules/comment/comment.css b/modules/comment/comment.css index 0df1470cb..4cc8f4c42 100644 --- a/modules/comment/comment.css +++ b/modules/comment/comment.css @@ -1,5 +1,8 @@ /* $Id$ */ +#comments { + margin-top: 15px; +} .indented { margin-left: 25px; /* LTR */ } diff --git a/modules/comment/comment.module b/modules/comment/comment.module index 831544c0e..c7f4a7f1c 100644 --- a/modules/comment/comment.module +++ b/modules/comment/comment.module @@ -422,7 +422,7 @@ function theme_comment_block() { /** * An implementation of hook_nodeapi_view(). */ -function comment_nodeapi_view($node, $teaser, $page) { +function comment_nodeapi_view($node, $teaser) { $links = array(); if ($node->comment) { @@ -493,6 +493,13 @@ function comment_nodeapi_view($node, $teaser, $page) { '#type' => 'node_links', '#value' => $links, ); + + // Append the list of comments to $node->content for node detail pages. + if ($node->comment && (bool)menu_get_object()) { + $node->content['comments'] = array( + '#markup' => comment_render($node), + ); + } } } @@ -662,6 +669,14 @@ function comment_nodeapi_update_index($node) { } /** + * Implementation of hook_update_index(). + */ +function comment_update_index() { + // Store the maximum possible comments per thread (used for ranking by reply count) + variable_set('node_cron_comments_scale', 1.0 / max(1, db_query('SELECT MAX(comment_count) FROM {node_comment_statistics}')->fetchField())); +} + +/** * Implementation of hook_nodeapi_search_result(). */ function comment_nodeapi_search_result($node) { @@ -740,7 +755,8 @@ function comment_node_url() { */ function comment_save($edit) { global $user; - if (user_access('post comments') && (user_access('administer comments') || node_comment_mode($edit['nid']) == COMMENT_NODE_READ_WRITE)) { + $node = node_load($edit['nid']); + if (user_access('post comments') && (user_access('administer comments') || $node->comment == COMMENT_NODE_READ_WRITE)) { if (!form_get_errors()) { $edit += array( 'mail' => '', @@ -902,7 +918,8 @@ function comment_links($comment, $return = 1) { ); } - if (node_comment_mode($comment->nid) == COMMENT_NODE_READ_WRITE) { + $node = node_load($comment->nid); + if ($node->comment == COMMENT_NODE_READ_WRITE) { if (user_access('administer comments') && user_access('post comments')) { $links['comment_delete'] = array( 'title' => t('delete'), @@ -1118,7 +1135,7 @@ function comment_render($node, $cid = 0) { // If enabled, show new comment form if it's not already being displayed. $reply = arg(0) == 'comment' && arg(1) == 'reply'; - if (user_access('post comments') && node_comment_mode($nid) == COMMENT_NODE_READ_WRITE && (variable_get('comment_form_location_' . $node->type, COMMENT_FORM_SEPARATE_PAGE) == COMMENT_FORM_BELOW) && !$reply) { + if (user_access('post comments') && $node->comment == COMMENT_NODE_READ_WRITE && (variable_get('comment_form_location_' . $node->type, COMMENT_FORM_SEPARATE_PAGE) == COMMENT_FORM_BELOW) && !$reply) { $output .= comment_form_box(array('nid' => $nid), t('Post new comment')); } $output = theme('comment_wrapper', $output, $node); @@ -2158,4 +2175,4 @@ function comment_ranking() { 'arguments' => array(variable_get('node_cron_comments_scale', 0)), ), ); -} +}
\ No newline at end of file diff --git a/modules/comment/comment.pages.inc b/modules/comment/comment.pages.inc index 4b7d08413..a4c94e22a 100644 --- a/modules/comment/comment.pages.inc +++ b/modules/comment/comment.pages.inc @@ -96,7 +96,7 @@ function comment_reply($node, $pid = NULL) { } // Should we show the reply box? - if (node_comment_mode($node->nid) != COMMENT_NODE_READ_WRITE) { + if ($node->comment != COMMENT_NODE_READ_WRITE) { drupal_set_message(t("This discussion is closed: you can't post new comments."), 'error'); drupal_goto("node/$node->nid"); } |