diff options
-rwxr-xr-x | web/alert.cgi | 53 | ||||
-rwxr-xr-x | web/index.cgi | 16 | ||||
-rwxr-xr-x | web/reports.cgi | 1 |
3 files changed, 62 insertions, 8 deletions
diff --git a/web/alert.cgi b/web/alert.cgi index 313d55c7d..8924d97f5 100755 --- a/web/alert.cgi +++ b/web/alert.cgi @@ -105,11 +105,11 @@ sub alert_list { my $errors = ''; $errors = '<ul class="error"><li>' . join('</li><li>', @errors) . '</li></ul>' if @errors; - my @types = (@$mySociety::VotingArea::council_parent_types, @$mySociety::VotingArea::council_child_types); - my %councils = map { $_ => 1 } @$mySociety::VotingArea::council_parent_types; + my $cobrand = Page::get_cobrand($q); + my @types = (Cobrand::area_types($cobrand), @$mySociety::VotingArea::council_child_types); + my %councils = map { $_ => 1 } Cobrand::area_types($cobrand); my $areas = mySociety::MaPit::call('point', "4326/$lon,$lat", type => \@types); - my $cobrand = Page::get_cobrand($q); my ($success, $error_msg) = Cobrand::council_check($cobrand, { all_councils => $areas }, $q, 'alert'); if (!$success) { return alert_front_page($q, $error_msg); @@ -118,7 +118,52 @@ sub alert_list { return alert_front_page($q, _('That location does not appear to be covered by a council, perhaps it is offshore - please try somewhere more specific.')) if keys %$areas == 0; my ($options, $options_start, $options_end); - if (keys %$areas == 2) { + if (mySociety::Config::get('COUNTRY') eq 'NO') { + + my (@options, $fylke, $kommune); + foreach (values %$areas) { + if ($_->{type} eq 'NKO') { + $kommune = $_; + } else { + $fylke = $_; + } + } + my $kommune_name = encode_utf8($kommune->{name}); + my $fylke_name = encode_utf8($fylke->{name}); + + if ($fylke->{id} == 3) { # Oslo + + push @options, [ 'council', $fylke->{id}, Page::short_name($fylke), + sprintf(_("Problems within %s"), $fylke_name) ]; + + $options_start = "<div><ul id='rss_feed'>"; + $options = alert_list_options($q, @options); + $options_end = "</ul>"; + + } else { + + push @options, + [ 'area', $kommune->{id}, Page::short_name($kommune), $kommune_name ], + [ 'area', $fylke->{id}, Page::short_name($fylke), $fylke_name ]; + $options_start = '<div id="rss_list">'; + $options = $q->p($q->strong(_('Problems within the boundary of:'))) . + $q->ul(alert_list_options($q, @options)); + @options = (); + push @options, + [ 'council', $kommune->{id}, Page::short_name($kommune), $kommune_name ], + [ 'council', $fylke->{id}, Page::short_name($fylke), $fylke_name ]; + $options .= $q->p($q->strong(_('Or problems reported to:'))) . + $q->ul(alert_list_options($q, @options)); + $options_end = $q->p($q->small(_('FixMyStreet sends different categories of problem +to the appropriate council, so problems within the boundary of a particular council +might not match the problems sent to that council. For example, a graffiti report +will be sent to the district council, so will appear in both of the district +council’s alerts, but will only appear in the "Within the boundary" alert +for the county council.'))) . '</div><div id="rss_buttons">'; + + } + + } elsif (keys %$areas == 2) { # One-tier council my (@options, $council, $ward); diff --git a/web/index.cgi b/web/index.cgi index 189231682..7c8ecaded 100755 --- a/web/index.cgi +++ b/web/index.cgi @@ -528,11 +528,19 @@ sub display_form { return front_page($q, $error_msg); } - # Ipswich & St Edmundsbury are responsible for everything in their areas, not Suffolk - delete $all_councils->{2241} if $all_councils->{2446} || $all_councils->{2443}; + if (mySociety::Config::get('COUNTRY') eq 'GB') { + # Ipswich & St Edmundsbury are responsible for everything in their areas, not Suffolk + delete $all_councils->{2241} if $all_councils->{2446} || $all_councils->{2443}; - # Norwich is responsible for everything in its areas, not Norfolk - delete $all_councils->{2233} if $all_councils->{2391}; + # Norwich is responsible for everything in its areas, not Norfolk + delete $all_councils->{2233} if $all_councils->{2391}; + + } elsif (mySociety::Config::get('COUNTRY') eq 'NO') { + + # Oslo is both a kommune and a fylke, we only want to show it once + delete $all_councils->{301} if $all_councils->{3}; + + } return display_location($q, _('That spot does not appear to be covered by a council. If you have tried to report an issue past the shoreline, for example, diff --git a/web/reports.cgi b/web/reports.cgi index 12e3a3014..9d0787450 100755 --- a/web/reports.cgi +++ b/web/reports.cgi @@ -198,6 +198,7 @@ sub main { } print '<th>' . _('Recently fixed') . '</th><th>' . _('Older fixed') . '</th></tr>'; foreach (sort { $areas_info->{$a}->{name} cmp $areas_info->{$b}->{name} } keys %$areas_info) { + next if mySociety::Config::get('COUNTRY') eq 'NO' && $_ eq 301; # Only want one Oslo print '<tr align="center"'; ++$c; if (mySociety::Config::get('COUNTRY') eq 'GB' && $areas_info->{$_}->{generation_high} == 10) { |