package PgCommitFest::CommitFest;
use strict;
use warnings;
+use XML::RSS;
sub activity {
my ($r, $extrapath) = @_;
'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(<<EOM, @l);
+SELECT
+ to_char(v.last_updated_time, 'YYYY-MM-DD HH24:MI:SS') AS last_updated_time,
+ v.last_updater, v.patch_name, v.patch_id, v.activity_type, v.details,
+ commitfest.name as commitfest_name
+FROM
+ commitfest_activity_log v
+INNER JOIN
+ commitfest ON v.commitfest_id=commitfest.id
+$where
+ORDER BY
+ v.last_updated_time DESC LIMIT 50
+EOM
+
+ my $rss = new XML::RSS(version=>'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'} .
+ '<br/>Patch: <a href="http://commitfest.postgresql.org/action/patch_view?id=' .
+ $row->{'patch_id'} . '">' . $row->{'patch_name'} . '</a><br/>Change by: ' .
+ $row->{'last_updater'} . '<br/>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);
'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,