Index: modules/aggregator/aggregator.admin.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/aggregator/aggregator.admin.inc,v retrieving revision 1.14 diff -u -r1.14 aggregator.admin.inc --- modules/aggregator/aggregator.admin.inc 16 Aug 2008 14:48:17 -0000 1.14 +++ modules/aggregator/aggregator.admin.inc 23 Aug 2008 10:21:19 -0000 @@ -7,40 +7,63 @@ */ /** - * Menu callback; displays the aggregator administration page. - */ -function aggregator_admin_overview() { - return aggregator_view(); -} - -/** - * Displays the aggregator administration page. + * Menu callback; displays the aggregator feed overview page. * * @return * The page HTML. */ -function aggregator_view() { - $result = db_query('SELECT f.*, COUNT(i.iid) AS items FROM {aggregator_feed} f LEFT JOIN {aggregator_item} i ON f.fid = i.fid GROUP BY f.fid, f.title, f.url, f.refresh, f.checked, f.link, f.description, f.hash, f.etag, f.modified, f.image, f.block ORDER BY f.title'); +function aggregator_admin_overview() { + $result = pager_query('SELECT f.*, COUNT(i.iid) AS items FROM {aggregator_feed} f LEFT JOIN {aggregator_item} i ON f.fid = i.fid GROUP BY f.fid, f.title, f.url, f.refresh, f.checked, f.link, f.description, f.hash, f.etag, f.modified, f.image, f.block ORDER BY f.title', 50, 0, 'SELECT COUNT(*) FROM {aggregator_feed}'); - $output = '
' . t('Thousands of sites (particularly news sites and blogs) publish their latest headlines and posts in feeds, using a number of standardized XML-based formats. Formats supported by the aggregator include RSS, RDF, and Atom.', array('@rss' => 'http://cyber.law.harvard.edu/rss/', '@rdf' => 'http://www.w3.org/RDF/', '@atom' => 'http://www.atomenabled.org')) . '
'; - $output .= '' . t('Current feeds are listed below, and new feeds may be added. For each feed or feed category, the latest items block may be enabled at the blocks administration page.', array('@addfeed' => url('admin/content/aggregator/add/feed'), '@block' => url('admin/build/block'))) . '
'; + $output .= '' . t('Current feeds are listed below, and new feeds may be added. For each feed, the latest items block may be enabled at the blocks administration page.', array('@addfeed' => url('admin/content/aggregator/add/feed'), '@block' => url('admin/build/block'))) . '
'; return $output; + case 'admin/content/aggregator/list/categories': + return '' . t('Current categories are listed below, and new categories may be added. For each category, the latest items block may be enabled at the blocks administration page.', array('@addcategory' => url('admin/content/aggregator/add/category'), '@block' => url('admin/build/block'))) . '
'; case 'admin/content/aggregator/add/feed': return '' . t('Add a feed in RSS, RDF or Atom format. A feed may only have one entry.') . '
'; case 'admin/content/aggregator/add/category': @@ -87,6 +89,22 @@ 'page callback' => 'aggregator_admin_overview', 'access arguments' => array('administer news feeds'), ); + $items['admin/content/aggregator/list'] = array( + 'title' => 'List', + 'type' => MENU_DEFAULT_LOCAL_TASK, + 'weight' => -10, + ); + $items['admin/content/aggregator/list/feeds'] = array( + 'title' => 'Feed overview', + 'type' => MENU_DEFAULT_LOCAL_TASK, + 'weight' => -10, + ); + $items['admin/content/aggregator/list/categories'] = array( + 'title' => 'Category overview', + 'page callback' => 'aggregator_category_overview', + 'access arguments' => array('administer news feeds'), + 'type' => MENU_LOCAL_TASK, + ); $items['admin/content/aggregator/add/feed'] = array( 'title' => 'Add feed', 'page callback' => 'drupal_get_form', @@ -125,11 +143,6 @@ 'access arguments' => array('administer news feeds'), 'type' => MENU_CALLBACK, ); - $items['admin/content/aggregator/list'] = array( - 'title' => 'List', - 'type' => MENU_DEFAULT_LOCAL_TASK, - 'weight' => -10, - ); $items['admin/content/aggregator/settings'] = array( 'title' => 'Settings', 'page callback' => 'drupal_get_form', @@ -147,7 +160,7 @@ $items['aggregator/sources'] = array( 'title' => 'Sources', 'page callback' => 'aggregator_page_sources', - 'access arguments' => array('access news feeds'), + 'access callback' => '_aggregator_has_sources', ); $items['aggregator/categories'] = array( 'title' => 'Categories', @@ -256,6 +269,16 @@ } /** + * Find out whether there are any aggregator feeds. + * + * @return + * TRUE if there is at least one feed and the user has access to them, FALSE otherwise. + */ +function _aggregator_has_sources() { + return user_access('access news feeds') && db_result(db_query('SELECT COUNT(*) FROM {aggregator_feed}')); +} + +/** * Find out whether there are any aggregator categories. * * @return