Index: modules/aggregator/aggregator.install
===================================================================
RCS file: /cvs/drupal/drupal/modules/aggregator/aggregator.install,v
retrieving revision 1.9
diff -u -p -r1.9 aggregator.install
--- modules/aggregator/aggregator.install	25 May 2007 12:46:43 -0000	1.9
+++ modules/aggregator/aggregator.install	10 Jun 2007 21:14:32 -0000
@@ -20,4 +20,14 @@ function aggregator_uninstall() {
   variable_del('aggregator_summary_items');
   variable_del('aggregator_clear');
   variable_del('aggregator_category_selector');
+  variable_del('aggregator_block_create');  
 }
+
+/**
+ * Implementation of hook_update
+ */
+function aggregator_update_1() {
+  $ret = array();
+  db_add_field($ret, 'aggregator_feed', 'block_create',  array('type' => 'int', 'not null' => TRUE, 'default' => 1, 'size' => 'tiny'));  
+  return $ret;
+}
\ No newline at end of file
Index: modules/aggregator/aggregator.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/aggregator/aggregator.module,v
retrieving revision 1.345
diff -u -p -r1.345 aggregator.module
--- modules/aggregator/aggregator.module	5 Jun 2007 12:13:21 -0000	1.345
+++ modules/aggregator/aggregator.module	10 Jun 2007 21:14:34 -0000
@@ -236,6 +236,12 @@ function aggregator_admin_settings() {
     '#description' => t('The type of category selection widget which is shown on categorization pages. Checkboxes are easier to use; a multiple selector is good for working with large numbers of categories.')
   );
 
+  $form['aggregator_block_create'] = array(
+    '#type' => 'radios', '#title' => t('Block creation rules'), '#default_value' => variable_get('aggregator_block_create', 1),
+    '#options' => array(0 => t('do not create blocks for new feeds'), 1 => t('create blocks for new feeds')),
+    '#description' => t('When adding feeds, the default setting will create a new block or not.  This value can be changed for each feed.')
+  );
+
   return system_settings_form($form);
 }
 
@@ -270,7 +276,7 @@ function aggregator_block($op = 'list', 
       while ($category = db_fetch_object($result)) {
         $block['category-'. $category->cid]['info'] = t('!title category latest items', array('!title' => $category->title));
       }
-      $result = db_query('SELECT fid, title FROM {aggregator_feed} ORDER BY fid');
+      $result = db_query('SELECT fid, title FROM {aggregator_feed} WHERE block_create = 1 ORDER BY fid');
       while ($feed = db_fetch_object($result)) {
         $block['feed-'. $feed->fid]['info'] = t('!title feed latest items', array('!title' => $feed->title));
       }
@@ -281,7 +287,7 @@ function aggregator_block($op = 'list', 
         $value = db_result(db_query('SELECT block FROM {aggregator_category} WHERE cid = %d', $id));
       }
       else {
-        $value = db_result(db_query('SELECT block FROM {aggregator_feed} WHERE fid = %d', $id));
+        $value = db_result(db_query('SELECT block FROM {aggregator_feed} WHERE fid = %d AND block_create = 1', $id));
       }
       $form['block'] = array('#type' => 'select', '#title' => t('Number of news items in block'), '#default_value' => $value, '#options' => drupal_map_assoc(array(2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20)));
       return $form;
@@ -469,6 +475,7 @@ function aggregator_form_feed($edit = ar
   while ($category = db_fetch_object($categories)) {
     $options[$category->cid] = check_plain($category->title);
     if ($category->fid) $values[] = $category->cid;
+    $fid = $category->fid;
   }
   if ($options) {
     $form['category'] = array('#type' => 'checkboxes',
@@ -478,6 +485,32 @@ function aggregator_form_feed($edit = ar
       '#description' => t('New items in this feed will be automatically filed in the checked categories as they are received.'),
     );
   }
+
+  // Handling of block creation.  Set $rehash to zero or to the current value.
+  if (!empty($fid)) {
+    $block = db_fetch_object(db_query("SELECT block_create FROM {aggregator_feed} WHERE fid = %d", $fid));
+    $edit['block_create'] = $block->block_create;
+    $rehash = $block->block_create;
+  }  
+  else {
+    $edit['block_create'] = variable_get('aggregator_block_create', 1);
+    $rehash = 0;
+  }
+  // Show the form to privileged users, or use hidden element.
+  if (user_access('administer blocks')) {
+    $form['block_create'] = array(
+      '#title' => t('Create block'),
+      '#default_value' => $edit['block_create'],
+      '#type' => 'radios',
+      '#options' => array(0 => t('do not create a block for this feed'), 1 => t('create a block for this feed')),
+      '#description' => t('Block creation options for this feed.'),
+      '#required' => TRUE,
+    );
+  }
+  else {
+    $form['block_create'] = array('#type' => 'value', '#value' => $edit['block_create']);  
+  }
+  $form['block_rehash'] = array('#type' => 'hidden', '#value' => $rehash);
   $form['submit'] = array('#type' => 'submit', '#value' => t('Submit'));
 
   if ($edit['fid']) {
@@ -563,7 +596,7 @@ function aggregator_save_feed($edit) {
     db_query('DELETE FROM {aggregator_category_feed} WHERE fid = %d', $edit['fid']);
   }
   if ($edit['fid'] && $edit['title']) {
-    db_query("UPDATE {aggregator_feed} SET title = '%s', url = '%s', refresh = %d WHERE fid = %d", $edit['title'], $edit['url'], $edit['refresh'], $edit['fid']);
+    db_query("UPDATE {aggregator_feed} SET title = '%s', url = '%s', refresh = %d, block_create = %d WHERE fid = %d", $edit['title'], $edit['url'], $edit['refresh'], $edit['block_create'], $edit['fid']);
   }
   else if ($edit['fid']) {
     $result = db_query('SELECT iid FROM {aggregator_item} WHERE fid = %d', $edit['fid']);
@@ -591,6 +624,10 @@ function aggregator_save_feed($edit) {
       }
     }
   }
+  // If the block settings have changed, update the blocks table.
+  if ($edit['block_create'] != $edit['block_rehash']) {
+    _block_rehash();
+  }
 }
 
 function aggregator_remove($feed) {
Index: modules/aggregator/aggregator.schema
===================================================================
RCS file: /cvs/drupal/drupal/modules/aggregator/aggregator.schema,v
retrieving revision 1.1
diff -u -p -r1.1 aggregator.schema
--- modules/aggregator/aggregator.schema	25 May 2007 12:46:43 -0000	1.1
+++ modules/aggregator/aggregator.schema	10 Jun 2007 21:14:34 -0000
@@ -41,7 +41,8 @@ function aggregator_schema() {
       'image'       => array('type' => 'text', 'not null' => TRUE, 'size' => 'big'),
       'etag'        => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => ''),
       'modified'    => array('type' => 'int', 'not null' => TRUE, 'default' => 0),
-      'block'       => array('type' => 'int', 'not null' => TRUE, 'default' => 0, 'size' => 'tiny')
+      'block'       => array('type' => 'int', 'not null' => TRUE, 'default' => 0, 'size' => 'tiny'),
+      'block_create'  => array('type' => 'int', 'not null' => TRUE, 'default' => 1, 'size' => 'tiny')      
     ),
     'unique keys' => array(
       'url'  => array('url'),
