From 532166f4f5ea2850d6ac17d0aa680c2d20c89493 Mon Sep 17 00:00:00 2001 From: Sam Minnee Date: Wed, 13 Oct 2010 04:15:18 +0000 Subject: [PATCH] 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 --- code/CMSMain.php | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/code/CMSMain.php b/code/CMSMain.php index 192e433d..a05f2b4d 100755 --- a/code/CMSMain.php +++ b/code/CMSMain.php @@ -100,8 +100,16 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr 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); Requirements::customScript("window.name = windowName('cms');"); return $nav['items']; @@ -924,7 +932,11 @@ JS; SSViewer::setOption('rewriteHashlinks', false); if($this->isAjax()) { - return $form->formHtmlContent(); + $content = $form->formHtmlContent(); + if($this->ShowSwitchView()) { + $content .= '
' . $this->SwitchView($record) . '
'; + } + return $content; } else { $templateData = $this->customise(array( "EditForm" => $form