*** empty log message ***
authorKasper Skårhøj <kasper@typo3.org>
Fri, 4 Nov 2005 19:45:05 +0000 (19:45 +0000)
committerKasper Skårhøj <kasper@typo3.org>
Fri, 4 Nov 2005 19:45:05 +0000 (19:45 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@841 709f56b5-9817-0410-a4d7-c38de5d9e867

TODO.txt
typo3/sysext/impexp/class.tx_impexp.php

index bb5ede9..e8cc024 100755 (executable)
--- a/TODO.txt
+++ b/TODO.txt
@@ -304,10 +304,14 @@ SQLengine (t3lib_sqlengine):
 Versioning/Workspaces:
 *******************************
 - Running the TemplaVoila wizard in workspace?
-- Dual-view preview?
+
+
+- Dual-view preview? + publishing, raise state? + diff-view inline?
 - Web > Versioning:
        - Raising state for all records on a page and using same comment for all + send only one notification email per instance.
        - "Publish / Swap all" - link
+- Show workspace in icon-title-text
+
 
 - Documentation:
        - Finish screenshots for "Inside TYPO3"
index 3952741..d6c1d12 100755 (executable)
@@ -1777,12 +1777,7 @@ class tx_impexp {
 
                                // If the record has been written and received a new id, then proceed:
                        if (is_array($this->import_mapId[$table]) && isset($this->import_mapId[$table][$uid]))  {
-                               $thisNewUid = $this->import_mapId[$table][$uid];
-
-                                       // If the new versions are made in a workspace we must further remap the uids:
-                               if ($newVersionRec = t3lib_BEfunc::getWorkspaceVersionOfRecord($GLOBALS['BE_USER']->workspace, $table, $thisNewUid, 'uid'))     {
-                                       $thisNewUid = $newVersionRec['uid'];
-                               }
+                               $thisNewUid = $this->wsMapId($table,$this->import_mapId[$table][$uid]);
 
                                if (is_array($this->dat['records'][$table.':'.$uid]['rels']))   {
                                        reset($this->dat['records'][$table.':'.$uid]['rels']);
@@ -1887,7 +1882,8 @@ class tx_impexp {
 
                                // If the record has been written and received a new id, then proceed:
                        if (is_array($this->import_mapId[$table]) && isset($this->import_mapId[$table][$uid]))  {
-                               $thisNewUid = $this->import_mapId[$table][$uid];
+                               $thisNewUid = $this->wsMapId($table,$this->import_mapId[$table][$uid]);
+
                                if (is_array($this->dat['records'][$table.':'.$uid]['rels']))   {
                                        reset($this->dat['records'][$table.':'.$uid]['rels']);
                                        t3lib_div::loadTCA($table);
@@ -2025,7 +2021,7 @@ class tx_impexp {
                                                }
 
                                                        // The new id:
-                                               $thisNewUid = $this->import_mapId[$table][$uid];
+                                               $thisNewUid = $this->wsMapId($table,$this->import_mapId[$table][$uid]);
 
                                                        // Now, if there are any fields that require substitution to be done, lets go for that:
                                                foreach($fieldsIndex as $field => $softRefCfgs) {
@@ -2157,7 +2153,7 @@ class tx_impexp {
                                                                        // Trying to map database element if found in the mapID array:
                                                                list($tempTable,$tempUid) = explode(':',$cfg['subst']['recordRef']);
                                                                if (isset($this->import_mapId[$tempTable][$tempUid]))   {
-                                                                       $insertValue = $this->import_mapId[$tempTable][$tempUid];
+                                                                       $insertValue = $this->wsMapId($tempTable,$this->import_mapId[$tempTable][$tempUid]);
 
                                                                                // Look if reference is to a page and the original token value was NOT an integer - then we assume is was an alias and try to look up the new one!
                                                                        if ($tempTable==='pages' && !t3lib_div::testInt($cfg['subst']['tokenValue']))   {
@@ -3528,7 +3524,20 @@ class tx_impexp {
                return $this->fileProcObj;
        }
 
-
+       /**
+        * Performs mapping of new uids to new versions UID in case of import inside a workspace.
+        *
+        * @param       string          Table name
+        * @param       integer         Record uid (of live record placeholder)
+        * @return      integer         Uid of offline version if any, otherwise live uid.
+        */
+       function wsMapId($table,$uid)   {
+               if ($wsRec = t3lib_BEfunc::getWorkspaceVersionOfRecord($GLOBALS['BE_USER']->workspace,$table,$uid,'uid'))       {
+                       return $wsRec['uid'];
+               } else {
+                       return $uid;
+               }
+       }