From bf23d6955e0da5346f803b104ca7bfdb680e4e34 Mon Sep 17 00:00:00 2001 From: tolleiv Date: Tue, 22 Feb 2011 22:36:10 +0000 Subject: [PATCH] Fixed bug #12855: Generate preview link visible in Live-Workspace and on non-content pages git-svn-id: https://svn.typo3.org/TYPO3v4/CoreProjects/workspaces/workspaces/trunk@4172 743128fe-103e-dd11-99c4-001b210b3e58 --- typo3/sysext/workspaces/ChangeLog | 5 +++++ .../Classes/Controller/ReviewController.php | 2 ++ .../workspaces/Classes/Service/Workspaces.php | 21 +++++++++++++++++++ .../Resources/Private/Layouts/module.html | 2 +- 4 files changed, 29 insertions(+), 1 deletion(-) diff --git a/typo3/sysext/workspaces/ChangeLog b/typo3/sysext/workspaces/ChangeLog index 10e0316a4a03..dd2d2561e41c 100644 --- a/typo3/sysext/workspaces/ChangeLog +++ b/typo3/sysext/workspaces/ChangeLog @@ -1,4 +1,9 @@ +2011-02-22 Tolleiv Nietsch + + * Fixed bug #12855: Generate preview link visible in Live-Workspace and on non-content pages + 2011-02-21 Marco Bresch + * Fixed bug #13074: missing cache_frontend configuration 2011-02-20 Tolleiv Nietsch diff --git a/typo3/sysext/workspaces/Classes/Controller/ReviewController.php b/typo3/sysext/workspaces/Classes/Controller/ReviewController.php index ccace34b03aa..98b7de4b20f5 100644 --- a/typo3/sysext/workspaces/Classes/Controller/ReviewController.php +++ b/typo3/sysext/workspaces/Classes/Controller/ReviewController.php @@ -65,6 +65,7 @@ class Tx_Workspaces_Controller_ReviewController extends Tx_Workspaces_Controller $this->view->assign('workspaceList', $wsList); $this->view->assign('activeWorkspaceUid', $activeWorkspace); $this->view->assign('activeWorkspaceTitle', tx_Workspaces_Service_Workspaces::getWorkspaceTitle($activeWorkspace)); + $this->view->assign('showPreviewLink', $wsService->canCreatePreviewLink( t3lib_div::_GP('id'), $activeWorkspace)); $GLOBALS['BE_USER']->setAndSaveSessionData('tx_workspace_activeWorkspace', $activeWorkspace); } @@ -85,6 +86,7 @@ class Tx_Workspaces_Controller_ReviewController extends Tx_Workspaces_Controller $this->view->assign('showAllWorkspaceTab', $GLOBALS['BE_USER']->isAdmin()); $this->view->assign('workspaceList', $wsService->getAvailableWorkspaces()); $this->view->assign('activeWorkspaceUid', tx_Workspaces_Service_Workspaces::SELECT_ALL_WORKSPACES); + $this->view->assign('showPreviewLink', FALSE); $GLOBALS['BE_USER']->setAndSaveSessionData('tx_workspace_activeWorkspace', tx_Workspaces_Service_Workspaces::SELECT_ALL_WORKSPACES); // set flag for javascript $this->pageRenderer->addInlineSetting('Workspaces', 'allView', '1'); diff --git a/typo3/sysext/workspaces/Classes/Service/Workspaces.php b/typo3/sysext/workspaces/Classes/Service/Workspaces.php index 985e2ce53329..e4753df3da0e 100644 --- a/typo3/sysext/workspaces/Classes/Service/Workspaces.php +++ b/typo3/sysext/workspaces/Classes/Service/Workspaces.php @@ -503,6 +503,27 @@ class tx_Workspaces_Service_Workspaces { } return $viewUrl; } + + /** + * Determine whether this page for the current + * + * @param $pageUid + * @param $workspaceUid + * @return void + */ + public function canCreatePreviewLink($pageUid, $workspaceUid) { + $result = TRUE; + if ($pageUid > 0 && $workspaceUid > 0) { + $pageRecord = t3lib_BEfunc::getRecord('pages', $pageUid); + t3lib_BEfunc::workspaceOL('pages', $pageRecord, $workspaceUid); + if (!t3lib_div::inList($GLOBALS['TYPO3_CONF_VARS']['FE']['content_doktypes'], $pageRecord['doktype'])) { + $result = FALSE; + } + } else { + $result = FALSE; + } + return $result; + } } diff --git a/typo3/sysext/workspaces/Resources/Private/Layouts/module.html b/typo3/sysext/workspaces/Resources/Private/Layouts/module.html index a096d75caec1..14d68ebe0aac 100644 --- a/typo3/sysext/workspaces/Resources/Private/Layouts/module.html +++ b/typo3/sysext/workspaces/Resources/Private/Layouts/module.html @@ -4,7 +4,7 @@