Cleanup: #11153: Determine whether Tx_Workspaces_Service_Stages::encodeStageUid and...
authorsonne <sonne@743128fe-103e-dd11-99c4-001b210b3e58>
Sun, 19 Dec 2010 17:23:26 +0000 (17:23 +0000)
committersonne <sonne@743128fe-103e-dd11-99c4-001b210b3e58>
Sun, 19 Dec 2010 17:23:26 +0000 (17:23 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/CoreProjects/workspaces/workspaces/trunk@3446 743128fe-103e-dd11-99c4-001b210b3e58

typo3/sysext/workspaces/ChangeLog
typo3/sysext/workspaces/Classes/Service/Stages.php
typo3/sysext/workspaces/Classes/Service/Tcemain.php

index f5edb33..f72e864 100644 (file)
@@ -1,3 +1,7 @@
+2010-12-19  Sonja Scholz <ss@cabag.ch>
+
+       * Cleanup: #11153: Determine whether Tx_Workspaces_Service_Stages::encodeStageUid and resolveStageUid are required
+
 2010-12-19  Tolleiv Nietsch <typo3@tolleiv.de>
 
        * Followup-to #9819: Workspace preview window - "live" and "workspace" buttons are clickable now
index aaa8524..a3ac99e 100644 (file)
@@ -165,10 +165,10 @@ class Tx_Workspaces_Service_Stages {
                                // go through custom stages records
                        foreach ($workspaceStageRecs as $workspaceStageRec) {
                                        // check if the user has permissions to the custom stage
-                               if ($GLOBALS['BE_USER']->workspaceCheckStageForCurrent($this->encodeStageUid($workspaceStageRec['uid']))) {
+                               if ($GLOBALS['BE_USER']->workspaceCheckStageForCurrent($workspaceStageRec['uid'])) {
                                                // yes, so add to return array
                                        $stagesForWSUserData[] = array(
-                                               'uid' => $this->encodeStageUid($workspaceStageRec['uid']),
+                                               'uid' => $workspaceStageRec['uid'],
                                                'title' => $GLOBALS['LANG']->sL($this->pathToLocallang . ':actionSendToStage') . ' ' . $workspaceStageRec['title']);
                                } else if ($workspaceStageRec['uid'] == self::STAGE_PUBLISH_EXECUTE_ID) {
                                                if ($GLOBALS['BE_USER']->workspacePublishAccess($this->getWorkspaceId())) {
@@ -191,27 +191,6 @@ class Tx_Workspaces_Service_Stages {
        }
 
        /**
-        * converts from versioning stage id to stage record UID
-        *
-        * @return int UID of the database record
-        */
-       public function resolveStageUid($ver_stage) {
-               return $ver_stage;
-               //return $ver_stage - $this->raiseStageIdAmount;
-       }
-
-       /**
-        * converts from stage record UID to versioning stage id
-        *
-        * @param int UID of the stage database record
-        * @return int versioning stage id
-        */
-       public function encodeStageUid($stage_uid) {
-               return $stage_uid;
-               //return $stage_uid + $this->raiseStageIdAmount;
-       }
-
-       /**
         * Gets the title of a stage.
         *
         * @param integer $ver_stage
@@ -250,7 +229,7 @@ class Tx_Workspaces_Service_Stages {
         * @return array
         */
        public function getStageRecord($stageid) {
-               return t3lib_BEfunc::getRecord('sys_workspace_stage', $this->resolveStageUid($stageid));
+               return t3lib_BEfunc::getRecord('sys_workspace_stage', $stageid);
        }
 
        /**
@@ -274,7 +253,7 @@ class Tx_Workspaces_Service_Stages {
                        reset($workspaceStageRecs);
                        while (!is_null($workspaceStageRecKey = key($workspaceStageRecs))) {
                                $workspaceStageRec = current($workspaceStageRecs);
-                               if ($workspaceStageRec['uid'] == $this->resolveStageUid($stageId)) {
+                               if ($workspaceStageRec['uid'] == $stageId) {
                                        $nextStage = next($workspaceStageRecs);
                                        break;
                                }
@@ -345,7 +324,7 @@ class Tx_Workspaces_Service_Stages {
                        end($workspaceStageRecs);
                        while (!is_null($workspaceStageRecKey = key($workspaceStageRecs))) {
                                $workspaceStageRec = current($workspaceStageRecs);
-                               if ($workspaceStageRec['uid'] == $this->resolveStageUid($stageid)) {
+                               if ($workspaceStageRec['uid'] == $stageid) {
                                        $prevStage = prev($workspaceStageRecs);
                                        break;
                                }
@@ -558,10 +537,6 @@ class Tx_Workspaces_Service_Stages {
                        throw new InvalidArgumentException($GLOBALS['LANG']->sL('LLL:EXT:workspaces/Resources/Private/Language/locallang.xml:error.stageId.integer'));
                }
 
-               if ($stageId != self::STAGE_PUBLISH_ID && $stageId != self::STAGE_EDIT_ID) {
-                       $stageId = $this->resolveStageUid($stageId);
-               }
-
                $workspaceStage = t3lib_BEfunc::getRecord(self::TABLE_STAGE, $stageId);
 
                if (is_array($workspaceStage) && isset($workspaceStage[$property])) {
index 77f91be..3c75e44 100644 (file)
@@ -64,16 +64,12 @@ class tx_Workspaces_Service_Tcemain {
         * @return void
         */
        protected function resetStageOfElements($stageId) {
-               $service = t3lib_div::makeInstance('Tx_Workspaces_Service_Stages');
-                       // @todo: remove the encode/decode functionality
-               $pseudoStageId = $service->encodeStageUid($stageId);
-
                $fields = array('t3ver_stage' => Tx_Workspaces_Service_Stages::STAGE_EDIT_ID);
 
                foreach ($this->getTcaTables() as $tcaTable) {
                        if (t3lib_BEfunc::isTableWorkspaceEnabled($tcaTable)) {
 
-                               $where = 't3ver_stage = ' . intval($pseudoStageId);
+                               $where = 't3ver_stage = ' . intval($stageId);
                                $where .= ' AND t3ver_wsid > 0 AND pid=-1';
                                $where .= t3lib_BEfunc::deleteClause($tcaTable);