[FEATURE] Enable all workspaces tab in workspace module 45/22445/5
authorOliver Hader <oliver@typo3.org>
Sat, 20 Jul 2013 12:26:13 +0000 (14:26 +0200)
committerOliver Hader <oliver.hader@typo3.org>
Tue, 15 Oct 2013 15:43:25 +0000 (17:43 +0200)
The "all workspaces" tab currently is only available for admin
users. However, there's no need to disallow regular editors to
use this feature as well - access will be granted to workspaces
that have been defined for each particular user or group.

Besides that, actions from the "all workspaces" view need to be
handled in a special way since there is no correct
BE_USER->workspace value assigned in that case, but working with
versioned records requires to have a correct scope defined.

Change-Id: I89bfee3ad0b2ce1a5f3c12a1bd91342472b12d3d
Resolves: #50223
Releases: 6.2
Reviewed-on: https://review.typo3.org/22445
Reviewed-by: Oliver Hader
Tested-by: Oliver Hader
12 files changed:
typo3/alt_doc.php
typo3/sysext/backend/Classes/Controller/EditDocumentController.php
typo3/sysext/core/Classes/Authentication/BackendUserAuthentication.php
typo3/sysext/workspaces/Classes/Controller/AbstractController.php
typo3/sysext/workspaces/Classes/Controller/ReviewController.php
typo3/sysext/workspaces/Classes/ExtDirect/ActionHandler.php
typo3/sysext/workspaces/Classes/Service/GridDataService.php
typo3/sysext/workspaces/Classes/Service/StagesService.php
typo3/sysext/workspaces/Classes/Service/WorkspaceService.php
typo3/sysext/workspaces/Resources/Public/JavaScript/Store/mainstore.js
typo3/sysext/workspaces/Resources/Public/JavaScript/configuration.js
typo3/sysext/workspaces/Resources/Public/JavaScript/toolbar.js

index 4e5554e..4f33b66 100644 (file)
@@ -35,6 +35,7 @@
 require_once 'init.php';
 \TYPO3\CMS\Backend\Utility\BackendUtility::lockRecords();
 
+/* @var $editDocumentController \TYPO3\CMS\Backend\Controller\EditDocumentController */
 $editDocumentController = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Controller\\EditDocumentController');
 
 // Preprocessing, storing data if submitted to
index d542a4b..fdba0d0 100644 (file)
@@ -195,6 +195,13 @@ class EditDocumentController {
         */
        public $localizationMode;
 
+       /**
+        * Workspace used for the editing action.
+        *
+        * @var NULL|integer
+        */
+       protected $workspace;
+
        // Internal, static:
        /**
         * document template object
@@ -378,6 +385,7 @@ class EditDocumentController {
                $this->doSave = GeneralUtility::_GP('doSave');
                $this->returnEditConf = GeneralUtility::_GP('returnEditConf');
                $this->localizationMode = GeneralUtility::_GP('localizationMode');
+               $this->workspace = GeneralUtility::_GP('workspace');
                $this->uc = GeneralUtility::_GP('uc');
                // Setting override values as default if defVals does not exist.
                if (!is_array($this->defVals) && is_array($this->overrideVals)) {
@@ -409,6 +417,11 @@ class EditDocumentController {
                if (is_array($this->R_URL_getvars) && count($this->R_URL_getvars) < 2 && !is_array($this->editconf)) {
                        $this->setDocument($this->docDat[1]);
                }
+
+               // Sets a temporary workspace, this request is based on
+               if ($this->workspace !== NULL) {
+                       $this->getBackendUser()->setTemporaryWorkspace($this->workspace);
+               }
        }
 
        /**
@@ -1354,7 +1367,7 @@ class EditDocumentController {
         * @todo Define visibility
         */
        public function compileStoreDat() {
-               $this->storeArray = GeneralUtility::compileSelectedGetVarsFromArray('edit,defVals,overrideVals,columnsOnly,disHelp,noView,editRegularContentFromId', $this->R_URL_getvars);
+               $this->storeArray = GeneralUtility::compileSelectedGetVarsFromArray('edit,defVals,overrideVals,columnsOnly,disHelp,noView,editRegularContentFromId,workspace', $this->R_URL_getvars);
                $this->storeUrl = GeneralUtility::implodeArrayForUrl('', $this->storeArray);
                $this->storeUrlMd5 = md5($this->storeUrl);
        }
@@ -1443,4 +1456,11 @@ class EditDocumentController {
                HttpUtility::redirect($retUrl);
        }
 
+       /**
+        * @return \TYPO3\CMS\Core\Authentication\BackendUserAuthentication
+        */
+       protected function getBackendUser() {
+               return $GLOBALS['BE_USER'];
+       }
+
 }
