diff options
Diffstat (limited to 'web')
-rwxr-xr-x | web/alert.cgi | 4 | ||||
-rwxr-xr-x | web/index.cgi | 12 | ||||
-rwxr-xr-x | web/reports.cgi | 15 | ||||
-rwxr-xr-x | web/rss.cgi | 22 |
4 files changed, 32 insertions, 21 deletions
diff --git a/web/alert.cgi b/web/alert.cgi index 67f8a970f..40b465c94 100755 --- a/web/alert.cgi +++ b/web/alert.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: alert.cgi,v 1.27 2008-05-20 14:39:01 matthew Exp $ +# $Id: alert.cgi,v 1.28 2008-05-23 09:53:10 matthew Exp $ use strict; use Standard; @@ -364,6 +364,6 @@ sub alert_do_subscribe { $h{url} = mySociety::Config::get('BASE_URL') . '/A/' . mySociety::AuthToken::store('alert', { id => $alert_id, type => 'subscribe', email => $email } ); dbh()->commit(); - return Page::send_email($email, undef, 'alert', %h); + return Page::send_email($q, $email, undef, 'alert', %h); } diff --git a/web/index.cgi b/web/index.cgi index d51cbe691..14f2ad94a 100755 --- a/web/index.cgi +++ b/web/index.cgi @@ -6,7 +6,7 @@ # Copyright (c) 2006 UK Citizens Online Democracy. All rights reserved. # Email: matthew@mysociety.org. WWW: http://www.mysociety.org # -# $Id: index.cgi,v 1.198 2008-05-20 14:39:01 matthew Exp $ +# $Id: index.cgi,v 1.199 2008-05-23 09:53:10 matthew Exp $ use strict; use Standard; @@ -206,10 +206,11 @@ sub submit_update { $h{name} = $input{name} ? $input{name} : _("Anonymous"); my $base = mySociety::Config::get('BASE_URL'); $base =~ s/matthew/emptyhomes.matthew/ if $q->{site} eq 'emptyhomes'; # XXX Temp + $base =~ s/matthew/scambs.matthew/ if $q->{site} eq 'scambs'; # XXX Temp $h{url} = $base . '/C/' . mySociety::AuthToken::store('update', $id); dbh()->commit(); - my $out = Page::send_email($input{email}, $input{name}, 'update', %h); + my $out = Page::send_email($q, $input{email}, $input{name}, 'update', %h); return $out; } @@ -358,10 +359,11 @@ sub submit_problem { $h{name} = $input{name}; my $base = mySociety::Config::get('BASE_URL'); $base =~ s/matthew/emptyhomes.matthew/ if $q->{site} eq 'emptyhomes'; # XXX Temp + $base =~ s/matthew/scambs.matthew/ if $q->{site} eq 'scambs'; # XXX Temp $h{url} = $base . '/P/' . mySociety::AuthToken::store('problem', $id); dbh()->commit(); - $out = Page::send_email($input{email}, $input{name}, _('problem'), %h); + $out = Page::send_email($q, $input{email}, $input{name}, _('problem'), %h); } return $out; @@ -449,9 +451,7 @@ sub display_form { push @categories, $_->{category}; } if ($q->{site} eq 'scambs') { - @categories = ('Abandoned vehicles', 'Discarded hypodermic needles', - 'Dog fouling', 'Flytipping', 'Graffiti', 'Lighting (e.g. security lights)', - 'Litter', 'Neighbourhood noise'); + @categories = Page::scambs_categories(); } if (@categories) { @categories = ('-- Pick a category --', @categories, _('Other')); diff --git a/web/reports.cgi b/web/reports.cgi index f9ad1b2a2..fb23396a2 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.17 2008-05-20 14:39:01 matthew Exp $ +# $Id: reports.cgi,v 1.18 2008-05-23 09:53:10 matthew Exp $ use strict; use Standard; @@ -94,7 +94,12 @@ sub main { $title_params{NAME} = $ward ? $q_ward : $q_council; $type = 'area_problems'; # Problems within an area } - mySociety::Alert::generate_rss($type, "/$url", \@params, \%title_params); + print $q->header( -type => 'application/xml; charset=utf-8' ); + my $out = mySociety::Alert::generate_rss($type, "/$url", \@params, \%title_params); + $out =~ s/FixMyStreet/EnviroCrime/g if $q->{site} eq 'scambs'; + $out =~ s/matthew.fixmystreet/scambs.matthew.fixmystreet/g if $q->{site} eq 'scambs'; # XXX Temp + $out =~ s/matthew.fixmystreet/emptyhomes.matthew.fixmystreet/g if $q->{site} eq 'emptyhomes'; + print $out; return; } @@ -194,15 +199,15 @@ sub main { $name = ent($q_ward) . ", $name"; } print Page::header($q, title=>"$name - Summary reports", rss => [ "Problems within $name, FixMyStreet", $rss_url ]); - my $rss_title = _('RSS feed'); - my $rss_alt = _('RSS feed of problems in this %s'); + my $rss_title = _('RSS feed'); + my $rss_alt = _('RSS feed of problems in this %s'); print $q->p( $q->a({ href => $rss_url }, '<img align="right" src="/i/feed.png" width="16" height="16" title="' . $rss_title . '" alt="' . sprintf($rss_alt, $thing) . '" border="0" hspace="4">'), 'This is a summary of all reports for one ' . $thing . '. You can ' . ($all ? $q->a({href => NewURL($q, council=>undef, ward=>undef, all=>undef) }, 'see less detail') : $q->a({href => NewURL($q, council=>undef, ward=>undef, all=>1) }, 'see more details')) . - ($q->{site} eq 'scambs' ? '' : + ($q->{site} eq 'scambs' ? '' : ' or go back and ' . $q->a({href => '/reports' }, 'show all councils') ) . '.'); diff --git a/web/rss.cgi b/web/rss.cgi index 8cff290a6..1d357efbb 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.20 2008-03-06 11:52:33 matthew Exp $ +# $Id: rss.cgi,v 1.21 2008-05-23 09:53:10 matthew Exp $ use strict; use Standard; @@ -19,29 +19,35 @@ use mySociety::Gaze; sub main { my $q = shift; my $type = $q->param('type') || ''; + my $out; if ($type eq 'local_problems') { - rss_local_problems($q); + $out = rss_local_problems($q); } elsif ($type eq 'new_updates') { my $id = $q->param('id'); my $qs = '?id='.$id; - mySociety::Alert::generate_rss($type, $qs, [$id]); + $out = mySociety::Alert::generate_rss($type, $qs, [$id]); } elsif ($type eq 'new_problems') { - mySociety::Alert::generate_rss($type, ''); + $out = 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]); + $out = 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], { NAME => $va_info->{name} }); + $out = mySociety::Alert::generate_rss($type, $qs, [$id], { NAME => $va_info->{name} }); } elsif ($type eq 'all_problems') { - mySociety::Alert::generate_rss($type, ''); + $out = mySociety::Alert::generate_rss($type, ''); } else { print $q->redirect('http://www.fixmystreet.com/alert'); exit; } + print $q->header( -type => 'application/xml; charset=utf-8' ); + $out =~ s/FixMyStreet/EnviroCrime/g if $q->{site} eq 'scambs'; + $out =~ s/matthew.fixmystreet/scambs.matthew.fixmystreet/g if $q->{site} eq 'scambs'; # XXX Temp + $out =~ s/matthew.fixmystreet/emptyhomes.matthew.fixmystreet/g if $q->{site} eq 'emptyhomes'; + print $out; } Page::do_fastcgi(\&main); @@ -72,6 +78,6 @@ sub rss_local_problems { $d = mySociety::Gaze::get_radius_containing_population($lat, $lon, 200000); $d = int($d*10+0.5)/10; } - mySociety::Alert::generate_rss('local_problems', $qs, [$e, $n, $d]); + return mySociety::Alert::generate_rss('local_problems', $qs, [$e, $n, $d]); } |