fixed: Syndicated Content wobject makes H::T choke

This commit is contained in:
Doug Bell 2008-06-13 19:30:19 +00:00
parent 0f74429d81
commit 879668156b
3 changed files with 28 additions and 21 deletions

View file

@ -2,6 +2,7 @@
- fixed: Unable to template user profile viewing and editing screens.
- fixed: Product Variants not saving SKU
- fixed: Shop Payment Methods
- fixed: Syndicated Content asset makes template engine choke
- fixed: Asset Manager breaks when an asset is locked
- fixed: Asset Manager is slow to load
- fixed: project management application unable to add or edit tasks.

View file

@ -283,6 +283,7 @@ sub _find_record {
}
#-------------------------------------------------------------------
# First, get rid of things we don't want.
# Copy the guid field to the link field if the guid looks like a link.
# This is a kludge that gets around the fact that some folks use the link
# field as the link to the story while others use it as the link
@ -300,25 +301,29 @@ sub _normalize_items {
my $max_words = 10;
for my $item (@{$_[0]}) {
if ($item->{guid} && ($item->{guid} =~ /^http:\/\//i)) {
$item->{link} = $item->{guid};
}
if (!$item->{title}) {
my @description_words = split(/\s/, $item->{description});
if (@description_words <= $max_words) {
$item->{title} = $item->{description};
} else {
$item->{title} = join(' ', @description_words[0..$max_words-1]) .
' ...';
}
}
# Get rid of any keys in the items that we do not want
my @wantedKeys = qw( title link description pubDate );
%{ $item } = map { $_ => $item->{ $_ } } @wantedKeys;
if ($item->{guid} && ($item->{guid} =~ /^http:\/\//i)) {
$item->{link} = $item->{guid};
}
if (!$item->{title}) {
my @description_words = split(/\s/, $item->{description});
if (@description_words <= $max_words) {
$item->{title} = $item->{description};
} else {
$item->{title} = join(' ', @description_words[0..$max_words-1]) .
' ...';
}
}
# IE doesn't recognize &apos;
$item->{title} =~ s/&apos;/\'/g;
$item->{description} =~ s/&apos;/\'/g;
$item->{category} = [$item->{category}]
if ref $item->{category} ne 'ARRAY';
appendChoppedDescriptionTemplateVars($item);
# IE doesn't recognize &apos;
$item->{title} =~ s/&apos;/\'/g;
$item->{description} =~ s/&apos;/\'/g;
$item->{category} = [$item->{category}]
if ref $item->{category} ne 'ARRAY';
appendChoppedDescriptionTemplateVars($item);
}
}
@ -570,7 +575,7 @@ sub _get_items {
#Sort feeds in order by channel title.
#@rss_feeds=sort{$a->{channel}->{title} cmp $b->{channel}->{title}} @rss_feeds;
if ($displayMode eq 'grouped') {
_create_grouped_items($items,\@rss_feeds,$maxHeadlines,$hasTermsRegex);
} else {

View file

@ -49,8 +49,9 @@ isa_ok($syndicated_content, 'WebGUI::Asset::Wobject::SyndicatedContent');
my $newSyndicatedContentSettings = {
cacheTimeout => 124,
templateId => "PBtmpl0000000000000065",
rssUrl => "http://morningmonologue.wordpress.com/feed/", # broken
#rssUrl => "http://morningmonologue.wordpress.com/feed/", # broken
#rssUrl => "http://motivationalmuse.wordpress.com/feed/", #working feed
rssUrl => 'https://svn.webgui.org/svnweb/plainblack/rss/WebGUI/',
};
# update the new values for this instance
@ -96,7 +97,7 @@ my $hasTermsRegex = "" ; #$syndicated_content->_make_regex( $syndicated_content-
my $rss_info = WebGUI::Asset::Wobject::SyndicatedContent::_get_rss_data($session,$newSyndicatedContentSettings->{'rssUrl'});
ok(ref($rss_info) eq 'HASH', "Hashref returned from _get_rss_data");
push(@rss_feeds, $rss_info) ;
push(@rss_feeds, $rss_info);
my $xml_list = WebGUI::Asset::Wobject::SyndicatedContent::_create_interleaved_items($items, \@rss_feeds , $max_headlines, $hasTermsRegex);
ok($xml_list , "Got results back from XML " );