From 6e8ebffd217d62d77d8c72f7bea4105acd0bf9c8 Mon Sep 17 00:00:00 2001 From: miker Date: Fri, 23 Jun 2006 02:45:43 +0000 Subject: [PATCH] improving the freshmeat feed git-svn-id: svn://svn.open-ils.org/ILS/trunk@4726 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/src/perlmods/OpenILS/Application/SuperCat.pm | 9 ++------- Open-ILS/src/perlmods/OpenILS/WWW/SuperCat.pm | 13 +++++++++---- Open-ILS/src/perlmods/OpenILS/WWW/SuperCat/Feed.pm | 3 +++ 3 files changed, 14 insertions(+), 11 deletions(-) diff --git a/Open-ILS/src/perlmods/OpenILS/Application/SuperCat.pm b/Open-ILS/src/perlmods/OpenILS/Application/SuperCat.pm index c2f686dea7..130c2734bf 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/SuperCat.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/SuperCat.pm @@ -512,14 +512,9 @@ sub escape { sub recent_changes { my $self = shift; my $client = shift; - my $when = shift; + my $when = shift || '1-01-01'; my $limit = shift; - if (!$when) { - my ($d,$m,$y) = (localtime)[4,5,6]; - $when = sprintf('%4d-%02d-%02d', $y + 1900, $m + 1, $d); - } - my $type = 'biblio'; $type = 'authority' if ($self->api_name =~ /authority/o); @@ -531,7 +526,7 @@ sub recent_changes { return $_storage ->request( "open-ils.cstore.direct.$type.record_entry.id_list.atomic", - { $axis => { ">" => $when } }, + { $axis => { ">" => $when }, id => { '>' => 0 } }, { order_by => "$axis desc", limit => $limit } ) ->gather(1); } diff --git a/Open-ILS/src/perlmods/OpenILS/WWW/SuperCat.pm b/Open-ILS/src/perlmods/OpenILS/WWW/SuperCat.pm index 4db2a48738..993783a25c 100644 --- a/Open-ILS/src/perlmods/OpenILS/WWW/SuperCat.pm +++ b/Open-ILS/src/perlmods/OpenILS/WWW/SuperCat.pm @@ -449,8 +449,7 @@ sub changes_feed { $path =~ s/^\///og; - my ($type,$rtype,$axis,$date,$limit) = split '/', $path; - $date ||= 'today'; + my ($type,$rtype,$axis,$limit,$date) = split '/', $path; $limit ||= 10; my $list = $supercat->request("open-ils.supercat.$rtype.record.$axis.recent", $date, $limit)->gather(1); @@ -465,7 +464,12 @@ sub changes_feed { my $feed = create_record_feed( $type, $list, $unapi); $feed->root($root); - $feed->title("$limit most recent $rtype changes from $date forward"); + if ($date) { + $feed->title("Up to $limit recent $rtype ${axis}s from $date forward"); + } else { + $feed->title("$limit most recent $rtype ${axis}s"); + } + $feed->creator($host); $feed->update_ts(gmtime_ISO8601()); @@ -820,13 +824,14 @@ sub create_record_feed { my $item_tag = "tag:$host,$year:biblio-record_entry/$rec/$lib"; - my $xml = $supercat->request( "open-ils.supercat.record.$type.retrieve", $rec )->gather(1); + next unless $xml; my $node = $feed->add_item($xml); + next unless $node; if ($lib && $type eq 'marcxml') { $xml = $supercat->request( "open-ils.supercat.record.holdings_xml.retrieve", $rec, $lib )->gather(1); diff --git a/Open-ILS/src/perlmods/OpenILS/WWW/SuperCat/Feed.pm b/Open-ILS/src/perlmods/OpenILS/WWW/SuperCat/Feed.pm index ff206d8125..1aa1f88d8a 100644 --- a/Open-ILS/src/perlmods/OpenILS/WWW/SuperCat/Feed.pm +++ b/Open-ILS/src/perlmods/OpenILS/WWW/SuperCat/Feed.pm @@ -20,6 +20,7 @@ sub new { sub build { my $class = shift; my $xml = shift; + return undef unless $xml; $parser = new XML::LibXML if (!$parser); @@ -135,6 +136,7 @@ sub add_item { my $item_xml = shift; my $entry = $class->new($item_xml); + return undef unless $entry; $entry->base($self->base); $entry->unapi($self->unapi); @@ -441,6 +443,7 @@ sub new { my $class = shift; my $xml = shift; my $self = $class->SUPER::build($xml); + return undef unless $self; $self->{doc}->documentElement->setNamespace('http://www.loc.gov/MARC21/slim', 'marc'); $self->{type} = 'application/xml'; $self->{holdings_xpath} = '/marc:record'; -- 2.11.0