#!/usr/bin/perl -w # index.pl: # Main code for BCI - not really. # # Copyright (c) 2006 UK Citizens Online Democracy. All rights reserved. # Email: matthew@mysociety.org. WWW: http://www.mysociety.org # # $Id: index.cgi,v 1.10 2006-09-20 14:51:00 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 Error qw(:try); use HTML::Entities; use Page; use mySociety::Config; BEGIN { mySociety::Config::set_file("$FindBin::Bin/../conf/general"); } use mySociety::MaPit; mySociety::MaPit::configure(); # Main code for index.cgi sub main { my $q = shift; my $out = ''; if ($q->param('pc')) { $out = display($q); } else { $out = front_page(); } print $q->header(-charset=>'utf-8'); print Page::header($q, ''); print $out; print Page::footer($q); } Page::do_fastcgi(\&main); # Display front page sub front_page { my $error = shift; my $out = ''; $out .= '
' . $error . '
' if ($error); $out .= <This is currently only for Newham and Lewisham Councils
It’s very simple:
Now, please select the location of the problem on the map below. Use the arrows to the left of the map to scroll around.
EOF my @ps = $q->param; foreach (@ps) { my $x = $q->param($_) if /\.x$/; my $y = $q->param($_) if /\.y$/; } my $x = $q->param('x') || 628; my $y = $q->param('y') || 1724; my $dir = mySociety::Config::get('TILES_URL'); my $tl = $x . '.' . $y; my $tr = ($x+1) . '.' . $y; my $bl = $x . '.' . ($y+1); my $br = ($x+1) . '.' . ($y+1); my $tl_src = $dir . $tl . '.png'; my $tr_src = $dir . $tr . '.png'; my $bl_src = $dir . $bl . '.png'; my $br_src = $dir . $br . '.png'; $pc = encode_entities($pc); $out .= Page::compass($pc, $x, $y); $out .= <