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

@ -3,6 +3,8 @@
- fixed #12065: "Data error" in AssetManager if URL is Cyrillic
- fixed #12075: Underground Style - Search does not search
- fixed #12084: Greenportal links are sometimes white on white
- rfe #618: Syndicated Content Asset: Make images in the downloaded
RSS-feeds available in the template.
7.10.12
- fixed #12072: Product, related and accessory assets

View file

@ -7,6 +7,10 @@ upgrading from one version to the next, or even between multiple
versions. Be sure to heed the warnings contained herein as they will
save you many hours of grief.
7.10.13
--------------------------------------------------------------------
* WebGUI now depends on XML::FeedPP::MediaRSS.
7.10.12
--------------------------------------------------------------------
* The Dashboard has been extended to include Asset Dashlets. This gives

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,

View file

@ -102,6 +102,7 @@ checkModule("HTML::Template", 2.9 );
checkModule("HTML::Template::Expr", 0.07, 2 );
checkModule("Template", 2.20, 2 );
checkModule("XML::FeedPP", 0.40 );
checkModule("XML::FeedPP::MediaRSS", 0.02 );
checkModule("JSON", 2.12 );
checkModule("Config::JSON", "1.3.1" );
checkModule("Text::CSV_XS", "0.64" );

View file

@ -20,7 +20,7 @@ use Data::Dumper;
use WebGUI::Test;
use WebGUI::Session;
use Test::More tests => 29; # increment this value for each test you create
use Test::More tests => 30; # increment this value for each test you create
use Test::Deep;
use WebGUI::Asset::Wobject::SyndicatedContent;
use XML::FeedPP;
@ -144,7 +144,7 @@ ok( defined $vars->{item_loop}->[0]->{description}, 'getTemplateVariables: descr
##Construct a feed with a wrapped description, to check for paragraph handling.
$feed = XML::FeedPP->new(<<EOFEED);
<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<rss version="2.0" xmlns:media="http://search.yahoo.com/mrss">
<channel>
<title>The WebGUI buglist</title>
<link>/tbb</link>
@ -165,6 +165,11 @@ character, creating invalid markup.&lt;/p&gt;
&lt;p&gt;No more text is shown of the first paragraph beyond the bold characters of the first line.&lt;/p&gt;
&lt;p&gt;Third paragraph, for completeness.&lt;/p&gt;
</description>
<media:content
url="http://www.plainblack.com/wg_btn.jpg"
filesize="1415"
type="image/jpeg"
medium="image" />
</item>
</channel>
</rss>
@ -185,6 +190,15 @@ is $vars->{item_loop}->[0]->{descriptionFirstSentence},
Rich Text editor in the first sentence of the description.",
'... first sentence, with HTML stripped';
is_deeply $vars->{item_loop}->[0]->{media}, [
{
url => 'http://www.plainblack.com/wg_btn.jpg',
type => 'image/jpeg',
medium => 'image',
filesize => 1415,
}
], 'MediaRSS';
####################################################################
#
# generateFeed, hasTerms