aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--perllib/Cobrand.pm3
-rw-r--r--perllib/Cobrands/Emptyhomes/Util.pm4
-rw-r--r--perllib/Cobrands/Fiksgatami/Util.pm8
-rwxr-xr-xweb/index.cgi11
-rwxr-xr-xweb/reports.cgi14
-rwxr-xr-xweb/rss.cgi2
6 files changed, 28 insertions, 14 deletions
diff --git a/perllib/Cobrand.pm b/perllib/Cobrand.pm
index c218ba9ea..3d604984d 100644
--- a/perllib/Cobrand.pm
+++ b/perllib/Cobrand.pm
@@ -116,6 +116,9 @@ my %fns = (
'admin_pages' => { default => '0' },
# Show the problem creation graph in the admin interface
'admin_show_creation_graph' => { default => '1' },
+ # The MaPit types this site handles
+ 'area_types' => { default => '[qw(DIS LBO MTD UTA CTY COI)]' },
+ 'area_min_generation' => { default => '10' },
);
foreach (keys %fns) {
diff --git a/perllib/Cobrands/Emptyhomes/Util.pm b/perllib/Cobrands/Emptyhomes/Util.pm
index acb870695..00502eae9 100644
--- a/perllib/Cobrands/Emptyhomes/Util.pm
+++ b/perllib/Cobrands/Emptyhomes/Util.pm
@@ -33,6 +33,10 @@ sub admin_base_url {
return 'https://secure.mysociety.org/admin/emptyhomes/';
}
+sub area_types {
+ return [qw(DIS LBO MTD UTA LGD COI)]; # No CTY
+}
+
=item set_lang_and_domain LANG UNICODE
Set the language and text domain for the site based on the query and host.
diff --git a/perllib/Cobrands/Fiksgatami/Util.pm b/perllib/Cobrands/Fiksgatami/Util.pm
index 15a649eba..a0374cf1a 100644
--- a/perllib/Cobrands/Fiksgatami/Util.pm
+++ b/perllib/Cobrands/Fiksgatami/Util.pm
@@ -34,5 +34,13 @@ sub disambiguate_location {
return $s;
}
+sub area_types {
+ return [ 'NKO', 'NFY' ];
+}
+
+sub area_min_generation {
+ return '';
+}
+
1;
diff --git a/web/index.cgi b/web/index.cgi
index cd9a7574c..ca2795eaa 100755
--- a/web/index.cgi
+++ b/web/index.cgi
@@ -277,6 +277,7 @@ sub submit_problem {
my @errors;
my %field_errors;
+ my $cobrand = Page::get_cobrand($q);
# If in UK and we have a lat,lon coocdinate check it is in UK
if ( $input{latitude} && mySociety::Config::get('COUNTRY') eq 'GB' ) {
@@ -324,7 +325,8 @@ sub submit_problem {
$areas = mySociety::MaPit::call( 'point', $mapit_query );
if ($input{council} =~ /^[\d,]+(\|[\d,]+)?$/) {
my $no_details = $1 || '';
- my %va = map { $_ => 1 } @$mySociety::VotingArea::council_parent_types;
+ my $area_types = Cobrand::area_types($cobrand);
+ my %va = map { $_ => 1 } @$area_types;
my %councils;
foreach (keys %$areas) {
$councils{$_} = 1 if $va{$areas->{$_}->{type}};
@@ -388,7 +390,6 @@ sub submit_problem {
my $used_map = $input{skipped} ? 'f' : 't';
$input{category} = _('Other') unless $input{category};
my ($id, $out);
- my $cobrand = Page::get_cobrand($q);
my $cobrand_data = Cobrand::extra_problem_data($cobrand, $q);
if (my $token = $input{partial}) {
my $id = mySociety::AuthToken::retrieve('partial', $token);
@@ -516,11 +517,9 @@ sub display_form {
}
# Look up councils and do checks for the point we've got
- my $parent_types = $mySociety::VotingArea::council_parent_types;
- $parent_types = [qw(DIS LBO MTD UTA LGD COI)] # No CTY
- if $q->{site} eq 'emptyhomes';
+ my $area_types = Cobrand::area_types($cobrand);
# XXX: I think we want in_gb_locale around the next line, needs testing
- my $all_councils = mySociety::MaPit::call('point', "4326/$longitude,$latitude", type => $parent_types);
+ my $all_councils = mySociety::MaPit::call('point', "4326/$longitude,$latitude", type => $area_types);
# Let cobrand do a check
my ($success, $error_msg) = Cobrand::council_check($cobrand, { all_councils => $all_councils }, $q, 'submit_problem');
diff --git a/web/reports.cgi b/web/reports.cgi
index 999e82bb3..8dc0bd452 100755
--- a/web/reports.cgi
+++ b/web/reports.cgi
@@ -11,6 +11,7 @@
use strict;
use Standard;
+use Encode;
use URI::Escape;
use FixMyStreet::Alert;
use mySociety::MaPit;
@@ -49,7 +50,7 @@ sub main {
print $q->redirect($base_url . $rss . '/reports/' . $area_name);
return;
} elsif ($q_council =~ /\D/) {
- my $areas = mySociety::MaPit::call('areas', $q_council, type => $mySociety::VotingArea::council_parent_types, min_generation=>10 );
+ my $areas = mySociety::MaPit::call('areas', $q_council, type => Cobrand::area_types($cobrand), min_generation=>Cobrand::area_min_generation($cobrand) );
if (keys %$areas == 1) {
($one_council) = keys %$areas;
$area_type = $areas->{$one_council}->{type};
@@ -83,7 +84,8 @@ sub main {
my $q_ward = $q->param('ward') || '';
my $ward;
if ($one_council && $q_ward) {
- my $qw = mySociety::MaPit::call('areas', $q_ward, type => $mySociety::VotingArea::council_child_types, min_generation => 10);
+ my $qw = mySociety::MaPit::call('areas', $q_ward, type => $mySociety::VotingArea::council_child_types,
+ min_generation => Cobrand::area_min_generation($cobrand));
foreach my $id (sort keys %$qw) {
if ($qw->{$id}->{parent_area} == $one_council) {
$ward = $id;
@@ -130,10 +132,8 @@ sub main {
$areas_info = mySociety::MaPit::call('areas', $one_council);
} else {
# Show all councils on main report page
- my $ignore = 'LGD';
- $ignore .= '|CTY' if $q->{site} eq 'emptyhomes';
- my @types = grep { !/$ignore/ } @$mySociety::VotingArea::council_parent_types;
- $areas_info = mySociety::MaPit::call('areas', [ @types ], min_generation=>10 );
+ my $area_types = Cobrand::area_types($cobrand);
+ $areas_info = mySociety::MaPit::call('areas', [ @$area_types ], min_generation=>Cobrand::area_min_generation($cobrand) );
}
my $problems = Problems::council_problems($ward, $one_council);
@@ -181,7 +181,7 @@ sub main {
my $url = Page::short_name($areas_info->{$_}->{name});
my $cobrand_url = Cobrand::url($cobrand, "/reports/$url", $q);
print '><td align="left"><a href="' . $cobrand_url . '">' .
- $areas_info->{$_}->{name} . '</a></td>';
+ encode_utf8($areas_info->{$_}->{name}) . '</a></td>';
summary_cell(\@{$open{$_}{new}});
if ($q->{site} eq 'emptyhomes') {
my $c = 0;
diff --git a/web/rss.cgi b/web/rss.cgi
index 2a9aeaa52..6ba23abe2 100755
--- a/web/rss.cgi
+++ b/web/rss.cgi
@@ -115,7 +115,7 @@ sub rss_local_problems {
# truncate the lat,lon for nicer urls
( $lat, $lon ) = map { Utils::truncate_coordinate($_) } ( $lat, $lon );
- my $qs = "?lat=$lat;lon/=$lon";
+ my $qs = "?lat=$lat;lon=$lon";
if ($d) {
$qs .= ";d=$d";