Index: modules/comment/comment.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/comment/comment.module,v
retrieving revision 1.829
diff -u -r1.829 comment.module
--- modules/comment/comment.module	10 Jan 2010 00:41:28 -0000	1.829
+++ modules/comment/comment.module	11 Jan 2010 04:52:15 -0000
@@ -130,8 +130,11 @@
  */
 function comment_theme() {
   return array(
-    'comment_block' => array(
-      'variables' => array(),
+    'comment_recent_block' => array(
+      'variables' => array('comments' => NULL),
+    ),
+    'comment_recent_comment' => array(
+      'variables' => array('comment' => NULL),
     ),
     'comment_preview' => array(
       'variables' => array('comment' => NULL),
@@ -336,10 +339,10 @@
  * Implements hook_block_configure().
  */
 function comment_block_configure($delta = '') {
-  $form['comment_block_count'] = array(
+  $form['comment_recent_block_count'] = array(
     '#type' => 'select',
-    '#title' => t('Number of recent comments'),
-    '#default_value' => variable_get('comment_block_count', 10),
+    '#title' => t('Number of recent comments to display'),
+    '#default_value' => variable_get('comment_recent_block_count', 10),
     '#options' => drupal_map_assoc(array(2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 25, 30)),
   );
 
@@ -350,7 +353,7 @@
  * Implements hook_block_save().
  */
 function comment_block_save($delta = '', $edit = array()) {
-  variable_set('comment_block_count', (int)$edit['comment_block_count']);
+  variable_set('comment_recent_block_count', $edit['comment_recent_block_count']);
 }
 
 /**
@@ -361,7 +364,14 @@
 function comment_block_view($delta = '') {
   if (user_access('access comments')) {
     $block['subject'] = t('Recent comments');
-    $block['content'] = theme('comment_block');
+    if ($comments = comment_get_recent(variable_get('comment_recent_block_count', 10))) {
+      $block['content'] = theme('comment_recent_block', array(
+        'comment' => $comments,
+      ));
+    }
+    else {
+      $block['content'] = t('No comments available.');
+    }
 
     return $block;
   }
@@ -502,16 +512,45 @@
  *   The comment list HTML.
  * @ingroup themeable
  */
-function theme_comment_block() {
-  $items = array();
-  $number = variable_get('comment_block_count', 10);
-  foreach (comment_get_recent($number) as $comment) {
-    $items[] = l($comment->subject, 'comment/' . $comment->cid, array('fragment' => 'comment-' . $comment->cid)) . '<br />' . t('@time ago', array('@time' => format_interval(REQUEST_TIME - $comment->changed)));
+function theme_comment_recent_block($variables) {
+  $rows = array();
+  $output = '';
+
+  $l_options = array('query' => drupal_get_destination());
+  foreach ($variables['comments'] as $comment) {
+    $row = array();
+    $row[] = theme('comment_recent_comments', array('comment' => $comment));
+    $row[] = comment_access('update', $comment) ? l(t('edit'), 'comment/' . $comment->cid . '/edit', $l_options) : '';
+    $row[] = comment_access('delete', $comment) ? l(t('delete'), 'comment/' . $comment->cid . '/delete', $l_options) : '';
+    $rows[] = $row;
   }
 
-  if ($items) {
-    return theme('item_list', array('items' => $items));
+  if ($rows) {
+    $output = theme('table', array('rows' => $rows));
+    $output .= '<div class="list-all">' . l(t('Show all comments'), 'admin/content/comment') . '</div>';
   }
+
+  return $output;
+}
+
+/**
+ * Returns a formatted recent node to be displayed in the recent content block.
+ *
+ * @return
+ *   The recent content node's HTML.
+ * @ingroup themeable
+ */
+function theme_comment_recent_comment($variables) {
+  $comment = $variables['comment'];
+
+  $output = '<div class="comment-title">';
+  $output .= l($comment->title, 'comment/' . $comment->cid);
+  $output .= theme('mark', array('type' => node_mark($comment->nid, $comment->changed)));
+  $output .= '</div><div class="comment-author">';
+  $output .= theme('username', array('account' => user_load($comment->uid)));
+  $output .= '</div>';
+
+  return $output;
 }
 
 /**
