mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-06-26 22:49:38 +02:00
Actually merge in Save & Publish, don't just pretend to
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/branches/2.1.0@42286 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
d71d3c2253
commit
73b5103a78
|
@ -315,7 +315,7 @@ JS;
|
|||
}
|
||||
|
||||
if($record->canEdit()) {
|
||||
$actions->push(new FormAction('save','Save draft'));
|
||||
$actions->push(new FormAction('save','Save'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -393,15 +393,6 @@ JS;
|
|||
return "admin/$action";
|
||||
}
|
||||
|
||||
public function publish($urlParams, $form) {
|
||||
$id = $_REQUEST['ID'];
|
||||
$record = DataObject::get_by_id("SiteTree", $id);
|
||||
$form->saveInto($record);
|
||||
$this->performPublish($record);
|
||||
|
||||
return $this->tellBrowserAboutPublicationChange($record, "Published '$record->Title' successfully");
|
||||
}
|
||||
|
||||
public function deletefromlive($urlParams, $form) {
|
||||
$id = $_REQUEST['ID'];
|
||||
Versioned::reading_stage('Live');
|
||||
|
|
|
@ -353,7 +353,7 @@ JS;
|
|||
|
||||
|
||||
/**
|
||||
* Save page handler
|
||||
* Save and Publish page handler
|
||||
*/
|
||||
public function save($urlParams, $form) {
|
||||
$className = $this->stat('tree_class');
|
||||
|
@ -487,7 +487,13 @@ JS;
|
|||
|
||||
}
|
||||
|
||||
return FormResponse::respond();
|
||||
// If the 'Save & Publish' button was clicked, also publish the page
|
||||
if(isset($urlParams['publish']) && $urlParams['publish'] == 1) {
|
||||
$this->performPublish($record);
|
||||
return $this->tellBrowserAboutPublicationChange($record, "Published '$record->Title' successfully");
|
||||
} else {
|
||||
return FormResponse::respond();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,13 +1,6 @@
|
|||
function action_publish_right() {
|
||||
$('Form_EditForm').notify('BeforeSave');
|
||||
Ajax.SubmitForm('Form_EditForm', 'action_publish', {
|
||||
onSuccess : function(response) {
|
||||
Ajax.Evaluator(response);
|
||||
},
|
||||
onFailure : function(response) {
|
||||
errorMessage('Error publishing content', response);
|
||||
}
|
||||
});
|
||||
var publish = true;
|
||||
$('Form_EditForm').save(false, null, 'save', publish);
|
||||
}
|
||||
function action_revert_right() {
|
||||
Ajax.SubmitForm('Form_EditForm', 'action_revert', {
|
||||
|
|
|
@ -129,8 +129,10 @@ CMSForm.prototype = {
|
|||
/**
|
||||
* Save the contens of the form, by submitting it and resetting is changed checker
|
||||
* on success.
|
||||
*
|
||||
* @param publish boolean (optional) whether to publish in addition to saving
|
||||
*/
|
||||
save: function(ifChanged, callAfter, action) {
|
||||
save: function(ifChanged, callAfter, action, publish) {
|
||||
_AJAX_LOADING = true;
|
||||
if(typeof tinyMCE != 'undefined') tinyMCE.triggerSave();
|
||||
if(!action) action = "save";
|
||||
|
@ -160,6 +162,10 @@ CMSForm.prototype = {
|
|||
} else {
|
||||
var data = this.serializeAllFields() + '&ajax=1&action_' + action + '=1';
|
||||
}
|
||||
if(publish)
|
||||
{
|
||||
data += '&publish=1';
|
||||
}
|
||||
|
||||
statusMessage("Saving...", null, true);
|
||||
new Ajax.Request(this.action, {
|
||||
|
|
Loading…
Reference in New Issue
Block a user