Changeset 784
- Timestamp:
- 05/14/06 16:27:00 (3 years ago)
- Location:
- trunk
- Files:
-
- 6 modified
-
Build.PL (modified) (1 diff)
-
Changes (modified) (1 diff)
-
PREREQUISITES (modified) (1 diff)
-
lib/OpenGuides.pm (modified) (3 diffs)
-
lib/OpenGuides/Feed.pm (modified) (7 diffs)
-
wiki.cgi (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Build.PL
r777 r784 222 222 'CGI::Wiki' => '0.62', # fixed delete version 223 223 'CGI::Wiki::Formatter::UseMod' => '0.16', # macros 224 'CGI::Wiki::Plugin::Atom' => 0, 224 225 'CGI::Wiki::Plugin::Categoriser' => 0, 225 226 'CGI::Wiki::Plugin::Diff' => '0.08', # earlier buggy -
trunk/Changes
r782 r784 1 1 "#" items refer to tickets. See <http://dev.openguides.org/report/9> for details. 2 3 0.55 ??? 4 Support for Atom feeds for RecentChanges. 5 #118 Use Wiki::Toolkit 2 6 3 7 0.54 21 April 2006 -
trunk/PREREQUISITES
r782 r784 9 9 CGI::Wiki (version 0.62 or later) 10 10 CGI::Wiki::Formatter::UseMod (version 0.16 or later) 11 CGI::Wiki::Plugin::Atom 11 12 CGI::Wiki::Plugin::Categoriser 12 13 CGI::Wiki::Plugin::Diff (version 0.08 or later) -
trunk/lib/OpenGuides.pm
r783 r784 156 156 $tt_vars{"rss_".lc($type)."_url"} = 157 157 $config->script_name . "?action=rc;format=rss;" 158 . lc($type) . "=" . lc(CGI->escape($2)); 159 $tt_vars{"atom_".lc($type)."_url"} = 160 $config->script_name . "?action=rc;format=atom;" 158 161 . lc($type) . "=" . lc(CGI->escape($2)); 159 162 } … … 648 651 ); 649 652 653 # All edits bob has made to pub pages in the last week in Atom format 654 $guide->display_feed( 655 feed_type => 'atom', 656 days => 7, 657 username => "bob", 658 category => "Pubs", 659 ); 660 650 661 C<feed_type> is a mandatory parameter. Supported values at present are 651 "rss" .662 "rss" and "atom". 652 663 653 664 As with other methods, the C<return_output> parameter can be used to … … 694 705 if ($feed_type eq 'rss') { 695 706 $output = "Content-Type: application/rdf+xml\n"; 696 } else { 707 } 708 elsif ($feed_type eq 'atom') { 709 $output = "Content-Type: application/atom+xml\n"; 710 } 711 else { 697 712 croak "Unknown feed type given: $feed_type"; 698 713 } -
trunk/lib/OpenGuides/Feed.pm
r769 r784 6 6 $VERSION = '0.01'; 7 7 8 use CGI::Wiki::Plugin::Atom; 8 9 use CGI::Wiki::Plugin::RSS::ModWiki; 9 10 use Time::Piece; … … 63 64 my %known_types = ( 64 65 'rss' => 1, 66 'atom' => 1, 65 67 ); 66 68 … … 71 73 return $self->rss_maker->recent_changes(%args); 72 74 } 75 elsif ($feed_type eq 'atom') { 76 return $self->atom_maker->recent_changes(%args); 77 } 78 } 79 80 sub atom_maker { 81 my $self = shift; 82 83 unless ($self->{atom_maker}) { 84 $self->{atom_maker} = CGI::Wiki::Plugin::Atom->new( 85 wiki => $self->{wiki}, 86 site_name => $self->{site_name}, 87 site_url => $self->{config}->script_url, 88 site_description => $self->{site_description}, 89 make_node_url => $self->{make_node_url}, 90 recent_changes_link => $self->{config}->script_url . '?action=rc', 91 atom_link => $self->{config}->script_url . '?action=rc&format=atom', 92 software_name => 'OpenGuides', 93 software_homepage => 'http://openguides.org/', 94 software_version => $self->{og_version}, 95 ); 96 } 97 98 $self->{atom_maker}; 73 99 } 74 100 … … 107 133 =head1 DESCRIPTION 108 134 109 Produces RSS 1.0 feeds for OpenGuides. Distributed and135 Produces RSS 1.0 and Atom 1.0 feeds for OpenGuides. Distributed and 110 136 installed as part of the OpenGuides project, not intended for independent 111 137 installation. This documentation is probably only useful to OpenGuides … … 151 177 invoked this module with. 152 178 179 =item B<atom_maker> 180 181 Returns a raw L<CGI::Wiki::Plugin::Atom> object created with the values you 182 invoked this module with. 183 153 184 =item B<make_feed> 154 185 … … 160 191 print $rdf_writer->make_feed( %args ); 161 192 193 # All the changes made by bob in the past week, ignoring minor edits, in Atom. 194 $args{days} = 7; 195 $args{ignore_minor_edits = 1; 196 $args{filter_on_metadata} => { username => "bob" }; 197 198 print "Content-Type: application/atom+xml\n"; 199 print "Last-Modified: " . $feed->feed_timestamp( %args ) . "\n\n"; 200 print $feed->make_feed( %args ); 201 162 202 =item B<feed_timestamp> 163 203 … … 176 216 =over 4 177 217 178 =item * L<CGI::Wiki> and L<CGI::Wiki::Plugin::RSS::ModWiki>218 =item * L<CGI::Wiki>, L<CGI::Wiki::Plugin::RSS::ModWiki> and L<CGI::Wiki::Plugin::Atom> 179 219 180 220 =item * L<http://openguides.org/> -
trunk/wiki.cgi
r783 r784 111 111 croak "Unknown RSS feed type '$feed'"; 112 112 } 113 } elsif ($format && $format eq 'atom') { 114 my %args = map { $_ => ( $q->param($_) || "" ) } 115 qw( feed items days ignore_minor_edits username 116 category locale ); 117 $args{feed_type} = 'atom'; 118 $guide->display_feed( %args ); 113 119 } else { 114 120 $guide->display_node( id => 'RecentChanges' );
