diff options
-rw-r--r-- | perllib/Page.pm | 30 | ||||
-rw-r--r-- | web/css/core.css | 7 | ||||
-rwxr-xr-x | web/index.cgi | 18 | ||||
-rwxr-xr-x | web/questionnaire.cgi | 4 |
4 files changed, 36 insertions, 23 deletions
diff --git a/perllib/Page.pm b/perllib/Page.pm index c336d29ec..5d2a3b8b2 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.88 2008-04-10 19:07:38 matthew Exp $ +# $Id: Page.pm,v 1.89 2008-04-14 16:05:57 matthew Exp $ # package Page; @@ -73,7 +73,8 @@ sub microsite { my $q = shift; my $host = $ENV{HTTP_HOST} || ''; $q->{site} = 'fixmystreet'; - $q->{site} = 'scambs' if $host =~ /scambs/ || $q->param('scamb'); + $q->{site} = 'scambs' if $host =~ /scambs/; + $q->{site} = 'emptyhomes' if $host =~ /emptyhomes/; } =item header Q [PARAM VALUE ...] @@ -103,6 +104,11 @@ sub header ($%) { $html = join('', <FP>); close FP; $html =~ s#<!-- TITLE -->#$title#; + } elsif ($q->{site} eq 'emptyhomes') { + open FP, '../templates/website/emptyhomes-header'; + $html = join('', <FP>); + close FP; + $html =~ s#<!-- TITLE -->#$title#; } else { $html = <<EOF; <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> @@ -150,6 +156,11 @@ sub footer { my $html = join('', <FP>); close FP; return $html; + } elsif ($q->{site} eq 'emptyhomes') { + open FP, '../templates/website/emptyhomes-footer'; + my $html = join('', <FP>); + close FP; + return $html; } my $pc = $q->param('pc') || ''; @@ -204,7 +215,7 @@ sub display_map { $params{pins} ||= ''; $params{pre} ||= ''; $params{post} ||= ''; - my $px = defined($params{px}) ? $params{px}-254 : 0; + my $px = defined($params{px}) ? 254-$params{px} : 0; my $py = defined($params{py}) ? 254-$params{py} : 0; my $x = int($params{x})<=0 ? 0 : $params{x}; my $y = int($params{y})<=0 ? 0 : $params{y}; @@ -280,7 +291,7 @@ sub display_pin { my %cols = (red=>'R', green=>'G', blue=>'B', purple=>'P'); my $out = '<img class="pin" src="/i/pin' . $cols{$col} . $num . '.gif" alt="Problem" style="top:' . ($py-59) - . 'px; right:' . ($px-31) . 'px; position: absolute;">'; + . 'px; left:' . ($px) . 'px; position: absolute;">'; return $out unless $_ && $_->{id} && $col ne 'blue'; my $url = NewURL($q, id=>$_->{id}, x=>undef, y=>undef); $out = '<a title="' . $_->{title} . '" href="' . $url . '">' . $out . '</a>'; @@ -320,15 +331,16 @@ EOF # P is easting or northing # BL is bottom left tile reference of displayed map sub os_to_px { - my ($p, $bl) = @_; - return tile_to_px(os_to_tile($p), $bl); + my ($p, $bl, $invert) = @_; + return tile_to_px(os_to_tile($p), $bl, $invert); } -# Convert tile co-ordinates to pixel co-ordinates from top right of map +# Convert tile co-ordinates to pixel co-ordinates from top left of map # BL is bottom left tile reference of displayed map sub tile_to_px { - my ($p, $bl) = @_; - $p = 508 - 254 * ($p - $bl); + my ($p, $bl, $invert) = @_; + $p = 254 * ($p - $bl); + $p = 508 - $p if $invert; $p = int($p + .5 * ($p <=> 0)); return $p; } diff --git a/web/css/core.css b/web/css/core.css index c2e32909a..a1fa31b64 100644 --- a/web/css/core.css +++ b/web/css/core.css @@ -39,7 +39,7 @@ dt { .v { display: none; } -#error { +p#error { text-align: center; color: #cc0000; font-size: larger; @@ -56,6 +56,7 @@ ul#error { padding-right: 4px; border: solid 1px #cc0000; text-align: left; + font-size: larger; } /* Site-wide layout */ @@ -213,11 +214,11 @@ p#copyright { #compass { background-color: #ffffff; border: solid 1px #000000; - border-width: 0 1px 1px 1px; + border-width: 0 1px 1px 0; color: #000000; position: absolute; top: 0px; - right: 439px; + left: 0px; } #compass img { diff --git a/web/index.cgi b/web/index.cgi index 7b9557fe5..c84acc934 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.189 2008-04-10 19:07:39 matthew Exp $ +# $Id: index.cgi,v 1.190 2008-04-14 16:06:03 matthew Exp $ use strict; use Standard; @@ -51,8 +51,8 @@ sub main { $params{title} = 'Submitting your update'; ($out) = submit_update($q); } elsif ($q->param('submit_map')) { - $params{title} = 'Reporting a problem'; ($out, %params) = display_form($q); + $params{title} = 'Reporting a problem'; } elsif ($q->param('id')) { ($out, %params) = display_problem($q); $params{title} .= ' - Viewing a problem'; @@ -393,7 +393,7 @@ sub display_form { $input{x} ||= int($pin_x) - 1; $input{y} ||= int($pin_y) - 1; $px = Page::tile_to_px($pin_x, $input{x}); - $py = Page::tile_to_px($pin_y, $input{y}); + $py = Page::tile_to_px($pin_y, $input{y}, 1); $easting = Page::tile_to_os($pin_x); $northing = Page::tile_to_os($pin_y); } elsif ($input{flickr} && $input{pc} && !$input{easting} && !$input{northing}) { @@ -402,13 +402,13 @@ sub display_form { $input{x} = int(Page::os_to_tile($easting)); $input{y} = int(Page::os_to_tile($northing)); $px = Page::os_to_px($easting, $input{x}); - $py = Page::os_to_px($northing, $input{y}); + $py = Page::os_to_px($northing, $input{y}, 1); } else { # Normal form submission $input{x} = int(Page::os_to_tile($input{easting})); $input{y} = int(Page::os_to_tile($input{northing})); $px = Page::os_to_px($input{easting}, $input{x}); - $py = Page::os_to_px($input{northing}, $input{y}); + $py = Page::os_to_px($input{northing}, $input{y}, 1); $easting = $input_h{easting}; $northing = $input_h{northing}; } @@ -715,7 +715,7 @@ sub display_problem { my $x_tile = $input{x} || int($x); my $y_tile = $input{y} || int($y); my $px = Page::os_to_px($problem->{easting}, $x_tile); - my $py = Page::os_to_px($problem->{northing}, $y_tile); + my $py = Page::os_to_px($problem->{northing}, $y_tile, 1); my $out = ''; @@ -826,7 +826,7 @@ sub map_pins { foreach (@$current_map) { push(@ids, $_->{id}); my $px = Page::os_to_px($_->{easting}, $x); - my $py = Page::os_to_px($_->{northing}, $y); + my $py = Page::os_to_px($_->{northing}, $y, 1); $pins .= Page::display_pin($q, $px, $py, 'red', $count_prob++); } @@ -847,7 +847,7 @@ sub map_pins { order by distance, created desc limit $limit", $mid_e, $mid_n); foreach (@$current) { my $px = Page::os_to_px($_->{easting}, $x); - my $py = Page::os_to_px($_->{northing}, $y); + my $py = Page::os_to_px($_->{northing}, $y, 1); $pins .= Page::display_pin($q, $px, $py, 'red', $count_prob++); } } @@ -858,7 +858,7 @@ sub map_pins { order by created desc limit 9", $mid_e, $mid_n); foreach (@$fixed) { my $px = Page::os_to_px($_->{easting}, $x); - my $py = Page::os_to_px($_->{northing}, $y); + my $py = Page::os_to_px($_->{northing}, $y, 1); $pins .= Page::display_pin($q, $px, $py, 'green', $count_fixed++); } return ($pins, $current_map, $current, $fixed, $dist); diff --git a/web/questionnaire.cgi b/web/questionnaire.cgi index 34bfa9a44..b5118bf59 100755 --- a/web/questionnaire.cgi +++ b/web/questionnaire.cgi @@ -6,7 +6,7 @@ # Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved. # Email: matthew@mysociety.org. WWW: http://www.mysociety.org # -# $Id: questionnaire.cgi,v 1.26 2008-04-10 19:19:10 matthew Exp $ +# $Id: questionnaire.cgi,v 1.27 2008-04-14 16:06:03 matthew Exp $ use strict; use Standard; @@ -180,7 +180,7 @@ sub display_questionnaire { my $x_tile = int($x); my $y_tile = int($y); my $px = Page::os_to_px($problem->{easting}, $x_tile); - my $py = Page::os_to_px($problem->{northing}, $y_tile); + my $py = Page::os_to_px($problem->{northing}, $y_tile, 1); my $pins = Page::display_pin($q, $px, $py, $problem->{state} eq 'fixed'?'green':'red'); my $problem_text = Page::display_problem_text($q, $problem); |