diff options
-rw-r--r-- | perllib/Page.pm | 12 | ||||
-rwxr-xr-x | web/confirm.cgi | 4 | ||||
-rwxr-xr-x | web/index.cgi | 21 |
3 files changed, 23 insertions, 14 deletions
diff --git a/perllib/Page.pm b/perllib/Page.pm index 8d0ac69d4..dd6e29e7d 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.84 2008-03-29 03:03:35 matthew Exp $ +# $Id: Page.pm,v 1.85 2008-04-03 16:18:37 matthew Exp $ # package Page; @@ -57,7 +57,7 @@ sub do_fastcgi { q(<hr>), q(<p>The text of the error was:</p>), qq(<blockquote class="errortext">$msg</blockquote>), - q(</body></html); + q(</body></html>); }; dbh()->rollback() if $mySociety::DBHandle::conf_ok; exit(0); @@ -83,7 +83,7 @@ Return HTML for the top of the page, given PARAMs (TITLE is required). sub header ($%) { my ($q, %params) = @_; - my %permitted_params = map { $_ => 1 } qw(title rss); + my %permitted_params = map { $_ => 1 } qw(title rss js); foreach (keys %params) { croak "bad parameter '$_'" if (!exists($permitted_params{$_})); } @@ -136,7 +136,9 @@ EOF =cut sub footer { - my ($q, $extra) = @_; + my ($q, %params) = @_; + my $extra = $params{extra}; + my $js = $params{js} || ''; if ($q->{site} eq 'scambs') { open FP, '../templates/website/scambs-footer'; @@ -166,6 +168,8 @@ href="https://secure.mysociety.org/cvstrac/dir?d=mysociety/services/TilMa">code< $track +$js + </body> </html> EOF diff --git a/web/confirm.cgi b/web/confirm.cgi index f01137862..6205d0605 100755 --- a/web/confirm.cgi +++ b/web/confirm.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: confirm.cgi,v 1.37 2008-03-27 01:02:23 matthew Exp $ +# $Id: confirm.cgi,v 1.38 2008-04-03 16:18:37 matthew Exp $ use strict; use Standard; @@ -44,7 +44,7 @@ EOF print Page::header($q, title=>_('Confirmation')); print $out; - print Page::footer($q, $extra); + print Page::footer($q, extra => $extra); } Page::do_fastcgi(\&main); diff --git a/web/index.cgi b/web/index.cgi index 3f5794a86..157b8df44 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.185 2008-03-29 03:03:35 matthew Exp $ +# $Id: index.cgi,v 1.186 2008-04-03 16:18:37 matthew Exp $ use strict; use Standard; @@ -53,7 +53,7 @@ sub main { ($out) = submit_update($q); } elsif ($q->param('submit_map')) { $params{title} = 'Reporting a problem'; - ($out) = display_form($q); + ($out, %params) = display_form($q); } elsif ($q->param('id')) { ($out, %params) = display_problem($q); $params{title} .= ' - Viewing a problem'; @@ -65,7 +65,9 @@ sub main { } print Page::header($q, %params); print $out; - print Page::footer($q); + my %footerparams; + $footerparams{js} = $params{js} if $params{js}; + print Page::footer($q, %footerparams); } Page::do_fastcgi(\&main); @@ -596,12 +598,14 @@ directly using their own website. </div> EOF $out .= Page::display_map_end(1); - $out .= <<EOF; -<script type="text/javascript"> + my %params = ( + js => <<EOF +<script type="text/javascript" defer> swfu = new SWFUpload(swfu_settings); </script> EOF - return $out; + ); + return ($out, %params); } sub display_location { @@ -800,14 +804,15 @@ $fixedline </form> EOF $out .= Page::display_map_end(0); - $out .= <<EOF; -<script type="text/javascript"> + my $js = <<EOF; +<script type="text/javascript" defer> swfu = new SWFUpload(swfu_settings); </script> EOF my %params = ( rss => [ 'Updates to this problem, FixMyStreet', "/rss/$input_h{id}" ], + js => $js, title => $problem->{title} ); return ($out, %params); |