BUGFIX Corrected page history pane loading (fixes #7477)

This commit is contained in:
Ingo Schommer 2012-06-15 12:50:54 +02:00
parent e7ecdf4b35
commit c8052da5b8
2 changed files with 36 additions and 14 deletions

View File

@ -21,19 +21,36 @@ class CMSPageHistoryController extends CMSMain {
'$Action/$ID/$VersionID/$OtherVersionID' => 'handleAction'
);
public function getResponseNegotiator() {
$negotiator = parent::getResponseNegotiator();
$controller = $this;
$negotiator->setCallback('CurrentForm', function() use(&$controller) {
$form = $controller->ShowVersionForm($controller->getRequest()->param('VersionID'));
if($form) return $form->forTemplate();
else return $controller->renderWith($controller->getTemplatesWithSuffix('_Content'));
});
$negotiator->setCallback('default', function() use(&$controller) {
return $controller->renderWith($controller->getViewer('show'));
});
return $negotiator;
}
/**
* @return array
*/
function show($request) {
$form = $this->ShowVersionForm($request->param('VersionID'));
if($request->isAjax()) {
if($form) $content = $form->forTemplate();
else $content = $this->renderWith($this->getTemplatesWithSuffix('_Content'));
} else {
$content = $this->customise(array('EditForm' => $form))->renderWith($this->getViewer('show'));
}
return $content;
$negotiator = $this->getResponseNegotiator();
$controller = $this;
$negotiator->setCallback('CurrentForm', function() use(&$controller, &$form) {
return $form ? $form->forTemplate() : $controller->renderWith($controller->getTemplatesWithSuffix('_Content'));
});
$negotiator->setCallback('default', function() use(&$controller, &$form) {
return $controller->customise(array('EditForm' => $form))->renderWith($controller->getViewer('show'));
});
return $negotiator->respond($request);
}
/**
@ -44,12 +61,17 @@ class CMSPageHistoryController extends CMSMain {
$request->param('VersionID'),
$request->param('OtherVersionID')
);
if($request->isAjax()) {
$content = $form->forTemplate();
} else {
$content = $this->customise(array('EditForm' => $form))->renderWith($this->getViewer('show'));
}
return $content;
$negotiator = $this->getResponseNegotiator();
$controller = $this;
$negotiator->setCallback('CurrentForm', function() use(&$controller, &$form) {
return $form ? $form->forTemplate() : $controller->renderWith($controller->getTemplatesWithSuffix('_Content'));
});
$negotiator->setCallback('default', function() use(&$controller, &$form) {
return $controller->customise(array('EditForm' => $form))->renderWith($controller->getViewer('show'));
});
return $negotiator->respond($request);
}
/**

View File

@ -79,7 +79,7 @@
url = ss.i18n.sprintf(this.data('linkTmplShow'), id,to);
}
$('.cms-container').loadPanel(url, '', {selector: '.cms-edit-form'});
$('.cms-container').loadPanel(url, '', {pjax: 'CurrentForm'});
}
});