aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--conf/httpd.conf12
-rw-r--r--db/alert_types.sql2
-rw-r--r--perllib/Page.pm4
-rwxr-xr-xweb-admin/index.cgi6
-rwxr-xr-xweb/reports.cgi (renamed from web/report.cgi)33
-rw-r--r--web/xsl.xsl2
6 files changed, 41 insertions, 18 deletions
diff --git a/conf/httpd.conf b/conf/httpd.conf
index a35023739..aaad9112b 100644
--- a/conf/httpd.conf
+++ b/conf/httpd.conf
@@ -20,7 +20,7 @@
# Copyright (c) 2006 UK Citizens Online Democracy. All rights reserved.
# Email: francis@mysociety.org; WWW: http://www.mysociety.org
#
-# $Id: httpd.conf,v 1.20 2007-08-16 15:17:24 matthew Exp $
+# $Id: httpd.conf,v 1.21 2007-08-23 11:45:43 matthew Exp $
DirectoryIndex index.cgi
@@ -28,6 +28,8 @@ RewriteEngine on
#RewriteLog /var/log/apache/rewrite.log
#RewriteLogLevel 3
+RewriteRule ^(.+)/$ $1 [R=permanent]
+
RewriteRule ^/[Aa]/([0-9A-Za-z]{16}).*$ /alert.cgi?token=$1
RewriteRule ^/[Cc]/([0-9A-Za-z]{16}).*$ /confirm.cgi?type=update;token=$1
RewriteRule ^/[Pp]/([0-9A-Za-z]{16}).*$ /confirm.cgi?type=problem;token=$1
@@ -42,9 +44,13 @@ RewriteRule ^/rss/([0-9]+),([0-9]+)/([0-9]+)$ /rss.cgi?type=local_problems;x
RewriteRule ^/rss/([0-9]+)/([0-9]+)/([0-9]+)$ /rss.cgi?type=local_problems;x=$1;y=$2;d=$3 [QSA]
RewriteRule ^/rss/l/([0-9]+)/([0-9]+)/([0-9]+)$ /rss.cgi?type=local_problems;lat=$1;lon=$2;d=$3 [QSA]
RewriteRule ^/rss/council/([0-9]+)$ /rss.cgi?type=council_problems;id=$1 [QSA]
+#RewriteRule ^/rss/ward/([0-9]+)$ /rss.cgi?type=council_problems;id=$1 [QSA]
RewriteRule ^/rss/problems$ /rss.cgi?type=new_problems [QSA]
-RewriteRule ^/report/([0-9]+)$ /?id=$1 [QSA]
+RewriteRule ^/report/([0-9]+)$ /index.cgi?id=$1 [QSA]
+RewriteRule ^/report$ /reports [R=permanent]
+RewriteRule ^/reports/([^/]+)/all$ /reports.cgi?council=$1;all=1 [QSA]
+RewriteRule ^/reports/([^/]+)$ /reports.cgi?council=$1 [QSA]
ProxyPass /tilma/ http://tilma.mysociety.org/
ProxyPassReverse /tilma/ http://tilma.mysociety.org/
@@ -53,8 +59,6 @@ ProxyPassReverse /tilma/ http://tilma.mysociety.org/
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI}.cgi -f
RewriteRule /(.+) /$1.cgi [PT]
-RewriteRule /(contact|faq|report)/ /$1 [R=permanent]
-
# Make a file down.html in the DocumentRoot bring down the whole site and
# display itself.
RewriteCond %{DOCUMENT_ROOT}/down.html -s
diff --git a/db/alert_types.sql b/db/alert_types.sql
index 7f157c453..9b7fab576 100644
--- a/db/alert_types.sql
+++ b/db/alert_types.sql
@@ -34,7 +34,7 @@ insert into alert_type
item_table, item_where, item_order,
item_title, item_link, item_description, template)
values ('council_problems', '', '',
- 'New local problems on FixMyStreet', '/report', 'The latest local problems reported by users',
+ 'New local problems on FixMyStreet', '/reports', 'The latest local problems reported by users',
'problem', 'problem.state in (\'confirmed\', \'fixed\') and council like \'%\'||?||\'%\'', 'created desc',
'{{title}}', '/?id={{id}}', '{{detail}}', 'alert-problem'
);
diff --git a/perllib/Page.pm b/perllib/Page.pm
index 73c19f105..f131f929d 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.59 2007-08-20 10:39:30 matthew Exp $
+# $Id: Page.pm,v 1.60 2007-08-23 11:45:44 matthew Exp $
#
package Page;
@@ -115,7 +115,7 @@ sub footer {
<h2 class="v">Navigation</h2>
<ul id="navigation">
<li><a href="/">Report a problem</a></li>
-<li><a href="/report">All reports</a></li>
+<li><a href="/reports">All reports</a></li>
<li><a href="/faq">Help</a></li>
<li><a href="/contact">Contact</a></li>
</ul>
diff --git a/web-admin/index.cgi b/web-admin/index.cgi
index 47257d807..eb4a13350 100755
--- a/web-admin/index.cgi
+++ b/web-admin/index.cgi
@@ -7,10 +7,10 @@
# Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved.
# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
#
-# $Id: index.cgi,v 1.44 2007-08-15 19:21:47 matthew Exp $
+# $Id: index.cgi,v 1.45 2007-08-23 11:45:44 matthew Exp $
#
-my $rcsid = ''; $rcsid .= '$Id: index.cgi,v 1.44 2007-08-15 19:21:47 matthew Exp $';
+my $rcsid = ''; $rcsid .= '$Id: index.cgi,v 1.45 2007-08-23 11:45:44 matthew Exp $';
use strict;
@@ -283,7 +283,7 @@ sub do_council_contacts ($$) {
"Example postcode " . $example_postcode) . " | ";
}
$links_html .= ' ' .
- $q->a({href => build_url($q, mySociety::Config::get('BASE_URL') . "/report",
+ $q->a({href => build_url($q, mySociety::Config::get('BASE_URL') . "/reports",
{ 'council' => $area_id}) }, " List all reported problems");
print $q->p($links_html);
diff --git a/web/report.cgi b/web/reports.cgi
index 2a3845696..aea46e36f 100755
--- a/web/report.cgi
+++ b/web/reports.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: report.cgi,v 1.40 2007-06-19 15:54:24 matthew Exp $
+# $Id: reports.cgi,v 1.1 2007-08-23 11:45:44 matthew Exp $
use strict;
require 5.8.0;
@@ -15,12 +15,14 @@ require 5.8.0;
use FindBin;
use lib "$FindBin::Bin/../perllib";
use lib "$FindBin::Bin/../../perllib";
+use URI::Escape;
use Page;
use mySociety::Config;
use mySociety::DBHandle qw(dbh select_all);
use mySociety::MaPit;
use mySociety::Web qw(ent NewURL);
+use mySociety::VotingArea;
BEGIN {
mySociety::Config::set_file("$FindBin::Bin/../conf/general");
@@ -37,7 +39,14 @@ sub main {
my $q = shift;
my $all = $q->param('all') || 0;
my $one_council = $q->param('council') || '';
- $one_council =~ s/\D//g;
+ if ($one_council =~ /\D/) {
+ $one_council = mySociety::MaPit::get_voting_area_by_name($one_council, $mySociety::VotingArea::council_parent_types);
+ if (keys %$one_council == 1) {
+ ($one_council) = keys %$one_council;
+ } else {
+ $one_council = undef;
+ }
+ }
$all = 0 unless $one_council;
my @params;
my $where_extra = '';
@@ -85,7 +94,8 @@ sub main {
foreach (sort { $areas_info->{$a}->{name} cmp $areas_info->{$b}->{name} } keys %councils) {
print '<tr align="center"';
print ' class="a"' if (++$c%2);
- print '><td align="left"><a href="report?council=' . $_ . '">' .
+ my $url = short_name($areas_info->{$_}->{name});
+ print '><td align="left"><a href="/reports/' . $url . '">' .
$areas_info->{$_}->{name} . '</a></td>';
summary_cell(\@{$open{$_}{new}});
summary_cell(\@{$open{$_}{older}});
@@ -100,7 +110,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 => NewURL($q, all=>undef, council=>undef) }, 'Show all councils');
+ print $q->a({href => '/reports' }, 'Show all councils');
print ".";
} else {
print Page::header($q, title=>"$name - Summary reports", rss => [ "Problems within $name, FixMyStreet", "/rss/council/$one_council" ]);
@@ -108,10 +118,10 @@ sub main {
$q->a({href => "/rss/council/$one_council"}, '<img align="right" src="/i/feed.png" width="16" height="16" title="RSS feed" alt="RSS feed of problems in this council" border="0" hspace="4">'),
'This is a summary of all reports for one council. You can ' .
($all ?
- $q->a({href => NewURL($q, all=>undef) }, 'see less detail') :
- $q->a({href => NewURL($q, all=>1) }, 'see more details')) .
+ $q->a({href => NewURL($q, council=>undef, all=>undef) }, 'see less detail') :
+ $q->a({href => NewURL($q, council=>undef, all=>1) }, 'see more details')) .
' or go back and ' .
- $q->a({href => NewURL($q, all=>undef, council=>undef) }, 'show all councils') .
+ $q->a({href => '/reports' }, 'show all councils') .
'.');
print "<h2>$name</h2>\n";
if ($open{$one_council}) {
@@ -154,3 +164,12 @@ sub list_problems {
}
print '</ul>';
}
+
+sub short_name {
+ my $name = shift;
+ $name =~ s/ (Borough|City|District|County) Council$//;
+ $name =~ s/ Council$//;
+ $name = uri_escape($name);
+ $name =~ s/%20/+/g;
+ return $name;
+}
diff --git a/web/xsl.xsl b/web/xsl.xsl
index 95eeb0a33..cbb11062f 100644
--- a/web/xsl.xsl
+++ b/web/xsl.xsl
@@ -18,7 +18,7 @@
<h2 class="v">Navigation</h2>
<ul id="navigation">
<li><a href="/">Report a problem</a></li>
-<li><a href="/report">All reports</a></li>
+<li><a href="/reports">All reports</a></li>
<li><a href="/faq">Help</a></li>
<li><a href="/contact">Contact</a></li>
</ul>