diff options
author | Struan Donald <struan@exo.org.uk> | 2011-06-03 14:28:46 +0100 |
---|---|---|
committer | Struan Donald <struan@exo.org.uk> | 2011-06-03 14:28:46 +0100 |
commit | b8e2d75cc1c74584dfdf8571c241dab7182c4543 (patch) | |
tree | 3fdfa0d55b8c33d75b1f63ac7b80112f07941254 | |
parent | a90bb442e432e97b0714cf3ce645b0c5c50765fe (diff) | |
parent | 7b405637a1ac3436cf90acc7d5ad46f1b80c8250 (diff) |
Merge branch 'migrate_to_catalyst' of ssh://git.mysociety.org/data/git/public/fixmystreet into migrate_to_catalyst
48 files changed, 131 insertions, 541 deletions
diff --git a/bin/handlemail b/bin/handlemail index c5854a9ab..8b8e03be9 100755 --- a/bin/handlemail +++ b/bin/handlemail @@ -47,7 +47,7 @@ if ($data{is_bounce_message}) { # Not a bounce, send an automatic response my $template = 'reply-autoresponse'; -open FP, "$FindBin::Bin/../templates/emails/$template" or exit 75; +open FP, "$FindBin::Bin/../templates/email/default/$template" or exit 75; $template = join('', <FP>); close FP; diff --git a/conf/httpd.conf b/conf/httpd.conf index 2645af791..5bdb08fd8 100644 --- a/conf/httpd.conf +++ b/conf/httpd.conf @@ -86,10 +86,6 @@ RewriteRule ^/reports/{/rss/(.*)}$ /rss/$1 [R=permanent,L] # RewriteRule ^/report/([0-9]+) /report/$1 [R,L] RewriteRule ^/alerts/?$ /alert [R=permanent,L] -# JSON API for summaries of reports -RewriteRule ^/json/problems/new$ /json.cgi?type=new_problems [QSA,L] -RewriteRule ^/json/problems/fixed$ /json.cgi?type=fixed_problems [QSA,L] - # Proxy tilma so that our js code can make calls on the originating server. Use # a RewriteRule rather than ProxyPass so that Apache's processing order is more # predictable. ProxyPassReverse is not affected by this. @@ -105,10 +101,7 @@ RewriteRule /(.+) /$1 [L] # Explicitly capture all cgi files so that we can remove them one by one # RewriteRule ^/confirm(.*) /confirm.cgi$1 [L] -# RewriteRule ^/contact(.*) /contact.cgi$1 [L] RewriteRule ^/flickr(.*) /flickr.cgi$1 [L] -# RewriteRule ^/fun(.*) /fun.cgi$1 [L] -# RewriteRule ^/json(.*) /json.cgi$1 [L] # RewriteRule ^/questionnaire(.*) /questionnaire.cgi$1 [L] # RewriteRule ^/reports(.*) /reports.cgi$1 [L] # RewriteRule ^/rss(.*) /rss.cgi$1 [L] diff --git a/db/alert_types.pl b/db/alert_types.pl index fd1243982..7280ae3b8 100644 --- a/db/alert_types.pl +++ b/db/alert_types.pl @@ -27,7 +27,7 @@ _('The latest local problems reported by users'), # New problems around a postcode with a particular state - _('New problems NEAR {{POSTCODE}} on FixMyStreet'), + _('New problems near {{POSTCODE}} on FixMyStreet'), _('The latest local problems reported by users'), # New problems sent to a particular council diff --git a/db/alert_types.sql b/db/alert_types.sql index fb1aac1d0..eca83bb6f 100644 --- a/db/alert_types.sql +++ b/db/alert_types.sql @@ -71,7 +71,7 @@ insert into alert_type item_table, item_where, item_order, item_title, item_link, item_description, template) values ('postcode_local_problems_state', '', '', - 'New problems NEAR {{POSTCODE}} on FixMyStreet', '/', 'The latest local problems reported by users', + 'New problems near {{POSTCODE}} on FixMyStreet', '/', 'The latest local problems reported by users', 'problem_find_nearby(?, ?, ?) as nearby,problem', 'nearby.problem_id = problem.id and problem.state in (?)', 'created desc', '{{title}}, {{confirmed}}', '/report/{{id}}', '{{detail}}', 'alert-problem-nearby'); diff --git a/perl-external/files.txt b/perl-external/files.txt index 762bd9f1d..dba014f2f 100644 --- a/perl-external/files.txt +++ b/perl-external/files.txt @@ -98,6 +98,7 @@ /authors/id/D/DR/DROLSKY/MooseX-SemiAffordanceAccessor-0.09.tar.gz /authors/id/D/DR/DROLSKY/MooseX-Types-0.25.tar.gz /authors/id/D/DR/DROLSKY/Package-DeprecationManager-0.10.tar.gz +/authors/id/D/DR/DRTECH/Locale-Maketext-Lexicon-0.86.tar.gz /authors/id/F/FD/FDALY/Test-Tester-0.107.tar.gz /authors/id/F/FE/FERREIRA/Devel-Hide-0.0008.tar.gz /authors/id/F/FE/FERREIRA/Exporter-5.63.tar.gz @@ -237,6 +238,7 @@ /authors/id/T/TJ/TJENNESS/File-Temp-0.22.tar.gz /authors/id/T/TL/TLINDEN/Config-General-2.50.tar.gz /authors/id/T/TM/TMTM/Class-Data-Inheritable-0.08.tar.gz +/authors/id/T/TO/TODDR/Locale-Maketext-1.19.tar.gz /authors/id/T/TO/TOKUHIROM/Test-Requires-0.06.tar.gz /authors/id/T/TU/TURNSTEP/DBD-Pg-2.17.2.tar.gz /authors/id/T/TU/TURNSTEP/DBD-Pg-2.18.1.tar.gz diff --git a/perl-external/minicpan/modules/02packages.details.txt.gz b/perl-external/minicpan/modules/02packages.details.txt.gz Binary files differindex 50bc1f707..a166b7223 100644 --- a/perl-external/minicpan/modules/02packages.details.txt.gz +++ b/perl-external/minicpan/modules/02packages.details.txt.gz diff --git a/perl-external/modules.txt b/perl-external/modules.txt index 4c9f79e11..25c957fb7 100644 --- a/perl-external/modules.txt +++ b/perl-external/modules.txt @@ -34,6 +34,7 @@ HTTP::Server::Simple HTTP::Server::Simple::CGI IO::String JSON +Locale::Maketext::Lexicon Moose Net::Domain::TLD Path::Class diff --git a/perllib/FixMyStreet/App/Controller/Contact.pm b/perllib/FixMyStreet/App/Controller/Contact.pm index 558a354c6..b179680d0 100644 --- a/perllib/FixMyStreet/App/Controller/Contact.pm +++ b/perllib/FixMyStreet/App/Controller/Contact.pm @@ -4,8 +4,6 @@ use namespace::autoclean; BEGIN { extends 'Catalyst::Controller'; } -use mySociety::Random qw(random_bytes); - =head1 NAME FixMyStreet::App::Controller::Contact - Catalyst Controller @@ -43,6 +41,7 @@ sub submit : Path('submit') : Args(0) { return unless $c->forward('setup_request') + && $c->forward('determine_contact_type') && $c->forward('validate') && $c->forward('prepare_params_for_email') && $c->forward('send_email'); @@ -69,7 +68,7 @@ sub determine_contact_type : Private { { 'select' => [ 'title', 'detail', 'name', - 'anonymous', + 'anonymous', 'id', 'user_id', 'confirmed', ] } @@ -85,7 +84,6 @@ sub determine_contact_type : Private { elsif ($problem) { $c->stash->{problem} = $problem; } - $c->stash->{id} = $id; } return 1; @@ -150,27 +148,26 @@ sub prepare_params_for_email : Private { $c->stash->{message} =~ s/\r\n/\n/g; $c->stash->{subject} =~ s/\r|\n/ /g; - my $base_url = $c->cobrand->base_url_for_emails; + my $base_url = $c->cobrand->base_url_for_emails( $c->cobrand->extra_data ); my $admin_base_url = $c->cobrand->admin_base_url || 'https://secure.mysociety.org/admin/bci/'; - if ( $c->stash->{problem} and $c->stash->{update} ) { + if ( $c->stash->{update} ) { - # FIXME - correct url here - my $problem_url = $base_url; - my $admin_url = $admin_base_url; + my $problem_url = $base_url . '/report/' . $c->stash->{update}->problem_id + . '#update_' . $c->stash->{update}->id; + my $admin_url = $admin_base_url . '?page=update_edit;id=' . $c->stash->{update}->id; $c->stash->{message} .= sprintf( " \n\n[ Complaint about update %d on report %d - %s - %s ]", $c->stash->{update}->id, - $c->stash->{problem}->id, + $c->stash->{update}->problem_id, $problem_url, $admin_url ); } elsif ( $c->stash->{problem} ) { - # FIXME - correct url here - my $problem_url = $base_url; - my $admin_url = $admin_base_url; + my $problem_url = $base_url . '/report/' . $c->stash->{problem}->id; + my $admin_url = $admin_base_url . '?page=report_edit;id=' . $c->stash->{problem}->id; $c->stash->{message} .= sprintf( " \n\n[ Complaint about report %d - %s - %s ]", $c->stash->{problem}->id, diff --git a/perllib/FixMyStreet/App/Controller/JSON.pm b/perllib/FixMyStreet/App/Controller/JSON.pm index c437aafc0..d3688f19a 100644 --- a/perllib/FixMyStreet/App/Controller/JSON.pm +++ b/perllib/FixMyStreet/App/Controller/JSON.pm @@ -18,15 +18,24 @@ Provide information as JSON =head1 METHODS -=head2 json +=head2 problems + +Provide JSON of new/fixed problems in a specified time range =cut -sub json : Path : Args(0) { - my ( $self, $c ) = @_; +sub problems : Local { + my ( $self, $c, $path_type ) = @_; + + # get the type from the path - this is to deal with the historic url + # structure. In futur + $path_type ||= ''; + my $type = + $path_type eq 'new' ? 'new_problems' + : $path_type eq 'fixed' ? 'fixed_problems' + : ''; # gather the parameters - my $type = $c->req->param('type') || ''; my $start_date = $c->req->param('start_date') || ''; my $end_date = $c->req->param('end_date') || ''; diff --git a/perllib/FixMyStreet/Cobrand/Default.pm b/perllib/FixMyStreet/Cobrand/Default.pm index 1f1086c21..c20dbf6a3 100644 --- a/perllib/FixMyStreet/Cobrand/Default.pm +++ b/perllib/FixMyStreet/Cobrand/Default.pm @@ -763,7 +763,7 @@ sub council_rss_alert_options { { type => 'council', id => sprintf( 'district:%s:%s', $district->{id}, $district->{id_name} ), - text => sprintf( _('%s'), $district->{name}), + text => $district->{name}, rss_text => sprintf( _('RSS feed of %s'), $district->{name}), uri => $self->uri( '/rss/reports/' . $district->{short_name} ), }, @@ -777,7 +777,7 @@ sub council_rss_alert_options { { type => 'council', id => sprintf( 'county:%s:%s', $county->{id}, $county->{id_name} ), - text => sprintf( _('%s'), $county->{name}), + text => $county->{name}, rss_text => sprintf( _('RSS feed of %s'), $county->{name}), uri => $self->uri( '/rss/reports/' . $county->{short_name} ), }, diff --git a/t/app/controller/about.t b/t/app/controller/about.t index e1a1641fd..84eab005a 100644 --- a/t/app/controller/about.t +++ b/t/app/controller/about.t @@ -8,7 +8,7 @@ ok( my $mech = Test::WWW::Mechanize::Catalyst->new, 'Created mech object' ); # check that we can get the page $mech->get_ok('/about'); -$mech->content_like(qr{About Us ::\s+FixMyStreet.com}); +$mech->content_like(qr{About us ::\s+FixMyStreet.com}); $mech->content_contains('html lang="en-gb"'); SKIP: { diff --git a/t/app/controller/alert.t b/t/app/controller/alert.t index f32d0d6e9..45257b31b 100644 --- a/t/app/controller/alert.t +++ b/t/app/controller/alert.t @@ -22,7 +22,7 @@ $mech->content_contains('html lang="en-gb"'); $mech->get_ok('/alert/list?pc=EH99 1SP'); $mech->title_like(qr/^Local RSS feeds and email alerts/); -$mech->content_contains('Local RSS feeds and email alerts for EH99 1SP'); +$mech->content_contains('Local RSS feeds and email alerts for ‘EH99 1SP’'); $mech->content_contains('html lang="en-gb"'); $mech->content_contains('Problems within 8.5km'); $mech->content_contains('rss/pc/EH991SP/2'); diff --git a/t/app/controller/contact.t b/t/app/controller/contact.t index 73660306d..9808ef762 100644 --- a/t/app/controller/contact.t +++ b/t/app/controller/contact.t @@ -10,6 +10,8 @@ $mech->get_ok('/contact'); $mech->title_like(qr/Contact Us/); $mech->content_contains("We'd love to hear what you think about this site"); +my $problem_main; + for my $test ( { name => 'A User', @@ -20,6 +22,7 @@ for my $test ( confirmed => '2011-05-04 10:44:28.145168', anonymous => 0, meta => 'Reported by A User at 10:44, Wednesday 4 May 2011', + main => 1, }, { name => 'A User', @@ -111,7 +114,11 @@ for my $test ( } $update->delete if $update; - $problem->delete; + if ($test->{main}) { + $problem_main = $problem; + } else { + $problem->delete; + } }; } @@ -193,7 +200,7 @@ for my $test ( field_errors => [ 'Please write a message', ] }, { - url => '/contact?id=1', + url => '/contact?id=' . $problem_main->id, fields => { em => 'test@example.com', name => 'A name', @@ -228,12 +235,25 @@ for my $test ( message => 'A message', }, }, + { + fields => { + em => 'test@example.com', + name => 'A name', + subject => 'A subject', + message => 'A message', + id => $problem_main->id, + }, + }, ) { subtest 'check email sent correctly' => sub { $mech->clear_emails_ok; - $mech->get_ok('/contact'); + if ($test->{fields}{id}) { + $mech->get_ok('/contact?id=' . $test->{fields}{id}); + } else { + $mech->get_ok('/contact'); + } $mech->submit_form_ok( { with_fields => $test->{fields} } ); $mech->content_contains('Thanks for your feedback'); $mech->email_count_is(1); @@ -243,7 +263,13 @@ for my $test ( is $email->header('Subject'), 'FMS message: ' . $test->{fields}->{subject}, 'subject'; is $email->header('From'), "\"$test->{fields}->{name}\" <$test->{fields}->{em}>", 'from'; like $email->body, qr/$test->{fields}->{message}/, 'body'; - like $email->body, qr/Sent by contact.cgi on \S+. IP address (?:\d{1,3}\.){3,}\d{1,3}/, 'body footer' + like $email->body, qr/Sent by contact.cgi on \S+. IP address (?:\d{1,3}\.){3,}\d{1,3}/, 'body footer'; + my $problem_id = $test->{fields}{id}; + like $email->body, qr/Complaint about report $problem_id/, 'reporting a report' + if $test->{fields}{id}; }; } + +$problem_main->delete; + done_testing(); diff --git a/t/app/controller/json.t b/t/app/controller/json.t index 2c9ff4a61..7c5dce786 100644 --- a/t/app/controller/json.t +++ b/t/app/controller/json.t @@ -13,23 +13,23 @@ subtest "check that a bad request produces the appropriate response" => sub { my $bad_type = "Invalid type supplied"; my %tests = ( - '' => $bad_date, - 'foo=bar' => $bad_date, - 'type=&start_date=&end_date=' => $bad_date, - 'type=&start_date=bad&end_date=2000-02-01' => $bad_date, - 'type=&start_date=2000-01-01&end_date=bad' => $bad_date, - 'type=&start_date=2000-02-31&end_date=2000-02-01' => $bad_date, - 'type=&start_date=2000-01-01&end_date=2000-02-31' => $bad_date, - - 'type=&start_date=2000-02-01&end_date=2000-01-01' => $mad_date, - - 'type=&start_date=2000-01-01&end_date=2000-02-01' => $bad_type, - 'type=foo&start_date=2000-01-01&end_date=2000-02-01' => $bad_type, + '?' => $bad_date, + '?foo=bar' => $bad_date, + '?start_date=&end_date=' => $bad_date, + '?start_date=bad&end_date=2000-02-01' => $bad_date, + '?start_date=2000-01-01&end_date=bad' => $bad_date, + '?start_date=2000-02-31&end_date=2000-02-01' => $bad_date, + '?start_date=2000-01-01&end_date=2000-02-31' => $bad_date, + + '?start_date=2000-02-01&end_date=2000-01-01' => $mad_date, + + '?start_date=2000-01-01&end_date=2000-02-01' => $bad_type, + '/foo?type=foo&start_date=2000-01-01&end_date=2000-02-01' => $bad_type, ); foreach my $q ( sort keys %tests ) { is_deeply # - $mech->get_ok_json("/json?$q"), # + $mech->get_ok_json("/json/problems$q"), # { error => $tests{$q} }, # "correct error for query '$q'"; } @@ -38,7 +38,7 @@ subtest "check that a bad request produces the appropriate response" => sub { is_deeply # $mech->get_ok_json( - "/json?type=new_problems&start_date=2000-01-01&end_date=2000-02-01"), # + "/json/problems/new?start_date=2000-01-01&end_date=2000-02-01"), # [], # "correct response"; @@ -75,7 +75,7 @@ ok $anon_problem, "created anon test problem"; is_deeply # $mech->get_ok_json( - "/json?type=new_problems&start_date=2000-01-01&end_date=2000-02-01"), # + "/json/problems/new?start_date=2000-01-01&end_date=2000-02-01"), # [ { 'anonymous' => 0, diff --git a/templates/emails/alert-problem-area b/templates/email/default/alert-problem-area.txt index 8c41aaf5e..8c41aaf5e 100644 --- a/templates/emails/alert-problem-area +++ b/templates/email/default/alert-problem-area.txt diff --git a/templates/emails/alert-problem-council b/templates/email/default/alert-problem-council.txt index 572e057a6..572e057a6 100644 --- a/templates/emails/alert-problem-council +++ b/templates/email/default/alert-problem-council.txt diff --git a/templates/emails/alert-problem-nearby b/templates/email/default/alert-problem-nearby.txt index 0bf8483a7..0bf8483a7 100644 --- a/templates/emails/alert-problem-nearby +++ b/templates/email/default/alert-problem-nearby.txt diff --git a/templates/emails/alert-problem-ward b/templates/email/default/alert-problem-ward.txt index efcf15993..efcf15993 100644 --- a/templates/emails/alert-problem-ward +++ b/templates/email/default/alert-problem-ward.txt diff --git a/templates/emails/alert-problem b/templates/email/default/alert-problem.txt index 8369b8e28..8369b8e28 100644 --- a/templates/emails/alert-problem +++ b/templates/email/default/alert-problem.txt diff --git a/templates/emails/alert-update b/templates/email/default/alert-update.txt index ac0ddd50a..ac0ddd50a 100644 --- a/templates/emails/alert-update +++ b/templates/email/default/alert-update.txt diff --git a/templates/emails/reply-autoresponse b/templates/email/default/reply-autoresponse index 672c1f3c9..672c1f3c9 100644 --- a/templates/emails/reply-autoresponse +++ b/templates/email/default/reply-autoresponse diff --git a/templates/emails/emptyhomes/alert-problem-area b/templates/email/emptyhomes/en-gb/alert-problem-area.txt index 0fb11665c..0fb11665c 100644 --- a/templates/emails/emptyhomes/alert-problem-area +++ b/templates/email/emptyhomes/en-gb/alert-problem-area.txt diff --git a/templates/emails/emptyhomes/alert-problem-council b/templates/email/emptyhomes/en-gb/alert-problem-council.txt index 6c2d5b55c..6c2d5b55c 100644 --- a/templates/emails/emptyhomes/alert-problem-council +++ b/templates/email/emptyhomes/en-gb/alert-problem-council.txt diff --git a/templates/emails/emptyhomes/alert-problem-nearby b/templates/email/emptyhomes/en-gb/alert-problem-nearby.txt index abe027d20..abe027d20 100644 --- a/templates/emails/emptyhomes/alert-problem-nearby +++ b/templates/email/emptyhomes/en-gb/alert-problem-nearby.txt diff --git a/templates/emails/emptyhomes/alert-problem-ward b/templates/email/emptyhomes/en-gb/alert-problem-ward.txt index 14dabc386..14dabc386 100644 --- a/templates/emails/emptyhomes/alert-problem-ward +++ b/templates/email/emptyhomes/en-gb/alert-problem-ward.txt diff --git a/templates/emails/emptyhomes/alert-problem b/templates/email/emptyhomes/en-gb/alert-problem.txt index 30dc10c42..30dc10c42 100644 --- a/templates/emails/emptyhomes/alert-problem +++ b/templates/email/emptyhomes/en-gb/alert-problem.txt diff --git a/templates/emails/emptyhomes/alert-update b/templates/email/emptyhomes/en-gb/alert-update.txt index 9ae295b3e..9ae295b3e 100644 --- a/templates/emails/emptyhomes/alert-update +++ b/templates/email/emptyhomes/en-gb/alert-update.txt diff --git a/templates/email/emptyhomes/en-gb/problem-confirm.txt b/templates/email/emptyhomes/en-gb/problem-confirm.txt index 25d2a0afd..f8ff3e7ca 100644 --- a/templates/email/emptyhomes/en-gb/problem-confirm.txt +++ b/templates/email/emptyhomes/en-gb/problem-confirm.txt @@ -1,20 +1,20 @@ -Subject: Confirm your empty property on reportemptyhomes.com +Subject: Confirm your empty property report Hi [% report.user.name %], -Please click on the link below to confirm the empty property you just -added to reportemptyhomes.com: +Please click on the link below to confirm the empty property +report you just added to the site: [% token_url %] If your email program does not let you click on this link, copy and paste it into your web browser and press return. -Your empty property had the title: +Your report had the subject: [% report.title %] And details: [% report.detail %] Yours, -The reportemptyhomes.com team +reportemptyhomes.com diff --git a/templates/email/fiksgatami/update-confirm.txt b/templates/email/fiksgatami/update-confirm.txt index 4d6d12369..70e1c2444 100644 --- a/templates/email/fiksgatami/update-confirm.txt +++ b/templates/email/fiksgatami/update-confirm.txt @@ -2,7 +2,7 @@ Subject: Bekreft din oppdatering på FiksGataMi Hei [% update.user.name %], -Vennligst klikk på lenken under for å bekrefte oppdateringen du skrev " +Vennligst klikk på lenken under for å bekrefte oppdateringen du skrev nettopp: [% token_url %] diff --git a/templates/emails/alert-confirm b/templates/emails/alert-confirm deleted file mode 100644 index bb6288119..000000000 --- a/templates/emails/alert-confirm +++ /dev/null @@ -1,14 +0,0 @@ -Subject: Confirm your alert on FixMyStreet - -Hi, - -Please click on the link below to confirm the alert you just -asked to subscribe to on FixMyStreet: - - <?=$values['url']?> - -If you can't click the link, please copy and paste it to the -address bar of your web browser. - -Yours, -The FixMyStreet team diff --git a/templates/emails/empty property-confirm b/templates/emails/empty property-confirm deleted file mode 100644 index b7381eec8..000000000 --- a/templates/emails/empty property-confirm +++ /dev/null @@ -1,20 +0,0 @@ -Subject: Confirm your empty property report - -Hi <?=$values['name']?>, - -Please click on the link below to confirm the empty property -report you just added to the site: - -<?=$values['url']?> - -If your email program does not let you click on this link, -copy and paste it into your web browser and press return. - -Your report had the subject: -<?=$values['title']?> - -And details: -<?=$values['detail']?> - -Yours, -reportemptyhomes.com diff --git a/templates/emails/problem-confirm b/templates/emails/problem-confirm deleted file mode 100644 index 2a00e54a5..000000000 --- a/templates/emails/problem-confirm +++ /dev/null @@ -1,20 +0,0 @@ -Subject: Confirm your problem on FixMyStreet - -Hi <?=$values['name']?>, - -Please click on the link below to confirm the problem you just -added to FixMyStreet: - -<?=$values['url']?> - -If your email program does not let you click on this link, -copy and paste it into your web browser and press return. - -Your problem had the title: -<?=$values['title']?> - -And details: -<?=$values['detail']?> - -Yours, -The FixMyStreet team diff --git a/templates/emails/tms-confirm b/templates/emails/tms-confirm deleted file mode 100644 index 4821aed82..000000000 --- a/templates/emails/tms-confirm +++ /dev/null @@ -1,14 +0,0 @@ -Subject: Confirm your expression of interest in TextMyStreet - -Hi, - -Please click on the link below to confirm your expression of -interest in TextMyStreet: - - <?=$values['url']?> - -If you can't click the link, please copy and paste it to the -address bar of your web browser. - -Yours, -The FixMyStreet team diff --git a/templates/emails/update-confirm b/templates/emails/update-confirm deleted file mode 100644 index 11878ad0b..000000000 --- a/templates/emails/update-confirm +++ /dev/null @@ -1,17 +0,0 @@ -Subject: Confirm your update on FixMyStreet - -Hi <?=$values['name']?>, - -Please click on the link below to confirm the update you just wrote: - -<?=$values['url']?> - -If you can't click the link, please copy and paste it to the -address bar of your web browser. - -Your update reads: - -<?=$values['update']?> - -Yours, -The FixMyStreet team diff --git a/templates/web/default/alert/list.html b/templates/web/default/alert/list.html index 5b1677e8b..931636f06 100644 --- a/templates/web/default/alert/list.html +++ b/templates/web/default/alert/list.html @@ -3,7 +3,7 @@ [% INCLUDE 'header.html', title => title %] [% IF pretty_pc %] -[% title = tprintf( loc('Local RSS feeds and email alerts for %s'), pretty_pc ) %] +[% title = tprintf( loc('Local RSS feeds and email alerts for ‘%s’'), pretty_pc ) %] [% END %] @@ -24,7 +24,7 @@ <p> [% IF pretty_pc %] - [% tprintf( loc('Here are the types of local problem alerts for %s.'), pretty_pc ) | html %] + [% tprintf( loc('Here are the types of local problem alerts for ‘%s’.'), pretty_pc ) | html %] [% END %] [% loc('Select which type of alert you\'d like and click the button for an RSS feed, or enter your email address to subscribe to an email alert') %] </p> @@ -38,7 +38,7 @@ <p id="rss_local"> <input type="radio" name="feed" id="[% rss_feed_id %]" value="[% rss_feed_id %]"[% IF rss_feed_id == selected_feed || selected_feed == '' %] checked[% END %]> <label for="[% rss_feed_id %]">[% tprintf( loc('Problems within %.1fkm of this location'), population_radius ) %]</label> - ([% loc('a default distance which covers roughly 200,000 people') %]) <a href='[% rss_feed_uri %]'> + [% loc('(a default distance which covers roughly 200,000 people)') %] <a href='[% rss_feed_uri %]'> <img src='/i/feed.png' width='16' height='16' title='[% loc('RSS feed of nearby problems') %]' alt='[% loc('RSS feed') %]' border='0'></a> </p> diff --git a/templates/web/default/around/display_location.html b/templates/web/default/around/display_location.html index de970e98a..4c728806b 100755 --- a/templates/web/default/around/display_location.html +++ b/templates/web/default/around/display_location.html @@ -74,8 +74,8 @@ <p id="alert_links_area"> <a id="email_alert" rel="nofollow" href="[% email_url | html %]"> - [% loc('Email me new local problems') %] - </a> | + [%- loc('Email me new local problems') -%] +</a> | <a href="[% rss_url | html %]" id="rss_alert"> <span>[% rss_alt %]</span> <img src="/i/feed.png" width="16" height="16" title="[% rss_title %]" alt="[% rss_alt %]" border="0" style="vertical-align: top"> diff --git a/templates/web/default/auth/token.html b/templates/web/default/auth/token.html index 16dfbb11c..b3a3d5cc8 100644 --- a/templates/web/default/auth/token.html +++ b/templates/web/default/auth/token.html @@ -14,7 +14,7 @@ [% ELSE %] -<h1>[% loc('Please check you email') %]</h1> +<h1>[% loc('Please check your email') %]</h1> <p>We have sent you an email containing a link to confirm your account.</p> @@ -22,4 +22,4 @@ [% END %] -[% INCLUDE 'footer.html' %]
\ No newline at end of file +[% INCLUDE 'footer.html' %] diff --git a/templates/web/default/contact/index.html b/templates/web/default/contact/index.html index 35c7f7e36..dc64dd554 100644 --- a/templates/web/default/contact/index.html +++ b/templates/web/default/contact/index.html @@ -1,20 +1,20 @@ -[% INCLUDE 'header.html', title => loc('Contact Us') %] +[% INCLUDE 'header.html', + title = loc('Contact Us') + robots = 'noindex,nofollow' +%] <h1>[% loc('Contact the team') %]</h1> <form method="post" action="/contact/submit"> -<input type="hidden" name="submit_form" value="1"> - - [% INCLUDE 'errors.html' %] [% IF update %] + <p> [% loc('You are reporting the following update for being abusive, containing personal information, or similar:') %] </p> - [% IF update.text %] <blockquote> <p> [% IF update.anonymous %] @@ -29,15 +29,14 @@ </p> </blockquote> - [% END %] <input type="hidden" name="update_id" value="[% update.id %]"> - <input type="hidden" name="id" value="[% problem.id %]"> + <input type="hidden" name="id" value="[% update.problem_id %]"> + [% ELSIF problem %] <p> [% loc('You are reporting the following problem report for being abusive, containing personal information, or similar:') %] </p> - [% IF problem.title %] <blockquote> <h2>[% problem.title | html %]</h2> @@ -55,13 +54,10 @@ </blockquote> <input type="hidden" name="id" value="[% problem.id %]"> - [% END %] + [% ELSE %] -[% IF id %] -<input type="hidden" name="id" value="[% id %]"> -[% END %] -[% INCLUDE 'contact/blurb.html' %] + [% INCLUDE 'contact/blurb.html' %] [% END %] @@ -69,32 +65,34 @@ <div class="form-error">[% field_errors.name %]</div> [% END %] <div class="form-field"> -<label for="form_name">Your name:</label> -<input type="text" name="name" id="form_name" value="[% form_name %]" size="30"></div> +<label for="form_name">[% loc('Your name:') %]</label> +<input type="text" name="name" id="form_name" value="[% form_name | html %]" size="30"></div> [% IF field_errors.em %] <div class="form-error">[% field_errors.em %]</div> [% END %] <div class="form-field"> -<label for="form_email">Your email:</label> -<input type="text" name="em" id="form_email" value="[% em %]" size="30"></div> +<label for="form_email">[% loc('Your email:') %]</label> +<input type="text" name="em" id="form_email" value="[% em | html %]" size="30"></div> [% IF field_errors.subject %] <div class="form-error">[% field_errors.subject %]</div> [% END %] <div class="form-field"> -<label for="form_subject">Subject:</label> -<input type="text" name="subject" id="form_subject" value="[% subject %]" size="30"></div> +<label for="form_subject">[% loc('Subject:') %]</label> +<input type="text" name="subject" id="form_subject" value="[% subject | html %]" size="30"></div> [% IF field_errors.message %] <div class="form-error">[% field_errors.message %]</div> [% END %] <div class="form-field"> -<label for="form_message">Message:</label> +<label for="form_message">[% loc('Message:') %]</label> + +<textarea name="message" id="form_message" rows="7" cols="50">[% message | html %]</textarea></div> +<div class="checkbox"><input type="submit" value="[% loc('Post') %]"></div> -<textarea name="message" id="form_message" rows="7" cols="50">[% message %]</textarea></div> -<div class="checkbox"><input type="submit" value="Post"></div> +[% c.cobrand.form_elements('contactForm') %] </form> diff --git a/templates/web/default/contact/submit.html b/templates/web/default/contact/submit.html index 12f3f30a6..3845e9210 100644 --- a/templates/web/default/contact/submit.html +++ b/templates/web/default/contact/submit.html @@ -1,18 +1,20 @@ -[% INCLUDE 'header.html', title => loc('Contact Us') %] +[% INCLUDE 'header.html', title = loc('Contact Us') %] <h1>[% loc('Contact the team') %]</h1> -<form method="post" action="/contact/submit"> - -<input type="hidden" name="submit_form" value="1"> - - -<p> [% IF success %] + + <p> [% loc("Thanks for your feedback. We'll get back to you as soon as we can!") %] + </p> + [% display_crosssell_advert( em, form_name, 'emailunvalidated', 1 ) %] + [% ELSE %] + + <p> [% tprintf( loc('Failed to send message. Please try again, or <a href="mailto:%s">email us</a>.'), contact_email ) %] + </p> + [% END %] -</p> [% INCLUDE 'footer.html' %] diff --git a/templates/web/default/questionnaire/completed.html b/templates/web/default/questionnaire/completed.html index afac7aa29..4a6419ccb 100644 --- a/templates/web/default/questionnaire/completed.html +++ b/templates/web/default/questionnaire/completed.html @@ -23,6 +23,6 @@ why not <a href="http://www.pledgebank.com/new">make and publicise a pledge</a>? [% END %] [% IF advert_outcome %] - [% display_crosssell_advert( problem.user.email, problem.name, council, problem.council ) %] + [% display_crosssell_advert( problem.user.email, problem.name, 'council', problem.council ) %] [% END %] diff --git a/templates/web/default/report/display.html b/templates/web/default/report/display.html index 8ea902aa2..4fa58c1db 100644 --- a/templates/web/default/report/display.html +++ b/templates/web/default/report/display.html @@ -1,7 +1,7 @@ [% PROCESS "maps/${map.type}.html"; - problem_title = problem.title | html; + problem_title = problem.title _ ' - ' _ loc('Viewing a problem') | html; INCLUDE 'header.html' title = problem_title rss = [ loc('Updates to this problem, FixMyStreet'), "/rss/$problem.id" ] @@ -42,7 +42,7 @@ <a rel="nofollow" id="email_alert" href="[% c.uri_for( '/alert', { type => 'updates', id => problem.id } ) %]">[% loc('Email me updates' ) %]</a> <form action="[% c.uri_for( '/alert/subscribe' ) %]" method="post" id="email_alert_box"> - <p>[% loc('Receive email when updates are left on this problem' ) %]</p> + <p>[% loc('Receive email when updates are left on this problem.' ) %]</p> <label class="n" for="alert_rznvy">[% loc('Email') %]</label> <input type="text" name="rznvy" id="alert_rznvy" value="[% email | html %]" size="30"> <input type="hidden" name="id" value="[% problem.id %]"> @@ -52,7 +52,7 @@ </form> <a href="[% c.uri_for( '/rss', problem.id ) %]"> - <img src="/i/feed.png" width="16" height="16" title="[% loc('Rss feed') %]" alt="[% loc('Rss feed of updates to the problem' ) %]" border="0" style="vertical-align: middle"> + <img src="/i/feed.png" width="16" height="16" title="[% loc('RSS feed') %]" alt="[% loc('RSS feed of updates to this problem' ) %]" border="0" style="vertical-align: middle"> </a> </div> diff --git a/templates/web/default/static/about.html b/templates/web/default/static/about.html index 7219f6320..9c319f051 100644 --- a/templates/web/default/static/about.html +++ b/templates/web/default/static/about.html @@ -1,4 +1,4 @@ -[% INCLUDE 'header.html', title => loc('About Us') %] +[% INCLUDE 'header.html', title => loc('About us') %] <h1>[% loc('About us') %]</h1> @@ -6,4 +6,4 @@ [%# FIXME - put in blurb here %] -[% INCLUDE 'footer.html' %]
\ No newline at end of file +[% INCLUDE 'footer.html' %] diff --git a/templates/web/emptyhomes/tokens/confirm_problem.html b/templates/web/emptyhomes/tokens/confirm_problem.html index c4d246430..7bcf8acdf 100644 --- a/templates/web/emptyhomes/tokens/confirm_problem.html +++ b/templates/web/emptyhomes/tokens/confirm_problem.html @@ -28,7 +28,10 @@ %]</p> [% ELSE %] <p>[% - loc( 'Thank you for reporting an empty property on ReportEmptyHomes.com.' ) + loc( 'Thank you for reporting this empty property on ReportEmptyHomes.com. +At present the report cannot be sent through to the council for this area. We +are working with councils to link them into the system so that as many areas +as possible will be covered.') %]</p> [% END %] diff --git a/templates/web/fiksgatami/contact/address.html b/templates/web/fiksgatami/contact/address.html new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/templates/web/fiksgatami/contact/address.html diff --git a/templates/website/contact b/templates/website/contact deleted file mode 100644 index b1103d3f1..000000000 --- a/templates/website/contact +++ /dev/null @@ -1,42 +0,0 @@ -<h1>{{ $header }}</h1> -{{ $errors }} -<form method="post" action="{{ $form_action }}"> -<input type="hidden" name="submit_form" value="1"> - -{{ $intro }} -{{ if ( $item_title ) { - "<blockquote><h2>$item_title</h2><p>$item_meta</p><p>$item_body</p></blockquote>"; - -} }} - -{{ $hidden_vals }} -{{ if ( $field_errors{name}) { - "<div class='form-error'>$field_errors{name}</div>"; -} }} -<div class="form-field"> -<label for="form_name">{{ $label_name }}</label> -<input type="text" name="name" id="form_name" value="{{ $input_h{name} }}" size="30"></div> - -{{ if ( $field_errors{email}) { - "<div class='form-error'>$field_errors{email}</div>"; -} }} -<div class="form-field"> -<label for="form_email">{{ $label_email }}</label> -<input type="text" name="em" id="form_email" value="{{ $input_h{em} }}" size="30"></div> -{{ if ( $field_errors{subject}) { - "<div class='form-error'>$field_errors{subject}</div>"; -} }} -<div class="form-field"> -<label for="form_subject">{{ $label_subject }}</label> -<input type="text" name="subject" id="form_subject" value="{{ $input_h{subject} }}" size="30"></div> -{{ if ( $field_errors{message}) { - "<div class='form-error'>$field_errors{message}</div>"; -} }} -<div class="form-field"> -<label for="form_message">{{ $label_message }}</label> -<textarea name="message" id="form_message" rows="7" cols="50">{{ $input_h{message} }}</textarea></div> -<div class="checkbox"><input type="submit" value="{{ $label_submit }}"></div> -{{ $cobrand_form_elements }} -</form> - -{{ $contact_details }} diff --git a/templates/website/questionnaire b/templates/website/questionnaire deleted file mode 100644 index 869552c4b..000000000 --- a/templates/website/questionnaire +++ /dev/null @@ -1,34 +0,0 @@ -{{ $map_start }} - -<h1>{{ $heading }}</h1> - -<form method="post" action="{{ $form_action }}" id="questionnaire"{{ $enctype }}> -<input type="hidden" name="token" value="{{ $input_h{token} }}"> - -{{ $blurb_eh }} - -<p>{{ $blurb_report }} {{ $blurb_report2 }}</p> - -{{ $errors }} - -<p>{{ $fixed_question }}</p> -<p> -<input type="radio" name="been_fixed" id="been_fixed_yes" value="Yes"{{ $been_fixed{yes} }}> -<label for="been_fixed_yes">{{ $yes }}</label> -<input type="radio" name="been_fixed" id="been_fixed_no" value="No"{{ $been_fixed{no} }}> -<label for="been_fixed_no">{{ $no }}</label> -<input type="radio" name="been_fixed" id="been_fixed_unknown" value="Unknown"{{ $been_fixed{unknown} }}> -<label for="been_fixed_unknown">{{ $dontknow }}</label> -</p> - -{{ $ever_reported }} - -{{ $blurb_update }} -<p><textarea name="update" style="max-width:90%" rows="7" cols="30">{{ $input_h{update} }}</textarea></p> -{{ $photo_input }} - -{{ $another_questionnaire }} - -<p><input type="submit" name="submit" value="{{ $submit }}"></p> </form> - -{{ $map_end }} diff --git a/web/contact.cgi b/web/contact.cgi deleted file mode 100755 index b3af1688b..000000000 --- a/web/contact.cgi +++ /dev/null @@ -1,245 +0,0 @@ -#!/usr/bin/perl -w -I../perllib - -# contact.cgi: -# Contact page for FixMyStreet -# -# Copyright (c) 2006 UK Citizens Online Democracy. All rights reserved. -# Email: matthew@mysociety.org. WWW: http://www.mysociety.org -# -# $Id: contact.cgi,v 1.58 2009-12-17 14:57:34 louise Exp $ - -use strict; -use Standard; -use CrossSell; -use mySociety::Email; -use mySociety::EmailUtil; -use mySociety::Web qw(ent); -use mySociety::Random qw(random_bytes); - -# Main code for index.cgi -sub main { - my $q = shift; - print Page::header($q, title=>_('Contact Us'), context=>'contact', robots => 'noindex,nofollow'); - my $out = ''; - if ($q->param('submit_form')) { - $out = contact_submit($q); - } else { - $out = contact_page($q, [], {}); - } - print $out; - print Page::footer($q); -} -Page::do_fastcgi(\&main); - -sub contact_submit { - my $q = shift; - my @vars = qw(name em subject message id update_id); - my %input = map { $_ => $q->param($_) || '' } @vars; - my $cobrand = Page::get_cobrand($q); - my @errors; - my %field_errors; - $field_errors{name} = _('Please give your name') unless $input{name} =~ /\S/; - if ($input{em} !~ /\S/) { - $field_errors{email} = _('Please give your email'); - } elsif (!mySociety::EmailUtil::is_valid_email($input{em})) { - $field_errors{email} = _('Please give a valid email address'); - } - $field_errors{subject} = _('Please give a subject') unless $input{subject} =~ /\S/; - $field_errors{message} = _('Please write a message') unless $input{message} =~ /\S/; - push(@errors, _('Illegal ID')) if (($input{id} && $input{id} !~ /^[1-9]\d*$/) || ($input{update_id} && $input{update_id} !~ /^[1-9]\d*$/)); - return contact_page($q, \@errors, \%field_errors) if (@errors || scalar keys %field_errors); - - (my $message = $input{message}) =~ s/\r\n/\n/g; - (my $subject = $input{subject}) =~ s/\r|\n/ /g; - my $extra_data = Cobrand::extra_data($cobrand, $q); - my $base_url = Cobrand::base_url_for_emails($cobrand, $extra_data); - my $admin_base_url = Cobrand::admin_base_url($cobrand); - if (!$admin_base_url) { - $admin_base_url = "https://secure.mysociety.org/admin/bci/"; - } - if ($input{id} && $input{update_id}) { - $message .= "\n\n[ Complaint about update $input{update_id} on report $input{id} - " - . $base_url . "/report/$input{id}#update_$input{update_id} - " - . "$admin_base_url?page=update_edit;id=$input{update_id} ]"; - } elsif ($input{id}) { - $message .= "\n\n[ Complaint about report $input{id} - " - . $base_url . "/report/$input{id} - " - . "$admin_base_url?page=report_edit;id=$input{id} ]"; - } - my $postfix = '[ Sent by contact.cgi on ' . - $ENV{'HTTP_HOST'} . '. ' . - "IP address " . $ENV{'REMOTE_ADDR'} . - ($ENV{'HTTP_X_FORWARDED_FOR'} ? ' (forwarded from '.$ENV{'HTTP_X_FORWARDED_FOR'}.')' : '') . '. ' . - ' ]'; - - my $recipient = Cobrand::contact_email($cobrand); - my $recipient_name = Cobrand::contact_name($cobrand); - my $email = mySociety::Email::construct_email({ - _body_ => "$message\n\n$postfix", - From => [$input{em}, $input{name}], - To => [[$recipient, _($recipient_name)]], - Subject => 'FMS message: ' . $subject, - 'Message-ID' => sprintf('<contact-%s-%s@mysociety.org>', time(), unpack('h*', random_bytes(5, 1))), - }); - my $result = mySociety::EmailUtil::send_email($email, $input{em}, $recipient); - if ($result == mySociety::EmailUtil::EMAIL_SUCCESS) { - my $message = _("Thanks for your feedback. We'll get back to you as soon as we can!"); - my $out = $q->p($message); - my $display_advert = Cobrand::allow_crosssell_adverts($cobrand); - my $advert = ''; - if ($display_advert) { - $advert = CrossSell::display_advert($q, $input{em}, $input{name}, emailunvalidated=>1 ); - $out .= $advert; - } - my %vars = (message => $message, - advert => $advert); - my $template_out = Page::template_include('confirmed-alert', $q, Page::template_root($q), %vars); - return $template_out if $template_out; - return $out; - } else { - return $q->p('Failed to send message. Please try again, or <a href="mailto:' . $recipient . '">email us</a>.'); - } -} - -sub contact_details { - my ($q) = @_; - my $out = ''; - my $sitename = _('FixMyStreet'); - my $contact_info = ''; - if ( mySociety::Config::get('COUNTRY') eq 'GB' ) { - # XXX Rewrite to make brandable? - $contact_info .= <<EOF; -<div class="contact-details"> -<p>$sitename is a service provided by mySociety, which is the project of a -registered charity. The charity is called UK Citizens Online Democracy and is charity number 1076346.</p> -<p>mySociety can be contacted by email at <a href="mailto:hello@mysociety.org">hello@mysociety.org</a>, -or by post at:</p> -<p>mySociety<br> -483 Green Lanes<br> -London<br> -N13 4BS<br> -UK</p> -</div> -EOF - $out .= $contact_info unless $q->{site} eq 'emptyhomes'; - } - return $out; -} - -sub generic_contact_text { - my ($q) = @_; - my $intro; - - if ($q->{site} eq 'emptyhomes') { - $intro .= $q->p(_('We’d love to hear what you think about this -website. Just fill in the form. Please don’t contact us about individual empty -homes; use the box accessed from <a href="/">the front page</a>.')); - } else { - my $cobrand = Page::get_cobrand($q); - my $mailto = Cobrand::contact_email($cobrand); - $mailto =~ s/\@/@/; - $intro .= $q->p(_('Please do <strong>not</strong> report problems through this form; messages go to -the team behind FixMyStreet, not a council. To report a problem, -please <a href="/">go to the front page</a> and follow the instructions.')); - $intro .= $q->p(sprintf(_("We'd love to hear what you think about this site. Just fill in the form, or send an email to <a href='mailto:%s'>%s</a>:"), $mailto, $mailto)); - } - return $intro; -} - -sub contact_page { - my ($q, $errors, $field_errors) = @_; - my @errors = @$errors; - my %field_errors = %{$field_errors}; - push @errors, _('There were problems with your report. Please see below.') if (scalar keys %field_errors); - my @vars = qw(name em subject message); - my %input = map { $_ => $q->param($_) || '' } @vars; - my %input_h = map { $_ => $q->param($_) ? ent($q->param($_)) : '' } @vars; - my $out = ''; - my $header = _('Contact the team'); - $errors = ''; - - if (@errors) { - $errors = '<ul class="error"><li>' . join('</li><li>', @errors) . '</li></ul>'; - } - my $cobrand = Page::get_cobrand($q); - my $form_action = Cobrand::url($cobrand, '/contact', $q); - - my $intro = ''; - my $item_title = ''; - my $item_body = ''; - my $item_meta = ''; - my $hidden_vals = ''; - my $id = $q->param('id'); - my $update_id = $q->param('update_id'); - $id = undef unless $id && $id =~ /^[1-9]\d*$/; - $update_id = undef unless $update_id && $update_id =~ /^[1-9]\d*$/; - if ($id) { - mySociety::DBHandle::configure( - Name => mySociety::Config::get('BCI_DB_NAME'), - User => mySociety::Config::get('BCI_DB_USER'), - Password => mySociety::Config::get('BCI_DB_PASS'), - Host => mySociety::Config::get('BCI_DB_HOST', undef), - Port => mySociety::Config::get('BCI_DB_PORT', undef) - ); - my $p = dbh()->selectrow_hashref( - 'select title,detail,name,anonymous,extract(epoch from confirmed) as confirmed - from problem where id=?', {}, $id); - if ($update_id) { - my $u = dbh()->selectrow_hashref( - 'select comment.text, comment.name, problem.title, extract(epoch from comment.confirmed) as confirmed - from comment, problem where comment.id=? - and comment.problem_id = problem.id - and comment.problem_id=?', {}, $update_id ,$id); - if (! $u) { - $intro = generic_contact_text($q); - } else { - $intro .= $q->p(_('You are reporting the following update for being abusive, containing personal information, or similar:')); - $item_title = ent($u->{title}); - $item_meta = $q->em( 'Update below added ', (!$u->{name}) ? 'anonymously' : "by " . ent($u->{name}), - ' at ' . Page::prettify_epoch($q, $u->{confirmed})); - $item_body = ent($u->{text}); - $hidden_vals .= '<input type="hidden" name="update_id" value="' . $update_id . '">'; - } - } else { - if (! $p) { - $intro = generic_contact_text($q); - } else { - $intro .= $q->p(_('You are reporting the following problem report for being abusive, containing personal information, or similar:')); - $item_title = ent($p->{title}); - my $date_time = Page::prettify_epoch($q, $p->{confirmed}); - $item_meta = $q->em( - $p->{anonymous} - ? sprintf(_('Reported anonymously at %s'), $date_time) - : sprintf(_('Reported by %s at %s'), ent($p->{name}), $date_time) - ); - $item_body = ent($p->{detail}); - } - } - $hidden_vals .= '<input type="hidden" name="id" value="' . $id . '">'; - } else { - $intro = generic_contact_text($q); - } - my $cobrand_form_elements = Cobrand::form_elements(Page::get_cobrand($q), 'contactForm', $q); - my %vars = ( - header => $header, - errors => $errors, - intro => $intro, - item_title => $item_title, - item_meta => $item_meta, - item_body => $item_body, - hidden_vals => $hidden_vals, - form_action => $form_action, - input_h => \%input_h, - field_errors => \%field_errors, - label_name => _('Your name:'), - label_email => _('Your email:'), - label_subject => _('Subject:'), - label_message => _('Message:'), - label_submit => _('Post'), - contact_details => contact_details($q), - cobrand_form_elements => $cobrand_form_elements - ); - $out .= Page::template_include('contact', $q, Page::template_root($q), %vars); - return $out; -} - diff --git a/web/json.cgi b/web/json.cgi deleted file mode 100755 index 70ae2a76f..000000000 --- a/web/json.cgi +++ /dev/null @@ -1,35 +0,0 @@ -#!/usr/bin/perl -w -I../perllib - -# json.cgi: -# A small JSON API for FixMyStreet -# -# Copyright (c) 2009 UK Citizens Online Democracy. All rights reserved. -# Email: louise@mysociety.org. WWW: http://www.mysociety.org -# -# $Id: json.cgi,v 1.4 2010-01-20 11:31:26 matthew Exp $ - -# use strict; -# use Error qw(:try); -# use JSON; -# use Standard; -# -# sub main { -# my $q = shift; -# my $problems; -# my $type = $q->param('type') || ''; -# my $start_date = $q->param('start_date') || ''; -# my $end_date = $q->param('end_date') || ''; -# if ($start_date !~ /^\d{4}-\d\d-\d\d$/ || $end_date !~ /^\d{4}-\d\d-\d\d$/) { -# $problems = { error => 'Invalid dates supplied' }; -# } elsif ($type eq 'new_problems') { -# $problems = Problems::created_in_interval($start_date, $end_date); -# } elsif ($type eq 'fixed_problems') { -# $problems = Problems::fixed_in_interval($start_date, $end_date); -# } -# print $q->header( -type => 'application/json; charset=utf-8' ); -# print JSON::to_json($problems); -# } -# -# -# Page::do_fastcgi(\&main); -# |