diff options
author | Struan Donald <struan@exo.org.uk> | 2012-05-25 18:07:20 +0100 |
---|---|---|
committer | Struan Donald <struan@exo.org.uk> | 2012-05-25 18:07:20 +0100 |
commit | 6b26b7ec133eb9bdd4a9bed45477ec6d9d78304c (patch) | |
tree | 24cc24b1536ea4bdd6fa717a5a268d85ddad3325 | |
parent | 0ff2c1689fafab7ed533b3989075c34f3c1a8779 (diff) | |
parent | 5ab9f3916e43372a89dd78740b752de2c7cf2552 (diff) |
Merge remote-tracking branch 'origin/bromley' into bromley
-rw-r--r-- | perllib/FixMyStreet/App.pm | 7 | ||||
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Contact.pm | 4 | ||||
-rw-r--r-- | perllib/FixMyStreet/Cobrand/Bromley.pm | 17 | ||||
-rw-r--r-- | perllib/FixMyStreet/Cobrand/Default.pm | 11 | ||||
-rw-r--r-- | perllib/FixMyStreet/Map/Bromley.pm | 4 | ||||
-rw-r--r-- | perllib/FixMyStreet/Map/FMS.pm | 10 | ||||
-rw-r--r-- | t/app/controller/report_new.t | 2 | ||||
-rw-r--r-- | templates/web/bromley/header.html | 4 | ||||
-rw-r--r-- | web/js/map-bing-ol.js | 16 |
9 files changed, 45 insertions, 30 deletions
diff --git a/perllib/FixMyStreet/App.pm b/perllib/FixMyStreet/App.pm index 1624f89e7..3d9f0a511 100644 --- a/perllib/FixMyStreet/App.pm +++ b/perllib/FixMyStreet/App.pm @@ -181,12 +181,7 @@ sub setup_request { Memcached::set_namespace( FixMyStreet->config('FMS_DB_NAME') . ":" ); - my $map = $host =~ /^osm\./ ? 'OSM' : $c->req->param('map_override'); - #if ($c->sessionid) { - # $map = $c->session->{map}; - # $map = undef unless $map eq 'OSM'; - #} - FixMyStreet::Map::set_map_class( $map ); + FixMyStreet::Map::set_map_class( $cobrand->map_type || $c->req->param('map_override') ); return $c; } diff --git a/perllib/FixMyStreet/App/Controller/Contact.pm b/perllib/FixMyStreet/App/Controller/Contact.pm index f28d37989..91580f05a 100644 --- a/perllib/FixMyStreet/App/Controller/Contact.pm +++ b/perllib/FixMyStreet/App/Controller/Contact.pm @@ -183,7 +183,7 @@ generally required to stash sub setup_request : Private { my ( $self, $c ) = @_; - $c->stash->{contact_email} = $c->cobrand->contact_email; + $c->stash->{contact_email} = $c->cobrand->contact_email( 'contact' ); $c->stash->{contact_email} =~ s/\@/@/; for my $param (qw/em subject message/) { @@ -205,7 +205,7 @@ Sends the email sub send_email : Private { my ( $self, $c ) = @_; - my $recipient = $c->cobrand->contact_email(); + my $recipient = $c->cobrand->contact_email( 'contact' ); my $recipient_name = $c->cobrand->contact_name(); $c->stash->{host} = $c->req->header('HOST'); diff --git a/perllib/FixMyStreet/Cobrand/Bromley.pm b/perllib/FixMyStreet/Cobrand/Bromley.pm index 500863cf6..f7d885da2 100644 --- a/perllib/FixMyStreet/Cobrand/Bromley.pm +++ b/perllib/FixMyStreet/Cobrand/Bromley.pm @@ -1,4 +1,5 @@ package FixMyStreet::Cobrand::Bromley; +use mro 'c3'; use parent 'FixMyStreet::Cobrand::FixMyStreet'; use parent 'FixMyStreet::Cobrand::UKCouncils'; @@ -10,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 [ @@ -38,6 +43,10 @@ sub example_places { return ( 'BR1 3UH', 'Glebe Rd, Bromley' ); } +sub map_type { + 'Bromley'; +} + sub on_map_default_max_pin_age { return '1 month'; } @@ -67,5 +76,13 @@ sub process_extras { $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 c0a0b1ff7..7a82d728d 100644 --- a/perllib/FixMyStreet/Cobrand/Default.pm +++ b/perllib/FixMyStreet/Cobrand/Default.pm @@ -351,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 diff --git a/perllib/FixMyStreet/Map/Bromley.pm b/perllib/FixMyStreet/Map/Bromley.pm index 836efed39..20821236f 100644 --- a/perllib/FixMyStreet/Map/Bromley.pm +++ b/perllib/FixMyStreet/Map/Bromley.pm @@ -12,11 +12,11 @@ use base 'FixMyStreet::Map::FMS'; use strict; sub map_type { - return '"/tilma"'; + return '[ [ "", "a-" ], "https://{S}fix.bromley.gov.uk/tilma" ]'; } sub map_tile_base { - "/tilma/%d/%d/%d.png"; + '-', "https://%sfix.bromley.gov.uk/tilma/%d/%d/%d.png"; } 1; diff --git a/perllib/FixMyStreet/Map/FMS.pm b/perllib/FixMyStreet/Map/FMS.pm index 4d0af983b..b1dd29002 100644 --- a/perllib/FixMyStreet/Map/FMS.pm +++ b/perllib/FixMyStreet/Map/FMS.pm @@ -38,17 +38,17 @@ sub get_quadkey { } sub map_tile_base { - "http://%stilma.mysociety.org/sv/%d/%d/%d.png"; + '.', "http://%stilma.mysociety.org/sv/%d/%d/%d.png"; } sub map_tiles { my ($self, $x, $y, $z) = @_; if ($z >= 16) { - my $tile_base = $self->map_tile_base; + my ($tile_sep, $tile_base) = $self->map_tile_base; return [ - sprintf($tile_base, 'a.', $z, $x-1, $y-1), - sprintf($tile_base, 'b.', $z, $x, $y-1), - sprintf($tile_base, 'c.', $z, $x-1, $y), + sprintf($tile_base, 'a' . $tile_sep, $z, $x-1, $y-1), + sprintf($tile_base, 'b' . $tile_sep, $z, $x, $y-1), + sprintf($tile_base, 'c' . $tile_sep, $z, $x-1, $y), sprintf($tile_base, '', $z, $x, $y), ]; } else { diff --git a/t/app/controller/report_new.t b/t/app/controller/report_new.t index 74355c2d4..29fb650e5 100644 --- a/t/app/controller/report_new.t +++ b/t/app/controller/report_new.t @@ -919,7 +919,7 @@ for my $test ( ok $email, "got an email"; like $email->body, qr/confirm the problem/i, "confirm the problem"; - my ($url) = $email->body =~ m{(http://\S+)}; + my ($url) = $email->body =~ m{(https?://\S+)}; ok $url, "extracted confirm url '$url'"; # confirm token in order to update the user details diff --git a/templates/web/bromley/header.html b/templates/web/bromley/header.html index b8e56172c..eea690c7d 100644 --- a/templates/web/bromley/header.html +++ b/templates/web/bromley/header.html @@ -70,12 +70,12 @@ <div class="wrapper"> <div class="table-cell"> - <header id="site-header" role="banner"> + <div id="site-header" role="banner"> <div class="container"> <a href="/" id="site-logo">FixMyStreet</a> <a href="#main-nav" id="nav-link">Main Navigation</a> </div> - </header> + </div> <div id="user-meta"> [% IF c.user_exists %] diff --git a/web/js/map-bing-ol.js b/web/js/map-bing-ol.js index 9bff93e27..7d40f8afc 100644 --- a/web/js/map-bing-ol.js +++ b/web/js/map-bing-ol.js @@ -1,4 +1,4 @@ -var tile_base = 'tilma.mysociety.org/sv'; +var tile_base = [ [ '', 'a.', 'b.', 'c.' ], 'http://{S}tilma.mysociety.org/sv' ]; function set_map_config(perm) { var permalink_id; @@ -99,17 +99,9 @@ OpenLayers.Layer.Bing = OpenLayers.Class(OpenLayers.Layer.XYZ, { var url; if (z >= 16) { - if (tile_base.substring(0,1) == '/') { - url = [ - tile_base + "/${z}/${x}/${y}.png" - ]; - } else { - url = [ - "http://" + tile_base + "/${z}/${x}/${y}.png", - "http://a." + tile_base + "/${z}/${x}/${y}.png", - "http://b." + tile_base + "/${z}/${x}/${y}.png", - "http://c." + tile_base + "/${z}/${x}/${y}.png" - ]; + url = []; + for (var i=0; i< tile_base[0].length; i++) { + url.push( tile_base[1].replace('{S}', tile_base[0][i]) + "/${z}/${x}/${y}.png" ); } } else { var type = ''; |