From af8eb4acce9ee1e00b9790fd0223fe1667115089 Mon Sep 17 00:00:00 2001 From: Matthew Somerville Date: Fri, 20 Apr 2012 13:21:07 +0100 Subject: Inherit new design, site title, Bing working. --- perllib/FixMyStreet/App/Controller/Council.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'perllib/FixMyStreet/App/Controller') diff --git a/perllib/FixMyStreet/App/Controller/Council.pm b/perllib/FixMyStreet/App/Controller/Council.pm index 48248e4fe..c4819765a 100644 --- a/perllib/FixMyStreet/App/Controller/Council.pm +++ b/perllib/FixMyStreet/App/Controller/Council.pm @@ -82,7 +82,7 @@ sub load_and_check_councils : Private { $c->cobrand->remove_redundant_councils($all_councils) if $c->stash->{remove_redundant_councils}; # If we don't have any councils we can't accept the report - if ( !scalar keys %$all_councils ) { + if ( !scalar keys %$all_councils || $all_councils->{error}) { $c->stash->{location_offshore} = 1; return; } -- cgit v1.2.3 From 64fcf9db855a8058ff5a3088c59f1a9cb5e0bb4c Mon Sep 17 00:00:00 2001 From: Matthew Somerville Date: Fri, 20 Apr 2012 16:04:57 +0100 Subject: If no mapit is defined, just return a default area always (for #182). --- perllib/FixMyStreet/App/Controller/Council.pm | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'perllib/FixMyStreet/App/Controller') diff --git a/perllib/FixMyStreet/App/Controller/Council.pm b/perllib/FixMyStreet/App/Controller/Council.pm index c4819765a..b488346f8 100644 --- a/perllib/FixMyStreet/App/Controller/Council.pm +++ b/perllib/FixMyStreet/App/Controller/Council.pm @@ -37,6 +37,16 @@ there are no councils then return false. sub load_and_check_councils : Private { my ( $self, $c ) = @_; + + # If no mapit is set up, let it through wherever + unless ($c->config->{MAPIT_URL}) { + my $area = { "name" => "Default Area", "type" => "ZZZ", "id" => 0 }; + $c->stash->{all_areas} = { 0 => $area }; + $c->stash->{all_councils} = { 0 => $area }; + $c->stash->{all_council_names} = [ 'Default Area' ]; + return 1; + } + my $latitude = $c->stash->{latitude}; my $longitude = $c->stash->{longitude}; -- cgit v1.2.3 From 4f4dd76967e1bff4be4e11a405a2438bfcd25de4 Mon Sep 17 00:00:00 2001 From: Matthew Somerville Date: Mon, 23 Apr 2012 15:40:54 +0100 Subject: Have a whole fake mapit (for #182) that works if MAPIT_URL is set accordingly. --- perllib/FixMyStreet/App/Controller/Council.pm | 9 ----- perllib/FixMyStreet/App/Controller/FakeMapit.pm | 53 +++++++++++++++++++++++++ perllib/FixMyStreet/App/Controller/Reports.pm | 4 +- 3 files changed, 56 insertions(+), 10 deletions(-) create mode 100755 perllib/FixMyStreet/App/Controller/FakeMapit.pm (limited to 'perllib/FixMyStreet/App/Controller') diff --git a/perllib/FixMyStreet/App/Controller/Council.pm b/perllib/FixMyStreet/App/Controller/Council.pm index b488346f8..1d801c292 100644 --- a/perllib/FixMyStreet/App/Controller/Council.pm +++ b/perllib/FixMyStreet/App/Controller/Council.pm @@ -38,15 +38,6 @@ there are no councils then return false. sub load_and_check_councils : Private { my ( $self, $c ) = @_; - # If no mapit is set up, let it through wherever - unless ($c->config->{MAPIT_URL}) { - my $area = { "name" => "Default Area", "type" => "ZZZ", "id" => 0 }; - $c->stash->{all_areas} = { 0 => $area }; - $c->stash->{all_councils} = { 0 => $area }; - $c->stash->{all_council_names} = [ 'Default Area' ]; - return 1; - } - my $latitude = $c->stash->{latitude}; my $longitude = $c->stash->{longitude}; diff --git a/perllib/FixMyStreet/App/Controller/FakeMapit.pm b/perllib/FixMyStreet/App/Controller/FakeMapit.pm new file mode 100755 index 000000000..57c2e7c27 --- /dev/null +++ b/perllib/FixMyStreet/App/Controller/FakeMapit.pm @@ -0,0 +1,53 @@ +package FixMyStreet::App::Controller::FakeMapit; +use Moose; +use namespace::autoclean; + +BEGIN { extends 'Catalyst::Controller'; } + +=head1 NAME + +FixMyStreet::App::Controller::FakeMapit - Catalyst Controller + +=head1 DESCRIPTION + +A controller to fake mapit when we don't have it. If you set MAPIT_URL to +.../fakemapit/ it should all just work, with a mapit that assumes the whole +world is one area, with ID 0 and name "Default Area". + +=head1 METHODS + +=cut + +my $area = { "name" => "Default Area", "type" => "ZZZ", "id" => 0 }; + +sub output : Private { + my ( $self, $c, $data ) = @_; + my $body = JSON->new->utf8(1)->encode( $data ); + $c->res->content_type('application/json; charset=utf-8'); + $c->res->body( $body ); +} + +sub point : Local { + my ( $self, $c ) = @_; + $c->detach( 'output', [ { 0 => $area } ] ); +} + +sub area : Local { + my ( $self, $c ) = @_; + $c->detach( 'output', [ $area ] ); +} + +sub areas : Local { + my ( $self, $c ) = @_; + $c->detach( 'output', [ { 0 => $area } ] ); +} + +sub children : Path('area/0/children') : Args(0) { + my ( $self, $c ) = @_; + $c->detach( 'output', [ {} ] ); +} + +__PACKAGE__->meta->make_immutable; + +1; + diff --git a/perllib/FixMyStreet/App/Controller/Reports.pm b/perllib/FixMyStreet/App/Controller/Reports.pm index 9fb72121e..c5f709054 100644 --- a/perllib/FixMyStreet/App/Controller/Reports.pm +++ b/perllib/FixMyStreet/App/Controller/Reports.pm @@ -43,6 +43,7 @@ sub index : Path : Args(0) { $c->stash->{message} = _("Unable to look up areas in MaPit. Please try again later.") . ' ' . sprintf(_('The error was: %s'), $@); $c->stash->{template} = 'errors/generic.html'; + return; } # For each area, add its link and perhaps alter its name if we need to for @@ -70,6 +71,7 @@ sub index : Path : Args(0) { $c->stash->{message} = _("There was a problem showing the All Reports page. Please try again later.") . ' ' . sprintf(_('The error was: %s'), $@); $c->stash->{template} = 'errors/generic.html'; + return; } # Down here so that error pages aren't cached. @@ -126,7 +128,7 @@ sub ward : Path : Args(2) { # List of wards unless ($c->stash->{ward}) { - my $children = mySociety::MaPit::call('area/children', $c->stash->{council}->{id}, + my $children = mySociety::MaPit::call('area/children', [ $c->stash->{council}->{id} ], type => $mySociety::VotingArea::council_child_types, ); foreach (values %$children) { -- cgit v1.2.3 From 79978cebd79325880a7fcbf60b971c1820967cbd Mon Sep 17 00:00:00 2001 From: Matthew Somerville Date: Mon, 23 Apr 2012 16:05:33 +0100 Subject: Doesn't like 0 ID (#182), check right db flag, and factor out tabs for different usage. --- perllib/FixMyStreet/App/Controller/FakeMapit.pm | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'perllib/FixMyStreet/App/Controller') diff --git a/perllib/FixMyStreet/App/Controller/FakeMapit.pm b/perllib/FixMyStreet/App/Controller/FakeMapit.pm index 57c2e7c27..bc46df712 100755 --- a/perllib/FixMyStreet/App/Controller/FakeMapit.pm +++ b/perllib/FixMyStreet/App/Controller/FakeMapit.pm @@ -12,13 +12,13 @@ FixMyStreet::App::Controller::FakeMapit - Catalyst Controller A controller to fake mapit when we don't have it. If you set MAPIT_URL to .../fakemapit/ it should all just work, with a mapit that assumes the whole -world is one area, with ID 0 and name "Default Area". +world is one area, with ID 161 and name "Default Area". =head1 METHODS =cut -my $area = { "name" => "Default Area", "type" => "ZZZ", "id" => 0 }; +my $area = { "name" => "Default Area", "type" => "ZZZ", "id" => 161 }; sub output : Private { my ( $self, $c, $data ) = @_; @@ -29,7 +29,7 @@ sub output : Private { sub point : Local { my ( $self, $c ) = @_; - $c->detach( 'output', [ { 0 => $area } ] ); + $c->detach( 'output', [ { 161 => $area } ] ); } sub area : Local { @@ -39,10 +39,10 @@ sub area : Local { sub areas : Local { my ( $self, $c ) = @_; - $c->detach( 'output', [ { 0 => $area } ] ); + $c->detach( 'output', [ { 161 => $area } ] ); } -sub children : Path('area/0/children') : Args(0) { +sub children : Path('area/161/children') : Args(0) { my ( $self, $c ) = @_; $c->detach( 'output', [ {} ] ); } -- cgit v1.2.3 From 9a758e4041f5221a2fbf8c4121b2601d2162241e Mon Sep 17 00:00:00 2001 From: Matthew Somerville Date: Thu, 26 Apr 2012 13:54:11 +0100 Subject: Area type for Barangay, and hack for working out/in boundaries. Error handling needs looking at. --- perllib/FixMyStreet/App/Controller/Around.pm | 2 +- perllib/FixMyStreet/App/Controller/Council.pm | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) (limited to 'perllib/FixMyStreet/App/Controller') diff --git a/perllib/FixMyStreet/App/Controller/Around.pm b/perllib/FixMyStreet/App/Controller/Around.pm index e110cf8d7..0901599ed 100644 --- a/perllib/FixMyStreet/App/Controller/Around.pm +++ b/perllib/FixMyStreet/App/Controller/Around.pm @@ -45,7 +45,7 @@ sub around_index : Path : Args(0) { || $c->forward('/location/determine_location_from_pc'); # Check to see if the spot is covered by a council - if not show an error. - return unless $c->forward('check_location_is_acceptable'); + return unless $c->cobrand->moniker eq 'fixmybarangay' || $c->forward('check_location_is_acceptable'); # If we have a partial - redirect to /report/new so that it can be # completed. diff --git a/perllib/FixMyStreet/App/Controller/Council.pm b/perllib/FixMyStreet/App/Controller/Council.pm index 1d801c292..7a0f9b73f 100644 --- a/perllib/FixMyStreet/App/Controller/Council.pm +++ b/perllib/FixMyStreet/App/Controller/Council.pm @@ -85,6 +85,7 @@ sub load_and_check_councils : Private { # If we don't have any councils we can't accept the report if ( !scalar keys %$all_councils || $all_councils->{error}) { $c->stash->{location_offshore} = 1; + $c->stash->{location_error} = 'That point is outside the boundaries.'; return; } -- cgit v1.2.3 From 98eb8e031e5082402fd88adf7d67bab910611973 Mon Sep 17 00:00:00 2001 From: Matthew Somerville Date: Tue, 8 May 2012 14:01:36 +0100 Subject: Allow display of areas on /around. --- perllib/FixMyStreet/App/Controller/Around.pm | 1 + 1 file changed, 1 insertion(+) (limited to 'perllib/FixMyStreet/App/Controller') diff --git a/perllib/FixMyStreet/App/Controller/Around.pm b/perllib/FixMyStreet/App/Controller/Around.pm index 0901599ed..fc6df20c3 100644 --- a/perllib/FixMyStreet/App/Controller/Around.pm +++ b/perllib/FixMyStreet/App/Controller/Around.pm @@ -203,6 +203,7 @@ sub display_location : Private { longitude => $short_longitude, clickable => 1, pins => \@pins, + area => $c->cobrand->areas_on_around, ); return 1; -- cgit v1.2.3 From 7e6f8a128038523734f315ddb01df50f31bd91db Mon Sep 17 00:00:00 2001 From: Dave Whiteland Date: Tue, 10 Jul 2012 01:50:30 +0100 Subject: passing MM message number through service field, callback on view (needs client check to only trigger on rreports created this session) --- perllib/FixMyStreet/App/Controller/Report/New.pm | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'perllib/FixMyStreet/App/Controller') diff --git a/perllib/FixMyStreet/App/Controller/Report/New.pm b/perllib/FixMyStreet/App/Controller/Report/New.pm index 5bf184ae6..3d356cc40 100644 --- a/perllib/FixMyStreet/App/Controller/Report/New.pm +++ b/perllib/FixMyStreet/App/Controller/Report/New.pm @@ -1001,6 +1001,11 @@ sub save_user_and_report : Private { # Set unknown to DB unknown $report->council( undef ) if $report->council eq '-1'; + # if there is a Message Manager message ID, pass it back to the client view + if ($c->req->param('mm_msg_id')) { + $report->service( $c->req->param('mm_msg_id') ); + } + # save the report; $report->in_storage ? $report->update : $report->insert(); -- cgit v1.2.3 From 5fd90e4a82dcc5b2e7dd582dca2c1cd9c655c28c Mon Sep 17 00:00:00 2001 From: Struan Donald Date: Wed, 11 Jul 2012 17:18:37 +0100 Subject: if report generated from message manager pass id to report page --- perllib/FixMyStreet/App/Controller/Report/New.pm | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'perllib/FixMyStreet/App/Controller') diff --git a/perllib/FixMyStreet/App/Controller/Report/New.pm b/perllib/FixMyStreet/App/Controller/Report/New.pm index 3d356cc40..c09b721b9 100644 --- a/perllib/FixMyStreet/App/Controller/Report/New.pm +++ b/perllib/FixMyStreet/App/Controller/Report/New.pm @@ -1003,6 +1003,7 @@ sub save_user_and_report : Private { # if there is a Message Manager message ID, pass it back to the client view if ($c->req->param('mm_msg_id')) { + $c->stash->{mm_msg_id} = $c->req->param('mm_msg_id'); $report->service( $c->req->param('mm_msg_id') ); } @@ -1068,7 +1069,13 @@ sub redirect_or_confirm_creation : Private { if ( $report->confirmed ) { # Subscribe problem reporter to email updates $c->forward( 'create_reporter_alert' ); - my $report_uri = $c->uri_for( '/report', $report->id ); + my $report_uri; + + if ( $c->cobrand->moniker eq 'fixmybarangay' && $c->user->from_council && $c->stash->{mm_msg_id}) { + $report_uri = $c->uri_for( '/report', $report->id, undef, { mm_msg_id => $c->stash->{mm_msg_id} } ); + } else { + $report_uri = $c->uri_for( '/report', $report->id ); + } $c->log->info($report->user->id . ' was logged in, redirecting to /report/' . $report->id); $c->res->redirect($report_uri); $c->detach; -- cgit v1.2.3 From 83be54e6b5b465217ec1cddef31f220915f5ed0f Mon Sep 17 00:00:00 2001 From: Dave Whiteland Date: Wed, 11 Jul 2012 17:20:55 +0100 Subject: reworking mm_msg_id, instead of service --- perllib/FixMyStreet/App/Controller/Report/New.pm | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'perllib/FixMyStreet/App/Controller') diff --git a/perllib/FixMyStreet/App/Controller/Report/New.pm b/perllib/FixMyStreet/App/Controller/Report/New.pm index 3d356cc40..882fa30be 100644 --- a/perllib/FixMyStreet/App/Controller/Report/New.pm +++ b/perllib/FixMyStreet/App/Controller/Report/New.pm @@ -801,6 +801,9 @@ sub process_report : Private { # set these straight from the params $report->category( _ $params{category} ) if $params{category}; + # if there is a Message Manager message ID, save it + $report->mm_msg_id( $params{mm_msg_id} ) if $params{mm_msg_id}=~/^\d+$/; + my $areas = $c->stash->{all_areas}; $report->areas( ',' . join( ',', sort keys %$areas ) . ',' ); @@ -1001,11 +1004,6 @@ sub save_user_and_report : Private { # Set unknown to DB unknown $report->council( undef ) if $report->council eq '-1'; - # if there is a Message Manager message ID, pass it back to the client view - if ($c->req->param('mm_msg_id')) { - $report->service( $c->req->param('mm_msg_id') ); - } - # save the report; $report->in_storage ? $report->update : $report->insert(); @@ -1070,6 +1068,7 @@ sub redirect_or_confirm_creation : Private { $c->forward( 'create_reporter_alert' ); my $report_uri = $c->uri_for( '/report', $report->id ); $c->log->info($report->user->id . ' was logged in, redirecting to /report/' . $report->id); + XXXX $c->res->redirect($report_uri); $c->detach; } -- cgit v1.2.3 From e76a83d5ae9e34f227921847dde45518f6073896 Mon Sep 17 00:00:00 2001 From: Dave Whiteland Date: Wed, 11 Jul 2012 19:02:43 +0100 Subject: whoops XXX --- perllib/FixMyStreet/App/Controller/Report/New.pm | 1 - 1 file changed, 1 deletion(-) (limited to 'perllib/FixMyStreet/App/Controller') diff --git a/perllib/FixMyStreet/App/Controller/Report/New.pm b/perllib/FixMyStreet/App/Controller/Report/New.pm index 08d0addb9..57175269c 100644 --- a/perllib/FixMyStreet/App/Controller/Report/New.pm +++ b/perllib/FixMyStreet/App/Controller/Report/New.pm @@ -1074,7 +1074,6 @@ sub redirect_or_confirm_creation : Private { $report_uri = $c->uri_for( '/report', $report->id ); } $c->log->info($report->user->id . ' was logged in, redirecting to /report/' . $report->id); - XXXX $c->res->redirect($report_uri); $c->detach; } -- cgit v1.2.3 From 55751b48ca0cd977bf1d58ed600eff22bf5e8e81 Mon Sep 17 00:00:00 2001 From: Dave Whiteland Date: Wed, 11 Jul 2012 19:03:38 +0100 Subject: added Message Manager ID (mm_msg_id) column and used it --- perllib/FixMyStreet/App/Controller/Report/New.pm | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'perllib/FixMyStreet/App/Controller') diff --git a/perllib/FixMyStreet/App/Controller/Report/New.pm b/perllib/FixMyStreet/App/Controller/Report/New.pm index 57175269c..011e9e4b6 100644 --- a/perllib/FixMyStreet/App/Controller/Report/New.pm +++ b/perllib/FixMyStreet/App/Controller/Report/New.pm @@ -801,9 +801,6 @@ sub process_report : Private { # set these straight from the params $report->category( _ $params{category} ) if $params{category}; - # if there is a Message Manager message ID, save it - $report->mm_msg_id( $params{mm_msg_id} ) if $params{mm_msg_id}=~/^\d+$/; - my $areas = $c->stash->{all_areas}; $report->areas( ',' . join( ',', sort keys %$areas ) . ',' ); @@ -1004,6 +1001,12 @@ sub save_user_and_report : Private { # Set unknown to DB unknown $report->council( undef ) if $report->council eq '-1'; + # if there is a Message Manager message ID, pass it back to the client view + if ($c->req->param('mm_msg_id')=~/^\d+$/) { + $c->stash->{mm_msg_id} = $c->req->param('mm_msg_id'); + $report->mm_msg_id( $c->req->param('mm_msg_id') ); + } + # save the report; $report->in_storage ? $report->update : $report->insert(); -- cgit v1.2.3 From 8c297f3f178dc8e3678ab28d5d686d2ee542d96c Mon Sep 17 00:00:00 2001 From: Dave Whiteland Date: Thu, 12 Jul 2012 11:50:58 +0100 Subject: changed mm_msg_id to external_source_id, and added external_source col --- perllib/FixMyStreet/App/Controller/Report/New.pm | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'perllib/FixMyStreet/App/Controller') diff --git a/perllib/FixMyStreet/App/Controller/Report/New.pm b/perllib/FixMyStreet/App/Controller/Report/New.pm index 011e9e4b6..b0b338c69 100644 --- a/perllib/FixMyStreet/App/Controller/Report/New.pm +++ b/perllib/FixMyStreet/App/Controller/Report/New.pm @@ -1002,11 +1002,12 @@ sub save_user_and_report : Private { $report->council( undef ) if $report->council eq '-1'; # if there is a Message Manager message ID, pass it back to the client view - if ($c->req->param('mm_msg_id')=~/^\d+$/) { - $c->stash->{mm_msg_id} = $c->req->param('mm_msg_id'); - $report->mm_msg_id( $c->req->param('mm_msg_id') ); - } - + if ($c->cobrand->moniker eq 'fixmybarangay' && $c->req->param('external_source_id')=~/^\d+$/) { + $c->stash->{external_source_id} = $c->req->param('external_source_id'); + $report->external_source_id( $c->req->param('external_source_id') ); + $report->external_source( $c->config->{MESSAGE_MANAGER_URL} ) ; + } + # save the report; $report->in_storage ? $report->update : $report->insert(); @@ -1071,8 +1072,8 @@ sub redirect_or_confirm_creation : Private { $c->forward( 'create_reporter_alert' ); my $report_uri; - if ( $c->cobrand->moniker eq 'fixmybarangay' && $c->user->from_council && $c->stash->{mm_msg_id}) { - $report_uri = $c->uri_for( '/report', $report->id, undef, { mm_msg_id => $c->stash->{mm_msg_id} } ); + 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} } ); } else { $report_uri = $c->uri_for( '/report', $report->id ); } -- cgit v1.2.3 From ee7770bb0130e2e0483af203c7410dad8269bdd7 Mon Sep 17 00:00:00 2001 From: Struan Donald Date: Thu, 23 Aug 2012 12:45:18 +0100 Subject: initial crude add support option for a problem --- perllib/FixMyStreet/App/Controller/Report.pm | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'perllib/FixMyStreet/App/Controller') diff --git a/perllib/FixMyStreet/App/Controller/Report.pm b/perllib/FixMyStreet/App/Controller/Report.pm index d36ba32fe..05c08100d 100644 --- a/perllib/FixMyStreet/App/Controller/Report.pm +++ b/perllib/FixMyStreet/App/Controller/Report.pm @@ -56,6 +56,17 @@ sub display : Path('') : Args(1) { $c->forward( 'format_problem_for_display' ); } +sub support : Path('support') : Args(1) { + my ( $self, $c, $id ) = @_; + + if ( $c->cobrand->can_support_problems && $c->user && $c->user->from_council ) { + $c->forward( 'load_problem_or_display_error', [ $id ] ); + $c->stash->{problem}->interest_count( $c->stash->{problem}->interest_count + 1 ); + $c->stash->{problem}->update; + } + $c->res->redirect( $c->uri_for( '', $id ) ); +} + sub load_problem_or_display_error : Private { my ( $self, $c, $id ) = @_; -- cgit v1.2.3 From ce3622a64d372eb4ee0c3a27f943061a434e06e4 Mon Sep 17 00:00:00 2001 From: Struan Donald Date: Thu, 23 Aug 2012 16:27:00 +0100 Subject: allow adding of message manager messages as updates rather than as issues --- perllib/FixMyStreet/App/Controller/Report/Update.pm | 1 + 1 file changed, 1 insertion(+) (limited to 'perllib/FixMyStreet/App/Controller') diff --git a/perllib/FixMyStreet/App/Controller/Report/Update.pm b/perllib/FixMyStreet/App/Controller/Report/Update.pm index c49123a90..1141e213a 100644 --- a/perllib/FixMyStreet/App/Controller/Report/Update.pm +++ b/perllib/FixMyStreet/App/Controller/Report/Update.pm @@ -348,6 +348,7 @@ sub redirect_or_confirm_creation : Private { if ( $update->confirmed ) { $c->forward( 'update_problem' ); $c->forward( 'signup_for_alerts' ); + my $report_uri = $c->cobrand->base_url_for_report( $update->problem ) . $update->problem->url; $c->res->redirect($report_uri); $c->detach; -- cgit v1.2.3 From 0e87fe14208bb20c4e901ba49c97df91c05e9fd5 Mon Sep 17 00:00:00 2001 From: Struan Donald Date: Fri, 24 Aug 2012 16:10:37 +0100 Subject: adding text from a message manager message increments supporter count --- perllib/FixMyStreet/App/Controller/Report/Update.pm | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'perllib/FixMyStreet/App/Controller') diff --git a/perllib/FixMyStreet/App/Controller/Report/Update.pm b/perllib/FixMyStreet/App/Controller/Report/Update.pm index 1141e213a..39d0ab225 100644 --- a/perllib/FixMyStreet/App/Controller/Report/Update.pm +++ b/perllib/FixMyStreet/App/Controller/Report/Update.pm @@ -76,6 +76,10 @@ sub update_problem : Private { $problem->state('confirmed'); } + if ( $c->cobrand->can_support_problems && $c->user && $c->user->from_council && $c->req->param('external_source_id') ) { + $problem->interest_count( $problem->interest_count + 1 ); + } + $problem->lastupdate( \'ms_current_timestamp()' ); $problem->update; -- cgit v1.2.3 From 1aeb10621ead53f55740e332c00c94277107666b Mon Sep 17 00:00:00 2001 From: Struan Donald Date: Mon, 27 Aug 2012 12:58:26 +0100 Subject: Display support count even if not logged in use a button for adding support rather than a link --- perllib/FixMyStreet/App/Controller/Report.pm | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'perllib/FixMyStreet/App/Controller') diff --git a/perllib/FixMyStreet/App/Controller/Report.pm b/perllib/FixMyStreet/App/Controller/Report.pm index 05c08100d..4127b6247 100644 --- a/perllib/FixMyStreet/App/Controller/Report.pm +++ b/perllib/FixMyStreet/App/Controller/Report.pm @@ -56,15 +56,22 @@ sub display : Path('') : Args(1) { $c->forward( 'format_problem_for_display' ); } -sub support : Path('support') : Args(1) { - my ( $self, $c, $id ) = @_; +sub support : Path('support') : Args(0) { + my ( $self, $c ) = @_; + + my $id = $c->req->param('id'); + + my $uri = + $id + ? $c->uri_for( '/report', $id ) + : $c->uri_for('/'); - if ( $c->cobrand->can_support_problems && $c->user && $c->user->from_council ) { + if ( $id && $c->cobrand->can_support_problems && $c->user && $c->user->from_council ) { $c->forward( 'load_problem_or_display_error', [ $id ] ); $c->stash->{problem}->interest_count( $c->stash->{problem}->interest_count + 1 ); $c->stash->{problem}->update; } - $c->res->redirect( $c->uri_for( '', $id ) ); + $c->res->redirect( $uri ); } sub load_problem_or_display_error : Private { -- cgit v1.2.3 From 716c333de51d06e289f0dd798ec675b6466e336a Mon Sep 17 00:00:00 2001 From: Struan Donald Date: Tue, 28 Aug 2012 13:08:56 +0100 Subject: remove race condition --- perllib/FixMyStreet/App/Controller/Report.pm | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'perllib/FixMyStreet/App/Controller') diff --git a/perllib/FixMyStreet/App/Controller/Report.pm b/perllib/FixMyStreet/App/Controller/Report.pm index 4127b6247..57d27b3e4 100644 --- a/perllib/FixMyStreet/App/Controller/Report.pm +++ b/perllib/FixMyStreet/App/Controller/Report.pm @@ -68,8 +68,7 @@ sub support : Path('support') : Args(0) { if ( $id && $c->cobrand->can_support_problems && $c->user && $c->user->from_council ) { $c->forward( 'load_problem_or_display_error', [ $id ] ); - $c->stash->{problem}->interest_count( $c->stash->{problem}->interest_count + 1 ); - $c->stash->{problem}->update; + $c->stash->{problem}->update( { interest_count => \'interest_count +1' } ); } $c->res->redirect( $uri ); } -- cgit v1.2.3 From 9e7edef8733f26a81e12f9544d136b43f3f8e9cd Mon Sep 17 00:00:00 2001 From: Struan Donald Date: Wed, 29 Aug 2012 18:07:04 +0100 Subject: Fix other part of race condition --- perllib/FixMyStreet/App/Controller/Report/Update.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'perllib/FixMyStreet/App/Controller') diff --git a/perllib/FixMyStreet/App/Controller/Report/Update.pm b/perllib/FixMyStreet/App/Controller/Report/Update.pm index 39d0ab225..da4cc33ca 100644 --- a/perllib/FixMyStreet/App/Controller/Report/Update.pm +++ b/perllib/FixMyStreet/App/Controller/Report/Update.pm @@ -77,7 +77,7 @@ sub update_problem : Private { } if ( $c->cobrand->can_support_problems && $c->user && $c->user->from_council && $c->req->param('external_source_id') ) { - $problem->interest_count( $problem->interest_count + 1 ); + $problem->interest_count( \'interest_count + 1' ); } $problem->lastupdate( \'ms_current_timestamp()' ); -- cgit v1.2.3 From 5d094d3a3a9114acc7f53e89ace7e9640654b7c3 Mon Sep 17 00:00:00 2001 From: Struan Donald Date: Fri, 28 Sep 2012 10:40:29 +0100 Subject: admin interface to set endpoint as devolved --- perllib/FixMyStreet/App/Controller/Admin.pm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'perllib/FixMyStreet/App/Controller') diff --git a/perllib/FixMyStreet/App/Controller/Admin.pm b/perllib/FixMyStreet/App/Controller/Admin.pm index 298c75352..d917441a1 100644 --- a/perllib/FixMyStreet/App/Controller/Admin.pm +++ b/perllib/FixMyStreet/App/Controller/Admin.pm @@ -340,7 +340,7 @@ sub update_contacts : Private { } elsif ( $posted eq 'open311' ) { $c->forward('check_token'); - my %params = map { $_ => $c->req->param($_) || '' } qw/open311_id endpoint jurisdiction api_key area_id send_method send_comments suppress_alerts comment_user_id/; + my %params = map { $_ => $c->req->param($_) || '' } qw/open311_id endpoint jurisdiction api_key area_id send_method send_comments suppress_alerts comment_user_id devolved/; if ( $params{open311_id} ) { my $conf = $c->model('DB::Open311Conf')->find( { id => $params{open311_id} } ); @@ -352,6 +352,7 @@ sub update_contacts : Private { $conf->send_comments( $params{send_comments} || 0); $conf->suppress_alerts( $params{suppress_alerts} || 0); $conf->comment_user_id( $params{comment_user_id} || undef ); + $conf->can_be_devolved( $params{devolved} || 0 ); $conf->update(); @@ -366,6 +367,7 @@ sub update_contacts : Private { $conf->send_comments( $params{send_comments} || 0); $conf->suppress_alerts( $params{suppress_alerts} || 0); $conf->comment_user_id( $params{comment_user_id} || undef ); + $conf->can_be_devolved( $params{devolved} || 0 ); $conf->insert(); -- cgit v1.2.3 From feb0a8eb85be517465f999b30177579b972cebc0 Mon Sep 17 00:00:00 2001 From: Struan Donald Date: Fri, 28 Sep 2012 13:04:03 +0100 Subject: admin interface to add contact level endpoints --- perllib/FixMyStreet/App/Controller/Admin.pm | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'perllib/FixMyStreet/App/Controller') diff --git a/perllib/FixMyStreet/App/Controller/Admin.pm b/perllib/FixMyStreet/App/Controller/Admin.pm index d917441a1..f05639b41 100644 --- a/perllib/FixMyStreet/App/Controller/Admin.pm +++ b/perllib/FixMyStreet/App/Controller/Admin.pm @@ -304,6 +304,10 @@ sub update_contacts : Private { $contact->note( $c->req->param('note') ); $contact->whenedited( \'ms_current_timestamp()' ); $contact->editor( $editor ); + $contact->endpoint( $c->req->param('endpoint') ); + $contact->jurisdiction( $c->req->param('jurisdiction') ); + $contact->api_key( $c->req->param('api_key') ); + $contact->send_method( $c->req->param('send_method') ); if ( $contact->in_storage ) { $c->stash->{updated} = _('Values updated'); @@ -463,6 +467,9 @@ sub council_edit : Path('council_edit') : Args(2) { $c->stash->{history} = $history; + my @methods = map { $_ =~ s/FixMyStreet::SendReport:://; $_ } keys %{ FixMyStreet::SendReport->get_senders }; + $c->stash->{send_methods} = \@methods; + return 1; } -- cgit v1.2.3