aboutsummaryrefslogtreecommitdiffstats
path: root/web
diff options
context:
space:
mode:
Diffstat (limited to 'web')
-rwxr-xr-xweb/index.cgi14
-rwxr-xr-xweb/photo.cgi24
2 files changed, 25 insertions, 13 deletions
diff --git a/web/index.cgi b/web/index.cgi
index 2c540d94b..bc72d8797 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.195 2008-05-14 15:02:28 matthew Exp $
+# $Id: index.cgi,v 1.196 2008-05-15 09:26:56 matthew Exp $
use strict;
use Standard;
@@ -120,7 +120,7 @@ EOF
$q->li(_('Enter a nearby UK postcode, or street name and area')),
$q->li(_('Locate the problem on a map of the area')),
$q->li(_('Enter details of the problem')),
- $q->li(_('We send it to the council on your behalf'))
+ ($q->{site} ne 'emptyhomes' && $q->li(_('We send it to the council on your behalf')))
);
$out .= $q->h2(_('FixMyStreet updates'));
@@ -201,7 +201,9 @@ sub submit_update {
my %h = ();
$h{update} = $input{update};
$h{name} = $input{name} ? $input{name} : _("Anonymous");
- $h{url} = mySociety::Config::get('BASE_URL') . '/C/' . mySociety::AuthToken::store('update', $id);
+ my $base = mySociety::Config::get('BASE_URL');
+ $base =~ s/matthew/emptyhomes.matthew/ if $q->{site} eq 'emptyhomes'; # XXX Temp
+ $h{url} = $base . '/C/' . mySociety::AuthToken::store('update', $id);
dbh()->commit();
my $out = Page::send_email($input{email}, $input{name}, 'update', %h);
@@ -225,6 +227,8 @@ sub submit_problem {
push @errors, $err if $err;
}
+ $input{council} = -1 if $q->{site} eq 'emptyhomes'; # Not sent to council
+
push(@errors, _('No council selected')) unless ($input{council} && $input{council} =~ /^(?:-1|[\d,]+(?:\|[\d,]+)?)$/);
push(@errors, _('Please enter a subject')) unless $input{title} =~ /\S/;
push(@errors, _('Please enter some details')) unless $input{detail} =~ /\S/;
@@ -348,7 +352,9 @@ sub submit_problem {
$h{title} = $input{title};
$h{detail} = $input{detail};
$h{name} = $input{name};
- $h{url} = mySociety::Config::get('BASE_URL') . '/P/' . mySociety::AuthToken::store('problem', $id);
+ my $base = mySociety::Config::get('BASE_URL');
+ $base =~ s/matthew/emptyhomes.matthew/ if $q->{site} eq 'emptyhomes'; # XXX Temp
+ $h{url} = $base . '/P/' . mySociety::AuthToken::store('problem', $id);
dbh()->commit();
$out = Page::send_email($input{email}, $input{name}, _('problem'), %h);
diff --git a/web/photo.cgi b/web/photo.cgi
index 33bff0bd7..9b8428a95 100755
--- a/web/photo.cgi
+++ b/web/photo.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: photo.cgi,v 1.8 2008-03-28 16:36:48 matthew Exp $
+# $Id: photo.cgi,v 1.9 2008-05-15 09:26:56 matthew Exp $
use strict;
use Standard;
@@ -32,17 +32,23 @@ sub main {
return unless $photo;
$photo = $photo->[0];
if ($q->param('tn')) {
- use Image::Magick;
- my $image = Image::Magick->new;
- $image->BlobToImage($photo);
- my $err = $image->Scale(geometry => "x100>");
- throw Error::Simple("resize failed: $err") if "$err";
- my @blobs = $image->ImageToBlob();
- undef $image;
- $photo = $blobs[0];
+ $photo = resize($photo, 'x100');
+ } elsif ($q->{site} eq 'emptyhomes') {
+ $photo = resize($photo, '200x');
}
print $photo;
}
Page::do_fastcgi(\&main);
+sub resize {
+ my ($photo, $size) = @_;
+ use Image::Magick;
+ my $image = Image::Magick->new;
+ $image->BlobToImage($photo);
+ my $err = $image->Scale(geometry => "$size>");
+ throw Error::Simple("resize failed: $err") if "$err";
+ my @blobs = $image->ImageToBlob();
+ undef $image;
+ return $blobs[0];
+}