diff options
author | Nicolas Vigier <boklm@mageia.org> | 2013-05-15 13:47:18 +0000 |
---|---|---|
committer | Nicolas Vigier <boklm@mageia.org> | 2013-05-15 13:47:18 +0000 |
commit | 0198a4bc59ce41712a86b610d10b0b7a93ec2dc7 (patch) | |
tree | 73792c9df10e2db475bb1370ec323818f503d335 | |
parent | 3d442aae04b0a6e19fb24ce5597094e6d2481040 (diff) | |
download | mgatres-0198a4bc59ce41712a86b610d10b0b7a93ec2dc7.tar mgatres-0198a4bc59ce41712a86b610d10b0b7a93ec2dc7.tar.gz mgatres-0198a4bc59ce41712a86b610d10b0b7a93ec2dc7.tar.bz2 mgatres-0198a4bc59ce41712a86b610d10b0b7a93ec2dc7.tar.xz mgatres-0198a4bc59ce41712a86b610d10b0b7a93ec2dc7.zip |
Add rss feed for donations
git-svn-id: svn+ssh://svn.mageia.org/svn/soft/mga-treasurer/trunk@8243 5b7c3c08-40e5-403b-9995-ace06908e4af
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | config_default | 2 | ||||
-rwxr-xr-x | mktreasurer | 1 | ||||
-rw-r--r-- | tmpl/donations.html | 2 | ||||
-rw-r--r-- | tmpl/donations.rss | 28 |
5 files changed, 33 insertions, 2 deletions
@@ -3,7 +3,7 @@ VERSION=0.1 PROJECTNAME=mga-treasurer BINFILES=mktreasurer CFGFILES=mga-treasurer.conf -TMPLFILES=tmpl/*.html +TMPLFILES=tmpl/*.html tmpl/*.rss sysconfdir=/etc bindir=/usr/bin diff --git a/config_default b/config_default index f5ee800..3bc615b 100644 --- a/config_default +++ b/config_default @@ -2,5 +2,7 @@ grisbi_file: /var/lib/mga-treasurer/data/mga-accounts.gsb tmpl_dir: /usr/share/mga-treasurer/tmpl output_format: - html + - rss out_dir: /var/www/mga-treasurer sitename: Mageia.Org +siteurl: http://treasurer.mageia.org diff --git a/mktreasurer b/mktreasurer index 786246b..93967a7 100755 --- a/mktreasurer +++ b/mktreasurer @@ -47,6 +47,7 @@ sub donations_list { my @donations = grep { $_->{Ca} == $don_cat } @{$r->{Transaction}}; foreach my $don (@donations) { my %d = ( + nb => $don->{Nb}, amount => $don->{Am}, date => epoch_date($don->{Dt}), who => party_name($r, $don->{Pa}), diff --git a/tmpl/donations.html b/tmpl/donations.html index f50e96f..8eac51c 100644 --- a/tmpl/donations.html +++ b/tmpl/donations.html @@ -9,7 +9,7 @@ [% donations.total_30 %] Euros have been donated to Mageia.org in the last 30 days. [%- l = 10 -%] - <h3>Last [% l %] donations</h3> + <h3>Last [% l %] donations <a href="donations.rss"><img src="http://static.mageia.org/g/images/smi/feed-16x16.png" alt="RSS feed" /></a></h3> <ul> [%- i=0 -%] [%- FOR don IN donations.donations.sort('date').reverse -%] diff --git a/tmpl/donations.rss b/tmpl/donations.rss new file mode 100644 index 0000000..83bf083 --- /dev/null +++ b/tmpl/donations.rss @@ -0,0 +1,28 @@ +<?xml version="1.0"?> + +<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"> + <channel> + <title>[% config.sitename %]: Donations</title> + <link>[% config.siteurl %]</link> + <description>[% config.sitename %] Donations</description> + <language>en</language> + + <atom:link href="[% config.siteurl %]/index.rss" rel="self" type="application/rss+xml" /> + + [%- FOR don IN donations.donations.sort('date').reverse -%] + + <item> + <title>[% don.who %] donated [% don.amount %] Euros</title> + <link>[% config.siteurl %]/donations_[% date.format(don.date, format => '%Y-%m') %].html</link> + <guid isPermaLink="false">[% config.sitename %]:donations:[% don.nb %]</guid> + [%- USE date %] + <pubDate>[% date.format(don.date, format => '%a, %d %b %Y %H:%M:%S', gmt => 1) %] GMT</pubDate> + <category>[% don.type %]</category> + <description> + [% don.who %] donated [% don.amount %] Euros ([% don.type %]). + </description> + </item> + + [%- END -%] + </channel> +</rss> |