aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--perllib/Page.pm5
-rw-r--r--web/.cvsignore1
-rw-r--r--web/css.css2
-rwxr-xr-xweb/index.cgi34
-rw-r--r--web/pngfix.js37
5 files changed, 67 insertions, 12 deletions
diff --git a/perllib/Page.pm b/perllib/Page.pm
index 0f3030bb0..58c4ece9e 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.10 2006-09-21 18:20:39 matthew Exp $
+# $Id: Page.pm,v 1.11 2006-09-21 21:22:12 matthew Exp $
#
package Page;
@@ -63,6 +63,9 @@ sub header ($$%) {
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="en-gb">
<head>
+ <!--[if lt IE 7.]>
+ <script defer type="text/javascript" src="pngfix.js"></script>
+ <![endif]-->
<title>Neighbourhood Fix-It</title>
<style type="text/css">\@import url("css.css");</style>
</head>
diff --git a/web/.cvsignore b/web/.cvsignore
index a62d38343..8316da013 100644
--- a/web/.cvsignore
+++ b/web/.cvsignore
@@ -1 +1,2 @@
down.html
+_Inline
diff --git a/web/css.css b/web/css.css
index 057808b25..d7e854333 100644
--- a/web/css.css
+++ b/web/css.css
@@ -28,7 +28,7 @@ label {
float: left;
text-align: right;
padding-right: 4px;
- width: 4em;
+ width: 5em;
}
/* Site-wide layout */
diff --git a/web/index.cgi b/web/index.cgi
index d3a1daad5..d5998574b 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.14 2006-09-21 18:20:39 matthew Exp $
+# $Id: index.cgi,v 1.15 2006-09-21 21:22:12 matthew Exp $
use strict;
require 5.8.0;
@@ -33,7 +33,7 @@ sub main {
my $q = shift;
my $out = '';
- if ($q->param('submit_form')) {
+ if ($q->param('submit_problem')) {
$out = submit_form($q);
} elsif ($q->param('map')) {
$out = display_form($q);
@@ -95,11 +95,15 @@ sub display_form {
my @ps = $q->param;
foreach (@ps) {
($pin_tile_x, $pin_tile_y, $pin_x) = ($1, $2, $q->param($_)) if /^tile_(\d+)\.(\d+)\.x$/;
- $pin_y = 254 - $q->param($_) if /\.y$/;
+ $pin_y = $q->param($_) if /\.y$/;
}
return display($q) unless defined($skipped) || (defined($pin_x) && defined($pin_y));
my $out = '';
+ $pin_x -= 254 while $pin_x > 254;
+ $pin_y -= 254 while $pin_y > 254;
+ $pin_y = 254 - $pin_y;
+
my $hidden = '';
$out .= '<h2>Reporting a problem</h2>';
if ($skipped) {
@@ -114,19 +118,19 @@ sub display_form {
$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. Please fill in details of the problem below:</p>';
$out .= display_map($q, $x_tile, $y_tile, 1, 0);
$out .= display_pin($px, $py, 'yellow');
- $out .= '</p></div></form>';
+ $out .= '</div></form>';
}
my $pc_enc = ent($pc);
$out .= <<EOF;
<form action="./" method="post" id="report_form">
-<input type="hidden" name="submit_form" value="1">
+<input type="hidden" name="submit_problem" value="1">
<input type="hidden" name="pc" value="$pc_enc">
$hidden
-<div><label for="form_title">Title:</label> <input type="text" value="" name="title" id="form_title" size="30">
+<div><label for="form_title">Title:</label> <input type="text" value="" name="title" id="form_title" size="30"></div>
<div><label for="form_detail">Details:</label>
-<textarea name="detail" id="form_detail" rows="7" cols="30"></textarea>
-<div><label for="form_name">Name:</label> <input type="text" value="" name="name" id="form_name" size="30">
-<div><label for="form_email">Email:</label> <input type="text" value="" name="email" id="form_email" size="30">
+<textarea name="detail" id="form_detail" rows="7" cols="30"></textarea></div>
+<div><label for="form_name">Name:</label> <input type="text" value="" name="name" id="form_name" size="30"></div>
+<div><label for="form_email">Email:</label> <input type="text" value="" name="email" id="form_email" size="30"></div>
<input type="submit" value="Submit">
</form>
EOF
@@ -248,6 +252,16 @@ sub display_problem {
# Display comments
$out .= '<h3>Comments</h3>';
$out .= '<p>Will go here</p>';
+ $out .= '<h3>Add Comment</h3>';
+ $out .= <<EOF;
+<form method="post" action="./" id="report_form">
+<input type="hidden" name="submit_comment" value="1">
+<div><label for="form_name">Name:</label> <input type="text" name="name" id="form_name" value="" size="30"></div>
+<div><label for="form_email">Email:</label> <input type="text" name="email" id="form_email" value="" size="30"></div>
+<div><label for="form_comment">Comment:</label> <textarea name="comment" id="form_comment" rows="7" cols="30"></textarea></div>
+<input type="submit" value="Post">
+</form>
+EOF
return $out;
}
@@ -276,7 +290,7 @@ sub display_map {
if ($type) {
my $pc_enc = ent($q->param('pc'));
$out .= <<EOF;
-<form action"=./" method="get">
+<form action="./" method="get">
<input type="hidden" name="map" value="1">
<input type="hidden" name="x" value="$x">
<input type="hidden" name="y" value="$y">
diff --git a/web/pngfix.js b/web/pngfix.js
new file mode 100644
index 000000000..6552a4b47
--- /dev/null
+++ b/web/pngfix.js
@@ -0,0 +1,37 @@
+/*
+
+ Correctly handle PNG transparency in Win IE 5.5 & 6.
+ http://homepage.ntlworld.com/bobosola. Updated 18-Jan-2006.
+
+ Use in <HEAD> with DEFER keyword wrapped in conditional comments:
+ <!--[if lt IE 7]>
+ <script defer type="text/javascript" src="pngfix.js"></script>
+ <![endif]-->
+
+ */
+
+var arVersion = navigator.appVersion.split("MSIE")
+var version = parseFloat(arVersion[1])
+
+if ((version >= 5.5) && (document.body.filters)) {
+ for(var i=0; i<document.images.length; i++) {
+ var img = document.images[i]
+ var imgName = img.src.toUpperCase()
+ if (imgName.substring(imgName.length-3, imgName.length) == "PNG") {
+ var imgID = (img.id) ? "id='" + img.id + "' " : ""
+ var imgClass = (img.className) ? "class='" + img.className + "' " : ""
+ var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
+ var imgStyle = "display:inline-block;" + img.style.cssText
+ if (img.align == "left") imgStyle = "float:left;" + imgStyle
+ if (img.align == "right") imgStyle = "float:right;" + imgStyle
+ if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle
+ var strNewHTML = "<span " + imgID + imgClass + imgTitle
+ + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
+ + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
+ + "(src=\'" + img.src + "\', sizingMethod='image');\"></span>"
+ img.outerHTML = strNewHTML
+ i = i-1
+ }
+ }
+}
+