diff options
-rw-r--r-- | perllib/Page.pm | 11 | ||||
-rw-r--r-- | perllib/Problems.pm | 8 | ||||
-rw-r--r-- | templates/emails/submit-council | 11 | ||||
-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 |
7 files changed, 50 insertions, 33 deletions
diff --git a/perllib/Page.pm b/perllib/Page.pm index 326ea992e..edfe3ba7c 100644 --- a/perllib/Page.pm +++ b/perllib/Page.pm @@ -6,7 +6,7 @@ # Copyright (c) 2006 UK Citizens Online Democracy. All rights reserved. # Email: matthew@mysociety.org; WWW: http://www.mysociety.org/ # -# $Id: Page.pm,v 1.103 2008-05-21 16:13:12 matthew Exp $ +# $Id: Page.pm,v 1.104 2008-05-23 09:53:10 matthew Exp $ # package Page; @@ -411,9 +411,10 @@ sub os_to_px_with_adjust { # send_email TO (NAME) TEMPLATE-NAME PARAMETERS sub send_email { - my ($email, $name, $thing, %h) = @_; + my ($q, $email, $name, $thing, %h) = @_; my $template = "$thing-confirm"; $template = File::Slurp::read_file("$FindBin::Bin/../templates/emails/$template"); + $template =~ s/FixMyStreet/Envirocrime/ if $q->{site} eq 'scambs'; my $to = $name ? [[$email, $name]] : $email; my $sender = mySociety::Config::get('CONTACT_EMAIL'); $sender =~ s/team/fms-DO-NOT-REPLY/; @@ -715,4 +716,10 @@ sub workaround_pg_bytea { $s->execute(); } +sub scambs_categories { + return ('Abandoned vehicles', 'Discarded hypodermic needles', + 'Dog fouling', 'Flytipping', 'Graffiti', 'Lighting (e.g. security lights)', + 'Litter', 'Neighbourhood noise'); +} + 1; diff --git a/perllib/Problems.pm b/perllib/Problems.pm index c767c7abf..548496f63 100644 --- a/perllib/Problems.pm +++ b/perllib/Problems.pm @@ -6,7 +6,7 @@ # Copyright (c) 2008 UK Citizens Online Democracy. All rights reserved. # Email: matthew@mysociety.org; WWW: http://www.mysociety.org/ # -# $Id: Problems.pm,v 1.2 2008-05-21 15:48:06 matthew Exp $ +# $Id: Problems.pm,v 1.3 2008-05-23 09:53:10 matthew Exp $ # package Problems; @@ -18,10 +18,10 @@ use mySociety::Web qw/ent/; my $site_restriction = ''; sub set_site_restriction { my $site = shift; + my @cats = Page::scambs_categories(); + my $cats = join("','", @cats); $site_restriction = " and council=2260 and category in - ('Abandoned vehicles', 'Discarded hypodermic needles', 'Dog fouling', - 'Flytipping', 'Graffiti', 'Lighting (e.g. security lights)', 'Litter', - 'Neighbourhood noise') " + ('$cats') " if $site eq 'scambs'; } diff --git a/templates/emails/submit-council b/templates/emails/submit-council index 46ebe8798..9f377fb16 100644 --- a/templates/emails/submit-council +++ b/templates/emails/submit-council @@ -27,10 +27,9 @@ Replies to this email will go to the user who submitted the problem. Yours, The FixMyStreet team -[ This message was sent via FixMyStreet (the new name for Neighbourhood -Fix-It), a project of UKCOD, registered charity number 1076346. If there -is a more appropriate email address for messages about -<?=$values['category_footer']?>, please let us know by sending an email -to <team@fixmystreet.com>. This will help improve the service for local -people. We also welcome any other feedback you may have. ] +[ This message was sent via FixMyStreet, a project of UKCOD, registered charity +number 1076346. If there is a more appropriate email address for messages about +<?=$values['category_footer']?>, please let us know by sending an email to +<team@fixmystreet.com>. This will help improve the service for local people. We +also welcome any other feedback you may have. ] 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]); } |