Adding Ben Simpson's new persistence layer.
This commit is contained in:
parent
af4efc0333
commit
d48579b177
16 changed files with 2127 additions and 56 deletions
78
lib/WebGUI/CollateralFolder.pm
Normal file
78
lib/WebGUI/CollateralFolder.pm
Normal file
|
|
@ -0,0 +1,78 @@
|
|||
package WebGUI::CollateralFolder;
|
||||
|
||||
|
||||
=head1 LEGAL
|
||||
|
||||
-------------------------------------------------------------------
|
||||
WebGUI is Copyright 2001-2003 Plain Black LLC.
|
||||
-------------------------------------------------------------------
|
||||
Please read the legal notices (docs/legal.txt) and the license
|
||||
(docs/license.txt) that came with this distribution before using
|
||||
this software.
|
||||
-------------------------------------------------------------------
|
||||
http://www.plainblack.com info@plainblack.com
|
||||
-------------------------------------------------------------------
|
||||
|
||||
=cut
|
||||
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use WebGUI::Collateral;
|
||||
use WebGUI::Persistent::Tree;
|
||||
use WebGUI::SQL;
|
||||
|
||||
our @ISA = qw(WebGUI::Persistent::Tree);
|
||||
|
||||
=head1 NAME
|
||||
|
||||
Package WebGUI::CollateralFolder
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
This is a management package for the collateral folder system.
|
||||
|
||||
=head1 METHODS
|
||||
|
||||
For inherited methods see L<WebGUI::Persistent::Tree>.
|
||||
|
||||
=cut
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
sub classSettings {
|
||||
return {
|
||||
properties => {
|
||||
name => { quote => 1 },
|
||||
parentId => { defaultValue => 0 },
|
||||
collateralFolderId => { key => 1 },
|
||||
description => { quote => 1 }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 recursiveDelete ()
|
||||
|
||||
Recursively delete a folder, sub folders and contents
|
||||
|
||||
=cut
|
||||
|
||||
sub recursiveDelete {
|
||||
my ($self) = @_;
|
||||
my @ids = $self->SUPER::recursiveDelete();
|
||||
return unless @ids;
|
||||
|
||||
# If WebGUI::Collateral inherited from WebGUI::Persistent then we would only
|
||||
# need the following line:
|
||||
# WebGUI::Collateral->multiDelete(collateralFolderId => \@ids);
|
||||
|
||||
my @collateralIds = WebGUI::SQL->buildArray("select collateralId from collateral where collateralType='image' and collateralFolderId in (".join(',',@ids).")");
|
||||
WebGUI::Collateral->multiDelete(@collateralIds);
|
||||
}
|
||||
|
||||
sub table { 'collateralFolder' }
|
||||
|
||||
1;
|
||||
Loading…
Add table
Add a link
Reference in a new issue