diff --git a/lib/WebGUI/AssetLineage.pm b/lib/WebGUI/AssetLineage.pm index e04853e5e..11eda8bc4 100644 --- a/lib/WebGUI/AssetLineage.pm +++ b/lib/WebGUI/AssetLineage.pm @@ -1015,6 +1015,43 @@ sub www_setRank { return $self->getParent->www_manageAssets(); } +#------------------------------------------------------------------- + +=head2 www_setRanks ( ) + +Utility method for the AssetManager. Reorders 1 pagefull of assets via rank. + +If the current user cannot edit the current asset, it returns the insufficient privileges page. + +Returns the user to the manage assets screen. + +=cut + +sub www_setRanks { + my $self = shift; + my $session = $self->session; + return $session->privilege->insufficient() unless $session->asset->canEdit; + my $i18n = WebGUI::International->new($session, 'Asset'); + my $pb = WebGUI::ProgressBar->new($session); + my $form = $session->form; + + $pb->start($i18n->get('Set Rank'), $session->url->extras('adminConsole/assets.gif')); + my @assetIds = $form->get( 'assetId' ); + ASSET: for my $assetId ( @assetIds ) { + my $asset = WebGUI::Asset->newByDynamicClass( $session, $assetId ); + next ASSET unless $asset; + my $rank = $form->get( $assetId . '_rank' ); + next ASSET unless $rank; # There's no such thing as zero + + $asset->setRank( $rank, sub { $pb->update(sprintf $i18n->get(shift), shift); } ); + } + + $pb->finish($session->asset->getManagerUrl); + return "redirect"; + #return $www_manageAssets(); +} + + 1; diff --git a/lib/WebGUI/Content/AssetManager.pm b/lib/WebGUI/Content/AssetManager.pm index 99e58f9cb..0a90f633c 100644 --- a/lib/WebGUI/Content/AssetManager.pm +++ b/lib/WebGUI/Content/AssetManager.pm @@ -334,37 +334,6 @@ sub www_manage { ### Do Action my @assetIds = $session->form->get( 'assetId' ); - if ( $session->form->get( 'action_delete' ) ) { - for my $assetId ( @assetIds ) { - my $asset = WebGUI::Asset->newByDynamicClass( $session, $assetId ); - next unless $asset; - $asset->trash; - } - } - elsif ( $session->form->get( 'action_cut' ) ) { - for my $assetId ( @assetIds ) { - my $asset = WebGUI::Asset->newByDynamicClass( $session, $assetId ); - next unless $asset; - $asset->cut; - } - } - elsif ( $session->form->get( 'action_copy' ) ) { - for my $assetId ( @assetIds ) { - # Copy == Duplicate + Cut - my $asset = WebGUI::Asset->newByDynamicClass( $session, $assetId); - my $newAsset = $asset->duplicate( { skipAutoCommitWorkflows => 1 } ); - $newAsset->update( { title => $newAsset->getTitle . ' (copy)' } ); - $newAsset->cut; - } - } - elsif ( $session->form->get( 'action_duplicate' ) ) { - for my $assetId ( @assetIds ) { - my $asset = WebGUI::Asset->newByDynamicClass( $session, $assetId ); - next unless $asset; - $asset->duplicate( { skipAutoCommitWorkflows => 1 } ); - } - } - # Handle autocommit workflows if (WebGUI::VersionTag->autoCommitWorkingIfEnabled($session, { allowComments => 1, @@ -428,24 +397,25 @@ ENDHTML $output .= ''; ### The page of assets - $output .= q{