aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--conf/general.yml-example5
-rw-r--r--cpanfile1
-rw-r--r--perllib/CrossSell.pm26
-rw-r--r--perllib/FixMyStreet/App.pm1
-rw-r--r--perllib/FixMyStreet/App/Controller/Admin.pm11
-rw-r--r--perllib/FixMyStreet/App/Controller/Council.pm11
-rw-r--r--perllib/FixMyStreet/App/Controller/Dashboard.pm4
-rw-r--r--perllib/FixMyStreet/App/Controller/Report/New.pm21
-rw-r--r--perllib/FixMyStreet/DB/ResultSet/Problem.pm2
-rw-r--r--perllib/Utils.pm4
-rw-r--r--t/app/controller/dashboard.t16
-rw-r--r--t/cobrand/zurich.t4
-rw-r--r--templates/web/default/admin/config_page.html1
-rw-r--r--templates/web/fixmystreet/footer.html18
-rw-r--r--templates/web/southampton/header.html2
-rw-r--r--web/cobrands/fixmystreet/images/google_play_logo.pngbin0 -> 8913 bytes
-rw-r--r--web/cobrands/fixmystreet/images/itunes_store_logo.pngbin0 -> 3394 bytes
17 files changed, 88 insertions, 39 deletions
diff --git a/conf/general.yml-example b/conf/general.yml-example
index f5fb89b64..0704fdb52 100644
--- a/conf/general.yml-example
+++ b/conf/general.yml-example
@@ -74,9 +74,12 @@ MAPIT_TYPES: [ 'ZZZ' ]
# If you are using global MapIt, you might want to restrict FixMyStreet usage
# to only one or more areas, rather than all O04, for example. Provide MapIt
-# IDs here in a list that FixMyStreet should recognise.
+# IDs here in a list that FixMyStreet should recognise, along with the MapIt
+# generation those IDs are in.
# MAPIT_ID_WHITELIST: [ 240838, 246176, 246733 ]
+# MAPIT_GENERATION: 2
MAPIT_ID_WHITELIST: []
+MAPIT_GENERATION: 0
# If your MapIt has the concept of council wards (subareas of councils, where
# people can sign up for alerts, but not report things), then you can give the
diff --git a/cpanfile b/cpanfile
index ca82f9ae2..158e10cd1 100644
--- a/cpanfile
+++ b/cpanfile
@@ -85,6 +85,7 @@ feature 'uk', 'FixMyStreet.com specific requirements' => sub {
# # East Hampshire
# requires 'SOAP::Lite';
# Barnet
+ # TODO: This can perhaps be removed since Barnet switched to email for problem reports
requires 'SOAP::WSDL';
};
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
diff --git a/t/app/controller/dashboard.t b/t/app/controller/dashboard.t
index a87232e9b..4e62028b5 100644
--- a/t/app/controller/dashboard.t
+++ b/t/app/controller/dashboard.t
@@ -609,9 +609,19 @@ FixMyStreet::override_config {
}
subtest 'export as csv' => sub {
+ make_problem( {
+ detail => "this report\nis split across\nseveral lines",
+ state => "confirmed",
+ conf_dt => DateTime->now(),
+ } );
$mech->get_ok('/dashboard?export=1');
- my @lines = split /\n/, $mech->content;
- is scalar @lines, 6, '1 (header) + 5 (reports) = 6 lines';
+ open my $data_handle, '<', \$mech->content;
+ my $csv = Text::CSV->new( { binary => 1 } );
+ my @rows;
+ while ( my $row = $csv->getline( $data_handle ) ) {
+ push @rows, $row;
+ }
+ is scalar @rows, 7, '1 (header) + 6 (reports) = 7 lines';
};
};
restore_time;
@@ -623,7 +633,7 @@ sub make_problem {
title => 'a problem',
name => 'a user',
anonymous => 1,
- detail => 'some detail',
+ detail => $args->{detail} || 'some detail',
state => $args->{state},
confirmed => $args->{conf_dt},
whensent => $args->{conf_dt},
diff --git a/t/cobrand/zurich.t b/t/cobrand/zurich.t
index e97891b91..16c0b77f8 100644
--- a/t/cobrand/zurich.t
+++ b/t/cobrand/zurich.t
@@ -565,7 +565,8 @@ subtest "phone number is mandatory" => sub {
MAPIT_TYPES => [ 'O08' ],
MAPIT_URL => 'http://global.mapit.mysociety.org/',
ALLOWED_COBRANDS => [ 'zurich' ],
- MAPIT_ID_WHITELIST => [ 423017 ],
+ MAPIT_ID_WHITELIST => [ 274456 ],
+ MAPIT_GENERATION => 2,
}, sub {
$user = $mech->log_in_ok( 'dm1@example.org' );
$mech->get_ok( '/report/new?lat=47.381817&lon=8.529156' );
@@ -581,6 +582,7 @@ subtest "phone number is not mandatory for reports from mobile apps" => sub {
MAPIT_URL => 'http://global.mapit.mysociety.org/',
ALLOWED_COBRANDS => [ 'zurich' ],
MAPIT_ID_WHITELIST => [ 423017 ],
+ MAPIT_GENERATION => 4,
}, sub {
$mech->post_ok( '/report/new/mobile?lat=47.381817&lon=8.529156' , {
service => 'iPhone',
diff --git a/templates/web/default/admin/config_page.html b/templates/web/default/admin/config_page.html
index f198de2af..83300e4db 100644
--- a/templates/web/default/admin/config_page.html
+++ b/templates/web/default/admin/config_page.html
@@ -84,6 +84,7 @@ running version <strong>[% git_version || 'unknown' %]</strong>.
[% INCLUDE with_cobrand value="MAPIT_TYPES"
cob = c.cobrand.area_types %]
[% INCLUDE just_value value="MAPIT_ID_WHITELIST" %]
+[% INCLUDE just_value value="MAPIT_GENERATION" %]
[% INCLUDE with_cobrand value="MAPIT_TYPES_CHILDREN"
cob = c.cobrand.area_types_children %]
diff --git a/templates/web/fixmystreet/footer.html b/templates/web/fixmystreet/footer.html
index dbf9235e0..cb39416f4 100644
--- a/templates/web/fixmystreet/footer.html
+++ b/templates/web/fixmystreet/footer.html
@@ -2,14 +2,16 @@
<footer role="content-info">
<div class="tablewrapper bordered">
<div id="footer-mobileapps">
- <h4>Mobile apps</h4>
- <p>
- <a href="https://itunes.apple.com/gb/app/fixmystreet/id297456545">iPhone</a>
- and
- <a href="https://play.google.com/store/apps/details?id=org.mysociety.FixMyStreet">Android</a>
- apps now available.
- </p>
- </div>
+ <h4>The FixMyStreet App</h4>
+ <p>
+ <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>
+ <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>
+ </p>
+ </div>
<div id="footer-help">
<ul>
diff --git a/templates/web/southampton/header.html b/templates/web/southampton/header.html
index 113803492..54f8ee2a8 100644
--- a/templates/web/southampton/header.html
+++ b/templates/web/southampton/header.html
@@ -111,7 +111,7 @@
<li><a href="/reports/Southampton">All reports</a></li>
<li><a href="/alerts">Local alerts</a></li>
<li><a href="/faq">Help</a></li>
- <li><a href="/contact">Contact</a></li>
+ <li><a href="http://www.southampton.gov.uk/customer-service/contact/">Contact</a></li>
</ul>
</div>
diff --git a/web/cobrands/fixmystreet/images/google_play_logo.png b/web/cobrands/fixmystreet/images/google_play_logo.png
new file mode 100644
index 000000000..9891cbbd3
--- /dev/null
+++ b/web/cobrands/fixmystreet/images/google_play_logo.png
Binary files differ
diff --git a/web/cobrands/fixmystreet/images/itunes_store_logo.png b/web/cobrands/fixmystreet/images/itunes_store_logo.png
new file mode 100644
index 000000000..b37f4c230
--- /dev/null
+++ b/web/cobrands/fixmystreet/images/itunes_store_logo.png
Binary files differ