summaryrefslogtreecommitdiff
path: root/modules/aggregator
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2010-03-24 08:51:42 +0000
committerDries Buytaert <dries@buytaert.net>2010-03-24 08:51:42 +0000
commit545ef5b08199c43c1cdda859311c8d1f3c8810f8 (patch)
treeea6af5af20b9556de1e070418897545c32e0b6f0 /modules/aggregator
parentca435ae9d87d240de8c6fa49c50eb24ea4916dac (diff)
downloadbrdo-545ef5b08199c43c1cdda859311c8d1f3c8810f8.tar.gz
brdo-545ef5b08199c43c1cdda859311c8d1f3c8810f8.tar.bz2
- Patch #748742 by mr.baileys, catch: aggregator categorize feature is broken.
Diffstat (limited to 'modules/aggregator')
-rw-r--r--modules/aggregator/aggregator.module4
-rw-r--r--modules/aggregator/aggregator.pages.inc59
-rw-r--r--modules/aggregator/aggregator.test2
3 files changed, 42 insertions, 23 deletions
diff --git a/modules/aggregator/aggregator.module b/modules/aggregator/aggregator.module
index 62c6c35db..d7343050e 100644
--- a/modules/aggregator/aggregator.module
+++ b/modules/aggregator/aggregator.module
@@ -209,7 +209,7 @@ function aggregator_menu() {
$items['aggregator/categories/%aggregator_category/categorize'] = array(
'title' => 'Categorize',
'page callback' => 'drupal_get_form',
- 'page arguments' => array('aggregator_page_category', 2),
+ 'page arguments' => array('aggregator_page_category_form', 2),
'access arguments' => array('administer news feeds'),
'type' => MENU_LOCAL_TASK,
'file' => 'aggregator.pages.inc',
@@ -238,7 +238,7 @@ function aggregator_menu() {
$items['aggregator/sources/%aggregator_feed/categorize'] = array(
'title' => 'Categorize',
'page callback' => 'drupal_get_form',
- 'page arguments' => array('aggregator_page_source', 2),
+ 'page arguments' => array('aggregator_page_source_form', 2),
'access arguments' => array('administer news feeds'),
'type' => MENU_LOCAL_TASK,
'file' => 'aggregator.pages.inc',
diff --git a/modules/aggregator/aggregator.pages.inc b/modules/aggregator/aggregator.pages.inc
index 9f2a4e2f4..f8eb047af 100644
--- a/modules/aggregator/aggregator.pages.inc
+++ b/modules/aggregator/aggregator.pages.inc
@@ -23,19 +23,13 @@ function aggregator_page_last() {
/**
* Menu callback; displays all the items captured from a particular feed.
*
- * If there are two arguments then this function is the categorize form.
+ * @param $feed
+ * The feed for which to display all items.
*
- * @param $arg1
- * If there are two arguments then $arg1 is $form_state. Otherwise, $arg1 is $feed.
- * @param $arg2
- * If there are two arguments then $arg2 is feed.
* @return
- * The item's HTML.
+ * The rendered list of items for a feed.
*/
-function aggregator_page_source($arg1, $arg2 = NULL) {
- // If there are two arguments then this function is the categorize form, and
- // $arg1 is $form_state and $arg2 is $feed. Otherwise, $arg1 is $feed.
- $feed = is_object($arg2) ? $arg2 : $arg1;
+function aggregator_page_source($feed) {
drupal_set_title($feed->title);
$feed_source = theme('aggregator_feed_source', array('feed' => $feed));
@@ -47,22 +41,30 @@ function aggregator_page_source($arg1, $arg2 = NULL) {
}
/**
- * Menu callback; displays all the items aggregated in a particular category.
+ * Menu callback; displays a form with all items captured from a feed.
*
- * If there are two arguments then this function is called as a form.
+ * @param $feed
+ * The feed for which to list all the aggregated items.
*
- * @param $arg1
- * If there are two arguments then $arg1 is $form_state. Otherwise, $arg1 is $category.
- * @param $arg2
- * If there are two arguments then $arg2 is $category.
* @return
- * The items HTML.
+ * The rendered list of items for a feed.
+ *
+ * @see aggregator_page_source()
*/
-function aggregator_page_category($arg1, $arg2 = NULL) {
- // If there are two arguments then we are called as a form, $arg1 is
- // $form_state and $arg2 is $category. Otherwise, $arg1 is $category.
- $category = is_array($arg2) ? $arg2 : $arg1;
+function aggregator_page_source_form($form, $form_state, $feed) {
+ return aggregator_page_source($feed);
+}
+/**
+ * Menu callback; displays all the items aggregated in a particular category.
+ *
+ * @param $category
+ * The category for which to list all the aggregated items.
+ *
+ * @return
+* The rendered list of items for a category.
+ */
+function aggregator_page_category($category) {
drupal_add_feed(url('aggregator/rss/' . $category['cid']), variable_get('site_name', 'Drupal') . ' ' . t('aggregator - @title', array('@title' => $category['title'])));
// It is safe to include the cid in the query because it's loaded from the
@@ -73,6 +75,21 @@ function aggregator_page_category($arg1, $arg2 = NULL) {
}
/**
+ * Menu callback; displays a form containing items aggregated in a category.
+ *
+ * @param $category
+ * The category for which to list all the aggregated items.
+ *
+ * @return
+* The rendered list of items for a category.
+ *
+ * @see aggregator_page_category()
+ */
+function aggregator_page_category_form($form, $form_state, $category) {
+ return aggregator_page_category($category);
+}
+
+/**
* Load feed items
*
* @param $type
diff --git a/modules/aggregator/aggregator.test b/modules/aggregator/aggregator.test
index 6837cb854..93e77f989 100644
--- a/modules/aggregator/aggregator.test
+++ b/modules/aggregator/aggregator.test
@@ -283,6 +283,8 @@ class AddFeedTestCase extends AggregatorTestCase {
$this->drupalGet('aggregator/sources/' . $feed->fid);
$this->assertResponse(200, t('Feed source exists.'));
$this->assertText($feed->title, t('Page title'));
+ $this->drupalGet('aggregator/sources/' . $feed->fid . '/categorize');
+ $this->assertResponse(200, t('Feed categorization page exists.'));
// Delete feed.
$this->deleteFeed($feed);