diff --git a/perllib/FixMyStreet/App/Controller/Admin.pm b/perllib/FixMyStreet/App/Controller/Admin.pm index 114a2e19f22..6145a6eb025 100644 --- a/perllib/FixMyStreet/App/Controller/Admin.pm +++ b/perllib/FixMyStreet/App/Controller/Admin.pm @@ -425,7 +425,7 @@ sub update_contacts : Private { sub body_params : Private { my ( $self, $c ) = @_; - my @fields = qw/name endpoint jurisdiction api_key send_method send_comments suppress_alerts send_extended_statuses comment_user_id can_be_devolved parent deleted/; + my @fields = qw/name endpoint jurisdiction api_key send_method external_url/; my %defaults = map { $_ => '' } @fields; %defaults = ( %defaults, send_comments => 0, @@ -436,7 +436,7 @@ sub body_params : Private { parent => undef, deleted => 0, ); - my %params = map { $_ => $c->get_param($_) || $defaults{$_} } @fields; + my %params = map { $_ => $c->get_param($_) || $defaults{$_} } keys %defaults; return \%params; } @@ -705,6 +705,13 @@ sub report_edit : Path('report_edit') : Args(1) { $c->forward( 'log_edit', [ $id, 'problem', 'resend' ] ); } + elsif ( $c->get_param('mark_sent') ) { + $c->forward('check_token'); + $problem->whensent(\'ms_current_timestamp()'); + $problem->update(); + $c->stash->{status_message} = '

' . _('That problem has been marked as sent.') . '

'; + $c->forward( 'log_edit', [ $id, 'problem', 'marked sent' ] ); + } elsif ( $c->get_param('flaguser') ) { $c->forward('flag_user'); $c->stash->{problem}->discard_changes; diff --git a/t/app/controller/admin.t b/t/app/controller/admin.t index f63a7211734..498f1cedcbb 100644 --- a/t/app/controller/admin.t +++ b/t/app/controller/admin.t @@ -568,7 +568,7 @@ foreach my $test ( $report->discard_changes; - if ( $report->state eq 'confirmed' ) { + if ($report->state eq 'confirmed' && $report->whensent) { $mech->content_contains( 'type="submit" name="resend"', 'resend button' ); } else { $mech->content_lacks( 'type="submit" name="resend"', 'no resend button' ); @@ -1083,7 +1083,7 @@ subtest 'report search' => sub { subtest 'search abuse' => sub { $mech->get_ok( '/admin/users?search=example' ); - $mech->content_like(qr{test4\@example.com.*\s*.*?\s*\(Email in abuse table}); + $mech->content_like(qr{test4\@example.com.*\s*.*?\s*\(Email in abuse table}s); }; subtest 'show flagged entries' => sub { diff --git a/templates/web/base/admin/bodies.html b/templates/web/base/admin/bodies.html index a039f8208ba..4c95423c0b2 100644 --- a/templates/web/base/admin/bodies.html +++ b/templates/web/base/admin/bodies.html @@ -35,13 +35,13 @@ [% IF c.cobrand.moniker == 'zurich' %] [% FILTER repeat(4*body.api_key) %] [% END %] [% IF admin_type == 'super' %] - [% body.name %] + [% body.name | html %] [% ELSE %] - [% body.name %] + [% body.name | html %] [% END %] [% ELSE %] [%# not Zurich: all bodies should be links %] - [% body.name %] - [%- ', ' _ body.parent.name IF body.parent -%] + [% body.name | html%] + [%- IF body.parent %], [% body.parent.name | html %][% END -%] [% END %] [% IF c.cobrand.moniker == 'zurich' %] diff --git a/templates/web/base/admin/body-form.html b/templates/web/base/admin/body-form.html index 608a77dc26c..6b103a7cf5d 100644 --- a/templates/web/base/admin/body-form.html +++ b/templates/web/base/admin/body-form.html @@ -16,7 +16,7 @@

- +

@@ -72,17 +72,21 @@ [% SET body_areas = body.areas %] [% FOR area IN areas %] [% SET aid = area.id %] - + [% END %]

+

+ + +

[% loc( "You can mark a body as deleted if you do not want it to be active on the site." ) %]

- +

@@ -124,7 +128,7 @@

- +

@@ -137,7 +141,7 @@

- +

@@ -150,7 +154,7 @@

- +

@@ -180,6 +184,9 @@

+ [% IF body.comment_user_id %] + [% loc('edit user') %] + [% END %]

diff --git a/templates/web/base/admin/body.html b/templates/web/base/admin/body.html index cd87a5af845..84ea6840ca6 100644 --- a/templates/web/base/admin/body.html +++ b/templates/web/base/admin/body.html @@ -13,14 +13,22 @@ [% IF example_pc %] [% tprintf( loc('Example postcode %s'), example_pc ) | html %] | [% END %] - [% IF c.cobrand.moniker == 'emptyhomes' %] - [% loc('List all reported problems' ) %] | - [% ELSE %] + [% loc('Area covered') %]: + [% SET body_areas = body.areas %] + [% FOR area IN areas %] + [% SET aid = area.id %] + [% IF body_areas.$aid %] + [% area.name | html %] + [% END %] + [% END %] +
[% loc('List all reported problems' ) %] | - [% END %] - [% loc('Text only version') %] + [% loc('Text only version') %]

+ [% IF body.send_method == 'Open311' %]

Council contacts configured via Open311 @@ -65,7 +73,7 @@

[% WHILE ( cat = contacts.next ) %] - [% cat.category %] + [% cat.category | html %]
[% cat.email | html %] [% loc('Confirmed') %]:  @@ -79,10 +87,10 @@


[% loc('Devolved') %]:  [%- IF body.can_be_devolved AND cat.send_method %][% loc('Yes') %][% ELSE %][% loc('No') %][% END %] - [% cat.editor %] + [% cat.editor | html %]
[% PROCESS format_time time=cat.whenedited %] [% cat.note | html %] - + [% END %] diff --git a/templates/web/base/admin/category_edit.html b/templates/web/base/admin/category_edit.html index ef7a0a11c76..b827a4b6da9 100644 --- a/templates/web/base/admin/category_edit.html +++ b/templates/web/base/admin/category_edit.html @@ -23,6 +23,11 @@

[% loc('Category:') %] [% contact.category | html %] + [% IF contact.extra %] +

[% loc('Extra data:') %] + [% USE Dumper %] + [% Dumper.dump(contact.extra) | html %]

+ [% END %]

[% loc('Email:') %] @@ -48,17 +53,17 @@

[% loc('Configure Endpoint') %]

- +

- +

- +

@@ -93,7 +98,7 @@

[% loc('History') %]

[% PROCESS highlightchanged old=prev new=contact value='email' %] [% PROCESS highlightchanged_yesno old=prev new=contact value='confirmed' %] [% PROCESS highlightchanged_yesno old=prev new=contact value='deleted' %] - [% contact.editor %] + [% contact.editor | html %] [% contact.note | html %] [%- prev = contact %] diff --git a/templates/web/base/admin/report_edit.html b/templates/web/base/admin/report_edit.html index 12560fdf31a..d488dcadc36 100644 --- a/templates/web/base/admin/report_edit.html +++ b/templates/web/base/admin/report_edit.html @@ -20,14 +20,27 @@
  • -
  • [% loc('Co-ordinates:') %] [% problem.latitude %], [% problem.longitude %] +
  • [% loc('Co-ordinates:') %] +[% problem.latitude %], [% problem.longitude %] ( [% SET postcode_safe = problem.postcode | html; tprintf( loc('originally entered: “%s”'), postcode_safe ) %], [% IF problem.used_map %][% loc('used map') %][% ELSE %][% loc("didn't use map") %][% END %])
  • -
  • [% loc('For council(s):') %] [% IF problem.bodies_str %][% problem.bodies_str %][% ELSE %][% loc('None' ) %][% END %] ([% loc('other areas:') %] [% problem.areas | remove('^,') | remove( ',$' ) %])
  • +
  • [% loc('Body:') %] + [% IF problem.bodies_str %] + [% FOREACH body IN problem.bodies.values %] + [% body.name | html %] + [%- ',' IF NOT loop.last %] + [% END %] + [% ELSE %] + [% loc('None' ) %] + [% END %] + ([% loc('other areas:') %] [% problem.areas | remove('^,') | remove( ',$' ) %])
  • [% IF problem.extra.address %]
  • [% loc('Property address:') %] [% problem.extra.address | html %]
  • [% END %] @@ -68,7 +81,10 @@
  • [% loc('Phone:') %] [% problem.user.phone | html %]
  • [% loc('Created:') %] [% PROCESS format_time time=problem.created %]
  • [% loc('Confirmed:') %] [% PROCESS format_time time=problem.confirmed no_time='-' %]
  • -
  • [% loc('Sent:') %] [% PROCESS format_time time=problem.whensent %] [% IF problem.state == 'confirmed' %][% END %]
  • +
  • [% loc('Sent:') %] [% PROCESS format_time time=problem.whensent %] +[% IF problem.state == 'confirmed' AND problem.whensent %][% END %] +[% IF NOT problem.whensent %][% END %] +
  • [% loc('Last update:') %] [% PROCESS format_time time=problem.lastupdate %]
  • [% loc('Service:') %] [% problem.service %]
  • [% loc('Cobrand:') %] [% problem.cobrand %]
  • diff --git a/templates/web/base/admin/user-form.html b/templates/web/base/admin/user-form.html index 4a57b05a082..3956e8533d6 100644 --- a/templates/web/base/admin/user-form.html +++ b/templates/web/base/admin/user-form.html @@ -34,8 +34,9 @@ [% FOR body IN bodies %] [% END %] - + [% IF user.from_body AND user.has_permission_to('moderate', user.from_body.id) %]*[% END %] + [% IF c.cobrand.moniker != 'zurich' %]
  • diff --git a/templates/web/base/admin/users.html b/templates/web/base/admin/users.html index db97c7d5976..19a3de03cdb 100644 --- a/templates/web/base/admin/users.html +++ b/templates/web/base/admin/users.html @@ -24,7 +24,9 @@ [% PROCESS value_or_nbsp value=user.name %] [% PROCESS value_or_nbsp value=user.email %] - [% PROCESS value_or_nbsp value=user.from_body.name %] + [% PROCESS value_or_nbsp value=user.from_body.name %] + [% IF user.from_body AND user.has_permission_to('moderate', user.from_body.id) %] * [% END %] + [% IF c.cobrand.moniker != 'zurich' %] [% user.flagged == 2 ? loc('(Email in abuse table)') : user.flagged ? loc('Yes') : ' ' %] [% END %] diff --git a/web/js/fixmystreet-admin.js b/web/js/fixmystreet-admin.js index e49516a5cad..5e0d873c566 100644 --- a/web/js/fixmystreet-admin.js +++ b/web/js/fixmystreet-admin.js @@ -9,7 +9,7 @@ $(function(){ var show_open311 = false; if ($('#endpoint').val()) { show_open311 = true; // always show the form if there is an endpoint value - } else if (send_method && send_method.toLowerCase() != 'email') { + } else if (send_method && !send_method.match(/^(email|emptyhomes|noop|refused)$/i)) { show_open311 = true; } if (show_open311) {