Do not prevent Assets from being added as children by subclassing addChild. It doesn't prevent paste from working. Fixes bug #11525.
This commit is contained in:
parent
d26a3dc862
commit
b4f7bb4334
6 changed files with 2 additions and 112 deletions
|
|
@ -10,6 +10,7 @@
|
||||||
- fixed #11444: Strange spectre problem
|
- fixed #11444: Strange spectre problem
|
||||||
- fixed #10189: pbworkflow000000000007 Hanging
|
- fixed #10189: pbworkflow000000000007 Hanging
|
||||||
- fixed #11526: Wrong log error in file AssetClipboard.pm
|
- fixed #11526: Wrong log error in file AssetClipboard.pm
|
||||||
|
- fixed #11525: Paste assets inside CS
|
||||||
|
|
||||||
7.9.2
|
7.9.2
|
||||||
- added: Workflow to extend recurring Calendar events 2 years from the
|
- added: Workflow to extend recurring Calendar events 2 years from the
|
||||||
|
|
|
||||||
|
|
@ -298,27 +298,6 @@ sub definition {
|
||||||
|
|
||||||
#----------------------------------------------------------------------------
|
#----------------------------------------------------------------------------
|
||||||
|
|
||||||
=head2 addChild ( properties [, more ] )
|
|
||||||
|
|
||||||
Only allows Events to be added as a child of this asset.
|
|
||||||
|
|
||||||
=cut
|
|
||||||
|
|
||||||
sub addChild {
|
|
||||||
my $self = shift;
|
|
||||||
my $properties = shift;
|
|
||||||
my @other = @_;
|
|
||||||
|
|
||||||
if ($properties->{className} ne "WebGUI::Asset::Event") {
|
|
||||||
$self->session->errorHandler->security("add a ".$properties->{className}." to a ".$self->get("className"));
|
|
||||||
return undef;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $self->SUPER::addChild($properties, @other);
|
|
||||||
}
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
=head2 addFeed ( $feedParams )
|
=head2 addFeed ( $feedParams )
|
||||||
|
|
||||||
Adds a new Feed to this calendar. This is a wrapper around WebGUI::JSONCollateral's setJSONCollateral
|
Adds a new Feed to this calendar. This is a wrapper around WebGUI::JSONCollateral's setJSONCollateral
|
||||||
|
|
|
||||||
|
|
@ -62,26 +62,6 @@ sub _visitorCacheOk {
|
||||||
&& !$self->session->form->process('sortBy'));
|
&& !$self->session->form->process('sortBy'));
|
||||||
}
|
}
|
||||||
|
|
||||||
#-------------------------------------------------------------------
|
|
||||||
|
|
||||||
=head2 addChild
|
|
||||||
|
|
||||||
Extend the base method to allow only Threads as children.
|
|
||||||
|
|
||||||
=cut
|
|
||||||
|
|
||||||
sub addChild {
|
|
||||||
my $self = shift;
|
|
||||||
my $properties = shift;
|
|
||||||
my @other = @_;
|
|
||||||
if ($properties->{className} ne "WebGUI::Asset::Post::Thread") {
|
|
||||||
$self->session->errorHandler->security("add a ".$properties->{className}." to a ".$self->get("className"));
|
|
||||||
return undef;
|
|
||||||
}
|
|
||||||
return $self->next::method($properties, @other);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------
|
#-------------------------------------------------------------------
|
||||||
|
|
||||||
=head2 appendPostListTemplateVars ($var, $p)
|
=head2 appendPostListTemplateVars ($var, $p)
|
||||||
|
|
|
||||||
|
|
@ -345,34 +345,6 @@ sub definition {
|
||||||
|
|
||||||
#----------------------------------------------------------------------------
|
#----------------------------------------------------------------------------
|
||||||
|
|
||||||
=head2 addChild ( properties, [...] )
|
|
||||||
|
|
||||||
Add a child to this asset. See C<WebGUI::AssetLineage> for more info.
|
|
||||||
|
|
||||||
Overridden to ensure that only GalleryAlbums are added to Galleries.
|
|
||||||
|
|
||||||
=cut
|
|
||||||
|
|
||||||
sub addChild {
|
|
||||||
my $self = shift;
|
|
||||||
my $properties = shift;
|
|
||||||
my $albumClass = "WebGUI::Asset::Wobject::GalleryAlbum";
|
|
||||||
|
|
||||||
# Load the class
|
|
||||||
WebGUI::Pluggable::load( $properties->{className} );
|
|
||||||
|
|
||||||
if ( !$properties->{className}->isa( $albumClass ) ) {
|
|
||||||
$self->session->errorHandler->security(
|
|
||||||
"add a ".$properties->{className}." to a ".$self->get("className")
|
|
||||||
);
|
|
||||||
return undef;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $self->next::method( $properties, @_ );
|
|
||||||
}
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
=head2 appendTemplateVarsSearchForm ( var )
|
=head2 appendTemplateVarsSearchForm ( var )
|
||||||
|
|
||||||
Appends the template vars for the search form to the hash reference C<var>.
|
Appends the template vars for the search form to the hash reference C<var>.
|
||||||
|
|
|
||||||
|
|
@ -174,37 +174,6 @@ sub addArchive {
|
||||||
|
|
||||||
#----------------------------------------------------------------------------
|
#----------------------------------------------------------------------------
|
||||||
|
|
||||||
=head2 addChild ( properties [, ... ] )
|
|
||||||
|
|
||||||
Add a child to this GalleryAlbum. See C<WebGUI::AssetLineage> for more info.
|
|
||||||
|
|
||||||
Override to ensure only appropriate classes get added to GalleryAlbums.
|
|
||||||
|
|
||||||
=cut
|
|
||||||
|
|
||||||
sub addChild {
|
|
||||||
my $self = shift;
|
|
||||||
my $properties = shift;
|
|
||||||
my $fileClass = 'WebGUI::Asset::File::GalleryFile';
|
|
||||||
|
|
||||||
# Load the class
|
|
||||||
WebGUI::Pluggable::load( $properties->{className} );
|
|
||||||
|
|
||||||
# Make sure we only add appropriate child classes
|
|
||||||
if ( !$properties->{className}->isa( $fileClass )
|
|
||||||
&& !$properties->{ className }->isa( "WebGUI::Asset::Shortcut" )
|
|
||||||
) {
|
|
||||||
$self->session->errorHandler->security(
|
|
||||||
"add a ".$properties->{className}." to a ".$self->get("className")
|
|
||||||
);
|
|
||||||
return undef;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $self->next::method( $properties, @_ );
|
|
||||||
}
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
=head2 appendTemplateVarsFileLoop ( vars, assetIds )
|
=head2 appendTemplateVarsFileLoop ( vars, assetIds )
|
||||||
|
|
||||||
Append template vars for a file loop for the specified assetIds. C<vars> is
|
Append template vars for a file loop for the specified assetIds. C<vars> is
|
||||||
|
|
|
||||||
|
|
@ -57,7 +57,7 @@ use Data::Dumper;
|
||||||
use WebGUI::Asset::Wobject::Calendar;
|
use WebGUI::Asset::Wobject::Calendar;
|
||||||
use WebGUI::Asset::Event;
|
use WebGUI::Asset::Event;
|
||||||
|
|
||||||
plan tests => 14 + scalar @icalWrapTests;
|
plan tests => 12 + scalar @icalWrapTests;
|
||||||
|
|
||||||
my $session = WebGUI::Test->session;
|
my $session = WebGUI::Test->session;
|
||||||
|
|
||||||
|
|
@ -82,10 +82,6 @@ isa_ok($cal, 'WebGUI::Asset::Wobject::Calendar');
|
||||||
my $event = $cal->addChild({className=>'WebGUI::Asset::Event'});
|
my $event = $cal->addChild({className=>'WebGUI::Asset::Event'});
|
||||||
isa_ok($event, 'WebGUI::Asset::Event','Can add Events as a child to the calendar.');
|
isa_ok($event, 'WebGUI::Asset::Event','Can add Events as a child to the calendar.');
|
||||||
|
|
||||||
my $article = $cal->addChild({className=>"WebGUI::Asset::Wobject::Article"});
|
|
||||||
isnt(ref $article, 'WebGUI::Asset::Wobject::Article', "Can't add an article as a child to the calendar.");
|
|
||||||
ok(! defined $article, '... addChild returned undef');
|
|
||||||
|
|
||||||
my $dt = WebGUI::DateTime->new($session, mysql => '2001-08-16 8:00:00', time_zone => 'America/Chicago');
|
my $dt = WebGUI::DateTime->new($session, mysql => '2001-08-16 8:00:00', time_zone => 'America/Chicago');
|
||||||
|
|
||||||
my $vars = {};
|
my $vars = {};
|
||||||
|
|
@ -270,10 +266,6 @@ is(scalar @{ $windowCal->getLineage(['children'])}, 13, 'added events to the win
|
||||||
|
|
||||||
my @window = $windowCal->getEventsIn($startDt->toDatabase, $endDt->toDatabase);
|
my @window = $windowCal->getEventsIn($startDt->toDatabase, $endDt->toDatabase);
|
||||||
|
|
||||||
#note $startDt->toDatabase;
|
|
||||||
#note join "\n", map { join ' ', $_->get('title'), $_->get('startDate'), $_->get('startTime')} @window;
|
|
||||||
#note $endDt->toDatabase;
|
|
||||||
|
|
||||||
cmp_bag(
|
cmp_bag(
|
||||||
[ map { $_->get('title') } @window ],
|
[ map { $_->get('title') } @window ],
|
||||||
[ map { $_->get('title') }
|
[ map { $_->get('title') }
|
||||||
|
|
@ -503,9 +495,6 @@ my $listCal = $node->addChild({
|
||||||
$allDayDt = $bday->cloneToUserTimeZone->truncate( to => 'day' );
|
$allDayDt = $bday->cloneToUserTimeZone->truncate( to => 'day' );
|
||||||
my $prevDayDt = $bday->cloneToUserTimeZone->truncate( to => 'day' )->subtract(days => 1)->add(hours => 19);
|
my $prevDayDt = $bday->cloneToUserTimeZone->truncate( to => 'day' )->subtract(days => 1)->add(hours => 19);
|
||||||
|
|
||||||
note $allDayDt->toDatabase;
|
|
||||||
note $prevDayDt->toDatabase;
|
|
||||||
|
|
||||||
$allDay = $listCal->addChild({
|
$allDay = $listCal->addChild({
|
||||||
className => 'WebGUI::Asset::Event',
|
className => 'WebGUI::Asset::Event',
|
||||||
title => 'An event with explicit times that lasts all day',
|
title => 'An event with explicit times that lasts all day',
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue