From fe5d9e3ed729b793d8508f6d7cf8990920e1fbdd Mon Sep 17 00:00:00 2001 From: Magnus Hagander Date: Fri, 31 Jul 2009 07:56:38 -0400 Subject: [PATCH] Implement an RSS feed with the changes from the commitfest app. --- perl-lib/PgCommitFest/CommitFest.pm | 47 +++++++++++++++++++++++++++++ perl-lib/PgCommitFest/Handler.pm | 1 + template/header.tt2 | 1 + 3 files changed, 49 insertions(+) diff --git a/perl-lib/PgCommitFest/CommitFest.pm b/perl-lib/PgCommitFest/CommitFest.pm index 6955839..7e67f97 100644 --- a/perl-lib/PgCommitFest/CommitFest.pm +++ b/perl-lib/PgCommitFest/CommitFest.pm @@ -1,6 +1,7 @@ package PgCommitFest::CommitFest; use strict; use warnings; +use XML::RSS; sub activity { my ($r, $extrapath) = @_; @@ -23,6 +24,52 @@ EOM 'activity' => $activity }); } +sub activity_rss { + my ($r, $extrapath) = @_; + my $where = ''; # By default, show all commitfests + my @l = (); + + if (defined($extrapath)) { + $l[0] = setup($r, $extrapath)->{'id'}; + $where = 'WHERE v.commitfest_id = ?'; + } + my $activity = $r->db->select(<'2.0'); + $rss->channel( title => 'PostgreSQL commitfest updates', + link => 'http://commitfest.postgresql.org', + language => 'en', + description => 'PostgreSQL commitfest updates' + ); + foreach my $row (@$activity) { + $rss->add_item(guid => 'http://commitfest.postgresql.org/activity/' . + $row->{'patch_id'} . '/' . $row->{'last_updated_time'}, + title => $row->{'commitfest_name'} . ': ' . $row->{'patch_name'}, + description => 'Commitfest: ' . $row->{'commitfest_name'} . + '
Patch: ' . $row->{'patch_name'} . '
Change by: ' . + $row->{'last_updater'} . '
Change: ' . $row->{'activity_type'} . ': ' . + $row->{'details'} + ); + } + print "Content-type: application/xml+rss\n\n"; + + print $rss->as_string; + $r->{'response_sent'} = 1; +} + sub delete { my ($r) = @_; $r->authenticate('require_login' => 1, 'require_administrator' => 1); diff --git a/perl-lib/PgCommitFest/Handler.pm b/perl-lib/PgCommitFest/Handler.pm index b269e0f..57dc859 100644 --- a/perl-lib/PgCommitFest/Handler.pm +++ b/perl-lib/PgCommitFest/Handler.pm @@ -13,6 +13,7 @@ our %ACTION = ( 'login' => \&PgCommitFest::Handler::login, 'logout' => \&PgCommitFest::Handler::logout, 'commitfest_activity' => \&PgCommitFest::CommitFest::activity, + 'commitfest_activity.rss' => \&PgCommitFest::CommitFest::activity_rss, 'commitfest_delete' => \&PgCommitFest::CommitFest::delete, 'commitfest_form' => \&PgCommitFest::CommitFest::form, 'commitfest_search' => \&PgCommitFest::CommitFest::search, diff --git a/template/header.tt2 b/template/header.tt2 index 1563751..f9648ec 100644 --- a/template/header.tt2 +++ b/template/header.tt2 @@ -5,6 +5,7 @@ PostgreSQL CommitFest Management[% IF title != '' %]: [% title | htmlsafe %][% END %] + -- 2.39.5