index 12f046f..c39e792 100644 (file)
@@ -1978,12 +1978,8 @@ class BackendUserAuthentication extends \TYPO3\CMS\Core\Authentication\AbstractU
         */
        public function setWorkspace($workspaceId) {
                // Check workspace validity and if not found, revert to default workspace.
-               if ($this->workspaceRec = $this->checkWorkspace($workspaceId, '*')) {
-                       // Set workspace ID internally
-                       $this->workspace = (int) $workspaceId;
-               } else {
-                       $this->workspace = (int) $this->getDefaultWorkspace();
-                       $this->workspaceRec = $this->checkWorkspace($this->workspace, '*');
+               if (!$this->setTemporaryWorkspace($workspaceId)) {
+                       $this->setDefaultWorkspace();
                }
                // Unset access cache:
                unset($this->checkWorkspaceCurrent_cache);
@@ -1996,6 +1992,35 @@ class BackendUserAuthentication extends \TYPO3\CMS\Core\Authentication\AbstractU
        }
 
        /**
+        * Sets a temporary workspace in the context of the current backend user.
+        *
+        * @param integer $workspaceId
+        * @return boolean
+        */
+       public function setTemporaryWorkspace($workspaceId) {
+               $result = FALSE;
+               $workspaceRecord = $this->checkWorkspace($workspaceId, '*');
+
+               if ($workspaceRecord) {
+                       $this->workspaceRec = $workspaceRecord;
+                       $this->workspace = (int) $workspaceId;
+                       $result = TRUE;
+               }
+
+               return $result;
+       }
+
+       /**
+        * Sets the default workspace in the context of the current backend user.
+        *
+        * @return void
+        */
+       public function setDefaultWorkspace() {
+               $this->workspace = (int) $this->getDefaultWorkspace();
+               $this->workspaceRec = $this->checkWorkspace($this->workspace, '*');
+       }
+
+       /**
         * Setting workspace preview state for user:
         *
         * @param boolean $previewState State of user preview.
index 3135ba0..b8ebe43 100644 (file)
@@ -130,8 +130,9 @@ class AbstractController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionControl
         */
        protected function getLanguageSelection() {
                $language = 'all';
-               if (isset($GLOBALS['BE_USER']->uc['moduleData']['Workspaces'][$GLOBALS['BE_USER']->workspace]['language'])) {
-                       $language = $GLOBALS['BE_USER']->uc['moduleData']['Workspaces'][$GLOBALS['BE_USER']->workspace]['language'];
+               $backendUser = $this->getBackendUser();
+               if (isset($backendUser->uc['moduleData']['Workspaces'][$backendUser->workspace]['language'])) {
+                       $language = $backendUser->uc['moduleData']['Workspaces'][$backendUser->workspace]['language'];
                }
                return $language;
        }
@@ -150,4 +151,11 @@ class AbstractController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionControl
                return $this->objectManager->get('TYPO3\\CMS\\Workspaces\\Service\\AdditionalResourceService');
        }
 
+       /**
+        * @return \TYPO3\CMS\Core\Authentication\BackendUserAuthentication
+        */
+       protected function getBackendUser() {
+               return $GLOBALS['BE_USER'];
+       }
+
 }
