Merge lp:planet-drupal/planet-5x into lp:planet-drupal
- planet-5.x
- Merge into trunk
Proposed by
Rocky Road
Status: | Merged |
---|---|
Merged at revision: | 3 |
Proposed branch: | lp:planet-drupal/planet-5x |
Merge into: | lp:planet-drupal |
Diff against target: | None lines |
To merge this branch: | bzr merge lp:planet-drupal/planet-5x |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Rocky Road | drupal.org release | Pending | |
Review via email: mp+7081@code.launchpad.net |
Commit message
Description of the change
To post a comment you must log in.
Revision history for this message
Rocky Road (m-baert) wrote : | # |
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'CREDITS' |
2 | --- CREDITS 2009-06-04 09:16:03 +0000 |
3 | +++ CREDITS 2009-06-04 14:37:33 +0000 |
4 | @@ -1,5 +1,1 @@ |
5 | Written by Daryl Houston <daryl@learnhouston.com> |
6 | - |
7 | -The core fetching and parsing of this module is lifted straight |
8 | -out of the aggregator2 module, which presumably lifts from |
9 | -aggregator. |
10 | |
11 | === modified file 'planet.info' |
12 | --- planet.info 2009-06-04 08:45:43 +0000 |
13 | +++ planet.info 2009-06-04 14:40:20 +0000 |
14 | @@ -1,5 +1,10 @@ |
15 | -; $Id: planet.info,v 1.1 2007/05/10 20:27:41 daryl Exp $ |
16 | +; $Id: planet.info,v 1.2 2007/05/30 03:22:01 daryl Exp $ |
17 | name = Planet |
18 | description = Planet blog aggregator |
19 | package = Community - optional |
20 | version = 0.1 |
21 | + |
22 | +; Information added by drupal.org packaging script on 2007-05-10 |
23 | +version = "5.x-1.0" |
24 | +project = "planet" |
25 | + |
26 | |
27 | === modified file 'planet.install' |
28 | --- planet.install 2009-06-04 08:45:43 +0000 |
29 | +++ planet.install 2009-06-04 14:40:20 +0000 |
30 | @@ -1,5 +1,5 @@ |
31 | <?php |
32 | -// $Id: planet.install,v 1.1 2006/08/25 20:11:43 daryl Exp $ |
33 | +// $Id: planet.install,v 1.3 2007/05/30 03:22:01 daryl Exp $ |
34 | |
35 | /** |
36 | * Implementation of hook_install() |
37 | @@ -31,6 +31,7 @@ |
38 | fid int(10) unsigned zerofill, |
39 | nid int(10) unsigned zerofill, |
40 | guid varchar(120), |
41 | + link varchar(180), |
42 | created int(11) |
43 | ) /*!40100 DEFAULT CHARACTER SET utf8 */;"); |
44 | |
45 | |
46 | === modified file 'planet.module' |
47 | --- planet.module 2009-06-04 09:40:49 +0000 |
48 | +++ planet.module 2009-06-04 15:45:25 +0000 |
49 | @@ -3,8 +3,15 @@ |
50 | define('PLANET_ADMIN', 'administer planet'); |
51 | |
52 | function planet_node_info() { |
53 | - return array('planet' => array('name' => t('planet'), 'base' => 'planet')); |
54 | -} |
55 | + return array( |
56 | + 'planet' => array( |
57 | + 'name' => t('Planet Entry'), |
58 | + 'module' => 'planet', |
59 | + 'description' => t('Node to contain posts aggregated from various blogs.'), |
60 | + ) |
61 | + ); |
62 | +} |
63 | + |
64 | |
65 | function planet_perm() { |
66 | return array(PLANET_ADMIN); |
67 | @@ -20,15 +27,23 @@ |
68 | $output .= '<li><strong>General Settings</strong>. The auto-publish value is a string that the module looks for in categories (if possible) or within a post itself. Posts that include the value will be auto-converted into blog entries. The role to select bloggers from lets you narrow the user list for when you\'re adding a feed and associating it with a user. A common setting will be to create a staff role and use this for planet.</li>'; |
69 | $output .= '<li><strong>Feeds</strong>. This section lets you add a new feed. Give it a title, select an author, provide the feed url, and you\'re off. You\'ll have to manually refresh it or wait for a cron run for items to be imported.</li>'; |
70 | $output .= '<li><strong>Feeds</strong>. This section lists current feeds, when they were last updated, how many items they have, and it allows you to edit, refresh, or freeze them. Freezing is a quick way to temporarily suspend updates from the given feed.</li>'; |
71 | - $output .= '</ul>'; |
72 | return $output; |
73 | case 'admin/modules#description': |
74 | return t('Aggregates RSS feeds and faciliates their association with site users who belong to a given role.'); |
75 | } |
76 | } |
77 | |
78 | -function planet_node_name(){ |
79 | - return 'planet'; |
80 | +function planet_view($node, $teaser = FALSE, $page = FALSE, $links = TRUE){ |
81 | + if($page === true && variable_get('planet_redirect_page', 0) == 1){ |
82 | + $obj = db_fetch_object(db_query('SELECT * FROM {planet_items} WHERE nid = %d', $node->nid)); |
83 | + if($obj->nid == $node->nid && $obj->link != ''){ |
84 | + header('Location: ' . $obj->link); |
85 | + exit; |
86 | + } |
87 | + } |
88 | + else{ |
89 | + return node_prepare($node, $teaser); |
90 | + } |
91 | } |
92 | |
93 | function planet_access($op, $node){ |
94 | @@ -39,7 +54,7 @@ |
95 | } |
96 | |
97 | if ($op == 'update' || $op == 'delete') { |
98 | - if (user_access('edit own blog') && ($user->uid == $node->uid)) { |
99 | + if (user_access('edit own blog') && ($user->uid == $node->uid) || user_access('administer nodes')) { |
100 | return TRUE; |
101 | } |
102 | } |
103 | @@ -105,8 +120,8 @@ |
104 | } |
105 | |
106 | function _planet_settings(){ |
107 | - if($_POST['edit']){ |
108 | - $edit = $_POST['edit']; |
109 | + if($_POST){ |
110 | + $edit = $_POST; |
111 | |
112 | if($_POST['op'] == 'Delete' && intval($edit['fid']) > 0){ |
113 | db_query('DELETE FROM {planet_feeds} WHERE fid = %d', intval($edit['fid'])); |
114 | @@ -128,6 +143,12 @@ |
115 | if($edit['planet_auto_publish']){ |
116 | variable_set('planet_auto_publish', $edit['planet_auto_publish']); |
117 | } |
118 | + if($edit['planet_redirect_page'] == 1){ |
119 | + variable_set('planet_redirect_page', $edit['planet_redirect_page']); |
120 | + } |
121 | + else{ |
122 | + variable_del('planet_redirect_page'); |
123 | + } |
124 | drupal_set_message('Edited general planet settings.'); |
125 | } |
126 | } |
127 | @@ -137,35 +158,21 @@ |
128 | $fid = intval(arg(3)); |
129 | if($fid > 0){ |
130 | $edit = db_fetch_array(db_query('SELECT * FROM {planet_feeds} WHERE fid = %d', $fid)); |
131 | - $output .= planet_feed_form($edit, true); |
132 | + $output .= drupal_get_form('planet_feed_form', $edit, true); |
133 | } |
134 | else{ |
135 | |
136 | - $roles = array(); |
137 | - |
138 | - $result = db_query('SELECT rid, name FROM {role}'); |
139 | - while($role = db_fetch_object($result)){ |
140 | - $roles[$role->rid] = $role->name; |
141 | - } |
142 | - |
143 | $output .= '<h2>Recent Items</h2>'; |
144 | $output .= planet_queue(); |
145 | - |
146 | - $form = array(); |
147 | - |
148 | - $form['general'] = array('#type' => 'fieldset', '#title' => t('General Settings')); |
149 | |
150 | - $form['general']['planet_auto_publish'] = array('#type' => 'textfield', '#title' => t('Auto-publish text'), '#value' => variable_get('planet_auto_publish', ''), '#size' => 30, '#maxlength' => 30, '#description' => t('If this snippet appears in the aggregated item, it will be auto-published.')); |
151 | - $form['general']['planet_author_roles'] = array('#type' => 'select', '#title' => 'Role to select authors from', '#options' => $roles, '#default_value' => variable_get('planet_author_roles', 2), '#description' =>t('Select the role from which blog authors should be selected on the feed creation screen.')); |
152 | - $form['general']['submit'] = array('#type' => 'submit', '#value' => 'Adjust Settings'); |
153 | - |
154 | - $output .= drupal_get_form('settings', $form); |
155 | + $output .= drupal_get_form('planet_settings_form'); |
156 | + //$output .= drupal_get_form('settings', $form); |
157 | //$output .= $form; |
158 | |
159 | - $output .= planet_feed_form($edit); |
160 | + $output .= drupal_get_form('planet_feed_form', $edit); |
161 | |
162 | $result = db_query('SELECT *, (UNIX_TIMESTAMP(NOW()) - checked) _checked FROM {planet_feeds}'); |
163 | - $result = db_query('SELECT COUNT(f.uid) cnt, f.*, (UNIX_TIMESTAMP(NOW()) - checked) _checked FROM planet_feeds f LEFT OUTER JOIN planet_items i ON i.fid = f.fid GROUP BY f.uid;'); |
164 | + $result = db_query('SELECT COUNT(f.fid) cnt, f.*, (UNIX_TIMESTAMP(NOW()) - checked) _checked FROM {planet_feeds} f LEFT OUTER JOIN {planet_items} i ON i.fid = f.fid GROUP BY f.fid;'); |
165 | $rows = array(); |
166 | $headers = array('Feed', 'Items', 'Edit', 'Last checked', 'Refresh', 'Freeze'); |
167 | while($feed = db_fetch_object($result)){ |
168 | @@ -191,6 +198,24 @@ |
169 | } |
170 | } |
171 | |
172 | +function planet_settings_form(){ |
173 | + $roles = array(); |
174 | + |
175 | + $result = db_query('SELECT rid, name FROM {role}'); |
176 | + while($role = db_fetch_object($result)){ |
177 | + $roles[$role->rid] = $role->name; |
178 | + } |
179 | + |
180 | + $form = array(); |
181 | + $form['general'] = array('#type' => 'fieldset', '#title' => t('General Settings')); |
182 | + $form['general']['planet_auto_publish'] = array('#type' => 'textfield', '#title' => t('Auto-publish text'), '#value' => variable_get('planet_auto_publish', ''), '#size' => 30, '#maxlength' => 30, '#description' => t('If this snippet appears in the aggregated item, it will be auto-published.')); |
183 | + $form['general']['planet_author_roles'] = array('#type' => 'select', '#title' => t('Role to select authors from'), '#options' => $roles, '#default_value' => variable_get('planet_author_roles', 2), '#description' =>t('Select the role from which blog authors should be selected on the feed creation screen.')); |
184 | + $form['general']['planet_redirect_page'] = array('#type' => 'checkbox', '#title' => t('Redirect node?'), '#return_value' => 1, '#value' => (variable_get('planet_redirect_page', 0) == 1) ? 1 : null, '#description' => t('Check this if you want the node view to redirect to the original content link; this is useful if you want the feed to forward through instead of showing the planet node.')); |
185 | + $form['general']['submit'] = array('#type' => 'submit', '#value' => 'Adjust Settings'); |
186 | + return $form; |
187 | +} |
188 | + |
189 | + |
190 | function planet_feed_form($edit = array(), $individual = false){ |
191 | $uids = array(); |
192 | $result = db_query('SELECT u.uid, u.name FROM {users} u, {role} r, {users_roles} ur WHERE u.uid = ur.uid AND ur.rid = r.rid AND r.rid = %d ORDER BY u.name ASC', variable_get('planet_author_roles',2)); |
193 | @@ -200,18 +225,17 @@ |
194 | |
195 | $form = array(); |
196 | $form['feeds'] = array('#type' => 'fieldset', '#title' => 'Feeds'); |
197 | - $form['feeds']['fid'] = array('#type' => 'hidden', '#value' => $edit['title']); |
198 | + $form['feeds']['fid'] = array('#type' => 'hidden', '#value' => $edit['fid']); |
199 | $form['feeds']['title'] = array('#type' => 'textfield', '#title' => t('Title'), '#value' => $edit['title'], '#size' => 40, '#maxlength' => 40); |
200 | $form['feeds']['uid'] = array('#type' => 'select', '#title' => t('Original author'), '#value' => $edit['uid'], '#options' => $uids, '#description' => t('Select a user to associate this feed with')); |
201 | $form['feeds']['link'] = array('#type' => 'textfield', '#title' => t('URL'), '#value' => $edit['link'], '#size' => 40, '#maxlength' => 80); |
202 | $form['feeds']['submit'] = array('#type' => 'submit', '#value' => $edit['fid'] > 0 ? 'Edit' : 'Add' . ' Feed'); |
203 | - $output .= drupal_get_form('settings',$form); |
204 | - |
205 | + |
206 | if($individual){ |
207 | - $output .= planet_queue(intval($edit['uid'])); |
208 | + $form['queue'] = array('#type' => 'item', '#value' => planet_queue(intval($edit['uid']))); |
209 | } |
210 | |
211 | - return $output; |
212 | + return $form; |
213 | } |
214 | |
215 | function planet_queue($uid = null){ |
216 | @@ -873,7 +897,7 @@ |
217 | // If title was "escaped" then it may still contain entities, becuase each & from entity was also escabet to & before |
218 | // TODO: the same for content? |
219 | if ($item['TITLE'][0]['MODE'] == 'escaped') { |
220 | - $title = feeds_replace_entities($title); |
221 | + $title = planet_replace_entities($title); |
222 | } |
223 | $title = strip_tags($title); |
224 | |
225 | @@ -988,7 +1012,7 @@ |
226 | else { |
227 | $entry = db_fetch_object(db_query("SELECT ai.nid AS nid FROM {node} n, {planet_items} ai WHERE ai.fid = %d AND ai.nid = n.nid AND n.title = '%s'", $feed->fid, $title)); |
228 | } |
229 | - |
230 | + |
231 | //print $guid . '<br />'; |
232 | //print $entry->nid . '<br />'; |
233 | // Ignore items already existing in database and not allowed to be updated |
234 | @@ -999,6 +1023,7 @@ |
235 | $entry->body = $body; |
236 | $entry->body = planet_convert_relative_urls($body, $link); |
237 | $entry->teaser = node_teaser($entry->body); |
238 | + $entry->revision = true; |
239 | |
240 | // Check for an auto-publish string in the post and publish if applicable. |
241 | $has_category = false; |
242 | @@ -1016,8 +1041,9 @@ |
243 | |
244 | //Fields to set if it's a new item. |
245 | if(!isset($entry->nid)){ |
246 | + //print "Planet item " . $entry->title . "<br />"; |
247 | $entry->type = 'planet'; |
248 | - if($has_category == true || preg_match('/' . $auto_publish . '/',$entry->body)){ |
249 | + if($has_category == true || ($auto_publish != '' && preg_match('/' . $auto_publish . '/',$entry->body))){ |
250 | $entry->type = 'blog'; |
251 | } |
252 | |
253 | @@ -1029,8 +1055,9 @@ |
254 | $entry->promote = in_array('promote', $options) ? 1 : 0; |
255 | $entry->sticky = in_array('sticky', $options) ? 1 : 0; |
256 | $entry->comment = in_array('comment', $options) ? 2 : 0; |
257 | - $entry->format = 3; |
258 | + $entry->format = 4; //TODO: probably need to make this an option. |
259 | $entry->created = strtotime($date); |
260 | + $entry->revision = true; |
261 | |
262 | $terms = module_invoke('taxonomy', 'node_get_terms', $edit->nid, 'tid'); |
263 | foreach ($terms as $tid => $term) { |
264 | @@ -1038,8 +1065,9 @@ |
265 | $edit->taxonomy[] = $term->tid; |
266 | } |
267 | } |
268 | + //print '<pre>' . print_r($entry, 1) . '</pre>'; |
269 | node_save($entry); |
270 | - db_query('INSERT INTO {planet_items} (fid, nid, guid, created) VALUES(%d, %d, "%s", UNIX_TIMESTAMP(NOW()))', $feed->fid, $entry->nid, $guid); |
271 | + db_query('INSERT INTO {planet_items} (fid, nid, guid, link, created) VALUES(%d, %d, "%s", "%s", UNIX_TIMESTAMP(NOW()))', $feed->fid, $entry->nid, $guid, $link); |
272 | watchdog('planet', 'Adding ' . $title); |
273 | drupal_set_message('Adding ' . $title); |
274 | } |
275 | @@ -1048,10 +1076,10 @@ |
276 | if($has_category == true || preg_match('/' . $auto_publish . '/',$entry->body)){ |
277 | $entry->type = 'blog'; |
278 | } |
279 | - node_save($entry); |
280 | - watchdog('planet', 'Updating ' . $title); |
281 | drupal_set_message('Updating ' . $title); |
282 | } |
283 | + node_save($entry); |
284 | + watchdog('planet', 'Updating ' . $title); |
285 | } |
286 | } |
287 | |
288 | @@ -1189,12 +1217,16 @@ |
289 | */ |
290 | function planet_user($type, &$edit, &$user) { |
291 | if ($type == 'view' && user_access('edit own blog', $user)) { |
292 | - $items[] = array('title' => t('Planet'), |
293 | - 'value' => l(t('view recent planet entries'), "planet/$user->uid", array('title' => t("Read %username's latest planet entries.", array('%username' => $user->name)))), |
294 | - 'class' => 'planet', |
295 | + $items[] = array('title' => t('Blog'), |
296 | + 'value' => l(t('view recent blog entries'), "planet/$user->uid", array('title' => t("Read %username's latest blog entries.", array('%username' => $user->name)))), |
297 | + 'class' => 'blog', |
298 | ); |
299 | return array(t('History') => $items); |
300 | } |
301 | + if($type == 'load'){ |
302 | + $obj = db_fetch_object(db_query('SELECT link FROM {planet_feeds} WHERE uid = %d', $user->uid)); |
303 | + $user->planet_feed = $obj->link; |
304 | + } |
305 | } |
306 | |
307 | /** |
308 | @@ -1251,7 +1283,7 @@ |
309 | } |
310 | |
311 | function planet_load($node){ |
312 | - $additions = db_fetch_object(db_query('SELECT guid FROM {planet_items} WHERE nid = %d', $node->nid)); |
313 | + $additions = db_fetch_object(db_query('SELECT link, guid FROM {planet_items} WHERE nid = %d', $node->nid)); |
314 | return $additions; |
315 | } |
316 | |
317 | |
318 | === removed file 'planet.sql' |
319 | --- planet.sql 2009-06-04 08:45:43 +0000 |
320 | +++ planet.sql 1970-01-01 00:00:00 +0000 |
321 | @@ -1,16 +0,0 @@ |
322 | -CREATE TABLE planet_feeds( |
323 | - fid int(10) unsigned zerofill not null primary key auto_increment, |
324 | - uid int(10) unsigned zerofill, |
325 | - title varchar(50), |
326 | - link varchar(80), |
327 | - image varchar(120), |
328 | - checked int(11) |
329 | -); |
330 | - |
331 | -CREATE TABLE planet_items( |
332 | - id int(10) unsigned zerofill not null primary key auto_increment, |
333 | - fid int(10) unsigned zerofill, |
334 | - nid int(10) unsigned zerofill, |
335 | - guid varchar(120), |
336 | - created int(11) |
337 | -); |
338 | \ No newline at end of file |
This is the CVS release tag DRUPAL-5--1-2, drupal. org/node/ 80702/release as follows: ------- ------- ------- ------- ------- ------- ------- - 5.x-1.2. tar.gz 997ad8e07b40a0e e2
base of 6.x branch, lp:~swe3tdave/drupal-planet/6.x
released on http://
-------
planet 5.x-1.2
5.x · New features
dllh - June 15, 2007 - 17:34
Official release from CVS tag: DRUPAL-5--1-2
First released: June 15, 2007 - 17:34
Download: planet-
Size: 18.87 KB
md5_file hash: 62926edcff4e923
Last updated: June 15, 2007 - 17:35
View usage statistics for this release
This release adds the ability to have planet nodes automatically redirect to the source link for a given planet item. This may be useful for people who aren't comfortable editing templates to use the $node->link attribute the module adds. It's also useful for feed links, which are generated using node_feed, which defaults to the node/$nid url. Rather than hacking a copy of node_feed into planet, administrators can toggle this option on in the planet settings and have both web site clicks and feed clicks forward to the originating link.
One possible liability of this addition is that with the option turned on, administrators will not be able to click to a planet item to get the edit tab for editing and deleting; these operations will have to be performed through administration menus. ------- ------- ------- ------- ------- ------- ------- -
-------