diff options
-rw-r--r-- | db/alert_types.sql | 2 | ||||
-rw-r--r-- | templates/emails/alert-problem-nearby | 11 | ||||
-rwxr-xr-x | web/alert.cgi | 26 | ||||
-rw-r--r-- | web/css.css | 4 |
4 files changed, 30 insertions, 13 deletions
diff --git a/db/alert_types.sql b/db/alert_types.sql index 7eac87ad0..fc7300032 100644 --- a/db/alert_types.sql +++ b/db/alert_types.sql @@ -29,7 +29,7 @@ insert into alert_type values ('local_problems', '', '', 'New local problems on FixMyStreet', '/', 'The latest local problems reported by users', 'problem_find_nearby(?, ?, ?) as nearby,problem', 'nearby.problem_id = problem.id and problem.state in (\'confirmed\', \'fixed\')', 'created desc', - '{{title}}, {{confirmed}}', '/?id={{id}}', '{{detail}}', 'alert-problem'); + '{{title}}, {{confirmed}}', '/?id={{id}}', '{{detail}}', 'alert-problem-nearby'); -- New problems sent to a particular council insert into alert_type diff --git a/templates/emails/alert-problem-nearby b/templates/emails/alert-problem-nearby new file mode 100644 index 000000000..85136a034 --- /dev/null +++ b/templates/emails/alert-problem-nearby @@ -0,0 +1,11 @@ +Subject: New nearby problems on FixMyStreet + +The following nearby problems have been added: + +<?=$values['data']?> + +-- +The FixMyStreet team + +To stop receiving emails when there are nearby problems, +please follow this link: <?=$values['unsubscribe_url']?> diff --git a/web/alert.cgi b/web/alert.cgi index c2f920cd4..086d6c32c 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.14 2007-09-03 21:03:31 matthew Exp $ +# $Id: alert.cgi,v 1.15 2007-09-14 13:57:51 matthew Exp $ use strict; use Standard; @@ -146,15 +146,20 @@ sub alert_list { <<EOF; <h1>Local RSS feeds and email alerts for ‘$input_h{pc}’</h1> +<form id="alerts" method="post" action="/alert"> +<input type="hidden" name="type" value="local"> +<input type="hidden" name="pc" value="$input_h{pc}"> + <p>We have a variety of RSS feeds for local problems. The easiest is our simple geographic one:</p> -<p id="rss_local"><a href="/rss/$x,$y"><img -src="/i/feed.png" width="16" height="16" title="RSS feed of recent local problems" alt="RSS feed" border="0"></a> -<a href="/rss/$x,$y">Problems within ${dist}km of this location</a> (a default +<p id="rss_local"> +<input type="radio" name="feed" id="local:$x:$y" value="local:$x:$y"> +<label for="local:$x:$y">Problems within ${dist}km of this location</label> (a default distance which covers roughly 200,000 people) +<a href="/rss/$x,$y"><img src="/i/feed.png" width="16" height="16" title="RSS feed of nearby problems" alt="RSS feed" border="0"></a> </p> <p id="rss_local_alt"> -(alternatively within <a href="/rss/$x,$y/2">2km</a> / <a href="/rss/$x,$y/5">5km</a> +(alternatively the RSS feed can be customised, within <a href="/rss/$x,$y/2">2km</a> / <a href="/rss/$x,$y/5">5km</a> / <a href="/rss/$x,$y/10">10km</a> / <a href="/rss/$x,$y/20">20km</a>) </ul> @@ -163,10 +168,6 @@ select which feed you’d like and click the button. If you’d prefer, these feeds are also available as email alerts – just enter your email address below.</p> -<form id="alerts" method="post" action="/alert"> -<input type="hidden" name="type" value="local"> -<input type="hidden" name="pc" value="$input_h{pc}"> - $options $errors @@ -197,7 +198,7 @@ sub alert_list_options { . '</label> <a href="/rss/'; $out .= $type eq 'area' ? 'area' : 'reports'; $out .= '/' . $rss . '"><img src="/i/feed.png" width="16" height="16" -title="RSS feed of recent local problems" alt="RSS feed" border="0"></a>'; +title="RSS feed of local problems at ' . $text . '" alt="RSS feed" border="0"></a>'; } return $out; } @@ -233,6 +234,9 @@ sub alert_rss { (my $id = $1) =~ tr{:_}{/+}; print $q->redirect('/rss/reports/' . $id); return; + } elsif ($feed =~ /^local:(\d+):(\d+)$/) { + print $q->redirect('/rss/' . $1 . ',' . $2); + return; } else { return alert_list($q, 'Illegal feed selection'); } @@ -326,6 +330,8 @@ sub alert_do_subscribe { $alert_id = mySociety::Alert::create($email, 'council_problems', $1, $1); } elsif ($feed =~ /^ward:(\d+):(\d+)/) { $alert_id = mySociety::Alert::create($email, 'ward_problems', $1, $2); + } elsif ($feed =~ /^local:(\d+):(\d+)/) { + $alert_id = mySociety::Alert::create($email, 'local_problems', $1, $2); } } else { throw mySociety::Alert::Error('Invalid type'); diff --git a/web/css.css b/web/css.css index 8b18807a3..52acd8f6d 100644 --- a/web/css.css +++ b/web/css.css @@ -436,11 +436,11 @@ ol#current img { margin-bottom: 2em; } #rss_local { - margin-left: 3em; + margin-left: 1.5em; margin-bottom: 0; } #rss_local_alt { - margin: 0 0 2em 6em; + margin: 0 0 2em 4em; } /* Report page */ |