fixed: Syndicated Content picks wrong entries for interleaving
This commit is contained in:
parent
ab0d5cbecb
commit
0bf48f9349
3 changed files with 23 additions and 19 deletions
|
|
@ -20,6 +20,7 @@
|
|||
- fixed: Bad message if database link for SQL Report doesn't exist
|
||||
- fixed: Thingy shows things from other Thingies
|
||||
- fixed: Collaboration System errors when missing RSS From Parent
|
||||
- fixed: Syndicated Content picks wrong entries for interleaving
|
||||
|
||||
7.5.7
|
||||
- fixed: HttpProxy mixes original site's content encoding with WebGUI's
|
||||
|
|
|
|||
|
|
@ -37,6 +37,15 @@ finish($session); # this line required
|
|||
# # and here's our code
|
||||
#}
|
||||
|
||||
#-------------------------------------------------
|
||||
sub clearRSSCache {
|
||||
my $session = shift;
|
||||
print "\tClearing RSS feed cache..." unless $quiet;
|
||||
my $cache = WebGUI::Cache->new($session, '', 'RSS');
|
||||
$cache->flush;
|
||||
print " Done.\n" unless $quiet;
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
sub removeOldGalleryColumns {
|
||||
my $session = shift;
|
||||
|
|
|
|||
|
|
@ -466,27 +466,21 @@ sub _create_grouped_items{
|
|||
# No need to return because we're doing everything by reference.
|
||||
|
||||
sub _create_interleaved_items {
|
||||
my($items,$rss_feeds,$maxHeadlines,$hasTermsRegex)=@_;
|
||||
my $items_remain = 1;
|
||||
while((@$items < $maxHeadlines) && $items_remain){
|
||||
$items_remain=0;
|
||||
foreach my $rss(@$rss_feeds){
|
||||
if(defined $rss->{items}
|
||||
&& @$items < $maxHeadlines
|
||||
&& (my $item = shift @{$rss->{items}})
|
||||
){
|
||||
$item->{site_title}=$rss->{channel}->{title};
|
||||
$item->{site_link}=$rss->{channel}->{link};
|
||||
if(! $hasTermsRegex || _check_hasTerms($item,$hasTermsRegex)){
|
||||
push @{$items},$item;
|
||||
}
|
||||
if (@{$rss->{items}}) {
|
||||
$items_remain = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
my ($items, $rss_feeds, $maxHeadlines, $hasTermsRegex) = @_;
|
||||
# put all items together into a single list
|
||||
foreach my $rss (@$rss_feeds) {
|
||||
while (my $item = shift @{$rss->{items}}) {
|
||||
if ($hasTermsRegex && ! _check_hasTerms($item, $hasTermsRegex)) {
|
||||
next;
|
||||
}
|
||||
$item->{site_title} = $rss->{channel}->{title};
|
||||
$item->{site_link} = $rss->{channel}->{link};
|
||||
push @$items, $item;
|
||||
}
|
||||
}
|
||||
@$items = sort { $b->{date} <=> $a->{date} } @$items;
|
||||
# limit to $maxHeadlines
|
||||
@$items = @$items[0 .. ($maxHeadlines - 1)];
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue