diff options
author | matthew <matthew> | 2007-05-01 16:24:40 +0000 |
---|---|---|
committer | matthew <matthew> | 2007-05-01 16:24:40 +0000 |
commit | 6177cdfd1be022d9c45ce285651e2016c2a730bd (patch) | |
tree | f7a8b2bb7ec2384a9d9f04f6aa9d54df80827495 | |
parent | 66fcaf983d03babdef9e3279666989d3b1890591 (diff) |
Note stderr suppression not working; commit some old locale fix-it code,
and a couple of bugfixes.
-rw-r--r-- | perllib/Page.pm | 8 | ||||
-rwxr-xr-x | web/alert.cgi | 28 | ||||
-rwxr-xr-x | web/confirm.cgi | 46 | ||||
-rwxr-xr-x | web/faq.cgi | 224 | ||||
-rw-r--r-- | web/js.js | 2 | ||||
-rwxr-xr-x | web/report.cgi | 4 | ||||
-rw-r--r-- | web/xsl.xsl | 5 |
7 files changed, 139 insertions, 178 deletions
diff --git a/perllib/Page.pm b/perllib/Page.pm index 5913558fd..9927a3934 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.40 2007-04-11 10:34:48 matthew Exp $ +# $Id: Page.pm,v 1.41 2007-05-01 16:24:40 matthew Exp $ # package Page; @@ -87,7 +87,7 @@ EOF EOF my $home = !$title && $ENV{SCRIPT_NAME} eq '/index.cgi' && !$ENV{QUERY_STRING}; $html .= $home ? '<h1 id="header">' : '<div id="header"><a href="/">'; - $html .= 'Neighbourhood Fix-It <span id="beta">Beta</span>'; + $html .= 'Neighbourhood Fix-It <span id="beta">' . _('Beta') . '</span>'; $html .= $home ? '</h1>' : '</a></div>'; $html .= '<div id="wrapper"><div id="content">'; if (mySociety::Config::get('STAGING_SITE')) { @@ -200,4 +200,8 @@ sub prettify_epoch { return $tt; } +# Simply so I can gettext the code without making the locale stuff all work +sub _ { + return $_[0]; +} 1; diff --git a/web/alert.cgi b/web/alert.cgi index f706eb065..a4f7145b8 100755 --- a/web/alert.cgi +++ b/web/alert.cgi @@ -6,7 +6,7 @@ # Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved. # Email: matthew@mysociety.org. WWW: http://www.mysociety.org # -# $Id: alert.cgi,v 1.3 2007-02-02 23:24:01 matthew Exp $ +# $Id: alert.cgi,v 1.4 2007-05-01 16:24:40 matthew Exp $ use strict; require 5.8.0; @@ -47,9 +47,9 @@ sub main { if ($signed_email eq sha1_hex("$id-$email-$salt-$secret")) { my $alert_id = mySociety::Alert::create($email, 'new_updates', $id); mySociety::Alert::confirm($alert_id); - $out .= '<p>You have successfully subscribed to that alert.</p>'; + $out .= $q->p(_('You have successfully subscribed to that alert.')); } else { - $out = '<p>We could not validate that alert.</p>'; + $out = $q->p(_('We could not validate that alert.')); } } elsif (my $token = $q->param('token')) { my $data = mySociety::AuthToken::retrieve('alert', $token); @@ -57,21 +57,21 @@ sub main { my $type = $data->{type}; if ($type eq 'subscribe') { mySociety::Alert::confirm($id); - $out = '<p>You have successfully confirmed your alert.</p>'; + $out = $q->p(_('You have successfully confirmed your alert.')); } elsif ($type eq 'unsubscribe') { mySociety::Alert::delete($id); - $out = '<p>You have successfully deleted your alert.</p>'; + $out = $q->p(_('You have successfully deleted your alert.')); } } else { - $out = <<EOF; -<p>Thank you for trying to confirm your update or problem. We seem to have a + $out = $q->p(_(<<EOF)); +Thank you for trying to confirm your update or problem. We seem to have a problem ourselves though, so <a href="/contact">please let us know what went on</a> and we'll look into it. EOF } } elsif (my $email = $q->param('email')) { my @errors; - push @errors, 'Please enter a valid email address' unless is_valid_email($email); + push @errors, _('Please enter a valid email address') unless is_valid_email($email); if (@errors) { $out = display_form($q, @errors); } else { @@ -94,10 +94,10 @@ EOF } elsif ($q->param('id')) { $out = display_form($q); } else { - $out = '<p>Subscribe from a problem page!</p>'; + $out = $q->p(_('Subscribe from a problem page!')); } - print Page::header($q, 'Confirmation'); + print Page::header($q, _('Confirmation')); print $out; print Page::footer(); } @@ -113,14 +113,16 @@ sub display_form { if (@errors) { $out .= '<ul id="error"><li>' . join('</li><li>', @errors) . '</li></ul>'; } + $out .= $q->p(_('Receive email when updates are left on this problem.')); + my $label = _('Email:'); + my $subscribe = _('Subscribe'); $out .= <<EOF; -<p>Receive email when updates are left on this problem. <form action="alert" method="post"> -<label class="n" for="alert_email">Email:</label> +<label class="n" for="alert_email">$label</label> <input type="text" name="email" id="alert_email" value="$input_h{email}" size="30"> <input type="hidden" name="id" value="$input_h{id}"> <input type="hidden" name="type" value="updates"> -<input type="submit" value="Subscribe"> +<input type="submit" value="$subscribe"> </form> EOF return $out; diff --git a/web/confirm.cgi b/web/confirm.cgi index 72f9609bc..cc0e21a04 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.12 2007-03-21 22:41:48 matthew Exp $ +# $Id: confirm.cgi,v 1.13 2007-05-01 16:24:40 matthew Exp $ use strict; require 5.8.0; @@ -54,53 +54,49 @@ sub main { my $salt = unpack('h*', random_bytes(8)); my $secret = scalar(dbh()->selectrow_array('select secret from secret')); my $signed_email = sha1_hex("$problem_id-$email-$salt-$secret"); - $out = <<EOF; -<form action="/alert" method="post"> -<p>You have successfully confirmed your update and you can now <a href="/?id=$problem_id#update_$id">view it on the site</a>.</p> -<p>You could also -<a href="/rss/$problem_id">subscribe to the RSS feed</a> of updates by other local people on this problem, -or + $out = '<form action="/alert" method="post">'; + $out .= $q->p(sprintf(_('You have successfully confirmed your update and you can now <a href="%s">view it on the site</a>.'), "/?id=$problem_id#update_$id")); + my $signup = <<EOF; <input type="hidden" name="signed_email" value="$salt,$signed_email"> <input type="hidden" name="email" value="$email"> <input type="hidden" name="id" value="$problem_id"> <input type="hidden" name="type" value="updates"> -<input type="submit" value="sign up"> if you wish to receive updates by email. -</p> -</form> EOF + $signup .= '<input type="submit" value="' . _('sign up') . '">'; + $out .= $q->p(sprintf(_('You could also <a href="%s">subscribe to the RSS feed</a> of updates by other local people on this problem, or %s if you wish to receive updates by email.'), "/rss/$problem_id", $signup)); + $out .= '</form>'; } elsif ($type eq 'problem') { dbh()->do("update problem set state='confirmed' where id=? and state='unconfirmed'", {}, $id); - my ($email, $council) = dbh()->selectrow_array("select email, council from problem where id=?", {}, $id); - $council = $council ? ' and <strong>we will now send it to the council</strong>' : ''; + my ($email, $council) = dbh()->selectrow_array("select email, council from problem where id=?", {}, $id); my $salt = unpack('h*', random_bytes(8)); my $secret = scalar(dbh()->selectrow_array('select secret from secret')); my $signed_email = sha1_hex("$id-$email-$salt-$secret"); - $out = <<EOF; -<form action="/alert" method="post"> -<p>You have successfully confirmed your problem$council. -You can <a href="/?id=$id">view the problem on this site</a>.</p> -<p>You could also -<a href="/rss/$id">subscribe to the RSS feed</a> of updates by other local people on this problem, -or + $out = '<form action="/alert" method="post">'; + $out .= $q->p( + _('You have successfully confirmed your problem') + . ($council ? _(' and <strong>we will now send it to the council</strong>') : '') + . sprintf(_('You can <a href="%s">view the problem on this site</a>.'), "/?id=$id") + ); + my $signup = <<EOF; <input type="hidden" name="signed_email" value="$salt,$signed_email"> <input type="hidden" name="email" value="$email"> <input type="hidden" name="id" value="$id"> <input type="hidden" name="type" value="updates"> -<input type="submit" value="sign up"> if you wish to receive updates by email. -</p> -</form> EOF + $signup .= '<input type="submit" value="' . _('sign up') . '">'; + $out .= $q->p(sprintf(_('You could also <a href="%s">subscribe to the RSS feed</a> of updates by other local people on this problem, or %s if you wish to receive updates by email.'), "/rss/$id", $signup)); + $out .= '</form>'; } dbh()->commit(); } else { - $out = <<EOF; -<p>Thank you for trying to confirm your update or problem. We seem to have a + $out = $q->p(_(<<EOF)); +Thank you for trying to confirm your update or problem. We seem to have a problem ourselves though, so <a href="/contact">please let us know what went on</a> and we'll look into it. EOF } - print Page::header($q, 'Confirmation'); + print Page::header($q, _('Confirmation')); print $out; print Page::footer(); } diff --git a/web/faq.cgi b/web/faq.cgi index c5c7675d7..5620c66a2 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.15 2007-04-27 19:37:29 matthew Exp $ +# $Id: faq.cgi,v 1.16 2007-05-01 16:24:40 matthew Exp $ use strict; require 5.8.0; @@ -20,150 +20,110 @@ use Page; # Main code for index.cgi sub main { my $q = shift; - print Page::header($q, 'FAQ'); - print faq(); + print Page::header($q, _('FAQ')); + print faq($q); print Page::footer(); } Page::do_fastcgi(\&main); sub faq { - my $out = <<EOF; -<h1>Frequently Asked Questions</h1> - -<dl> - -<dt>What is Neighbourhood Fix-It for?</dt> -<dd>Neighbourhood Fix-It 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 2007.</dd> - -<dt>Can you give me some examples?</dt> -<dd>Sure. Graffiti, unlit lampposts, abandoned beds, broken glass on a cycle -path; anything like that that could be usefully reported to your council -to be fixed.</dd> - -<dt>How do I use the site?</dt> -<dd>After entering a postcode or location, you are presented with a map of that -area. You can view problems already reported in that area, or report -ones of your own simply by clicking on the map at the location of the -problem.</dd> - -<dt>How are the problems solved?</dt> -<dd>They are reported to the relevant council by email. The council can -then resolve the problem the way they normally would. Alternatively, you -can discuss the problem on the website with others, and then together lobby -the council to fix it, or fix it directly yourselves. -</dd> - -<dt>Is it free?</dt> -<dd>The site is free to use, yes. Neighbourhood Fix-It -is run by a registered charity, though, so if you want to make -a contribution, <a href="https://secure.mysociety.org/donate/">please do</a>.</dd> - -</dl> - -<h2>Practical Questions</h2> -<dl> - -<dt>I'm from a council, where do you send the reports?</dt> -<dd>You can either leave a test report or <a href="/contact">contact us</a> + my $q = shift; + my $out = $q->h1(_('Frequently Asked Questions')); + $out .= $q->dl( + $q->dt(_('What is Neighbourhood Fix-It for?')), + $q->dd(_('Neighbourhood Fix-It 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 +2007.')), + $q->dt(_('Can you give me some examples?')), + $q->dd(_('Sure. Graffiti, unlit lampposts, abandoned beds, broken +glass on a cycle path; anything like that that could be usefully reported to +your council to be fixed.')), + $q->dt(_('How do I use the site?')), + $q->dd(_('After entering a postcode or location, you are presented +with a map of that area. You can view problems already reported in that area, +or report ones of your own simply by clicking on the map at the location of +the problem.')), + $q->dt(_('How are the problems solved?')), + $q->dd(_('They are reported to the relevant council by email. The +council can then resolve the problem the way they normally would. +Alternatively, you can discuss the problem on the website with others, and +then together lobby the council to fix it, or fix it directly yourselves.')), + $q->dt(_('Is it free?')), + $q->dd(_('The site is free to use, yes. Neighbourhood Fix-It is run +by a registered charity, though, so if you want to make a contribution, <a +href="https://secure.mysociety.org/donate/">please do</a>.')), + ); + $out .= $q->h2(_('Practical Questions')); + $out .= $q->dl( + $q->dt(_("I'm from a council, where do you send the reports?")), + $q->dd(_('You can either leave a test report or <a href="/contact">contact us</a> to find out where reports go at the moment. Also <a href="/contact">contact us</a> -to update the address or addresses we use. -</dd> - -<dt>Do you remove silly or illegal content?</dt> -<dd>We reserve the right to remove any problems or updates which we -consider to be inappropriate.</dd> - -<dt>Why doesn't dragging the map work on reporting-a-problem pages in Safari?</dt> -<dd> -There's a bug in Safari to do with setting images on form submits, which the map -is when reporting a problem. It's fixed in the latest nightly build of Safari, so -will presumably be fixed in the next release. Until then, I've sadly had to disable -dragging to avoid people dragging an empty square. -</dd> - - -</dl> - -<h2>Privacy Questions</h2> -<dl> - -<dt>Who gets to see my email address?</dt> -<dd>If you submit a problem, we pass on your details, and details -of the problem, to the council contact or contacts responsible for the area where you -located the problem. Your name is displayed upon the site, but not your email address; -similarly with updates. - -We will never give or sell your -email address to anyone else, unless we are obliged to by law. - -</dd> - -<dt>Will you send nasty, brutish spam to my email address?</dt> -<dd>Never. We will email you a month after you submit a problem, asking for a status -update. You can also opt in to receive emails about updates to a particular problem. -</dd> - -</dl> - -<h2>Organisation Questions</h2> - -<dl> - -<dt>Who built Neighbourhood Fix-It?</dt> -<dd>This site was built by <a href="http://www.mysociety.org">mySociety</a>. -mySociety is the project of a reigstered charity which has grown out of the community of +to update the address or addresses we use.')), + $q->dt(_('Do you remove silly or illegal content?')), + $q->dd(_('We reserve the right to remove any problems or updates +which we consider to be inappropriate.')), + $q->dt(_("Why doesn't dragging the map work on reporting-a-problem pages in Safari?")), + $q->dd(_("There's a bug in Safari to do with setting images on form +submits, which the map is when reporting a problem. It's fixed in the +latest nightly build of Safari, so will presumably be fixed in the next +release. Until then, I've sadly had to disable dragging to avoid people +dragging an empty square.")) + ); + $out .= $q->h2(_('Privacy Questions')); + $out .= $q->dl( + $q->dt(_('Who gets to see my email address?')), + $q->dd(_('If you submit a problem, we pass on your details, and details +of the problem, to the council contact or contacts responsible for the +area where you located the problem. Your name is displayed upon the +site, but not your email address; similarly with updates. We will +never give or sell your email address to anyone else, unless we are +obliged to by law.')), + $q->dt(_('Will you send nasty, brutish spam to my email address?')), + $q->dd(_('Never. We will email you a month after you submit a +problem, asking for a status update. You can also opt in to receive emails +about updates to a particular problem.')) + ); + $out .= $q->h2(_('Organisation Questions')); + $out .= $q->dl( + $q->dt(_('Who built Neighbourhood Fix-It?')), + $q->dd(_('This site was built by <a href="http://www.mysociety.org">mySociety</a>. +mySociety is the project of a registered charity which has grown out of the community of volunteers who built sites like <a href="http://www.theyworkforyou.com/">TheyWorkForYou.com</a>. -mySociety’s primary -mission is to build Internet projects which give people simple, tangible +mySociety’s primary mission is to build Internet projects which give people simple, tangible benefits in the civic and community aspects of their lives. Our first project was <a href="http://www.writetothem.com/">WriteToThem.com</a>, where you can write to any of your -elected representatives, for free.</dd> - -<dt>Who pays for it?</dt> -<dd>Neighbourhood Fix-It was paid for via the -Department for Constitutional Affairs Innovations Fund. -</dd> - -<dt>Do you need any help with the project?</dt> -<dd>Yes, we can use help in all sorts of ways, technical or non-technical. -Please see our <a href="http://www.mysociety.org/volunteertasks">volunteers page</a>.</dd> - -<dt>Where’s the "source code" to this site?</dt> -<dd>The software behind this site is open source, and available to you -mainly under the Affero GPL software license. You can <a -href="https://secure.mysociety.org/cvstrac/dir?d=mysociety">download the source -code</a> (look under ‘bci’) and help us develop it. You’re welcome to use it -in your own projects, although you must also make available the source code to -any such projects. -</dd> - -<dt>People build things, not organisations. Who <em>actually</em> built it?</dt> -<dd>OK, we are -Francis Irving, -Chris Lightfoot, -Richard Pope, -Matthew Somerville, -and -Tom Steinberg. +elected representatives, for free.')), + $q->dt(_('Who pays for it?')), + $q->dd(_('Neighbourhood Fix-It was paid for via the Department for +Constitutional Affairs Innovations Fund.')), + $q->dt(_('Do you need any help with the project?')), + $q->dd(_('Yes, we can use help in all sorts of ways, technical or +non-technical. Please see our <a +href="http://www.mysociety.org/volunteertasks">volunteers page</a>.')), + $q->dt(_('Where’s the "source code" to this site?')), + $q->dd(_('The software behind this site is open source, and available +to you mainly under the Affero GPL software license. You can <a +href="https://secure.mysociety.org/cvstrac/dir?d=mysociety">download the +source code</a> (look under ‘bci’) and help us develop it. +You’re welcome to use it in your own projects, although you must also +make available the source code to any such projects.')), + $q->dt(_('People build things, not organisations. Who <em>actually</em> built it?')), + $q->dd(_('OK, we are Francis Irving, Chris Lightfoot, Richard Pope, +Matthew Somerville, and Tom Steinberg. Thanks also to -<a href="http://www.ordnancesurvey.co.uk">Ordnance Survey</a> (for the maps, UK postcodes, and -UK addresses – data © Crown copyright, all rights reserved, Department for -Constitutional Affairs 100037819 2007), -Yahoo! for their BSD-licensed JavaScript libraries, -the entire free software community (this particular project was brought to you by -Perl, PostgreSQL, and the number 161.290) and -<a href="http://www.easynet.net/publicsector/">Easynet</a> (who kindly host all +<a href="http://www.ordnancesurvey.co.uk">Ordnance Survey</a> (for the maps, +UK postcodes, and UK addresses – data © Crown copyright, all +rights reserved, Department for Constitutional Affairs 100037819 2007), +Yahoo! for their BSD-licensed JavaScript libraries, the entire free software +community (this particular project was brought to you by Perl, PostgreSQL, +and the number 161.290) and <a +href="http://www.easynet.net/publicsector/">Easynet</a> (who kindly host all our servers). -Let us know if we’ve missed anyone. -</dd> - -</dl> - -EOF +Let us know if we’ve missed anyone.')) + ); return $out; } @@ -37,7 +37,7 @@ YAHOO.util.Event.onContentReady('compass', function() { YAHOO.util.Event.onContentReady('map', function() { var ua=navigator.userAgent.toLowerCase(); - if (document.getElementById('mapForm') && /safari/.test(ua)) return; + if (document.getElementById('mapForm') && (/safari/.test(ua) || /Konqueror/.test(ua))) return; new YAHOO.util.DDMap('map'); update_tiles(0, 0, true); diff --git a/web/report.cgi b/web/report.cgi index ea9395eef..c0afd6385 100755 --- a/web/report.cgi +++ b/web/report.cgi @@ -6,7 +6,7 @@ # Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved. # Email: matthew@mysociety.org. WWW: http://www.mysociety.org # -# $Id: report.cgi,v 1.5 2007-04-23 18:15:40 francis Exp $ +# $Id: report.cgi,v 1.6 2007-05-01 16:24:40 matthew Exp $ use strict; require 5.8.0; @@ -61,7 +61,7 @@ sub main { my $areas_info = mySociety::MaPit::get_voting_areas_info([keys %out]); print Page::header($q, 'Summary reports'); if (!$one_council) { - print $q->p('This is a summary of all reports on this site, select \'show only\' to see the reports for just one council..'); + print $q->p('This is a summary of all reports on this site, select \'show only\' to see the reports for just one council.'); } else { print $q->p('This is a summary of all reports for one council.', $q->a({href => NewURL($q, 'council'=>undef) }, 'Show all councils.')); diff --git a/web/xsl.xsl b/web/xsl.xsl index 73e815fc2..b02dd2da8 100644 --- a/web/xsl.xsl +++ b/web/xsl.xsl @@ -22,9 +22,8 @@ <li><a href="/contact">Contact</a></li> </ul> -<p id="footer">Built by <a href="http://www.mysociety.org/">mySociety</a>. -Using lots of <a href="http://www.ordnancesurvey.co.uk/">Ordnance Survey</a> data, under licence, -and some <a href="https://secure.mysociety.org/cvstrac/dir?d=mysociety/bci">clever</a> <a +<p id="footer">Built by <a href="http://www.mysociety.org/">mySociety</a>, +using some <a href="https://secure.mysociety.org/cvstrac/dir?d=mysociety/bci">clever</a> <a href="https://secure.mysociety.org/cvstrac/dir?d=mysociety/services/TilMa">code</a>.</p> </body> |