index 50fff3b..1cb490d 100644 (file)
@@ -45,7 +45,7 @@ class ReviewController extends \TYPO3\CMS\Workspaces\Controller\AbstractControll
        public function indexAction() {
                $wsService = GeneralUtility::makeInstance('TYPO3\\CMS\\Workspaces\\Service\\WorkspaceService');
                $this->view->assign('showGrid', !($GLOBALS['BE_USER']->workspace === 0 && !$GLOBALS['BE_USER']->isAdmin()));
-               $this->view->assign('showAllWorkspaceTab', $GLOBALS['BE_USER']->isAdmin());
+               $this->view->assign('showAllWorkspaceTab', TRUE);
                $this->view->assign('pageUid', GeneralUtility::_GP('id'));
                $this->view->assign('showLegend', !($GLOBALS['BE_USER']->workspace === 0 && !$GLOBALS['BE_USER']->isAdmin()));
                $wsList = $wsService->getAvailableWorkspaces();
@@ -80,27 +80,31 @@ class ReviewController extends \TYPO3\CMS\Workspaces\Controller\AbstractControll
        }
 
        /**
-        * Renders the review module for admins.
+        * Renders the review module user dependent.
         * The module will show all records of all workspaces.
         *
         * @return void
         */
        public function fullIndexAction() {
+               $wsService = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Workspaces\\Service\\WorkspaceService');
+               $wsList = $wsService->getAvailableWorkspaces();
+
                if (!$GLOBALS['BE_USER']->isAdmin()) {
-                       $this->redirect('index');
-               } else {
-                       $wsService = GeneralUtility::makeInstance('TYPO3\\CMS\\Workspaces\\Service\\WorkspaceService');
-                       $this->view->assign('pageUid', GeneralUtility::_GP('id'));
-                       $this->view->assign('showGrid', TRUE);
-                       $this->view->assign('showLegend', TRUE);
-                       $this->view->assign('showAllWorkspaceTab', $GLOBALS['BE_USER']->isAdmin());
-                       $this->view->assign('workspaceList', $wsService->getAvailableWorkspaces());
-                       $this->view->assign('activeWorkspaceUid', \TYPO3\CMS\Workspaces\Service\WorkspaceService::SELECT_ALL_WORKSPACES);
-                       $this->view->assign('showPreviewLink', FALSE);
-                       $GLOBALS['BE_USER']->setAndSaveSessionData('tx_workspace_activeWorkspace', \TYPO3\CMS\Workspaces\Service\WorkspaceService::SELECT_ALL_WORKSPACES);
-                       // set flag for javascript
-                       $this->pageRenderer->addInlineSetting('Workspaces', 'allView', '1');
+                       $activeWorkspace = $GLOBALS['BE_USER']->workspace;
+                       $wsCur = array($activeWorkspace => TRUE);
+                       $wsList = array_intersect_key($wsList, $wsCur);
                }
+
+               $this->view->assign('pageUid', GeneralUtility::_GP('id'));
+               $this->view->assign('showGrid', TRUE);
+               $this->view->assign('showLegend', TRUE);
+               $this->view->assign('showAllWorkspaceTab', TRUE);
+               $this->view->assign('workspaceList', $wsList);
+               $this->view->assign('activeWorkspaceUid', \TYPO3\CMS\Workspaces\Service\WorkspaceService::SELECT_ALL_WORKSPACES);
+               $this->view->assign('showPreviewLink', FALSE);
+               $GLOBALS['BE_USER']->setAndSaveSessionData('tx_workspace_activeWorkspace', \TYPO3\CMS\Workspaces\Service\WorkspaceService::SELECT_ALL_WORKSPACES);
+               // set flag for javascript
+               $this->pageRenderer->addInlineSetting('Workspaces', 'allView', '1');
        }
 
        /**
index 2bbffe8..29063b4 100644 (file)
@@ -27,8 +27,8 @@ namespace TYPO3\CMS\Workspaces\ExtDirect;
  *  This copyright notice MUST APPEAR in all copies of the script!
  ***************************************************************/
 
