Change www_delete and www_cut to use either the container, or the parent
as the asset to return the user to after their actions. Subclass getContainer in the Story, and alias it to getArchive. Fixes bug 10657.
This commit is contained in:
parent
194e98d937
commit
92815bb75d
5 changed files with 37 additions and 7 deletions
|
|
@ -311,6 +311,15 @@ sub getAutoCommitWorkflowId {
|
|||
return undef;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 getContainer ( )
|
||||
|
||||
Returns the archive for this story, instead of the folder.
|
||||
|
||||
=cut
|
||||
|
||||
BEGIN { *getContainer = *getArchive }
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
|
|
|
|||
|
|
@ -336,7 +336,8 @@ sub www_createShortcut {
|
|||
|
||||
=head2 www_cut ( )
|
||||
|
||||
Cuts (removes to clipboard) self, returns the www_view of the Parent if canEdit. Otherwise returns AdminConsole rendered insufficient privilege.
|
||||
If the current user canEdit, it puts $self into the clipboard and calls www_view on it's container.
|
||||
Otherwise returns AdminConsole rendered insufficient privilege.
|
||||
|
||||
=cut
|
||||
|
||||
|
|
@ -346,8 +347,14 @@ sub www_cut {
|
|||
return $self->session->privilege->vitalComponent
|
||||
if $self->get('isSystem');
|
||||
$self->cut;
|
||||
$self->session->asset($self->getParent);
|
||||
return $self->getParent->www_view;
|
||||
my $asset = $self->getContainer;
|
||||
if ($self->getId eq $asset->getId) {
|
||||
$asset = $self->getParent;
|
||||
}
|
||||
$self->session->asset($asset);
|
||||
return $asset->www_view;
|
||||
|
||||
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -303,7 +303,8 @@ sub _invokeWorkflowOnExportedFiles {
|
|||
|
||||
=head2 www_delete
|
||||
|
||||
Moves self to trash, returns www_view() method of Parent if canEdit. Otherwise returns AdminConsole rendered insufficient privilege.
|
||||
Moves self to trash, returns www_view() method of Container or Parent if canEdit.
|
||||
Otherwise returns AdminConsole rendered insufficient privilege.
|
||||
|
||||
=cut
|
||||
|
||||
|
|
@ -313,8 +314,12 @@ sub www_delete {
|
|||
return $self->session->privilege->vitalComponent() if $self->get('isSystem');
|
||||
return $self->session->privilege->vitalComponent() if (isIn($self->getId, $self->session->setting->get("defaultPage"), $self->session->setting->get("notFoundPage")));
|
||||
$self->trash;
|
||||
$self->session->asset($self->getParent);
|
||||
return $self->getParent->www_view;
|
||||
my $asset = $self->getContainer;
|
||||
if ($self->getId eq $asset->getId) {
|
||||
$asset = $self->getParent;
|
||||
}
|
||||
$self->session->asset($asset);
|
||||
return $asset->www_view;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue