Tests for templateId and URL handling, some i18n for the RenderThingData macro.

This commit is contained in:
Colin Kuskie 2011-05-24 15:23:32 -07:00
parent 8bc944d526
commit 595660e9e4
3 changed files with 130 additions and 2 deletions

View file

@ -11,8 +11,8 @@ package WebGUI::Macro::RenderThingData;
#-------------------------------------------------------------------
use strict;
use WebGUI::Group;
use WebGUI::Asset::Template;
use WebGUI::International;
use WebGUI::Asset::Wobject::Thingy;
=head1 NAME
@ -39,6 +39,8 @@ Optional. Specifies the templateId or template url to use. If omitted, the def
#-------------------------------------------------------------------
sub process {
my ($session, $thingDataUrl, $templateHint ) = @_;
my $i18n = WebGUI::International->new($session, 'Macro_RenderThingData');
return $i18n->get('no template') if !$templateHint;
my $uri = URI->new( $thingDataUrl );
@ -55,7 +57,6 @@ sub process {
my $output = $thing->www_viewThingData( $thingId, $thingDataId, $templateHint );
# FIX: Temporary solution (broken map due to template rendering <script> tags)
return "RenderThingData: Please specify a template." if !$templateHint;
return "RenderThingData: Contained bad tags!" if $output =~ /script>/;
return $output;

View file

@ -0,0 +1,18 @@
package WebGUI::i18n::English::Macro_RenderThingData;
use strict;
our $I18N = {
'bad tags' => {
message => q||,
lastUpdated => 1306275259,
},
'no template' => {
message => q|RenderThingData: Please specify a template.|,
lastUpdated => 1149177662,
},
};
1;