Fixed bug #12855: Generate preview link visible in Live-Workspace and on non-content...
authortolleiv <tolleiv@743128fe-103e-dd11-99c4-001b210b3e58>
Tue, 22 Feb 2011 22:36:10 +0000 (22:36 +0000)
committertolleiv <tolleiv@743128fe-103e-dd11-99c4-001b210b3e58>
Tue, 22 Feb 2011 22:36:10 +0000 (22:36 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/CoreProjects/workspaces/workspaces/trunk@4172 743128fe-103e-dd11-99c4-001b210b3e58

typo3/sysext/workspaces/ChangeLog
typo3/sysext/workspaces/Classes/Controller/ReviewController.php
typo3/sysext/workspaces/Classes/Service/Workspaces.php
typo3/sysext/workspaces/Resources/Private/Layouts/module.html

index 10e0316..dd2d256 100644 (file)
@@ -1,4 +1,9 @@
+2011-02-22  Tolleiv Nietsch  <typo3@tolleiv.de>
+
+       * Fixed bug #12855: Generate preview link visible in Live-Workspace and on non-content pages
+
 2011-02-21  Marco Bresch <typo3@starfinanz.de>
+
        * Fixed bug #13074: missing cache_frontend configuration
 
 2011-02-20  Tolleiv Nietsch  <typo3@tolleiv.de>
index ccace34..98b7de4 100644 (file)
@@ -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');
index 985e2ce..e4753df 100644 (file)
@@ -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;
+       }
 }
 
 
index a096d75..14d68eb 100644 (file)
@@ -4,7 +4,7 @@
 <div id="typo3-docheader">
 <div id="typo3-docheader-row1">
 <div class="buttonsleft">
-       <f:if condition="{pageUid} > 0">
+       <f:if condition="{showPreviewLink}">
                <a href="#" onclick="TYPO3.Workspaces.Actions.generateWorkspacePreviewLink();return false;" title="Generate page preview" id="goPreviewLinkButton"><span class="t3-icon t3-icon-extensions t3-icon-extensions-workspaces t3-icon-workspaces-generatepreviewlink">&nbsp;</span>Generate Workspace Preview Link</a>
        </f:if>
 </div>