aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--conf/general-example4
-rw-r--r--web/css.css11
-rwxr-xr-xweb/index.cgi56
3 files changed, 53 insertions, 18 deletions
diff --git a/conf/general-example b/conf/general-example
index 0fc5d5259..661ac7a3c 100644
--- a/conf/general-example
+++ b/conf/general-example
@@ -14,7 +14,7 @@
* Copyright (c) 2006 UK Citizens Online Democracy. All rights reserved.
* Email: francis@mysociety.org; WWW: http://www.mysociety.org
*
- * $Id: general-example,v 1.2 2006-09-19 23:32:55 matthew Exp $
+ * $Id: general-example,v 1.3 2006-09-20 10:49:30 matthew Exp $
*
*/
@@ -25,6 +25,8 @@ define('OPTION_BCI_DB_NAME', 'bci');
define('OPTION_BCI_DB_USER', 'bci');
define('OPTION_BCI_DB_PASS', '');
+define('OPTION_TILES_URL', '');
+
define('OPTION_MAPIT_URL', 'http://services.mysociety.org/mapit');
?>
diff --git a/web/css.css b/web/css.css
index 9afb752d0..7418f766d 100644
--- a/web/css.css
+++ b/web/css.css
@@ -1,11 +1,16 @@
body {
- font-family: "Gill Sans", "Gill Sans MT", sans-serif;
+ font-family: "Gill Sans", "Gill Sans MT", Helvetica, Arial, sans-serif;
}
h1 {
- text-align: right;
border-bottom: solid 1px #999999;
margin: 0;
}
+
+#error {
+ color: #cc0000;
+ font-size: larger;
+}
+
#map {
border: solid 1px #000000;
width: 500px;
@@ -22,7 +27,7 @@ h1 {
top: 0;
left: 0;
}
-#drag img {
+#drag input {
position: absolute;
}
#log {
diff --git a/web/index.cgi b/web/index.cgi
index f576f78e3..efb937ac7 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.6 2006-09-19 23:32:55 matthew Exp $
+# $Id: index.cgi,v 1.7 2006-09-20 10:49:30 matthew Exp $
use strict;
require 5.8.0;
@@ -46,14 +46,30 @@ Page::do_fastcgi(\&main);
# Display front page
sub front_page {
- return <<EOF;
-<p>Welcome to Neighbourhood Fix-It.</p>
+ my $error = shift;
+ my $out = '';
+ $out .= '<p id="error">' . $error . '</p>' if ($error);
+ $out .= <<EOF;
+<p>Welcome to Neighbourhood Fix-It, where you can report a problem with
+a lamppost or something to your local council.</p>
+
+<p><strong>This is currently only for Newham and Lewisham Councils</strong></p>
+
+<p>It&rsquo;s very simple:</p>
+
+<ol>
+<li>Enter postcode
+<li>Find problem on map
+<li>Enter details of problem
+<li>Send!
+</ol>
<form action="./" method="get">
<p>Enter your postcode: <input type="text" name="pc" value="">
<input type="submit" value="Go">
</form>
EOF
+ return $out;
}
# This should use postcode, not x/y!
@@ -63,25 +79,37 @@ sub display {
my $areas = mySociety::MaPit::get_voting_areas($pc);
# XXX Check for error
- return 'Uncovered area' if (!$areas || !$areas->{LBO});
+ # Check for London Borough
+ return front_page('I\'m afraid that postcode isn\'t in our covered area') if (!$areas || !$areas->{LBO});
+
+ # Check for Lewisham or Newham
my $lbo = $areas->{LBO};
- return 'Not covered London borough' unless ($lbo == 2510 || $lbo == 2492);
+ return front_page('I\'m afraid that postcode isn\'t in our covered London boroughs') unless ($lbo == 2510 || $lbo == 2492);
+
my $area_info = mySociety::MaPit::get_voting_area_info($lbo);
my $name = $area_info->{name};
- my $x = $q->param('x') || 62;
- my $y = $q->param('y') || 171;
- my $dir = 'tl/';
- my $tl = $dir.$x.'.'.$y.'.png';
- my $tr = $dir.($x+1).'.'.$y.'.png';
- my $bl = $dir.$x.'.'.($y+1).'.png';
- my $br = $dir.($x+1).'.'.($y+1).'.png';
- my $out = Page::compass($x, $y);
+ my $out = '<h2>' . $name . '</h2>';
+
+ my $x = $q->param('x') || 620;
+ my $y = $q->param('y') || 1710;
+ my $dir = mySociety::Config::get('TILES_URL');
+ my $tl = $x.'.'.$y.'.png';
+ my $tr = ($x+1).'.'.$y.'.png';
+ my $bl = $x.'.'.($y+1).'.png';
+ my $br = ($x+1).'.'.($y+1).'.png';
+ my $tl_src = $dir.$tl;
+ my $tr_src = $dir.$tr;
+ my $bl_src = $dir.$bl;
+ my $br_src = $dir.$br;
+ $out .= Page::compass($x, $y);
$out .= <<EOF;
<div id="map">
<div id="drag">
- <img id="2.2" nm="$tl" src="$tl" style="top:0px; left:0px;"><img id="3.2" nm="$tr" src="$tr" style="top:0px; left:250px;"><br><img id="2.3" nm="$bl" src="$bl" style="top:250px; left:0px;"><img id="3.3" nm="$br" src="$br" style="top:250px; left:250px;">
+ <form action"=./" method="get">
+ <input type="image" id="2.2" name="$tl" src="$tl_src" style="top:0px; left:0px;"><input type="image" id="3.2" name="$tr" src="$tr_src" style="top:0px; left:250px;"><br><input type="image" id="2.3" name="$bl" src="$bl_src" style="top:250px; left:0px;"><input type="image" id="3.3" name="$br" src="$br_src" style="top:250px; left:250px;">
+ </form>
</div>
</div>
EOF