More tests for AdSpace/Ad.pm, one of which found a bug with

handling Macros in Rich Media ads.  This was fixed.

Just the start of template docs for the Calendar.  Finishing the 
Calendar docs requires doing the Event docs.
This commit is contained in:
Colin Kuskie 2007-02-10 00:16:16 +00:00
parent 4ebc99108f
commit 84198ceea0
6 changed files with 422 additions and 97 deletions

View file

@ -63,6 +63,7 @@
- fix: Ignoring shortcut overrides.
- fix: Calendar feeds not working.
- fix: multiple matrix sharing features
- fix: Fixed a bug with processing macros in rich media ads. (perlDreamer Consulting, LLC)
- fix: WebGUI Auth create account can now be properly overriden
7.3.8

View file

@ -263,7 +263,7 @@ sub set {
$self->{_properties}{renderedAd} = '<div style="position:relative; width:'.$adSpace->get("width").'px; height:'.$adSpace->get("height").'px; margin:0px; overflow:hidden; border:0px;"><a href="'.$self->session->url->gateway(undef, "op=clickAd;id=".$self->getId).'" style="position:absolute; padding: 3px; top:0px; left:0px; width:100%; height:100%; z-index:10; display:block; text-decoration:none; vertical-align:top;"><img src="'.$storage->getUrl($storage->getFiles->[0]).'" alt="'.$self->get("title").'" style="z-index:0;position:relative;border-style:none;border: 0px;" alt="'.$self->get("title").'" /></a></div>';
} elsif ($self->get("type") eq "rich") {
my $ad = $self->get("richMedia");
WebGUI::Macro::process($self->session, $ad);
WebGUI::Macro::process($self->session, \$ad);
$self->{_properties}{renderedAd} = $ad;
}
$self->session->db->setRow("advertisement","adId",$self->{_properties});

View file

@ -1685,10 +1685,12 @@ sub www_search {
defaultValue => $default_end,
});
my $i18n = WebGUI::International->new($session, 'Asset_Calendar');
$var->{"form.submit"}
= WebGUI::Form::submit($session, {
name => "submit",
value => "Search",
value => $i18n->get('searchButtonLabel'),
});
# This is very bad! It should be $self->processStyle or whatnot.

View file