-use TYPO3\CMS\Backend\Utility\BackendUtility;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
+use TYPO3\CMS\Backend\Utility\BackendUtility;
 
 /**
  * ExtDirect action handler
@@ -69,12 +69,17 @@ class ActionHandler extends \TYPO3\CMS\Workspaces\ExtDirect\AbstractHandler {
         * @todo What about reporting errors back to the ExtJS interface? /olly/
         */
        public function swapSingleRecord($table, $t3ver_oid, $orig_uid) {
+               $versionRecord = BackendUtility::getRecord($table, $orig_uid);
+               $currentWorkspace = $this->setTemporaryWorkspace($versionRecord['t3ver_wsid']);
+
                $cmd[$table][$t3ver_oid]['version'] = array(
                        'action' => 'swap',
                        'swapWith' => $orig_uid,
                        'swapIntoWS' => 1
                );
                $this->processTcaCmd($cmd);
+
+               $this->setTemporaryWorkspace($currentWorkspace);
        }
 
        /**
@@ -86,10 +91,15 @@ class ActionHandler extends \TYPO3\CMS\Workspaces\ExtDirect\AbstractHandler {
         * @todo What about reporting errors back to the ExtJS interface? /olly/
         */
        public function deleteSingleRecord($table, $uid) {
+               $versionRecord = BackendUtility::getRecord($table, $uid);
+               $currentWorkspace = $this->setTemporaryWorkspace($versionRecord['t3ver_wsid']);
+
                $cmd[$table][$uid]['version'] = array(
                        'action' => 'clearWSID'
                );
                $this->processTcaCmd($cmd);
+
+               $this->setTemporaryWorkspace($currentWorkspace);
        }
 
        /**
@@ -153,6 +163,8 @@ class ActionHandler extends \TYPO3\CMS\Workspaces\ExtDirect\AbstractHandler {
         */
        public function sendToNextStageWindow($uid, $table, $t3ver_oid) {
                $elementRecord = BackendUtility::getRecord($table, $uid);
+               $currentWorkspace = $this->setTemporaryWorkspace($elementRecord['t3ver_wsid']);
+
                if (is_array($elementRecord)) {
                        $stageId = $elementRecord['t3ver_stage'];
                        if ($this->getStageService()->isValid($stageId)) {
@@ -170,6 +182,8 @@ class ActionHandler extends \TYPO3\CMS\Workspaces\ExtDirect\AbstractHandler {
                } else {
                        $result = $this->getErrorResponse('error.sendToNextStage.noRecordFound', 1287264776);
                }
+
+               $this->setTemporaryWorkspace($currentWorkspace);
                return $result;
        }
 
@@ -182,6 +196,8 @@ class ActionHandler extends \TYPO3\CMS\Workspaces\ExtDirect\AbstractHandler {
         */
        public function sendToPrevStageWindow($uid, $table) {
                $elementRecord = BackendUtility::getRecord($table, $uid);
+               $currentWorkspace = $this->setTemporaryWorkspace($elementRecord['t3ver_wsid']);
+
                if (is_array($elementRecord)) {
                        $stageId = $elementRecord['t3ver_stage'];
                        if ($this->getStageService()->isValid($stageId)) {
@@ -203,6 +219,8 @@ class ActionHandler extends \TYPO3\CMS\Workspaces\ExtDirect\AbstractHandler {
                } else {
                        $result = $this->getErrorResponse('error.sendToNextStage.noRecordFound', 1287264765);
                }
+
+               $this->setTemporaryWorkspace($currentWorkspace);
                return $result;
        }
 
@@ -393,6 +411,10 @@ class ActionHandler extends \TYPO3\CMS\Workspaces\ExtDirect\AbstractHandler {
                $table = $parameters->affects->table;
                $uid = $parameters->affects->uid;
                $t3ver_oid = $parameters->affects->t3ver_oid;
+
+               $elementRecord = BackendUtility::getRecord($table, $uid);
+               $currentWorkspace = $this->setTemporaryWorkspace($elementRecord['t3ver_wsid']);
+
                $recipients = $this->getRecipientList($parameters->receipients, $parameters->additional, $setStageId);
                if ($setStageId == \TYPO3\CMS\Workspaces\Service\StagesService::STAGE_PUBLISH_EXECUTE_ID) {
                        $cmdArray[$table][$t3ver_oid]['version']['action'] = 'swap';
@@ -409,6 +431,8 @@ class ActionHandler extends \TYPO3\CMS\Workspaces\ExtDirect\AbstractHandler {
                $result = array(
                        'success' => TRUE
                );
+
+               $this->setTemporaryWorkspace($currentWorkspace);
                return $result;
        }
 
@@ -428,11 +452,14 @@ class ActionHandler extends \TYPO3\CMS\Workspaces\ExtDirect\AbstractHandler {
         */
        public function sendToPrevStageExecute(\stdClass $parameters) {
                $cmdArray = array();
-               $recipients = array();
                $setStageId = $parameters->affects->nextStage;
                $comments = $parameters->comments;
                $table = $parameters->affects->table;
                $uid = $parameters->affects->uid;
+
+               $elementRecord = BackendUtility::getRecord($table, $uid);
+               $currentWorkspace = $this->setTemporaryWorkspace($elementRecord['t3ver_wsid']);
+
                $recipients = $this->getRecipientList($parameters->receipients, $parameters->additional, $setStageId);
                $cmdArray[$table][$uid]['version']['action'] = 'setStage';
                $cmdArray[$table][$uid]['version']['stageId'] = $setStageId;
@@ -442,6 +469,8 @@ class ActionHandler extends \TYPO3\CMS\Workspaces\ExtDirect\AbstractHandler {
                $result = array(
                        'success' => TRUE
                );
+
+               $this->setTemporaryWorkspace($currentWorkspace);
                return $result;
        }
 
@@ -698,4 +727,32 @@ class ActionHandler extends \TYPO3\CMS\Workspaces\ExtDirect\AbstractHandler {
                return $toolbarButtons;
        }
 
-}
+       /**
+        * @param integer $workspaceId
+        * @return integer Id of the original workspace
+        * @throws \TYPO3\CMS\Core\Exception
+        */
+       protected function setTemporaryWorkspace($workspaceId) {
+               $workspaceId = (int) $workspaceId;
+               $currentWorkspace = (int) $this->getBackendUser()->workspace;
+
+               if ($currentWorkspace !== $workspaceId) {
+                       if (!$this->getBackendUser()->setTemporaryWorkspace($workspaceId)) {
+                               throw new \TYPO3\CMS\Core\Exception(
+                                       'Cannot set temporary workspace to "' . $workspaceId . '"',
+                                       1371484524
+                               );
+                       }
+               }
+
+               return $currentWorkspace;
+       }
+
+       /**
+        * @return \TYPO3\CMS\Core\Authentication\BackendUserAuthentication
+        */
+       protected function getBackendUser() {
+               return $GLOBALS['BE_USER'];
+       }
+
+}
\ No newline at end of file
index 194d0a9..7f0f5cd 100644 (file)
@@ -165,6 +165,7 @@ class GridDataService {
                                        $versionArray['workspace_Title'] = htmlspecialchars(\TYPO3\CMS\Workspaces\Service\WorkspaceService::getWorkspaceTitle($versionRecord['t3ver_wsid']));
                                        $versionArray['workspace_Tstamp'] = $versionRecord['tstamp'];
                                        $versionArray['workspace_Formated_Tstamp'] = BackendUtility::datetime($versionRecord['tstamp']);
+                                       $versionArray['t3ver_wsid'] = $versionRecord['t3ver_wsid'];
                                        $versionArray['t3ver_oid'] = $record['t3ver_oid'];
                                        $versionArray['livepid'] = $record['livepid'];
                                        $versionArray['stage'] = $versionRecord['t3ver_stage'];
index 620453f..d988ace 100644 (file)
@@ -45,12 +45,6 @@ class StagesService {
        const MODE_NOTIFY_SOMEONE = 0;
        const MODE_NOTIFY_ALL = 1;
        const MODE_NOTIFY_ALL_STRICT = 2;
-       /**
-        * Current workspace ID
-        *
-        * @var integer
-        */
-       private $workspaceId = NULL;
 
        /**
         * Path to the locallang file
@@ -84,29 +78,10 @@ class StagesService {
        /**
         * Getter for current workspace id
         *
-        * @return integer current workspace id
+        * @return integer Current workspace id
         */
        public function getWorkspaceId() {
-               if ($this->workspaceId == NULL) {
-                       $this->setWorkspaceId($GLOBALS['BE_USER']->workspace);
-               }
-               return $this->workspaceId;
-       }
-
-       /**
-        * Setter for current workspace id
-        *
-        * @param integer current workspace id
-        */
-       private function setWorkspaceId($wsid) {
-               $this->workspaceId = $wsid;
-       }
-
-       /**
-        * constructor for workspace library
-        */
-       public function __construct() {
-               $this->setWorkspaceId($GLOBALS['BE_USER']->workspace);
+               return $this->getBackendUser()->workspace;
        }
 
        /**
@@ -288,6 +263,8 @@ class StagesService {
         * Check if given workspace has custom staging activated
         *
         * @return boolean
+        * @deprecated since TYPO3 6.2, will be removed two versions later
+        * not used anymore in the TYPO3 CMS Core
         */
        public function checkCustomStagingForWS() {
                $workspaceRec = BackendUtility::getRecord('sys_workspace', $this->getWorkspaceId());
@@ -400,8 +377,8 @@ class StagesService {
        /**
         * Get next stage in process for given stage id
         *
-        * @param int                   stageid
-        * @return int                  id
+        * @param integer $stageid Id of the stage to fetch the previous one for
+        * @return integer The previous stage Id
         */
        public function getPrevStage($stageid) {
                if (!\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($stageid)) {
@@ -770,4 +747,11 @@ class StagesService {
                }
        }
 
-}
+       /**
+        * @return \TYPO3\CMS\Core\Authentication\BackendUserAuthentication
+        */
+       protected function getBackendUser() {
+               return $GLOBALS['BE_USER'];
+       }
+
+}
\ No newline at end of file
index 5cb3dba..bb993a0 100644 (file)
@@ -76,10 +76,20 @@ class WorkspaceService implements \TYPO3\CMS\Core\SingletonInterface {
         */
        public function getCurrentWorkspace() {
                $workspaceId = $GLOBALS['BE_USER']->workspace;
-               if ($GLOBALS['BE_USER']->isAdmin()) {
-                       $activeId = $GLOBALS['BE_USER']->getSessionData('tx_workspace_activeWorkspace');
-                       $workspaceId = $activeId !== NULL ? $activeId : $workspaceId;
+               $activeId = $GLOBALS['BE_USER']->getSessionData('tx_workspace_activeWorkspace');
+
+               // Avoid invalid workspace settings
+               if ($activeId !== NULL && $activeId !== self::SELECT_ALL_WORKSPACES) {
+                       $availableWorkspaces = $this->getAvailableWorkspaces();
+                       if (!isset($availableWorkspaces[$activeId])) {
+                               $activeId = NULL;
+                       }
+               }
+
+               if ($activeId !== NULL) {
+                       $workspaceId = $activeId;
                }
+
                return $workspaceId;
        }
 
@@ -518,7 +528,8 @@ class WorkspaceService implements \TYPO3\CMS\Core\SingletonInterface {
                                $versionRecord = BackendUtility::getRecord($table, $uid);
                        }
 
-                       $additionalParameters = '';
+                       $additionalParameters = '&tx_workspaces_web_workspacesworkspaces[previewWS]=' . $versionRecord['t3ver_wsid'];
+
                        $languageField = $GLOBALS['TCA'][$table]['ctrl']['languageField'];
                        if ($versionRecord[$languageField] > 0) {
                                $additionalParameters .= '&L=' . $versionRecord[$languageField];
@@ -602,7 +613,7 @@ class WorkspaceService implements \TYPO3\CMS\Core\SingletonInterface {
                $redirect = $backPath . 'index.php?redirect_url=';
                // @todo why do we need these additional params? the URIBuilder should add the controller, but he doesn't :(
                $additionalParams = '&tx_workspaces_web_workspacesworkspaces%5Bcontroller%5D=Preview&M=web_WorkspacesWorkspaces&id=';
-               $viewScript = $backPath . $uriBuilder->setArguments(array('tx_workspaces_web_workspacesworkspaces' => array('previewWS' => $GLOBALS['BE_USER']->workspace)))->uriFor('index', array(), 'TYPO3\\CMS\\Workspaces\\Controller\\PreviewController', 'workspaces', 'web_workspacesworkspaces') . $additionalParams;
+               $viewScript = $backPath . $uriBuilder->uriFor('index', array(), 'TYPO3\\CMS\\Workspaces\\Controller\\PreviewController', 'workspaces', 'web_workspacesworkspaces') . $additionalParams;
                if ($addDomain === TRUE) {
                        return BackendUtility::getViewDomain($uid) . $redirect . urlencode($viewScript) . $uid;
                } else {
index 6de8130..2403056 100644 (file)
@@ -4,6 +4,7 @@ TYPO3.Workspaces.Configuration.StoreFieldArray = [
        {name : 'table'},
        {name : 'uid', type : 'int'},
        {name : 't3ver_oid', type : 'int'},
+       {name : 't3ver_wsid', type : 'int'},
        {name : 'livepid', type : 'int'},
        {name : 'stage', type: 'int'},
        {name : 'change',type : 'int'},
index 51f4117..588c21b 100644 (file)
@@ -172,7 +172,7 @@ TYPO3.Workspaces.Configuration.SendToPrevStageButton = {
        xtype: 'actioncolumn',
        header:'',
        width: 18,
-       hidden: (TYPO3.settings.Workspaces.allView === '1'),
+       hidden: false,
        items:[
                {
                        iconCls: 't3-icon t3-icon-extensions t3-icon-extensions-workspaces t3-icon-workspaces-sendtoprevstage',
@@ -189,7 +189,7 @@ TYPO3.Workspaces.Configuration.SendToNextStageButton = {
        xtype: 'actioncolumn',
        header:'',
        width: 18,
-       hidden: (TYPO3.settings.Workspaces.allView === '1'),
+       hidden: false,
        items: [
                {},{    // empty dummy important!!!!
                        iconCls: 't3-icon t3-icon-extensions t3-icon-extensions-workspaces t3-icon-workspaces-sendtonextstage',
@@ -214,7 +214,7 @@ TYPO3.Workspaces.Configuration.Stage = {
        },
        renderer: function(value, metaData, record, rowIndex, colIndex, store) {
                var returnCode = '';
-               if (record.json.allowedAction_prevStage && TYPO3.settings.Workspaces.allView !== '1') {
+               if (record.json.allowedAction_prevStage) {
                        var tempTooltip = TYPO3.Workspaces.Configuration.SendToPrevStageButton.items[0].tooltip;
                        TYPO3.Workspaces.Configuration.SendToPrevStageButton.items[0].tooltip += ' &quot;'+ record.json.label_prevStage + '&quot;';
                        var prevButton = new Ext.grid.ActionColumn(TYPO3.Workspaces.Configuration.SendToPrevStageButton);
@@ -224,7 +224,7 @@ TYPO3.Workspaces.Configuration.Stage = {
                        returnCode += "<span class=\"t3-icon t3-icon-empty t3-icon-empty-empty\">&nbsp;</span>";
                }
                returnCode += record.json.label_Stage;
-               if (record.json.allowedAction_nextStage && TYPO3.settings.Workspaces.allView !== '1') {
+               if (record.json.allowedAction_nextStage) {
                        var tempTooltip = TYPO3.Workspaces.Configuration.SendToNextStageButton.items[1].tooltip;
                        TYPO3.Workspaces.Configuration.SendToNextStageButton.items[1].tooltip += ' &quot;'+ record.json.label_nextStage + '&quot;';
                        var nextButton = new Ext.grid.ActionColumn(TYPO3.Workspaces.Configuration.SendToNextStageButton);
@@ -253,7 +253,7 @@ TYPO3.Workspaces.Configuration.RowButtons = {
        header: TYPO3.l10n.localize('column.actions'),
        width: 80,
        hideable: false,
-       hidden: (TYPO3.settings.Workspaces.allView === '1'),
+       hidden: false,
        menuDisabled: true,
        items: [
                {
@@ -277,6 +277,10 @@ TYPO3.Workspaces.Configuration.RowButtons = {
                        handler: function(grid, rowIndex, colIndex) {
                                var record = TYPO3.Workspaces.MainStore.getAt(rowIndex);
                                var newUrl = 'alt_doc.php?returnUrl=' + encodeURIComponent(document.location.href) + '&id=' + TYPO3.settings.Workspaces.id + '&edit[' + record.json.table + '][' + record.json.uid + ']=edit';
+                               // Append workspace of record in all-workspaces view
+                               if (TYPO3.settings.Workspaces.allView) {
+                                       newUrl += '&workspace=' + record.json.t3ver_wsid;
+                               }
                                window.location.href = newUrl;
                        },
                        getClass: function(v, meta, rec) {
@@ -353,7 +357,7 @@ TYPO3.Workspaces.Configuration.SwapButton = {
        width: 18,
        menuDisabled: true,
        sortable: false,
-       hidden: (TYPO3.settings.Workspaces.allView === '1'),
+       hidden: false,
        items: [
                {
                        iconCls:'t3-icon t3-icon-actions t3-icon-actions-version t3-icon-version-swap-workspace'
index f1ff51f..91cca04 100644 (file)
@@ -308,9 +308,9 @@ TYPO3.Workspaces.Toolbar.FullTopToolbar = [
 ];
 
 TYPO3.Workspaces.Toolbar.FullBottomBar = [
-       (TYPO3.settings.Workspaces.isLiveWorkspace == true) ? {hidden: true} : TYPO3.Workspaces.Toolbar.selectStateActionCombo,
-       (TYPO3.settings.Workspaces.isLiveWorkspace == true) ? {hidden: true} : '-',
-       (TYPO3.settings.Workspaces.isLiveWorkspace == true) ? {hidden: true} : TYPO3.Workspaces.Toolbar.selectStateMassActionCombo,
+       (TYPO3.settings.Workspaces.isLiveWorkspace == true || TYPO3.settings.Workspaces.allView) ? {hidden: true} : TYPO3.Workspaces.Toolbar.selectStateActionCombo,
+       (TYPO3.settings.Workspaces.isLiveWorkspace == true || TYPO3.settings.Workspaces.allView) ? {hidden: true} : '-',
+       (TYPO3.settings.Workspaces.isLiveWorkspace == true || TYPO3.settings.Workspaces.allView) ? {hidden: true} : TYPO3.Workspaces.Toolbar.selectStateMassActionCombo,
        {xtype: 'tbfill'},
        TYPO3.Workspaces.Toolbar.Pager
 ];