aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--db/schema.sql5
-rw-r--r--db/schema_0027-add_sub_category_to_problem.sql6
-rw-r--r--perllib/FixMyStreet/App/Controller/Admin.pm9
-rwxr-xr-xperllib/FixMyStreet/App/Controller/JS.pm2
-rw-r--r--perllib/FixMyStreet/App/Controller/Report.pm2
-rw-r--r--perllib/FixMyStreet/App/Controller/Report/New.pm31
-rw-r--r--perllib/FixMyStreet/Cobrand/Default.pm53
-rw-r--r--perllib/FixMyStreet/Cobrand/SeeSomething.pm148
-rw-r--r--perllib/FixMyStreet/DB/Result/Problem.pm6
-rw-r--r--perllib/FixMyStreet/DB/ResultSet/Problem.pm43
-rw-r--r--t/app/controller/report_new.t113
-rw-r--r--t/app/model/problem.t47
-rw-r--r--templates/email/default/confirm_report_sent.txt9
-rw-r--r--templates/email/seesomething/confirm_report_sent.txt9
-rw-r--r--templates/email/seesomething/submit.txt25
-rw-r--r--templates/web/default/around/around_index.html54
-rw-r--r--templates/web/default/common_header_tags.html1
-rw-r--r--templates/web/default/js/validation_rules.html7
-rw-r--r--templates/web/default/report/new/category.html2
-rw-r--r--templates/web/default/report_created.html9
-rw-r--r--templates/web/fixmystreet/header.html5
-rw-r--r--templates/web/seesomething/admin/footer.html7
-rw-r--r--templates/web/seesomething/admin/header.html2
-rw-r--r--templates/web/seesomething/admin/stats.html63
-rw-r--r--templates/web/seesomething/around/around_index.html24
-rw-r--r--templates/web/seesomething/around/display_location.html49
-rw-r--r--templates/web/seesomething/around/postcode_form.html17
-rw-r--r--templates/web/seesomething/footer.html22
-rw-r--r--templates/web/seesomething/front/stats.html0
-rw-r--r--templates/web/seesomething/front/tips.html3
-rw-r--r--templates/web/seesomething/index.html43
-rw-r--r--templates/web/seesomething/js/validation_rules.html13
-rw-r--r--templates/web/seesomething/js/validation_strings.html15
-rw-r--r--templates/web/seesomething/report/display.html9
-rw-r--r--templates/web/seesomething/report/new/category.html14
-rw-r--r--templates/web/seesomething/report/new/fill_in_details_form.html104
-rw-r--r--templates/web/seesomething/report_created.html29
-rw-r--r--templates/web/seesomething/set_body_class.html1
-rw-r--r--web/js/fixmystreet.js8
39 files changed, 957 insertions, 52 deletions
diff --git a/db/schema.sql b/db/schema.sql
index 6ebec5689..87e785de2 100644
--- a/db/schema.sql
+++ b/db/schema.sql
@@ -217,7 +217,10 @@ create table problem (
external_source_id text,
-- number of me toos
- interest_count integer default 0
+ interest_count integer default 0,
+
+ -- subcategory to enable filtering in reporting --
+ subcategory text
);
create index problem_state_latitude_longitude_idx on problem(state, latitude, longitude);
create index problem_user_id_idx on problem ( user_id );
diff --git a/db/schema_0027-add_sub_category_to_problem.sql b/db/schema_0027-add_sub_category_to_problem.sql
new file mode 100644
index 000000000..6787bd371
--- /dev/null
+++ b/db/schema_0027-add_sub_category_to_problem.sql
@@ -0,0 +1,6 @@
+begin;
+
+ALTER TABLE problem
+ ADD COLUMN subcategory TEXT;
+
+commit;
diff --git a/perllib/FixMyStreet/App/Controller/Admin.pm b/perllib/FixMyStreet/App/Controller/Admin.pm
index 4999d16f2..7a2790b31 100644
--- a/perllib/FixMyStreet/App/Controller/Admin.pm
+++ b/perllib/FixMyStreet/App/Controller/Admin.pm
@@ -33,6 +33,11 @@ sub begin : Private {
my ( $self, $c ) = @_;
$c->uri_disposition('relative');
+
+ if ( $c->cobrand->moniker eq 'seesomething' ) {
+ $c->detach( '/auth/redirect' ) unless $c->user_exists;
+ $c->detach( '/auth/redirect' ) unless $c->user->from_council;
+ }
}
sub summary : Path( 'summary' ) : Args(0) {
@@ -927,6 +932,10 @@ sub stats : Path('stats') : Args(0) {
$c->forward('set_up_council_details');
+ if ( $c->cobrand->moniker eq 'seesomething' ) {
+ return $c->cobrand->admin_stats();
+ }
+
if ( $c->req->param('getcounts') ) {
my ( $start_date, $end_date, @errors );
diff --git a/perllib/FixMyStreet/App/Controller/JS.pm b/perllib/FixMyStreet/App/Controller/JS.pm
index ae2f06605..d7847af75 100755
--- a/perllib/FixMyStreet/App/Controller/JS.pm
+++ b/perllib/FixMyStreet/App/Controller/JS.pm
@@ -24,6 +24,8 @@ sub validation_strings : LocalRegex('^validation_strings\.(.*?)\.js$') : Args(0)
$c->res->content_type( 'application/javascript' );
}
+sub validation_rules : Path('validation_rules.js') : Args(0) { }
+
__PACKAGE__->meta->make_immutable;
1;
diff --git a/perllib/FixMyStreet/App/Controller/Report.pm b/perllib/FixMyStreet/App/Controller/Report.pm
index a7e1e8a3a..ef966a8a8 100644
--- a/perllib/FixMyStreet/App/Controller/Report.pm
+++ b/perllib/FixMyStreet/App/Controller/Report.pm
@@ -95,7 +95,7 @@ sub load_problem_or_display_error : Private {
if ( !$c->user || $c->user->id != $problem->user->id ) {
$c->detach(
'/page_error_403_access_denied',
- [ _('That report cannot be viewed on FixMyStreet.') ] #
+ [ sprintf(_('That report cannot be viewed on %s.'), $c->cobrand->site_title) ] #
);
}
}
diff --git a/perllib/FixMyStreet/App/Controller/Report/New.pm b/perllib/FixMyStreet/App/Controller/Report/New.pm
index 31c184733..9194f5318 100644
--- a/perllib/FixMyStreet/App/Controller/Report/New.pm
+++ b/perllib/FixMyStreet/App/Controller/Report/New.pm
@@ -194,6 +194,7 @@ sub report_form_ajax : Path('ajax') : Args(0) {
councils_text => $councils_text,
category => $category,
extra_name_info => $extra_name_info,
+ categories => $c->stash->{category_options},
}
);
@@ -712,6 +713,14 @@ sub process_user : Private {
my $user_title = Utils::trim_text( $params{fms_extra_title} );
+ if ( $c->cobrand->allow_anonymous_reports ) {
+ my $anon_details = $c->cobrand->anonymous_account;
+
+ for my $key ( qw( email name ) ) {
+ $params{ $key } ||= $anon_details->{ $key };
+ }
+ }
+
# The user is already signed in
if ( $c->user_exists ) {
my $user = $c->user->obj;
@@ -776,6 +785,7 @@ sub process_report : Private {
'detail_offensive',
'may_show_name', #
'category', #
+ 'subcategory', #
'partial', #
'service', #
);
@@ -808,6 +818,8 @@ sub process_report : Private {
# set these straight from the params
$report->category( _ $params{category} ) if $params{category};
+ $report->subcategory( $params{subcategory} );
+
my $areas = $c->stash->{all_areas};
$report->areas( ',' . join( ',', sort keys %$areas ) . ',' );
@@ -925,11 +937,7 @@ sub check_for_errors : Private {
# let the model check for errors
$c->stash->{field_errors} ||= {};
- my %field_errors = (
- %{ $c->stash->{field_errors} },
- %{ $c->stash->{report}->user->check_for_errors },
- %{ $c->stash->{report}->check_for_errors },
- );
+ my %field_errors = $c->cobrand->report_check_for_errors( $c );
# Zurich, we don't care about title or name
# There is no title, and name is optional
@@ -974,7 +982,14 @@ sub save_user_and_report : Private {
my $report = $c->stash->{report};
# Save or update the user if appropriate
- if ( !$report->user->in_storage ) {
+ if ( $c->cobrand->never_confirm_reports ) {
+ if ( $report->user->in_storage() ) {
+ $report->user->update();
+ } else {
+ $report->user->insert();
+ }
+ $report->confirm();
+ } elsif ( !$report->user->in_storage ) {
# User does not exist.
# Store changes in token for when token is validated.
$c->stash->{token_data} = {
@@ -1100,6 +1115,10 @@ sub redirect_or_confirm_creation : Private {
if ( $c->cobrand->moniker eq 'fixmybarangay' && $c->user->from_council && $c->stash->{external_source_id}) {
$report_uri = $c->uri_for( '/report', $report->id, undef, { external_source_id => $c->stash->{external_source_id} } );
+ } elsif ( $c->cobrand->never_confirm_reports && $report->non_public ) {
+ $c->log->info( 'cobrand was set to always confirm reports and report was non public, success page showed');
+ $c->stash->{template} = 'report_created.html';
+ return 1;
} else {
$report_uri = $c->cobrand->base_url_for_report( $report ) . $report->url;
}
diff --git a/perllib/FixMyStreet/Cobrand/Default.pm b/perllib/FixMyStreet/Cobrand/Default.pm
index efa455637..1f3b4d4bb 100644
--- a/perllib/FixMyStreet/Cobrand/Default.pm
+++ b/perllib/FixMyStreet/Cobrand/Default.pm
@@ -145,6 +145,14 @@ Can be specified in template.
sub enter_postcode_text { }
+=head2 site_title
+
+The name of the site
+
+=cut
+
+sub site_title { return 'FixMyStreet'; }
+
=head2 set_lang_and_domain
my $set_lang = $cobrand->set_lang_and_domain( $lang, $unicode, $dir )
@@ -750,5 +758,50 @@ sub default_show_name {
1;
}
+=head2 report_check_for_errors
+
+Perform validation for new reports. Takes Catalyst context object as an argument
+
+=cut
+
+sub report_check_for_errors {
+ my $self = shift;
+ my $c = shift;
+
+ return (
+ %{ $c->stash->{field_errors} },
+ %{ $c->stash->{report}->user->check_for_errors },
+ %{ $c->stash->{report}->check_for_errors },
+ );
+}
+
+sub report_sent_confirmation_email { 0; }
+
+=head2 never_confirm_reports
+
+If true then we never send an email to confirm a report
+
+=cut
+
+sub never_confirm_reports { 0; }
+
+=head2 allow_anonymous_reports
+
+If true then can have reports that are truely anonymous - i.e with no email or name. You
+need to also put details in the anonymous_account function too.
+
+=cut
+
+sub allow_anonymous_reports { 0; }
+
+=head2 anonymous_account
+
+Details to use for anonymous reports. This should return a hashref with an email and
+a name key
+
+=cut
+
+sub anonymous_account { undef; }
+
1;
diff --git a/perllib/FixMyStreet/Cobrand/SeeSomething.pm b/perllib/FixMyStreet/Cobrand/SeeSomething.pm
new file mode 100644
index 000000000..e445ff435
--- /dev/null
+++ b/perllib/FixMyStreet/Cobrand/SeeSomething.pm
@@ -0,0 +1,148 @@
+package FixMyStreet::Cobrand::SeeSomething;
+use parent 'FixMyStreet::Cobrand::UKCouncils';
+
+use strict;
+use warnings;
+
+sub council_id { return [ 2520, 2522, 2514, 2546, 2519, 2538, 2535 ]; }
+sub council_area { return 'West Midlands'; }
+sub council_name { return 'See Something Say Something'; }
+sub council_url { return 'seesomething'; }
+sub area_types { [ 'MTD' ] }
+sub site_title { return 'See Something, Say Something'; }
+
+
+sub site_restriction {
+ my $self = shift;
+ return { council => { IN => $self->council_id } };
+}
+
+sub problems_clause {
+ my $self = shift;
+ return { council => { IN => $self->council_id } };
+}
+
+sub path_to_web_templates {
+ my $self = shift;
+ return [
+ FixMyStreet->path_to( 'templates/web', $self->moniker )->stringify,
+ FixMyStreet->path_to( 'templates/web/fixmystreet' )->stringify
+ ];
+}
+
+sub council_check {
+ my ( $self, $params, $context ) = @_;
+
+ my $councils = $params->{all_councils};
+ my $council_match = grep { $councils->{$_} } @{ $self->council_id };
+
+ if ($council_match) {
+ return 1;
+ }
+
+ return ( 0, "That location is not covered by See Something, Say Something" );
+}
+
+sub disambiguate_location {
+ my $self = shift;
+ my $string = shift;
+
+ my $town = 'West Midlands';
+
+ return {
+ %{ $self->SUPER::disambiguate_location() },
+ town => $town,
+ centre => '52.4803101685267,-2.2708272758854',
+ span => '1.4002794815887,2.06340043925997',
+ bounds => [ 51.8259444771676, -3.23554082684068, 53.2262239587563, -1.17214038758071 ],
+ };
+}
+
+sub example_places {
+ return ( 'WS1 4NH', 'Austin Drive, Coventry' );
+}
+
+sub send_questionnaires {
+ return 0;
+}
+
+sub ask_ever_reported {
+ return 0;
+}
+
+sub report_sent_confirmation_email { 1; }
+
+sub report_check_for_errors { return (); }
+
+sub never_confirm_reports { 1; }
+
+sub allow_anonymous_reports { 1; }
+
+sub anonymous_account { return { name => 'anon user', email => 'anon@example.com' }; }
+
+sub admin_pages {
+ my $self = shift;
+
+ return {
+ 'stats' => ['Reports', 0],
+ };
+};
+
+sub admin_stats {
+ my $self = shift;
+ my $c = $self->{c};
+
+ my %filters = ();
+
+ my %councils =
+ map {
+ $c->stash->{council_details}->{$_}->{name} =~ s/(?:Borough|City) Council//;
+ $_ => $c->stash->{council_details}->{$_}
+ }
+ @{ $self->council_id };
+
+ $c->stash->{council_details} = \%councils;
+
+ if ( !$c->user_exists || !grep { $_ == $c->user->from_council } @{ $self->council_id } ) {
+ $c->detach( '/page_error_404_not_found' );
+ }
+
+ if ( $c->req->param('category') ) {
+ $filters{category} = $c->req->param('category');
+ $c->stash->{category} = $c->req->param('category');
+ }
+
+ if ( $c->req->param('subcategory') ) {
+ $filters{subcategory} = $c->req->param('subcategory');
+ $c->stash->{subcategory} = $c->req->param('subcategory');
+ }
+
+ if ( $c->req->param('service') ) {
+ $filters{service} = { -ilike => $c->req->param('service') };
+ $c->stash->{service} = $c->req->param('service');
+ }
+
+ my $page = $c->req->params->{p} || 1;
+
+ my $p = $c->model('DB::Problem')->search(
+ {
+ confirmed => { not => undef },
+ %filters
+ },
+ {
+ columns => [ qw(
+ service category subcategory council confirmed
+ ) ],
+ order_by => { -desc=> [ 'confirmed' ] },
+ rows => 20,
+ }
+ )->page( $page );
+
+ $c->stash->{reports} = $p;
+ $c->stash->{pager} = $p->pager;
+
+ return 1;
+}
+
+1;
+
diff --git a/perllib/FixMyStreet/DB/Result/Problem.pm b/perllib/FixMyStreet/DB/Result/Problem.pm
index dbfe8e9c8..dd09ad3c2 100644
--- a/perllib/FixMyStreet/DB/Result/Problem.pm
+++ b/perllib/FixMyStreet/DB/Result/Problem.pm
@@ -100,6 +100,8 @@ __PACKAGE__->add_columns(
{ data_type => "text", is_nullable => 1 },
"interest_count",
{ data_type => "integer", is_nullable => 1 },
+ "subcategory",
+ { data_type => "text", is_nullable => 1 },
);
__PACKAGE__->set_primary_key("id");
__PACKAGE__->has_many(
@@ -122,8 +124,8 @@ __PACKAGE__->belongs_to(
);
-# Created by DBIx::Class::Schema::Loader v0.07017 @ 2012-08-31 10:25:34
-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:mudIAiLAUdmK8gGWIPiq6g
+# Created by DBIx::Class::Schema::Loader v0.07017 @ 2012-12-03 17:48:10
+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:xN/RB8Vx50CwyOeBjvJezQ
# Add fake relationship to stored procedure table
__PACKAGE__->has_one(
diff --git a/perllib/FixMyStreet/DB/ResultSet/Problem.pm b/perllib/FixMyStreet/DB/ResultSet/Problem.pm
index aa123496e..faed3b8ac 100644
--- a/perllib/FixMyStreet/DB/ResultSet/Problem.pm
+++ b/perllib/FixMyStreet/DB/ResultSet/Problem.pm
@@ -288,6 +288,16 @@ sub send_reports {
$h{closest_address} = $cobrand->find_closest( $h{latitude}, $h{longitude}, $row );
}
+ if ( $cobrand->allow_anonymous_reports &&
+ $row->user->email eq $cobrand->anonymous_account->{'email'}
+ ) {
+ $h{anonymous_report} = 1;
+ $h{user_details} = _('This report was submitted anonymously');
+ } else {
+ $h{user_details} = sprintf(_('Name: %s'), $row->name) . "\n\n";
+ $h{user_details} .= sprintf(_('Email: %s'), $row->user->email) . "\n\n";
+ }
+
my %reporters = ();
my ( $sender_count );
if ($site eq 'emptyhomes') {
@@ -336,6 +346,10 @@ sub send_reports {
$h{category_line} = sprintf(_("Category: %s"), $h{category}) . "\n\n";
}
+ if ( $row->subcategory ) {
+ $h{subcategory_line} = sprintf(_("Subcategory: %s"), $row->subcategory) . "\n\n";
+ }
+
$h{councils_name} = join(_(' and '), @dear);
if ($h{category} eq _('Other')) {
$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"
@@ -420,6 +434,9 @@ sub send_reports {
whensent => \'ms_current_timestamp()',
lastupdate => \'ms_current_timestamp()',
} );
+ if ( $cobrand->report_sent_confirmation_email && !$h{anonymous_report}) {
+ _send_report_sent_email( $row, \%h, $nomail );
+ }
} else {
my @errors;
for my $sender ( keys %reporters ) {
@@ -465,4 +482,30 @@ sub send_reports {
}
}
+sub _send_report_sent_email {
+ my $row = shift;
+ my $h = shift;
+ my $nomail = shift;
+
+ my $template = 'confirm_report_sent.txt';
+ my $template_path = FixMyStreet->path_to( "templates", "email", $row->cobrand, $row->lang, $template )->stringify;
+ $template_path = FixMyStreet->path_to( "templates", "email", $row->cobrand, $template )->stringify
+ unless -e $template_path;
+ $template_path = FixMyStreet->path_to( "templates", "email", "default", $template )->stringify
+ unless -e $template_path;
+ $template = Utils::read_file( $template_path );
+
+ my $result = FixMyStreet::App->send_email_cron(
+ {
+ _template_ => $template,
+ _parameters_ => $h,
+ To => $row->user->email,
+ From => mySociety::Config::get('CONTACT_EMAIL'),
+ },
+ mySociety::Config::get('CONTACT_EMAIL'),
+ [ $row->user->email ],
+ $nomail
+ );
+}
+
1;
diff --git a/t/app/controller/report_new.t b/t/app/controller/report_new.t
index 77afb071c..d20f15922 100644
--- a/t/app/controller/report_new.t
+++ b/t/app/controller/report_new.t
@@ -1142,6 +1142,119 @@ SKIP: {
$mech->delete_user($user);
}
+SKIP: {
+ skip( "Need 'seesomething' in ALLOWED_COBRANDS config", 100 )
+ unless FixMyStreet::Cobrand->exists('seesomething');
+
+ $mech->host('seesomething.fixmystreet.com');
+ $mech->clear_emails_ok;
+ $mech->log_out_ok;
+
+ my $cobrand = FixMyStreet::Cobrand::SeeSomething->new();
+
+ my $bus_contact = FixMyStreet::App->model('DB::Contact')->find_or_create( {
+ %contact_params,
+ area_id => 2535,
+ category => 'Bus',
+ email => 'bus@example.com',
+ non_public => 1,
+ } );
+
+ for my $test ( {
+ desc => 'report with no user details works',
+ pc => 'WS1 4NH',
+ fields => {
+ detail => 'Test report details',
+ category => 'Bus',
+ subcategory => 'Smoking',
+ },
+ email => $cobrand->anonymous_account->{email},
+ },
+ {
+ desc => 'report with user details works',
+ pc => 'WS1 4NH',
+ fields => {
+ detail => 'Test report details',
+ category => 'Bus',
+ subcategory => 'Smoking',
+ email => 'non_anon_user@example.com',
+ name => 'Non Anon',
+ },
+ email => 'non_anon_user@example.com',
+ },
+ {
+ desc => 'report with public category',
+ pc => 'WS1 4NH',
+ fields => {
+ detail => 'Test report details',
+ category => 'Bus',
+ subcategory => 'Smoking',
+ },
+ email => $cobrand->anonymous_account->{email},
+ public => 1,
+ }
+ ) {
+ subtest $test->{desc} => sub {
+ $mech->clear_emails_ok;
+ my $user =
+ FixMyStreet::App->model('DB::User')->find( { email => $test->{email} } );
+
+ if ( $user ) {
+ $user->alerts->delete;
+ $user->problems->delete;
+ $user->delete;
+ }
+
+ if ( $test->{public} ) {
+ $bus_contact->non_public(0);
+ $bus_contact->update;
+ } else {
+ $bus_contact->non_public(1);
+ $bus_contact->update;
+ }
+
+ $mech->get_ok( '/around' );
+ $mech->submit_form_ok(
+ {
+ with_fields => {
+ pc => $test->{pc},
+ },
+ },
+ 'submit around form',
+ );
+ $mech->follow_link_ok( { text_regex => qr/skip this step/i, }, "follow 'skip this step' link" );
+
+ $mech->submit_form_ok(
+ {
+ with_fields => $test->{fields},
+ },
+ 'Submit form details with no user details',
+ );
+ is_deeply $mech->page_errors, [], "check there were no errors";
+
+ $user =
+ FixMyStreet::App->model('DB::User')->find( { email => $test->{email} } );
+ ok $user, "user found";
+
+ my $report = $user->problems->first;
+ ok $report, "Found the report";
+
+ $mech->email_count_is(0);
+
+ ok $report->confirmed, 'Report is confirmed automatically';
+
+ if ( $test->{public} ) {
+ is $mech->uri->path, '/report/' . $report->id, 'redirects to report page';
+ } else {
+ is $mech->uri->path, '/report/new', 'stays on report/new page';
+ $mech->content_contains( 'Your report has been sent', 'use report created template' );
+ }
+ };
+ }
+
+ $bus_contact->delete;
+}
+
$contact1->delete;
$contact2->delete;
$contact3->delete;
diff --git a/t/app/model/problem.t b/t/app/model/problem.t
index 9aa52c3cf..63204e05c 100644
--- a/t/app/model/problem.t
+++ b/t/app/model/problem.t
@@ -540,6 +540,53 @@ foreach my $test ( {
};
}
+subtest 'check can turn on report sent email alerts' => sub {
+ eval 'use Test::MockModule; 1' or
+ plan skip_all => 'Skipping tests that rely on Test::MockModule';
+
+ $mech->clear_emails_ok;
+
+ FixMyStreet::App->model('DB::Problem')->search(
+ {
+ whensent => undef
+ }
+ )->update( { whensent => \'ms_current_timestamp()' } );
+
+ $problem->discard_changes;
+ $problem->update( {
+ council => 2651,
+ state => 'confirmed',
+ confirmed => \'ms_current_timestamp()',
+ whensent => undef,
+ category => 'potholes',
+ name => 'Test User',
+ cobrand => 'fixmystreet',
+ } );
+
+ my $m = new Test::MockModule(
+ 'FixMyStreet::Cobrand::FixMyStreet' );
+ $m->mock( report_sent_confirmation_email => 1 );
+ FixMyStreet::App->model('DB::Problem')->send_reports();
+
+ $mech->email_count_is( 2 );
+ my @emails = $mech->get_email;
+ my $email = $emails[0];
+
+ like $email->header('To'),qr/City of Edinburgh Council/, 'to line looks correct';
+ is $email->header('From'), '"Test User" <system_user@example.com>', 'from line looks correct';
+ like $email->header('Subject'), qr/A Title/, 'subject line looks correct';
+ like $email->body, qr/A user of FixMyStreet/, 'email body looks a bit like a report';
+ like $email->body, qr/Subject: A Title/, 'more email body checking';
+ like $email->body, qr/Dear City of Edinburgh Council/, 'Salutation looks correct';
+
+ $problem->discard_changes;
+ ok defined( $problem->whensent ), 'whensent set';
+
+ $email = $emails[1];
+ like $email->header('Subject'), qr/Problem Report Sent/, 'report sent email title correct';
+ like $email->body, qr/Your report about/, 'report sent body correct';
+};
+
$problem->comments->delete;
$problem->delete;
$user->delete;
diff --git a/templates/email/default/confirm_report_sent.txt b/templates/email/default/confirm_report_sent.txt
new file mode 100644
index 000000000..42f200213
--- /dev/null
+++ b/templates/email/default/confirm_report_sent.txt
@@ -0,0 +1,9 @@
+Subject: Problem Report Sent: <?=$values['title']?>
+
+Hi,
+
+Your report about "<?=$values['title']?>" has been sent to <?=$values['councils_name']?>.
+
+Thanks
+
+<?=$values['signature']?>
diff --git a/templates/email/seesomething/confirm_report_sent.txt b/templates/email/seesomething/confirm_report_sent.txt
new file mode 100644
index 000000000..b17a76186
--- /dev/null
+++ b/templates/email/seesomething/confirm_report_sent.txt
@@ -0,0 +1,9 @@
+Subject: See Something, Say Something report sent
+
+Hi,
+
+Your report on See Something, Say Something has been sent
+
+Thanks
+
+<?=$values['signature']?>
diff --git a/templates/email/seesomething/submit.txt b/templates/email/seesomething/submit.txt
new file mode 100644
index 000000000..0682425fe
--- /dev/null
+++ b/templates/email/seesomething/submit.txt
@@ -0,0 +1,25 @@
+Subject: Report on See Something, Say Something
+
+A user of
+See Something, Say Something has submitted the following report
+of a problem that they believe might require your attention.
+
+<?=$values['image_url']?>
+----------
+
+<?=$values['user_details']?>
+
+<?=$values['phone_line']?><?=$values['category_line']?><?=$values['subcategory_line']?>
+
+Details: <?=$values['detail']?>
+
+<?=$values['easting_northing']?>Latitude: <?=$values['latitude']?>
+
+Longitude: <?=$values['longitude']?>
+
+<?=$values['closest_address']?>----------
+
+Replies to this email will go to the user who submitted the problem
+unless it is an anonymous report in which case they will be discarded.
+
+<?=$values['signature']?>
diff --git a/templates/web/default/around/around_index.html b/templates/web/default/around/around_index.html
index f58d13d80..a143e90a2 100644
--- a/templates/web/default/around/around_index.html
+++ b/templates/web/default/around/around_index.html
@@ -1,34 +1,24 @@
-[% INCLUDE 'header.html', title => loc('Reporting a problem') %]
-
-[%
- # NOTE ON PARTIAL REPORTS:
- #
- # partial reports get a bit of extra text added, the form goes to
- # '/report/new' and the partial hidden field is added to the form.
-%]
-
-[% INCLUDE 'around/postcode_form.html' %]
-
-[% IF location_error %]
- <p class="error">[% location_error %]</p>
-[% END %]
-
-[% IF possible_location_matches %]
- <p>[% loc('We found more than one match for that location. We show up to ten matches, please try a different search if yours is not here.') %]</p>
- <ul class="pc_alternatives">
- [% FOREACH match IN possible_location_matches %]
- <li><a href="/around?latitude=[% match.latitude | uri %];longitude=[% match.longitude | uri %]">[% match.address | html %]</a></li>
- [% END %]
- </ul>
-[% END %]
-
-[% IF partial_token %]
- <p style="margin-top: 0; color: #cc0000;">
- <img align="right" src="/photo/[% report.id %].jpeg" hspace="5">
- [% loc("Thanks for uploading your photo. We now need to locate your problem, so please enter a nearby street name or postcode in the box below&nbsp;:") %]
- </p>
-[% END %]
-
-
+[% INCLUDE 'header.html', title => loc('Reporting a problem'), bodyclass = 'mappage' %]
+
+<form action="[% c.uri_for('/around') %]" method="get" name="mapForm" id="mapForm">
+ <div id="side-form">
+ <div id="report-a-problem-main">
+ [% INCLUDE 'around/postcode_form.html' %]
+
+ [% IF location_error %]
+ <p class="error">[% location_error %]</p>
+ [% END %]
+
+ [% IF possible_location_matches %]
+ <p>[% loc('We found more than one match for that location. We show up to ten matches, please try a different search if yours is not here.') %]</p>
+ <ul class="pc_alternatives">
+ [% FOREACH match IN possible_location_matches %]
+ <li><a href="/around?latitude=[% match.latitude | uri %];longitude=[% match.longitude | uri %]">[% match.address | html %]</a></li>
+ [% END %]
+ </ul>
+ [% END %]
+ </div>
+ </div>
+</form>
[% INCLUDE 'footer.html' %]
diff --git a/templates/web/default/common_header_tags.html b/templates/web/default/common_header_tags.html
index 9d32164f7..4839249ac 100644
--- a/templates/web/default/common_header_tags.html
+++ b/templates/web/default/common_header_tags.html
@@ -1,6 +1,7 @@
[% USE date %][% USE Math %]
<meta http-equiv="content-type" content="text/html; charset=utf-8">
+<script type="text/javascript" src="/js/validation_rules.js?[% Math.int( date.now / 3600 ) %]"></script>
<script type="text/javascript" src="/js/validation_strings.[% lang_code %].js?[% Math.int( date.now / 3600 ) %]"></script>
<script type="text/javascript" src="/jslib/jquery-1.7.2.min.js"></script>
diff --git a/templates/web/default/js/validation_rules.html b/templates/web/default/js/validation_rules.html
new file mode 100644
index 000000000..409d0971f
--- /dev/null
+++ b/templates/web/default/js/validation_rules.html
@@ -0,0 +1,7 @@
+ validation_rules = {
+ title: { required: true },
+ detail: { required: true },
+ email: { required: true },
+ update: { required: true },
+ rznvy: { required: true }
+ };
diff --git a/templates/web/default/report/new/category.html b/templates/web/default/report/new/category.html
index 8bff539c4..49be4d25d 100644
--- a/templates/web/default/report/new/category.html
+++ b/templates/web/default/report/new/category.html
@@ -3,7 +3,7 @@
[% IF category;
category = category | lower;
END; %]
- <label for='form_category'>[% category_label | html %]</label>
+ <label for='form_category' id="form_category_label">[% category_label | html %]</label>
<select name='category' id='form_category'[% ' onchange="form_category_onchange()"' IF category_extras.size %]>
[% FOREACH cat_op IN category_options %]
[% cat_op_lc = cat_op | lower %]
diff --git a/templates/web/default/report_created.html b/templates/web/default/report_created.html
new file mode 100644
index 000000000..81083654b
--- /dev/null
+++ b/templates/web/default/report_created.html
@@ -0,0 +1,9 @@
+[% INCLUDE 'header.html', title => loc('Report created') %]
+
+<h1>[% loc("Report created") %]</h1>
+
+<p>
+[% loc('Your report has been created and will shortly be sent.') %]
+</p>
+
+[% INCLUDE 'footer.html' %]
diff --git a/templates/web/fixmystreet/header.html b/templates/web/fixmystreet/header.html
index f9c146bc0..85ed2c0e1 100644
--- a/templates/web/fixmystreet/header.html
+++ b/templates/web/fixmystreet/header.html
@@ -22,7 +22,7 @@
<script src="[% start %][% version('/js/modernizr.custom.js') %]" charset="utf-8"></script>
<script src="[% start %][% version('/cobrands/fixmystreet/position_map.js') %]" charset="utf-8"></script>
- [% INCLUDE 'common_header_tags.html', js_override = '/cobrands/fixmystreet/fixmystreet.js', site_title = 'FixMyStreet' %]
+ [% INCLUDE 'common_header_tags.html', js_override = '/cobrands/fixmystreet/fixmystreet.js', site_title = c.cobrand.site_title %]
[% extra_js %]
[% IF c.req.uri.host == 'osm.fixmystreet.com' %]
@@ -32,13 +32,14 @@
[% INCLUDE 'tracking_code.html' %]
</head>
+ [% TRY %][% PROCESS 'set_body_class.html' %][% CATCH file %][% END %]
<body class="[% bodyclass | html IF bodyclass %]">
<div class="wrapper">
<div class="table-cell">
<header id="site-header" role="banner">
<div class="container">
- <a href="/" id="site-logo">FixMyStreet</a>
+ <a href="/" id="site-logo">[% c.cobrand.site_title | html %]</a>
<a href="#main-nav" id="nav-link">Main Navigation</a>
</div>
</header>
diff --git a/templates/web/seesomething/admin/footer.html b/templates/web/seesomething/admin/footer.html
new file mode 100644
index 000000000..bdd42e2e4
--- /dev/null
+++ b/templates/web/seesomething/admin/footer.html
@@ -0,0 +1,7 @@
+ </div><!-- .content role=main -->
+ </div><!-- .container -->
+ </div><!-- .table-cell -->
+<!-- [% INCLUDE 'debug_footer.html' %] -->
+ </div> <!-- .wrapper -->
+</body>
+</html>
diff --git a/templates/web/seesomething/admin/header.html b/templates/web/seesomething/admin/header.html
new file mode 100644
index 000000000..40bea25bf
--- /dev/null
+++ b/templates/web/seesomething/admin/header.html
@@ -0,0 +1,2 @@
+[% INCLUDE 'header.html' admin = 1, bodyclass = 'admin fullwidthpage' %]
+ <h1>[% title %]</h1>
diff --git a/templates/web/seesomething/admin/stats.html b/templates/web/seesomething/admin/stats.html
new file mode 100644
index 000000000..713c3fb6d
--- /dev/null
+++ b/templates/web/seesomething/admin/stats.html
@@ -0,0 +1,63 @@
+[% INCLUDE 'admin/header.html' title=loc('Reports') %]
+[% PROCESS 'admin/report_blocks.html' %]
+
+[% BLOCK options %]
+ [% FOR option IN option_list %]
+ <option value="[% option %]"[% ' selected' IF selected == option %]>[% option %]</opytion>
+ [% END %]
+[% END %]
+
+<form method="post" action="[% c.uri_for('stats') %]" enctype="application/x-www-form-urlencoded" accept-charset="utf-8" id="filter-form">
+ <label for="form_category">Transport Type: </label>
+ <select name="category" id="form_category">
+ <option value="">Select</option>
+ [% PROCESS options, option_list = [ 'Bus', 'Metro', 'Train' ], selected = category %]
+ </select>
+
+ <label for="form_subcategory">Incident Type: </label>
+ <select name="subcategory" id="form_subcategory">
+ <option value="">Select</option>
+ [% PROCESS options, option_list = ['Smoking', 'Drugs', 'Anti-social Behaviour', 'Loud Music', 'Damage', 'Feet on Seats', 'Other'], selected = subcategory %]
+ </select>
+
+ <label for="form_service">Device: </label>
+ <select name="service" id="form_service">
+ <option value="">Select</option>
+ [% PROCESS options, option_list = [ 'Android', 'iPhone' ], selected = service %]
+ </select>
+
+ <input type="submit" name="getcounts" size="30" id="getcounts" value="Look Up" />
+</form>
+
+[% IF pager.total_entries == 0 %]
+<p align="center">
+No Results found
+</p>
+[% ELSE %]
+<table class="admin-report">
+ <thead>
+ <tr>
+ <th>Device</th>
+ <th>Transport Category</th>
+ <th>Incident Category</th>
+ <th>Area</th>
+ <th>Submitted</th>
+ </tr>
+ </thead>
+ <tbody>
+ [%- WHILE (report = reports.next) %]
+ <tr>
+ <td>[% report.service || 'Other' %]</td>
+ <td>[% report.category %]</td>
+ <td class="nowrap">[% report.subcategory %]</td>
+ <td class="nowrap">[% council_details.${report.council}.name %]</td>
+ <td class="nowrap">[% PROCESS format_time time=report.confirmed %]</td>
+ </tr>
+ [%- END %]
+ </tbody>
+</table>
+[% END %]
+
+[% INCLUDE 'pagination.html', param = 'p' %]
+
+[% INCLUDE 'admin/footer.html' %]
diff --git a/templates/web/seesomething/around/around_index.html b/templates/web/seesomething/around/around_index.html
new file mode 100644
index 000000000..a143e90a2
--- /dev/null
+++ b/templates/web/seesomething/around/around_index.html
@@ -0,0 +1,24 @@
+[% INCLUDE 'header.html', title => loc('Reporting a problem'), bodyclass = 'mappage' %]
+
+<form action="[% c.uri_for('/around') %]" method="get" name="mapForm" id="mapForm">
+ <div id="side-form">
+ <div id="report-a-problem-main">
+ [% INCLUDE 'around/postcode_form.html' %]
+
+ [% IF location_error %]
+ <p class="error">[% location_error %]</p>
+ [% END %]
+
+ [% IF possible_location_matches %]
+ <p>[% loc('We found more than one match for that location. We show up to ten matches, please try a different search if yours is not here.') %]</p>
+ <ul class="pc_alternatives">
+ [% FOREACH match IN possible_location_matches %]
+ <li><a href="/around?latitude=[% match.latitude | uri %];longitude=[% match.longitude | uri %]">[% match.address | html %]</a></li>
+ [% END %]
+ </ul>
+ [% END %]
+ </div>
+ </div>
+</form>
+
+[% INCLUDE 'footer.html' %]
diff --git a/templates/web/seesomething/around/display_location.html b/templates/web/seesomething/around/display_location.html
new file mode 100644
index 000000000..e90d1aa0e
--- /dev/null
+++ b/templates/web/seesomething/around/display_location.html
@@ -0,0 +1,49 @@
+[%
+
+ url_skip = c.uri_for(
+ '/report/new',
+ {
+ pc => pc
+ latitude => short_latitude,
+ longitude => short_longitude,
+ skipped => 1,
+ }
+ );
+
+ PROCESS "maps/${map.type}.html";
+
+ INCLUDE 'header.html',
+ title => loc('Viewing a location')
+ bodyclass => 'mappage',
+ robots => 'noindex,nofollow';
+
+%]
+
+<form action="[% c.uri_for('/report/new') %]" method="post" name="mapForm" id="mapForm" enctype="multipart/form-data" class="validate">
+ [% IF c.req.params.map_override %]
+ <input type="hidden" name="map_override" value="[% c.req.params.map_override | html %]">
+ [% END %]
+ <input type="hidden" name="pc" value="[% pc | html %]">
+
+ <input type="hidden" name="latitude" id="fixmystreet.latitude" value="[% short_latitude | html %]">
+ <input type="hidden" name="longitude" id="fixmystreet.longitude" value="[% short_longitude | html %]">
+
+ [% map_html %]
+
+ </div>
+
+ <div id="side">
+ [% INCLUDE 'around/_report_banner.html' %]
+ </div>
+
+ <div style="display:none" id="side-form">
+ [% INCLUDE "report/new/fill_in_details_form.html"
+ js = 1,
+ report.used_map = 1
+ report.name = c.user.name
+ %]
+ </div>
+
+</form>
+
+[% INCLUDE 'footer.html' %]
diff --git a/templates/web/seesomething/around/postcode_form.html b/templates/web/seesomething/around/postcode_form.html
new file mode 100644
index 000000000..56fcdca97
--- /dev/null
+++ b/templates/web/seesomething/around/postcode_form.html
@@ -0,0 +1,17 @@
+<div id="front-main">
+ <div id="front-main-container">
+ [%
+ question = c.cobrand.enter_postcode_text || loc('Enter a nearby street name and area');
+ %]
+
+ <label for="pc">[% question %]:</label>
+ <div>
+ <input type="text" name="pc" value="[% pc | html %]" id="pc" size="10" maxlength="200" placeholder="[% tprintf(loc('e.g. ‘%s’ or ‘%s’'), c.cobrand.example_places) %]">
+ <input type="submit" value="[% loc('Go') %]" id="submit">
+ </div>
+
+ [% IF partial_token %]
+ <input type="hidden" name="partial" value="[% partial_token.token %]">
+ [% END %]
+ </div>
+</div>
diff --git a/templates/web/seesomething/footer.html b/templates/web/seesomething/footer.html
new file mode 100644
index 000000000..95297f33d
--- /dev/null
+++ b/templates/web/seesomething/footer.html
@@ -0,0 +1,22 @@
+ </div><!-- .content role=main -->
+ </div><!-- .container -->
+ </div><!-- .table-cell -->
+
+ <div class="nav-wrapper">
+ <div class="nav-wrapper-2">
+ <div id="main-nav" role="navigation">
+
+ <ul id="main-menu">
+ <li><[% IF c.req.uri.path == '/' %]span[% ELSE %]a href="/"[% END %] class="report-a-problem-btn"
+ >[% loc("Report a problem") %]</[% c.req.uri.path == '/' ? 'span' : 'a' %]></li>[%
+ %]<li><[% IF c.req.uri.path == '/faq' %]span[% ELSE %]a href="/faq"[% END
+ %]>[% loc("Help") %]</[% c.req.uri.path == '/faq' ? 'span' : 'a' %]></li>
+ </ul>
+ </div>
+ </div>
+ </div>
+
+<!-- [% INCLUDE 'debug_footer.html' %] -->
+ </div> <!-- .wrapper -->
+</body>
+</html>
diff --git a/templates/web/seesomething/front/stats.html b/templates/web/seesomething/front/stats.html
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/templates/web/seesomething/front/stats.html
diff --git a/templates/web/seesomething/front/tips.html b/templates/web/seesomething/front/tips.html
new file mode 100644
index 000000000..34712656d
--- /dev/null
+++ b/templates/web/seesomething/front/tips.html
@@ -0,0 +1,3 @@
+ <p>
+ If you are unsure about where the incident took place as you where on a moving train or bus then use the location of the start of your journey and mention which bus or train you where on in your report.
+ </p>
diff --git a/templates/web/seesomething/index.html b/templates/web/seesomething/index.html
new file mode 100644
index 000000000..cccd15709
--- /dev/null
+++ b/templates/web/seesomething/index.html
@@ -0,0 +1,43 @@
+[%# Assumes fixmystreet cobrand is using FMS map template - for bonus points preload all the right map elements. %]
+
+[% PROCESS "maps/fms.html" %]
+[% INCLUDE 'header.html', title = '', bodyclass = 'mappage' %]
+
+<form action="[% c.uri_for('/around') %]" method="get" name="mapForm" id="mapForm">
+<script type="text/javascript">
+var fixmystreet = {
+ 'page': '',
+ 'latitude': 52.505241,
+ 'longitude': -1.815285,
+ 'zoom': 3,
+ 'numZoomLevels': 5,
+ 'zoomOffset': 13,
+ 'map_type': ""
+
+}
+</script>
+<div id="map_box">
+ <div id="map"></div>
+ </div>
+
+ <div id="side-form">
+ <div id="report-a-problem-main">
+ [% form = PROCESS 'around/postcode_form.html' %]
+ [% form %]
+
+ [% IF error %]
+ <p class="form-error">[% error %]</p>
+ [% END %]
+
+ <div class="tablewrapper">
+ <div id="front-howto">
+ [% INCLUDE 'index-steps.html' %]
+ </div>
+
+ </div>
+
+ </div>
+ </div>
+</form>
+
+[% INCLUDE 'footer.html' pagefooter = 'yes' %]
diff --git a/templates/web/seesomething/js/validation_rules.html b/templates/web/seesomething/js/validation_rules.html
new file mode 100644
index 000000000..cef5fce7e
--- /dev/null
+++ b/templates/web/seesomething/js/validation_rules.html
@@ -0,0 +1,13 @@
+ validation_rules = {
+ detail: { required: true },
+ category: { required: true },
+ subcategory: { required: true }
+ };
+
+ $(function(){
+ $('#submit_noname').click( function(e) {
+ $('#form_category').addClass('required validCategory').removeClass('valid');
+ $('#form_subcategory').addClass('required validCategory').removeClass('valid');
+ });
+ });
+
diff --git a/templates/web/seesomething/js/validation_strings.html b/templates/web/seesomething/js/validation_strings.html
new file mode 100644
index 000000000..64251c163
--- /dev/null
+++ b/templates/web/seesomething/js/validation_strings.html
@@ -0,0 +1,15 @@
+ validation_strings = {
+ detail: '[% loc('Please enter some details') | replace("'", "\\'") %]',
+ name: {
+ validName: '[% loc('Please enter your full name, councils need this information – if you do not wish your name to be shown on the site, untick the box below') | replace("'", "\\'") %]'
+ },
+ category: '[% loc('Please choose a transport category') | replace("'", "\\'") %]',
+ subcategory: '[% loc('Please choose an incident category') | replace("'", "\\'") %]',
+ rznvy: {
+ required: '[% loc('Please enter your email') | replace("'", "\\'") %]',
+ email: '[% loc('Please enter a valid email') | replace("'", "\\'") %]'
+ },
+ email: {
+ email: '[% loc('Please enter a valid email') | replace("'", "\\'") %]'
+ },
+ };
diff --git a/templates/web/seesomething/report/display.html b/templates/web/seesomething/report/display.html
new file mode 100644
index 000000000..93b0048a2
--- /dev/null
+++ b/templates/web/seesomething/report/display.html
@@ -0,0 +1,9 @@
+[%
+ INCLUDE 'header.html'
+ robots = 'index, nofollow',
+ bobyclass = 'mappage';
+%]
+
+Reports to this site are private
+
+[% INCLUDE 'footer.html' %]
diff --git a/templates/web/seesomething/report/new/category.html b/templates/web/seesomething/report/new/category.html
new file mode 100644
index 000000000..26d750b52
--- /dev/null
+++ b/templates/web/seesomething/report/new/category.html
@@ -0,0 +1,14 @@
+[% FILTER collapse %]
+[% IF category_options.size %]
+ [% IF category;
+ category = category | lower;
+ END; %]
+ <label for='form_category' class="select">[% category_label | html %]</label>
+ <select name='category' data-theme="c" id='form_category'[% ' onchange="form_category_onchange()"' IF category_extras.size %]>
+ [% FOREACH cat_op IN category_options %]
+ [% cat_op_lc = cat_op | lower %]
+ <option value='[% cat_op | html %]'[% ' selected' IF report.category == cat_op || category == cat_op_lc %]>[% cat_op | html %]</option>
+ [% END %]
+ </select>
+[% END %]
+[% END -%]
diff --git a/templates/web/seesomething/report/new/fill_in_details_form.html b/templates/web/seesomething/report/new/fill_in_details_form.html
new file mode 100644
index 000000000..659fadd04
--- /dev/null
+++ b/templates/web/seesomething/report/new/fill_in_details_form.html
@@ -0,0 +1,104 @@
+<div id="report-a-problem-main">
+ <p>Click and drag on the map to reposition the pin.</p>
+ <h1>[% loc('Reporting a problem') %]</h1>
+
+
+ [% INCLUDE 'errors.html' %]
+ <fieldset>
+ <div id="problem_form">
+
+ [% INCLUDE 'report/new/form_heading.html' %]
+
+ [% IF field_errors.council %]
+ <p class='form-error'>[% field_errors.council %]</p>
+ [% END %]
+
+ <label for="form_detail">[% loc('Details') %]</label>
+ [% IF field_errors.detail %]
+ <p class='form-error'>[% field_errors.detail %]</p>
+ [% END %]
+ <textarea rows="7" cols="26" name="detail" id="form_detail" placeholder="[% loc('Please fill in details of the problem.') %]" required>[% report.detail | html %]</textarea>
+
+ [% IF js %]
+ <div id="form_category_row">
+ <label for="form_category">[% loc('Transport Category') %]</label>
+ <select name="category" id="form_category" required><option>[% loc('Loading...') %]</option></select>
+ </div>
+ [% ELSE %]
+ [% IF category_options.size %]
+ [% IF field_errors.category %]
+ <p class='form-error'>[% field_errors.category %]</p>
+ [% END %]
+
+ [% PROCESS "report/new/category.html" %]
+ [% END %]
+ [% END %]
+
+ <div id="form_subcategory_row">
+ <label for="form_subcategory">[% loc('Incident Category') %]</label>
+ <select name="subcategory" id="form_subcategory" required>
+ <option value="">-- Pick a category --</option>
+ <option value="Smoking/other drugs">Smoking/other drugs</option>
+ <option value="Drugs">Drugs</option>
+ <option value="Anti-social behaviour">Anti-social behaviour</option>
+ <option value="Loud music">Loud music</option>
+ <option value="Damage">Damage</option>
+ <option value="Feet on seats">Feet on seats</option>
+ <option value="Other">Other</option>
+ </select>
+ </div>
+
+ [% IF c.cobrand.allow_photo_upload %]
+ <label for="form_photo">[% loc('Photo') %]</label>
+ [% IF upload_fileid || report.photo %]
+ [% IF upload_fileid %]
+ <img align="right" src="/photo/[% upload_fileid %].temp.jpeg" alt="">
+ <input type="hidden" name="upload_fileid" value="[% upload_fileid %]">
+ [% END %]
+
+ <p>[% loc('You have already attached a photo to this report, attaching another one will replace it.') %]</p>
+
+ [% IF report.photo %]
+ <img align="right" src="/photo/[% report.id %].jpeg">
+ [% END %]
+ [% END %]
+
+ [% IF field_errors.photo %]
+ <p class='form-error'>[% field_errors.photo %]</p>
+ [% END %]
+ <input type="file" name="photo" id="form_photo">
+ [% END %]
+
+ <h2>Personal Details:</h2>
+
+ <label for="form_name">[% loc('Name (optional)') %]</label>
+ [% IF field_errors.name %]
+ <p class='form-error'>[% field_errors.name %]</p>
+ [% END %]
+
+ <input type="text" class="form-focus-trigger validName" value="[% report.name | html %]" name="name" id="form_name" placeholder="[% loc('Your name') %]">
+
+ <label for="form_email">[% loc('Your email (optional)') %]</label>
+ [% IF field_errors.email %]
+ <p class='form-error'>[% field_errors.email %]</p>
+ [% END %]
+ <input type="email" value="[% report.user.email | html %]" name="email" id="form_email" placeholder="[% loc('Please enter your email address') %]">
+
+
+
+ <label class="" for="form_phone">[% loc('Phone number (optional)') %]</label>
+ <input class="" type="text" value="[% report.user.phone | html %]" name="phone" id="form_phone" placeholder="[% loc('Your phone number') %]">
+
+ <div class="form-txt-submit-box ">
+ <input class="green-btn" type="submit" id="submit_noname" name="submit_noname" value="[% loc('Submit') %]">
+ </div>
+
+ </div>
+ </fieldset>
+
+ [% IF partial_token %]
+ <input type="hidden" name="partial" value="[% partial_token.token %]">
+ [% END %]
+
+ <input type="hidden" name="submit_problem" value="1">
+</div>
diff --git a/templates/web/seesomething/report_created.html b/templates/web/seesomething/report_created.html
new file mode 100644
index 000000000..4a11d14b4
--- /dev/null
+++ b/templates/web/seesomething/report_created.html
@@ -0,0 +1,29 @@
+[%
+
+ IF report.used_map;
+ PROCESS "maps/${map.type}.html";
+ END;
+
+ INCLUDE 'header.html',
+ title => loc('Report created')
+ bodyclass => 'mappage',
+ robots => 'noindex,nofollow';
+%]
+
+
+ [% IF report.used_map %]
+ [% map_html %]
+
+ </div>
+ [% END %]
+
+ <div id="side">
+<div id="report-a-problem-main">
+ <h1>Complete</h1>
+ <p>Your report has been sent. If you included contact details we may be in touch to follow up or request more details.</p>
+ <p>Thank you for saying something and making our transport safer.</p>
+ <p><img src="../cobrands/seesomething/images/btp-wmp-logos.png" alt="British Transport Police and the West Midlands Police" width="271" height="116"></p>
+</div>
+ </div>
+
+[% INCLUDE 'footer.html' %]
diff --git a/templates/web/seesomething/set_body_class.html b/templates/web/seesomething/set_body_class.html
new file mode 100644
index 000000000..b613706f2
--- /dev/null
+++ b/templates/web/seesomething/set_body_class.html
@@ -0,0 +1 @@
+[% bodyclass = ( bodyclass ? bodyclass : 'mappage' ) %]
diff --git a/web/js/fixmystreet.js b/web/js/fixmystreet.js
index 98e92606d..1d5ef6b97 100644
--- a/web/js/fixmystreet.js
+++ b/web/js/fixmystreet.js
@@ -53,13 +53,7 @@ $(function(){
var submitted = false;
$("form.validate").validate({
- rules: {
- title: { required: true },
- detail: { required: true },
- email: { required: true },
- update: { required: true },
- rznvy: { required: true }
- },
+ rules: validation_rules,
messages: validation_strings,
onkeyup: false,
onfocusout: false,