Index: modules/blog.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/blog.module,v
retrieving revision 1.249
diff -u -F^f -r1.249 blog.module
--- modules/blog.module	18 May 2006 14:58:56 -0000	1.249
+++ modules/blog.module	21 May 2006 10:13:49 -0000
@@ -285,24 +285,36 @@ function blog_menu($may_cache) {
 /**
  * Implementation of hook_block().
  *
- * Displays the most recent 10 blog titles.
+ * Displays the most recent blog titles.
  */
-function blog_block($op = 'list', $delta = 0) {
+function blog_block($op = 'list', $delta = 0, $edit = array()) {
   global $user;
-  if ($op == 'list') {
-    $block[0]['info'] = t('Recent blog posts');
-    return $block;
-  }
-  else if ($op == 'view') {
-    if (user_access('access content')) {
-      $result = db_query_range(db_rewrite_sql("SELECT n.nid, n.title, n.created FROM {node} n WHERE n.type = 'blog' AND n.status = 1 ORDER BY n.created DESC"), 0, 10);
-      if (db_num_rows($result)) {
-        $block['content'] = node_title_list($result);
-        $block['content'] .= '<div class="more-link">'. l(t('more'), 'blog', array('title' => t('Read the latest blog entries.'))) .'</div>';
-        $block['subject'] = t('Recent blog posts');
-        return $block;
+  switch ($op) {
+    case 'list':
+      $block[0]['info'] = t('Recent blog posts');
+      return $block;
+      
+    case 'configure':
+      $form['blog_block_most_recent_count'] = array('#type' => 'select', '#title' => t('Most recent length'), '#default_value' => variable_get('blog_block_most_recent_count', 10), '#options' => drupal_map_assoc(array(0, 5, 10, 15, 20, 25, 30, 40, 50, 75, 100)), '#description' => t('Maximum number of most recent blog titles to display.'));
+      
+      return $form;
+      break;
+    
+    case 'save':
+      variable_set('blog_block_most_recent_count', $edit['blog_block_most_recent_count']);
+      break;
+      
+    case 'view':
+      if (user_access('access content')) {
+        $result = db_query_range(db_rewrite_sql("SELECT n.nid, n.title, n.created FROM {node} n WHERE n.type = 'blog' AND n.status = 1 ORDER BY n.created DESC"), 0, variable_get('blog_block_most_recent_count', 10));
+        if (db_num_rows($result)) {
+          $block['content'] = node_title_list($result);
+          $block['content'] .= '<div class="more-link">'. l(t('more'), 'blog', array('title' => t('Read the latest blog entries.'))) .'</div>';
+          $block['subject'] = t('Recent blog posts');
+          return $block;
+        }
       }
-    }
+      break;
   }
 }
 