@ -3,92 +3,153 @@ package WebGUI::Help::Asset_Calendar;
use strict;
use warnings;
our $HELP = {};
#### Edit Calendar Page
my $editPage = $HELP->{'calendar add/edit'} = {};
$editPage->{ title } = 'help add/edit title';
$editPage->{ body } = 'help add/edit body';
push @{$editPage->{ isa }}, {
tag => 'asset fields',
namespace => 'Asset',
},
;
push @{$editPage->{ fields }},
{
title => "defaultView label",
description => "defaultView description",
namespace => "Asset_Calendar",
},
{
title => "defaultDate label",
description => "defaultDate description",
namespace => "Asset_Calendar",
},
{
title => "groupIdEventEdit label",
description => "groupIdEventEdit description",
namespace => "Asset_Calendar",
},
{
title => "templateIdMonth label",
description => "templateIdMonth description",
namespace => "Asset_Calendar",
},
{
title => "templateIdWeek label",
description => "templateIdWeek description",
namespace => "Asset_Calendar",
},
{
title => "templateIdDay label",
description => "templateIdDay description",
namespace => "Asset_Calendar",
},
{
title => "templateIdEvent label",
description => "templateIdEvent description",
namespace => "Asset_Calendar",
},
{
title => "templateIdEventEdit label",
description => "templateIdEventEdit description",
namespace => "Asset_Calendar",
},
{
title => "templateIdSearch label",
description => "templateIdSearch description",
namespace => "Asset_Calendar",
},
{
title => "templateIdPrintMonth label",
description => "templateIdPrintMonth description",
namespace => "Asset_Calendar",
},
{
title => "templateIdPrintWeek label",
description => "templateIdPrintWeek description",
namespace => "Asset_Calendar",
},
{
title => "templateIdPrintDay label",
description => "templateIdPrintDay description",
namespace => "Asset_Calendar",
},
{
title => "templateIdPrintEvent label",
description => "templateIdPrintEvent description",
namespace => "Asset_Calendar",
},
;
our $HELP = {
'calendar add/edit' => {
title => 'help add/edit title',
body => 'help add/edit body',
isa => [
{
namespace => "Asset_Wobject",
tag => "wobject add/edit"
},
],
fields => [
{
title => "defaultView label",
description => "defaultView description",
namespace => "Asset_Calendar",
},
{
title => "defaultDate label",
description => "defaultDate description",
namespace => "Asset_Calendar",
},
{
title => "groupIdEventEdit label",
description => "groupIdEventEdit description",
namespace => "Asset_Calendar",
},
{
title => "templateIdMonth label",
description => "templateIdMonth description",
namespace => "Asset_Calendar",
},
{
title => "templateIdWeek label",
description => "templateIdWeek description",
namespace => "Asset_Calendar",
},
{
title => "templateIdDay label",
description => "templateIdDay description",
namespace => "Asset_Calendar",
},
{
title => "templateIdEvent label",
description => "templateIdEvent description",
namespace => "Asset_Calendar",
},
{
title => "templateIdEventEdit label",
description => "templateIdEventEdit description",
namespace => "Asset_Calendar",
},
{
title => "templateIdSearch label",
description => "templateIdSearch description",
namespace => "Asset_Calendar",
},
{
title => "templateIdPrintMonth label",
description => "templateIdPrintMonth description",
namespace => "Asset_Calendar",
},
{
title => "templateIdPrintWeek label",
description => "templateIdPrintWeek description",
namespace => "Asset_Calendar",
},
{
title => "templateIdPrintDay label",
description => "templateIdPrintDay description",
namespace => "Asset_Calendar",
},
{
title => "templateIdPrintEvent label",
description => "templateIdPrintEvent description",
namespace => "Asset_Calendar",
},
],
variables => [
],
related => [
],
},
#### View Calendar Page
'view calendar template' => {
title => 'view calendar title',
body => 'view calendar body',
isa => [
{
namespace => "Asset_Template",
tag => "template variables"
},
{
namespace => "Asset",
tag => "asset template"
},
],
fields => [
],
variables => [
{
'name' => 'admin'
},
{
'name' => 'adminControls'
},
{
'name' => 'editor'
},
{
'name' => 'urlAdd'
},
{
'name' => 'urlDay'
},
{
'name' => 'urlWeek'
},
{
'name' => 'urlMonth'
},
{
'name' => 'urlSearch'
},
{
'name' => 'urlPrint'
},
{
'name' => 'paramStart'
},
{
'name' => 'paramType'
},
{
'name' => 'extrasUrl'
},
],
related => [
{
tag => 'calendar add/edit',
namespace => 'Asset_Calendar'
},
]
},
#### Search Calendar Page
#### ICal Calendar Page
@ -100,25 +161,88 @@ push @{$editPage->{ fields }},
#### View Day Template
#### Search Template
__END__
our $HELP = {
'calendar add/edit' => {
title => 'add/edit title',
body => 'add/edit body',
'view day template' => {
title => 'view calendar day title',
body => 'view calendar day body',
isa => [
{
tag => 'asset fields',
namespace => 'Asset'
namespace => "Asset_Calendar",
tag => "view calendar template"
},
],
fields => [
],
],
variables => [
{
'name' => 'hours'
},
{
'name' => 'hour12'
},
{
'name' => 'hour24'
},
{
'name' => 'hourM'
},
{
'name' => 'pageNextStart'
},
{
'name' => 'pageNextUrl'
},
{
'name' => 'pagePrevStart'
},
{
'name' => 'pagePrevUrl'
},
{
'name' => 'dayName'
},
{
'name' => 'dayAbbr'
},
{
'name' => 'dayOfMonth'
},
{
'name' => 'dayOfWeek'
},
{
'name' => 'monthName'
},
{
'name' => 'monthAbbr'
},
{
'name' => 'year'
},
{
'name' => 'ymd'
},
{
'name' => 'mdy'
},
{
'name' => 'dmy'
},
{
'name' => 'epoch'
},
],
related => [
{
tag => 'calendar add/edit',
namespace => 'Asset_Calendar'
},
]
},
};
#### Search Template
1;

View file

@ -290,6 +290,191 @@ our $I18N = {
},
#################### HELP PAGES ####################
'searchButtonLabel' => {
message => q|Search|,
lastUpdated => 1170803504,
},
#################### HELP PAGES View Calendar ####################
'view calendar title' => {
message => q|View Calendar Template Variables|,
lastUpdated => 1171043337,
},
'view calendar body' => {
message => q|<p>The Calendar can be viewed as an entire month, a week, or just a day. Each view has its own individual template variables, but they also share several common variables. These are listed below:</p>|,
lastUpdated => 1171043883,
},
'admin' => {
message => q|A conditional that will be true if the user has Admin mode turned on.|,
lastUpdated => 1171043883,
},
'adminControls' => {
message => q|These are the icons and URLs that allow editing, cutting, copying, deleting and reordering the Asset.|,
lastUpdated => 1171043883,
},
'editor' => {
message => q|A conditional that will be true if the user is in the group allowed to edit events in the calendar.|,
lastUpdated => 1171043883,
},
'urlAdd' => {
message => q|A URL to add an event to the calendar.|,
lastUpdated => 1171043883,
},
'urlDay' => {
message => q|A URL to the 1 day view of the calendar.|,
lastUpdated => 1171043883,
},
'urlWeek' => {
message => q|A URL to the week view of the calendar.|,
lastUpdated => 1171043883,
},
'urlMonth' => {
message => q|A URL to the month view of the calendar.|,
lastUpdated => 1171043883,
},
'urlSearch' => {
message => q|A URL to the search form for the calendar.|,
lastUpdated => 1171043883,
},
'urlPrint' => {
message => q|A URL to the printable view of the calendar.|,
lastUpdated => 1171043883,
},
'paramStart' => {
message => q|The starting date of the calendar.|,
lastUpdated => 1171043883,
},
'paramType' => {
message => q|The current view of the calendar, one of the strings "day", "week", "month".|,
context => q|Translator's note: Do not translate the strings in double quotes, they are literals.|,
lastUpdated => 1171062302,
},
'extrasUrl' => {
message => q|A URL to the WebGUI extras directory.|,
lastUpdated => 1171062302,
},
'view calendar day title' => {
message => q|View Calendar Day Template Variables|,
lastUpdated => 1171043337,
},
'view calendar day body' => {
message => q|<p>This template shows all events in a single day in the calendar, sorted by hour.</p>|,
lastUpdated => 1171043883,
},
'hours' => {
message => q|This loop contains all the events and labels for the hours that they occur in.|,
lastUpdated => 1171043883,
},
'hour12' => {
message => q|The hour in 12 hour format. 2:00 in the afternoon will be 2:00.|,
lastUpdated => 1171043883,
},
'hour24' => {
message => q|The hour in 24 hour format. 2:00 in the afternoon will be 14:00.|,
lastUpdated => 1171043883,
},
'hourM' => {
message => q|Depending on whether the hour occurs in the morning or afternoon, either the strings "am" or "pm"|,
context => q|Translator's note: Do not translate the strings in double quotes, they are literals.|,
lastUpdated => 1171043883,
},
'pageNextStart' => {
message => q|The date of the next day in the calendar in YYYY-MM-DD (Year, Month, Day) format.|,
lastUpdated => 1171043883,
},
'pageNextUrl' => {
message => q|A URL to the next day in the calendar.|,
lastUpdated => 1171043883,
},
'pagePrevStart' => {
message => q|The date of the previous day in the calendar in YYYY-MM-DD (Year, Month, Day) format.|,
lastUpdated => 1171043883,
},
'pagePrevUrl' => {
message => q|A URL to the previous day in the calendar.|,
lastUpdated => 1171043883,
},
'dayName' => {
message => q|The name of the current day.|,
lastUpdated => 1171043883,
},
'dayAbbr' => {
message => q|The abbreviation for the name of the current day.|,
lastUpdated => 1171043883,
},
'dayOfMonth' => {
message => q|Which day of the month this day is, an integer from 1..31.|,
lastUpdated => 1171043883,
},
'dayOfWeek' => {
message => q|Which day of the week this day is, an integer from 1..7.|,
lastUpdated => 1171043883,
},
'monthName' => {
message => q|The name of this month.|,
lastUpdated => 1171043883,
},
'monthAbbr' => {
message => q|The abbreviation of the name for this month.|,
lastUpdated => 1171043883,
},
'year' => {
message => q|The 4 digit year.|,
lastUpdated => 1171043883,
},
'ymd' => {
message => q|This day's date in yyyy-mm-dd format, where yyyy is the year, mm is the month and dd is the day.|,
lastUpdated => 1171043883,
},
'mdy' => {
message => q|This day's date in mm-dd-yyyy format, where yyyy is the year, mm is the month and dd is the day.|,
lastUpdated => 1171043883,
},
'dmy' => {
message => q|This day's date in dd-mm-yyyy format, where yyyy is the year, mm is the month and dd is the day.|,
lastUpdated => 1171043883,
},
'epoch' => {
message => q|This day's date in epoch format.|,
lastUpdated => 1171043883,
},
#################### ASSET NAME ####################
'assetName' => {

View file

@ -35,7 +35,7 @@ my $newAdSettings = {
priority => "0",
};
my $numTests = 6; # increment this value for each test you create
my $numTests = 7; # increment this value for each test you create
$numTests += scalar keys %{ $newAdSettings };
++$numTests; ##For conditional testing on module load
@ -45,6 +45,7 @@ my $loaded = use_ok('WebGUI::AdSpace::Ad');
my $session = WebGUI::Test->session;
my $ad;
my $richAd;
my $adSpace;
SKIP: {
@ -55,6 +56,7 @@ SKIP: {
isa_ok($ad,"WebGUI::AdSpace::Ad");
isa_ok($ad->session, 'WebGUI::Session');
isa($ad->get('type'), 'text', 'property set during object creation');
my $ad2 = WebGUI::AdSpace::Ad->new($session, $ad->getId);
cmp_deeply($ad2, $ad, "new returns an identical object to the original what was created");
@ -72,11 +74,22 @@ SKIP: {
sprintf "default setting for %s", $setting);
}
$richAd = WebGUI::AdSpace::Ad->create($session, $adSpace->getId);
$richAd->set({
type => 'rich',
richMedia => 'This is rich, ^@;'
});
my $renderedAd = $richAd->get('renderedAd');
my $userName = $session->user->username;
like($renderedAd, qr/This is rich, $userName/, 'Rich media ads render macros');
}
END {
if (defined $ad and ref $ad eq 'WebGUI::AdSpace::Ad') {
$ad->delete;
foreach my $advertisement ($ad, $richAd) {
if (defined $advertisement and ref $advertisement eq 'WebGUI::AdSpace::Ad') {
$advertisement->delete;
}
}
if (defined $adSpace and ref $adSpace eq 'WebGUI::AdSpace') {
$adSpace->delete;