aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile2
-rw-r--r--config_default2
-rwxr-xr-xmktreasurer1
-rw-r--r--tmpl/donations.html2
-rw-r--r--tmpl/donations.rss28
5 files changed, 33 insertions, 2 deletions
diff --git a/Makefile b/Makefile
index cee0300..eb4678c 100644
--- a/Makefile
+++ b/Makefile
@@ -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>