aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormatthew <matthew>2007-08-24 00:24:14 +0000
committermatthew <matthew>2007-08-24 00:24:14 +0000
commitd0d0d5dfbb520bed61c0f99b508421a1cb108836 (patch)
treecc260553d458bdb88a98190a95dd741db3bd0786
parent0d540c056e0e22a9411b5ea090a6b58739ae7e4d (diff)
Store all voting areas of problems.
-rw-r--r--conf/httpd.conf11
-rw-r--r--db/schema.sql5
-rwxr-xr-xweb/index.cgi12
3 files changed, 17 insertions, 11 deletions
diff --git a/conf/httpd.conf b/conf/httpd.conf
index 7215fde92..7e98872f3 100644
--- a/conf/httpd.conf
+++ b/conf/httpd.conf
@@ -20,7 +20,7 @@
# Copyright (c) 2006 UK Citizens Online Democracy. All rights reserved.
# Email: francis@mysociety.org; WWW: http://www.mysociety.org
#
-# $Id: httpd.conf,v 1.23 2007-08-23 12:09:44 matthew Exp $
+# $Id: httpd.conf,v 1.24 2007-08-24 00:24:14 matthew Exp $
DirectoryIndex index.cgi
@@ -48,10 +48,11 @@ RewriteRule ^/rss/council/([0-9]+)$ /rss.cgi?type=council_problems;id=$1 [Q
#RewriteRule ^/rss/ward/([0-9]+)$ /rss.cgi?type=council_problems;id=$1 [QSA]
RewriteRule ^/rss/problems$ /rss.cgi?type=new_problems [QSA]
-RewriteRule ^/report/([0-9]+)$ /index.cgi?id=$1 [QSA]
-RewriteRule ^/report$ /reports [R=permanent]
-RewriteRule ^/reports/([^/]+)/all$ /reports.cgi?council=$1;all=1 [QSA]
-RewriteRule ^/reports/([^/]+)$ /reports.cgi?council=$1 [QSA]
+RewriteRule ^/report/([0-9]+)$ /index.cgi?id=$1 [QSA]
+RewriteRule ^/report$ /reports [R=permanent]
+RewriteRule ^/reports/([^/]+)/all$ /reports.cgi?council=$1;all=1 [QSA]
+RewriteRule ^/reports/([^/]+)/([^/]+)$ /reports.cgi?council=$1;ward=$2 [QSA]
+RewriteRule ^/reports/([^/]+)$ /reports.cgi?council=$1 [QSA]
ProxyPass /tilma/ http://tilma.mysociety.org/
ProxyPassReverse /tilma/ http://tilma.mysociety.org/
diff --git a/db/schema.sql b/db/schema.sql
index eea52a777..4078421e8 100644
--- a/db/schema.sql
+++ b/db/schema.sql
@@ -4,7 +4,7 @@
-- Copyright (c) 2006 UK Citizens Online Democracy. All rights reserved.
-- Email: matthew@mysociety.org; WWW: http://www.mysociety.org/
--
--- $Id: schema.sql,v 1.36 2007-07-11 16:28:13 matthew Exp $
+-- $Id: schema.sql,v 1.37 2007-08-24 00:24:14 matthew Exp $
--
-- secret
@@ -123,7 +123,8 @@ create table problem (
postcode text not null,
easting double precision not null,
northing double precision not null,
- council text, -- integer references contacts(area_id),
+ council text, -- the council(s) we'll report this problem to
+ areas text not null, -- the voting areas this location is in
category text not null default 'Other',
title text not null,
detail text not null,
diff --git a/web/index.cgi b/web/index.cgi
index 8f17e8f2c..07c75616d 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.158 2007-08-21 02:20:56 matthew Exp $
+# $Id: index.cgi,v 1.159 2007-08-24 00:24:15 matthew Exp $
use strict;
require 5.8.0;
@@ -240,7 +240,10 @@ sub submit_problem {
$input{category} = '';
}
+ my $areas;
if ($input{easting} && $input{northing}) {
+ $areas = mySociety::MaPit::get_voting_area_by_location_en($input{easting}, $input{northing}, 'polygon');
+ $areas = ',' . join(',', @$areas) . ',';
if ($input{council} =~ /^[\d,]+(\|[\d,]+)?$/) {
my $no_details = $1 || '';
my $councils = mySociety::MaPit::get_voting_area_by_location_en($input{easting}, $input{northing}, 'polygon', $mySociety::VotingArea::council_parent_types);
@@ -326,9 +329,9 @@ sub submit_problem {
# This is horrid
my $s = dbh()->prepare("insert into problem
(id, postcode, easting, northing, title, detail, name,
- email, phone, photo, state, council, used_map, anonymous, category)
+ email, phone, photo, state, council, used_map, anonymous, category, areas)
values
- (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, 'unconfirmed', ?, ?, ?, ?)");
+ (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, 'unconfirmed', ?, ?, ?, ?, ?)");
$s->bind_param(1, $id);
$s->bind_param(2, $input{pc});
$s->bind_param(3, $input{easting});
@@ -343,6 +346,7 @@ sub submit_problem {
$s->bind_param(12, $used_map);
$s->bind_param(13, $input{anonymous} ? 'f': 't');
$s->bind_param(14, $input{category});
+ $s->bind_param(15, $areas);
$s->execute();
my %h = ();
$h{title} = $input{title};
@@ -825,7 +829,7 @@ sub geocode_choice {
$choice =~ s/, United Kingdom//;
$choice =~ s/, UK//;
my $url = uri_escape($choice);
- $url =~ s/%20/+/g;
+ $url =~ s/%20/+/g;
$out .= '<li><a href="/?pc=' . $url . '">' . $choice . "</a></li>\n";
}
$out .= '</ul>';