mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-10-22 08:05:56 +02:00
Save & Publish fixes, merged from trunk r42087 and r42082
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/branches/2.1.0@42502 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
dc34d1d6e7
commit
367f229897
@ -426,8 +426,6 @@ JS;
|
|||||||
FormResponse::add("$('Form_EditForm').elements.ID.value = \"$record->ID\";");
|
FormResponse::add("$('Form_EditForm').elements.ID.value = \"$record->ID\";");
|
||||||
}
|
}
|
||||||
|
|
||||||
$title = Convert::raw2js($record->TreeTitle());
|
|
||||||
|
|
||||||
if($added = DataObjectLog::getAdded('SiteTree')) {
|
if($added = DataObjectLog::getAdded('SiteTree')) {
|
||||||
foreach($added as $page) {
|
foreach($added as $page) {
|
||||||
if($page->ID != $record->ID) $result .= $this->addTreeNodeJS($page);
|
if($page->ID != $record->ID) $result .= $this->addTreeNodeJS($page);
|
||||||
@ -447,7 +445,6 @@ JS;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FormResponse::add("$('sitetree').setNodeTitle(\"$record->ID\", \"$title\");");
|
|
||||||
$message = "Saved.";
|
$message = "Saved.";
|
||||||
|
|
||||||
|
|
||||||
@ -479,20 +476,23 @@ JS;
|
|||||||
|
|
||||||
$record->write();
|
$record->write();
|
||||||
|
|
||||||
$result .= $this->getActionUpdateJS($record);
|
// If the 'Save & Publish' button was clicked, also publish the page
|
||||||
FormResponse::status_message($message, "good");
|
if(isset($urlParams['publish']) && $urlParams['publish'] == 1) {
|
||||||
|
$this->performPublish($record);
|
||||||
FormResponse::update_status($record->Status);
|
// BUGFIX: Changed icon sometimes shows after "Save & Publish" button is clicked http://support.silverstripe.com/gsoc/ticket/31
|
||||||
|
$record->setClassName($record->ClassName);
|
||||||
|
$newClass = $record->ClassName;
|
||||||
}
|
$publishedRecord = $record->newClassInstance($newClass);
|
||||||
|
return $this->tellBrowserAboutPublicationChange($publishedRecord, "Published '$record->Title' successfully");
|
||||||
// If the 'Save & Publish' button was clicked, also publish the page
|
} else {
|
||||||
if(isset($urlParams['publish']) && $urlParams['publish'] == 1) {
|
// BUGFIX: Changed icon only shows after Save button is clicked twice http://support.silverstripe.com/gsoc/ticket/76
|
||||||
$this->performPublish($record);
|
$title = Convert::raw2js($record->TreeTitle());
|
||||||
return $this->tellBrowserAboutPublicationChange($record, "Published '$record->Title' successfully");
|
FormResponse::add("$('sitetree').setNodeTitle(\"$record->ID\", \"$title\");");
|
||||||
} else {
|
$result .= $this->getActionUpdateJS($record);
|
||||||
return FormResponse::respond();
|
FormResponse::status_message($message, "good");
|
||||||
|
FormResponse::update_status($record->Status);
|
||||||
|
return FormResponse::respond();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user