aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--perllib/Page.pm9
-rw-r--r--web/js.js39
2 files changed, 25 insertions, 23 deletions
diff --git a/perllib/Page.pm b/perllib/Page.pm
index 2612af6a1..ffed2d2fb 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.180 2009-09-22 16:24:13 louise Exp $
+# $Id: Page.pm,v 1.181 2009-09-23 09:27:51 louise Exp $
#
package Page;
@@ -175,8 +175,8 @@ LANG is the language the templates will be rendered in.
sub template_vars ($$){
my ($q, $lang) = @_;
my %vars;
- my $lang_url = base_url_with_lang($q, 1);
- $lang_url .= $ENV{REQUEST_URI} if $ENV{REQUEST_URI};
+ my $host = base_url_with_lang($q, 1);
+ my $lang_url .= $ENV{REQUEST_URI} if $ENV{REQUEST_URI};
%vars = (
'report' => _('Report a problem'),
'reports' => _('All reports'),
@@ -184,6 +184,7 @@ sub template_vars ($$){
'faq' => _('Help'),
'about' => _('About us'),
'site_title' => _('Report Empty Homes'),
+ 'host' => $host,
'lang_code' => $lang,
'lang' => $lang eq 'en-gb' ? 'Cymraeg' : 'English',
'lang_url' => $lang_url,
@@ -446,7 +447,7 @@ EOF
my $imgh = '254px';
$out .= <<EOF;
<script type="text/javascript">
-var x = $x - 2; var y = $y - 2;
+var fms_x = $x - 2; var fms_y = $y - 2;
var start_x = $px; var start_y = $py;
</script>
<div id="map_box">
diff --git a/web/js.js b/web/js.js
index 1115b47be..7debab608 100644
--- a/web/js.js
+++ b/web/js.js
@@ -9,6 +9,7 @@
*
*/
+
YAHOO.util.Event.onContentReady('pc', function() {
if (this.id && this.value == this.defaultValue) {
this.focus();
@@ -41,23 +42,25 @@ YAHOO.util.Event.onContentReady('compass', function() {
YAHOO.util.Event.addListener(points[4], 'click', compass_pan, { home:1, orig_x:drag_x, orig_y:drag_y });
});
+
YAHOO.util.Event.onContentReady('map', function() {
var ua=navigator.userAgent.toLowerCase();
// if (document.getElementById('mapForm') && (/safari/.test(ua) || /Konqueror/.test(ua))) return;
if (document.getElementById('map').offsetWidth > 510) return;
-
new YAHOO.util.DDMap('map');
update_tiles(start_x, start_y, true);
});
+
YAHOO.util.Event.onContentReady('mapForm', function() {
this.onsubmit = function() {
- if (this.submit_problem) {
+ if (this.submit_problem) {
this.submit_problem.disabled = true;
this.submit_map.value = 2;
}
- this.x.value = x + 2;
- this.y.value = y + 2;
+
+ this.x.value = fms_x + 2;
+ this.y.value = fms_y + 2;
/*
if (swfu && swfu.getStats().files_queued > 0) {
swfu.startUpload();
@@ -141,21 +144,21 @@ YAHOO.util.Event.addListener('all_pins_link', 'click', function(e) {
if (this.innerHTML == 'Include stale reports') {
this.innerHTML = 'Hide stale reports';
document.getElementById('all_pins').value = '1';
- load_pins(x, y);
+ load_pins(fms_x, fms_y);
} else if (this.innerHTML == 'Cynnwys hen adroddiadau') {
this.innerHTML = 'Cuddio hen adroddiadau';
document.getElementById('all_pins').value = '1';
welsh = 1;
- load_pins(x, y);
+ load_pins(fms_x, fms_y);
} else if (this.innerHTML == 'Cuddio hen adroddiadau') {
this.innerHTML = 'Cynnwys hen adroddiadau';
welsh = 1;
document.getElementById('all_pins').value = '';
- load_pins(x, y);
+ load_pins(fms_x, fms_y);
} else if (this.innerHTML == 'Hide stale reports') {
this.innerHTML = 'Include stale reports';
document.getElementById('all_pins').value = '';
- load_pins(x, y);
+ load_pins(fms_x, fms_y);
}
if (welsh) {
document.getElementById('hide_pins_link').innerHTML = 'Cuddio pinnau';
@@ -275,7 +278,6 @@ var drag_y = 0;
function update_tiles(dx, dy, force) {
dx = getInt(dx); dy = getInt(dy);
if (!dx && !dy && !force) return;
-
var old_drag_x = drag_x;
var old_drag_y = drag_y;
drag_x += dx;
@@ -288,21 +290,20 @@ function update_tiles(dx, dy, force) {
var horizontal = Math.floor(old_drag_x/tilewidth) - Math.floor(drag_x/tilewidth);
var vertical = Math.floor(old_drag_y/tileheight) - Math.floor(drag_y/tileheight);
if (!horizontal && !vertical && !force) return;
-
- x += horizontal;
+ fms_x += horizontal;
+
tile_x += horizontal;
- y -= vertical;
+ fms_y -= vertical;
tile_y += vertical;
- var url = [ '/tilma/tileserver/10k-full/', x, '-', (x+5), ',', y, '-', (y+5), '/JSON' ].join('');
+ var url = [ '/tilma/tileserver/10k-full/', fms_x, '-', (fms_x+5), ',', fms_y, '-', (fms_y+5), '/JSON' ].join('');
YAHOO.util.Connect.asyncRequest('GET', url, {
success: urls_loaded, failure: urls_not_loaded,
argument: [tile_x, tile_y]
});
if (force) return;
-
- load_pins(x, y);
+ load_pins(fms_x, fms_y);
}
function load_pins(x, y) {
@@ -312,7 +313,7 @@ function load_pins(x, y) {
';all_pins=', document.getElementById('all_pins').value
].join('');
YAHOO.util.Connect.asyncRequest('GET', url, {
- success: pins_loaded
+ success: pins_loaded
});
}
}
@@ -340,8 +341,8 @@ function urls_loaded(o) {
if (tiles[i][j] == null) continue;
var jj = (j + o.argument[0]);
var id = [ 't', ii, '.', jj ].join('');
- var xx = x+j;
- var yy = y+5-i;
+ var xx = fms_x+j;
+ var yy = fms_y+5-i;
var img = document.getElementById(id);
if (img) {
if (!img.galleryimg) { img.galleryimg = false; }
@@ -391,7 +392,7 @@ function cloneNode() {
var tileCache=[];
function cleanCache() {
for (var i in tileCache) {
- if (tileCache[i].x < x || tileCache[i].x > x+5 || tileCache[i].y < y || tileCache[i].y > y+5) {
+ if (tileCache[i].x < fms_x || tileCache[i].x > fms_x+5 || tileCache[i].y < fms_y || tileCache[i].y > fms_y+5) {
var t = tileCache[i].t;
t.parentNode.removeChild(t); // de-leak?
delete tileCache[i];