rework how validParent works, and where it is checked. Add an explicit check for it in addChild, and remove a bunch of overridden addChild methods.
This commit is contained in:
parent
a8496c4d15
commit
88ec09d279
12 changed files with 78 additions and 110 deletions
|
|
@ -130,37 +130,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->className
|
||||
);
|
||||
return undef;
|
||||
}
|
||||
|
||||
return $self->next::method( $properties, @_ );
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
=head2 appendTemplateVarsFileLoop ( vars, assetIds )
|
||||
|
||||
Append template vars for a file loop for the specified assetIds. C<vars> is
|
||||
|
|
@ -764,6 +733,20 @@ sub sendChunkedContent {
|
|||
return "chunked";
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 valid_parent_classes
|
||||
|
||||
Make sure that the current session asset is a Gallery for pasting and adding checks.
|
||||
|
||||
This is a class method.
|
||||
|
||||
=cut
|
||||
|
||||
sub valid_parent_classes {
|
||||
return [qw/WebGUI::Asset::Wobject::Gallery/];
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
=head2 view ( )
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue