Added RSS feed template to Collaboration. Created help for new template. Added internationalization for template labels, tooltips and help. Modified upgrade script to add new column to Collaboration table and add new template.

This commit is contained in:
Michelle LaMar 2005-11-07 05:42:21 +00:00
parent 607a251b11
commit f1dfaaa142
5 changed files with 174 additions and 31 deletions

View file

@ -359,6 +359,10 @@ sub definition {
fieldType=>"selectList",
defaultValue=>'dateUpdated'
},
rssTemplateId =>{
fieldType=>"template",
defaultValue=>'PBtmpl0000000000000142'
},
notificationTemplateId =>{
fieldType=>"template",
defaultValue=>'PBtmpl0000000000000027'
@ -463,6 +467,13 @@ sub getEditForm {
-label=>WebGUI::International::get('notification template', 'Asset_Collaboration'),
-hoverHelp=>WebGUI::International::get('notification template description', 'Asset_Collaboration'),
);
$tabform->getTab("display")->template(
-name=>"rssTemplateId",
-value=>$self->getValue("rssTemplateId"),
-namespace=>"Collaboration/RSS",
-label=>WebGUI::International::get('rss template', 'Asset_Collaboration'),
-hoverHelp=>WebGUI::International::get('rss template description', 'Asset_Collaboration'),
);
$tabform->getTab("security")->group(
-name=>"moderateGroupId",
-label=>WebGUI::International::get('who moderates', 'Asset_Collaboration'),
@ -703,7 +714,7 @@ sub getUnsubscribeUrl {
=head2 incrementReplies ( lastPostDate, lastPostId )
Increments this forum's reply counter.
Increments the reply counter for this forum.
=head3 lastPostDate
@ -1125,17 +1136,19 @@ sub www_view {
# print out RSS 2.0 feed describing the items visible on the first page
sub www_viewRSS {
my $self = shift;
my %var;
$self->logView() if ($session{setting}{passiveProfilingEnabled});
my $encTitle = _xml_encode($self->get("title"));
my $encDescription = _xml_encode($self->get("description"));
my $encUrl = _xml_encode($self->getUrl);
my $xml = qq~<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
<channel>
<title>$encTitle</title>
<link>$encUrl</link>
<description>$encDescription</description>
~;
# Set the required channel variables
$var{'title'} = _xml_encode($self->get("title"));
$var{'link'} = _xml_encode($self->getUrl);
$var{'description'} = _xml_encode($self->get("description"));
# Set some of the optional channel variables
$var{'generator'} = "WebGUI ".$WebGUI::VERSION;
$var{'lastBuildDate'} = _xml_encode(_get_rfc822_date($self->get("dateUpdated")));
$var{'webMaster'} = $WebGUI::Session::session{setting}{companyEmail};
$var{'docs'} = "http://blogs.law.harvard.edu/tech/rss";
my $sth = WebGUI::SQL->read("select asset.assetId, asset.className, max(assetData.revisionDate)
from Thread
left join asset on Thread.assetId=asset.assetId
@ -1150,30 +1163,21 @@ sub www_viewRSS {
my $i = 1;
while (my ($id, $class, $version) = $sth->array) {
my $post = WebGUI::Asset::Wobject::Collaboration->new($id, $class, $version);
my $encUrl = _xml_encode(WebGUI::URL::getSiteURL().$post->getUrl);
my $encUrl = _xml_encode(WebGUI::URL::getSiteURL().$post->getUrl);
my $encTitle = _xml_encode($post->get("title"));
my $encPubDate = _xml_encode(_get_rfc822_date($post->get("dateUpdated")));
my $encDescription = _xml_encode($post->get("synopsis"));
$xml .= qq~
<item>
<title>$encTitle</title>
<link>$encUrl</link>
<description>$encDescription</description>
<guid isPermaLink="true">$encUrl</guid>
<pubDate>$encPubDate</pubDate>
</item>
~;
push(@{$var{'item_loop'}}, {
title => _xml_encode($post->get("title")),
link => $encUrl,
description => _xml_encode($post->get("synopsis")),
guid => $encUrl,
pubDate => _xml_encode(_get_rfc822_date($post->get("dateUpdated")))
});
$i++;
last if ($i == $self->get("threadsPerPage"));
}
$xml .=qq~
</channel>
</rss>
~;
WebGUI::HTTP::setMimeType("text/xml");
return $xml;
return $self->processTemplate(\%var,$self->get("rssTemplateId"));
}
@ -1181,5 +1185,3 @@ sub www_viewRSS {
1;

View file

@ -35,6 +35,11 @@ our $HELP = {
description => 'notification template description',
namespace => 'Asset_Collaboration',
},
{
title => 'rss template',
description => 'rss template description',
namespace => 'Asset_Collaboration',
},
{
title => 'who moderates',
description => 'who moderates description',
@ -191,6 +196,19 @@ our $HELP = {
]
},
'collaboration rss template' => {
title => 'collaboration rss template title',
body => 'collaboration rss template body',
fields => [
],
related => [
{
tag => 'collaboration post list template variables',
namespace => 'Asset_Collaboration',
},
]
},
};
1;

View file

@ -433,6 +433,11 @@ our $I18N = {
lastUpdated => 1109698614,
},
'rss template' => {
message => q|RSS Template|,
lastUpdated => 1109698614,
},
'who moderates' => {
message => q|Who can moderate?|,
lastUpdated => 1109698614,
@ -847,6 +852,10 @@ properties listed below:</p>
message => q|The template used to generate emails for users who have subscribed to this Asset.|,
lastUpdated => 1119070429,
},
'rss template description' => {
message => q|The template used to generate the xml for an rss feed based on this Asset.|,
lastUpdated => 1119070429,
},
'who moderates description' => {
message => q|The group that will moderate posts to this Asset, if moderation is enabled.|,
@ -1258,6 +1267,64 @@ A URL for sorting and displaying the list of posts by their ratings.
},
'collaboration rss template title' => {
message => q|Collaboration RSS Template|,
lastUpdated => 1114467745,
},
'collaboration rss template body' => {
message => q|The Collaboration RSS template is available to allow configuration of the XML produced as an RSS feed for a collaboration. To produce a valid rss feed, this template must adhere to the <a href="http://blogs.law.harvard.edu/tech/rss">RSS 2.0 Specification.</a> These variables are available in the Collaboration RSS Template:<p>
<p>
<b>title</b><br>
The title of the rss feed (comes from the collaboration title).
<p>
<b>link</b><br>
The url to the collaboration.
<p>
<b>description</b><br>
The description of the rss feed (comes from the collaboration description).
<p>
<b>generator</b><br>
The program used to generate the rss feed, i.e. WebGUI plus version information. (optional field)
<p>
<b>webMaster</b><br>
The email address of the person responsible for the technical issues relating to this rss feed. (optional field)
<p>
<b>docs</b><br>
The url of documentation about the format of this file, RSS 2.0 (optional field)
<p>
<b>lastBuildDate</b><br>
The date that this feed was last updated. (optional field)
<p>
<b>item_loop</b><br>
Loops over the posts to be transmitted in this RSS feed.
<blockquote>
<b>title</b><br>
The title of the item (post).
<p>
<b>link</b><br>
The url to the full text of the item.
<p>
<b>description</b><br>
A synopsis of the item.
<p>
<b>guid</b><br>
A unique identifier for this item.
<p>
<b>pubDate</b><br>
The date the item was published.
</blockquote>
|,
lastUpdated => 1114467741,
},
};
1;