Index: modules/aggregator.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/aggregator.module,v
retrieving revision 1.253
diff -u -u -r1.253 aggregator.module
--- modules/aggregator.module 8 Sep 2005 20:08:42 -0000 1.253
+++ modules/aggregator.module 15 Sep 2005 21:15:05 -0000
@@ -1058,21 +1058,33 @@
$url = '/categories/' . $category->cid;
$title = ' ' . t('in category') . ' ' . $category->title;
$sql = 'SELECT i.*, f.title AS ftitle, f.link AS flink FROM {aggregator_category_item} c LEFT JOIN {aggregator_item} i ON c.iid = i.iid LEFT JOIN {aggregator_feed} f ON i.fid = f.fid WHERE cid = %d ORDER BY timestamp DESC, iid DESC';
- $result = db_query_range($sql, $category->cid, 0, 15);
+ $result = db_query_range($sql, $category->cid, 0, variable_get('feed_default_items', 10));
}
// or, get the default aggregator items
else {
$sql = 'SELECT i.*, f.title AS ftitle, f.link AS flink FROM {aggregator_item} i INNER JOIN {aggregator_feed} f ON i.fid = f.fid ORDER BY i.timestamp DESC, i.iid DESC';
- $result = db_query_range($sql, 0, 15);
+ $result = db_query_range($sql, 0, variable_get('feed_default_items', 10));
}
while ($item = db_fetch_object($result)) {
+ switch (variable_get('feed_item_length', 'teaser')) {
+ case 'teaser':
+ $teaser = node_teaser($item->description);
+ if ($teaser != $item_description) {
+ $teaser .= '
'. t('read more') ."
\n";
+ }
+ $item->description = $teaser;
+ break;
+ case 'title':
+ $item->description = '';
+ break;
+ }
$items .= format_rss_item($item->ftitle . ': ' . $item->title, $item->link, $item->description, array('pubDate' => date('r', $item->timestamp)));
}
$output .= "\n";
$output .= "]>\n";
- $output .= "\n";
+ $output .= "\n";
$output .= format_rss_channel(variable_get('site_name', t('Drupal')) . ' ' . t('aggregator'), $base_url . '/' . url('aggregator' . $url), variable_get('site_name', t('Drupal')) . ' - ' . t('aggregated feeds') . $title, $items, 'en');
$output .= "\n";
Index: modules/blog.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/blog.module,v
retrieving revision 1.227
diff -u -u -r1.227 blog.module
--- modules/blog.module 14 Sep 2005 21:16:00 -0000 1.227
+++ modules/blog.module 15 Sep 2005 21:15:06 -0000
@@ -77,7 +77,7 @@
$account = $user;
}
- $result = db_query_range(db_rewrite_sql("SELECT n.nid, n.title, r.teaser, n.created, u.name, u.uid FROM {node} n INNER JOIN {node_revisions} r ON n.vid = r.vid INNER JOIN {users} u ON n.uid = u.uid WHERE n.type = 'blog' AND u.uid = %d AND n.status = 1 ORDER BY n.created DESC"), $uid, 0, 15);
+ $result = db_query_range(db_rewrite_sql("SELECT n.nid, n.title, r.teaser, n.created, u.name, u.uid FROM {node} n INNER JOIN {node_revisions} r ON n.vid = r.vid INNER JOIN {users} u ON n.uid = u.uid WHERE n.type = 'blog' AND u.uid = %d AND n.status = 1 ORDER BY n.created DESC"), $uid, 0, variable_get('feed_default_items', 10));
$channel['title'] = $account->name ."'s blog";
$channel['link'] = url("blog/$uid", NULL, NULL, TRUE);
$channel['description'] = $term->description;
@@ -88,7 +88,7 @@
* Displays an RSS feed containing recent blog entries of all users.
*/
function blog_feed_last() {
- $result = db_query_range(db_rewrite_sql("SELECT n.nid, n.title, r.teaser, n.created, u.name, u.uid FROM {node} n INNER JOIN {node_revisions} r ON n.vid = r.vid INNER JOIN {users} u ON n.uid = u.uid WHERE n.type = 'blog' AND n.status = 1 ORDER BY n.created DESC"), 0, 15);
+ $result = db_query_range(db_rewrite_sql("SELECT n.nid, n.title, r.teaser, n.created, u.name, u.uid FROM {node} n INNER JOIN {node_revisions} r ON n.vid = r.vid INNER JOIN {users} u ON n.uid = u.uid WHERE n.type = 'blog' AND n.status = 1 ORDER BY n.created DESC"), 0, variable_get('feed_default_items', 10));
$channel['title'] = variable_get('site_name', 'drupal') .' blogs';
$channel['link'] = url('blog', NULL, NULL, TRUE);
$channel['description'] = $term->description;
Index: modules/comment.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/comment.module,v
retrieving revision 1.369
diff -u -u -r1.369 comment.module
--- modules/comment.module 7 Sep 2005 20:45:53 -0000 1.369
+++ modules/comment.module 15 Sep 2005 21:15:07 -0000
@@ -284,6 +284,8 @@
case 'search result':
$comments = db_result(db_query('SELECT comment_count FROM {node_comment_statistics} WHERE nid = %d', $node->nid));
return format_plural($comments, '1 comment', '%count comments');
+ case 'rss item':
+ return array(array('key' => 'comments', 'value' => url('node/'.$node->nid, NULL, 'comment', TRUE)));
}
}
Index: modules/node.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/node.module,v
retrieving revision 1.527
diff -u -u -r1.527 node.module
--- modules/node.module 2 Sep 2005 02:11:41 -0000 1.527
+++ modules/node.module 15 Sep 2005 21:15:08 -0000
@@ -1160,29 +1160,58 @@
global $base_url, $locale;
if (!$nodes) {
- $nodes = db_query_range(db_rewrite_sql('SELECT n.nid FROM {node} n WHERE n.promote = 1 AND n.status = 1 ORDER BY n.created DESC'), 0, 15);
+ $nodes = db_query_range(db_rewrite_sql('SELECT n.nid FROM {node} n WHERE n.promote = 1 AND n.status = 1 ORDER BY n.created DESC'), 0, variable_get('feed_default_items', 10));
}
+ $item_length = variable_get('feed_item_length', 'teaser');
+ $namespaces = array('xmlns:dc="http://purl.org/dc/elements/1.1/"');
+
while ($node = db_fetch_object($nodes)) {
// Load the specified node:
$item = node_load($node->nid);
$link = url("node/$node->nid", NULL, NULL, 1);
- // Filter and prepare node teaser
- if (node_hook($item, 'view')) {
- node_invoke($item, 'view', TRUE, FALSE);
- }
- else {
- $item = node_prepare($item, TRUE);
- }
-
- // Allow modules to change $node->teaser before viewing.
- node_invoke_nodeapi($item, 'view', true, false);
+ if ($item_length != 'title') {
+ $teaser = ($item_length == 'teaser') ? TRUE : FALSE;
+ // Filter and prepare node teaser
+ if (node_hook($item, 'view')) {
+ node_invoke($item, 'view', $teaser, FALSE);
+ }
+ else {
+ $item = node_prepare($item, $teaser);
+ }
+
+ // Allow modules to change $node->teaser before viewing.
+ node_invoke_nodeapi($item, 'view', $teaser, FALSE);
+ }
+
+ // Prepare the item description
+ switch ($item_length) {
+ case 'fulltext':
+ $item_text = $item->body;
+ break;
+ case 'teaser':
+ $item_text = $item->teaser;
+ if ($item->readmore) {
+ $item_text .= ''. l(t('read more'), 'node/'. $item->nid, NULL, NULL, NULL, TRUE) .'
';
+ }
+ break;
+ case 'title':
+ $item_text = '';
+ break;
+ }
+
// Allow modules to add additional item fields
$extra = node_invoke_nodeapi($item, 'rss item');
- $extra = array_merge($extra, array(array('key' => 'pubDate', 'value' => date('r', $item->created))));
- $items .= format_rss_item($item->title, $link, $item->teaser, $extra);
+ $extra = array_merge($extra, array(array('key' => 'pubDate', 'value' => date('r', $item->created)),
+ array('key' => 'dc:creator', 'value' => $item->name)));
+ foreach ($extra as $element) {
+ if ($element['namespace']) {
+ $namespaces = array_merge($namespaces, array($element['namespace']));
+ }
+ }
+ $items .= format_rss_item($item->title, $link, $item_text, $extra);
}
$channel_defaults = array(
@@ -1196,7 +1225,7 @@
$output = "\n";
$output .= "]>\n";
- $output .= "\n";
+ $output .= "\n";
$output .= format_rss_channel($channel['title'], $channel['link'], $channel['description'], $items, $channel['language']);
$output .= "\n";
Index: modules/system.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/system.module,v
retrieving revision 1.234
diff -u -u -r1.234 system.module
--- modules/system.module 13 Sep 2005 19:12:19 -0000 1.234
+++ modules/system.module 15 Sep 2005 21:15:10 -0000
@@ -238,6 +238,12 @@
$output .= form_group_collapsible(t('Image handling'), ''. $group .'
', TRUE);
}
+ // Feed settings
+ $group = '';
+ $group .= form_select(t('Number of items per feed'), 'feed_default_items', variable_get('feed_default_items', 10), drupal_map_assoc(array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 15, 20, 25, 30)), t('The default number of items to include in a feed.'));
+ $group .= form_select(t('Display of XML feed items'), 'feed_item_length', variable_get('feed_item_length','teaser'), array('title' => t('Titles only'), 'teaser' => t('Titles plus teaser'), 'fulltext' => t('Full text')), t('Global setting for the length of XML feed items that are output by default.'));
+ $output .= form_group_collapsible(t('Feed settings'), $group, TRUE);
+
// Date settings:
$zones = _system_zonelist();
Index: modules/taxonomy.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/taxonomy.module,v
retrieving revision 1.223
diff -u -u -r1.223 taxonomy.module
--- modules/taxonomy.module 12 Sep 2005 21:55:41 -0000 1.223
+++ modules/taxonomy.module 15 Sep 2005 21:15:11 -0000
@@ -979,7 +979,7 @@
$result = pager_query($sql, variable_get('default_nodes_main', 10), 0, $sql_count);
}
else {
- $result = db_query_range($sql, 0, 15);
+ $result = db_query_range($sql, 0, variable_get('feed_default_items', 10));
}
}