[BUGFIX] Preview links are shown for deleted pages 71/30471/2
authorOliver Hader <oliver@typo3.org>
Wed, 28 May 2014 12:03:56 +0000 (14:03 +0200)
committerSteffen Ritter <info@rs-websystems.de>
Thu, 12 Jun 2014 14:25:11 +0000 (16:25 +0200)
Preview links should not be shown in the backend, if pages are
deleted in a workspace. Currently both page tree context menu
and workspaces module offer a preview for deleted pages which
results in a "broken rootline" error once being clicked.

Resolves: #59142
Releases: 6.2
Change-Id: Id398ace2deb7dc6f000c7960d23f940b694d6229
Reviewed-on: https://review.typo3.org/30471
Reviewed-by: Wouter Wolters
Reviewed-by: Krzysztof Adamczyk
Tested-by: Krzysztof Adamczyk
Reviewed-by: Zbigniew Jacko
Tested-by: Zbigniew Jacko
Reviewed-by: Steffen Ritter
Tested-by: Steffen Ritter
typo3/sysext/backend/Classes/Tree/Pagetree/PagetreeNode.php
typo3/sysext/workspaces/Classes/Service/WorkspaceService.php

index 228c77d..eb2e180 100644 (file)
@@ -253,7 +253,6 @@ class PagetreeNode extends \TYPO3\CMS\Backend\Tree\ExtDirectNode {
                        $this->canCreate($this->record)
                        && !VersionState::cast($this->record['t3ver_state'])->equals(VersionState::DELETE_PLACEHOLDER)
                        && $GLOBALS['BE_USER']->checkLanguageAccess(0)
-
                );
        }
 
@@ -320,7 +319,7 @@ class PagetreeNode extends \TYPO3\CMS\Backend\Tree\ExtDirectNode {
         * @return boolean
         */
        public function canBeViewed() {
-               return TRUE;
+               return !$this->isDeleted();
        }
 
        /**
@@ -342,6 +341,18 @@ class PagetreeNode extends \TYPO3\CMS\Backend\Tree\ExtDirectNode {
        }
 
        /**
+        * Determines whether this node is deleted.
+        *
+        * @return bool
+        */
+       public function isDeleted() {
+               return (
+                       !empty($this->record['deleted'])
+                       || VersionState::cast($this->record['t3ver_state'])->equals(VersionState::DELETE_PLACEHOLDER)
+               );
+       }
+
+       /**
         * Returns the calculated id representation of this node
         *
         * @param string $prefix Defaults to 'p'
index 872cf04..da98278 100644 (file)
@@ -567,7 +567,10 @@ class WorkspaceService implements \TYPO3\CMS\Core\SingletonInterface {
                if ($pageUid > 0 && $workspaceUid > 0) {
                        $pageRecord = BackendUtility::getRecord('pages', $pageUid);
                        BackendUtility::workspaceOL('pages', $pageRecord, $workspaceUid);
-                       if (!\TYPO3\CMS\Core\Utility\GeneralUtility::inList($GLOBALS['TYPO3_CONF_VARS']['FE']['content_doktypes'], $pageRecord['doktype'])) {
+                       if (
+                               !GeneralUtility::inList($GLOBALS['TYPO3_CONF_VARS']['FE']['content_doktypes'], $pageRecord['doktype'])
+                               || VersionState::cast($pageRecord['t3ver_state'])->equals(VersionState::DELETE_PLACEHOLDER)
+                       ) {
                                $result = FALSE;
                        }
                } else {