diff options
Diffstat (limited to 'perllib')
-rw-r--r-- | perllib/CrossSell.pm | 26 | ||||
-rw-r--r-- | perllib/FixMyStreet/App.pm | 1 | ||||
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Admin.pm | 11 | ||||
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Council.pm | 11 | ||||
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Dashboard.pm | 4 | ||||
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Report/New.pm | 21 | ||||
-rw-r--r-- | perllib/FixMyStreet/DB/ResultSet/Problem.pm | 2 | ||||
-rw-r--r-- | perllib/Utils.pm | 4 |
8 files changed, 55 insertions, 25 deletions
diff --git a/perllib/CrossSell.pm b/perllib/CrossSell.pm index ca4eebdb3..f9bb73d6a 100644 --- a/perllib/CrossSell.pm +++ b/perllib/CrossSell.pm @@ -161,6 +161,30 @@ for campaigns too. EOF } +sub display_app_links { + return <<EOF; +<h1 style="padding-top:0.5em">New! FixMyStreet Apps for Apple and Android</h1> +<p> +We've built all-new FixMyStreet phone apps, for your use. Key +improvements include offline reporting (for where there is bad signal) +and a better interface for adding problem reports more quickly and +easily. Please give the apps a go and tell us what you think. +</p> + +<p> +<a href="https://play.google.com/store/apps/details?id=org.mysociety.FixMyStreet"> + <img alt="FixMyStreet Android app on Google Play" + src="/cobrands/fixmystreet/images/google_play_logo.png" /> +</a> + +<a href="https://itunes.apple.com/gb/app/fixmystreet/id297456545"> + <img alt="FixMyStreet app on the App Store" + src="/cobrands/fixmystreet/images/itunes_store_logo.png" /> +</a><br> +</p> +EOF +} + # Not currently used, needs more explanation and testing; perhaps in future. sub display_gny_groups { my ($lon, $lat) = @_; @@ -222,7 +246,7 @@ sub display_advert ($$;$%) { #unless (defined $data{done_tms} && $data{done_tms}==1) { $c->stash->{scratch} = 'advert=wtt'; return '<div style="margin: 0 5em; border-top: dotted 1px #666666;">' - . display_wtt_link() + . display_app_links() . '</div>'; $c->stash->{scratch} = 'advert=news'; diff --git a/perllib/FixMyStreet/App.pm b/perllib/FixMyStreet/App.pm index bf95c8e17..0d3b024a8 100644 --- a/perllib/FixMyStreet/App.pm +++ b/perllib/FixMyStreet/App.pm @@ -95,6 +95,7 @@ __PACKAGE__->setup(); after 'prepare_headers' => sub { my $self = shift; $self->req->secure( 1 ) if $self->config->{BASE_URL} eq 'https://www.zueriwieneu.ch'; + $self->req->secure( 1 ) if $self->config->{BASE_URL} eq 'http://www.fixmystreet.com' && $self->req->headers->header('Host') eq 'fix.bromley.gov.uk'; }; # set up DB handle for old code diff --git a/perllib/FixMyStreet/App/Controller/Admin.pm b/perllib/FixMyStreet/App/Controller/Admin.pm index 9c0018f38..cfe165f43 100644 --- a/perllib/FixMyStreet/App/Controller/Admin.pm +++ b/perllib/FixMyStreet/App/Controller/Admin.pm @@ -774,7 +774,8 @@ sub report_edit : Path('report_edit') : Args(1) { if ( $c->req->param('remove_photo') ) { $problem->photo(undef); } - if ( $new_state eq 'hidden' ) { + + if ( $c->req->param('remove_photo') || $new_state eq 'hidden' ) { unlink glob FixMyStreet->path_to( 'web', 'photo', $problem->id . '.*' ); } @@ -916,6 +917,10 @@ sub update_edit : Path('update_edit') : Args(1) { $update->photo(undef); } + if ( $c->req->param('remove_photo') || $new_state eq 'hidden' ) { + unlink glob FixMyStreet->path_to( 'web', 'photo', 'c', $update->id . '.*' ); + } + $update->name( $c->req->param('name') || '' ); $update->text( $c->req->param('text') ); $update->anonymous( $c->req->param('anonymous') ); @@ -939,10 +944,6 @@ sub update_edit : Path('update_edit') : Args(1) { } } - if ( $new_state eq 'hidden' ) { - unlink glob FixMyStreet->path_to( 'web', 'photo', 'c', $update->id . '.*' ); - } - $update->update; $c->stash->{status_message} = '<p><em>' . _('Updated!') . '</em></p>'; diff --git a/perllib/FixMyStreet/App/Controller/Council.pm b/perllib/FixMyStreet/App/Controller/Council.pm index ceec04027..8a174c254 100644 --- a/perllib/FixMyStreet/App/Controller/Council.pm +++ b/perllib/FixMyStreet/App/Controller/Council.pm @@ -53,10 +53,16 @@ sub load_and_check_areas : Private { my $short_longitude = Utils::truncate_coordinate($longitude); my $all_areas; + + my %params; + $params{generation} = $c->config->{MAPIT_GENERATION} + if $c->config->{MAPIT_GENERATION}; + if ( $c->stash->{fetch_all_areas} ) { my %area_types = map { $_ => 1 } @$area_types; $all_areas = - mySociety::MaPit::call( 'point', "4326/$short_longitude,$short_latitude" ); + mySociety::MaPit::call( 'point', + "4326/$short_longitude,$short_latitude", %params ); $c->stash->{all_areas_mapit} = $all_areas; $all_areas = { map { $_ => $all_areas->{$_} } @@ -65,7 +71,8 @@ sub load_and_check_areas : Private { }; } else { $all_areas = - mySociety::MaPit::call( 'point', "4326/$short_longitude,$short_latitude", + mySociety::MaPit::call( 'point', + "4326/$short_longitude,$short_latitude", %params, type => $area_types ); } if ($all_areas->{error}) { diff --git a/perllib/FixMyStreet/App/Controller/Dashboard.pm b/perllib/FixMyStreet/App/Controller/Dashboard.pm index b5f65d8c8..25c6e1923 100644 --- a/perllib/FixMyStreet/App/Controller/Dashboard.pm +++ b/perllib/FixMyStreet/App/Controller/Dashboard.pm @@ -195,7 +195,7 @@ sub export_as_csv { (defined $value and length $value) ? ($_, $value) : () } sort keys %where }; - my $csv = Text::CSV->new(); + my $csv = Text::CSV->new({ binary => 1, eol => "\n" }); $csv->combine( 'Report ID', 'Title', @@ -264,7 +264,7 @@ sub export_as_csv { } $c->res->content_type('text/csv; charset=utf-8'); $c->res->header('content-disposition' => "attachment; filename=${filename}.csv"); - $c->res->body( join "\n", @body ); + $c->res->body( join "", @body ); } sub updates_search : Private { diff --git a/perllib/FixMyStreet/App/Controller/Report/New.pm b/perllib/FixMyStreet/App/Controller/Report/New.pm index 4a5e11573..1e9f83aec 100644 --- a/perllib/FixMyStreet/App/Controller/Report/New.pm +++ b/perllib/FixMyStreet/App/Controller/Report/New.pm @@ -624,15 +624,13 @@ sub setup_categories_and_bodies : Private { _('Empty public building - school, hospital, etc.') ); - } elsif ($first_area->{id} != COUNCIL_ID_BROMLEY && $first_area->{type} eq 'LBO') { + } elsif ($first_area->{id} != COUNCIL_ID_BROMLEY + && $first_area->{id} != COUNCIL_ID_BARNET + && $first_area->{type} eq 'LBO') { $bodies_to_list{ $first_body->id } = 1; my @local_categories; - if ($first_area->{id} == COUNCIL_ID_BARNET) { - @local_categories = sort keys %{ Utils::barnet_categories() } - } else { - @local_categories = sort keys %{ Utils::london_categories() } - } + @local_categories = sort keys %{ Utils::london_categories() }; @category_options = ( _('-- Pick a category --'), @local_categories @@ -853,15 +851,10 @@ sub process_report : Private { $report->extra( \%extra ); } - } elsif ( $first_area->{id} == COUNCIL_ID_BARNET ) { + } elsif ($first_area->{id} != COUNCIL_ID_BROMLEY + && $first_area->{id} != COUNCIL_ID_BARNET + && $first_area->{type} eq 'LBO') { - unless ( exists Utils::barnet_categories()->{ $report->category } ) { - $c->stash->{field_errors}->{category} = _('Please choose a category'); - } - $report->bodies_str( $first_body->id ); - - } elsif ( $first_area->{id} != COUNCIL_ID_BROMLEY && $first_area->{type} eq 'LBO') { - unless ( Utils::london_categories()->{ $report->category } ) { $c->stash->{field_errors}->{category} = _('Please choose a category'); } diff --git a/perllib/FixMyStreet/DB/ResultSet/Problem.pm b/perllib/FixMyStreet/DB/ResultSet/Problem.pm index a7c1bebae..2f4bc6363 100644 --- a/perllib/FixMyStreet/DB/ResultSet/Problem.pm +++ b/perllib/FixMyStreet/DB/ResultSet/Problem.pm @@ -376,6 +376,8 @@ sub send_reports { if ( $row->subcategory ) { $h{subcategory_line} = sprintf(_("Subcategory: %s"), $row->subcategory) . "\n\n"; + } else { + $h{subcategory_line} = "\n\n"; } $h{bodies_name} = join(_(' and '), @dear); diff --git a/perllib/Utils.pm b/perllib/Utils.pm index 27d604a59..7a22c888d 100644 --- a/perllib/Utils.pm +++ b/perllib/Utils.pm @@ -123,7 +123,9 @@ sub london_categories { } sub barnet_categories { - # The values here are KBIDs from Barnet's system: see bin/send-reports for formatting + # The values here are KBIDs from Barnet's system: see bin/send-reports for formatting. + # They are no longer used since Barnet switched to email for delivery of problem reports. + # and can be removed when SendReport/Barnet.pm is removed. if (mySociety::Config::get('STAGING_SITE')) { # note staging site must use different KBIDs return { 'Street scene misc' => 14 # for test |