aboutsummaryrefslogtreecommitdiffstats
path: root/web
diff options
context:
space:
mode:
Diffstat (limited to 'web')
-rwxr-xr-xweb/alert.cgi17
-rwxr-xr-xweb/index.cgi16
-rwxr-xr-xweb/rss.cgi8
3 files changed, 25 insertions, 16 deletions
diff --git a/web/alert.cgi b/web/alert.cgi
index 70b9d1873..3dc52c677 100755
--- a/web/alert.cgi
+++ b/web/alert.cgi
@@ -72,20 +72,17 @@ Page::do_fastcgi(\&main);
sub alert_list {
my ($q, @errors) = @_;
- my @vars = qw(pc rznvy x y);
+ my @vars = qw(pc rznvy e n);
my %input = map { $_ => scalar $q->param($_) } @vars;
my %input_h = map { $_ => $q->param($_) ? ent($q->param($_)) : '' } @vars;
my($error, $e, $n);
- my $x = $input{x}; my $y = $input{y};
- $x ||= 0; $x += 0;
- $y ||= 0; $y += 0;
- if ($x || $y) {
- $e = FixMyStreet::Map::tile_to_os($input{x});
- $n = FixMyStreet::Map::tile_to_os($input{y});
+ if ($input{e} || $input{n}) {
+ $e = $input{e};
+ $n = $input{n};
} else {
try {
- ($x, $y, $e, $n, $error) = FixMyStreet::Geocode::lookup($input{pc}, $q);
+ ($e, $n, $error) = FixMyStreet::Geocode::lookup($input{pc}, $q);
} catch Error::Simple with {
$error = shift;
};
@@ -274,8 +271,8 @@ EOF
rss_feed_5k => $rss_feed_5k,
rss_feed_10k => $rss_feed_10k,
rss_feed_20k => $rss_feed_20k,
- x => $x,
- y => $y,
+ e => $e,
+ n => $n,
options => $options );
my $cobrand_page = Page::template_include('alert-options', $q, Page::template_root($q), %vars);
$out = $cobrand_page if ($cobrand_page);
diff --git a/web/index.cgi b/web/index.cgi
index 4c1366cbb..63b1e938b 100755
--- a/web/index.cgi
+++ b/web/index.cgi
@@ -470,7 +470,7 @@ sub display_form {
$easting = FixMyStreet::Map::tile_to_os($input{x});
$northing = FixMyStreet::Map::tile_to_os($input{y});
} else {
- my ($x, $y, $e, $n, $error) = FixMyStreet::Geocode::lookup($input{pc}, $q);
+ my ($e, $n, $error) = FixMyStreet::Geocode::lookup($input{pc}, $q);
$easting = $e; $northing = $n;
}
} elsif ($pin_x && $pin_y) {
@@ -484,9 +484,9 @@ sub display_form {
$easting = FixMyStreet::Map::tile_to_os($pin_x);
$northing = FixMyStreet::Map::tile_to_os($pin_y);
} elsif ($input{partial} && $input{pc} && !$input{easting} && !$input{northing}) {
- my ($x, $y, $error);
+ my $error;
try {
- ($x, $y, $easting, $northing, $error) = FixMyStreet::Geocode::lookup($input{pc}, $q);
+ ($easting, $northing, $error) = FixMyStreet::Geocode::lookup($input{pc}, $q);
} catch Error::Simple with {
$error = shift;
};
@@ -795,7 +795,13 @@ sub display_location {
return front_page($q, @errors) unless $x || $y || $input{pc};
if (!$x && !$y) {
try {
- ($x, $y, $easting, $northing, $error) = FixMyStreet::Geocode::lookup($input{pc}, $q);
+ ($easting, $northing, $error) = FixMyStreet::Geocode::lookup($input{pc}, $q);
+ my $xx = FixMyStreet::Map::os_to_tile($easting);
+ my $yy = FixMyStreet::Map::os_to_tile($northing);
+ $x = int($xx);
+ $y = int($yy);
+ $x += 1 if ($xx - $x > 0.5);
+ $y += 1 if ($yy - $y > 0.5);
} catch Error::Simple with {
$error = shift;
};
@@ -866,7 +872,7 @@ sub display_location {
map_end => FixMyStreet::Map::display_map_end(1),
url_home => Cobrand::url($cobrand, '/', $q),
url_rss => Cobrand::url($cobrand, NewURL($q, -retain => 1, -url=> "/rss/n/$easting,$northing", pc => undef, x => undef, 'y' => undef), $q),
- url_email => Cobrand::url($cobrand, NewURL($q, -retain => 1, pc => undef, -url=>'/alert', x=>$x, 'y'=>$y, feed=>"local:$easting:$northing"), $q),
+ url_email => Cobrand::url($cobrand, NewURL($q, -retain => 1, pc => undef, -url=>'/alert', e=>$easting, 'n'=>$northing, feed=>"local:$easting:$northing"), $q),
url_skip => $url_skip,
email_me => _('Email me new local problems'),
rss_alt => _('RSS feed'),
diff --git a/web/rss.cgi b/web/rss.cgi
index 623314e7f..867f050fd 100755
--- a/web/rss.cgi
+++ b/web/rss.cgi
@@ -94,7 +94,13 @@ sub rss_local_problems {
} elsif ($pc) {
my $error;
try {
- ($x, $y, $e, $n, $error) = FixMyStreet::Geocode::lookup($pc, $q);
+ ($e, $n, $error) = FixMyStreet::Geocode::lookup($pc, $q);
+ my $xx = FixMyStreet::Map::os_to_tile($e);¬
+ my $yy = FixMyStreet::Map::os_to_tile($n);¬
+ $x = int($xx);¬
+ $y = int($yy);¬
+ $x += 1 if ($xx - $x > 0.5);¬
+ $y += 1 if ($yy - $y > 0.5);¬
} catch Error::Simple with {
$error = shift;
};