Added feature to the Syndicated Content Wobject that allows the use of macros in the RSS URL property

This commit is contained in:
Roy Johnson 2006-11-02 20:17:47 +00:00
parent 46055a5812
commit c197ded0a9
4 changed files with 42 additions and 2 deletions

View file

@ -20,6 +20,7 @@ use WebGUI::HTMLForm;
use WebGUI::HTML;
use WebGUI::International;
use WebGUI::Asset::Wobject;
use WebGUI::Macro;
use XML::RSSLite;
use XML::RSS::Creator;
use LWP::UserAgent;
@ -89,7 +90,7 @@ sub _getMaxHeadlines {
#-------------------------------------------------------------------
sub _getValidatedUrls {
my $self = shift;
my @urls = split(/\s+/,$self->get('rssUrl'));
my @urls = split(/\s+/,$self->getRssUrl);
my @validatedUrls = ();
foreach my $url (@urls) {
push(@validatedUrls, $url) if ($url =~ m/^http/);
@ -140,6 +141,13 @@ sub definition {
label=>$i18n->get(1),
hoverHelp=>$i18n->get('1 description')
},
processMacroInRssUrl=>{
tab=>"properties",
defaultValue=>0,
fieldType=>'yesNo',
label=>$i18n->get('process macros in rss url'),
hoverHelp=>$i18n->get('process macros in rss url description'),
},
maxHeadlines=>{
tab=>"properties",
fieldType=>'integer',
@ -504,7 +512,7 @@ sub _get_items {
# - aggregate: $items
# - aggregate2 (2006-08-26): [$items, \@rss_feeds]
my $key=join(':',('aggregate2', $displayMode,$hasTermsRegex,$maxHeadlines,$self->get('rssUrl')));
my $key=join(':',('aggregate2', $displayMode,$hasTermsRegex,$maxHeadlines,$self->getRssUrl));
my $cache = WebGUI::Cache->new($self->session,$key, 'RSS');
my $cached = Storable::thaw($cache->get());
@ -649,6 +657,20 @@ sub view {
}
#-------------------------------------------------------------------
=head2 getRssUrl
Get the RSS URL and process macros if we're supposed to.
=cut
sub getRssUrl {
my $self = shift;
my $value = $self->get("rssUrl");
WebGUI::Macro::process($self->session,\$value) if $self->get("processMacroInRssUrl");
return $value;
}
#-------------------------------------------------------------------
=head2 getContentLastModified ( )

View file

@ -1,6 +1,14 @@
package WebGUI::i18n::English::Asset_SyndicatedContent;
our $I18N = {
'process macros in rss url' => {
message => q|Process Macros in RSS URLs|,
lastUpdated => 0
},
'process macros in rss url description' => {
message => q|Setting this to yes will allow you to use macros in your urls|,
lastUpdated => 0
},
'cache timeout' => {
message => q|Cache Timeout|,
lastUpdated => 0