Index: modules/comment/comment.install =================================================================== RCS file: /cvs/drupal/drupal/modules/comment/comment.install,v retrieving revision 1.39 diff -u -p -r1.39 comment.install --- modules/comment/comment.install 22 Jun 2009 13:21:37 -0000 1.39 +++ modules/comment/comment.install 30 Jun 2009 13:22:24 -0000 @@ -110,6 +110,23 @@ function comment_update_7003() { } /** + * Rename comment display setting variables. + */ +function comment_update_7004() { + $types = node_type_get_types(); + foreach ($types as $type => $object) { + $setting = variable_get('comment_default_mode_' . $type, 4); + if ($setting == 3 || $setting == 4) { + variable_set('comment_default_mode_' . $type, 1); + } + else { + variable_set('comment_default_mode_' . $type, 0); + } + } + return array(); +} + +/** * @} End of "defgroup updates-6.x-to-7.x" * The next series of updates should start at 8000. */ Index: modules/comment/comment.module =================================================================== RCS file: /cvs/drupal/drupal/modules/comment/comment.module,v retrieving revision 1.730 diff -u -p -r1.730 comment.module --- modules/comment/comment.module 30 Jun 2009 09:57:57 -0000 1.730 +++ modules/comment/comment.module 30 Jun 2009 13:22:25 -0000 @@ -21,24 +21,14 @@ define('COMMENT_NOT_PUBLISHED', 0); define('COMMENT_PUBLISHED', 1); /** - * Comments are displayed in a flat list - collapsed. - */ -define('COMMENT_MODE_FLAT_COLLAPSED', 1); - -/** * Comments are displayed in a flat list - expanded. */ -define('COMMENT_MODE_FLAT_EXPANDED', 2); - -/** - * Comments are displayed as a threaded list - collapsed. - */ -define('COMMENT_MODE_THREADED_COLLAPSED', 3); +define('COMMENT_MODE_FLAT', 0); /** * Comments are displayed as a threaded list - expanded. */ -define('COMMENT_MODE_THREADED_EXPANDED', 4); +define('COMMENT_MODE_THREADED', 1); /** * Anonymous posters cannot enter their contact information. @@ -130,15 +120,9 @@ function comment_theme() { 'template' => 'comment-folded', 'arguments' => array('comment' => NULL, 'node' => NULL), ), - 'comment_flat_collapsed' => array( - 'arguments' => array('comment' => NULL, 'node' => NULL), - ), 'comment_flat_expanded' => array( 'arguments' => array('comment' => NULL, 'node' => NULL), ), - 'comment_thread_collapsed' => array( - 'arguments' => array('comment' => NULL, 'node' => NULL), - ), 'comment_thread_expanded' => array( 'arguments' => array('comment' => NULL, 'node' => NULL), ), @@ -404,7 +388,7 @@ function comment_new_page_count($num_com $comments_per_page = _comment_get_display_setting('comments_per_page', $node); $mode = _comment_get_display_setting('mode', $node); $pagenum = NULL; - $flat = in_array($mode, array(COMMENT_MODE_FLAT_COLLAPSED, COMMENT_MODE_FLAT_EXPANDED)); + $flat = $mode == COMMENT_MODE_FLAT ? TRUE : FALSE; if ($num_comments <= $comments_per_page) { // Only one page of comments. $pageno = 0; @@ -569,61 +553,54 @@ function comment_form_node_type_form_alt '#collapsible' => TRUE, '#collapsed' => TRUE, ); - $form['comment']['comment'] = array( - '#type' => 'radios', - '#title' => t('Default comment setting'), - '#default_value' => variable_get('comment_' . $form['#node_type']->type, COMMENT_NODE_OPEN), - '#options' => array(t('Hidden'), t('Closed'), t('Open')), - '#description' => t('Users with the administer comments permission will be able to override this setting.'), - ); $form['comment']['comment_default_mode'] = array( - '#type' => 'radios', - '#title' => t('Default display mode'), - '#default_value' => variable_get('comment_default_mode_' . $form['#node_type']->type, COMMENT_MODE_THREADED_EXPANDED), - '#options' => _comment_get_modes(), - '#description' => t('Expanded views display the body of the comment. Threaded views keep replies together.'), + '#type' => 'checkbox', + '#title' => t('Threading'), + '#default_value' => variable_get('comment_default_mode_' . $form['#node_type']->type, COMMENT_MODE_THREADED), + '#description' => t('Show comment replies in a threaded list.'), ); $form['comment']['comment_default_per_page'] = array( '#type' => 'select', '#title' => t('Comments per page'), '#default_value' => variable_get('comment_default_per_page_' . $form['#node_type']->type, 50), '#options' => _comment_per_page(), - '#description' => t('Additional comments will be displayed on separate pages.'), + ); + + $form['comment']['comment'] = array( + '#type' => 'select', + '#title' => t('Default comment setting'), + '#default_value' => variable_get('comment_' . $form['#node_type']->type, COMMENT_NODE_OPEN), + '#options' => array(t('Hidden'), t('Closed'), t('Open')), + '#description' => t('Users with the administer comments permission will be able to override this setting.'), ); $form['comment']['comment_anonymous'] = array( - '#type' => 'radios', + '#type' => 'select', '#title' => t('Anonymous commenting'), '#default_value' => variable_get('comment_anonymous_' . $form['#node_type']->type, COMMENT_ANONYMOUS_MAYNOT_CONTACT), '#options' => array( COMMENT_ANONYMOUS_MAYNOT_CONTACT => t('Anonymous posters may not enter their contact information'), COMMENT_ANONYMOUS_MAY_CONTACT => t('Anonymous posters may leave their contact information'), COMMENT_ANONYMOUS_MUST_CONTACT => t('Anonymous posters must leave their contact information')), - '#description' => t('This option is enabled when anonymous users have permission to post comments on the permissions page.', array('@url' => url('admin/user/permissions', array('fragment' => 'module-comment')))), ); if (!user_access('post comments', drupal_anonymous_user())) { - $form['comment']['comment_anonymous']['#disabled'] = TRUE; + $form['comment']['comment_anonymous']['#access'] = FALSE; } $form['comment']['comment_subject_field'] = array( - '#type' => 'radios', + '#type' => 'checkbox', '#title' => t('Comment subject field'), '#default_value' => variable_get('comment_subject_field_' . $form['#node_type']->type, 1), - '#options' => array(t('Disabled'), t('Enabled')), - '#description' => t('Can users provide a unique subject for their comments?'), ); $form['comment']['comment_preview'] = array( - '#type' => 'radios', - '#title' => t('Preview comment'), + '#type' => 'checkbox', + '#title' => t('Require preview'), '#default_value' => variable_get('comment_preview_' . $form['#node_type']->type, COMMENT_PREVIEW_REQUIRED), - '#options' => array(t('Optional'), t('Required')), - '#description' => t("Forces a user to look at their comment by clicking on a 'Preview' button before they can actually add the comment"), ); $form['comment']['comment_form_location'] = array( - '#type' => 'radios', - '#title' => t('Location of comment submission form'), + '#type' => 'checkbox', + '#title' => t('Quick reply form'), '#default_value' => variable_get('comment_form_location_' . $form['#node_type']->type, COMMENT_FORM_SEPARATE_PAGE), - '#options' => array(t('Display on separate page'), t('Display below post or comments')), ); } } @@ -1196,7 +1173,7 @@ function comment_render($node, $cid = 0) $query->condition('c.status', COMMENT_PUBLISHED); $count_query->condition('c.status', COMMENT_PUBLISHED); } - if ($mode === COMMENT_MODE_FLAT_COLLAPSED || $mode === COMMENT_MODE_FLAT_EXPANDED) { + if ($mode === COMMENT_MODE_FLAT) { $query->orderBy('c.cid', 'ASC'); } else { @@ -1218,7 +1195,7 @@ function comment_render($node, $cid = 0) $comment->name = $comment->uid ? $comment->registered_name : $comment->name; $comment->depth = count(explode('.', $comment->thread)) - 1; - if ($mode == COMMENT_MODE_THREADED_COLLAPSED || $mode == COMMENT_MODE_THREADED_EXPANDED) { + if ($mode == COMMENT_MODE_THREADED) { if ($comment->depth > $divs) { $divs++; $comments .= '