diff options
author | matthew <matthew> | 2008-09-18 10:28:21 +0000 |
---|---|---|
committer | matthew <matthew> | 2008-09-18 10:28:21 +0000 |
commit | bf83c1a12ae721feed916afc11165502f0f36ce1 (patch) | |
tree | e4cfb3e3546326a07b88c0cc551f1f91da0253d5 | |
parent | af409c70aa38705958569388c900f5eca8bc761b (diff) |
Fix JS bug on individual problem page; escape pin title.
-rw-r--r-- | perllib/Page.pm | 4 | ||||
-rwxr-xr-x | web/faq.cgi | 4 | ||||
-rw-r--r-- | web/js.js | 62 |
3 files changed, 36 insertions, 34 deletions
diff --git a/perllib/Page.pm b/perllib/Page.pm index d7ed0f51a..7efab3896 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.112 2008-09-17 17:17:29 matthew Exp $ +# $Id: Page.pm,v 1.113 2008-09-18 10:28:21 matthew Exp $ # package Page; @@ -345,7 +345,7 @@ sub display_pin { . 'px; left:' . ($px) . 'px; position: absolute;">'; return $out unless $_ && $_->{id} && $col ne 'blue'; my $url = '/?id=' . $_->{id}; - $out = '<a title="' . $_->{title} . '" href="' . $url . '">' . $out . '</a>'; + $out = '<a title="' . ent($_->{title}) . '" href="' . $url . '">' . $out . '</a>'; return $out; } diff --git a/web/faq.cgi b/web/faq.cgi index cbb7d0039..477fa8014 100755 --- a/web/faq.cgi +++ b/web/faq.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: faq.cgi,v 1.32 2008-09-17 16:55:58 matthew Exp $ +# $Id: faq.cgi,v 1.33 2008-09-18 10:28:21 matthew Exp $ use strict; use Standard -db; @@ -31,7 +31,7 @@ sub faq { $q->dt(_('What is FixMyStreet for?')), $q->dd(_('FixMyStreet is a site to help people report, view, or discuss local problems they’ve found to their local council by -simply locating them on a map. It launched in beta early February +simply locating them on a map. It launched in early February 2007.')), $q->dt(_('Can you give me some examples?')), $q->dd(_('Sure. Graffiti, unlit lampposts, abandoned beds, broken @@ -58,12 +58,12 @@ YAHOO.util.Event.onContentReady('mapForm', function() { } this.x.value = x + 2; this.y.value = y + 2; - /* - if (swfu && swfu.getStats().files_queued > 0) { - swfu.startUpload(); - return false; - } - */ + /* + if (swfu && swfu.getStats().files_queued > 0) { + swfu.startUpload(); + return false; + } + */ return true; } }); @@ -126,9 +126,9 @@ function doSubmit(e) { e.cancelBubble = true; try { if (swfu.getStats().files_queued > 0) - swfu.startUpload(); - else - return true; + swfu.startUpload(); + else + return true; } catch (e) {} return false; } @@ -153,7 +153,7 @@ var swfu_settings = { swfupload_loaded_handler : function() { var d = document.getElementById("fieldset"); - if (d) d.onsubmit = doSubmit; + if (d) d.onsubmit = doSubmit; }, file_queued_handler : function(obj) { document.getElementById('txtfilename').value = obj.name; @@ -170,27 +170,27 @@ var swfu_settings = { upload_success_handler : function(obj, server_data) { obj.id = "singlefile"; var progress = new FileProgress(obj, this.customSettings.progress_target); - progress.setComplete(); + progress.setComplete(); progress.setStatus("Complete!"); - if (server_data == ' ') { - this.customSettings.upload_successful = false; - } else { - this.customSettings.upload_successful = true; - document.getElementById('upload_fileid').value = server_data; - } + if (server_data == ' ') { + this.customSettings.upload_successful = false; + } else { + this.customSettings.upload_successful = true; + document.getElementById('upload_fileid').value = server_data; + } }, upload_complete_handler : function(obj) { if (this.customSettings.upload_successful) { - var d = document.getElementById('update_post'); - if (d) d.disabled = 'true'; - uploadDone(); - } else { - obj.id = 'singlefile'; + var d = document.getElementById('update_post'); + if (d) d.disabled = 'true'; + uploadDone(); + } else { + obj.id = 'singlefile'; var progress = new FileProgress(obj, this.customSettings.progress_target); progress.setError(); progress.setStatus("File rejected"); - document.getElementById('txtfilename').value = ''; - } + document.getElementById('txtfilename').value = ''; + } }, upload_error_handler : uploadError, @@ -256,12 +256,14 @@ function update_tiles(dx, dy, force) { if (force) return; - url = [ '/ajax?sx=', document.getElementById('formX').value, ';sy=', - document.getElementById('formY').value, ';x=', (x+2), ';y=', (y+2) - ].join(''); - YAHOO.util.Connect.asyncRequest('GET', url, { - success: pins_loaded - }); + if (document.getElementById('formX')) { + url = [ '/ajax?sx=', document.getElementById('formX').value, ';sy=', + document.getElementById('formY').value, ';x=', (x+2), ';y=', (y+2) + ].join(''); + YAHOO.util.Connect.asyncRequest('GET', url, { + success: pins_loaded + }); + } } function pins_loaded(o) { |