? comment-539216.patch
? modules/comment/.directory
Index: modules/comment/comment-wrapper-form-above.tpl.php
===================================================================
RCS file: modules/comment/comment-wrapper-form-above.tpl.php
diff -N modules/comment/comment-wrapper-form-above.tpl.php
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ modules/comment/comment-wrapper-form-above.tpl.php	5 Aug 2009 08:01:38 -0000
@@ -0,0 +1,46 @@
+<?php
+// $Id: comment-wrapper.tpl.php,v 1.7 2009/07/28 10:09:25 dries Exp $
+
+/**
+ * @file
+ * Default theme implementation to wrap comments.
+ *
+ * Available variables:
+ * - $content: The array of content-related elements for the node. Use
+ *   render($content) to print them all, or
+ *   print a subset such as render($content['comment_form']).
+ * - $classes: String of classes that can be used to style contextually through
+ *   CSS. It can be manipulated through the variable $classes_array from
+ *   preprocess functions. The default value has the following:
+ *   - comment-wrapper: The current template type, i.e., "theming hook".
+ *
+ * The following variables are provided for contextual information.
+ * - $node: Node object the comments are attached to.
+ * The constants below the variables show the possible values and should be
+ * used for comparison.
+ * - $display_mode
+ *   - COMMENT_MODE_FLAT
+ *   - COMMENT_MODE_THREADED
+ *
+ * Other variables:
+ * - $classes_array: Array of html class attribute values. It is flattened
+ *   into a string within the variable $classes.
+ *
+ * @see template_preprocess_comment_wrapper()
+ * @see theme_comment_wrapper()
+ */
+?>
+<div id="comments" class="<?php print $classes; ?>">
+  <?php if ($node->type != 'forum'): ?>
+    <h2 class="comments"><?php print t('Comments'); ?></h2>
+  <?php endif; ?>
+
+  <?php if ($content['comment_form']): ?>
+    <h2 class="title"><?php print t('Post new comment'); ?></h2>
+    <div>
+      <?php print render($content['comment_form']); ?>
+    </div>
+  <?php endif; ?>
+
+  <?php print render($content['comments']); ?>
+</div>
Index: modules/comment/comment.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/comment/comment.module,v
retrieving revision 1.749
diff -u -p -r1.749 comment.module
--- modules/comment/comment.module	4 Aug 2009 06:53:48 -0000	1.749
+++ modules/comment/comment.module	5 Aug 2009 08:01:39 -0000
@@ -56,6 +56,11 @@ define('COMMENT_FORM_SEPARATE_PAGE', 0);
 define('COMMENT_FORM_BELOW', 1);
 
 /**
+ * Comment form should be shown below post, but above list of comments.
+ */
+define('COMMENT_FORM_ABOVE', 2);
+
+/**
  * Comments for this node are hidden.
  */
 define('COMMENT_NODE_HIDDEN', 0);
@@ -590,7 +595,7 @@ function comment_node_page_additions($no
   }
 
   // Append comment form if needed.
-  if (user_access('post comments') && $node->comment == COMMENT_NODE_OPEN && (variable_get('comment_form_location_' . $node->type, COMMENT_FORM_BELOW) == COMMENT_FORM_BELOW)) {
+  if (user_access('post comments') && $node->comment == COMMENT_NODE_OPEN && (variable_get('comment_form_location_' . $node->type, COMMENT_FORM_BELOW) != COMMENT_FORM_SEPARATE_PAGE)) {
     $build = drupal_get_form('comment_form', (object) array('nid' => $node->nid));
     $additions['comment_form'] = $build;
   }
@@ -912,9 +917,14 @@ function comment_form_node_type_form_alt
       '#default_value' => variable_get('comment_subject_field_' . $form['#node_type']->type, 1),
     );
     $form['comment']['comment_form_location'] = array(
-      '#type' => 'checkbox',
-      '#title' => t('Show reply form on the same page as comments'),
-      '#default_value' => variable_get('comment_form_location_' . $form['#node_type']->type, COMMENT_FORM_BELOW),
+      '#type' => 'radios',
+      '#title' => t('Location of comment submission form'),
+      '#default_value' => variable_get('comment_form_location_'. $form['#node_type']->type, COMMENT_FORM_BELOW),
+      '#options' => array(
+        COMMENT_FORM_SEPARATE_PAGE => t('Display on separate page'),
+        COMMENT_FORM_BELOW => t('Display below post or comments'),
+        COMMENT_FORM_ABOVE => t('Display below post, but above comments'),
+      ),
     );
     $form['comment']['comment_preview'] = array(
       '#type' => 'checkbox',
@@ -2178,6 +2188,10 @@ function template_preprocess_comment_wra
   $variables['node'] = $variables['content']['#node'];
   $variables['display_mode'] = _comment_get_display_setting('mode', $variables['node']);
   $variables['template_files'][] = 'comment-wrapper-' . $variables['node']->type;
+
+  if (variable_get('comment_form_location_' . $variables['content']['#node']->type, COMMENT_FORM_BELOW) == COMMENT_FORM_ABOVE) {
+    $variables['template_files'][] = 'comment-wrapper-form-above';
+  }
 }
 
 /**
