--- old\modules\aggregator.module Sun Jan 15 19:56:42 2006 +++ new\modules\aggregator.module Mon Jan 16 19:14:42 2006 @@ -190,11 +190,11 @@ function aggregator_block($op, $delta = 0, $edit = array()) { if (user_access('access news feeds')) { if ($op == 'list') { - $result = db_query('SELECT cid, title FROM {aggregator_category} ORDER BY title'); + $result = db_query('SELECT cid, title FROM {aggregator_category} WHERE block > 0 ORDER BY title'); while ($category = db_fetch_object($result)) { $block['category-'. $category->cid]['info'] = t('%title category latest items', array('%title' => theme('placeholder', $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 > 0 ORDER BY fid'); while ($feed = db_fetch_object($result)) { $block['feed-'. $feed->fid]['info'] = t('%title feed latest items', array('%title' => theme('placeholder', $feed->title))); } @@ -645,6 +645,13 @@ function aggregator_form_category($edit = array()) { $form['title'] = array('#type' => 'textfield', '#title' => t('Title'), '#default_value' => $edit['title'], '#maxlength' => 64); $form['description'] = array('#type' => 'textarea', '#title' => t('Description'), '#default_value' => $edit['description']); + if (!is_numeric($edit['block'])) { + $edit['block'] = 5; + } + $form['block'] = array( + '#type' => 'radios', '#title' => t('Generate a block for this category'), '#default_value' => $edit['block'], + '#options' => array(0 => t('Disabled'), ($edit['block'] == 0 ? 5 : $edit['block']) => t('Enabled')) + ); $form['submit'] = array('#type' => 'submit', '#value' =>t('Submit')); if ($edit['cid']) { @@ -657,7 +664,10 @@ function aggregator_save_category($edit) { if ($edit['cid'] && $edit['title']) { - db_query('UPDATE {aggregator_category} SET title = \'%s\', description = \'%s\' WHERE cid = %d', $edit['title'], $edit['description'], $edit['cid']); + if (!is_numeric($edit['block'])) { + $edit['block'] = 0; + } + db_query('UPDATE {aggregator_category} SET title = \'%s\', description = \'%s\', block = %d WHERE cid = %d', $edit['title'], $edit['description'], $edit['block'], $edit['cid']); } else if ($edit['cid']) { db_query('DELETE FROM {aggregator_category} WHERE cid = %d', $edit['cid']); @@ -665,7 +675,10 @@ else if ($edit['title']) { // a single unique id for bundles and feeds, to use in blocks $next_id = db_next_id('{aggregator_category}_cid'); - db_query('INSERT INTO {aggregator_category} (cid, title, description, block) VALUES (%d, \'%s\', \'%s\', 5)', $next_id, $edit['title'], $edit['description']); + if (!is_numeric($edit['block'])) { + $edit['block'] = 0; + } + db_query('INSERT INTO {aggregator_category} (cid, title, description, block) VALUES (%d, \'%s\', \'%s\', %d)', $next_id, $edit['title'], $edit['description'], $edit['block']); } } @@ -692,6 +705,13 @@ if ($options) { $form['category'] = array('#type' => 'checkboxes', '#title' => t('Categorize news items'), '#default_value' => $values, '#options' => $options, '#description' => t('New items in this feed will be automatically filed in the checked categories as they are received.')); } + if (!is_numeric($edit['block'])) { + $edit['block'] = 5; + } + $form['block'] = array( + '#type' => 'radios', '#title' => t('Generate a block for this feed'), '#default_value' => $edit['block'], + '#options' => array(0 => t('Disabled'), ($edit['block'] == 0 ? 5 : $edit['block']) => t('Enabled')) + ); $form['submit'] = array('#type' => 'submit', '#value' =>t('Submit')); if ($edit['fid']) { @@ -708,7 +728,10 @@ 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']); + if (!is_numeric($edit['block'])) { + $edit['block'] = 0; + } + db_query('UPDATE {aggregator_feed} SET title = \'%s\', url = \'%s\', refresh = %d, block = %d WHERE fid = %d', $edit['title'], $edit['url'], $edit['refresh'], $edit['block'], $edit['fid']); } else if ($edit['fid']) { $result = db_query('SELECT iid FROM {aggregator_item} WHERE fid = %d', $edit['fid']); @@ -724,7 +747,10 @@ else if ($edit['title']) { // a single unique id for bundles and feeds, to use in blocks $edit['fid'] = db_next_id('{aggregator_feed}_fid'); - db_query('INSERT INTO {aggregator_feed} (fid, title, url, refresh, block) VALUES (%d, \'%s\', \'%s\', %d, 5)', $edit['fid'], $edit['title'], $edit['url'], $edit['refresh']); + if (!is_numeric($edit['block'])) { + $edit['block'] = 0; + } + db_query('INSERT INTO {aggregator_feed} (fid, title, url, refresh, block) VALUES (%d, \'%s\', \'%s\', %d, %d)', $edit['fid'], $edit['title'], $edit['url'], $edit['refresh'], $edit['block']); } if ($edit['title']) { // the feed is being saved, save the categories as well