Index: classes/class.tx_templavoila_datastructure.php =================================================================== --- classes/class.tx_templavoila_datastructure.php (revision 33776) +++ classes/class.tx_templavoila_datastructure.php (working copy) @@ -114,6 +114,27 @@ abstract class tx_templavoila_datastructure { abstract public function getStoragePids(); /** + * Provides the datastructure configuration as XML + * + * @return string + */ + abstract public function getDataprotXML(); + + /** + * Provides the datastructure configuration as array + * + * @return array + */ + public function getDataprotArray() { + $arr = array(); + $ds = $this->getDataprotXML(); + if (strlen($ds) > 1) { + $arr = t3lib_div::xml2array($ds); + } + return $arr; + } + + /** * Determine whether the current user has permission to create elements based on this * datastructure or not * Index: classes/class.tx_templavoila_datastructure_dbbase.php =================================================================== --- classes/class.tx_templavoila_datastructure_dbbase.php (revision 33776) +++ classes/class.tx_templavoila_datastructure_dbbase.php (working copy) @@ -36,7 +36,12 @@ class tx_templavoila_datastructure_dbbase extends tx_templavoila_datastructure { * @param integer $uid */ public function __construct($uid) { - $this->row = t3lib_beFunc::getRecordWSOL('tx_templavoila_datastructure', $uid); + // getting the DS for the DB and make sure the workspace-overlay is performed (done internally) + if (TYPO3_MODE == 'FE') { + $this->row = $GLOBALS['TSFE']->sys_page->checkRecord('tx_templavoila_datastructure', $uid); + } else { + $this->row = t3lib_beFunc::getRecordWSOL('tx_templavoila_datastructure', $uid); + } $this->setLabel($this->row['title']); $this->setScope($this->row['scope']); @@ -61,6 +66,15 @@ class tx_templavoila_datastructure_dbbase extends tx_templavoila_datastructure { } /** + * Provides the datastructure configuration as XML + * + * @return string + */ + public function getDataprotXML() { + return $this->row['dataprot']; + } + + /** * Determine whether the current user has permission to create elements based on this * datastructure or not * Index: classes/class.tx_templavoila_datastructure_staticbase.php =================================================================== --- classes/class.tx_templavoila_datastructure_staticbase.php (revision 33776) +++ classes/class.tx_templavoila_datastructure_staticbase.php (working copy) @@ -72,6 +72,21 @@ class tx_templavoila_datastructure_staticbase extends tx_templavoila_datastructu } /** + * Provides the datastructure configuration as XML + * + * @return string + */ + public function getDataprotXML() { + $xml = ''; + if(is_readable($this->filename)) { + $xml = file_get_contents($this->filename); + } else { + // @todo find out if that happens and whether there's a "useful" reaction for that + } + return $xml; + } + + /** * Determine whether the current user has permission to create elements based on this * datastructure or not - not really useable for static datastructure but relevant for * the overall system Index: ext_tables.php =================================================================== --- ext_tables.php (revision 33776) +++ ext_tables.php (working copy) @@ -3,7 +3,7 @@ if (!defined ('TYPO3_MODE')) die ('Access denied.'); // unserializing the configuration so we can use it here: -$_EXTCONF = unserialize($_EXTCONF); +$_EXTCONF = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['templavoila']); if (TYPO3_MODE=='BE') { @@ -42,12 +42,11 @@ if (TYPO3_MODE=='BE') { t3lib_extMgm::extPath($_EXTKEY).'class.tx_templavoila_extdeveval.php', 'TemplaVoila L10N Mode Conversion Tool' ); - - // Static DS - if ($_EXTCONF['staticDS.']['enable']) { - include_once(t3lib_extMgm::extPath('templavoila') . 'classes/class.tx_staticdstools.php'); - tx_staticDStools::readStaticDsFilesIntoArray($_EXTCONF); - } +} + // Static DS +if ($_EXTCONF['staticDS.']['enable']) { + include_once(t3lib_extMgm::extPath('templavoila') . 'classes/class.tx_staticdstools.php'); + tx_staticDStools::readStaticDsFilesIntoArray($_EXTCONF); } // Adding tables: Index: mod1/index.php =================================================================== --- mod1/index.php (revision 33776) +++ mod1/index.php (working copy) @@ -2527,23 +2527,17 @@ class tx_templavoila_module1 extends t3lib_SCbase { */ protected function editingOfNewElementIsEnabled($dsUid, $toUid) { $ret = true; - $dsXML = $dsMeta = $toMeta = array(); + $dsMeta = $toMeta = array(); + + $dsRepo = t3lib_div::makeInstance('tx_templavoila_datastructureRepository'); + $ds = $dsRepo->getDatastructureByUidOrFilename($dsUid); + + $dsXML = $ds->getDataprotArray(); - if($this->staticDS) { - $ds = t3lib_div::getURL(PATH_site . $dsUid); - if( is_string($ds) ) { - $dsXML = t3lib_div::xml2array( $ds ); - } - } else { - $ds = t3lib_beFunc::getRecord('tx_templavoila_datastructure', intval($dsUid), 'uid,dataprot'); - if( is_array($ds) ) { - $dsXML = t3lib_div::xml2array( $ds['dataprot'] ); - } - } if(is_array($dsXML) && array_key_exists('meta', $dsXML)) { $dsMeta = $dsXML['meta']; } - + // @todo can be merged with the datastructure processing $to = t3lib_beFunc::getRecord('tx_templavoila_tmplobj', intval($toUid), 'uid,localprocessing'); if( is_array($to) ) { $toXML = t3lib_div::xml2array( $to['localprocessing'] ); Index: pi1/class.tx_templavoila_pi1.php =================================================================== --- pi1/class.tx_templavoila_pi1.php (revision 33776) +++ pi1/class.tx_templavoila_pi1.php (working copy) @@ -145,21 +145,17 @@ class tx_templavoila_pi1 extends tslib_pibase { $data['tx_templavoila_ds'] = $conf['ds']; $data['tx_templavoila_to'] = $conf['to']; + $dsRepo = t3lib_div::makeInstance('tx_templavoila_datastructureRepository'); + // prepare fake flexform $values = array(); foreach ($data as $k => $v) { // Make correct language identifiers here! if ($GLOBALS['TSFE']->sys_language_isocode) { - $srcPointer = $data['tx_templavoila_ds']; - if (t3lib_div::testInt($srcPointer)) { // If integer, then its a record we will look up: - $DSrec = $GLOBALS['TSFE']->sys_page->checkRecord('tx_templavoila_datastructure', $srcPointer); - $DS = t3lib_div::xml2array($DSrec['dataprot']); - } else { // Otherwise expect it to be a file: - $file = t3lib_div::getFileAbsFileName($srcPointer); - if ($file && @is_file($file)) { - $DS = t3lib_div::xml2array(t3lib_div::getUrl($file)); - } - } + + $dsObj = $dsRepo->getDatastructureByUidOrFilename($data['tx_templavoila_ds']); + $DS = $dsObj->getDataprotArray(); + if (is_array($DS)) { $langChildren = $DS['meta']['langChildren'] ? 1 : 0; $langDisabled = $DS['meta']['langDisable'] ? 1 : 0; @@ -260,17 +256,9 @@ class tx_templavoila_pi1 extends tslib_pibase { } } - // Get data structure: - $srcPointer = $row['tx_templavoila_ds']; - if (t3lib_div::testInt($srcPointer)) { // If integer, then its a record we will look up: - $DSrec = $GLOBALS['TSFE']->sys_page->checkRecord('tx_templavoila_datastructure', $srcPointer); - $DS = t3lib_div::xml2array($DSrec['dataprot']); - } else { // Otherwise expect it to be a file: - $file = t3lib_div::getFileAbsFileName($srcPointer); - if ($file && @is_file($file)) { - $DS = t3lib_div::xml2array(t3lib_div::getUrl($file)); - } - } + $dsRepo = t3lib_div::makeInstance('tx_templavoila_datastructureRepository'); + $dsObj = $dsRepo->getDatastructureByUidOrFilename($row['tx_templavoila_ds']); + $DS = $dsObj->getDataprotArray(); // If a Data Structure was found: if (is_array($DS)) { @@ -501,7 +489,7 @@ class tx_templavoila_pi1 extends tslib_pibase { foreach($DSelements as $key => $dsConf) { // Store key of DS element and the parents being handled in global register $nestedFields = ''; - if (isset($GLOBALS['TSFE']->register['tx_templavoila_pi1.current_field'])) { + if (isset($GLOBALS['TSFE']->register['tx_templavoila_pi1.current_field'])) { $nestedFields = implode(',', array($GLOBALS['TSFE']->register['tx_templavoila_pi1.current_field'], $key)); } else { $nestedFields = $key;