aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlouise <louise>2009-09-10 09:25:04 +0000
committerlouise <louise>2009-09-10 09:25:04 +0000
commit5e6ce5595b310f1031ce9de577c4eba7aa8df7b1 (patch)
treeec8f12385912e58ad47e997d4304dfa17d9d7852
parent6338e522eedcbb6c43266c1aa526f1008234eab2 (diff)
Fix param passing in set_lang_and_domain, generalize getting custom conf keys for cobrands
-rw-r--r--perllib/Cobrand.pm23
1 files changed, 14 insertions, 9 deletions
diff --git a/perllib/Cobrand.pm b/perllib/Cobrand.pm
index f5a1cc528..bff5718ca 100644
--- a/perllib/Cobrand.pm
+++ b/perllib/Cobrand.pm
@@ -7,7 +7,7 @@
# Copyright (c) 2009 UK Citizens Online Democracy. All rights reserved.
# Email: louise@mysociety.org. WWW: http://www.mysociety.org
#
-# $Id: Cobrand.pm,v 1.12 2009-09-10 08:54:34 louise Exp $
+# $Id: Cobrand.pm,v 1.13 2009-09-10 09:25:04 louise Exp $
package Cobrand;
use strict;
@@ -96,17 +96,22 @@ sub base_url{
Return the contact email for the cobranded version of the site
=cut
-sub contact_email{
+sub contact_email {
my $cobrand = shift;
+ return get_cobrand_conf($cobrand, 'CONTACT_EMAIL');
+}
+
+sub get_cobrand_conf {
+ my ($cobrand, $key) = @_;
+ my $value;
$cobrand = uc($cobrand);
- my $sender;
if ($cobrand){
- $sender = mySociety::Config::get("CONTACT_EMAIL_" . $cobrand, undef);
+ $value = mySociety::Config::get($key . "_" . $cobrand, undef);
}
- if (!$sender){
- $sender = mySociety::Config::get('CONTACT_EMAIL');
+ if (!$value){
+ $value = mySociety::Config::get($key);
}
- return $sender;
+ return $value;
}
=item set_lang_and_domain COBRAND LANG
@@ -119,10 +124,10 @@ sub set_lang_and_domain($$;$) {
if ($cobrand){
my $handle = cobrand_handle($cobrand);
if ($handle){
- $handle->set_lang_and_domain($lang);
+ $handle->set_lang_and_domain($lang, $unicode);
}
}else{
- mySociety::Locale::negotiate_language('en-gb,English,en_GB|nb,Norwegian,nb_NO'); # XXX Testing
+ mySociety::Locale::negotiate_language('en-gb,English,en_GB|nb,Norwegian,nb_NO', $lang); # XXX Testing
mySociety::Locale::gettext_domain('FixMyStreet', $unicode);
mySociety::Locale::change();
}