Merge lp://qastaging/~cafuego/ubuntu-drupal-planet/aggregator-categories into lp://qastaging/ubuntu-drupal-planet

Proposed by Cafuego
Status: Merged
Merged at revision: 58
Proposed branch: lp://qastaging/~cafuego/ubuntu-drupal-planet/aggregator-categories
Merge into: lp://qastaging/ubuntu-drupal-planet
Diff against target: 71 lines (+27/-0)
3 files modified
udplanet_feeds_admin.inc (+5/-0)
udplanet_feeds_user.inc (+5/-0)
udplanet_settings.inc (+17/-0)
To merge this branch: bzr merge lp://qastaging/~cafuego/ubuntu-drupal-planet/aggregator-categories
Reviewer Review Type Date Requested Status
Michael Lustfield (community) merged Approve
Review via email: mp+18347@code.qastaging.launchpad.net
To post a comment you must log in.
Revision history for this message
Cafuego (cafuego) wrote :

This branch contains a few bits of code that allow a user with the correct permissions to set an aggegator feed category on the udplanet feeds.

Doing that means you can use the category separate out OTHER feeds when creating blocks or pages via the Views module.

Revision history for this message
Michael Lustfield (michaellustfield) wrote :

This was merged for testing in lp:ubuntu-drupal-planet at revision 58.
Testing now needed from team. See bug 516672.

review: Needs Information (in testing)
Revision history for this message
Michael Lustfield (michaellustfield) :
review: Approve (merged)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'udplanet_feeds_admin.inc'
2--- udplanet_feeds_admin.inc 2009-11-19 21:08:03 +0000
3+++ udplanet_feeds_admin.inc 2010-01-31 23:28:13 +0000
4@@ -176,12 +176,17 @@
5 db_query('DELETE FROM {udplanet_feeds} WHERE lid=%d', $lid);
6 db_query('DELETE FROM {aggregator_item} WHERE fid=%d', $fid);
7 db_query('DELETE FROM {aggregator_feed} WHERE fid=%d', $fid);
8+ db_query('DELETE FROM {aggregator_category_feed} WHERE fid=%d', $fid);
9 }
10
11 // Add
12 if ($op == 'Add') {
13 db_query("INSERT INTO {aggregator_feed} (title, url, refresh, block, description, image) VALUES ('%s', '%s', 900, 5, '', '')", $feed_title, $feed_url);
14 $fid = db_last_insert_id('aggregator_feed', 'fid');
15+ // Assign category, if set.
16+ if ($cid = variable_get('udplanet_feed_category', 0)) {
17+ db_query("INSERT INTO {aggregator_category_feed} (fid, cid) VALUES (%d, %d)", $fid, $cid);
18+ }
19 db_query('INSERT INTO {udplanet_feeds} (uid, fid, disabled, frozen) VALUES ("%s", "%s", "%s", "%s")', $uid, $fid, $disabled, $frozen);
20 }
21
22
23=== modified file 'udplanet_feeds_user.inc'
24--- udplanet_feeds_user.inc 2010-01-03 23:36:59 +0000
25+++ udplanet_feeds_user.inc 2010-01-31 23:28:13 +0000
26@@ -166,12 +166,17 @@
27 db_query('DELETE FROM {udplanet_feeds} WHERE lid=%d AND uid="%s"', $lid, $uid);
28 db_query('DELETE FROM {aggregator_item} WHERE fid=%d', $fid);
29 db_query('DELETE FROM {aggregator_feed} WHERE fid=%d', $fid);
30+ db_query('DELETE FROM {aggregator_category_feed} WHERE fid=%d', $fid);
31 }
32
33 // Add
34 if ($op == 'Add') {
35 db_query("INSERT INTO {aggregator_feed} (title, url, refresh, block, description, image) VALUES ('%s', '%s', 900, 5, '', '')", $feed_title, $feed_url);
36 $fid = db_last_insert_id('aggregator_feed', 'fid');
37+ // Assign category, if set.
38+ if ($cid = variable_get('udplanet_feed_category', 0)) {
39+ db_query("INSERT INTO {aggregator_category_feed} (fid, cid) VALUES (%d, %d)", $fid, $cid);
40+ }
41 db_query('INSERT INTO {udplanet_feeds} (uid, fid, disabled) VALUES ("%s", "%s", "%s")', $uid, $fid, $disabled);
42 }
43
44
45=== modified file 'udplanet_settings.inc'
46--- udplanet_settings.inc 2010-01-03 23:36:59 +0000
47+++ udplanet_settings.inc 2010-01-31 23:28:13 +0000
48@@ -19,6 +19,23 @@
49 '#collapsed' => TRUE,
50 '#tree' => FALSE,
51 );
52+
53+ // Fetch a list of categories.
54+ //
55+ $options = array (0 => 'No category');
56+ $result = db_query('SELECT cid, title FROM {aggregator_category}');
57+ while ($row = db_fetch_array($result)) {
58+ $options[$row['cid']] = $row['title'];
59+ }
60+
61+ $form['general']['udplanet_feed_category'] = array(
62+ '#type' => 'select',
63+ '#title' => t('Aggregator Category'),
64+ '#description' => t('The aggregator category to assign to retrieved feed items.'),
65+ '#options' => $options,
66+ '#default_value' => variable_get('udplanet_feed_category', 0)
67+ );
68+
69 $form['general']['udplanet_feed_items'] = array(
70 '#type' => 'textfield',
71 '#title' => t('Feed Items'),

Subscribers

People subscribed via source and target branches