diff --git a/lib/WebGUI/AssetLineage.pm b/lib/WebGUI/AssetLineage.pm index 023461c3b..357c31788 100644 --- a/lib/WebGUI/AssetLineage.pm +++ b/lib/WebGUI/AssetLineage.pm @@ -1125,82 +1125,5 @@ sub www_promote { } -#------------------------------------------------------------------- - -=head2 www_setParent ( ) - -Returns a www_manageAssets() method. Sets a new parent via the results of a form. If canEdit is False, returns an insufficient privileges page. - -=cut - -sub www_setParent { - my $self = shift; - return $self->session->privilege->insufficient() unless $self->canEdit; - my $newParent = WebGUI::Asset->newById($self->session->form->process("assetId")); - if (defined $newParent) { - my $success = $self->setParent($newParent); - return $self->session->privilege->insufficient() unless $success; - } - return $self->www_manageAssets(); - -} - -#------------------------------------------------------------------- - -=head2 www_setRank ( ) - -Returns a www_manageAssets() method. Sets a new rank via the results of a form. If canEdit is False, returns an insufficient privileges page. - -=cut - -sub www_setRank { - my $self = shift; - return $self->session->privilege->insufficient() unless $self->canEdit; - my $newRank = $self->session->form->process("rank"); - $self->setRank($newRank) if (defined $newRank); - $self->session->asset($self->getParent); - return $self->getParent->www_manageAssets(); -} - -#------------------------------------------------------------------- - -=head2 www_setRanks ( ) - -Utility method for the AssetManager. Reorders 1 pagefull of assets via rank. -AssetIds are passed in via the C form variable. - -If the current user cannot edit the current asset, or if a valid CSRF token -is not submitted with the form, 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 && $session->form->validToken; - 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->newById( $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;