aboutsummaryrefslogtreecommitdiffstats
path: root/web
diff options
context:
space:
mode:
Diffstat (limited to 'web')
-rwxr-xr-xweb/about.cgi38
-rwxr-xr-xweb/contact.cgi75
-rw-r--r--web/css.css73
-rwxr-xr-xweb/faq.cgi38
-rwxr-xr-xweb/index.cgi56
5 files changed, 250 insertions, 30 deletions
diff --git a/web/about.cgi b/web/about.cgi
new file mode 100755
index 000000000..3d7cc2e29
--- /dev/null
+++ b/web/about.cgi
@@ -0,0 +1,38 @@
+#!/usr/bin/perl -w
+
+# about.cgi:
+# About page for Neighbourhood Fix-It
+#
+# Copyright (c) 2006 UK Citizens Online Democracy. All rights reserved.
+# Email: matthew@mysociety.org. WWW: http://www.mysociety.org
+#
+# $Id: about.cgi,v 1.1 2006-09-25 18:12:56 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 Page;
+
+# Main code for index.cgi
+sub main {
+ my $q = shift;
+ print Page::header($q, 'About');
+ print about_page();
+ print Page::footer();
+}
+Page::do_fastcgi(\&main);
+
+sub about_page {
+ my $out = '<div id="relativediv">';
+ $out .= <<EOF;
+<h1>About this site</h1>
+<p>About stuff here</p>
+</div>
+EOF
+ return $out;
+}
+
diff --git a/web/contact.cgi b/web/contact.cgi
new file mode 100755
index 000000000..00fa9ba83
--- /dev/null
+++ b/web/contact.cgi
@@ -0,0 +1,75 @@
+#!/usr/bin/perl -w
+
+# contact.cgi:
+# Contact page for Neighbourhood Fix-It
+#
+# Copyright (c) 2006 UK Citizens Online Democracy. All rights reserved.
+# Email: matthew@mysociety.org. WWW: http://www.mysociety.org
+#
+# $Id: contact.cgi,v 1.1 2006-09-25 18:12:56 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 Page;
+
+# Main code for index.cgi
+sub main {
+ my $q = shift;
+ print Page::header($q, 'Contact');
+ my $out = '';
+ if ($q->param('submit_form')) {
+ $out = contact_submit($q);
+ } else {
+ $out = contact_page($q);
+ }
+ print $out;
+ print Page::footer();
+}
+Page::do_fastcgi(\&main);
+
+sub contact_submit {
+ my $q = shift;
+ my @vars = qw(name email message);
+ my %input = map { $_ => $q->param($_) } @vars;
+ my @errors;
+ push(@errors, 'Please give your name') unless $input{name};
+ push(@errors, 'Please give your name') unless $input{email};
+ push(@errors, 'Please write a message') unless $input{message};
+ return contact_page($q, @errors) if @errors;
+
+}
+
+sub contact_page {
+ my ($q, @errors) = @_;
+ my @vars = qw(name email message);
+ my %input = map { $_ => $q->param($_) } @vars;
+ my %input_h = map { $_ => $q->param($_) ? ent($q->param($_)) : '' } @vars;
+
+ my $out = '<div id="relativediv"> <h1>Contact</h1>';
+ if (@errors) {
+ $out .= '<ul id="error"><li>' . join('</li><li>', @errors) . '</li></ul>';
+ }
+ $out .= <<EOF;
+<p>We'd love to hear what you think about this site. Just fill in the form:</p>
+<form method="post">
+<fieldset>
+<input type="hidden" name="submit_form" value="1">
+<div><label for="form_name">Name:</label>
+<input type="text" name="name" id="form_name" value="$input_h{name}" size="30"></div>
+<div><label for="form_email">Email:</label>
+<input type="text" name="email" id="form_email" value="$input_h{email}" size="30"></div>
+<div><label for="form_message">Message:</label>
+<textarea name="message" id="form_message" rows="7" cols="30">$input_h{message}</textarea></div>
+<div class="checkbox"><input type="submit" value="Post"></div>
+</fieldset>
+</form>
+</div>
+EOF
+ return $out;
+}
+
diff --git a/web/css.css b/web/css.css
index 4a4865827..255633b23 100644
--- a/web/css.css
+++ b/web/css.css
@@ -4,17 +4,43 @@
body {
font-family: "Gill Sans", "Gill Sans MT", Helvetica, Arial, sans-serif;
margin: 0;
- padding: 1em;
+ padding: 0;
+ dcolor: #a9aeb0;
}
h1 {
- border-bottom: solid 2px #999999;
+ font-size: 175%;
+}
+
+#header {
+ font-size: 200%;
+ font-weight: bold;
+ border-bottom: solid 2px #968d63;
margin: 0;
+ padding: 5px 0.5em;
+ background-color: #e3d595;
+ color: #968d63;
}
-a {
+#header a:link, #header a:visited {
+ color: #968d63;
+ background-color: #e3d595;
+ text-decoration: none;
+}
+#header a:active, #header a:hover {
+ text-decoration: underline;
+}
+
+h2 {
+ margin-left: 1em;
+}
+
+a:link {
color: #0000ff;
}
+a:visited {
+ color: #000099;
+}
a:hover, a:active {
color: #ff0000;
}
@@ -22,6 +48,7 @@ a:hover, a:active {
.v { display: none; }
#error {
+ text-align: center;
color: #cc0000;
font-size: larger;
}
@@ -38,7 +65,7 @@ ul#error {
#navigation {
position: absolute;
- top: 2em;
+ top: 1em;
right: 1em;
padding: 0;
margin: 0;
@@ -46,11 +73,46 @@ ul#error {
}
#navigation li {
float: right;
- padding: 0 2em;
+ padding: 0;
+ margin: 0;
+}
+
+#navigation a:link, #navigation a:visited {
+ color: #968d63;
+ background-color: #e3d595;
+ padding: 5px 2em;
+}
+#navigation a:hover, #navigation a:active {
+ background-color: #968d63;
+ color: #e3d595;
+}
+
+#footer {
+ text-align: right;
+ font-size: 83%;
+ border-top: solid 1px #968d63;
+ display: table;
+ margin: 1em 0 1em auto;
+ padding: 2px 4px;
}
/* Forms */
+input {
+ font-size: 100%;
+}
+
+#postcodeForm {
+ display: table;
+ font-size: 150%;
+ margin: 2em auto;
+}
+
+#postcodeForm label {
+ float: none;
+ padding-right: 0;
+}
+
label {
float: left;
text-align: right;
@@ -118,6 +180,7 @@ fieldset div.checkbox label {
}
#relativediv {
+ margin: 0 2em 0 3em;
position: relative;
}
diff --git a/web/faq.cgi b/web/faq.cgi
new file mode 100755
index 000000000..c6c99367e
--- /dev/null
+++ b/web/faq.cgi
@@ -0,0 +1,38 @@
+#!/usr/bin/perl -w
+
+# faq.cgi:
+# FAQ page for Neighbourhood Fix-It
+#
+# Copyright (c) 2006 UK Citizens Online Democracy. All rights reserved.
+# Email: matthew@mysociety.org. WWW: http://www.mysociety.org
+#
+# $Id: faq.cgi,v 1.1 2006-09-25 18:12:56 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 Page;
+
+# Main code for index.cgi
+sub main {
+ my $q = shift;
+ print Page::header($q, 'FAQ');
+ print faq();
+ print Page::footer();
+}
+Page::do_fastcgi(\&main);
+
+sub faq {
+ my $out = '<div id="relativediv">';
+ $out .= <<EOF;
+<h1>Frequently Asked Questions</h1>
+<p>FAQ stuff here</p>
+</div>
+EOF
+ return $out;
+}
+
diff --git a/web/index.cgi b/web/index.cgi
index 91a130856..b74789ade 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.22 2006-09-25 16:08:06 francis Exp $
+# $Id: index.cgi,v 1.23 2006-09-25 18:12:56 matthew Exp $
use strict;
require 5.8.0;
@@ -63,29 +63,34 @@ sub main {
} elsif ($q->param('pc')) {
$out = display($q);
} else {
- $out = front_page();
+ $out = front_page($q);
}
print Page::header($q, '');
print $out;
- print Page::footer($q);
+ print Page::footer();
}
Page::do_fastcgi(\&main);
# Display front page
sub front_page {
- my $error = shift;
- my $out = '';
- $out .= '<p id="error">' . $error . '</p>' if ($error);
+ my ($q, $error) = @_;
+ my $pc_h = ent($q->param('pc') || '');
+ my $out = '<div id="relativediv">';
+ $out .= <<EOF;
+<p style="text-align: center; font-size: 150%; margin: 2em; font-weight: bolder;">Report or view local problems
+like graffiti, fly tipping, broken paving slabs, or street lighting</p>
+EOF
+ $out .= '<p id="error">' . $error . 'Please try again.</p>' if ($error);
$out .= <<EOF;
-<p>You can use this site to <strong>report</strong> or <strong>view</strong> problems
-with refuse, recycling, fly tipping, pest control,
-abandoned vechicles, street lighting, graffiti, street cleaning, litter or
-similar, with reports going direct to your local council.</p>
+<form action="./" method="get" id="postcodeForm">
+<label for="pc">Enter your postcode:</label>
+<input type="text" name="pc" value="$pc_h" id="pc" size="10" maxlength="10">
+<input type="submit" value="Go">
+</form>
-<p><em>This is currently only for Newham and Lewisham Councils</em></p>
+<p>Reports are sent directly to your local council &ndash; at the moment, we only cover <em>Newham, Lewisham, and Islington</em> councils.</p>
-<p>To just view reports from your local area, simply enter a postcode.
-Reporting a problem is hopefully just as simple:</p>
+<p>Reporting a problem is hopefully very simple:</p>
<ol>
<li>Enter a postcode;
@@ -94,11 +99,7 @@ Reporting a problem is hopefully just as simple:</p>
<li>Submit to your council.
</ol>
-
-<form action="./" method="get">
-<p>Enter your postcode: <input type="text" name="pc" value="">
-<input type="submit" value="Go">
-</form>
+</div>
EOF
return $out;
}
@@ -243,12 +244,15 @@ sub display {
my $e = shift;
if ($e->value() == mySociety::MaPit::BAD_POSTCODE
|| $e->value() == mySociety::MaPit::POSTCODE_NOT_FOUND) {
- $error = 'That postcode was not recognised, sorry.';
+ $error = 'That postcode was not recognised, sorry. ';
} else {
$error = $e;
}
+ } catch Error::Simple with {
+ my $e = shift;
+ $error = $e;
};
- return front_page($error) if ($error);
+ return front_page($q, $error) if ($error);
my $out = "<h2>$name</h2>";
$out .= display_map($q, $x, $y, 1, 1);
@@ -298,13 +302,13 @@ EOF
}
my $skipurl = NewURL($q, 'map'=>1, skipped=>1);
$out .= '</ul></div>';
- $out .= display_map_end(1);
$out .= <<EOF;
<p>If you cannot see a map &ndash; if you have images turned off,
or are using a text only browser, for example &ndash; please
<a href="$skipurl">skip this step</a> and we will ask you
to describe the location of your problem instead.</p>
EOF
+ $out .= display_map_end(1);
return $out;
}
@@ -398,7 +402,7 @@ sub display_map {
my $url = mySociety::Config::get('TILES_URL');
my $tiles_url = $url . $x . '-' . ($x+1) . ',' . $y . '-' . ($y+1) . '/RABX';
my $tiles = LWP::Simple::get($tiles_url);
- throw Error::Simple("Unable to get tiles from URL $tiles_url") if !$tiles;
+ throw Error::Simple("Unable to get tiles from URL $tiles_url\n") if !$tiles;
my $tileids = RABX::unserialise($tiles);
my $tl = $x . '.' . ($y+1);
my $tr = ($x+1) . '.' . ($y+1);
@@ -450,11 +454,11 @@ sub postcode_check {
$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.", 123456) if (!$areas || !$areas->{LBO});
+ throw Error::Simple("I'm afraid that postcode isn't in our covered area.\n") if (!$areas || !$areas->{LBO});
# Check for Lewisham or Newham
my $lbo = $areas->{LBO};
- throw Error::Simple("I'm afraid that postcode isn't in our covered London boroughs.", 123457) unless ($lbo == 2510 || $lbo == 2492);
+ throw Error::Simple("I'm afraid that postcode isn't in our covered London boroughs.\n") unless ($lbo == 2510 || $lbo == 2492 || $lbo == 2507);
my $area_info = mySociety::MaPit::get_voting_area_info($lbo);
my $name = $area_info->{name};
@@ -484,7 +488,9 @@ sub os_to_px {
# BL is bottom left tile reference of displayed map
sub tile_to_px {
my ($p, $bl) = @_;
- return 508 - 254 * ($p - $bl);
+ $p = 508 - 254 * ($p - $bl);
+ $p = int($p + .5 * ($p <=> 0));
+ return $p;
}
# Tile co-ordinates are linear scale of OS E/N