MINOR Merged Translatable fixes from trunk

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/branches/2.3@75686 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Ingo Schommer 2009-04-29 23:33:56 +00:00 committed by Sam Minnee
parent 15f18179d4
commit f34259148c

View File

@ -589,10 +589,6 @@ JS;
$record->Status = ($record->Status == "New page" || $record->Status == "Saved (new)") ? "Saved (new)" : "Saved (update)"; $record->Status = ($record->Status == "New page" || $record->Status == "Saved (new)") ? "Saved (new)" : "Saved (update)";
} }
// $record->write();
if(Director::is_ajax()) { if(Director::is_ajax()) {
if($SQL_id != $record->ID) { if($SQL_id != $record->ID) {
FormResponse::add("$('sitetree').setNodeIdx(\"{$SQL_id}\", \"$record->ID\");"); FormResponse::add("$('sitetree').setNodeIdx(\"{$SQL_id}\", \"$record->ID\");");
@ -620,13 +616,17 @@ JS;
$message = _t('LeftAndMain.SAVEDUP'); $message = _t('LeftAndMain.SAVEDUP');
// Update the class instance if necessary
// Update the icon if the class has changed
if($originalClass != $record->ClassName) { if($originalClass != $record->ClassName) {
$record->setClassName( $record->ClassName ); $newClassName = $record->ClassName;
$newClass = $record->ClassName; // The records originally saved attribute was overwritten by $form->saveInto($record) before.
$record = $record->newClassInstance( $newClass ); // This is necessary for newClassInstance() to work as expected, and trigger change detection
// on the ClassName attribute
$record->setClassName($originalClass);
// Replace $record with a new instance
$record = $record->newClassInstance($newClassName);
// update the tree icon
FormResponse::add("if(\$('sitetree').setNodeIcon) \$('sitetree').setNodeIcon($record->ID, '$originalClass', '$record->ClassName');"); FormResponse::add("if(\$('sitetree').setNodeIcon) \$('sitetree').setNodeIcon($record->ID, '$originalClass', '$record->ClassName');");
} }
@ -653,9 +653,9 @@ JS;
if (isset($urlParams['publish']) && $urlParams['publish'] == 1) { if (isset($urlParams['publish']) && $urlParams['publish'] == 1) {
$record->doPublish(); $record->doPublish();
$record->setClassName($record->ClassName); // Update classname with original and get new instance (see above for explanation)
$newClass = $record->ClassName; $record->setClassName($originalClass);
$publishedRecord = $record->newClassInstance($newClass); $publishedRecord = $record->newClassInstance($record->ClassName);
return $this->tellBrowserAboutPublicationChange( return $this->tellBrowserAboutPublicationChange(
$publishedRecord, $publishedRecord,