? what.patch Index: aggregator.admin.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/aggregator/aggregator.admin.inc,v retrieving revision 1.54 diff -u -p -r1.54 aggregator.admin.inc --- aggregator.admin.inc 26 Jun 2010 19:55:47 -0000 1.54 +++ aggregator.admin.inc 7 Jan 2011 17:57:34 -0000 @@ -84,11 +84,10 @@ function aggregator_form_feed($form, &$f '#options' => $period, '#description' => t('The length of time between feed updates. Requires a correctly configured cron maintenance task.', array('@cron' => url('admin/reports/status'))), ); - $form['block'] = array('#type' => 'select', - '#title' => t('News items in block'), - '#default_value' => isset($feed->block) ? $feed->block : 5, - '#options' => drupal_map_assoc(array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20)), - '#description' => t("Drupal can make a block with the most recent news items of this feed. You can configure blocks to be displayed in the sidebar of your page. This setting lets you configure the number of news items to show in this feed's block. If you choose '0' this feed's block will be disabled.", array('@block-admin' => url('admin/structure/block'))), + $form['block'] = array('#type' => 'checkbox', + '#title' => t('Create block of feed items'), + '#default_value' => isset($feed->block) ? $feed->block : '', + '#description' => t("Drupal can make a block with the most recent news items of this feed. You can configure blocks to be displayed in the sidebar of your page.", array('@block-admin' => url('admin/structure/block'))), ); // Handling of categories. Index: aggregator.install =================================================================== RCS file: /cvs/drupal/drupal/modules/aggregator/aggregator.install,v retrieving revision 1.31 diff -u -p -r1.31 aggregator.install --- aggregator.install 22 Aug 2010 13:55:53 -0000 1.31 +++ aggregator.install 7 Jan 2011 17:57:34 -0000 @@ -50,7 +50,14 @@ function aggregator_schema() { 'not null' => TRUE, 'default' => 0, 'size' => 'tiny', - 'description' => 'The number of recent items to show within the category block.', + 'description' => 'Whether a block has been created for this feed.', + ), + 'items' => array( + 'type' => 'int', + 'not null' => TRUE, + 'default' => 0, + 'size' => 'tiny', + 'description' => 'Number of items to display in the feed’s block.', ) ), 'primary key' => array('cid'), Index: aggregator.module =================================================================== RCS file: /cvs/drupal/drupal/modules/aggregator/aggregator.module,v retrieving revision 1.444 diff -u -p -r1.444 aggregator.module --- aggregator.module 24 Sep 2010 00:37:41 -0000 1.444 +++ aggregator.module 7 Jan 2011 17:57:34 -0000 @@ -371,6 +371,17 @@ function aggregator_block_configure($del ); return $form; } + if ($type == 'feed') { + $value = db_query('SELECT items FROM {aggregator_feed} WHERE fid = :fid', array(':fid' => $id))->fetchField(); + $form['items'] = array( + '#type' => 'select', + '#title' => t('Number of news items in block'), + '#default_value' => $value, + '#options' => drupal_map_assoc(array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20)), + ); + return $form; + } + } /** @@ -384,6 +395,12 @@ function aggregator_block_save($delta = ->condition('cid', $id) ->execute(); } + if ($type == 'feed') { + db_update('aggregator_feed') + ->fields(array('items' => $edit['items'])) + ->condition('fid', $id) + ->execute(); + } } /** @@ -397,9 +414,9 @@ function aggregator_block_view($delta = list($type, $id) = explode('-', $delta); switch ($type) { case 'feed': - if ($feed = db_query('SELECT fid, title, block FROM {aggregator_feed} WHERE block <> 0 AND fid = :fid', array(':fid' => $id))->fetchObject()) { + if ($feed = db_query('SELECT fid, title, items FROM {aggregator_feed} WHERE block <> 0 AND fid = :fid', array(':fid' => $id))->fetchObject()) { $block['subject'] = check_plain($feed->title); - $result = db_query_range("SELECT * FROM {aggregator_item} WHERE fid = :fid ORDER BY timestamp DESC, iid DESC", 0, $feed->block, array(':fid' => $id)); + $result = db_query_range("SELECT * FROM {aggregator_item} WHERE fid = :fid ORDER BY timestamp DESC, iid DESC", 0, $feed->items, array(':fid' => $id)); $read_more = theme('more_link', array('url' => 'aggregator/sources/' . $feed->fid, 'title' => t("View this feed's recent news."))); } break;