diff options
Diffstat (limited to 'perllib/FixMyStreet/Cobrand')
-rw-r--r-- | perllib/FixMyStreet/Cobrand/Bromley.pm | 18 | ||||
-rw-r--r-- | perllib/FixMyStreet/Cobrand/Default.pm | 8 | ||||
-rw-r--r-- | perllib/FixMyStreet/Cobrand/EastSussex.pm | 4 | ||||
-rw-r--r-- | perllib/FixMyStreet/Cobrand/FixMindelo.pm | 2 | ||||
-rw-r--r-- | perllib/FixMyStreet/Cobrand/FixaMinGata.pm | 5 | ||||
-rw-r--r-- | perllib/FixMyStreet/Cobrand/Harrogate.pm | 242 | ||||
-rw-r--r-- | perllib/FixMyStreet/Cobrand/MakeMyIsland.pm | 2 | ||||
-rw-r--r-- | perllib/FixMyStreet/Cobrand/SeeSomething.pm | 2 | ||||
-rw-r--r-- | perllib/FixMyStreet/Cobrand/ZeroTB.pm | 2 | ||||
-rw-r--r-- | perllib/FixMyStreet/Cobrand/Zurich.pm | 1 |
10 files changed, 264 insertions, 22 deletions
diff --git a/perllib/FixMyStreet/Cobrand/Bromley.pm b/perllib/FixMyStreet/Cobrand/Bromley.pm index 531582f0e..99b38ca6a 100644 --- a/perllib/FixMyStreet/Cobrand/Bromley.pm +++ b/perllib/FixMyStreet/Cobrand/Bromley.pm @@ -24,6 +24,24 @@ sub disambiguate_location { # Bromley by Bow. $town .= ', BR1' if $string =~ /^high\s+st(reet)?$/i; + # Disambiguations required for BR5 + $town .= ', BR5' if $string =~ /^kelsey\s+r(?:oa)?d$/i; + $town = 'BR5 Bromley' if $string =~ /^leith\s+hill$/i; # doesn't like appended BR5 for some reason + + # There has also been a road name change for a section of Ramsden Road + # (BR5) between Church Hill and Court Road has changed to 'Old Priory + # Avenue' - presently entering Old Priory Avenue simply takes the user to + # a different Priory Avenue in Petts Wood + # From Google maps search, "BR6 0PL" is a valid postcode for Old Priory Avenue + if ($string =~/^old\s+priory\s+av\w*$/i) { + $string = 'Ramsden Road'; + $town = ', BR6 0PL'; + } + $town .= ', BR5' if $string =~ /^meadway/i; + + # and BR6 + $town .= ', BR6' if $string =~ /^berrylands/i; + # White Horse Hill is on boundary with Greenwich, so need a # specific postcode $town = 'chislehurst, BR7 6DH' if $string =~ /^white\s+horse/i; diff --git a/perllib/FixMyStreet/Cobrand/Default.pm b/perllib/FixMyStreet/Cobrand/Default.pm index ec7a8a81d..7f1fba67a 100644 --- a/perllib/FixMyStreet/Cobrand/Default.pm +++ b/perllib/FixMyStreet/Cobrand/Default.pm @@ -146,14 +146,6 @@ Can be specified in template. sub enter_postcode_text { } -=head2 site_title - -The name of the site - -=cut - -sub site_title { return 'FixMyStreet'; } - =head2 set_lang_and_domain my $set_lang = $cobrand->set_lang_and_domain( $lang, $unicode, $dir ) diff --git a/perllib/FixMyStreet/Cobrand/EastSussex.pm b/perllib/FixMyStreet/Cobrand/EastSussex.pm index 5447545e7..5aabae449 100644 --- a/perllib/FixMyStreet/Cobrand/EastSussex.pm +++ b/perllib/FixMyStreet/Cobrand/EastSussex.pm @@ -119,5 +119,9 @@ sub pin_colour { return $open_states->{ $p->state } ? 'yellow' : 'green'; } +sub send_questionnaires { + return 0; +} + 1; diff --git a/perllib/FixMyStreet/Cobrand/FixMindelo.pm b/perllib/FixMyStreet/Cobrand/FixMindelo.pm index fd3a55c6c..59debf157 100644 --- a/perllib/FixMyStreet/Cobrand/FixMindelo.pm +++ b/perllib/FixMyStreet/Cobrand/FixMindelo.pm @@ -4,8 +4,6 @@ use base 'FixMyStreet::Cobrand::Default'; use strict; use warnings; -sub site_title { return 'FixMindelo'; } - sub country { return 'CV'; } diff --git a/perllib/FixMyStreet/Cobrand/FixaMinGata.pm b/perllib/FixMyStreet/Cobrand/FixaMinGata.pm index 98c157aef..60f98dd47 100644 --- a/perllib/FixMyStreet/Cobrand/FixaMinGata.pm +++ b/perllib/FixMyStreet/Cobrand/FixaMinGata.pm @@ -9,11 +9,6 @@ use mySociety::MaPit; use FixMyStreet::Geocode::FixaMinGata; use DateTime; -sub site_title { - my ($self) = @_; - return 'FixaMinGata'; -} - sub country { return 'SE'; } diff --git a/perllib/FixMyStreet/Cobrand/Harrogate.pm b/perllib/FixMyStreet/Cobrand/Harrogate.pm new file mode 100644 index 000000000..6bcc2f227 --- /dev/null +++ b/perllib/FixMyStreet/Cobrand/Harrogate.pm @@ -0,0 +1,242 @@ +package FixMyStreet::Cobrand::Harrogate; +use base 'FixMyStreet::Cobrand::UKCouncils'; + +use strict; +use warnings; +use feature 'say'; + +sub council_id { return 2407; } +sub council_area { return 'Harrogate'; } +sub council_name { return 'Harrogate Borough Council'; } +sub council_url { return 'harrogate'; } +sub is_two_tier { return 1; } # with North Yorkshire CC 2235 + +sub disambiguate_location { + my $self = shift; + my $string = shift; + + my $town = 'Harrogate'; + + # as it's the requested example location, try to avoid a disambiguation page + $town .= ', HG1 1DH' if $string =~ /^\s*king'?s\s+r(?:oa)?d\s*(?:,\s*har\w+\s*)?$/i; + + return { + %{ $self->SUPER::disambiguate_location() }, + town => $town, + centre => '54.0671557690306,-1.59581319536637', + span => '0.370193897090822,0.829517054931808', + bounds => [ 53.8914112467619, -2.00450542308575, 54.2616051438527, -1.17498836815394 ], + }; +} + +sub example_places { + return ( 'HG1 2SG', "King's Road" ); +} + +sub enter_postcode_text { + my ($self) = @_; + return 'Enter a Harrogate district postcode, or street name and area'; +} + +# increase map zoom level so street names are visible +sub default_map_zoom { return 3; } + + +=head2 temp_email_to_update, temp_update_contacts + +Temporary helper routines to update the extra for potholes (temporary setup +hack, cargo-culted from ESCC, may in future be superseded either by +Open311/integration or a better mechanism for manually creating rich contacts). + +Can run with a script or command line like: + + bin/cron-wrapper perl -MFixMyStreet::App -MFixMyStreet::Cobrand::Harrogate -e \ + 'FixMyStreet::Cobrand::Harrogate->new({c => FixMyStreet::App->new})->temp_update_contacts' + +=cut + +sub temp_email_to_update { + return 'CustomerServices@harrogate.gov.uk'; +} + +sub temp_update_contacts { + my $self = shift; + + my $contact_rs = $self->{c}->model('DB::Contact'); + + my $email = $self->temp_email_to_update; + my $_update = sub { + my ($category, $field, $category_details) = @_; + # NB: we're accepting just 1 field, but supply as array [ $field ] + + my $contact = $contact_rs->find_or_create( + { + body_id => $self->council_id, + category => $category, + + confirmed => 1, + deleted => 0, + email => $email, + editor => 'automated script', + note => '', + send_method => '', + whenedited => \'NOW()', + %{ $category_details || {} }, + }, + { + key => 'contacts_body_id_category_idx' + } + ); + + say "Editing category: $category"; + + my %default = ( + variable => 'true', + order => '1', + required => 'no', + datatype => 'string', + datatype_description => 'a string', + ); + + if ($field->{datatype} || '' eq 'boolean') { + my $description = $field->{description}; + %default = ( + %default, + datatype => 'singlevaluelist', + datatype_description => 'Yes or No', + values => { value => [ + { key => ['No'], name => ['No'] }, + { key => ['Yes'], name => ['Yes'] }, + ] }, + ); + } + + $contact->update({ + extra => [ { %default, %$field } ], + confirmed => 1, + deleted => 0, + editor => 'automated script', + whenedited => \'NOW()', + note => 'Edited by script as per requirements Dec 2014', + }); + }; + + $_update->( 'Abandoned vehicles', { + code => 'registration', + description => 'Vehicle Registration number:', + }); + + $_update->( 'Dead animals', { + code => 'INFO_TEXT', + variable => 'false', + description => 'We do not remove small species, e.g. squirrels, rabbits, and small birds.', + }); + + $_update->( 'Flyposting', { + code => 'offensive', + description => 'Is it offensive?', + datatype => 'boolean', # mapped onto singlevaluelist + }); + + $_update->( 'Flytipping', { + code => 'size', + description => 'Size?', + datatype => 'singlevaluelist', + values => { value => [ + { key => ['Single Item'], name => ['Single item'] }, + { key => ['Car boot load'], name => ['Car boot load'] }, + { key => ['Small van load'], name => ['Small van load'] }, + { key => ['Transit van load'], name => ['Transit van load'] }, + { key => ['Tipper lorry load'], name => ['Tipper lorry load'] }, + { key => ['Significant load'], name => ['Significant load'] }, + ] }, + }); + + $_update->( 'Graffiti', { + code => 'offensive', + description => 'Is it offensive?', + datatype => 'boolean', # mapped onto singlevaluelist + }); + + $_update->( 'Parks and playgrounds', { + code => 'dangerous', + description => 'Is it dangerous or could cause injury?', + datatype => 'boolean', # mapped onto singlevaluelist + }); + + $_update->( 'Trees', { + code => 'dangerous', + description => 'Is it dangerous or could cause injury?', + datatype => 'boolean', # mapped onto singlevaluelist + }); + + # also ensure that the following categories are created: + for my $category ( + 'Car parking', + 'Dog and litter bins', + 'Dog fouling', + 'Other', + 'Rubbish (refuse and recycling)', + 'Street cleaning', + 'Street lighting', + 'Street nameplates', + ) { + say "Creating $category if required"; + my $contact = $contact_rs->find_or_create( + { + body_id => $self->council_id, + category => $category, + confirmed => 1, + deleted => 0, + email => $email, + editor => 'automated script', + note => 'Created by script as per requirements Dec 2014', + send_method => '', + whenedited => \'NOW()', + } + ); + } + + my @to_delete = ( + 'Parks/landscapes', # delete in favour of to parks and playgrounds + 'Public toilets', # as no longer in specs + ); + say sprintf "Deleting: %s (if present)", join ',' => @to_delete; + $contact_rs->search({ + body_id => $self->council_id, + category => \@to_delete, + deleted => 0 + })->update({ + deleted => 1, + editor => 'automated script', + whenedited => \'NOW()', + note => 'Deleted by script as per requirements Dec 2014', + }); +} + +sub contact_email { + my $self = shift; + return join( '@', 'customerservices', 'harrogate.gov.uk' ); +} + +sub process_additional_metadata_for_email { + my ($self, $problem, $h) = @_; + + my $additional = ''; + if (my $extra = $problem->extra) { + $additional = join "\n\n", map { + if ($_->{name} eq 'INFO_TEXT') { + (); + } + else { + sprintf '%s: %s', $_->{description}, $_->{value}; + } + } @$extra; + $additional = "\n\n$additional" if $additional; + } + + $h->{additional_information} = $additional; +} + +1; + diff --git a/perllib/FixMyStreet/Cobrand/MakeMyIsland.pm b/perllib/FixMyStreet/Cobrand/MakeMyIsland.pm index ebeb15fbb..f263df4cc 100644 --- a/perllib/FixMyStreet/Cobrand/MakeMyIsland.pm +++ b/perllib/FixMyStreet/Cobrand/MakeMyIsland.pm @@ -4,8 +4,6 @@ use base 'FixMyStreet::Cobrand::Default'; use strict; use warnings; -sub site_title { return 'MakeMyIsland'; } - sub country { return 'MV'; } diff --git a/perllib/FixMyStreet/Cobrand/SeeSomething.pm b/perllib/FixMyStreet/Cobrand/SeeSomething.pm index 5e6d3a8cd..775ba770b 100644 --- a/perllib/FixMyStreet/Cobrand/SeeSomething.pm +++ b/perllib/FixMyStreet/Cobrand/SeeSomething.pm @@ -9,8 +9,6 @@ sub council_area { return 'West Midlands'; } sub council_name { return 'See Something Say Something'; } sub council_url { return 'seesomething'; } sub area_types { [ 'MTD' ] } -sub site_title { return 'See Something, Say Something'; } - sub site_restriction { my $self = shift; diff --git a/perllib/FixMyStreet/Cobrand/ZeroTB.pm b/perllib/FixMyStreet/Cobrand/ZeroTB.pm index 087bf0912..cdf4e5ad4 100644 --- a/perllib/FixMyStreet/Cobrand/ZeroTB.pm +++ b/perllib/FixMyStreet/Cobrand/ZeroTB.pm @@ -4,8 +4,6 @@ use base 'FixMyStreet::Cobrand::Default'; use strict; use warnings; -sub site_title { return 'ZeroTB'; } - sub enter_postcode_text { return _ ('Enter a nearby street name and area, postal code or district in Delhi'); } sub country { diff --git a/perllib/FixMyStreet/Cobrand/Zurich.pm b/perllib/FixMyStreet/Cobrand/Zurich.pm index 087d9046b..577da9dd5 100644 --- a/perllib/FixMyStreet/Cobrand/Zurich.pm +++ b/perllib/FixMyStreet/Cobrand/Zurich.pm @@ -296,7 +296,6 @@ sub admin_pages { $pages = { %$pages, 'bodies' => [_('Bodies'), 1], 'body' => [undef, undef], - 'body_edit' => [undef, undef], }; return $pages if $type eq 'dm'; |