aboutsummaryrefslogtreecommitdiffstats
path: root/web
diff options
context:
space:
mode:
Diffstat (limited to 'web')
-rwxr-xr-xweb/alert.cgi25
-rwxr-xr-xweb/contact.cgi10
-rw-r--r--web/css/core.css10
-rwxr-xr-xweb/index.cgi37
-rw-r--r--web/js.js60
-rwxr-xr-xweb/questionnaire.cgi1
-rwxr-xr-xweb/reports.cgi28
-rwxr-xr-xweb/rss.cgi2
8 files changed, 79 insertions, 94 deletions
diff --git a/web/alert.cgi b/web/alert.cgi
index 59b6607a4..c755c9715 100755
--- a/web/alert.cgi
+++ b/web/alert.cgi
@@ -104,13 +104,12 @@ sub alert_list {
my @types = (@$mySociety::VotingArea::council_parent_types, @$mySociety::VotingArea::council_child_types);
my %councils = map { $_ => 1 } @$mySociety::VotingArea::council_parent_types;
- my $areas = mySociety::MaPit::get_voting_areas_by_location({easting=>$e, northing=>$n}, 'polygon', \@types);
+ my $areas = mySociety::MaPit::call('point', "27700/$e,$n", type => \@types);
my $cobrand = Page::get_cobrand($q);
my ($success, $error_msg) = Cobrand::council_check($cobrand, $areas, $q, 'alert');
if (!$success){
return alert_front_page($q, $error_msg);
}
- $areas = mySociety::MaPit::get_voting_areas_info([ keys %$areas ]);
return alert_front_page($q, _('That location does not appear to be covered by a council, perhaps it is offshore - please try somewhere more specific.')) if keys %$areas == 0;
@@ -126,9 +125,9 @@ sub alert_list {
$ward = $_;
}
}
- push @options, [ 'council', $council->{area_id}, Page::short_name($council->{name}),
+ push @options, [ 'council', $council->{id}, Page::short_name($council->{name}),
sprintf(_("Problems within %s"), $council->{name}) ];
- push @options, [ 'ward', $council->{area_id}.':'.$ward->{area_id}, Page::short_name($council->{name}) . '/'
+ push @options, [ 'ward', $council->{id}.':'.$ward->{id}, Page::short_name($council->{name}) . '/'
. Page::short_name($ward->{name}), sprintf(_("Problems within %s ward"), $ward->{name}) ];
$options_start = "<div><ul id='rss_feed'>";
@@ -142,7 +141,7 @@ sub alert_list {
foreach (values %$areas) {
$council = $_;
}
- push @options, [ 'council', $council->{area_id}, Page::short_name($council->{name}),
+ push @options, [ 'council', $council->{id}, Page::short_name($council->{name}),
sprintf(_("Problems within %s"), $council->{name}) ];
$options_start = "<div><ul id='rss_feed'>";
@@ -165,24 +164,24 @@ sub alert_list {
}
}
push @options,
- [ 'area', $district->{area_id}, Page::short_name($district->{name}), $district->{name} ],
- [ 'area', $district->{area_id}.':'.$d_ward->{area_id}, Page::short_name($district->{name}) . '/'
+ [ 'area', $district->{id}, Page::short_name($district->{name}), $district->{name} ],
+ [ 'area', $district->{id}.':'.$d_ward->{id}, Page::short_name($district->{name}) . '/'
. Page::short_name($d_ward->{name}), "$d_ward->{name} ward, $district->{name}" ],
- [ 'area', $county->{area_id}, Page::short_name($county->{name}), $county->{name} ],
- [ 'area', $county->{area_id}.':'.$c_ward->{area_id}, Page::short_name($county->{name}) . '/'
+ [ 'area', $county->{id}, Page::short_name($county->{name}), $county->{name} ],
+ [ 'area', $county->{id}.':'.$c_ward->{id}, Page::short_name($county->{name}) . '/'
. Page::short_name($c_ward->{name}), "$c_ward->{name} ward, $county->{name}" ];
$options_start = '<div id="rss_list">';
$options = $q->p($q->strong(_('Problems within the boundary of:'))) .
$q->ul(alert_list_options($q, @options));
@options = ();
push @options,
- [ 'council', $district->{area_id}, Page::short_name($district->{name}), $district->{name} ],
- [ 'ward', $district->{area_id}.':'.$d_ward->{area_id}, Page::short_name($district->{name}) . '/' . Page::short_name($d_ward->{name}),
+ [ 'council', $district->{id}, Page::short_name($district->{name}), $district->{name} ],
+ [ 'ward', $district->{id}.':'.$d_ward->{id}, Page::short_name($district->{name}) . '/' . Page::short_name($d_ward->{name}),
"$district->{name}, within $d_ward->{name} ward" ];
if ($q->{site} ne 'emptyhomes') {
push @options,
- [ 'council', $county->{area_id}, Page::short_name($county->{name}), $county->{name} ],
- [ 'ward', $county->{area_id}.':'.$c_ward->{area_id}, Page::short_name($county->{name}) . '/'
+ [ 'council', $county->{id}, Page::short_name($county->{name}), $county->{name} ],
+ [ 'ward', $county->{id}.':'.$c_ward->{id}, Page::short_name($county->{name}) . '/'
. Page::short_name($c_ward->{name}), "$county->{name}, within $c_ward->{name} ward" ];
$options .= $q->p($q->strong(_('Or problems reported to:'))) .
$q->ul(alert_list_options($q, @options));
diff --git a/web/contact.cgi b/web/contact.cgi
index bb4ed4913..6b82422a1 100755
--- a/web/contact.cgi
+++ b/web/contact.cgi
@@ -110,12 +110,12 @@ sub contact_details {
<div class="contact-details">
<p>$sitename is a service provided by mySociety, which is the project of a
registered charity. The charity is called UK Citizens Online Democracy and is charity number 1076346.</p>
-<p>mySociety can be contacted by email at <a href="mailto:team\@mysociety.org">team\@mysociety.org</a>,
+<p>mySociety can be contacted by email at <a href="mailto:hello&#64;mysociety.org">hello&#64;mysociety.org</a>,
or by post at:</p>
-<p>mySociety.org<br>
-12 Duke's Road<br>
-London<br>
-WC1H 9AD<br>
+<p>mySociety<br>
+PO Box 839<br>
+Oxford<br>
+OX1 9LG<br>
UK</p>
</div>
EOF
diff --git a/web/css/core.css b/web/css/core.css
index 4eb8496e2..08e6eca0d 100644
--- a/web/css/core.css
+++ b/web/css/core.css
@@ -191,7 +191,7 @@ fieldset div, #fieldset div {
#map_box {
float: right;
- width: 510px;
+ width: 502px; /* Two pixels more than width of #map */
position: relative;
padding-left: 20px;
background-color: #ffffff;
@@ -205,8 +205,8 @@ p#copyright {
#map {
border: solid 1px #000000;
- width: 508px;
- height: 508px;
+ width: 500px; /* Twice a tile width */
+ height: 500px;
overflow: hidden;
position: relative;
background-color: #f1f1f1;
@@ -214,8 +214,8 @@ p#copyright {
#drag {
position: absolute;
- width: 508px;
- height: 508px;
+ width: 500px;
+ height: 500px;
right: 0;
top: 0;
}
diff --git a/web/index.cgi b/web/index.cgi
index e39dd8921..f9428efa3 100755
--- a/web/index.cgi
+++ b/web/index.cgi
@@ -306,16 +306,13 @@ sub submit_problem {
my $areas;
if ($input{easting} && $input{northing}) {
- $areas = mySociety::MaPit::get_voting_areas_by_location(
- { easting=>$input{easting}, northing=>$input{northing} },
- 'polygon', [qw(WMC CTY CED DIS DIW MTD MTW COI COP LGD LGE UTA UTE UTW LBO LBW LAC SPC WAC NIE)]
- );
+ $areas = mySociety::MaPit::call('point', "27700/$input{easting},$input{northing}");
if ($input{council} =~ /^[\d,]+(\|[\d,]+)?$/) {
my $no_details = $1 || '';
my %va = map { $_ => 1 } @$mySociety::VotingArea::council_parent_types;
my %councils;
foreach (keys %$areas) {
- $councils{$_} = 1 if $va{$areas->{$_}};
+ $councils{$_} = 1 if $va{$areas->{$_}->{type}};
}
my @input_councils = split /,|\|/, $input{council};
foreach (@input_councils) {
@@ -515,9 +512,7 @@ sub display_form {
$parent_types = [qw(DIS LBO MTD UTA LGD COI)] # No CTY
if $q->{site} eq 'emptyhomes';
# XXX: I think we want in_gb_locale around the next line, needs testing
- my $all_councils = mySociety::MaPit::get_voting_areas_by_location(
- { easting => $easting, northing => $northing },
- 'polygon', $parent_types);
+ my $all_councils = mySociety::MaPit::call('point', "27700/$easting,$northing", type => $parent_types);
# Let cobrand do a check
my ($success, $error_msg) = Cobrand::council_check($cobrand, $all_councils, $q, 'submit_problem');
@@ -531,17 +526,15 @@ sub display_form {
# Norwich is responsible for everything in its areas, no Norfolk
delete $all_councils->{2233} if $all_councils->{2391};
- $all_councils = [ keys %$all_councils ];
return display_location($q, _('That spot does not appear to be covered by a council.
If you have tried to report an issue past the shoreline, for example,
-please specify the closest point on land.')) unless @$all_councils;
- my $areas_info = mySociety::MaPit::get_voting_areas_info($all_councils);
+please specify the closest point on land.')) unless %$all_councils;
# Look up categories for this council or councils
my $category = '';
my (%council_ok, @categories);
my $categories = select_all("select area_id, category from contacts
- where deleted='f' and area_id in (" . join(',', @$all_councils) . ')');
+ where deleted='f' and area_id in (" . join(',', keys %$all_councils) . ')');
if ($q->{site} ne 'emptyhomes') {
@$categories = sort { $a->{category} cmp $b->{category} } @$categories;
foreach (@$categories) {
@@ -574,7 +567,7 @@ please specify the closest point on land.')) unless @$all_councils;
# Work out what help text to show, depending on whether we have council details
my @councils = keys %council_ok;
my $details;
- if (@councils == @$all_councils) {
+ if (@councils == scalar keys %$all_councils) {
$details = 'all';
} elsif (@councils == 0) {
$details = 'none';
@@ -629,7 +622,7 @@ If this is not the correct location, simply click on the map again. '));
$vars{page_heading} = $q->h1(_('Reporting a problem'));
if ($details eq 'all') {
- my $council_list = join('</strong> or <strong>', map { $areas_info->{$_}->{name} } @$all_councils);
+ my $council_list = join('</strong> or <strong>', map { $_->{name} } values %$all_councils);
if ($q->{site} eq 'emptyhomes'){
$vars{text_help} = '<p>' . sprintf(_('All the information you provide here will be sent to <strong>%s</strong>.
On the site, we will show the subject and details of the problem, plus your
@@ -639,18 +632,18 @@ name if you give us permission.'), $council_list);
The subject and details of the problem will be public, plus your
name if you give us permission.'), $council_list);
}
- $vars{text_help} .= '<input type="hidden" name="council" value="' . join(',',@$all_councils) . '">';
+ $vars{text_help} .= '<input type="hidden" name="council" value="' . join(',', keys %$all_councils) . '">';
} elsif ($details eq 'some') {
my $e = Cobrand::contact_email($cobrand);
my %councils = map { $_ => 1 } @councils;
my @missing;
- foreach (@$all_councils) {
+ foreach (keys %$all_councils) {
push @missing, $_ unless $councils{$_};
}
my $n = @missing;
- my $list = join(' or ', map { $areas_info->{$_}->{name} } @missing);
+ my $list = join(' or ', map { $all_councils->{$_}->{name} } @missing);
$vars{text_help} = '<p>All the information you provide here will be sent to <strong>'
- . join('</strong> or <strong>', map { $areas_info->{$_}->{name} } @councils)
+ . join('</strong> or <strong>', map { $all_councils->{$_}->{name} } @councils)
. '</strong>. The subject and details of the problem will be public, plus your
name if you give us permission.';
$vars{text_help} .= ' We do <strong>not</strong> yet have details for the other council';
@@ -661,8 +654,8 @@ problems for $list and emailing it to us at <a href='mailto:$e'>$e</a>.";
. '|' . join(',', @missing) . '">';
} else {
my $e = Cobrand::contact_email($cobrand);
- my $list = join(' or ', map { $areas_info->{$_}->{name} } @$all_councils);
- my $n = @$all_councils;
+ my $list = join(' or ', map { $_->{name} } values %$all_councils);
+ my $n = scalar keys %$all_councils;
if ($q->{site} ne 'emptyhomes') {
$vars{text_help} = '<p>We do not yet have details for the council';
$vars{text_help} .= ($n>1) ? 's that cover' : ' that covers';
@@ -812,9 +805,7 @@ sub display_location {
return front_page($q, $error) if ($error);
my $parent_types = $mySociety::VotingArea::council_parent_types;
if ($easting && $northing) {
- my $all_councils = mySociety::MaPit::get_voting_areas_by_location(
- { easting => $easting, northing => $northing },
- 'polygon', $parent_types);
+ my $all_councils = mySociety::MaPit::call('point', "27700/$easting,$northing", type => $parent_types);
my ($success, $error_msg) = Cobrand::council_check($cobrand, $all_councils, $q, 'display_location');
if (!$success){
return front_page($q, $error_msg);
diff --git a/web/js.js b/web/js.js
index 223a8f2ee..4c98b82ba 100644
--- a/web/js.js
+++ b/web/js.js
@@ -31,14 +31,14 @@ YAHOO.util.Event.onContentReady('compass', function() {
if (document.getElementById('map').offsetWidth > 510) return;
var points = this.getElementsByTagName('a');
- YAHOO.util.Event.addListener(points[1], 'click', compass_pan, { x:0, y:tileheight });
- YAHOO.util.Event.addListener(points[3], 'click', compass_pan, { x:tilewidth, y:0 });
- YAHOO.util.Event.addListener(points[5], 'click', compass_pan, { x:-tilewidth, y:0 });
- YAHOO.util.Event.addListener(points[7], 'click', compass_pan, { x:0, y:-tileheight });
- YAHOO.util.Event.addListener(points[0], 'click', compass_pan, { x:tilewidth, y:tileheight });
- YAHOO.util.Event.addListener(points[2], 'click', compass_pan, { x:-tilewidth, y:tileheight });
- YAHOO.util.Event.addListener(points[6], 'click', compass_pan, { x:tilewidth, y:-tileheight });
- YAHOO.util.Event.addListener(points[8], 'click', compass_pan, { x:-tilewidth, y:-tileheight });
+ YAHOO.util.Event.addListener(points[1], 'click', compass_pan, { x:0, y:fixmystreet.tileheight });
+ YAHOO.util.Event.addListener(points[3], 'click', compass_pan, { x:fixmystreet.tilewidth, y:0 });
+ YAHOO.util.Event.addListener(points[5], 'click', compass_pan, { x:-fixmystreet.tilewidth, y:0 });
+ YAHOO.util.Event.addListener(points[7], 'click', compass_pan, { x:0, y:-fixmystreet.tileheight });
+ YAHOO.util.Event.addListener(points[0], 'click', compass_pan, { x:fixmystreet.tilewidth, y:fixmystreet.tileheight });
+ YAHOO.util.Event.addListener(points[2], 'click', compass_pan, { x:-fixmystreet.tilewidth, y:fixmystreet.tileheight });
+ YAHOO.util.Event.addListener(points[6], 'click', compass_pan, { x:fixmystreet.tilewidth, y:-fixmystreet.tileheight });
+ YAHOO.util.Event.addListener(points[8], 'click', compass_pan, { x:-fixmystreet.tilewidth, y:-fixmystreet.tileheight });
YAHOO.util.Event.addListener(points[4], 'click', compass_pan, { home:1, orig_x:drag_x, orig_y:drag_y });
});
@@ -47,7 +47,7 @@ YAHOO.util.Event.onContentReady('map', function() {
// if (document.getElementById('mapForm') && (/safari/.test(ua) || /Konqueror/.test(ua))) return;
if (document.getElementById('map').offsetWidth > 510) return;
new YAHOO.util.DDMap('map');
- update_tiles(start_x, start_y, true);
+ update_tiles(fixmystreet.start_x, fixmystreet.start_y, true);
});
@@ -57,8 +57,8 @@ YAHOO.util.Event.onContentReady('mapForm', function() {
this.onsubmit = function() { return false; };
}
- this.x.value = fms_x + 2;
- this.y.value = fms_y + 2;
+ this.x.value = fixmystreet.x + 2;
+ this.y.value = fixmystreet.y + 2;
/*
if (swfu && swfu.getStats().files_queued > 0) {
swfu.startUpload();
@@ -142,21 +142,21 @@ YAHOO.util.Event.addListener('all_pins_link', 'click', function(e) {
if (this.innerHTML == 'Include stale reports') {
this.innerHTML = 'Hide stale reports';
document.getElementById('all_pins').value = '1';
- load_pins(fms_x, fms_y);
+ load_pins(fixmystreet.x, fixmystreet.y);
} else if (this.innerHTML == 'Cynnwys hen adroddiadau') {
this.innerHTML = 'Cuddio hen adroddiadau';
document.getElementById('all_pins').value = '1';
welsh = 1;
- load_pins(fms_x, fms_y);
+ load_pins(fixmystreet.x, fixmystreet.y);
} else if (this.innerHTML == 'Cuddio hen adroddiadau') {
this.innerHTML = 'Cynnwys hen adroddiadau';
welsh = 1;
document.getElementById('all_pins').value = '';
- load_pins(fms_x, fms_y);
+ load_pins(fixmystreet.x, fixmystreet.y);
} else if (this.innerHTML == 'Hide stale reports') {
this.innerHTML = 'Include stale reports';
document.getElementById('all_pins').value = '';
- load_pins(fms_x, fms_y);
+ load_pins(fixmystreet.x, fixmystreet.y);
}
if (welsh) {
document.getElementById('hide_pins_link').innerHTML = 'Cuddio pinnau';
@@ -254,8 +254,6 @@ var swfu_settings = {
// I love the global
var tile_x = 0;
var tile_y = 0;
-var tilewidth = 254;
-var tileheight = 254;
var myAnim;
function pan(x, y) {
@@ -285,22 +283,22 @@ function update_tiles(dx, dy, force) {
drag.style.left = drag_x + 'px';
drag.style.top = drag_y + 'px';
- var horizontal = Math.floor(old_drag_x/tilewidth) - Math.floor(drag_x/tilewidth);
- var vertical = Math.floor(old_drag_y/tileheight) - Math.floor(drag_y/tileheight);
+ var horizontal = Math.floor(old_drag_x/fixmystreet.tilewidth) - Math.floor(drag_x/fixmystreet.tilewidth);
+ var vertical = Math.floor(old_drag_y/fixmystreet.tileheight) - Math.floor(drag_y/fixmystreet.tileheight);
if (!horizontal && !vertical && !force) return;
- fms_x += horizontal;
+ fixmystreet.x += horizontal;
tile_x += horizontal;
- fms_y -= vertical;
+ fixmystreet.y -= vertical;
tile_y += vertical;
- var url = [ root_path + '/tilma/tileserver/10k-full/', fms_x, '-', (fms_x+5), ',', fms_y, '-', (fms_y+5), '/JSON' ].join('');
+ var url = [ root_path + '/tilma/tileserver/' + fixmystreet.tile_type + '/', fixmystreet.x, '-', (fixmystreet.x+5), ',', fixmystreet.y, '-', (fixmystreet.y+5), '/JSON' ].join('');
YAHOO.util.Connect.asyncRequest('GET', url, {
success: urls_loaded, failure: urls_not_loaded,
argument: [tile_x, tile_y]
});
if (force) return;
- load_pins(fms_x, fms_y);
+ load_pins(fixmystreet.x, fixmystreet.y);
}
function load_pins(x, y) {
@@ -349,8 +347,8 @@ function urls_loaded(o) {
if (tiles[i][j] == null) continue;
var jj = (j + o.argument[0]);
var id = [ 't', ii, '.', jj ].join('');
- var xx = fms_x+j;
- var yy = fms_y+5-i;
+ var xx = fixmystreet.x+j;
+ var yy = fixmystreet.y+5-i;
var img = document.getElementById(id);
if (img) {
if (!img.galleryimg) { img.galleryimg = false; }
@@ -359,15 +357,15 @@ function urls_loaded(o) {
continue;
}
img = cloneNode();
- img.style.top = ((ii-2)*tileheight) + 'px';
- img.style.left = ((jj-2)*tilewidth) + 'px';
+ img.style.top = ((ii-2)*fixmystreet.tileheight) + 'px';
+ img.style.left = ((jj-2)*fixmystreet.tilewidth) + 'px';
img.name = [ 'tile_', xx, '.', yy ].join('')
img.id = id;
if (browser) {
img.style.visibility = 'hidden';
img.onload=function() { this.style.visibility = 'visible'; }
}
- img.src = 'http://tilma.mysociety.org/tileserver/10k-full/' + tiles[i][j];
+ img.src = 'http://tilma.mysociety.org/tileserver/' + fixmystreet.tile_type + '/' + tiles[i][j];
tileCache[id] = { x: xx, y: yy, t: img };
drag.appendChild(img);
}
@@ -387,8 +385,8 @@ function cloneNode() {
}
img.onclick = drag_check;
img.style.position = 'absolute';
- img.style.width = tilewidth + 'px';
- img.style.height = tileheight + 'px';
+ img.style.width = fixmystreet.tilewidth + 'px';
+ img.style.height = fixmystreet.tileheight + 'px';
img.galleryimg = false;
img.alt = 'Loading...';
} else {
@@ -400,7 +398,7 @@ function cloneNode() {
var tileCache=[];
function cleanCache() {
for (var i in tileCache) {
- if (tileCache[i].x < fms_x || tileCache[i].x > fms_x+5 || tileCache[i].y < fms_y || tileCache[i].y > fms_y+5) {
+ if (tileCache[i].x < fixmystreet.x || tileCache[i].x > fixmystreet.x+5 || tileCache[i].y < fixmystreet.y || tileCache[i].y > fixmystreet.y+5) {
var t = tileCache[i].t;
t.parentNode.removeChild(t); // de-leak?
delete tileCache[i];
diff --git a/web/questionnaire.cgi b/web/questionnaire.cgi
index f7b7df0e1..1da410b80 100755
--- a/web/questionnaire.cgi
+++ b/web/questionnaire.cgi
@@ -14,7 +14,6 @@ use Error qw(:try);
use CrossSell;
use mySociety::AuthToken;
use mySociety::Locale;
-use mySociety::MaPit;
use mySociety::Web qw(ent);
sub main {
diff --git a/web/reports.cgi b/web/reports.cgi
index 6c5796079..7246c9792 100755
--- a/web/reports.cgi
+++ b/web/reports.cgi
@@ -33,28 +33,27 @@ sub main {
my ($one_council, $area_type, $area_name);
if ($q_council =~ /^(\d\d)([a-z]{2})?([a-z]{2})?$/i) {
- my $va_info = mySociety::MaPit::get_voting_area_info(uc $q_council);
+ my $va_info = mySociety::MaPit::call('area', uc $q_council);
$area_name = Page::short_name($va_info->{name});
if (length($q_council) == 6) {
- $va_info = mySociety::MaPit::get_voting_area_info($va_info->{parent_area_id});
+ $va_info = mySociety::MaPit::call('area', $va_info->{parent_area});
$area_name = Page::short_name($va_info->{name}) . '/' . $area_name;
}
$rss = '/rss' if $rss;
print $q->redirect($base_url . $rss . '/reports/' . $area_name);
return;
} elsif ($q_council =~ /\D/) {
- (my $qc = $q_council) =~ s/ and / & /;
- my $areas = mySociety::MaPit::get_voting_area_by_name($qc, $mySociety::VotingArea::council_parent_types, 10);
+ my $areas = mySociety::MaPit::call('areas', $q_council, type => $mySociety::VotingArea::council_parent_types, min_generation=>10 );
if (keys %$areas == 1) {
($one_council) = keys %$areas;
$area_type = $areas->{$one_council}->{type};
$area_name = $areas->{$one_council}->{name};
} else {
foreach (keys %$areas) {
- if ($areas->{$_}->{name} =~ /^\Q$qc\E (Borough|City|District|County) Council$/) {
+ if ($areas->{$_}->{name} =~ /^\Q$q_council\E (Borough|City|District|County) Council$/) {
$one_council = $_;
$area_type = $areas->{$_}->{type};
- $area_name = $qc;
+ $area_name = $q_council;
}
}
}
@@ -63,7 +62,7 @@ sub main {
return;
}
} elsif ($q_council =~ /^\d+$/) {
- my $va_info = mySociety::MaPit::get_voting_area_info($q_council);
+ my $va_info = mySociety::MaPit::call('area', $q_council);
$area_name = $va_info->{name};
print $q->redirect($base_url . '/reports/' . Page::short_name($area_name));
return;
@@ -74,9 +73,9 @@ sub main {
my $q_ward = $q->param('ward') || '';
my $ward;
if ($one_council && $q_ward) {
- my $qw = mySociety::MaPit::get_voting_area_by_name($q_ward, $mySociety::VotingArea::council_child_types, 10);
+ my $qw = mySociety::MaPit::call('areas', $q_ward, type => $mySociety::VotingArea::council_child_types, min_generation => 10);
foreach my $id (sort keys %$qw) {
- if ($qw->{$id}->{parent_area_id} == $one_council) {
+ if ($qw->{$id}->{parent_area} == $one_council) {
$ward = $id;
last;
}
@@ -116,21 +115,21 @@ sub main {
return;
}
- my %councils;
+ my $areas_info;
if ($one_council) {
- %councils = ( $one_council => 1 );
+ $areas_info = mySociety::MaPit::call('areas', $one_council);
} else {
# Show all councils on main report page
my $ignore = 'LGD';
$ignore .= '|CTY' if $q->{site} eq 'emptyhomes';
my @types = grep { !/$ignore/ } @$mySociety::VotingArea::council_parent_types;
- %councils = map { $_ => 1 } @{mySociety::MaPit::get_areas_by_type(\@types, 10)};
+ $areas_info = mySociety::MaPit::call('areas', [ @types ], min_generation=>10 );
}
my $problems = Problems::council_problems($ward, $one_council);
my (%fixed, %open);
- my $re_councils = join('|', keys %councils);
+ my $re_councils = join('|', keys %$areas_info);
foreach my $row (@$problems) {
if (!$row->{council}) {
# Problem was not sent to any council, add to possible councils
@@ -148,7 +147,6 @@ sub main {
}
}
- my $areas_info = mySociety::MaPit::get_voting_areas_info([keys %councils]);
if (!$one_council) {
print Page::header($q, title=>_('Summary reports'), expires=>'+1h');
print $q->p(
@@ -162,7 +160,7 @@ sub main {
print '<th>' . _('Old problems,<br>state unknown') . '</th>';
}
print '<th>' . _('Recently fixed') . '</th><th>' . _('Older fixed') . '</th></tr>';
- foreach (sort { $areas_info->{$a}->{name} cmp $areas_info->{$b}->{name} } keys %councils) {
+ foreach (sort { $areas_info->{$a}->{name} cmp $areas_info->{$b}->{name} } keys %$areas_info) {
print '<tr align="center"';
++$c;
if ($areas_info->{$_}->{generation_high}==10) {
diff --git a/web/rss.cgi b/web/rss.cgi
index a2810aee8..7060d1709 100755
--- a/web/rss.cgi
+++ b/web/rss.cgi
@@ -43,7 +43,7 @@ sub main {
$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 $va_info = mySociety::MaPit::call('area', $id);
my $qs = '/'.$id;
$out = mySociety::Alert::generate_rss($type, $xsl, $qs, [$id], { NAME => $va_info->{name} }, $cobrand, $q);
} elsif ($type eq 'all_problems') {