diff options
-rw-r--r-- | db/alert_types.sql | 10 | ||||
-rwxr-xr-x | web/reports.cgi | 14 | ||||
-rwxr-xr-x | web/rss.cgi | 12 |
3 files changed, 23 insertions, 13 deletions
diff --git a/db/alert_types.sql b/db/alert_types.sql index 6b9dafa09..80745e5e2 100644 --- a/db/alert_types.sql +++ b/db/alert_types.sql @@ -38,7 +38,7 @@ insert into alert_type item_table, item_where, item_order, item_title, item_link, item_description, template) values ('council_problems', '', '', - 'New local problems on FixMyStreet', '/reports', 'The latest local problems reported by users', + 'New problems to {{COUNCIL}} on FixMyStreet', '/reports', 'The latest problems for {{COUNCIL}} reported by users', 'problem', 'problem.state in (\'confirmed\', \'fixed\') and (council like \'%\'||?||\'%\' or (council is null and areas like \'%,\'||?||\',%\'))', 'created desc', '{{title}}', '/?id={{id}}', '{{detail}}', 'alert-problem' @@ -51,7 +51,8 @@ insert into alert_type item_table, item_where, item_order, item_title, item_link, item_description, template) values ('ward_problems', '', '', - 'New local problems on FixMyStreet', '/reports', 'The latest local problems reported by users', + 'New problems for {{COUNCIL}} within {{WARD}} ward on FixMyStreet', '/reports', + 'The latest problems for {{COUNCIL}} within {{WARD}} ward reported by users', 'problem', 'problem.state in (\'confirmed\', \'fixed\') and (council like \'%\'||?||\'%\' or council is null) and areas like \'%,\'||?||\',%\'', 'created desc', '{{title}}', '/?id={{id}}', '{{detail}}', 'alert-problem' @@ -64,8 +65,9 @@ insert into alert_type item_table, item_where, item_order, item_title, item_link, item_description, template) values ('area_problems', '', '', - 'New local problems on FixMyStreet', '/reports', 'The latest local problems reported by users', - 'problem', 'problem.state in (\'confirmed\', \'fixed\') and areas like \'%,\'||?||\',%\'', 'created desc', + 'New problems within {{NAME}}\'s boundary on FixMyStreet', '/reports', + 'The latest problems within {{NAME}}\'s boundary reported by users', 'problem', + 'problem.state in (\'confirmed\', \'fixed\') and areas like \'%,\'||?||\',%\'', 'created desc', '{{title}}', '/?id={{id}}', '{{detail}}', 'alert-problem' ); diff --git a/web/reports.cgi b/web/reports.cgi index 9bc8ccf05..63ccd64bd 100755 --- a/web/reports.cgi +++ b/web/reports.cgi @@ -7,7 +7,7 @@ # Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved. # Email: matthew@mysociety.org. WWW: http://www.mysociety.org # -# $Id: reports.cgi,v 1.8 2007-08-24 23:48:47 matthew Exp $ +# $Id: reports.cgi,v 1.9 2007-08-25 00:17:30 matthew Exp $ use strict; require 5.8.0; @@ -44,13 +44,14 @@ sub main { # Look up council name, if given my $q_council = $q->param('council') || ''; - my ($one_council, $area_type); + my ($one_council, $area_type, $area_name); if ($q_council =~ /\D/) { (my $qc = $q_council) =~ s/ and / & /; $qc = mySociety::MaPit::get_voting_area_by_name("$qc ", $mySociety::VotingArea::council_parent_types); if (keys %$qc == 1) { ($one_council) = keys %$qc; $area_type = $qc->{$one_council}->{type}; + $area_name = $qc->{$one_council}->{name}; } if (!$one_council) { # Given a false council name print $q->redirect('/reports'); @@ -58,6 +59,8 @@ sub main { } } elsif ($q_council =~ /^\d+$/) { $one_council = $q_council; + my $va_info = mySociety::MaPit::get_voting_area_info($q_council); + $area_name = $va_info->{name}; } $all = 0 unless $one_council; @@ -86,17 +89,20 @@ sub main { return; } my $type = 'council_problems'; # Problems sent to a council - my @params; + my (@params, %title_params); + $title_params{COUNCIL} = $area_name; push @params, $one_council if $rss eq 'reports'; push @params, $ward ? $ward : $one_council; if ($ward && $rss eq 'reports') { $type = 'ward_problems'; # Problems sent to a council, restricted to a ward + $title_params{WARD} = $q_ward; } elsif ($rss eq 'area') { + $title_params{NAME} = $ward ? $q_ward : $q_council; $type = 'area_problems'; # Problems within an area } my $url = short_name($q_council); $url .= '/' . short_name($q_ward) if $ward; - mySociety::Alert::generate_rss($type, "/$url", @params); + mySociety::Alert::generate_rss($type, "/$url", \@params, \%title_params); return; } diff --git a/web/rss.cgi b/web/rss.cgi index aba53b1c0..c3b33f8a3 100755 --- a/web/rss.cgi +++ b/web/rss.cgi @@ -6,7 +6,7 @@ # Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved. # Email: matthew@mysociety.org. WWW: http://www.mysociety.org # -# $Id: rss.cgi,v 1.16 2007-08-24 22:35:51 matthew Exp $ +# $Id: rss.cgi,v 1.17 2007-08-25 00:17:30 matthew Exp $ use strict; require 5.8.0; @@ -21,6 +21,7 @@ use Page; use mySociety::Config; use mySociety::DBHandle qw(dbh); use mySociety::Alert; +use mySociety::MaPit; use mySociety::Web; use mySociety::GeoUtil; use mySociety::Gaze; @@ -67,21 +68,22 @@ sub main { $d = int($d*10+0.5)/10; } - mySociety::Alert::generate_rss($type, $qs, $e, $n, $d); + mySociety::Alert::generate_rss($type, $qs, [$e, $n, $d]); } elsif ($type eq 'new_updates') { my $id = $q->param('id'); my $qs = '?id='.$id; - mySociety::Alert::generate_rss($type, $qs, $id); + mySociety::Alert::generate_rss($type, $qs, [$id]); } elsif ($type eq 'new_problems') { mySociety::Alert::generate_rss($type, ''); } elsif ($type eq 'council_problems') { my $id = $q->param('id'); my $qs = '/'.$id; - mySociety::Alert::generate_rss($type, $qs, $id); + mySociety::Alert::generate_rss($type, $qs, [$id]); } elsif ($type eq 'area_problems') { my $id = $q->param('id'); + my $va_info = mySociety::MaPit::get_voting_area_info($id); my $qs = '/'.$id; - mySociety::Alert::generate_rss($type, $qs, $id); + mySociety::Alert::generate_rss($type, $qs, [$id], { NAME => $va_info->{name} }); } elsif ($type eq 'all_problems') { mySociety::Alert::generate_rss($type, ''); } else { |