Index: modules/comment.module =================================================================== RCS file: /cvs/drupal/drupal/modules/comment.module,v retrieving revision 1.367 diff -u -F^f -r1.367 comment.module --- modules/comment.module 28 Aug 2005 15:16:58 -0000 1.367 +++ modules/comment.module 30 Aug 2005 00:49:46 -0000 @@ -144,6 +144,13 @@ function comment_menu($may_cache) { 'callback' => 'node_page', 'type' => MENU_CALLBACK); } + if ((arg(0) == 'node') && is_numeric(arg(1)) && variable_get('comment_task', FALSE)) { + $title = t('discuss'); + $num = comment_num_all(arg(1)); + $title .= " ($num)"; + $items[] = array('path' => ('node/'. arg(1) .'/discuss'), 'title' => $title, + 'callback' => 'comment_task', 'callback arguments' => array(arg(1), arg(3)), 'type' => MENU_LOCAL_TASK, 'access' => user_access('access comments')); + } } return $items; @@ -312,6 +319,7 @@ function comment_configure() { } $group = form_radios(t('Default display mode'), 'comment_default_mode', variable_get('comment_default_mode', 4), _comment_get_modes(), t('The default view for comments. Expanded views display the body of the comment. Threaded views keep replies together.')); + $group .= form_checkbox(t('Show comments on own tab when viewing a post.'), 'comment_task', 1, variable_get('comment_task', FALSE)); $group .= form_radios(t('Default display order'), 'comment_default_order', variable_get('comment_default_order', 1), _comment_get_orders(), t('The default sorting for new users and anonymous users while viewing comments. These users may change their view using the comment control panel. For registered users, this change is remembered as a persistent user preference.')); $group .= form_select(t('Default comments per page'), 'comment_default_per_page', variable_get('comment_default_per_page', '50'), _comment_per_page(), t('Default number of comments for each page: more comments are distributed in several pages.')); $group .= form_radios(t('Comment controls'), 'comment_controls', variable_get('comment_controls', 3), array(t('Display above the comments'), t('Display below the comments'), t('Display above and below the comments'), t('Do not display')), t('Position of the comment controls box. The comment controls let the user change the default display mode and display order of comments.')); @@ -388,7 +396,7 @@ function comment_reply($nid, $pid = NULL return comment_preview($edit); } else { - drupal_goto("node/$nid#comment-$cid"); + drupal_goto("node/$nid/discuss#comment-$cid"); } } else if ($_POST['op'] == t('Preview comment')) { @@ -751,6 +759,16 @@ function comment_links($comment, $return return $links; } +function comment_task($nid, $cid = 0) { + $node = node_load(array('nid' => $nid)); + $output = comment_render($node, $cid); + // if (!$output) { + // drupal_set_message(t('there are no comments for this post.')); + // } + drupal_set_title($node->title); + return $output; +} + function comment_render($node, $cid = 0) { global $user; @@ -981,7 +999,7 @@ function comment_delete($cid) { // Clear the cache so an anonymous user sees that his comment was deleted. cache_clear_all(); - drupal_goto("node/$comment->nid"); + drupal_goto("node/$comment->nid/discuss"); } else if ($comment->cid) { $output = theme('confirm', @@ -1302,7 +1320,7 @@ function comment_save_settings() { $_SESSION['comment_comments_per_page'] = $comments_per_page; } - drupal_goto('node/'. $edit['nid'] .'#comment'); + drupal_goto($_GET['q']); } function comment_num_all($nid) {