BUGFIX: put back into the SSNavigator the archived site link (#5251) (from r101623)

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@112168 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Sam Minnee 2010-10-13 04:15:18 +00:00
parent 5b15f9e9e9
commit 532166f4f5

View File

@ -100,8 +100,16 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
return true; return true;
} }
function SwitchView() { /**
if($page = $this->currentPage()) { * Overloads the LeftAndMain::ShowView. Allows to pass a page as a parameter, so we are able
* to switch view also for archived versions.
*/
function SwitchView($page = null) {
if(!$page) {
$page = $this->currentPage();
}
if($page) {
$nav = SilverStripeNavigator::get_for_record($page); $nav = SilverStripeNavigator::get_for_record($page);
Requirements::customScript("window.name = windowName('cms');"); Requirements::customScript("window.name = windowName('cms');");
return $nav['items']; return $nav['items'];
@ -924,7 +932,11 @@ JS;
SSViewer::setOption('rewriteHashlinks', false); SSViewer::setOption('rewriteHashlinks', false);
if($this->isAjax()) { if($this->isAjax()) {
return $form->formHtmlContent(); $content = $form->formHtmlContent();
if($this->ShowSwitchView()) {
$content .= '<div id="AjaxSwitchView">' . $this->SwitchView($record) . '</div>';
}
return $content;
} else { } else {
$templateData = $this->customise(array( $templateData = $this->customise(array(
"EditForm" => $form "EditForm" => $form