diff options
-rw-r--r-- | db/alert_types.sql | 11 | ||||
-rwxr-xr-x | web/rss.cgi | 9 |
2 files changed, 19 insertions, 1 deletions
diff --git a/db/alert_types.sql b/db/alert_types.sql index d605d8e65..82a8c71f8 100644 --- a/db/alert_types.sql +++ b/db/alert_types.sql @@ -42,6 +42,17 @@ values ('local_problems', '', '', 'problem_find_nearby(?, ?, ?) as nearby,problem', 'nearby.problem_id = problem.id and problem.state in (''confirmed'', ''fixed'')', 'created desc', '{{title}}, {{confirmed}}', '/report/{{id}}', '{{detail}}', 'alert-problem-nearby'); +-- New problems around a location +insert into alert_type +(ref, head_sql_query, head_table, + head_title, head_link, head_description, + item_table, item_where, item_order, + item_title, item_link, item_description, template) +values ('local_problems_state', '', '', + '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 (?)', 'created desc', + '{{title}}, {{confirmed}}', '/report/{{id}}', '{{detail}}', 'alert-problem-nearby'); + -- New problems sent to a particular council insert into alert_type (ref, head_sql_query, head_table, diff --git a/web/rss.cgi b/web/rss.cgi index abbcf1955..6b43aeacb 100755 --- a/web/rss.cgi +++ b/web/rss.cgi @@ -72,6 +72,9 @@ sub rss_local_problems { $d = '' unless $d =~ /^\d+$/; my $d_str = ''; $d_str = "/$d" if $d; + my $state = $q->param('state') || 'all'; + $state = 'all' unless $state =~ /^(all|open|fixed)$/; + $state = 'confirmed' if $state eq 'open'; my $cobrand = Page::get_cobrand($q); my $base = Cobrand::base_url($cobrand); @@ -113,6 +116,10 @@ sub rss_local_problems { } my $xsl = Cobrand::feed_xsl($cobrand); - return FixMyStreet::Alert::generate_rss('local_problems', $xsl, $qs, [$e, $n, $d], undef, $cobrand, $q); + if ($state eq 'all') { + return FixMyStreet::Alert::generate_rss('local_problems', $xsl, $qs, [$e, $n, $d], undef, $cobrand, $q); + } else { + return FixMyStreet::Alert::generate_rss('local_problems_state', $xsl, $qs, [$e, $n, $d, $state], undef, $cobrand, $q); + } } |