aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Somerville <matthew@fury.ukcod.org.uk>2011-02-22 11:29:17 +0000
committerMatthew Somerville <matthew@fury.ukcod.org.uk>2011-02-22 11:29:17 +0000
commitaa0611663f2852f48b8a77481bc9d6da406b2cc1 (patch)
tree6fd2604b8fc1e9e6aed3d883d5f2475e8d5a6664
parentdfe4984c0ea5d9e1793f75aa7cb2574a877e9aa8 (diff)
Map JS only when map is being shown.
-rw-r--r--perllib/Page.pm4
-rwxr-xr-xweb/index.cgi7
-rwxr-xr-xweb/questionnaire.cgi5
3 files changed, 12 insertions, 4 deletions
diff --git a/perllib/Page.pm b/perllib/Page.pm
index 8135d1306..06c543f7c 100644
--- a/perllib/Page.pm
+++ b/perllib/Page.pm
@@ -204,7 +204,7 @@ sub template_vars ($%) {
'lang_url' => $lang_url,
'title' => $params{title},
'rss' => '',
- map_js => FixMyStreet::Map::header_js(),
+ map_js => $params{js} || '',
);
if ($params{rss}) {
@@ -271,7 +271,7 @@ sub header ($%) {
my $default_params = Cobrand::header_params(get_cobrand($q), $q, %params);
my %default_params = %{$default_params};
%params = (%default_params, %params);
- my %permitted_params = map { $_ => 1 } qw(title rss expires lastmodified template cachecontrol context status_code robots);
+ my %permitted_params = map { $_ => 1 } qw(title rss expires lastmodified template cachecontrol context status_code robots js);
foreach (keys %params) {
croak "bad parameter '$_'" if (!exists($permitted_params{$_}));
}
diff --git a/web/index.cgi b/web/index.cgi
index 79a867f78..2eabf703e 100755
--- a/web/index.cgi
+++ b/web/index.cgi
@@ -787,7 +787,10 @@ EOF
url_home => Cobrand::url($cobrand, '/', $q),
submit_button => _('Submit')
);
- return (Page::template_include('report-form', $q, Page::template_root($q), %vars), robots => 'noindex,nofollow');
+ return (Page::template_include('report-form', $q, Page::template_root($q), %vars),
+ robots => 'noindex,nofollow',
+ js => FixMyStreet::Map::header_js(),
+ );
}
# redirect from osgb
@@ -982,6 +985,7 @@ sub display_location {
my %params = (
rss => [ _('Recent local problems, FixMyStreet'), $rss_url ],
+ js => FixMyStreet::Map::header_js(),
robots => 'noindex,nofollow',
);
@@ -1114,6 +1118,7 @@ EOF
my %params = (
rss => [ _('Updates to this problem, FixMyStreet'), "/rss/$input_h{id}" ],
robots => 'index, nofollow',
+ js => FixMyStreet::Map::header_js(),
title => $problem->{title}
);
diff --git a/web/questionnaire.cgi b/web/questionnaire.cgi
index cb5e553d3..1eb62d03e 100755
--- a/web/questionnaire.cgi
+++ b/web/questionnaire.cgi
@@ -25,7 +25,10 @@ sub main {
} else {
$out = display_questionnaire($q);
}
- print Page::header($q, title=>_('Questionnaire'));
+ print Page::header($q,
+ title => _('Questionnaire'),
+ js => FixMyStreet::Map::header_js(),
+ );
print $out;
print Page::footer($q);
}