aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--perllib/FixMyStreet/App/Controller/Open311.pm13
-rwxr-xr-xperllib/FixMyStreet/App/Controller/Rss.pm7
2 files changed, 14 insertions, 6 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Open311.pm b/perllib/FixMyStreet/App/Controller/Open311.pm
index f3f38bcf6..99d7bddee 100644
--- a/perllib/FixMyStreet/App/Controller/Open311.pm
+++ b/perllib/FixMyStreet/App/Controller/Open311.pm
@@ -60,7 +60,7 @@ sub old_uri : Regex('^open311\.cgi') : Args(0) {
=head2 discovery
-http://search.cpan.org/~bobtfish/Catalyst-Manual-5.8007/lib/Catalyst/Manual/Intro.pod#Action_types
+http://search.cpan.org/~bobtfish/Catalyst-Manual-5.8007/lib/Catalyst/Manual/Intro.pod
=cut
@@ -362,7 +362,7 @@ sub get_requests : Private {
$criteria->{$key} = { $op, $value };
}
-# if ('rss' eq $c->stash->{format}) {
+ if ('rss' eq $c->stash->{format}) {
# FIXME write new implementatin
# my $cobrand = Page::get_cobrand($c);
# my $alert_type = 'open311_requests_rss';
@@ -376,9 +376,14 @@ sub get_requests : Private {
# $c, $criteria, $max_requests);
# print $c->header( -type => 'application/xml; charset=utf-8' );
# print $out;
-# } else {
+ $c->stash->{type} = 'new_problems';
+ $c->stash->{search_criteria} = $criteria;
+ $c->stash->{max_requests} = $max_requests;
+ # Call Controller::Rss::output
+ $c->forward( '/rss/output' );
+ } else {
$c->forward( 'output_requests', [ $criteria, $max_requests ] );
-# }
+ }
}
# Example
diff --git a/perllib/FixMyStreet/App/Controller/Rss.pm b/perllib/FixMyStreet/App/Controller/Rss.pm
index 78793d9c1..4a5b320ed 100755
--- a/perllib/FixMyStreet/App/Controller/Rss.pm
+++ b/perllib/FixMyStreet/App/Controller/Rss.pm
@@ -191,13 +191,16 @@ sub query_main : Private {
my ( $site_restriction, $site_id ) = $c->cobrand->site_restriction( $c->cobrand->extra_data );
# Only apply a site restriction if the alert uses the problem table
$site_restriction = '' unless $alert_type->item_table eq 'problem';
+ my $search_criteria = $c->stash->{search_criteria};
# FIXME Do this in a nicer way at some point in the future...
my $query = 'select * from ' . $alert_type->item_table . ' where '
. ($alert_type->head_table ? $alert_type->head_table . '_id=? and ' : '')
- . $alert_type->item_where . $site_restriction . ' order by '
- . $alert_type->item_order;
+ . $alert_type->item_where . $site_restriction .
+ . ($search_criteria ? "and $search_criteria" : '')
+ . ' order by ' . $alert_type->item_order;
my $rss_limit = mySociety::Config::get('RSS_LIMIT');
+ $rss_limit = $c->stash->{max_requests} if $c->stash->{max_requests};
$query .= " limit $rss_limit" unless $c->stash->{type} =~ /^all/;
my $q = $c->model('DB::Alert')->result_source->storage->dbh->prepare($query);