Forward port fix for updating property cache on editSave with autoCommit

so that the asset does not lie about its autocommit status.
This commit is contained in:
Colin Kuskie 2009-07-08 04:29:27 +00:00
parent b89486d5f3
commit b7358fbceb
3 changed files with 26 additions and 14 deletions

View file

@ -8,6 +8,7 @@
- fixed #10560: 7.7.2 upgrade script leaves rssFromParent assets behind (Wes Morgan) - fixed #10560: 7.7.2 upgrade script leaves rssFromParent assets behind (Wes Morgan)
- fixed #10612: strange i18n, with regard to label - fixed #10612: strange i18n, with regard to label
- fixed #9935: German characters in Collaboration System - fixed #9935: German characters in Collaboration System
- fixed #10610: editing a page and editing goes away
7.7.13 7.7.13
- fixed #10574: Creating Calendar Entry - fixed #10574: Creating Calendar Entry

View file

@ -2728,7 +2728,7 @@ sub www_editSave {
} }
my $object; my $object;
if ($isNewAsset) { if ($isNewAsset) {
$object = $self->addChild({className=>$self->session->form->process("class","className")}); $object = $self->addChild({className=>$session->form->process("class","className")});
return $self->www_view unless defined $object; return $self->www_view unless defined $object;
$object->{_parent} = $self; $object->{_parent} = $self;
$object->{_properties}{url} = undef; $object->{_properties}{url} = undef;
@ -2738,15 +2738,15 @@ sub www_editSave {
$object = $self->addRevision; $object = $self->addRevision;
} }
else { else {
return $self->session->asset($self->getContainer)->www_view; return $session->asset($self->getContainer)->www_view;
} }
} }
# Process properties from form post # Process properties from form post
my $errors = $object->processPropertiesFromFormPost; my $errors = $object->processPropertiesFromFormPost;
if (ref $errors eq 'ARRAY') { if (ref $errors eq 'ARRAY') {
$self->session->stow->set('editFormErrors', $errors); $session->stow->set('editFormErrors', $errors);
if ($self->session->form->process('assetId') eq 'new') { if ($session->form->process('assetId') eq 'new') {
$object->purge; $object->purge;
return $self->www_add(); return $self->www_add();
} else { } else {
@ -2762,16 +2762,27 @@ sub www_editSave {
$object->requestAutoCommit; $object->requestAutoCommit;
} }
# else, try to to auto commit # else, try to to auto commit
elsif(WebGUI::VersionTag->autoCommitWorkingIfEnabled($self->session, { else {
override => scalar $self->session->form->process('saveAndCommit'), my $commitStatus = WebGUI::VersionTag->autoCommitWorkingIfEnabled($session, {
allowComments => 1, override => scalar $session->form->process('saveAndCommit'),
returnUrl => $self->getUrl, allowComments => 1,
}) eq 'redirect') { returnUrl => $self->getUrl,
return undef; });
$session->log->warn('editSave commitStatus: '. $commitStatus);
if ($commitStatus eq 'redirect') {
##Redirect set by tag. Return nothing to send the user over to the redirect.
return undef;
}
elsif ($commitStatus eq 'commit') {
##Commit was successful. Update the local object cache so that it will no longer
##register as locked.
$self->{_properties}{isLockedBy} = $object->{_properties}{isLockedBy} = undef;
$session->log->warn('Cleared isLockedBy');
}
} }
# Handle "saveAndReturn" button # Handle "saveAndReturn" button
if ( $self->session->form->process( "saveAndReturn" ) ne "" ) { if ( $session->form->process( "saveAndReturn" ) ne "" ) {
return $object->www_edit; return $object->www_edit;
} }
@ -2795,8 +2806,8 @@ sub www_editSave {
return $self->session->asset->$method(); return $self->session->asset->$method();
} }
$self->session->asset($object->getContainer); $session->asset($object->getContainer);
return $self->session->asset->www_view; return $session->asset->www_view;
} }

View file

@ -536,7 +536,7 @@ Sets the versioning lock to "off" so that this piece of content may be edited on
sub unsetVersionLock { sub unsetVersionLock {
my $self = shift; my $self = shift;
$self->session->db->write("update asset set isLockedBy=NULL where assetId=".$self->session->db->quote($self->getId)); $self->session->db->write("update asset set isLockedBy=NULL where assetId=?",[$self->getId]);
$self->{_properties}{isLockedBy} = undef; $self->{_properties}{isLockedBy} = undef;
$self->updateHistory("unlocked"); $self->updateHistory("unlocked");
$self->purgeCache; $self->purgeCache;