aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/Cobrand
diff options
context:
space:
mode:
authorDave Whiteland <dave@mysociety.org>2012-05-29 15:57:41 +0100
committerDave Whiteland <dave@mysociety.org>2012-05-29 15:57:41 +0100
commit67da8efc720d2d0bd22bd9fe8655b7e983b35bb4 (patch)
tree38b8570647124df06c637d4b923f6010211ef328 /perllib/FixMyStreet/Cobrand
parent40b3a51d33caefa8f5fb97ce9be18ef936c7e260 (diff)
parent131ff6e9bf3626d6a8fff6ae54669d250148a63a (diff)
Merge remote branch 'origin/master' into fmb-read-only
Conflicts: bin/send-reports perllib/FixMyStreet/Cobrand/Default.pm perllib/FixMyStreet/Cobrand/FixMyStreet.pm templates/web/fixmystreet/alert/index.html templates/web/fixmystreet/around/display_location.html web/cobrands/fixmystreet/_layout.scss web/js/map-OpenLayers.js
Diffstat (limited to 'perllib/FixMyStreet/Cobrand')
-rw-r--r--perllib/FixMyStreet/Cobrand/Bromley.pm55
-rw-r--r--perllib/FixMyStreet/Cobrand/Default.pm40
-rw-r--r--perllib/FixMyStreet/Cobrand/FixMyStreet.pm43
-rw-r--r--perllib/FixMyStreet/Cobrand/UKCouncils.pm22
4 files changed, 156 insertions, 4 deletions
diff --git a/perllib/FixMyStreet/Cobrand/Bromley.pm b/perllib/FixMyStreet/Cobrand/Bromley.pm
index 75174b638..f7d885da2 100644
--- a/perllib/FixMyStreet/Cobrand/Bromley.pm
+++ b/perllib/FixMyStreet/Cobrand/Bromley.pm
@@ -1,5 +1,7 @@
package FixMyStreet::Cobrand::Bromley;
-use base 'FixMyStreet::Cobrand::UKCouncils';
+use mro 'c3';
+use parent 'FixMyStreet::Cobrand::FixMyStreet';
+use parent 'FixMyStreet::Cobrand::UKCouncils';
use strict;
use warnings;
@@ -9,6 +11,10 @@ sub council_area { return 'Bromley'; }
sub council_name { return 'Bromley Council'; }
sub council_url { return 'bromley'; }
+sub base_url {
+ 'https://fix.bromley.gov.uk';
+}
+
sub path_to_web_templates {
my $self = shift;
return [
@@ -17,10 +23,16 @@ sub path_to_web_templates {
];
}
+sub site_title {
+ my ($self) = @_;
+ return "London Borough of Bromley - Report a problem in Bromley\x{2019}s streets or parks";
+}
+
sub disambiguate_location {
my $self = shift;
return {
%{ $self->SUPER::disambiguate_location() },
+ town => 'Bromley',
centre => '51.366836,0.040623',
span => '0.154963,0.24347',
bounds => [ '51.289355,-0.081112', '51.444318,0.162358' ],
@@ -31,5 +43,46 @@ sub example_places {
return ( 'BR1 3UH', 'Glebe Rd, Bromley' );
}
+sub map_type {
+ 'Bromley';
+}
+
+sub on_map_default_max_pin_age {
+ return '1 month';
+}
+
+# Bromley pins always yellow
+sub pin_colour {
+ my ( $self, $p, $context ) = @_;
+ return 'yellow';
+}
+
+sub recent_photos {
+ my ( $self, $area, $num, $lat, $lon, $dist ) = @_;
+ $num = 3 if $num > 3 && $area eq 'alert';
+ return $self->problems->recent_photos( $num, $lat, $lon, $dist );
+}
+
+sub send_questionnaires {
+ return 0;
+}
+
+sub ask_ever_reported {
+ return 0;
+}
+
+sub process_extras {
+ my $self = shift;
+ $self->SUPER::process_extras( @_, [ 'first_name', 'last_name' ] );
+}
+
+sub contact_email {
+ my $self = shift;
+ my $type = shift || '';
+ return join( '@', 'info', 'bromley.gov.uk' ) if $type eq 'contact';
+ return $self->next::method();
+}
+sub contact_name { 'Bromley Council (do not reply)'; }
+
1;
diff --git a/perllib/FixMyStreet/Cobrand/Default.pm b/perllib/FixMyStreet/Cobrand/Default.pm
index e7359d33e..be024f134 100644
--- a/perllib/FixMyStreet/Cobrand/Default.pm
+++ b/perllib/FixMyStreet/Cobrand/Default.pm
@@ -173,6 +173,7 @@ EASTING and NORTHING.
sub recent_photos {
my $self = shift;
+ my $area = shift;
return $self->problems->recent_photos(@_);
}
@@ -350,6 +351,17 @@ Return the title to be used in page heads.
sub site_title { 'FixMyStreet' }
+=head2 map_type
+
+Return an override type of map if necessary.
+
+=cut
+sub map_type {
+ my $self = shift;
+ return 'OSM' if $self->{c}->req->uri->host =~ /^osm\./;
+ return;
+}
+
=head2 on_map_list_limit
Return the maximum number of items to be given in the list of reports on the map
@@ -576,6 +588,14 @@ first time they' ve reported a problem
sub ask_ever_reported { 1 }
+=head2 send_questionnaires
+
+Return a boolean indicating whether people should be sent questionnaire emails.
+
+=cut
+
+sub send_questionnaires { 1 }
+
=head2 admin_pages
List of names of pages to display on the admin interface
@@ -740,6 +760,8 @@ sub council_rss_alert_options {
( $ward->{id_name} = $ward->{short_name} ) =~ tr/+/_/;
}
}
+ $council->{name} = 'London Borough of Bromley'
+ if $council->{name} eq 'Bromley Council';
push @options,
{
@@ -916,6 +938,8 @@ Get stats to display on the council reports page
sub get_report_stats { return 0; }
+sub get_council_sender { return 'Email' };
+
sub example_places {
return [ 'B2 4QA', 'Tib St, Manchester' ];
}
@@ -936,7 +960,21 @@ If set to an arrayref, will plot those area ID(s) from mapit on all the /around
=cut
-sub areas_on_around {
+sub areas_on_around {}
+
+sub process_extras {}
+
+=head 2 pin_colour
+
+Returns the colour of pin to be used for a particular report
+(so perhaps different depending upon the age of the report).
+
+=cut
+sub pin_colour {
+ my ( $self, $p, $context ) = @_;
+ #return 'green' if time() - $p->confirmed_local->epoch < 7 * 24 * 60 * 60;
+ return 'yellow' if $context eq 'around';
+ return $p->is_fixed ? 'green' : 'red';
}
1;
diff --git a/perllib/FixMyStreet/Cobrand/FixMyStreet.pm b/perllib/FixMyStreet/Cobrand/FixMyStreet.pm
index f6571fed5..aba58495e 100644
--- a/perllib/FixMyStreet/Cobrand/FixMyStreet.pm
+++ b/perllib/FixMyStreet/Cobrand/FixMyStreet.pm
@@ -14,6 +14,21 @@ sub enter_postcode_text {
return _("Enter a nearby GB postcode, or street name and area");
}
+sub get_council_sender {
+ my ( $self, $area_id, $area_info ) = @_;
+
+ my $send_method;
+
+ my $council_config = FixMyStreet::App->model("DB::Open311conf")->search( { area_id => $area_id } )->first;
+ $send_method = $council_config->send_method if $council_config;
+
+ return $send_method if $send_method;
+
+ return 'London' if $area_info->{type} eq 'LBO';
+
+ return 'Email';
+}
+
sub generate_problem_banner {
my ( $self, $problem ) = @_;
@@ -40,5 +55,33 @@ sub generate_problem_banner {
return $banner;
}
+sub process_extras {
+ my $self = shift;
+ my $ctx = shift;
+ my $contacts = shift;
+ my $extra = shift;
+ my $fields = shift || [];
+
+ if ( $contacts->[0]->area_id == 2482 ) {
+ my @fields = ( 'fms_extra_title', @$fields );
+ for my $field ( @fields ) {
+ my $value = $ctx->request->param( $field );
+
+ if ( !$value ) {
+ $ctx->stash->{field_errors}->{ $field } = _('This information is required');
+ }
+ push @$extra, {
+ name => $field,
+ description => uc( $field),
+ value => $value || '',
+ };
+ }
+
+ if ( $ctx->request->param('fms_extra_title') ) {
+ $ctx->stash->{fms_extra_title} = $ctx->request->param('fms_extra_title');
+ $ctx->stash->{extra_name_info} = 1;
+ }
+ }
+}
1;
diff --git a/perllib/FixMyStreet/Cobrand/UKCouncils.pm b/perllib/FixMyStreet/Cobrand/UKCouncils.pm
index 69c4b18d4..8a6954418 100644
--- a/perllib/FixMyStreet/Cobrand/UKCouncils.pm
+++ b/perllib/FixMyStreet/Cobrand/UKCouncils.pm
@@ -7,6 +7,10 @@ use warnings;
use Carp;
use URI::Escape;
+sub is_council {
+ 1;
+}
+
sub site_restriction {
my $self = shift;
return ( "and council='" . $self->council_id . "'", $self->council_url, { council => sprintf('%d', $self->council_id) } );
@@ -77,10 +81,24 @@ sub all_councils_report {
}
sub recent_photos {
- my ( $self, $num, $lat, $lon, $dist ) = @_;
+ my ( $self, $area, $num, $lat, $lon, $dist ) = @_;
$num = 2 if $num == 3;
return $self->problems->recent_photos( $num, $lat, $lon, $dist );
}
-1;
+sub get_council_sender {
+ my ( $self, $area_id, $area_info ) = @_;
+
+ my $send_method;
+
+ my $council_config = FixMyStreet::App->model("DB::Open311conf")->search( { area_id => $area_id } )->first;
+ $send_method = $council_config->send_method if $council_config;
+ return $send_method if $send_method;
+
+ return 'London' if $area_info->{type} eq 'LBO';
+
+ return 'Email';
+}
+
+1;