aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xweb/index.cgi109
-rw-r--r--web/index.php91
2 files changed, 109 insertions, 91 deletions
diff --git a/web/index.cgi b/web/index.cgi
new file mode 100755
index 000000000..494562a51
--- /dev/null
+++ b/web/index.cgi
@@ -0,0 +1,109 @@
+#!/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.1 2006-09-19 15:58:37 matthew Exp $
+
+use strict;
+use CGI;
+
+my $q = new CGI;
+print $q->header();
+my $x = $q->param('x') || 62;
+my $y = $q->param('y') || 171;
+my $zoom = $q->param('z') || 250;
+
+my $dir;
+if ($zoom == 25) {
+ $dir = 'tl/';
+} else {
+ $dir = 't/';
+}
+
+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';
+
+sub url {
+ my ($x, $y, $z) = @_;
+ $z = $zoom unless $z;
+ return '?x=' . $x . '&y=' . $y . '&z=' . $z;
+}
+
+my $nw = url($x-1, $y-1);
+my $n = url($x, $y-1);
+my $ne = url($x+1, $y-1);
+my $w = url($x-1,$y);
+my $e = url($x+1,$y);
+my $sw = url($x-1, $y+1);
+my $s = url($x, $y+1);
+my $se = url($x+1, $y+1);
+print <<EOF;
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html lang="en-gb">
+ <head>
+ <title>MapOS testing</title>
+ <script type="text/javascript" src="build/YAHOO.js"></script>
+ <script type="text/javascript" src="build/dom.js"></script>
+ <script type="text/javascript" src="build/event.js"></script>
+ <script type="text/javascript" src="build/animation.js"></script>
+ <script type="text/javascript">
+ var x = $x;
+ var y = $y;
+ </script>
+ <script type="text/javascript" src="js.js"></script>
+ <style type="text/css">\@import url("css.css");</style>
+ </head>
+ <body>
+ <h1>MapOS</h1>
+ <p>Drag to move, double-click to centre, or use the arrows. Zoom's a bit of a jump (250,000:1 to 25,000:1 and back) but should be okay - if you double-click just before a zoom in, that's probably best.
+ <strong>Bugs:</strong> None at this immediate moment</p>
+ <div id="wrap">
+ <div id="column">
+
+<table cellpadding="0" cellspacing="0" border="0" id="compass">
+<tr valign="bottom">
+<td align="right"><a href="$nw"><img src="i/arrow-northwest.gif" alt="NW"></a></td>
+<td align="center"><a href="$n"><img src="i/arrow-north.gif" vspace="3" alt="N"></a></td>
+<td><a href="$ne"><img src="i/arrow-northeast.gif" alt="NE"></a></td>
+</tr>
+<tr>
+<td><a href="$w"><img src="i/arrow-west.gif" hspace="3" alt="W"></a></td>
+<td align="center"><img src="i/rose.gif" alt=""></a></td>
+<td><a href="$e"><img src="i/arrow-east.gif" hspace="3" alt="E"></a></td>
+</tr>
+<tr valign="top">
+<td align="right"><a href="$sw"><img src="i/arrow-southwest.gif" alt="SW"></a></td>
+<td align="center"><a href="$s"><img src="i/arrow-south.gif" vspace="3" alt="S"></a></td>
+<td><a href="$se"><img src="i/arrow-southeast.gif" alt="SE"></a></td>
+</tr>
+</table>
+
+<p id="zoom" align="center">
+EOF
+if ($zoom != 250) {
+ printf('<a href="%s"><img src="i/zoomout.gif" alt="Zoom out" border="0"></a>', url(round($x/10)-1,round($y/10)-1,250) );
+}
+if ($zoom != 25) {
+ print '<a href="' . url(($x+1)*10,($y+1)*10,25) . '"><img src="i/zoomin.gif" alt="Zoom in" border="0"></a>';
+}
+
+print <<EOF;
+</p>
+
+ <div id="log"></div>
+ </div>
+ <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;">
+ </div>
+ </div>
+ </div>
+ </body>
+</html>
+EOF
diff --git a/web/index.php b/web/index.php
deleted file mode 100644
index d9c952331..000000000
--- a/web/index.php
+++ /dev/null
@@ -1,91 +0,0 @@
-<?
-/*
- * index.php:
- * 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.php,v 1.1 2006-09-19 15:08:37 matthew Exp $
- *
- */
-
-$x = intval($_GET['x']) ? intval($_GET['x']) : 62;
-$y = intval($_GET['y']) ? intval($_GET['y']) : 171;
-$zoom = intval($_GET['z']) ? intval($_GET['z']) : 250;
-if ($zoom == 25) {
- $dir = 'tl/';
-} else {
- $dir = 't/';
-}
-$tl = $dir.$x.'.'.$y.'.png';
-$tr = $dir.($x+1).'.'.$y.'.png';
-$bl = $dir.$x.'.'.($y+1).'.png';
-$br = $dir.($x+1).'.'.($y+1).'.png';
-
-function url($x, $y, $z = null) {
- global $zoom;
- if (!$z) $z = $zoom;
- return '?x=' . $x . '&amp;y=' . $y . '&amp;z=' . $z;
-}
-?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
-<html lang="en-gb">
- <head>
- <title>MapOS testing</title>
- <script type="text/javascript" src="build/YAHOO.js"></script>
- <script type="text/javascript" src="build/dom.js"></script>
- <script type="text/javascript" src="build/event.js"></script>
- <script type="text/javascript" src="build/animation.js"></script>
- <script type="text/javascript">
- var x = <?=$x ?>;
- var y = <?=$y ?>;
- </script>
- <script type="text/javascript" src="js.js"></script>
- <style type="text/css">@import url("css.css");</style>
- </head>
- <body>
- <h1>MapOS</h1>
- <p>Drag to move, double-click to centre, or use the arrows. Zoom's a bit of a jump (250,000:1 to 25,000:1 and back) but should be okay - if you double-click just before a zoom in, that's probably best.
- <strong>Bugs:</strong> None at this immediate moment</p>
- <div id="wrap">
- <div id="column">
-
-<table cellpadding="0" cellspacing="0" border="0" id="compass">
-<tr valign="bottom">
-<td align="right"><a href="<?=url($x-1,$y-1)?>"><img src="i/arrow-northwest.gif" alt="NW"></a></td>
-<td align="center"><a href="<?=url($x, $y-1)?>"><img src="i/arrow-north.gif" vspace="3" alt="N"></a></td>
-<td><a href="<?=url($x+1,$y-1)?>"><img src="i/arrow-northeast.gif" alt="NE"></a></td>
-</tr>
-<tr>
-<td><a href="<?=url($x-1,$y)?>"><img src="i/arrow-west.gif" hspace="3" alt="W"></a></td>
-<td align="center"><img src="i/rose.gif" alt=""></a></td>
-<td><a href="<?=url($x+1,$y)?>"><img src="i/arrow-east.gif" hspace="3" alt="E"></a></td>
-</tr>
-<tr valign="top">
-<td align="right"><a href="<?=url($x-1,$y+1)?>"><img src="i/arrow-southwest.gif" alt="SW"></a></td>
-<td align="center"><a href="<?=url($x,$y+1)?>"><img src="i/arrow-south.gif" vspace="3" alt="S"></a></td>
-<td><a href="<?=url($x+1,$y+1)?>"><img src="i/arrow-southeast.gif" alt="SE"></a></td>
-</tr>
-</table>
-
-<p id="zoom" align="center">
-<? if ($zoom != 250) { ?>
-<a href="<?=url(round($x/10)-1,round($y/10)-1,250)?>"><img src="i/zoomout.gif" alt="Zoom out" border="0"></a>
-<? }
- if ($zoom != 25) { ?>
-<a href="<?=url(($x+1)*10,($y+1)*10,25)?>"><img src="i/zoomin.gif" alt="Zoom in" border="0"></a>
-<? } ?>
-</p>
-
- <div id="log"></div>
- </div>
- <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;">
- </div>
- </div>
- </div>
- </body>
-</html>
-