Author: dom Date: 2006-05-14 16:27:00 +0100 (Sun, 14 May 2006) New Revision: 784
Modified: trunk/Build.PL trunk/Changes trunk/PREREQUISITES trunk/lib/OpenGuides.pm trunk/lib/OpenGuides/Feed.pm trunk/wiki.cgi Log: Revert changeset 769 to reintroduce Atom support.
Modified: trunk/Build.PL =================================================================== --- trunk/Build.PL 2006-04-21 09:45:45 UTC (rev 783) +++ trunk/Build.PL 2006-05-14 15:27:00 UTC (rev 784) @@ -221,6 +221,7 @@ 'CGI::Cookie' => 0, 'CGI::Wiki' => '0.62', # fixed delete version 'CGI::Wiki::Formatter::UseMod' => '0.16', # macros + 'CGI::Wiki::Plugin::Atom' => 0, 'CGI::Wiki::Plugin::Categoriser' => 0, 'CGI::Wiki::Plugin::Diff' => '0.08', # earlier buggy 'CGI::Wiki::Plugin::Locator::Grid'=> '0.02', # cope with sqlite 3
Modified: trunk/Changes =================================================================== --- trunk/Changes 2006-04-21 09:45:45 UTC (rev 783) +++ trunk/Changes 2006-05-14 15:27:00 UTC (rev 784) @@ -1,5 +1,9 @@ "#" items refer to tickets. See http://dev.openguides.org/report/9 for details.
+0.55 ??? + Support for Atom feeds for RecentChanges. + #118 Use Wiki::Toolkit + 0.54 21 April 2006 #112 Fixed website display bug introduced in 0.53.
Modified: trunk/PREREQUISITES =================================================================== --- trunk/PREREQUISITES 2006-04-21 09:45:45 UTC (rev 783) +++ trunk/PREREQUISITES 2006-05-14 15:27:00 UTC (rev 784) @@ -8,6 +8,7 @@ CGI::Cookie CGI::Wiki (version 0.62 or later) CGI::Wiki::Formatter::UseMod (version 0.16 or later) +CGI::Wiki::Plugin::Atom CGI::Wiki::Plugin::Categoriser CGI::Wiki::Plugin::Diff (version 0.08 or later) CGI::Wiki::Plugin::Locator::Grid (version 0.02 or later)
Modified: trunk/lib/OpenGuides/Feed.pm =================================================================== --- trunk/lib/OpenGuides/Feed.pm 2006-04-21 09:45:45 UTC (rev 783) +++ trunk/lib/OpenGuides/Feed.pm 2006-05-14 15:27:00 UTC (rev 784) @@ -5,6 +5,7 @@ use vars qw( $VERSION ); $VERSION = '0.01';
+use CGI::Wiki::Plugin::Atom; use CGI::Wiki::Plugin::RSS::ModWiki; use Time::Piece; use URI::Escape; @@ -62,6 +63,7 @@
my %known_types = ( 'rss' => 1, + 'atom' => 1, );
croak "No feed type specified" unless $feed_type; @@ -70,8 +72,32 @@ if ($feed_type eq 'rss') { return $self->rss_maker->recent_changes(%args); } + elsif ($feed_type eq 'atom') { + return $self->atom_maker->recent_changes(%args); + } }
+sub atom_maker { + my $self = shift; + + unless ($self->{atom_maker}) { + $self->{atom_maker} = CGI::Wiki::Plugin::Atom->new( + wiki => $self->{wiki}, + site_name => $self->{site_name}, + site_url => $self->{config}->script_url, + site_description => $self->{site_description}, + make_node_url => $self->{make_node_url}, + recent_changes_link => $self->{config}->script_url . '?action=rc', + atom_link => $self->{config}->script_url . '?action=rc&format=atom', + software_name => 'OpenGuides', + software_homepage => 'http://openguides.org/', + software_version => $self->{og_version}, + ); + } + + $self->{atom_maker}; +} + sub rss_maker { my $self = shift;
@@ -106,7 +132,7 @@
=head1 DESCRIPTION
-Produces RSS 1.0 feeds for OpenGuides. Distributed and +Produces RSS 1.0 and Atom 1.0 feeds for OpenGuides. Distributed and installed as part of the OpenGuides project, not intended for independent installation. This documentation is probably only useful to OpenGuides developers. @@ -150,6 +176,11 @@ Returns a raw LCGI::Wiki::Plugin::RSS::ModWiki object created with the values you invoked this module with.
+=item B<atom_maker> + +Returns a raw LCGI::Wiki::Plugin::Atom object created with the values you +invoked this module with. + =item B<make_feed>
# Ten most recent changes in RSS format. @@ -159,6 +190,15 @@ feed_type => 'rss', ); print $rdf_writer->make_feed( %args );
+ # All the changes made by bob in the past week, ignoring minor edits, in Atom. + $args{days} = 7; + $args{ignore_minor_edits = 1; + $args{filter_on_metadata} => { username => "bob" }; + + print "Content-Type: application/atom+xml\n"; + print "Last-Modified: " . $feed->feed_timestamp( %args ) . "\n\n"; + print $feed->make_feed( %args ); + =item B<feed_timestamp>
print "Last-Modified: " . $feed->feed_timestamp( %args ) . "\n\n"; @@ -175,7 +215,7 @@
=over 4
-=item * LCGI::Wiki and LCGI::Wiki::Plugin::RSS::ModWiki +=item * LCGI::Wiki, LCGI::Wiki::Plugin::RSS::ModWiki and LCGI::Wiki::Plugin::Atom
=item * Lhttp://openguides.org/
Modified: trunk/lib/OpenGuides.pm =================================================================== --- trunk/lib/OpenGuides.pm 2006-04-21 09:45:45 UTC (rev 783) +++ trunk/lib/OpenGuides.pm 2006-05-14 15:27:00 UTC (rev 784) @@ -156,6 +156,9 @@ $tt_vars{"rss_".lc($type)."_url"} = $config->script_name . "?action=rc;format=rss;" . lc($type) . "=" . lc(CGI->escape($2)); + $tt_vars{"atom_".lc($type)."_url"} = + $config->script_name . "?action=rc;format=atom;" + . lc($type) . "=" . lc(CGI->escape($2)); }
my %current_data = $wiki->retrieve_node( $id ); @@ -647,8 +650,16 @@ locale => "Hammersmith", );
+ # 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", + ); + C<feed_type> is a mandatory parameter. Supported values at present are -"rss". +"rss" and "atom".
As with other methods, the C<return_output> parameter can be used to return the output instead of printing it to STDOUT. @@ -693,7 +704,11 @@
if ($feed_type eq 'rss') { $output = "Content-Type: application/rdf+xml\n"; - } else { + } + elsif ($feed_type eq 'atom') { + $output = "Content-Type: application/atom+xml\n"; + } + else { croak "Unknown feed type given: $feed_type"; }
Modified: trunk/wiki.cgi =================================================================== --- trunk/wiki.cgi 2006-04-21 09:45:45 UTC (rev 783) +++ trunk/wiki.cgi 2006-05-14 15:27:00 UTC (rev 784) @@ -110,6 +110,12 @@ } else { croak "Unknown RSS feed type '$feed'"; } + } elsif ($format && $format eq 'atom') { + my %args = map { $_ => ( $q->param($_) || "" ) } + qw( feed items days ignore_minor_edits username + category locale ); + $args{feed_type} = 'atom'; + $guide->display_feed( %args ); } else { $guide->display_node( id => 'RecentChanges' ); }
openguides-commits@lists.openguides.org