aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xbin/send-reports22
-rw-r--r--perllib/Page.pm4
-rw-r--r--templates/emails/submit-council2
-rw-r--r--web/css.css5
-rwxr-xr-xweb/index.cgi37
5 files changed, 39 insertions, 31 deletions
diff --git a/bin/send-reports b/bin/send-reports
index 8db6595a4..45927b06b 100755
--- a/bin/send-reports
+++ b/bin/send-reports
@@ -6,7 +6,7 @@
# Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved.
# Email: matthew@mysociety.org. WWW: http://www.mysociety.org
#
-# $Id: send-reports,v 1.3 2007-02-02 11:40:02 matthew Exp $
+# $Id: send-reports,v 1.4 2007-02-02 16:17:17 matthew Exp $
use strict;
require 5.8.0;
@@ -40,28 +40,34 @@ my $unsent = dbh()->selectall_arrayref(
foreach my $row (@$unsent) {
# XXX Needs locks!
print 'Need to send problem #' . $row->{id} . ' to council ' . $row->{council} . "\n";
- my $council_email = dbh()->selectrow_array('SELECT email FROM contacts WHERE area_id=?', {}, $row->{council});
- throw Error::Simple('Missing email!') unless $council_email;
- my $area_info = mySociety::MaPit::get_voting_area_info($row->{council});
+ my @councils = split ',', $row->{council};
+ my $areas_info = mySociety::MaPit::get_voting_areas_info(\@councils);
+ my (@to, @recips);
+ foreach my $council (@councils) {
+ my $council_email = dbh()->selectrow_array('SELECT email FROM contacts WHERE area_id=?', {}, $council);
+ throw Error::Simple('Missing email!') unless $council_email;
+ push @to, [ $council_email, $areas_info->{$council}->{name} ];
+ push @recips, $council_email;
+ }
my $template = File::Slurp::read_file("$FindBin::Bin/../templates/emails/submit-council");
my %h = map { $_ => $row->{$_} } qw/title detail/;
$h{user_details} = $row->{name} . ' <' . $row->{email} . '>';
$h{user_details} .= ' (' . $row->{phone} . ')' if $row->{phone};
$h{url} = mySociety::Config::get('BASE_URL') . '/?id=' . $row->{id};
- $h{council_name} = $area_info->{name};
+ $h{councils_name} = join(' and ', map { $areas_info->{$_}->{name} } @councils);
my $email = mySociety::Email::construct_email({
_template_ => $template,
_parameters_ => \%h,
- From => [mySociety::Config::get('CONTACT_EMAIL'), 'Neighbourhood Fix-It'],
- To => [[$council_email, $area_info->{name}]],
+ From => [ mySociety::Config::get('CONTACT_EMAIL'), mySociety::Config::get('CONTACT_NAME') ],
+ To => \@to,
});
my $result;
if (mySociety::Config::get('STAGING_SITE')) {
$result = -1;
} else {
- $result = mySociety::Util::send_email($email, mySociety::Config::get('CONTACT_EMAIL'), $council_email);
+ $result = mySociety::Util::send_email($email, mySociety::Config::get('CONTACT_EMAIL'), @recips);
}
if ($result == mySociety::Util::EMAIL_SUCCESS) {
dbh()->do('UPDATE problem SET whensent=ms_current_timestamp() WHERE id=?', {}, $row->{id});
diff --git a/perllib/Page.pm b/perllib/Page.pm
index 2192df2ef..36695cee8 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.34 2007-01-30 17:56:32 matthew Exp $
+# $Id: Page.pm,v 1.35 2007-02-02 16:17:18 matthew Exp $
#
package Page;
@@ -87,7 +87,7 @@ EOF
EOF
my $home = !$title && $ENV{SCRIPT_NAME} eq '/index.cgi' && !$ENV{QUERY_STRING};
$html .= $home ? '<h1 id="header">' : '<div id="header"><a href="/">';
- $html .= 'Neighbourhood Fix-It';
+ $html .= 'Neighbourhood Fix-It <span id="beta">Beta</span>';
$html .= $home ? '</h1>' : '</a></div>';
$html .= '<div id="wrapper"><div id="content">';
if (mySociety::Config::get('STAGING_SITE')) {
diff --git a/templates/emails/submit-council b/templates/emails/submit-council
index 527a7118c..c33349deb 100644
--- a/templates/emails/submit-council
+++ b/templates/emails/submit-council
@@ -1,6 +1,6 @@
Subject: Problem Report: <?=$values['title']?>
-Dear <?=$values['council_name']?>,
+Dear <?=$values['councils_name']?>,
A user of Neighbourhood Fix-It, <?=$values['user_details']?>,
has submitted the following report:
diff --git a/web/css.css b/web/css.css
index 0c1526152..c86119837 100644
--- a/web/css.css
+++ b/web/css.css
@@ -87,6 +87,11 @@ ul#error {
color: #5e552b;
}
+#beta {
+ font-size: 50%;
+ font-style: italic;
+}
+
#header a:link, #header a:visited {
color: #5e552b;
background-color: #e3d595;
diff --git a/web/index.cgi b/web/index.cgi
index c22cdb760..daaa1f312 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.63 2007-02-02 13:43:32 matthew Exp $
+# $Id: index.cgi,v 1.64 2007-02-02 16:17:18 matthew Exp $
# TODO
# Nothing is done about the update checkboxes - not stored anywhere on anything!
@@ -162,7 +162,7 @@ sub submit_problem {
($ct eq 'image/jpeg' || $ct eq 'image/pjpeg');
}
- push(@errors, 'No council selected') unless $input{council} && $input{council} =~ /^(?:-1|\d+)$/;
+ push(@errors, 'No council selected') unless $input{council} && $input{council} =~ /^(?:-1|[\d,]+)$/;
push(@errors, 'Please enter a title') unless $input{title};
push(@errors, 'Please enter some details') unless $input{detail};
push(@errors, 'Please enter your name') unless $input{name};
@@ -176,8 +176,17 @@ sub submit_problem {
if ($input{council} != -1) {
my $councils = mySociety::MaPit::get_voting_area_by_location_en($input{easting}, $input{northing}, 'polygon', $mySociety::VotingArea::council_parent_types);
my %councils = map { $_ => 1 } @$councils;
- push(@errors, 'That location is not part of that council') unless $councils{$input{council}};
- push(@errors, 'We do not yet have details for the council that covers that location') unless is_valid_council($input{council});
+ my @input_councils = split /,/, $input{council};
+ foreach (@input_councils) {
+ if (!$councils{$_}) {
+ push(@errors, 'That location is not part of that council');
+ last;
+ }
+ }
+ my @valid_councils = is_valid_council(\@input_councils);
+ push(@errors, 'We do not yet have details for the council that covers that location') unless @valid_councils;
+ $input{council} = join(',', @valid_councils);
+
}
} elsif ($input{easting} || $input{northing}) {
push(@errors, 'Somehow, you only have one co-ordinate. Please try again.');
@@ -287,23 +296,11 @@ EOF
$out .= '<p>You have located the problem at the point marked with a purple pin on the map.
If this is not the correct location, simply click on the map again.</p>';
}
- if (@councils > 1) {
- $out .= '<p>This spot lies in more than one council area; if you want, please choose which
- council you wish to send the report to below:</p>';
- $out .= '<ul style="list-style-type:none">';
- my $c = 0;
- # XXX: We don't know the order of display here!
- foreach my $council (@councils) {
- $out .= '<li><input type="radio" name="council" value="' . $council . '"';
- $out .= ' checked' if ($input{council}==$council || (!$input{council} && !$c++));
- $out .= ' id="council' . $council . '"> <label class="n" for="council'
- . $council . '">' . $areas_info->{$council}->{name} . '</label></li>';
- }
- $out .= '</ul>';
- } elsif (@councils == 1) {
+ if (@councils > 0) {
$out .= '<p>This problem will be reported to <strong>'
- . $areas_info->{$councils[0]}->{name} . '</strong>.</p>';
- $out .= '<input type="hidden" name="council" value="' . $councils[0] . '">';
+ . join('</strong> and <strong>', map { $areas_info->{$_}->{name} } @councils)
+ . '</strong>.</p>';
+ $out .= '<input type="hidden" name="council" value="' . join(',',@councils) . '">';
} else {
my $e = mySociety::Config::get('CONTACT_EMAIL');
my $list = join(', ', map { $areas_info->{$_}->{name} } @$all_councils);