Author: nick Date: 2006-05-19 12:08:19 +0100 (Fri, 19 May 2006) New Revision: 790
Modified: trunk/ trunk/Changes trunk/lib/OpenGuides.pm trunk/lib/OpenGuides/Feed.pm trunk/t/22_rss_modwiki.t trunk/wiki.cgi Log: Pass the requested feed listing through all the feeds code, rather than just assuming it's recent_changes
Property changes on: trunk ___________________________________________________________________ Name: svn:ignore + .vimrc *.swp
Modified: trunk/Changes =================================================================== --- trunk/Changes 2006-05-16 18:32:55 UTC (rev 789) +++ trunk/Changes 2006-05-19 11:08:19 UTC (rev 790) @@ -1,5 +1,11 @@ "#" items refer to tickets. See http://dev.openguides.org/report/9 for details.
+0.54_02 + Pass the feed_listing (currently just recent_changes) through all + the feed related code, rather than assuming it'll only ever be + recent changes. Will allow other listings of nodes to be handled + in the future. + 0.54_01 16 May 2006 Support for Atom feeds for RecentChanges. #118 Use Wiki::Toolkit. NOTE this is a development snapshot and is
Modified: trunk/lib/OpenGuides/Feed.pm =================================================================== --- trunk/lib/OpenGuides/Feed.pm 2006-05-16 18:32:55 UTC (rev 789) +++ trunk/lib/OpenGuides/Feed.pm 2006-05-19 11:08:19 UTC (rev 790) @@ -60,20 +60,31 @@ my ($self, %args) = @_;
my $feed_type = $args{feed_type}; + my $feed_listing = $args{feed_listing};
my %known_types = ( 'rss' => 1, 'atom' => 1, ); + my %known_listings = ( + 'recent_changes' => 1, + );
croak "No feed type specified" unless $feed_type; croak "Unknown feed type: $feed_type" unless $known_types{$feed_type};
+ croak "No feed listing specified" unless $feed_listing; + croak "Unknown feed listing: $feed_listing" unless $known_listings{$feed_listing}; + if ($feed_type eq 'rss') { - return $self->rss_maker->recent_changes(%args); + if ($feed_listing eq 'recent_changes') { + return $self->rss_maker->recent_changes(%args); + } } elsif ($feed_type eq 'atom') { - return $self->atom_maker->recent_changes(%args); + if ($feed_listing eq 'recent_changes') { + return $self->atom_maker->recent_changes(%args); + } } }
Modified: trunk/lib/OpenGuides.pm =================================================================== --- trunk/lib/OpenGuides.pm 2006-05-16 18:32:55 UTC (rev 789) +++ trunk/lib/OpenGuides.pm 2006-05-19 11:08:19 UTC (rev 790) @@ -645,6 +645,7 @@ # Last ten non-minor edits to Hammersmith pages in RSS 1.0 format $guide->display_feed( feed_type => 'rss', + feed_listing => 'recent_changes', items => 10, ignore_minor_edits => 1, locale => "Hammersmith", @@ -652,15 +653,19 @@
# All edits bob has made to pub pages in the last week in Atom format $guide->display_feed( - feed_type => 'atom', - days => 7, - username => "bob", - category => "Pubs", + feed_type => 'atom', + feed_listing => 'recent_changes', + days => 7, + username => "bob", + category => "Pubs", );
C<feed_type> is a mandatory parameter. Supported values at present are "rss" and "atom".
+C<feed_listing> is a mandatory parameter. Supported values at present +are "recent_changes". (More values are coming soon though!) + As with other methods, the C<return_output> parameter can be used to return the output instead of printing it to STDOUT.
@@ -671,6 +676,9 @@
my $feed_type = $args{feed_type}; croak "No feed type given" unless $feed_type; + + my $feed_listing = $args{feed_listing}; + croak "No feed listing given" unless $feed_listing;
my $return_output = $args{return_output} ? 1 : 0;
@@ -685,6 +693,7 @@ days => $days, ignore_minor_edits => $ignore_minor_edits, feed_type => $feed_type, + feed_listing => $feed_listing, ); my %filter; $filter{username} = $username if $username;
Modified: trunk/t/22_rss_modwiki.t =================================================================== --- trunk/t/22_rss_modwiki.t 2006-05-16 18:32:55 UTC (rev 789) +++ trunk/t/22_rss_modwiki.t 2006-05-19 11:08:19 UTC (rev 790) @@ -45,7 +45,7 @@ my $feed = OpenGuides::Feed->new( wiki => $wiki, config => $config );
-my $rss = eval { $feed->make_feed(feed_type => 'rss'); }; +my $rss = eval { $feed->make_feed(feed_type => 'rss', feed_listing => 'recent_changes'); }; is( $@, "", "->make_feed for rss doesn't croak" );
# Now write some data, first a minor edit then a non-minor one. @@ -99,6 +99,7 @@ # Check that the minor edits can be filtered out. $output = $guide->display_feed( feed_type => "rss", + feed_listing => "recent_changes", items => 5, username => "bob", ignore_minor_edits => 1,
Modified: trunk/wiki.cgi =================================================================== --- trunk/wiki.cgi 2006-05-16 18:32:55 UTC (rev 789) +++ trunk/wiki.cgi 2006-05-19 11:08:19 UTC (rev 790) @@ -104,6 +104,7 @@ qw( feed items days ignore_minor_edits username category locale ); $args{feed_type} = 'rss'; + $args{feed_listing} = 'recent_changes'; $guide->display_feed( %args ); } elsif ( $feed eq "chef_dan" ) { display_node_rdf( node => $node ); @@ -115,6 +116,7 @@ qw( feed items days ignore_minor_edits username category locale ); $args{feed_type} = 'atom'; + $args{feed_listing} = 'recent_changes'; $guide->display_feed( %args ); } else { $guide->display_node( id => 'RecentChanges' );
openguides-commits@lists.openguides.org