diff options
author | Duncan Parkes <duncan@fury.ukcod.org.uk> | 2011-02-18 19:08:22 +0000 |
---|---|---|
committer | Duncan Parkes <duncan@fury.ukcod.org.uk> | 2011-02-18 19:08:22 +0000 |
commit | 835dce8861e9a6c9dcbbf21bf2f29aa16d9fcdb4 (patch) | |
tree | 488145aa486a326599155e3281efd9ad4a791d92 | |
parent | 9cd9904b058abdb6a17e919594439a8cc7a509a7 (diff) |
Add postcode to the title of the feed.
At the moment, it's in whatever format it arrives, and lower case.
-rw-r--r-- | db/alert_types.sql | 22 | ||||
-rw-r--r-- | db/alert_types_eha.sql | 11 | ||||
-rwxr-xr-x | web/rss.cgi | 24 |
3 files changed, 54 insertions, 3 deletions
diff --git a/db/alert_types.sql b/db/alert_types.sql index 82a8c71f8..fb1aac1d0 100644 --- a/db/alert_types.sql +++ b/db/alert_types.sql @@ -53,6 +53,28 @@ values ('local_problems_state', '', '', '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 around a postcode +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 ('postcode_local_problems', '', '', + 'New problems near {{POSTCODE}} 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}}', '/report/{{id}}', '{{detail}}', 'alert-problem-nearby'); + +-- New problems around a postcode with a particular state +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 ('postcode_local_problems_state', '', '', + 'New problems NEAR {{POSTCODE}} 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/db/alert_types_eha.sql b/db/alert_types_eha.sql index c949ea2f8..17f44fcd9 100644 --- a/db/alert_types_eha.sql +++ b/db/alert_types_eha.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 postcode +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 ('postcode_local_problems', '', '', + 'New reports on reportemptyhomes.com near {{POSTCODE}}', '/', 'The latest local reports reported by users', + '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 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 cf6554928..365b9468d 100755 --- a/web/rss.cgi +++ b/web/rss.cgi @@ -84,6 +84,7 @@ sub rss_local_problems { my $qs; my %title_params; + my $alert_type; my $cobrand = Page::get_cobrand($q); my $base = Cobrand::base_url($cobrand); @@ -137,10 +138,27 @@ sub rss_local_problems { } my $xsl = Cobrand::feed_xsl($cobrand); - if ($state eq 'all') { - return FixMyStreet::Alert::generate_rss('local_problems', $xsl, $qs, [$lat, $lon, $d], $title_params, $cobrand, $q); + + + if ($pc) { + $alert_type = 'postcode_local_problems'; } else { - return FixMyStreet::Alert::generate_rss('local_problems_state', $xsl, $qs, [$lat, $lon, $d, $state], $title_params, $cobrand, $q); + $alert_type = 'local_problems'; } + + my @db_params = ($lat, $lon, $d); + + if ($state ne 'all') { + $alert_type .= '_state'; + push @db_params, $state; + } + + return FixMyStreet::Alert::generate_rss($alert_type, $xsl, $qs, \@db_params, \%title_params, $cobrand, $q); + +# if ($state eq 'all') { +# return FixMyStreet::Alert::generate_rss('local_problems', $xsl, $qs, [$lat, $lon, $d], \%title_params, $cobrand, $q); +# } else { +# return FixMyStreet::Alert::generate_rss('local_problems_state', $xsl, $qs, [$lat, $lon, $d, $state], \%title_params, $cobrand, $q); +# } } |