aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xbin/send-reports2
-rw-r--r--conf/general-example3
-rw-r--r--perllib/FixMyStreet/App/Controller/Around.pm2
-rw-r--r--perllib/FixMyStreet/App/Controller/Report/New.pm2
-rw-r--r--perllib/FixMyStreet/Cobrand/Default.pm10
-rw-r--r--perllib/FixMyStreet/Cobrand/FiksGataMi.pm4
-rw-r--r--perllib/FixMyStreet/Geocode.pm20
-rwxr-xr-xtemplates/web/default/around/display_location.html4
-rw-r--r--templates/web/default/report/display.html2
9 files changed, 30 insertions, 19 deletions
diff --git a/bin/send-reports b/bin/send-reports
index 9d6f79d36..b55447e8a 100755
--- a/bin/send-reports
+++ b/bin/send-reports
@@ -79,7 +79,7 @@ while (my $row = $unsent->next) {
# If we are in the UK include eastings and northings, and nearest stuff
$h{easting_northing} = '';
- if ( mySociety::Config::get('COUNTRY') eq 'GB' ) {
+ if ( $cobrand->country eq 'GB' ) {
( $h{easting}, $h{northing} ) = Utils::convert_latlon_to_en( $h{latitude}, $h{longitude} );
diff --git a/conf/general-example b/conf/general-example
index 129cee386..d2ac743e0 100644
--- a/conf/general-example
+++ b/conf/general-example
@@ -27,9 +27,6 @@ define('OPTION_BCI_DB_PASS', '');
define('OPTION_BASE_URL', 'http://www.example.org');
-# Which country are you operating in? ISO3166-alpha2 code please
-define('OPTION_COUNTRY', 'GB');
-
define('OPTION_EMAIL_DOMAIN', 'example.org');
define('OPTION_CONTACT_EMAIL', 'team@'.OPTION_EMAIL_DOMAIN);
define('OPTION_TEST_EMAIL_PREFIX', null);
diff --git a/perllib/FixMyStreet/App/Controller/Around.pm b/perllib/FixMyStreet/App/Controller/Around.pm
index d90a46b32..0c26220e0 100644
--- a/perllib/FixMyStreet/App/Controller/Around.pm
+++ b/perllib/FixMyStreet/App/Controller/Around.pm
@@ -222,7 +222,7 @@ sub check_location_is_acceptable : Private {
my $lon = $c->stash->{longitude};
# If in UK and we have a lat,lon coocdinate check it is in UK
- if ( $lat && $c->config->{COUNTRY} eq 'GB' ) {
+ if ( $lat && $c->cobrand->country eq 'GB' ) {
eval { Utils::convert_latlon_to_en( $lat, $lon ); };
if ($@) {
$c->stash->{location_error} =
diff --git a/perllib/FixMyStreet/App/Controller/Report/New.pm b/perllib/FixMyStreet/App/Controller/Report/New.pm
index 643e4bd8f..dfa45df55 100644
--- a/perllib/FixMyStreet/App/Controller/Report/New.pm
+++ b/perllib/FixMyStreet/App/Controller/Report/New.pm
@@ -156,7 +156,7 @@ sub report_import : Path('/import') {
push @errors, 'Please enter a valid email';
}
- if ( $latitude && $c->config->{COUNTRY} eq 'GB' ) {
+ if ( $latitude && $c->cobrand->country eq 'GB' ) {
eval { Utils::convert_latlon_to_en( $latitude, $longitude ); };
push @errors,
"We had a problem with the supplied co-ordinates - outside the UK?"
diff --git a/perllib/FixMyStreet/Cobrand/Default.pm b/perllib/FixMyStreet/Cobrand/Default.pm
index e81a28bd2..47bee1e0a 100644
--- a/perllib/FixMyStreet/Cobrand/Default.pm
+++ b/perllib/FixMyStreet/Cobrand/Default.pm
@@ -71,6 +71,16 @@ sub path_to_web_templates {
return FixMyStreet->path_to( 'templates/web', $self->moniker );
}
+=head1 country
+
+Returns the country that this cobrand operates in, as an ISO3166-alpha2 code.
+
+=cut
+
+sub country {
+ return 'GB';
+}
+
=head1 problems_clause
Returns a hash for a query to be used by problems (and elsewhere in joined
diff --git a/perllib/FixMyStreet/Cobrand/FiksGataMi.pm b/perllib/FixMyStreet/Cobrand/FiksGataMi.pm
index eb7ea89a5..694e952f2 100644
--- a/perllib/FixMyStreet/Cobrand/FiksGataMi.pm
+++ b/perllib/FixMyStreet/Cobrand/FiksGataMi.pm
@@ -7,6 +7,10 @@ use warnings;
use Carp;
use mySociety::MaPit;
+sub country {
+ return 'NO';
+}
+
sub set_lang_and_domain {
my ( $self, $lang, $unicode, $dir ) = @_;
mySociety::Locale::negotiate_language(
diff --git a/perllib/FixMyStreet/Geocode.pm b/perllib/FixMyStreet/Geocode.pm
index a520a2daa..423cec9b6 100644
--- a/perllib/FixMyStreet/Geocode.pm
+++ b/perllib/FixMyStreet/Geocode.pm
@@ -38,20 +38,20 @@ BEGIN {
sub lookup {
my ($s, $c) = @_;
my ($latitude, $longitude, $error);
- if (mySociety::Config::get('COUNTRY') eq 'GB') {
+ if ( $c->cobrand->country eq 'GB') {
if ($s =~ /^\d+$/) {
$error = 'FixMyStreet is a UK-based website that currently works in England, Scotland, and Wales. Please enter either a postcode, or a Great British street name and area.';
} elsif (mySociety::PostcodeUtil::is_valid_postcode($s)) {
my $location = mySociety::MaPit::call('postcode', $s);
- unless ($error = mapit_check_error($location)) {
+ unless ( $error = mapit_check_error( $c, $location ) ) {
$latitude = $location->{wgs84_lat};
$longitude = $location->{wgs84_lon};
}
}
- } elsif (mySociety::Config::get('COUNTRY') eq 'NO') {
+ } elsif ( $c->cobrand->country eq 'NO') {
if ($s =~ /^\d{4}$/) {
my $location = mySociety::MaPit::call('postcode', $s);
- unless ($error = mapit_check_error($location)) {
+ unless ( $error = mapit_check_error( $c, $location ) ) {
$latitude = $location->{wgs84_lat};
$longitude = $location->{wgs84_lon};
}
@@ -64,7 +64,7 @@ sub lookup {
}
sub geocoded_string_coordinates {
- my ( $js ) = @_;
+ my ( $c, $js ) = @_;
my ($latitude, $longitude, $error);
my ($accuracy) = $js =~ /"Accuracy" *: *(\d)/;
if ($accuracy < 4) {
@@ -72,7 +72,7 @@ sub geocoded_string_coordinates {
} elsif ( $js =~ /"coordinates" *: *\[ *(.*?), *(.*?),/ ) {
$longitude = $1;
$latitude = $2;
- if (mySociety::Config::get('COUNTRY') eq 'GB') {
+ if ( $c->cobrand->country eq 'GB') {
try {
my ($easting, $northing) = Utils::convert_latlon_to_en( $latitude, $longitude );
} catch Error::Simple with {
@@ -98,7 +98,7 @@ sub results_check {
push (@valid_locations, $_);
}
if (scalar @valid_locations == 1) {
- return geocoded_string_coordinates( $valid_locations[0] );
+ return geocoded_string_coordinates( $c, $valid_locations[0] );
}
$error = _('Sorry, we could not find that location.') unless $error;
return (undef, undef, $error);
@@ -128,7 +128,7 @@ sub string {
# think we are in the UK for some locations so we explictly add UK to
# the address. We do it here so as not to invalidate existing cache
# entries
- if ( mySociety::Config::get('COUNTRY') eq 'GB'
+ if ( $c->cobrand->country eq 'GB'
&& $url !~ /,\+UK/
&& $url !~ /united\++kingdom$/ )
{
@@ -160,12 +160,12 @@ sub string {
}
sub mapit_check_error {
- my $location = shift;
+ my ( $c, $location ) = @_;
if ($location->{error}) {
return _('That postcode was not recognised, sorry.') if $location->{code} =~ /^4/;
return $location->{error};
}
- if (mySociety::Config::get('COUNTRY') eq 'GB') {
+ if ( $c->cobrand->country eq 'GB') {
my $island = $location->{coordsyst};
if (!$island) {
return _("Sorry, that appears to be a Crown dependency postcode, which we don't cover.");
diff --git a/templates/web/default/around/display_location.html b/templates/web/default/around/display_location.html
index 4c728806b..88300113b 100755
--- a/templates/web/default/around/display_location.html
+++ b/templates/web/default/around/display_location.html
@@ -53,7 +53,7 @@
[% ELSE %]
<a id='hide_pins_link' rel='nofollow' href='[% c.uri_with( { no_pins => 1 } ) %]'>[% loc('Hide pins') %]</a>
[% END %]
- [% IF c.config.COUNTRY == 'GB' %]
+ [% IF c.cobrand.country == 'GB' %]
|
[% IF c.req.params.all_pins %]
<a id='all_pins_link' rel='nofollow' href='[% c.uri_with( { no_pins => undef, all_pins => undef } ) %]'>[% loc('Hide stale reports') %]</a>
@@ -63,7 +63,7 @@
[% END %]
</p>
-[% IF c.config.COUNTRY == 'GB' %]
+[% IF c.cobrand.country == 'GB' %]
<input type='hidden' id='all_pins' name='all_pins' value='[% all_pins | html %]'>
[% END %]
diff --git a/templates/web/default/report/display.html b/templates/web/default/report/display.html
index 4267b359e..1f4456086 100644
--- a/templates/web/default/report/display.html
+++ b/templates/web/default/report/display.html
@@ -10,7 +10,7 @@
[% map_html %]
-[% IF c.config.COUNTRY == 'GB' %]
+[% IF c.cobrand.country == 'GB' %]
<p id='sub_map_links'>
<a href="http://maps.google.co.uk/maps?output=embed&amp;z=16&amp;q=
[%- problem.title _ ' - ' _ c.cobrand.base_url_for_emails _ '/report/' _ problem.id | uri -%]