aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xweb/ajax.cgi6
-rwxr-xr-xweb/alert.cgi22
-rwxr-xr-xweb/confirm.cgi35
-rwxr-xr-xweb/reports.cgi22
-rwxr-xr-xweb/rss.cgi14
5 files changed, 49 insertions, 50 deletions
diff --git a/web/ajax.cgi b/web/ajax.cgi
index e33c210cc..4c668704c 100755
--- a/web/ajax.cgi
+++ b/web/ajax.cgi
@@ -6,7 +6,7 @@
# Copyright (c) 2008 UK Citizens Online Democracy. All rights reserved.
# Email: matthew@mysociety.org. WWW: http://www.mysociety.org
#
-# $Id: ajax.cgi,v 1.14 2009-10-15 16:51:55 louise Exp $
+# $Id: ajax.cgi,v 1.15 2009-10-21 15:05:55 louise Exp $
use strict;
use Standard;
@@ -50,7 +50,7 @@ sub main {
sx => undef,
sy => undef,
all_pins => undef,
- no_pins => undef));
+ no_pins => undef), $q);
$list .= '<li><a href="' . $link . '">';
$list .= $_->{title};
$list .= '</a>';
@@ -69,7 +69,7 @@ sub main {
sx => undef,
sy => undef,
all_pins => undef,
- no_pins => undef));
+ no_pins => undef), $q);
$list .= '<li><a href="' . $link . '">';
$list .= $_->{title} . ' <small>(' . int($_->{distance}/100+.5)/10 . 'km)</small>';
$list .= '</a>';
diff --git a/web/alert.cgi b/web/alert.cgi
index 1d657a85f..a29453445 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.53 2009-10-20 11:57:25 louise Exp $
+# $Id: alert.cgi,v 1.54 2009-10-21 15:06:31 louise Exp $
use strict;
use Standard;
@@ -35,7 +35,7 @@ sub main {
if ($data->{id}) {
$out = alert_token($q, $data);
} else {
- my $contact_url = Cobrand::url(Page::get_cobrand($q), '/contact');
+ my $contact_url = Cobrand::url(Page::get_cobrand($q), '/contact', $q);
$out = $q->p(_(<<EOF));
Thank you for trying to confirm your alert. We seem to have an error ourselves
though, so <a href="$contact_url">please let us know what went on</a> and we'll look into it.
@@ -208,7 +208,7 @@ for the county council.')));
? sprintf(_('Local RSS feeds and email alerts for &lsquo;%s&rsquo;'), $pretty_pc)
: _('Local RSS feeds and email alerts')
);
- my $form_action = Cobrand::url($cobrand, '/alert');
+ my $form_action = Cobrand::url($cobrand, '/alert', $q);
$out .= <<EOF;
<form id="alerts" name="alerts" method="post" action="$form_action">
<input type="hidden" name="type" value="local">
@@ -228,15 +228,15 @@ feed, or enter your email address to subscribe to an email alert.'));
<input type="radio" name="feed" id="local:$x:$y" value="local:$x:$y"$checked>
<label for="local:$x:$y">$label</label>
EOF
- my $rss_feed = Cobrand::url(Page::get_cobrand($q), "/rss/$x,$y");
+ my $rss_feed = Cobrand::url(Page::get_cobrand($q), "/rss/$x,$y", $q);
$out .= _('(a default distance which covers roughly 200,000 people)');
$out .= " <a href='$rss_feed'><img src='/i/feed.png' width='16' height='16' title='"
. _('RSS feed of nearby problems') . "' alt='" . _('RSS feed') . "' border='0'></a>";
$out .= '</p> <p id="rss_local_alt">' . _('(alternatively the RSS feed can be customised, within');
- my $rss_feed_2k = Cobrand::url($cobrand, "/rss/$x,$y/2");
- my $rss_feed_5k = Cobrand::url($cobrand, "/rss/$x,$y/5");
- my $rss_feed_10k = Cobrand::url($cobrand, "/rss/$x,$y/10");
- my $rss_feed_20k = Cobrand::url($cobrand, "/rss/$x,$y/20");
+ my $rss_feed_2k = Cobrand::url($cobrand, "/rss/$x,$y/2", $q);
+ my $rss_feed_5k = Cobrand::url($cobrand, "/rss/$x,$y/5", $q);
+ my $rss_feed_10k = Cobrand::url($cobrand, "/rss/$x,$y/10", $q);
+ my $rss_feed_20k = Cobrand::url($cobrand, "/rss/$x,$y/20", $q);
$out .= <<EOF;
<a href="$rss_feed_2k">2km</a> / <a href="$rss_feed_5k">5km</a>
/ <a href="$rss_feed_10k">10km</a> / <a href="$rss_feed_20k">20km</a>)
@@ -266,7 +266,7 @@ sub alert_list_options {
my $url = "/rss/";
$url .= $type eq 'area' ? 'area' : 'reports';
$url .= '/' . $rss ;
- my $rss_url = Cobrand::url(Page::get_cobrand($q), $url);
+ my $rss_url = Cobrand::url(Page::get_cobrand($q), $url, $q);
$out .= 'value="' . $id . '"> <label for="' . $id . '">' . $text
. '</label> <a href="' . $rss_url . '"><img src="/i/feed.png" width="16" height="16"
title="' . sprintf(_('RSS feed of %s'), $text) . '" alt="' . _('RSS feed') . '" border="0"></a>';
@@ -285,7 +285,7 @@ sub alert_front_page {
$out .= $q->p(_('FixMyStreet has a variety of RSS feeds and email alerts for local problems, including
alerts for all problems within a particular ward or council, or all problems
within a certain distance of a particular location.'));
- my $form_action = Cobrand::url(Page::get_cobrand($q), '/alert');
+ my $form_action = Cobrand::url(Page::get_cobrand($q), '/alert', $q);
$out .= $errors . qq(<form method="get" action="$form_action">);
$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} . '">
@@ -333,7 +333,7 @@ sub alert_updates_form {
$out .= $q->p(_('Receive email when updates are left on this problem.'));
my $label = _('Email:');
my $subscribe = _('Subscribe');
- my $form_action = Cobrand::url(Page::get_cobrand($q), 'alert');
+ my $form_action = Cobrand::url(Page::get_cobrand($q), 'alert', $q);
$out .= <<EOF;
<form action="$form_action" method="post">
<label class="n" for="alert_rznvy">$label</label>
diff --git a/web/confirm.cgi b/web/confirm.cgi
index dcc8e48b4..10655c14c 100755
--- a/web/confirm.cgi
+++ b/web/confirm.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: confirm.cgi,v 1.57 2009-09-28 15:40:56 louise Exp $
+# $Id: confirm.cgi,v 1.58 2009-10-21 15:10:08 louise Exp $
use strict;
use Standard;
@@ -51,7 +51,7 @@ Page::do_fastcgi(\&main);
sub confirm_update {
my ($q, $data) = @_;
-
+ my $cobrand = Page::get_cobrand($q);
my $id = $data;
my $add_alert = 0;
if (ref($data)) {
@@ -89,18 +89,18 @@ sub confirm_update {
my $answered_ever_reported = dbh()->selectrow_array(
'select id from questionnaire where problem_id in (select id from problem where lower(email)=?) and ever_reported is not null', {}, $email);
if (!$answered_ever_reported) {
- $out = ask_questionnaire($q->param('token'));
+ $out = ask_questionnaire($q->param('token'), $q);
}
}
+ my $report_url = Cobrand::url($cobrand, "/report/$problem_id#update_$id", $q);
if (!$out) {
- $out = $q->p({class => 'confirmed'}, sprintf(_('You have successfully confirmed your update and you can now <a href="%s">view it on the site</a>.'), "/report/$problem_id#update_$id"));
+ $out = $q->p({class => 'confirmed'}, sprintf(_('You have successfully confirmed your update and you can now <a href="%s">view it on the site</a>.'), $report_url));
$out .= CrossSell::display_advert($q, $email, $name);
}
# Subscribe updater to email updates if requested
if ($add_alert) {
- my $cobrand = Page::get_cobrand($q);
my $alert_id = mySociety::Alert::create($email, 'new_updates', $cobrand, $cobrand_data, $problem_id);
mySociety::Alert::confirm($alert_id);
}
@@ -110,7 +110,7 @@ sub confirm_update {
sub confirm_problem {
my ($q, $id) = @_;
-
+ my $cobrand = Page::get_cobrand($q);
my ($council, $email, $name, $cobrand_data) = dbh()->selectrow_array("select council, email, name, cobrand_data from problem where id=?", {}, $id);
(my $domain = $email) =~ s/^.*\@//;
@@ -122,12 +122,7 @@ sub confirm_problem {
where id=? and state='unconfirmed'", {}, $id);
}
my $out;
- if ($q->{site} eq 'scambs') {
- $out = $q->p($q->big(
- 'You have successfully confirmed your problem, and we will be in contact with you about it shortly. '
- . sprintf(' <a href="%s">View the problem on this site</a>.', "/report/$id")
- ));
- } elsif ($q->{site} eq 'emptyhomes') {
+ if ($q->{site} eq 'emptyhomes') {
if ($council) {
$out = $q->p(_('Thank you for reporting an empty property on
ReportEmptyHomes.com. We have emailed the empty property officer in the council
@@ -150,10 +145,11 @@ $q->p('<a href="/report/' . $id . '">' . _('View your report') . '</a>.');
$q->p('<a href="/report/' . $id . '">' . _('View your report') . '</a>.');
}
} else {
+ my $report_url = Cobrand::url($cobrand, "/report/$id", $q);
$out = $q->p({class => 'confirmed'},
_('You have successfully confirmed your problem')
. ($council ? _(' and <strong>we will now send it to the council</strong>') : '')
- . sprintf(_('. You can <a href="%s">view the problem on this site</a>.'), "/report/$id")
+ . sprintf(_('. You can <a href="%s">view the problem on this site</a>.'), $report_url)
);
$out .= CrossSell::display_advert($q, $email, $name);
}
@@ -167,13 +163,15 @@ $q->p('<a href="/report/' . $id . '">' . _('View your report') . '</a>.');
}
sub ask_questionnaire {
- my ($token) = @_;
+ my ($token, $q) = @_;
+ my $cobrand = Page::get_cobrand($q);
my $qn_thanks = _("Thanks, glad to hear it's been fixed! Could we just ask if you have ever reported a problem to a council before?");
my $yes = _('Yes');
my $no = _('No');
my $go = _('Go');
+ my $form_action = Cobrand::url($cobrand, "/confirm", $q);
my $out = <<EOF;
-<form action="/confirm" method="post" id="questionnaire">
+<form action="$form_action" method="post" id="questionnaire">
<input type="hidden" name="type" value="questionnaire">
<input type="hidden" name="token" value="$token">
<p>$qn_thanks</p>
@@ -196,11 +194,11 @@ sub add_questionnaire {
if (ref($data)) {
$id = $data->{id};
}
-
+ my $cobrand = Page::get_cobrand($q);
my ($problem_id, $email, $name) = dbh()->selectrow_array("select problem_id, email, name from comment where id=?", {}, $id);
my $reported = $q->param('reported') || '';
$reported = $reported eq 'Yes' ? 't' : ($reported eq 'No' ? 'f' : undef);
- return ask_questionnaire($token) unless $reported;
+ return ask_questionnaire($token, $q) unless $reported;
my $already = dbh()->selectrow_array("select id from questionnaire
where problem_id=? and old_state='confirmed' and new_state='fixed'",
{}, $problem_id);
@@ -208,7 +206,8 @@ sub add_questionnaire {
ever_reported, old_state, new_state) values (?, ms_current_timestamp(),
ms_current_timestamp(), ?, 'confirmed', 'fixed');", {}, $problem_id, $reported)
unless $already;
- my $out = $q->p({class => 'confirmed'}, sprintf(_('Thank you &mdash; you can <a href="%s">view your updated problem</a> on the site.'), "/report/$problem_id"));
+ my $report_url = Cobrand::url($cobrand, "/report/$problem_id", $q);
+ my $out = $q->p({class => 'confirmed'}, sprintf(_('Thank you &mdash; you can <a href="%s">view your updated problem</a> on the site.'), $report_url));
$out .= CrossSell::display_advert($q, $email, $name);
return $out;
}
diff --git a/web/reports.cgi b/web/reports.cgi
index f99ee7bee..04d30fe76 100755
--- a/web/reports.cgi
+++ b/web/reports.cgi
@@ -7,7 +7,7 @@
# Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved.
# Email: matthew@mysociety.org. WWW: http://www.mysociety.org
#
-# $Id: reports.cgi,v 1.35 2009-10-21 08:41:09 louise Exp $
+# $Id: reports.cgi,v 1.36 2009-10-21 15:13:18 louise Exp $
use strict;
use Standard;
@@ -100,7 +100,7 @@ sub main {
}
print $q->header( -type => 'application/xml; charset=utf-8' );
my $xsl = Cobrand::feed_xsl($cobrand);
- my $out = mySociety::Alert::generate_rss($type, $xsl, "/$url", \@params, \%title_params, $cobrand);
+ my $out = mySociety::Alert::generate_rss($type, $xsl, "/$url", \@params, \%title_params, $cobrand, $q);
$out =~ s/matthew.fixmystreet/emptyhomes.matthew.fixmystreet/g if $q->{site} eq 'emptyhomes';
print $out;
return;
@@ -178,7 +178,7 @@ sub main {
print ' class="a"';
}
my $url = Page::short_name($areas_info->{$_}->{name});
- my $cobrand_url = Cobrand::url($cobrand, "/reports/$url");
+ my $cobrand_url = Cobrand::url($cobrand, "/reports/$url", $q);
print '><td align="left"><a href="' . $cobrand_url . '">' .
$areas_info->{$_}->{name} . '</a></td>';
summary_cell(\@{$open{$_}{new}});
@@ -201,7 +201,7 @@ sub main {
if (!$name) {
print Page::header($q, title=>_("Summary reports"));
print "Council with identifier " . ent($one_council). " not found. ";
- print $q->a({href => Cobrand::url($cobrand, '/reports') }, 'Show all councils');
+ print $q->a({href => Cobrand::url($cobrand, '/reports', $q) }, 'Show all councils');
print ".";
} else {
my $rss_url = '/rss/reports/' . Page::short_name($name);
@@ -211,22 +211,22 @@ sub main {
$thing = 'ward';
$name = ent($q_ward) . ", $name";
}
- print Page::header($q, title=>sprintf(_('%s - Summary reports'), $name), rss => [ sprintf(_('Problems within %s, FixMyStreet'), $name), Cobrand::url($cobrand, $rss_url) ]);
+ print Page::header($q, title=>sprintf(_('%s - Summary reports'), $name), rss => [ sprintf(_('Problems within %s, FixMyStreet'), $name), Cobrand::url($cobrand, $rss_url, $q) ]);
my $rss_title = _('RSS feed');
my $rss_alt = _('RSS feed of problems in this %s');
my $summary_line;
my $all_councils_report = Cobrand::all_councils_report($cobrand);
if ($all && ! $all_councils_report) {
- $summary_line = sprintf(_('You can <a href="%s">see less detail</a>.'), Cobrand::url($cobrand, NewURL($q)));
+ $summary_line = sprintf(_('You can <a href="%s">see less detail</a>.'), Cobrand::url($cobrand, NewURL($q), $q));
} elsif (! $all_councils_report) {
- $summary_line = sprintf(_('You can <a href="%s">see more details</a>.'), Cobrand::url($cobrand, NewURL($q, all=>1)));
+ $summary_line = sprintf(_('You can <a href="%s">see more details</a>.'), Cobrand::url($cobrand, NewURL($q, all=>1), $q));
} elsif ($all) {
- $summary_line = sprintf(_('You can <a href="%s">see less detail</a> or go back and <a href="/reports">show all councils</a>.'), Cobrand::url($cobrand, NewURL($q)));
+ $summary_line = sprintf(_('You can <a href="%s">see less detail</a> or go back and <a href="/reports">show all councils</a>.'), Cobrand::url($cobrand, NewURL($q), $q));
} else {
- $summary_line = sprintf(_('You can <a href="%s">see more details</a> or go back and <a href="/reports">show all councils</a>.'), Cobrand::url($cobrand, NewURL($q, all=>1)));
+ $summary_line = sprintf(_('You can <a href="%s">see more details</a> or go back and <a href="/reports">show all councils</a>.'), Cobrand::url($cobrand, NewURL($q, all=>1), $q));
}
print $q->p(
- $q->a({ href => Cobrand::url($cobrand, $rss_url) }, '<img align="right" src="/i/feed.png" width="16" height="16" title="' . $rss_title . '" alt="' . sprintf($rss_alt, $thing) . '" border="0" hspace="4">'),
+ $q->a({ href => Cobrand::url($cobrand, $rss_url, $q) }, '<img align="right" src="/i/feed.png" width="16" height="16" title="' . $rss_title . '" alt="' . sprintf($rss_alt, $thing) . '" border="0" hspace="4">'),
sprintf(_('This is a summary of all reports for one %s.'), $thing) . ' ' . $summary_line);
print "<h2>$name</h2>\n";
if ($open{$one_council}) {
@@ -284,7 +284,7 @@ sub list_problems {
my $cobrand = Page::get_cobrand($q);
print "<h3>$title</h3>\n<ul>";
foreach (@$problems) {
- my $url = Cobrand::url($cobrand, "/report/" . $_->[0]);
+ my $url = Cobrand::url($cobrand, "/report/" . $_->[0], $q);
print '<li><a href="' . $url . '">';
print ent($_->[1]);
print '</a>';
diff --git a/web/rss.cgi b/web/rss.cgi
index 1925a2219..eab3400c7 100755
--- a/web/rss.cgi
+++ b/web/rss.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: rss.cgi,v 1.34 2009-10-20 15:10:52 louise Exp $
+# $Id: rss.cgi,v 1.35 2009-10-21 15:14:08 louise Exp $
use strict;
use Error qw(:try);
@@ -29,20 +29,20 @@ sub main {
} elsif ($type eq 'new_updates') {
my $id = $q->param('id');
my $qs = 'report/' . $id;
- $out = mySociety::Alert::generate_rss($type, $xsl, $qs, [$id], undef, $cobrand);
+ $out = mySociety::Alert::generate_rss($type, $xsl, $qs, [$id], undef, $cobrand, $q);
} elsif ($type eq 'new_problems' || $type eq 'new_fixed_problems') {
- $out = mySociety::Alert::generate_rss($type, $xsl, '', undef, undef, $cobrand);
+ $out = mySociety::Alert::generate_rss($type, $xsl, '', undef, undef, $cobrand, $q);
} elsif ($type eq 'council_problems') {
my $id = $q->param('id');
my $qs = '/'.$id;
- $out = mySociety::Alert::generate_rss($type, $xsl, $qs, [$id], undef, $cobrand);
+ $out = mySociety::Alert::generate_rss($type, $xsl, $qs, [$id], undef, $cobrand. $q);
} elsif ($type eq 'area_problems') {
my $id = $q->param('id');
my $va_info = mySociety::MaPit::get_voting_area_info($id);
my $qs = '/'.$id;
- $out = mySociety::Alert::generate_rss($type, $xsl, $qs, [$id], { NAME => $va_info->{name} }, $cobrand);
+ $out = mySociety::Alert::generate_rss($type, $xsl, $qs, [$id], { NAME => $va_info->{name} }, $cobrand, $q);
} elsif ($type eq 'all_problems') {
- $out = mySociety::Alert::generate_rss($type, $xsl, '', undef, undef, $cobrand);
+ $out = mySociety::Alert::generate_rss($type, $xsl, '', undef, undef, $cobrand, $q);
} else {
my $base = mySociety::Config::get('BASE_URL');
print $q->redirect($base . '/alert');
@@ -99,6 +99,6 @@ sub rss_local_problems {
}
my $xsl = Cobrand::feed_xsl($cobrand);
- return mySociety::Alert::generate_rss('local_problems', $xsl, $qs, [$e, $n, $d], undef, $cobrand);
+ return mySociety::Alert::generate_rss('local_problems', $xsl, $qs, [$e, $n, $d], undef, $cobrand, $q);
}