Permalink
Browse files

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
  • Loading branch information...
1 parent dc34d1d commit 367f2298972137ba9c1c1c1acc0ed3ae951303bf @ajoneil ajoneil committed with sminnee Sep 24, 2007
Showing with 17 additions and 17 deletions.
  1. +17 −17 code/LeftAndMain.php
View
@@ -425,8 +425,6 @@ public function save($urlParams, $form) {
FormResponse::add("$('sitetree').setNodeIdx(\"$id\", \"$record->ID\");");
FormResponse::add("$('Form_EditForm').elements.ID.value = \"$record->ID\";");
}
-
- $title = Convert::raw2js($record->TreeTitle());
if($added = DataObjectLog::getAdded('SiteTree')) {
foreach($added as $page) {
@@ -447,7 +445,6 @@ public function save($urlParams, $form) {
}
}
- FormResponse::add("$('sitetree').setNodeTitle(\"$record->ID\", \"$title\");");
$message = "Saved.";
@@ -479,20 +476,23 @@ public function save($urlParams, $form) {
$record->write();
- $result .= $this->getActionUpdateJS($record);
- FormResponse::status_message($message, "good");
-
- FormResponse::update_status($record->Status);
-
-
- }
-
- // 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();
+ // If the 'Save & Publish' button was clicked, also publish the page
+ if(isset($urlParams['publish']) && $urlParams['publish'] == 1) {
+ $this->performPublish($record);
+ // 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");
+ } else {
+ // BUGFIX: Changed icon only shows after Save button is clicked twice http://support.silverstripe.com/gsoc/ticket/76
+ $title = Convert::raw2js($record->TreeTitle());
+ FormResponse::add("$('sitetree').setNodeTitle(\"$record->ID\", \"$title\");");
+ $result .= $this->getActionUpdateJS($record);
+ FormResponse::status_message($message, "good");
+ FormResponse::update_status($record->Status);
+ return FormResponse::respond();
+ }
}
}

0 comments on commit 367f229

Please sign in to comment.