BUGFIX #6939: fixed bug that disable a newly created page from doing futher action and left hand menu lost js handler

This commit is contained in:
Normann Lou 2012-03-12 18:32:25 +13:00 committed by Ingo Schommer
parent f56e39e521
commit 50b4605b30

View File

@ -123,14 +123,14 @@ class CMSPageAddController extends CMSPageEditController {
$record = $this->getNewItem("new-$className-$parentID".$suffix, false);
if(class_exists('Translatable') && $record->hasExtension('Translatable')) $record->Locale = $data['Locale'];
$record->write();
$this->setCurrentPageID($record->ID);
$editController = singleton('CMSPageEditController');
$editController->setCurrentPageID($record->ID);
$link = Controller::join_links(singleton('CMSPageEditController')->Link('show'), $record->ID);
$this->getResponse()->addHeader('X-ControllerURL', $link);
if(Director::is_ajax()) {
return $this->renderWith(array_pop($this->getTemplatesWithSuffix('_Content')));
return $editController->renderWith(array_pop($editController->getTemplatesWithSuffix('_Content')));
} else {
return $this->redirect($link);
}