Fixed RSSFromParent bug
This commit is contained in:
parent
cb367a8020
commit
d5b79ae217
2 changed files with 32 additions and 12 deletions
|
|
@ -113,8 +113,9 @@ sub www_view {
|
||||||
$subvar->{pubDate} = _escapeXml($self->session->datetime->epochToMail($item->get('dateUpdated')));
|
$subvar->{pubDate} = _escapeXml($self->session->datetime->epochToMail($item->get('dateUpdated')));
|
||||||
} elsif (ref $item eq 'HASH') {
|
} elsif (ref $item eq 'HASH') {
|
||||||
foreach my $key (keys %$item) {
|
foreach my $key (keys %$item) {
|
||||||
my $value = $item->{$key};
|
### This does not do any XML escaping. A way must be found to
|
||||||
$subvar->{$key} = (ref $value eq 'ARRAY')? join($,, @$value) : _escapeXml($value);
|
# recursively escape the entire data structure.
|
||||||
|
$subvar->{$key} = $item->{$key};
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$self->session->errorHandler->error("Don't know what to do with this RSS item: $item");
|
$self->session->errorHandler->error("Don't know what to do with this RSS item: $item");
|
||||||
|
|
|
||||||
|
|
@ -673,20 +673,39 @@ sub getRssItems {
|
||||||
SQL
|
SQL
|
||||||
my $siteUrl = $self->session->url->getSiteURL();
|
my $siteUrl = $self->session->url->getSiteURL();
|
||||||
my $datetime = $self->session->datetime;
|
my $datetime = $self->session->datetime;
|
||||||
return map {
|
|
||||||
my $postId = $_;
|
my @posts;
|
||||||
|
for my $postId (@postIds) {
|
||||||
my $post = WebGUI::Asset->new($self->session, $postId, 'WebGUI::Asset::Post::Thread');
|
my $post = WebGUI::Asset->new($self->session, $postId, 'WebGUI::Asset::Post::Thread');
|
||||||
my $postUrl = $siteUrl . $post->getUrl;
|
my $postUrl = $siteUrl . $post->getUrl;
|
||||||
# Buggo: this is an abuse of 'author'. 'author' is supposed to be an email address.
|
# Buggo: this is an abuse of 'author'. 'author' is supposed to be an email address.
|
||||||
# But this is how it was in the original Collaboration RSS, so.
|
# But this is how it was in the original Collaboration RSS, so.
|
||||||
({ author => $post->get('username'),
|
|
||||||
title => $post->get('title'),
|
# Create the attachment template loop
|
||||||
'link' => $postUrl, guid => $postUrl,
|
my $storage = $post->getStorageLocation;
|
||||||
description => $post->get('synopsis'),
|
my $attachmentLoop = [];
|
||||||
pubDate => $datetime->epochToMail($post->get('dateUpdated')),
|
if ($post->get('storageId')) {
|
||||||
attachmentLoop => $self->getRssItemsAttachments($post),
|
for my $file (@{$storage->getFiles}) {
|
||||||
})
|
push @{$attachmentLoop}, {
|
||||||
} @postIds;
|
'attachment.url' => $storage->getUrl($file),
|
||||||
|
'attachment.path' => $storage->getPath($file),
|
||||||
|
'attachment.length' => $storage->getFileSize($file),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
push @posts, {
|
||||||
|
author => $post->get('username'),
|
||||||
|
title => $post->get('title'),
|
||||||
|
'link' => $postUrl,
|
||||||
|
guid => $postUrl,
|
||||||
|
description => $post->get('synopsis'),
|
||||||
|
pubDate => $datetime->epochToMail($post->get('dateUpdated')),
|
||||||
|
attachmentLoop => $attachmentLoop,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
return @posts;
|
||||||
}
|
}
|
||||||
|
|
||||||
#-------------------------------------------------------------------
|
#-------------------------------------------------------------------
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue