rfe #618: Syndicated Content Asset: Make images in the downloaded RSS-feeds available in the template.

This commit is contained in:
Paul Driver 2011-03-30 09:52:55 -05:00
parent af15289cc0
commit c8098e2ca6
7 changed files with 32 additions and 3 deletions

View file

@ -21,7 +21,7 @@ use Class::C3;
use base qw(WebGUI::AssetAspect::RssFeed WebGUI::Asset::Wobject);
use WebGUI::Macro;
use XML::FeedPP;
use XML::FeedPP::MediaRSS;
=head1 NAME
@ -279,6 +279,7 @@ A reference to an XML::FeedPP object.
sub getTemplateVariables {
my ($self, $feed) = @_;
my $media = XML::FeedPP::MediaRSS->new($feed);
my @items = $feed->get_item;
my %var;
$var{channel_title} = WebGUI::HTML::filter(scalar $feed->title, 'javascript');
@ -295,6 +296,7 @@ sub getTemplateVariables {
$var{channel_image_height} = WebGUI::HTML::filter($image[5], 'javascript');
foreach my $object (@items) {
my %item;
$item{media} = [ $media->for_item($object) ];
$item{title} = WebGUI::HTML::filter(scalar $object->title, 'javascript');
$item{date} = WebGUI::HTML::filter(scalar $object->get_pubDate_epoch, 'javascript');
$item{category} = WebGUI::HTML::filter(scalar $object->category, 'javascript');

View file

@ -39,6 +39,7 @@ our $HELP = {
{ 'name' => 'category' },
{ 'name' => 'author' },
{ 'name' => 'guid' },
{ 'name' => 'media' },
{ 'name' => 'description' },
{ 'name' => 'descriptionFirst100words' },
{ 'name' => 'descriptionFirst75words' },

View file

@ -51,6 +51,11 @@ our $I18N = {
lastUpdated => 0,
},
'media' => {
message => q|Any MediaRSS entries for this item: structure is directly copied from <a href="http://search.cpan.org/perldoc?XML::FeedPP::MediaRSS#KEYS" >XML::FeedPP::MediaRSS</a>|,
lastUpdated => 1301495766,
},
'channel_description' => {
message => q|A description of the content available through this channel. This variable will be populated by the first feed in a multi-feed list.|,
lastUpdated => 0,