added explicit locking

This commit is contained in:
JT Smith 2006-03-16 02:01:17 +00:00
parent e23d239e2a
commit ea09f24608
5 changed files with 39 additions and 5 deletions

View file

@ -69,7 +69,7 @@ sub addRevision {
my $newVersion = WebGUI::Asset->new($self->session,$self->getId, $self->get("className"), $now);
$newVersion->updateHistory("created revision");
$newVersion->update($self->get);
$newVersion->{isLockedBy} = $self->session->user->userId;
$newVersion->setVersionLock;
$properties->{status} = 'pending';
$newVersion->update($properties);
return $newVersion;
@ -225,6 +225,27 @@ sub updateHistory {
}
#-------------------------------------------------------------------
=head2 www_lock ()
This is the same as doing an www_editSave without changing anything. It's here so that users can lock assets if they're planning on working on them, or they're working on some of the content offline.
=cut
sub www_lock {
my $self = shift;
if (!$self->isLocked && $self->canEdit) {
$self = $self->addRevision;
}
if ($self->session->form->process("proceed") eq "manageAssets") {
$self->session->asset($self->getParent);
return $self->session->asset->www_manageAssets;
}
$self->session->asset($self->getContainer);
return $self->session->asset->www_view;
}
#-------------------------------------------------------------------
=head2 www_manageRevisions ()