Index: class.tx_templavoila_api.php =================================================================== --- class.tx_templavoila_api.php (revision 28437) +++ class.tx_templavoila_api.php (working copy) @@ -113,6 +113,7 @@ var $rootTable; var $debug = false; var $allSystemWebsiteLanguages = array(); // ->loadWebsiteLanguages() will set this to content of sys_language + var $modifyReferencesInLiveWS = false; /** * The constructor. @@ -1144,6 +1145,11 @@ $dataArr = array(); $uid = t3lib_beFunc::wsMapId($destinationPointer['table'],$destinationPointer['uid']); + $containerHasWorkspaceVersion = FALSE; + if ($uid != $destinationPointer['uid']) { + $containerHasWorkspaceVersion = TRUE; + } + $dataArr[$destinationPointer['table']][$uid]['tx_templavoila_flex']['data'][$destinationPointer['sheet']][$destinationPointer['sLang']][$destinationPointer['field']][$destinationPointer['vLang']] = implode(',',$referencesArr); $flagWasSet = $this->getTCEmainRunningFlag(); @@ -1151,6 +1157,20 @@ $tce = t3lib_div::makeInstance('t3lib_TCEmain'); $tce->stripslashes_values = 0; $tce->start($dataArr,array()); + + /** + * Set workspace to 0 because: + * 1) we want shadow-records to be placed in the Live-Workspace + * 2) there's no need to create a new version of the parent-record + * 3) try to avoid issues if the same list is modified in different workspaces at the same time + */ + if ($this->modifyReferencesInLiveWS && !$containerHasWorkspaceVersion) { + if ($tce->BE_USER->groupData['allowed_languages']) { + //force access to default language - since references needs to be stored in default langauage always + $tce->BE_USER->groupData['allowed_languages'].= ',0'; + } + $tce->BE_USER->workspace = 0; + } $tce->process_datamap(); if (!$flagWasSet) $this->setTCEmainRunningFlag (FALSE); } @@ -1734,6 +1754,15 @@ } } } + + /** + * + * @param boolean $enable + * @return void + */ + public function modifyReferencesInLiveWS ( $enable=true ) { + $this->modifyReferencesInLiveWS = $enable; + } } if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/templavoila/class.tx_templavoila_api.php']) { Index: mod1/index.php =================================================================== --- mod1/index.php (revision 28437) +++ mod1/index.php (working copy) @@ -225,7 +225,9 @@ } else { $this->apiObj = t3lib_div::makeInstance('tx_templavoila_api', $this->altRoot ? $this->altRoot : 'pages'); } - + if (isset($this->modSharedTSconfig['properties']['useLiveWorkspaceForReferenceListUpdates'])) { + $this->apiObj->modifyReferencesInLiveWS(true); + } // Initialize the clipboard $this->clipboardObj =& t3lib_div::getUserObj ('&tx_templavoila_mod1_clipboard',''); $this->clipboardObj->init($this);