aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xweb/import.cgi33
-rwxr-xr-xweb/index.cgi17
2 files changed, 28 insertions, 22 deletions
diff --git a/web/import.cgi b/web/import.cgi
index 2caddffc2..4096fde9a 100755
--- a/web/import.cgi
+++ b/web/import.cgi
@@ -6,19 +6,19 @@
# Copyright (c) 2008 UK Citizens Online Democracy. All rights reserved.
# Email: matthew@mysociety.org. WWW: http://www.mysociety.org
#
-# $Id: import.cgi,v 1.7 2008-11-08 19:38:57 matthew Exp $
+# $Id: import.cgi,v 1.8 2008-11-12 21:59:43 matthew Exp $
use strict;
use Error qw(:try);
use Standard;
use mySociety::AuthToken;
-use mySociety::Email;
use mySociety::EmailUtil;
+use mySociety::EvEl;
sub main {
my $q = shift;
- my @vars = qw(service subject detail name email phone easting northing lat lon id);
+ my @vars = qw(service subject detail name email phone easting northing lat lon id phone_id);
my %input = map { $_ => $q->param($_) || '' } @vars;
my @errors;
@@ -77,11 +77,12 @@ sub main {
}
# Store for possible future use
- if ($input{id}) {
- my $already = dbh()->selectrow_array('select id from partial_user where service=? and nsid=?', {}, $input{service}, $input{id});
+ if ($input{id} || $input{phone_id}) {
+ my $id = $input{id} || $input{phone_id};
+ my $already = dbh()->selectrow_array('select id from partial_user where service=? and nsid=?', {}, $input{service}, $id);
unless ($already) {
dbh()->do('insert into partial_user (service, nsid, name, email, phone) values (?, ?, ?, ?, ?)',
- {}, $input{service}, $input{id}, $input{name}, $input{email}, $input{phone});
+ {}, $input{service}, $id, $input{name}, $input{email}, $input{phone});
}
}
@@ -104,21 +105,17 @@ sub main {
service => $input{service},
);
- my $body = mySociety::Email::construct_email({
+ my $sender = mySociety::Config::get('CONTACT_EMAIL');
+ $sender =~ s/team/fms-DO-NOT-REPLY/;
+ mySociety::EvEl::send({
_template_ => $template,
_parameters_ => \%h,
To => $input{name} ? [ [ $input{email}, $input{name} ] ] : $input{email},
- From => [ mySociety::Config::get('CONTACT_EMAIL'), 'FixMyStreet' ],
- });
-
- my $result = mySociety::EmailUtil::send_email($body, mySociety::Config::get('CONTACT_EMAIL'), $input{email});
- if ($result == mySociety::EmailUtil::EMAIL_SUCCESS) {
- dbh()->commit();
- print 'SUCCESS';
- } else {
- dbh()->rollback();
- print 'ERROR:Could not send email';
- }
+ From => [ $sender, 'FixMyStreet' ],
+ }, $input{email});
+
+ dbh()->commit();
+ print 'SUCCESS';
}
Page::do_fastcgi(\&main);
diff --git a/web/index.cgi b/web/index.cgi
index 109b3389e..d7ed52149 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.225 2008-11-10 13:10:56 matthew Exp $
+# $Id: index.cgi,v 1.226 2008-11-12 21:59:43 matthew Exp $
use strict;
use Standard;
@@ -266,7 +266,7 @@ sub submit_problem {
push (@errors, _('Please choose a property type'));
$input{category} = '';
}
-
+
return display_form($q, @errors) if (@errors); # Short circuit
my $areas;
@@ -318,7 +318,7 @@ sub submit_problem {
} else {
push(@errors, _('You haven\'t specified any sort of co-ordinates. Please try again.'));
}
-
+
my $image;
if ($fh) {
try {
@@ -496,7 +496,7 @@ sub display_form {
@categories = ('-- Pick a property type --', 'Empty house or bungalow', 'Empty flat or maisonette', 'Whole block of empty flats', 'Empty office or other commercial', 'Empty pub or bar', 'Empty public building - school, hospital, etc.');
$category = _('Property type:');
}
- $category = $q->div($q->label({'for'=>'form_category'}, $category),
+ $category = $q->div($q->label({'for'=>'form_category'}, $category),
$q->popup_menu(-name=>'category', -values=>\@categories,
-attributes=>{id=>'form_category'})
) if $category;
@@ -524,6 +524,15 @@ EOF
my $pins = Page::display_pin($q, $px, $py, 'purple');
$out .= Page::display_map($q, x => $input{x}, y => $input{y}, type => 2,
pins => $pins, px => $px, py => $py );
+ my $partial_id;
+ if (my $token = $input{partial}) {
+ $partial_id = mySociety::AuthToken::retrieve('partial', $token);
+ if ($partial_id) {
+ $out .= $q->p({id=>'unknown'}, 'Please note your report has
+ <strong>not yet been sent</strong>. Choose a category
+ and add further information below, then submit.');
+ }
+ }
$out .= $q->h1(_('Reporting a problem')) . ' ';
$out .= $q->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. '));