Added feature to the Syndicated Content Wobject that allows the use of macros in the RSS URL property
This commit is contained in:
parent
46055a5812
commit
c197ded0a9
4 changed files with 42 additions and 2 deletions
|
|
@ -15,6 +15,8 @@
|
|||
- Test: Added t/lib/WebGUI/PseudoRequest, which is a mostly functional
|
||||
Apache::Request object replacement. It doesn't do everything, but it
|
||||
does enough to test Session/Http.pm, except for cookies.
|
||||
- Added an option to the Syndicated Content Wobject that allows use of macros
|
||||
inside the RSS Url property.
|
||||
|
||||
7.1.4
|
||||
- Template variables in the main Survey Template were out of date in the
|
||||
|
|
|
|||
|
|
@ -22,9 +22,17 @@ my $session = start(); # this line required
|
|||
|
||||
commerceSalesTax($session);
|
||||
createDictionaryStorage($session);
|
||||
addRssUrlMacroProcessing($session);
|
||||
|
||||
finish($session); # this line required
|
||||
|
||||
#--------------------------------------------------
|
||||
sub addRssUrlMacroProcessing {
|
||||
my $session = shift;
|
||||
print "\tAdding option to process macros in a Syndicated Content RSS Url.\n" unless ($quiet);
|
||||
$session->db->write("alter table SyndicatedContent add column processMacroInRssUrl int(11) default 0");
|
||||
|
||||
}
|
||||
|
||||
##-------------------------------------------------
|
||||
sub commerceSalesTax {
|
||||
|
|
|
|||
|
|
@ -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 ( )
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue