aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/Cobrands
diff options
context:
space:
mode:
authorMatthew Somerville <matthew@mysociety.org>2011-06-07 17:50:31 +0100
committerMatthew Somerville <matthew@mysociety.org>2011-06-07 17:50:31 +0100
commitf128b19cf7bf0da5dd445dc39d1a09e8953fc32d (patch)
treebfe7d772ece4a5725ae8389c43452c0aa0e3bb44 /perllib/Cobrands
parentb5a218792a7bcf477c930205b6a7c341a90d3efd (diff)
Creation of new Southampton cobrand, removal of old cobrands.
Diffstat (limited to 'perllib/Cobrands')
-rw-r--r--perllib/Cobrands/Barnet/Util.pm117
-rw-r--r--perllib/Cobrands/Emptyhomes/Util.pm75
-rw-r--r--perllib/Cobrands/Fiksgatami/Util.pm62
-rw-r--r--perllib/Cobrands/Southampton/Util.pm117
4 files changed, 0 insertions, 371 deletions
diff --git a/perllib/Cobrands/Barnet/Util.pm b/perllib/Cobrands/Barnet/Util.pm
deleted file mode 100644
index e4115c232..000000000
--- a/perllib/Cobrands/Barnet/Util.pm
+++ /dev/null
@@ -1,117 +0,0 @@
-#!/usr/bin/perl -w
-#
-# Util.pm:
-# Barnet cobranding for FixMyStreet.
-#
-# Copyright (c) 2009 UK Citizens Online Democracy. All rights reserved.
-# Email: matthew@mysociety.org. WWW: http://www.mysociety.org
-
-package Cobrands::Barnet::Util;
-use strict;
-use Carp;
-use URI::Escape;
-use mySociety::VotingArea;
-
-sub new {
- my $class = shift;
- return bless {}, $class;
-}
-
-=item site_restriction Q
-
-Return a site restriction clause and a site key.
-
-=cut
-sub site_restriction{
- return ("and council='2489'", 'barnet');
-}
-
-=item
-
-Return the base url for this cobranded site
-
-=cut
-
-sub base_url {
- my $base_url = mySociety::Config::get('BASE_URL');
- if ($base_url !~ /barnet/) {
- $base_url =~ s/http:\/\/(?!www\.)/http:\/\/barnet\./g;
- $base_url =~ s/http:\/\/www\./http:\/\/barnet\./g;
- }
- return $base_url;
-}
-
-=item site_title
-
-Return the title to be used in page heads
-
-=cut
-
-sub site_title {
- my ($self) = @_;
- return 'Barnet Council FixMyStreet';
-}
-
-sub enter_postcode_text {
- my ($self,$q) = @_;
- return 'Enter a Barnet postcode, or street name and area';
-}
-
-=item council_check COUNCILS QUERY CONTEXT
-
-Return a boolean indicating whether COUNCILS are okay for the location
-in the QUERY, and an error message appropriate to the CONTEXT.
-
-=cut
-
-sub council_check {
- my ($self, $params, $q, $context) = @_;
- my $councils;
- if ($params->{all_councils}) {
- $councils = $params->{all_councils};
- } elsif (defined $params->{lat}) {
- my $parent_types = $mySociety::VotingArea::council_parent_types;
- $councils = mySociety::MaPit::call('point', "4326/$params->{lon},$params->{lat}", type => $parent_types);
- }
- my $council_match = defined $councils->{2489};
- if ($council_match) {
- return 1;
- }
- my $url = 'http://www.fixmystreet.com/';
- $url .= 'alert' if $context eq 'alert';
- $url .= '?pc=' . URI::Escape::uri_escape_utf8($q->param('pc')) if $q->param('pc');
- my $error_msg = "That location is not covered by Barnet.
-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;
-}
-
-=item disambiguate_location S Q
-
-Given a string representing a location (street and area expected),
-bias the viewport to around Barnet.
-
-=cut
-
-sub disambiguate_location {
- my ($self, $s, $q) = @_;
- $s = "ll=51.612832,-0.218169&spn=0.0563,0.09&$s";
- return $s;
-}
-
-sub recent_photos {
- my ($self, $num, $lat, $lon, $dist) = @_;
- $num = 2 if $num == 3;
- return Problems::recent_photos($num, $lat, $lon, $dist);
-}
-
-sub tilma_mid_point {
- return 189;
-}
-
-1;
-
diff --git a/perllib/Cobrands/Emptyhomes/Util.pm b/perllib/Cobrands/Emptyhomes/Util.pm
deleted file mode 100644
index d23857f50..000000000
--- a/perllib/Cobrands/Emptyhomes/Util.pm
+++ /dev/null
@@ -1,75 +0,0 @@
-#!/usr/bin/perl -w
-#
-# Util.pm:
-# Emptyhomes Cobranding for FixMyStreet.
-#
-# Copyright (c) 2009 UK Citizens Online Democracy. All rights reserved.
-# Email: louise@mysociety.org. WWW: http://www.mysociety.org
-
-package Cobrands::Emptyhomes::Util;
-use strict;
-use Carp;
-
-sub new {
- my $class = shift;
- return bless {}, $class;
-}
-
-=item
-
-Return the base url for this cobranded site
-
-=cut
-
-sub base_url {
- my $base_url = mySociety::Config::get('BASE_URL');
- if ($base_url !~ /emptyhomes/) {
- $base_url =~ s/http:\/\//http:\/\/emptyhomes\./g;
- }
- return $base_url;
-}
-
-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.
-
-=cut
-
-sub set_lang_and_domain {
- my ($self, $lang, $unicode) = @_;
- mySociety::Locale::negotiate_language('en-gb,English,en_GB|cy,Cymraeg,cy_GB', $lang);
- mySociety::Locale::gettext_domain('FixMyStreet-EmptyHomes', $unicode);
- mySociety::Locale::change();
-}
-
-=item site_title
-
-Return the title to be used in page heads
-
-=cut
-
-sub site_title {
- my ($self) = @_;
- return _('Report Empty Homes');
-}
-
-=item feed_xsl
-
-Return the XSL file path to be used for feeds'
-
-=cut
-sub feed_xsl {
- my ($self) = @_;
- return '/xsl.eha.xsl';
-}
-
-1;
-
diff --git a/perllib/Cobrands/Fiksgatami/Util.pm b/perllib/Cobrands/Fiksgatami/Util.pm
deleted file mode 100644
index 2abc03d00..000000000
--- a/perllib/Cobrands/Fiksgatami/Util.pm
+++ /dev/null
@@ -1,62 +0,0 @@
-#!/usr/bin/perl -w
-#
-# Util.pm:
-# Fiksgatami cobranding for FixMyStreet.
-#
-# Copyright (c) 2011 UK Citizens Online Democracy. All rights reserved.
-# Email: matthew@mysociety.org. WWW: http://www.mysociety.org
-
-package Cobrands::Fiksgatami::Util;
-use strict;
-use Carp;
-
-sub new {
- my $class = shift;
- return bless {}, $class;
-}
-
-sub set_lang_and_domain {
- my ($self, $lang, $unicode) = @_;
- mySociety::Locale::negotiate_language('en-gb,English,en_GB|nb,Norwegian,nb_NO', 'nb');
- mySociety::Locale::gettext_domain('FixMyStreet', $unicode);
- mySociety::Locale::change();
-}
-
-# If lat/lon are present in the URL, OpenLayers will use that to centre the map.
-# Need to specify a zoom to stop it defaulting to null/0.
-sub url {
- my ($self, $url) = @_;
- if ($url =~ /lat=/ && $url !~ /zoom=/) {
- $url .= ';zoom=2';
- }
- return $url;
-}
-
-sub enter_postcode_text {
- my ($self, $q) = @_;
- return _('Enter a nearby postcode, or street name and area');
-}
-
-# Is also adding language parameter
-sub disambiguate_location {
- my ($self, $s, $q) = @_;
- $s = "hl=no&gl=no&$s";
- return $s;
-}
-
-sub geocoded_string_check {
- my ($self, $s) = @_;
- return 1 if $s =~ /, Norge/;
- return 0;
-}
-
-sub area_types {
- return ( 'NKO', 'NFY' );
-}
-
-sub area_min_generation {
- return '';
-}
-
-1;
-
diff --git a/perllib/Cobrands/Southampton/Util.pm b/perllib/Cobrands/Southampton/Util.pm
deleted file mode 100644
index d29b53127..000000000
--- a/perllib/Cobrands/Southampton/Util.pm
+++ /dev/null
@@ -1,117 +0,0 @@
-#!/usr/bin/perl -w
-#
-# Util.pm:
-# Southampton cobranding for FixMyStreet.
-#
-# Copyright (c) 2011 UK Citizens Online Democracy. All rights reserved.
-# Email: matthew@mysociety.org. WWW: http://www.mysociety.org
-
-package Cobrands::Southampton::Util;
-use strict;
-use Carp;
-use URI::Escape;
-use mySociety::VotingArea;
-
-sub new {
- my $class = shift;
- return bless {}, $class;
-}
-
-=item site_restriction Q
-
-Return a site restriction clause and a site key.
-
-=cut
-sub site_restriction {
- return ("and council='2567'", 'southampton');
-}
-
-=item
-
-Return the base url for this cobranded site
-
-=cut
-
-sub base_url {
- my $base_url = mySociety::Config::get('BASE_URL');
- if ($base_url !~ /southampton/) {
- $base_url =~ s/http:\/\/(?!www\.)/http:\/\/southampton\./g;
- $base_url =~ s/http:\/\/www\./http:\/\/southampton\./g;
- }
- return $base_url;
-}
-
-=item site_title
-
-Return the title to be used in page heads
-
-=cut
-
-sub site_title {
- my ($self) = @_;
- return 'Southampton City Council FixMyStreet';
-}
-
-sub enter_postcode_text {
- my ($self,$q) = @_;
- return 'Enter a Southampton postcode, or street name and area';
-}
-
-=item council_check COUNCILS QUERY CONTEXT
-
-Return a boolean indicating whether COUNCILS are okay for the location
-in the QUERY, and an error message appropriate to the CONTEXT.
-
-=cut
-
-sub council_check {
- my ($self, $params, $q, $context) = @_;
- my $councils;
- if ($params->{all_councils}) {
- $councils = $params->{all_councils};
- } elsif (defined $params->{lat}) {
- my $parent_types = $mySociety::VotingArea::council_parent_types;
- $councils = mySociety::MaPit::call('point', "4326/$params->{lon},$params->{lat}", type => $parent_types);
- }
- my $council_match = defined $councils->{2567};
- if ($council_match) {
- return 1;
- }
- my $url = 'http://www.fixmystreet.com/';
- $url .= 'alert' if $context eq 'alert';
- $url .= '?pc=' . URI::Escape::uri_escape_utf8($q->param('pc')) if $q->param('pc');
- my $error_msg = "That location is not covered by Southampton.
-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;
-}
-
-=item disambiguate_location S Q
-
-Given a string representing a location (street and area expected),
-bias the viewport to around Southampton.
-
-=cut
-
-sub disambiguate_location {
- my ($self, $s, $q) = @_;
- $s = "ll=50.913822,-1.400493&spn=0.084628,0.15701&$s";
- return $s;
-}
-
-sub recent_photos {
- my ($self, $num, $lat, $lon, $dist) = @_;
- $num = 2 if $num == 3;
- return Problems::recent_photos($num, $lat, $lon, $dist);
-}
-
-sub tilma_mid_point {
- return 189;
-}
-
-1;
-