RSS Limiter

This commit is contained in:
Brian Medley 2009-03-23 09:09:48 +00:00
parent a57a6ba87b
commit e7a3282af3
6 changed files with 60 additions and 14 deletions

View file

@ -35,11 +35,11 @@ using the RSSFromParent asset.
=cut
sub definition {
my $class = shift;
my $session = shift;
my $definition = shift;
my %properties;
tie %properties, 'Tie::IxHash';
my $class = shift;
my $session = shift;
my $definition = shift;
my %properties;
tie %properties, 'Tie::IxHash';
my $i18n = WebGUI::International->new($session, 'Asset_RSSCapable');
# We do this prefixing to avoid name collisions because properties aren't namespaced.
@ -58,6 +58,13 @@ sub definition {
label => $i18n->get('rssTemplateId label'),
hoverHelp => $i18n->get('rssTemplateId hoverHelp')
},
rssCapableRssLimit => { tab => 'display',
fieldType => 'integer',
defaultValue => 10,
namespace => 'RSSCapable/RSS',
label => $i18n->get('rssLimit label'),
hoverHelp => $i18n->get('rssLimit hoverHelp')
},
rssCapableRssFromParentId => { fieldType => 'hidden',
noFormPost => 1,
defaultValue => undef,
@ -65,12 +72,12 @@ sub definition {
);
push @$definition, { assetName => $i18n->get('assetName'),
tableName => 'RSSCapable',
autoGenerateForms => 1,
className => 'WebGUI::Asset::RSSCapable',
icon => 'rssCapable.gif',
properties => \%properties
};
tableName => 'RSSCapable',
autoGenerateForms => 1,
className => 'WebGUI::Asset::RSSCapable',
icon => 'rssCapable.gif',
properties => \%properties
};
return $class->NEXT::definition($session, $definition);
}

View file

@ -131,7 +131,7 @@ sub www_view {
my $self = shift;
return '' unless $self->session->asset->getId eq $self->getId;
return '' unless $self->getParent->isa('WebGUI::Asset::RSSCapable');
return '' unless $self->getParent->canView; # Go to parent for auth
return '' unless $self->getParent->canView; # Go to parent for auth
my $parent = $self->getParent;
my $template = WebGUI::Asset::Template->new($self->session, $parent->get('rssCapableRssTemplateId'));
$template->prepare($self->getMetaDataAsTemplateVariables);

View file

@ -5,6 +5,8 @@ our $I18N =
{
'rssEnabled label' => { message => 'Enable RSS', lastUpdate => 1162487361 },
'rssEnabled hoverHelp' => { message => q|Whether or not to enable the RSS feed for this asset. If enabled, an RSS From Parent asset will be created and managed as an extra child for this purpose. If not enabled, no such child will be created and the existing one will be deleted.|, lastUpdate => 1162487361 },
'rssLimit label' => { message => 'RSS Display limit', lastUpdate => 1162487361 },
'rssLimit hoverHelp' => { message => q|How many RSS items to display|, lastUpdate => 1162487361 },
'rssTemplateId label' => { message => 'RSS Template', lastUpdate => 1162487361 },
'rssTemplateId hoverHelp' => { message => q|The template to use for the RSS feed of this asset.|, lastUpdate => 1162487361 },