aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--perllib/Page.pm12
-rwxr-xr-xweb/alert.cgi7
-rwxr-xr-xweb/index.cgi6
3 files changed, 15 insertions, 10 deletions
diff --git a/perllib/Page.pm b/perllib/Page.pm
index 50f9b1e7f..ac1caa303 100644
--- a/perllib/Page.pm
+++ b/perllib/Page.pm
@@ -6,7 +6,7 @@
# Copyright (c) 2006 UK Citizens Online Democracy. All rights reserved.
# Email: matthew@mysociety.org; WWW: http://www.mysociety.org/
#
-# $Id: Page.pm,v 1.186 2009-09-28 10:43:58 louise Exp $
+# $Id: Page.pm,v 1.187 2009-09-28 12:57:03 louise Exp $
#
package Page;
@@ -920,14 +920,16 @@ sub geocode_string {
# geocode_choice
# Prints response if there's more than one possible result
sub geocode_choice {
- my ($choices, $page) = @_;
+ my ($choices, $page, $q) = @_;
+ my $url;
my $out = '<p>' . _('We found more than one match for that location. We show up to ten matches, please try a different search if yours is not here.') . '</p> <ul>';
foreach my $choice (@$choices) {
$choice =~ s/, United Kingdom//;
$choice =~ s/, UK//;
- my $url = uri_escape($choice);
- $url =~ s/%20/+/g;
- $out .= '<li><a href="' . $page . '?pc=' . $url . '">' . $choice . "</a></li>\n";
+ my $encoded_choice = $choice;
+ $encoded_choice =~ s/ /+/g;
+ $url = NewURL($q, -retain => 1, -url => $page, 'pc' => $encoded_choice);
+ $out .= '<li><a href="' . $url . '">' . $choice . "</a></li>\n";
}
$out .= '</ul>';
return $out;
diff --git a/web/alert.cgi b/web/alert.cgi
index e56846ee1..8a7c4d0fc 100755
--- a/web/alert.cgi
+++ b/web/alert.cgi
@@ -6,7 +6,7 @@
# Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved.
# Email: matthew@mysociety.org. WWW: http://www.mysociety.org
#
-# $Id: alert.cgi,v 1.48 2009-09-28 10:55:44 louise Exp $
+# $Id: alert.cgi,v 1.49 2009-09-28 12:57:03 louise Exp $
use strict;
use Standard;
@@ -81,7 +81,7 @@ sub alert_list {
$error = shift;
};
}
- return Page::geocode_choice($error, '/alert') if ref($error) eq 'ARRAY';
+ return Page::geocode_choice($error, '/alert', $q) if ref($error) eq 'ARRAY';
return alert_front_page($q, $error) if $error;
my $pretty_pc = $input_h{pc};
@@ -275,6 +275,7 @@ within a certain distance of a particular location.'));
$out .= $q->p(_('To find out what local alerts we have for you, please enter your GB
postcode or street name and area:'), '<input type="text" name="pc" value="' . $input_h{pc} . '">
<input type="submit" value="' . _('Go') . '">');
+ $out .= Cobrand::form_elements(Page::get_cobrand($q), 'alerts', $q);
$out .= '</form>';
return $out if $q->referer() && $q->referer() =~ /fixmystreet\.com/;
@@ -309,6 +310,7 @@ sub alert_updates_form {
my @vars = qw(id rznvy);
my %input = map { $_ => $q->param($_) || '' } @vars;
my %input_h = map { $_ => $q->param($_) ? ent($q->param($_)) : '' } @vars;
+ my $cobrand_form_elements = Cobrand::form_elements(Page::get_cobrand($q), 'alerts', $q);
my $out = '';
if (@errors) {
$out .= '<ul class="error"><li>' . join('</li><li>', @errors) . '</li></ul>';
@@ -323,6 +325,7 @@ sub alert_updates_form {
<input type="hidden" name="id" value="$input_h{id}">
<input type="hidden" name="type" value="updates">
<input type="submit" value="$subscribe">
+$cobrand_form_elements
</form>
EOF
return $out;
diff --git a/web/index.cgi b/web/index.cgi
index 1d868aea5..80b5989ae 100755
--- a/web/index.cgi
+++ b/web/index.cgi
@@ -6,7 +6,7 @@
# Copyright (c) 2006 UK Citizens Online Democracy. All rights reserved.
# Email: matthew@mysociety.org. WWW: http://www.mysociety.org
#
-# $Id: index.cgi,v 1.290 2009-09-28 12:18:54 louise Exp $
+# $Id: index.cgi,v 1.291 2009-09-28 12:57:03 louise Exp $
use strict;
use Standard;
@@ -471,7 +471,7 @@ sub display_form {
} catch Error::Simple with {
$error = shift;
};
- return Page::geocode_choice($error, '/') if ref($error) eq 'ARRAY';
+ return Page::geocode_choice($error, '/', $q) if ref($error) eq 'ARRAY';
return front_page($q, $error) if $error;
$input{x} = int(Page::os_to_tile($easting));
$input{y} = int(Page::os_to_tile($northing));
@@ -783,7 +783,7 @@ sub display_location {
$error = shift;
};
}
- return Page::geocode_choice($error, '/') if (ref($error) eq 'ARRAY');
+ return Page::geocode_choice($error, '/', $q) if (ref($error) eq 'ARRAY');
return front_page($q, $error) if ($error);
# Deal with pin hiding/age