diff options
-rw-r--r-- | web/css.css | 4 | ||||
-rw-r--r-- | web/i/pinB.gif (renamed from web/i/pin3blue.gif) | bin | 1089 -> 1089 bytes | |||
-rw-r--r-- | web/i/pinG.gif (renamed from web/i/pin3green.gif) | bin | 1105 -> 1105 bytes | |||
-rw-r--r-- | web/i/pinG1.gif | bin | 0 -> 1180 bytes | |||
-rw-r--r-- | web/i/pinG2.gif | bin | 0 -> 1198 bytes | |||
-rw-r--r-- | web/i/pinG3.gif | bin | 0 -> 1205 bytes | |||
-rw-r--r-- | web/i/pinG4.gif | bin | 0 -> 1202 bytes | |||
-rw-r--r-- | web/i/pinG5.gif | bin | 0 -> 1205 bytes | |||
-rw-r--r-- | web/i/pinG6.gif | bin | 0 -> 1210 bytes | |||
-rw-r--r-- | web/i/pinG7.gif | bin | 0 -> 1192 bytes | |||
-rw-r--r-- | web/i/pinG8.gif | bin | 0 -> 1223 bytes | |||
-rw-r--r-- | web/i/pinG9.gif | bin | 0 -> 1223 bytes | |||
-rw-r--r-- | web/i/pinP.gif (renamed from web/i/pin3purple.gif) | bin | 1090 -> 1090 bytes | |||
-rw-r--r-- | web/i/pinR.gif (renamed from web/i/pin3red.gif) | bin | 1088 -> 1088 bytes | |||
-rw-r--r-- | web/i/pinR1.gif | bin | 0 -> 1180 bytes | |||
-rw-r--r-- | web/i/pinR2.gif | bin | 0 -> 1198 bytes | |||
-rw-r--r-- | web/i/pinR3.gif | bin | 0 -> 1205 bytes | |||
-rw-r--r-- | web/i/pinR4.gif | bin | 0 -> 1202 bytes | |||
-rw-r--r-- | web/i/pinR5.gif | bin | 0 -> 1205 bytes | |||
-rw-r--r-- | web/i/pinR6.gif | bin | 0 -> 1210 bytes | |||
-rw-r--r-- | web/i/pinR7.gif | bin | 0 -> 1192 bytes | |||
-rw-r--r-- | web/i/pinR8.gif | bin | 0 -> 1223 bytes | |||
-rw-r--r-- | web/i/pinR9.gif | bin | 0 -> 1223 bytes | |||
-rwxr-xr-x | web/index.cgi | 71 |
24 files changed, 49 insertions, 26 deletions
diff --git a/web/css.css b/web/css.css index f525ba291..eb11b6f32 100644 --- a/web/css.css +++ b/web/css.css @@ -230,10 +230,12 @@ fieldset div.checkbox label { border: 0; } -ul#current img { +/* +ol#current img { position: absolute; border: none; } +*/ #expl { text-align: center; diff --git a/web/i/pin3blue.gif b/web/i/pinB.gif Binary files differindex 2501bc63b..2501bc63b 100644 --- a/web/i/pin3blue.gif +++ b/web/i/pinB.gif diff --git a/web/i/pin3green.gif b/web/i/pinG.gif Binary files differindex 6ba710878..6ba710878 100644 --- a/web/i/pin3green.gif +++ b/web/i/pinG.gif diff --git a/web/i/pinG1.gif b/web/i/pinG1.gif Binary files differnew file mode 100644 index 000000000..58f136791 --- /dev/null +++ b/web/i/pinG1.gif diff --git a/web/i/pinG2.gif b/web/i/pinG2.gif Binary files differnew file mode 100644 index 000000000..bcd7beddf --- /dev/null +++ b/web/i/pinG2.gif diff --git a/web/i/pinG3.gif b/web/i/pinG3.gif Binary files differnew file mode 100644 index 000000000..140ad9a7d --- /dev/null +++ b/web/i/pinG3.gif diff --git a/web/i/pinG4.gif b/web/i/pinG4.gif Binary files differnew file mode 100644 index 000000000..3da172f24 --- /dev/null +++ b/web/i/pinG4.gif diff --git a/web/i/pinG5.gif b/web/i/pinG5.gif Binary files differnew file mode 100644 index 000000000..22fb7b919 --- /dev/null +++ b/web/i/pinG5.gif diff --git a/web/i/pinG6.gif b/web/i/pinG6.gif Binary files differnew file mode 100644 index 000000000..d06d37f7a --- /dev/null +++ b/web/i/pinG6.gif diff --git a/web/i/pinG7.gif b/web/i/pinG7.gif Binary files differnew file mode 100644 index 000000000..a9c194a85 --- /dev/null +++ b/web/i/pinG7.gif diff --git a/web/i/pinG8.gif b/web/i/pinG8.gif Binary files differnew file mode 100644 index 000000000..68978cb2d --- /dev/null +++ b/web/i/pinG8.gif diff --git a/web/i/pinG9.gif b/web/i/pinG9.gif Binary files differnew file mode 100644 index 000000000..2ed1adffe --- /dev/null +++ b/web/i/pinG9.gif diff --git a/web/i/pin3purple.gif b/web/i/pinP.gif Binary files differindex 70ee2a6cb..70ee2a6cb 100644 --- a/web/i/pin3purple.gif +++ b/web/i/pinP.gif diff --git a/web/i/pin3red.gif b/web/i/pinR.gif Binary files differindex 612c6f72e..612c6f72e 100644 --- a/web/i/pin3red.gif +++ b/web/i/pinR.gif diff --git a/web/i/pinR1.gif b/web/i/pinR1.gif Binary files differnew file mode 100644 index 000000000..ecba968c2 --- /dev/null +++ b/web/i/pinR1.gif diff --git a/web/i/pinR2.gif b/web/i/pinR2.gif Binary files differnew file mode 100644 index 000000000..fa1b11cbf --- /dev/null +++ b/web/i/pinR2.gif diff --git a/web/i/pinR3.gif b/web/i/pinR3.gif Binary files differnew file mode 100644 index 000000000..31c27dc02 --- /dev/null +++ b/web/i/pinR3.gif diff --git a/web/i/pinR4.gif b/web/i/pinR4.gif Binary files differnew file mode 100644 index 000000000..183135eb4 --- /dev/null +++ b/web/i/pinR4.gif diff --git a/web/i/pinR5.gif b/web/i/pinR5.gif Binary files differnew file mode 100644 index 000000000..d16c826c5 --- /dev/null +++ b/web/i/pinR5.gif diff --git a/web/i/pinR6.gif b/web/i/pinR6.gif Binary files differnew file mode 100644 index 000000000..ea6092e98 --- /dev/null +++ b/web/i/pinR6.gif diff --git a/web/i/pinR7.gif b/web/i/pinR7.gif Binary files differnew file mode 100644 index 000000000..e9f1fddeb --- /dev/null +++ b/web/i/pinR7.gif diff --git a/web/i/pinR8.gif b/web/i/pinR8.gif Binary files differnew file mode 100644 index 000000000..b792510ee --- /dev/null +++ b/web/i/pinR8.gif diff --git a/web/i/pinR9.gif b/web/i/pinR9.gif Binary files differnew file mode 100644 index 000000000..b651cc0be --- /dev/null +++ b/web/i/pinR9.gif diff --git a/web/index.cgi b/web/index.cgi index 488adbe34..ffa879453 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.49 2006-10-18 19:18:31 matthew Exp $ +# $Id: index.cgi,v 1.50 2006-10-19 15:01:30 matthew Exp $ # TODO # Nothing is done about the update checkboxes - not stored anywhere on anything! @@ -398,7 +398,7 @@ EOF $out .= <<EOF; <div> <h2>Recent problems reported on this map</h2> -<ul id="current"> +<ol id="current"> EOF foreach (@$current_map) { $out .= '<li><a href="' . NewURL($q, id=>$_->{id}, x=>undef, y=>undef) . '">'; @@ -408,10 +408,11 @@ EOF unless (@$current_map) { $out .= '<li>No problems have been reported yet.</li>'; } + my $list_start = @$current_map + 1; $out .= <<EOF; - </ul> + </ol> <h2>Recent problems reported within 10km</h2> - <ul id="current"> + <ol id="current" start="$list_start"> EOF foreach (@$current) { $out .= '<li><a href="' . NewURL($q, id=>$_->{id}, x=>undef, y=>undef) . '">'; @@ -422,10 +423,10 @@ EOF $out .= '<li>No problems have been reported yet.</li>'; } $out .= <<EOF; - </ul> + </ol> <h2>Recent updates to problems?</h2> <h2>Recently fixed problems</h2> - <ul> + <ol> EOF foreach (@$fixed) { $out .= '<li><a href="' . NewURL($q, id=>$_->{id}, x=>undef, y=>undef) . '">'; @@ -435,7 +436,7 @@ EOF unless (@$fixed) { $out .= '<li>No problems have been fixed yet</li>'; } - $out .= '</ul></div>'; + $out .= '</ol></div>'; $out .= display_map_end(1); return $out; } @@ -552,41 +553,61 @@ sub map_pins { my $current_map = select_all( "select id,title,easting,northing from problem where state='confirmed' and easting>=? and easting<? and northing>=? and northing<? - order by created desc limit 5", $min_e, $max_e, $min_n, $max_n); + order by created desc limit 9", $min_e, $max_e, $min_n, $max_n); my @ids = (); + my $count_prob = 1; + my $count_fixed = 1; foreach (@$current_map) { push(@ids, $_->{id}); my $px = os_to_px($_->{easting}, $x); my $py = os_to_px($_->{northing}, $y); - $pins .= display_pin($q, $px, $py, $_->{id}==$id ? 'blue' : 'red'); + if ($_->{id}==$id) { + $pins .= display_pin($q, $px, $py, 'blue'); + } else { + $pins .= display_pin($q, $px, $py, 'red', $count_prob++); + } } - my $current = select_all( - "select id, title, easting, northing, distance - from problem_find_nearby(?, ?, 10) as nearby, problem - where nearby.problem_id = problem.id - and state = 'confirmed'" . (@ids ? ' and id not in (' . join(',' , @ids) . ')' : '') . " - order by created desc limit 5", $mid_e, $mid_n); - foreach (@$current) { - my $px = os_to_px($_->{easting}, $x); - my $py = os_to_px($_->{northing}, $y); - $pins .= display_pin($q, $px, $py, $_->{id}==$id ? 'blue' : 'red'); + my $current = []; + if (@$current_map < 9) { + my $limit = 9 - @$current_map; + $current = select_all( + "select id, title, easting, northing, distance + from problem_find_nearby(?, ?, 10) as nearby, problem + where nearby.problem_id = problem.id + and state = 'confirmed'" . (@ids ? ' and id not in (' . join(',' , @ids) . ')' : '') . " + order by distance limit $limit", $mid_e, $mid_n); + foreach (@$current) { + my $px = os_to_px($_->{easting}, $x); + my $py = os_to_px($_->{northing}, $y); + if ($_->{id}==$id) { + $pins .= display_pin($q, $px, $py, 'blue'); + } else { + $pins .= display_pin($q, $px, $py, 'red', $count_prob++); + } + } } my $fixed = select_all( "select id, title, easting, northing from problem where state='fixed' - order by created desc limit 5"); + order by created desc limit 9"); foreach (@$fixed) { my $px = os_to_px($_->{easting}, $x); my $py = os_to_px($_->{northing}, $y); - $pins .= display_pin($q, $px, $py, $_->{id}==$id ? 'blue' : 'green'); + if ($_->{id}==$id) { + $pins .= display_pin($q, $px, $py, 'blue'); + } else { + $pins .= display_pin($q, $px, $py, 'green', $count_fixed++); + } } return ($pins, $current_map, $current, $fixed); } sub display_pin { - my ($q, $px, $py, $col) = @_; - # return '' if ($px<0 || $px>508 || $py<0 || $py>508); - my $out = '<img class="pin" src="/i/pin3' . $col . '.gif" alt="Problem" style="top:' - . ($py-59) . 'px; right:' . ($px-31) . 'px; position: absolute;">'; + my ($q, $px, $py, $col, $num) = @_; + $num = '' unless $num; + my %cols = (red=>'R', green=>'G', blue=>'B', purple=>'P'); + my $out = '<img class="pin" src="/i/pin' . $cols{$col} + . $num . '.gif" alt="Problem" style="top:' . ($py-59) + . 'px; right:' . ($px-31) . 'px; position: absolute;">'; return $out unless $_->{id} && $col ne 'blue'; my $url = NewURL($q, id=>$_->{id}, x=>undef, y=>undef); $out = '<a title="' . $_->{title} . '" href="' . $url . '">' . $out . '</a>'; |