aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--perllib/FixMyStreet/Cobrand/Lichfield.pm80
1 files changed, 80 insertions, 0 deletions
diff --git a/perllib/FixMyStreet/Cobrand/Lichfield.pm b/perllib/FixMyStreet/Cobrand/Lichfield.pm
new file mode 100644
index 000000000..1889e91b7
--- /dev/null
+++ b/perllib/FixMyStreet/Cobrand/Lichfield.pm
@@ -0,0 +1,80 @@
+package FixMyStreet::Cobrand::Lichfield;
+use base 'FixMyStreet::Cobrand::Default';
+
+use strict;
+use warnings;
+
+use Carp;
+use URI::Escape;
+use mySociety::VotingArea;
+
+sub site_restriction {
+ return ( "and council='2434'", 'lichfield', { council => '2434' } );
+}
+
+sub problems_clause {
+ return { council => '2434' };
+}
+
+sub problems {
+ my $self = shift;
+ return $self->{c}->model('DB::Problem')->search( $self->problems_clause );
+}
+
+sub base_url {
+ my $base_url = mySociety::Config::get('BASE_URL');
+ if ( $base_url !~ /lichfield/ ) {
+ $base_url =~ s{http://(?!www\.)}{http://lichfield.}g;
+ $base_url =~ s{http://www\.}{http://lichfield.}g;
+ }
+ return $base_url;
+}
+
+sub site_title {
+ my ($self) = @_;
+ return 'Lichfield Council FixMyStreet';
+}
+
+sub enter_postcode_text {
+ my ($self) = @_;
+ return 'Enter a Lichfield postcode, or street name and area';
+}
+
+sub council_check {
+ my ( $self, $params, $context ) = @_;
+
+ my $councils = $params->{all_councils};
+ my $council_match = defined $councils->{2434};
+ if ($council_match) {
+ return 1;
+ }
+ my $url = 'http://www.fixmystreet.com/';
+ $url .= 'alert' if $context eq 'alert';
+ $url .= '?pc=' . URI::Escape::uri_escape( $self->{c}->req->param('pc') )
+ if $self->{c}->req->param('pc');
+ my $error_msg = "That location is not covered by Lichfield.
+Please visit <a href=\"$url\">the main FixMyStreet site</a>.";
+ return ( 0, $error_msg );
+}
+
+# All reports page only has the one council.
+sub all_councils_report {
+ return 0;
+}
+
+sub disambiguate_location {
+ return {
+ centre => '51.612832,-0.218169',
+ span => '0.0563,0.09',
+ bounds => [ '51.584682,-0.263169', '51.640982,-0.173169' ],
+ };
+}
+
+sub recent_photos {
+ my ( $self, $num, $lat, $lon, $dist ) = @_;
+ $num = 2 if $num == 3;
+ return $self->problems->recent_photos( $num, $lat, $lon, $dist );
+}
+
+1;
+