diff options
-rwxr-xr-x | bin/councils-no-contact | 106 | ||||
-rw-r--r-- | perllib/Page.pm | 6 | ||||
-rw-r--r-- | templates/emails/submit-council | 14 | ||||
-rw-r--r-- | web/css.css | 2 | ||||
-rwxr-xr-x | web/faq.cgi | 8 | ||||
-rwxr-xr-x | web/index.cgi | 42 |
6 files changed, 161 insertions, 17 deletions
diff --git a/bin/councils-no-contact b/bin/councils-no-contact new file mode 100755 index 000000000..22b2f53e1 --- /dev/null +++ b/bin/councils-no-contact @@ -0,0 +1,106 @@ +#!/usr/bin/perl -w + +# councils-no-contact: +# Given list of councils without email, generate list of MaPit area IDs. +# +# Copyright (c) 2006 UK Citizens Online Democracy. All rights reserved. +# Email: matthew@mysociety.org. WWW: http://www.mysociety.org +# +# $Id: councils-no-contact,v 1.1 2006-09-27 13:51:22 matthew Exp $ + +use strict; +require 5.8.0; + +# Horrible boilerplate to set up appropriate library paths. +use FindBin; +use lib "$FindBin::Bin/../perllib"; +use lib "$FindBin::Bin/../../perllib"; + +use mySociety::Config; +use mySociety::MaPit; +use mySociety::VotingArea; + +BEGIN { + mySociety::Config::set_file("$FindBin::Bin/../conf/general"); + mySociety::MaPit::configure(); +} + +my @councils_no_email = ( +'Aberdeenshire', +'Antrim', +'Ashford', +'Blaenau Gwent', +'Bradford', +'Breckland', +'Castlereagh', +'Charnwood', +'Cherwell', +'Chesterfield', +'Corporation of London', +'Congleton', +'Derwentside', +'Dorset', +'Durham County', +'E. Ayrshire', +'E. Dorset', +'E. Hampshire', +'E. Lothian', +'E. Sussex', +'Enfield', +'Essex', +'Halton', +'Harborough', +'Inverclyde', +'Kingston upon Hull', +'Magherafelt', +'Melton', +'Middlesbrough', +'Mole Valley', +'Newham', +'N. Devon', +'North Norfolk', +'N. Tyneside', +'N. Yorkshire', +'Northumberland', +'Nottinghamshire', +'Oadby & Wigston', +'Oldham', +'Purbeck', +'Reading', +'Rhondda Cynon Taff', +'Scottish Borders', +'S. Bedfordshire', +'S. Ribble', +'South Somerset', +'Southend on Sea', +'Surrey', +'Tendring', +'Thurrock', +'Tonbridge & Malling', +'Wakefield', +'Wansbeck', +'W. Devon', +'W. Sussex', +'Westminster', +'Weymouth & Portland', +'Worcestershire' +); + +my $types = $mySociety::VotingArea::council_parent_types; +my @out; +foreach my $type (@$types) { + my $areas = mySociety::MaPit::get_areas_by_type($type); + my $areas_info = mySociety::MaPit::get_voting_areas_info($areas); + foreach my $id (keys %$areas_info) { + my $area_info = $areas_info->{$id}; + my $name = $area_info->{name}; + foreach my $council (@councils_no_email) { + if ($name =~ /^$council( ((Borough|City|District|County) )*Council)?$/) { + push(@out, $id); + } + } + } +} + +print join(',', @out); + diff --git a/perllib/Page.pm b/perllib/Page.pm index 896a35e29..f64f7436a 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.19 2006-09-26 18:31:54 matthew Exp $ +# $Id: Page.pm,v 1.20 2006-09-27 13:51:22 matthew Exp $ # package Page; @@ -94,7 +94,9 @@ sub footer { <li><a href="/">Home</a> </ul> -<p id="footer">Built by <a href="http://www.mysociety.org/">mySociety</a>. Using lots of <a href="http://www.ordnancesurvey.co.uk/">Ordnance Survey</a> data. And some <a href="https://secure.mysociety.org/cvstrac/dir?d=mysociety/bci">very clever code</a>.</p> +<p id="footer">Built by <a href="http://www.mysociety.org/">mySociety</a>. +Using lots of <a href="http://www.ordnancesurvey.co.uk/">Ordnance Survey</a> data, under licence. +And some <a href="https://secure.mysociety.org/cvstrac/dir?d=mysociety/bci">very clever code</a>.</p> </body> </html> diff --git a/templates/emails/submit-council b/templates/emails/submit-council new file mode 100644 index 000000000..4a0fd7fe4 --- /dev/null +++ b/templates/emails/submit-council @@ -0,0 +1,14 @@ +Subject: <?=$values['title']?> + +Dear Council, + +A user of Neighbourhood Fix-It, <?=$values['name']?>, has submitted the following report: + +<?=$values['detail']?> + +To view a map of the precise location of this issue, please visit the following link: + +<?=$values['url']?> + +Yours, +The Neighbourhood Fix-It team diff --git a/web/css.css b/web/css.css index 075345d57..a7fd61458 100644 --- a/web/css.css +++ b/web/css.css @@ -88,6 +88,8 @@ ul#error { #content { width: 100%; /* Must specify a width or IE goes crazy wrong! */ position: relative; + margin: 0 auto; + max-width: 60em; } /* Can't put the margin in #content because of above IE craziness */ diff --git a/web/faq.cgi b/web/faq.cgi index 361c11710..5e13a9cb2 100755 --- a/web/faq.cgi +++ b/web/faq.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: faq.cgi,v 1.3 2006-09-26 18:31:54 matthew Exp $ +# $Id: faq.cgi,v 1.4 2006-09-27 13:51:23 matthew Exp $ use strict; require 5.8.0; @@ -94,9 +94,9 @@ was <a href="http://www.writetothem.com/">WriteToThem.com</a>, where you can wri elected representatives, for free.</dd> <dt>Who pays for it?</dt> -<dd>Neighbourhood Fix-It has been built by mySociety thanks to the effort -of a combination of paid core developers and unpaid volunteers. The -core developers were paid for by ???. +<dd>Neighbourhood Fix-It for Newham and Lewisham was paid for via the +Department for Constitutional Affairs Innovations Fund. mySociety itself +has put in some spare resources to cover wider parts of the UK. </dd> <dt>Do you need any help with the project?</dt> diff --git a/web/index.cgi b/web/index.cgi index 471936fa9..a503c2552 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.29 2006-09-26 22:21:55 matthew Exp $ +# $Id: index.cgi,v 1.30 2006-09-27 13:51:23 matthew Exp $ # TODO # Nothing is done about the update checkboxes - not stored anywhere on anything! @@ -32,6 +32,7 @@ use mySociety::DBHandle qw(dbh select_all); use mySociety::Email; use mySociety::Util; use mySociety::MaPit; +use mySociety::VotingArea; use mySociety::Web qw(ent NewURL); BEGIN { @@ -99,7 +100,7 @@ EOF <input type="submit" value="Go"> </form> -<p>Reports are sent directly to the local council – at the moment, we only cover <em>Newham, Lewisham, and Islington</em> councils.</p> +<p>Reports are sent directly to the local council – at the moment, we only cover <em>Newham, Lewisham, and Islington</em> councils. The rest of the UK is coming soon!</p> <p>Reporting a problem is hopefully very simple:</p> @@ -239,7 +240,7 @@ sub display_form { <input type="hidden" name="pc" value="$input_h{pc}"> <h1>Reporting a problem</h1> <p>Please fill in the form below with details of the problem, and -describe the location in the details box.</p> +describe the location as precisely as possible in the details box.</p> EOF } else { my ($px, $py, $easting, $northing); @@ -258,10 +259,17 @@ EOF $easting = $input_h{easting}; $northing = $input_h{northing}; } + # XXX: How to do this for not London? + # And needs to use polygon, not box + my $council = mySociety::MaPit::get_voting_area_by_location_en($easting, $northing, 'box', 'LBO'); + my $areas_info = mySociety::MaPit::get_voting_areas_info($council); + $council = join(', ', map { $areas_info->{$_}->{name} } @$council); $out .= display_map($q, $input{x}, $input{y}, 1, 0); $out .= '<h1>Reporting a problem</h1>'; - $out .= '<p>You have located the problem at the location marked with a yellow pin on the map. If this is not the correct location, simply click on the map again.</p> -<p>Please fill in details of the problem below:</p>'; + $out .= '<p>You have located the problem at the location marked with a yellow pin on the map, which is in the bounding box of '.$council.'. If this is not the correct location, simply click on the map again.</p> +<p>Please fill in details of the problem below. Your council won\'t be able +to help unless you leave as much detail as you can, so please describe the +exact location of the problem (ie. on a wall or the floor), and so on.</p>'; $out .= display_pin($px, $py, 'yellow'); $out .= '<input type="hidden" name="easting" value="' . $easting . '"> <input type="hidden" name="northing" value="' . $northing . '">'; @@ -554,14 +562,26 @@ sub postcode_check { my $areas; $areas = mySociety::MaPit::get_voting_areas($pc); - # Check for London Borough - throw Error::Simple("I'm afraid that postcode isn't in our covered area.\n") if (!$areas || !$areas->{LBO}); + my @councils_allowed = (2510, 2492, 2507); + my @councils_no_email = (2288,2402,2390,2252,2351,2430,2375,2285,2377,2374,2330,2454,2284,2378,2294,2312,2419,2386,2363,2353,2296,2300,2291,2268,2512,2504,2495,# 2510 + 2530,2516,2531,2545,2586,2554,2574,2580,2615,2596,2599,2601,2648,2563,2652,2607,2582,14287,14317,14328,2223,2225,2242,2222,2248,2246,2235,2224,2244,2236); + my ($valid_councils, $invalid_councils); + grep (vec($valid_councils, $_, 1) = 1, @councils_allowed); + grep (vec($invalid_councils, $_, 1) = 1, @councils_no_email); + + # Cheltenham example: CTY=2226 DIS=2326 + # Check for covered council + my @councils; + my $types = $mySociety::VotingArea::council_parent_types; + foreach my $type (@$types) { + push(@councils, $type) if ($areas->{$type} && !vec($invalid_councils, $areas->{$type}, 1)); + } + throw Error::Simple("I'm afraid that postcode isn't yet covered by us.\n") unless $areas && @councils; - # Check for Lewisham or Newham - my $lbo = $areas->{LBO}; - throw Error::Simple("I'm afraid that postcode isn't in our covered London boroughs.\n") unless ($lbo == 2510 || $lbo == 2492 || $lbo == 2507); + my $council = $areas->{$councils[0]}; + throw Error::Simple("I'm afraid that postcode isn't in our covered London boroughs.\n") if (@councils_allowed && !vec($valid_councils, $council, 1)); - my $area_info = mySociety::MaPit::get_voting_area_info($lbo); + my $area_info = mySociety::MaPit::get_voting_area_info($council); my $name = $area_info->{name}; $x ||= 0; $x += 0; |