? comment_controls.patch Index: modules/comment/comment.module =================================================================== RCS file: /cvs/drupal/drupal/modules/comment/comment.module,v retrieving revision 1.618 diff -u -p -r1.618 comment.module --- modules/comment/comment.module 6 Feb 2008 19:38:27 -0000 1.618 +++ modules/comment/comment.module 14 Feb 2008 10:41:38 -0000 @@ -51,26 +51,6 @@ define('COMMENT_ORDER_NEWEST_FIRST', 1); define('COMMENT_ORDER_OLDEST_FIRST', 2); /** - * Comment controls should be shown above the comment list. - */ -define('COMMENT_CONTROLS_ABOVE', 0); - -/** - * Comment controls should be shown below the comment list. - */ -define('COMMENT_CONTROLS_BELOW', 1); - -/** - * Comment controls should be shown both above and below the comment list. - */ -define('COMMENT_CONTROLS_ABOVE_BELOW', 2); - -/** - * Comment controls are hidden. - */ -define('COMMENT_CONTROLS_HIDDEN', 3); - -/** * Anonymous posters may not enter their contact information. */ define('COMMENT_ANONYMOUS_MAYNOT_CONTACT', 0); @@ -154,9 +134,6 @@ function comment_theme() { 'comment_view' => array( 'arguments' => array('comment' => NULL, 'node' => NULL, 'links' => array(), 'visible' => 1), ), - 'comment_controls' => array( - 'arguments' => array('form' => NULL), - ), 'comment' => array( 'template' => 'comment', 'arguments' => array('comment' => NULL, 'node' => NULL, 'links' => array()), @@ -252,7 +229,6 @@ function comment_node_type($op, $info) { 'comment_default_mode', 'comment_default_order', 'comment_default_per_page', - 'comment_controls', 'comment_anonymous', 'comment_subject_field', 'comment_preview', @@ -521,17 +497,6 @@ function comment_form_alter(&$form, $for '#options' => _comment_per_page(), '#description' => t('Default number of comments for each page: more comments are distributed in several pages.'), ); - $form['comment']['comment_controls'] = array( - '#type' => 'radios', - '#title' => t('Comment controls'), - '#default_value' => variable_get('comment_controls_'. $form['#node_type']->type, COMMENT_CONTROLS_HIDDEN), - '#options' => array( - t('Display above the comments'), - t('Display below the comments'), - t('Display above and below the comments'), - t('Do not display')), - '#description' => t('Position of the comment controls box. The comment controls let the user change the default display mode and display order of comments.'), - ); $form['comment']['comment_anonymous'] = array( '#type' => 'radios', '#title' => t('Anonymous commenting'), @@ -1029,17 +994,8 @@ function comment_render($node, $cid = 0) $comments .= ''; } - $comment_controls = variable_get('comment_controls_'. $node->type, COMMENT_CONTROLS_HIDDEN); - if ($num_rows && ($comment_controls == COMMENT_CONTROLS_ABOVE || $comment_controls == COMMENT_CONTROLS_ABOVE_BELOW)) { - $output .= drupal_get_form('comment_controls', $mode, $order, $comments_per_page); - } - $output .= $comments; $output .= theme('pager', NULL, $comments_per_page, 0); - - if ($num_rows && ($comment_controls == COMMENT_CONTROLS_BELOW || $comment_controls == COMMENT_CONTROLS_ABOVE_BELOW)) { - $output .= drupal_get_form('comment_controls', $mode, $order, $comments_per_page); - } } // If enabled, show new comment form if it's not already being displayed. @@ -1585,88 +1541,6 @@ function theme_comment_view($comment, $n return $output; } - -/** - * Build a comment control form. - * - * @param $mode - * Comment display mode. - * @param $order - * Comment order mode. - * @param $comments_per_page - * Comments per page. - * @ingroup forms - */ -function comment_controls($mode = COMMENT_MODE_THREADED_EXPANDED, $order = COMMENT_ORDER_NEWEST_FIRST, $comments_per_page = 50) { - $form['mode'] = array('#type' => 'select', - '#default_value' => $mode, - '#options' => _comment_get_modes(), - '#weight' => 1, - ); - $form['order'] = array( - '#type' => 'select', - '#default_value' => $order, - '#options' => _comment_get_orders(), - '#weight' => 2, - ); - foreach (_comment_per_page() as $i) { - $options[$i] = t('!a comments per page', array('!a' => $i)); - } - $form['comments_per_page'] = array('#type' => 'select', - '#default_value' => $comments_per_page, - '#options' => $options, - '#weight' => 3, - ); - - $form['submit'] = array('#type' => 'submit', - '#value' => t('Save settings'), - '#weight' => 20, - ); - - return $form; -} - -/** - * Theme comment controls box where the user can change the default display mode and display order of comments. - * - * @param $form - * The form structure. - * @ingroup themeable - */ -function theme_comment_controls($form) { - $output = '