remove copy and copyBranch from asset. is now AssetHelper::Copy

This commit is contained in:
Doug Bell 2011-02-23 15:34:03 -06:00
parent 734b1dea04
commit 3dbb9815f6

View file

@ -356,98 +356,6 @@ sub pasteInFork {
} ## end sub pasteInFork
#-------------------------------------------------------------------
=head2 www_copy ( )
Duplicates self, cuts duplicate, returns self->getContainer->www_view if
canEdit. Otherwise returns an AdminConsole rendered as insufficient privilege.
If with children/descendants is selected, a progress bar will be rendered.
=cut
sub www_copy {
my $self = shift;
my $session = $self->session;
my $http = $session->http;
my $redir = $self->getParent->getUrl;
return $session->privilege->insufficient unless $self->canEdit;
my $with = $session->form->get('with');
my %args;
if ($with eq 'children') {
$args{childrenOnly} = 1;
}
elsif ($with ne 'descendants') {
my $newAsset = $self->duplicate({
skipAutoCommitWorkflows => 1,
state => 'clipboard'
}
);
$newAsset->update({ title => $newAsset->getTitle . ' (copy)'});
my $result = WebGUI::VersionTag->autoCommitWorkingIfEnabled(
$session, {
allowComments => 1,
returnUrl => $redir,
}
);
$http->setRedirect($redir) unless $result eq 'redirect';
return 'redirect';
}
my $tag = WebGUI::VersionTag->getWorking($session);
if ($tag->canAutoCommit) {
$args{commit} = 1;
unless ($session->setting->get('skipCommitComments')) {
$redir = $tag->autoCommitUrl($redir);
}
}
$args{assetId} = $self->getId;
$self->forkWithStatusPage({
plugin => 'ProgressTree',
title => 'Copy Assets',
redirect => $redir,
method => 'copyInFork',
args => \%args
}
);
}
#-------------------------------------------------------------------
=head2 www_copyList ( )
Checks to see if the current user canEdit the parent containting the assets that
are being copied. If that's not true, or if the CSRF token is missing, then
return insufficient privileges.
Copies the list of assets in the C<assetId> form variable, checking each one for edit privileges.
Returns the user to either the screen set by the C<proceed> form variable, or to
the Asset Manager.
=cut
sub www_copyList {
my $self = shift;
my $session = $self->session;
return $self->session->privilege->insufficient() unless $self->canEdit && $session->form->validToken;
foreach my $assetId ($session->form->param("assetId")) {
my $asset = WebGUI::Asset->newById($session,$assetId);
if ($asset->canEdit) {
my $newAsset = $asset->duplicate({skipAutoCommitWorkflows => 1, state => 'clipboard'});
$newAsset->update({ title=>$newAsset->getTitle.' (copy)'});
}
}
if ($self->session->form->process("proceed") ne "") {
my $method = "www_".$session->form->process("proceed");
return $self->$method();
}
return $self->www_manageAssets();
}
#-------------------------------------------------------------------
=head2 www_createShortcut ( )