diff options
author | matthew <matthew> | 2008-05-15 16:09:51 +0000 |
---|---|---|
committer | matthew <matthew> | 2008-05-15 16:09:51 +0000 |
commit | cb679d86451e657b0c5de603def6a76b2dd6de71 (patch) | |
tree | c4f70385326aea28c10d491b340635579f7f3903 | |
parent | f4f1efdd55dfced30d61f98c98e0ea27866ab81d (diff) |
EHA text/template tweaks, get sending of reports working.
-rwxr-xr-x | bin/gettext-extract | 7 | ||||
-rwxr-xr-x | bin/make_emptyhomes_po | 2 | ||||
-rwxr-xr-x | bin/send-reports | 157 | ||||
-rw-r--r-- | perllib/Page.pm | 4 | ||||
-rw-r--r-- | templates/emails/alert-update | 2 | ||||
-rw-r--r-- | templates/website/emptyhomes-header | 23 | ||||
-rwxr-xr-x | web-admin/index.cgi | 6 | ||||
-rw-r--r-- | web/css/emptyhomes.css | 37 | ||||
-rw-r--r-- | web/css/main-scambs.css | 10 | ||||
-rwxr-xr-x | web/faq.cgi | 78 | ||||
-rwxr-xr-x | web/index.cgi | 49 | ||||
-rwxr-xr-x | web/reports.cgi | 22 |
12 files changed, 276 insertions, 121 deletions
diff --git a/bin/gettext-extract b/bin/gettext-extract index eb2682701..d0d8cbb1d 100755 --- a/bin/gettext-extract +++ b/bin/gettext-extract @@ -7,7 +7,7 @@ # Copyright (c) 2008 UK Citizens Online Democracy. All rights reserved. # Email: matthew@mysociety.org; WWW: http://www.mysociety.org/ # -# $Id: gettext-extract,v 1.2 2008-05-15 09:26:56 matthew Exp $ +# $Id: gettext-extract,v 1.3 2008-05-15 16:09:51 matthew Exp $ if [ -e ../../locale ] then @@ -57,8 +57,7 @@ cat $PO | sed " " >> $TEMP mv $TEMP $PO -# XXX: Email templates - should be in >1 language... -# And the XSL page too. +# XXX The XSL page needs including? # Extract email templates echo >> $PO @@ -67,7 +66,7 @@ for X in bci/templates/emails/* do # TODO: Should check for "*~" type filenames too, and do the *-livesimply case # with wildcards rather than checking per template - if [ "$X" != "bci/templates/emails/CVS" -a "$X" != "bci/templates/emails/empty property-confirm" ] + if [ "$X" != "bci/templates/emails/CVS" -a "$X" != "bci/templates/emails/empty property-confirm" -a "$X" != "bci/templates/emails/submit-eha" ] then echo >> $PO echo "#: $X" >> $PO diff --git a/bin/make_emptyhomes_po b/bin/make_emptyhomes_po index bd8f5c97a..0e59ee28d 100755 --- a/bin/make_emptyhomes_po +++ b/bin/make_emptyhomes_po @@ -63,7 +63,7 @@ while(<MAINPO>) { $buffer =~ s/\bproblems\b/empty properties/g; $buffer =~ s/\bProblems\b/Empty properties/g; $buffer =~ s/a empty/an empty/g; - $buffer =~ s/fixed/put back into use/g; + $buffer =~ s/fixed/returned to use/g; $buffer =~ s/Recently put back into use empty properties/Recent empty properties put back into use/; diff --git a/bin/send-reports b/bin/send-reports index 23755bb3a..f1901d055 100755 --- a/bin/send-reports +++ b/bin/send-reports @@ -6,7 +6,7 @@ # Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved. # Email: matthew@mysociety.org. WWW: http://www.mysociety.org # -# $Id: send-reports,v 1.49 2008-05-15 09:26:56 matthew Exp $ +# $Id: send-reports,v 1.50 2008-05-15 16:09:51 matthew Exp $ use strict; require 5.8.0; @@ -18,7 +18,7 @@ use lib "$FindBin::Bin/../../perllib"; use File::Slurp; use mySociety::Config; -use mySociety::DBHandle qw(dbh select_all); +use mySociety::DBHandle qw(dbh); use mySociety::Email; use mySociety::EmailUtil; use mySociety::MaPit; @@ -44,13 +44,24 @@ $nomail = 1 if (@ARGV==1 && $ARGV[0] eq '--nomail'); $verbose = 1 if (@ARGV==1 && $ARGV[0] eq '--verbose'); $verbose = 1 if $nomail; -my (%notgot, %note); -my $unsent = dbh()->selectall_arrayref( - "SELECT id, council, category, title, detail, name, email, phone, used_map, - easting, northing, (photo is not null) as has_photo +my $base_url = mySociety::Config::get('BASE_URL'); +my $site = 'fixmystreet'; +$site = 'emptyhomes' if $base_url =~ 'emptyhomes' || $base_url eq 'http://matthew.fixmystreet.com'; # XXX + +my $query; +if ($site eq 'emptyhomes') { + $query = "SELECT id, title, detail, name, email, phone, used_map, easting, + northing, (photo is not null) as has_photo + FROM problem WHERE state in ('confirmed','fixed') AND whensent IS NULL"; +} else { + $query = "SELECT id, council, category, title, detail, name, email, phone, + used_map, easting, northing, (photo is not null) as has_photo FROM problem WHERE state in ('confirmed','fixed') AND whensent IS NULL - AND council IS NOT NULL", { Slice => {} }); + AND council IS NOT NULL"; +} +my $unsent = dbh()->selectall_arrayref($query, { Slice => {} }); +my (%notgot, %note); foreach my $row (@$unsent) { if (dbh()->selectrow_array('select email from abuse where lower(email)=?', {}, lc($row->{email}))) { @@ -58,76 +69,88 @@ foreach my $row (@$unsent) { dbh()->commit(); next; } - # XXX Needs locks! - my @all_councils = split /,|\|/, $row->{council}; - my ($councils, $missing) = $row->{council} =~ /^([\d,]+)(?:\|([\d,]+))?/; - my @councils = split /,/, $councils; - my $areas_info = mySociety::MaPit::get_voting_areas_info(\@all_councils); - my (@to, @dear, %recips); - my $all_confirmed = 1; - foreach my $council (@councils) { - my $name = $areas_info->{$council}->{name}; - my ($council_email, $confirmed, $note) = dbh()->selectrow_array( - "SELECT email,confirmed,note FROM contacts WHERE deleted='f' - and area_id=? AND category=?", {}, $council, $row->{category}); - $council_email = essex_contact($row->{easting}, $row->{northing}) if $council == 2225; - $council_email = notts_contact($row->{easting}, $row->{northing}) if $council == 2236; - unless ($confirmed) { - $all_confirmed = 0; - $note = 'Council ' . $row->{council} . ' deleted' - unless $note; - $council_email = 'N/A' unless $council_email; - $notgot{$council_email}{$row->{category}}++; - $note{$council_email}{$row->{category}} = $note; - } - push @to, [ $council_email, $name ]; - push @dear, $name; - $recips{$council_email} = 1; - } - my @recips = keys %recips; - if (!@to) { - if ($verbose) { - print 'Need to send problem #' . $row->{id} . ' to council(s) ' . join(',',@recips) . "\n"; - print " ...but we have no contact details for any of them!\n"; - } - next; - } - next unless ($all_confirmed); - push @recips, mySociety::Config::get('CONTACT_EMAIL'); - - my $template = File::Slurp::read_file("$FindBin::Bin/../templates/emails/submit-council"); + # Template variables for the email my %h = map { $_ => $row->{$_} } qw/title detail name email phone category/; $h{phone} = "Phone: $h{phone}\n\n" if $h{phone}; $h{has_photo} = ''; $h{has_photo} = "This web page also contains a photo of the problem, provided by the user.\n\n" if $row->{has_photo}; - if ($h{category} eq 'Other') { - $h{category_footer} = 'this type of local problem'; - $h{category} = ''; - } else { - $h{category_footer} = "'" . $h{category} . "'"; - $h{category} = "Category: $h{category}\n\n"; - } - $h{url} = mySociety::Config::get('BASE_URL') . '/?id=' . $row->{id}; - $h{councils_name} = join(' and ', @dear); + $h{url} = $base_url . '/?id=' . $row->{id}; $h{fuzzy} = $row->{used_map} ? 'To view a map of the precise location of this issue' : 'The user could not locate the problem on a map, but to see the area around the location they entered'; - $h{multiple} = @dear>1 ? "[ This email has been sent to both councils covering the location of the problem, as the user did not categorise it; please ignore it if you're not the correct council to deal with the issue, or let us know what category of problem this is so we can add it to our system. ]\n\n" - : ''; - $h{missing} = ''; - if ($missing) { - my $name = $areas_info->{$missing}->{name}; - $h{missing} = '[ We realise this problem might be the responsibility of ' . $name - . "; however, we don't currently have any contact details for them. -If you know of an appropriate contact address, please do get in touch. ]\n\n"; - } - $h{closest_address} = ''; my ($address, $distance) = mySociety::Dress::find_nearest($row->{easting}, $row->{northing}); $h{closest_address} = sprintf("The closest address, as the crow flies, to the location of this problem, %.0fm away, is: %s - please note that this is automatically generated, so ensure that you check it against the details provided by the user and, if possible, the map.\n\n", - $distance, $address) if ($address); + $distance, $address) if $address; + + my (@to, @recips, $template); + if ($site eq 'emptyhomes') { + @to = ( [ 'matthew@mysociety.org', 'Empty Homes Agency' ] ); + @recips = ('matthew@mysociety.org'); + $template = File::Slurp::read_file("$FindBin::Bin/../templates/emails/submit-eha"); + } else { + # XXX Needs locks! + my @all_councils = split /,|\|/, $row->{council}; + my ($councils, $missing) = $row->{council} =~ /^([\d,]+)(?:\|([\d,]+))?/; + my @councils = split /,/, $councils; + my $areas_info = mySociety::MaPit::get_voting_areas_info(\@all_councils); + my (@dear, %recips); + my $all_confirmed = 1; + foreach my $council (@councils) { + my $name = $areas_info->{$council}->{name}; + my ($council_email, $confirmed, $note) = dbh()->selectrow_array( + "SELECT email,confirmed,note FROM contacts WHERE deleted='f' + and area_id=? AND category=?", {}, $council, $row->{category}); + $council_email = essex_contact($row->{easting}, $row->{northing}) if $council == 2225; + $council_email = notts_contact($row->{easting}, $row->{northing}) if $council == 2236; + unless ($confirmed) { + $all_confirmed = 0; + $note = 'Council ' . $row->{council} . ' deleted' + unless $note; + $council_email = 'N/A' unless $council_email; + $notgot{$council_email}{$row->{category}}++; + $note{$council_email}{$row->{category}} = $note; + } + push @to, [ $council_email, $name ]; + push @dear, $name; + $recips{$council_email} = 1; + } + my @recips = keys %recips; + if (!@to) { + if ($verbose) { + print 'Need to send problem #' . $row->{id} . ' to council(s) ' . join(',',@recips) . "\n"; + print " ...but we have no contact details for any of them!\n"; + } + next; + } + next unless ($all_confirmed); + + $template = File::Slurp::read_file("$FindBin::Bin/../templates/emails/submit-council"); + + if ($h{category} eq 'Other') { + $h{category_footer} = 'this type of local problem'; + $h{category} = ''; + } else { + $h{category_footer} = "'" . $h{category} . "'"; + $h{category} = "Category: $h{category}\n\n"; + } + + $h{councils_name} = join(' and ', @dear); + $h{multiple} = @dear>1 ? "[ This email has been sent to both councils covering the location of the problem, as the user did not categorise it; please ignore it if you're not the correct council to deal with the issue, or let us know what category of problem this is so we can add it to our system. ]\n\n" + : ''; + $h{missing} = ''; + if ($missing) { + my $name = $areas_info->{$missing}->{name}; + $h{missing} = '[ We realise this problem might be the responsibility of ' . $name + . "; however, we don't currently have any contact details for them. +If you know of an appropriate contact address, please do get in touch. ]\n\n"; + } + } + + push @recips, mySociety::Config::get('CONTACT_EMAIL'); + my $email = mySociety::Email::construct_email({ - _template_ => _($template), + _template_ => $template, _parameters_ => \%h, To => \@to, From => [ $row->{email}, $row->{name} ], @@ -135,7 +158,7 @@ If you know of an appropriate contact address, please do get in touch. ]\n\n"; }); my $result; - if (mySociety::Config::get('STAGING_SITE') || $nomail) { + if ($nomail) { $result = -1; } else { $result = mySociety::EmailUtil::send_email($email, mySociety::Config::get('CONTACT_EMAIL'), @recips); diff --git a/perllib/Page.pm b/perllib/Page.pm index cbf694227..fbeb1afe4 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.100 2008-05-15 09:26:56 matthew Exp $ +# $Id: Page.pm,v 1.101 2008-05-15 16:09:51 matthew Exp $ # package Page; @@ -150,7 +150,7 @@ EOF $html =~ s#<!-- RSS -->#<link rel="alternate" type="application/rss+xml" title="$params{rss}[0]" href="$params{rss}[1]">#; } if (mySociety::Config::get('STAGING_SITE')) { - $html .= '<p id="error">This is a developer site; things might break at any time, and councils are not sent emails (they\'d get annoyed!).</p>'; + $html .= '<p id="error">This is a developer site; things might break at any time.</p>'; } return $html; } diff --git a/templates/emails/alert-update b/templates/emails/alert-update index 1f8c45665..bed854db5 100644 --- a/templates/emails/alert-update +++ b/templates/emails/alert-update @@ -9,5 +9,5 @@ View or reply to these updates: <?=$values['problem_url']?> -- The FixMyStreet team -To stop receiving emails when there are new comments on this problem, +To stop receiving emails when there are new updates on this problem, please follow this link: <?=$values['unsubscribe_url']?> diff --git a/templates/website/emptyhomes-header b/templates/website/emptyhomes-header index 9c839fe77..75213e273 100644 --- a/templates/website/emptyhomes-header +++ b/templates/website/emptyhomes-header @@ -43,17 +43,20 @@ www.emptyhomes.com</small></p> <a href="http://www.emptyhomes.com/">Home</a> | <a href="http://www.emptyhomes.com/contact_us.html">Contact Us</a> | <a href="http://www.emptyhomes.com/sitemap.html">Site Map</a> | <a href="http://www.emptyhomes.com/disclaimer.html">Disclaimer</a> </div> <div id="main"><div id="left"> <ul> -<li><a href="http://www.emptyhomes.com/aboutus/about_us.html">What We Do </a></li> +<li><a href="http://www.emptyhomes.com/aboutus/whatwedo/what_we_do.html">What We Do </a></li> +<li><a href="http://www.emptyhomes.com/rescue/buying_empties.html">Rescue An Empty Property</a> <ol> -<li><a href="http://www.emptyhomes.com/aboutus/whatwedo/what_we_do.html">What We Do</a></li> -<li><a href="http://www.emptyhomes.com/aboutus/projects.html">Projects</a></li> -<li><a href="http://www.emptyhomes.com/aboutus/latestnews/latest_news.html">Latest News</a></li> -<li><a href="http://www.emptyhomes.com/aboutus/events.html">Events</a></li> -<li><a href="http://www.emptyhomes.com/aboutus/jobs.html">Jobs</a></li> -<li><a href="http://www.emptyhomes.com/aboutus/volunteer.html">Volunteer</a></li> -<li><a href="http://www.emptyhomes.com/aboutus/finance.html">Finance</a></li> -</ol> -<li><a href="http://www.emptyhomes.com/rescue/buying_empties.html">Rescue An Empty Property</a></li> + <li><a href="http://www.emptyhomes.com/rescue/buying_empties.html">Buying Empty Homes</a></li> + <li><a href="http://www.emptyhomes.com/rescue/owning_an_empty.html">Owning Empty Homes</a></li> + <li><a href="http://www.emptyhomes.com/rescue/campaigning_on_empties.html">Campaigning On Empty Homes</a></li> + <li><a href="/">Report an Empty Home</a> + <ul> + <li><a href="/reports">All reports</a></li> + <li><a href="/alert">Local alerts</a></li> + <li><a href="/faq">Help</a></li> + </ul> + </li> +</ol></li> <li><a href="http://www.emptyhomes.com/resources/papers_publications/publications.html">Papers & Publications </a></li> </ul> diff --git a/web-admin/index.cgi b/web-admin/index.cgi index 31f26ece1..a9669c036 100755 --- a/web-admin/index.cgi +++ b/web-admin/index.cgi @@ -7,10 +7,10 @@ # Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved. # Email: francis@mysociety.org; WWW: http://www.mysociety.org/ # -# $Id: index.cgi,v 1.48 2008-04-11 11:38:08 francis Exp $ +# $Id: index.cgi,v 1.49 2008-05-15 16:09:53 matthew Exp $ # -my $rcsid = ''; $rcsid .= '$Id: index.cgi,v 1.48 2008-04-11 11:38:08 francis Exp $'; +my $rcsid = ''; $rcsid .= '$Id: index.cgi,v 1.49 2008-05-15 16:09:53 matthew Exp $'; use strict; @@ -110,7 +110,7 @@ sub do_summary ($) { map { dbh()->selectrow_array($_->[0]) . " " . $_->[1] } ( ['select count(*) from contacts', 'contacts'], ['select count(*) from problem', 'problems'], - ['select count(*) from comment', 'comments'], + ['select count(*) from comment', 'updates'], ['select count(*) from questionnaire', 'questionnaires'], ['select count(*) from alert', 'alerts'] ))); diff --git a/web/css/emptyhomes.css b/web/css/emptyhomes.css index 813904b07..d4fa75e06 100644 --- a/web/css/emptyhomes.css +++ b/web/css/emptyhomes.css @@ -6,6 +6,7 @@ p#expl { float: none; } +/* Smaller map */ #map_box { width: 380px; } @@ -13,10 +14,22 @@ p#expl { width: 378px; height: 378px; } +#watermark { + background: url("/i/mojwatermark-378.png"); + height: 84px; + width: 171px; + position: absolute; + bottom: 0; + right: 0; +} #toptitle { margin-top: 0.5em; } + +#left { + width: auto; +} #middle { width: 600px; } @@ -51,6 +64,7 @@ p#fixed, p#unknown { margin: 0.5em 0 0.25em; } +/* So IE and Firefox match */ #left ol { padding: 0; } @@ -72,7 +86,6 @@ blockquote { _width: 500px; } - #front_stats div { padding: 0.5em 0; width: 6em; @@ -82,13 +95,21 @@ blockquote { clear: both; } -#watermark { - background: url("/i/mojwatermark-378.png"); - height: 84px; - width: 171px; - position: absolute; - bottom: 0; - right: 0; +/* Slightly narrower so it fits */ +#col_problems, #col_fixed { + width: 45%; } +/* Sub nav for the internal bits */ +#left ol ul { + font-size: 90%; +} +#left ol ul a { + padding: 4px 0 4px 20px; + background-color: #ffffff; +} +#left ol ul a:hover { + background-color: #B1BECF; + background-color: #DCDCED; +} diff --git a/web/css/main-scambs.css b/web/css/main-scambs.css index a8fb0a548..57f4a0b4b 100644 --- a/web/css/main-scambs.css +++ b/web/css/main-scambs.css @@ -17,6 +17,7 @@ blockquote { width: 7em; } +/* Smaller map */ #map_box { width: 380px; } @@ -24,4 +25,13 @@ blockquote { width: 378px; height: 378px; } +#watermark { + display: none; + background: url("/i/mojwatermark-378.png"); + height: 84px; + width: 171px; + position: absolute; + bottom: 0; + right: 0; +} diff --git a/web/faq.cgi b/web/faq.cgi index 928c49834..4e3ce614e 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.30 2008-05-13 12:39:17 matthew Exp $ +# $Id: faq.cgi,v 1.31 2008-05-15 16:09:52 matthew Exp $ use strict; use Standard -db; @@ -15,7 +15,11 @@ use Standard -db; sub main { my $q = shift; print Page::header($q, title=>_('FAQ')); - print faq($q); + if ($q->{site} eq 'emptyhomes') { + print emptyhomes_faq($q); + } else { + print faq($q); + } print Page::footer($q); } Page::do_fastcgi(\&main); @@ -130,3 +134,73 @@ Let us know if we’ve missed anyone.')) return $out; } +sub emptyhomes_faq { + my $q = shift; + my $out = $q->h1('Frequently Asked Questions'); + $out .= $q->dl( + $q->dt('What is this site for?'), + $q->dd('This site is to help provide a public record of +empty properties in Great Britain. It expands upon our telephone hotline +for empty homes in the London area, and allows local authorities, related +organisations and the public to view reported empty homes and update +their status, and report new empty properties.'), + $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('Is it free?'), + $q->dd('The site is free to use, yes. The Empty Homes Agency is +a registered charity, though, so if you want to make a contribution, +please do.'), + $q->dt(_('Do you remove silly or illegal content?')), + $q->dd(_('We reserve the right to remove any reports or updates +which we consider to be inappropriate.')), + ); + $out .= $q->h2(_('Privacy Questions')); + $out .= $q->dl( + $q->dt('Who gets to see my email address?'), + $q->dd('If you submit an empty property, your details are obviously provided to us. +Your name is displayed upon the site if you let us, 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\'ll only ever send you emails in relation to your +problem. You can opt in to receive emails about updates to a particular +problem.') + ); + $out .= $q->h2(_('Organisation Questions')); + $out .= $q->dl( + $q->dt('Who built this site?'), + $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</a>. +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</a>, where you can write to any of your +elected representatives, for free. +<a href="https://secure.mysociety.org/donate/">Donate to mySociety</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 GNU 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(_('This adaptation of FixMyStreet was written by Matthew Somerville. +Thanks go 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, Ministry of Justice 100037819 2008), +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.')) + ); + return $out; +} + diff --git a/web/index.cgi b/web/index.cgi index bc72d8797..ceb65df57 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.196 2008-05-15 09:26:56 matthew Exp $ +# $Id: index.cgi,v 1.197 2008-05-15 16:09:52 matthew Exp $ use strict; use Standard; @@ -76,6 +76,7 @@ sub front_page { my $pc_h = ent($q->param('pc') || ''); my $out = '<p id="expl"><strong>' . _('Report, view, or discuss local problems') . '</strong>'; my $subhead = _('(like graffiti, fly tipping, broken paving slabs, or street lighting)'); + $subhead = '(like graffiti, fly tipping, or neighbourhood noise)' if $q->{site} eq 'scambs'; $out .= '<br><small>' . $subhead . '</small>' if $subhead ne ' '; $out .= '</p>'; $out .= '<p id="error">' . $error . '</p>' if ($error); @@ -116,18 +117,22 @@ EOF <div id="front_intro"> EOF $out .= $q->h2(_('How to report a problem')); + my $step4 = $q->li(_('We send it to the council on your behalf')); + $step4 = '' if $q->{site} eq 'emptyhomes'; + $step4 = $q->li('The council receives your report and acts upon it') + if $q->{site} eq 'scambs'; $out .= $q->ol( $q->li(_('Enter a nearby UK postcode, or street name and area')), $q->li(_('Locate the problem on a map of the area')), $q->li(_('Enter details of the problem')), - ($q->{site} ne 'emptyhomes' && $q->li(_('We send it to the council on your behalf'))) + $step4 ); $out .= $q->h2(_('FixMyStreet updates')); $out .= $q->div({-id => 'front_stats'}, - $q->div("<big>$new</big> reports $new_text"), + $q->div("<big>$new</big> report" . ($new!=1?'s':''), $new_text), ($q->{site} ne 'emptyhomes' && $q->div("<big>$fixed</big> fixed in past month")), - $q->div("<big>$updates</big> updates on reports"), + $q->div("<big>$updates</big> update" . ($updates!=1?'s':''), "on reports"), ); $out .= <<EOF; @@ -341,13 +346,13 @@ sub submit_problem { $id = dbh()->selectrow_array("select nextval('problem_id_seq');"); Page::workaround_pg_bytea("insert into problem (id, postcode, easting, northing, title, detail, name, - email, phone, photo, state, council, used_map, anonymous, category, areas) + email, phone, photo, state, council, used_map, anonymous, category, areas, send_questionnaire) values - (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, 'unconfirmed', ?, ?, ?, ?, ?)", 10, + (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, 'unconfirmed', ?, ?, ?, ?, ?, ?)", 10, $id, $input{pc}, $input{easting}, $input{northing}, $input{title}, $input{detail}, $input{name}, $input{email}, $input{phone}, $image, $input{council}, $used_map, $input{anonymous} ? 'f': 't', $input{category}, - $areas); + $areas, $q->{site} eq 'emptyhomes' ? 'f' : 't'); my %h = (); $h{title} = $input{title}; $h{detail} = $input{detail}; @@ -422,11 +427,9 @@ sub display_form { my $all_councils = mySociety::MaPit::get_voting_areas_by_location( { easting => $easting, northing => $northing }, 'polygon', $mySociety::VotingArea::council_parent_types); + if ($q->{site} eq 'scambs') { - #delete $all_councils->{2218}; - #@categories = ('Abandoned vehicles', 'Discarded hypodermic needles', - #'Dog fouling', 'Flytipping', 'Graffiti', 'Lighting (e.g. security lights)', - #'Litter', 'Neighbourhood noise'); + delete $all_councils->{2218}; } $all_councils = [ keys %$all_councils ]; return display_location($q, _('That spot does not appear to be covered by a council - if it is past the shoreline, for example, please specify the closest point on land.')) unless @$all_councils; @@ -445,6 +448,11 @@ sub display_form { next if $_->{category} eq _('Other'); push @categories, $_->{category}; } + if ($q->{site} eq 'scambs') { + @categories = ('Abandoned vehicles', 'Discarded hypodermic needles', + 'Dog fouling', 'Flytipping', 'Graffiti', 'Lighting (e.g. security lights)', + 'Litter', 'Neighbourhood noise'); + } if (@categories) { @categories = ('-- Pick a category --', @categories, _('Other')); $category = $q->div($q->label({'for'=>'form_category'}, _('Category:')), @@ -524,6 +532,11 @@ problems for $list and emailing it to us at <a href='mailto:$e'>$e</a>."; if ($input{skipped}) { $out .= $q->p(_('Please fill in the form below with details of the problem, and describe the location as precisely as possible in the details box.')); + } elsif ($q->{site} eq 'scambs') { + $out .= '<p>Please fill in details of the problem below. We won\'t be able +to help unless you leave as much detail as you can, so please describe the exact location of +the problem (e.g. on a wall), what it is, how long it has been there, a description (and a +photo of the problem if you have one), etc.'; } elsif ($details ne 'none') { $out .= '<p>Please fill in details of the problem below. The council won\'t be able to help unless you leave as much detail as you can, so please describe the exact location of @@ -593,7 +606,18 @@ EOF <input type="text" value="$input_h{phone}" name="phone" id="form_phone" size="15"> <small>(optional)</small></div> EOF - $out .= <<EOF unless $q->{site} eq 'emptyhomes'; # No notes + if ($q->{site} eq 'scambs') { + $out .= <<EOF; +<p>Please note:</p> +<ul> +<li>Please be polite, concise and to the point. +<li>Please do not be abusive. +<li>Writing your message entirely in block capitals makes it hard to read, +as does a lack of punctuation. +</ul> +EOF + } elsif ($q->{site} ne 'emptyhomes') { + $out .= <<EOF; <p>Please note:</p> <ul> <li>Please be polite, concise and to the point. @@ -606,6 +630,7 @@ submission via this site remember that you can contact your council directly using their own website. </ul> EOF + } $out .= <<EOF; <p align="right"><input type="submit" name="submit_problem" value="Submit"></p> </div> diff --git a/web/reports.cgi b/web/reports.cgi index 05cfd5b3f..4812fb49a 100755 --- a/web/reports.cgi +++ b/web/reports.cgi @@ -7,7 +7,7 @@ # Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved. # Email: matthew@mysociety.org. WWW: http://www.mysociety.org # -# $Id: reports.cgi,v 1.15 2008-05-06 10:01:31 matthew Exp $ +# $Id: reports.cgi,v 1.16 2008-05-15 16:09:52 matthew Exp $ use strict; use Standard; @@ -144,13 +144,13 @@ sub main { my $areas_info = mySociety::MaPit::get_voting_areas_info([keys %councils]); if (!$one_council) { - print Page::header($q, title=>'Summary reports'); + print Page::header($q, title=>_('Summary reports')); print $q->p(_('This is a summary of all reports on this site; select a particular council to see the reports sent there.')); my $c = 0; print '<table cellpadding="3" cellspacing="1" border="0">'; print '<tr><th>Name</th><th>' . _('New problems') . '</th><th>' . _('Older problems') . '</th>'; if ($q->{site} eq 'emptyhomes') { - print '<th>Recently in use</th><th>Old in use</th></tr>'; + print '<th>Recently returned to use</th><th>Older returned to use</th></tr>'; } else { print '<th>Old problems,<br>state unknown</th><th>Recently fixed</th><th>Old fixed</th></tr>'; } @@ -205,22 +205,22 @@ sub main { print "<h2>$name</h2>\n"; if ($open{$one_council}) { print '<div id="col_problems">'; - list_problems(_('New problems'), $open{$one_council}{new}, $all); + list_problems($q, _('New problems'), $open{$one_council}{new}, $all); if ($q->{site} eq 'emptyhomes') { my @old = (); push @old, @{$open{$one_council}{older}} if $open{$one_council}{older}; push @old, @{$open{$one_council}{unknown}} if $open{$one_council}{unknown}; - list_problems('Older empty properties', \@old, $all); + list_problems($q, 'Older empty properties', \@old, $all); } else { - list_problems('Older problems', $open{$one_council}{older}, $all); - list_problems('Old problems, state unknown', $open{$one_council}{unknown}, $all); + list_problems($q, _('Older problems'), $open{$one_council}{older}, $all); + list_problems($q, _('Old problems, state unknown'), $open{$one_council}{unknown}, $all); } print '</div>'; } if ($fixed{$one_council}) { print '<div id="col_fixed">'; - list_problems('Recently fixed', $fixed{$one_council}{new}, $all); - list_problems('Old fixed', $fixed{$one_council}{old}, $all); + list_problems($q, _('Recently fixed'), $fixed{$one_council}{new}, $all); + list_problems($q, _('Old fixed'), $fixed{$one_council}{old}, $all); print '</div>'; } } @@ -251,7 +251,7 @@ sub summary_cell { } sub list_problems { - my ($title, $problems, $all) = @_; + my ($q, $title, $problems, $all) = @_; return unless $problems; print "<h3>$title</h3>\n<ul>"; foreach (@$problems) { @@ -259,7 +259,7 @@ sub list_problems { print ent($_->[1]); print '</a>'; print ' <small>(sent to both)</small>' if $_->[3]>1; - print ' <small>(not sent to council)</small>' if $_->[3]==0; + print ' <small>(not sent to council)</small>' if $_->[3]==0 && $q->{site} ne 'emptyhomes'; print '<br><small>' . ent($_->[2]) . '</small>' if $all; print '</li>'; } |