From fb16cc63f61e31dc9a9ee32721162138edb8a70d Mon Sep 17 00:00:00 2001 From: Mateusz Uzdowski Date: Wed, 24 Mar 2010 20:33:27 +0000 Subject: [PATCH] BUGFIX: put back into the SSNavigator the archived site link (#5251) git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/branches/2.4@101623 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- code/CMSMain.php | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/code/CMSMain.php b/code/CMSMain.php index 35d8cd03..b006956e 100755 --- a/code/CMSMain.php +++ b/code/CMSMain.php @@ -118,8 +118,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']; @@ -916,12 +924,14 @@ JS; if(Director::is_ajax()) { $result = $templateData->renderWith($this->class . '_right'); $parts = split(']*>', $result); - return $parts[sizeof($parts)-2]; + $content = $parts[sizeof($parts)-2]; + if($this->ShowSwitchView()) { + $content .= '
' . $this->SwitchView($record) . '
'; + } + return $content; } else { return $templateData->renderWith('LeftAndMain'); } - - } }