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')));
|
||||
} elsif (ref $item eq 'HASH') {
|
||||
foreach my $key (keys %$item) {
|
||||
my $value = $item->{$key};
|
||||
$subvar->{$key} = (ref $value eq 'ARRAY')? join($,, @$value) : _escapeXml($value);
|
||||
### This does not do any XML escaping. A way must be found to
|
||||
# recursively escape the entire data structure.
|
||||
$subvar->{$key} = $item->{$key};
|
||||
}
|
||||
} else {
|
||||
$self->session->errorHandler->error("Don't know what to do with this RSS item: $item");
|
||||
|
|
|
|||
|
|
@ -673,20 +673,39 @@ sub getRssItems {
|
|||
SQL
|
||||
my $siteUrl = $self->session->url->getSiteURL();
|
||||
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 $postUrl = $siteUrl . $post->getUrl;
|
||||
# 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.
|
||||
({ author => $post->get('username'),
|
||||
title => $post->get('title'),
|
||||
'link' => $postUrl, guid => $postUrl,
|
||||
description => $post->get('synopsis'),
|
||||
pubDate => $datetime->epochToMail($post->get('dateUpdated')),
|
||||
attachmentLoop => $self->getRssItemsAttachments($post),
|
||||
})
|
||||
} @postIds;
|
||||
|
||||
# Create the attachment template loop
|
||||
my $storage = $post->getStorageLocation;
|
||||
my $attachmentLoop = [];
|
||||
if ($post->get('storageId')) {
|
||||
for my $file (@{$storage->getFiles}) {
|
||||
push @{$attachmentLoop}, {
|
||||
'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