Index: mod1/class.tx_templavoila_mod1_wizards.php =================================================================== --- mod1/class.tx_templavoila_mod1_wizards.php (revision 27850) +++ mod1/class.tx_templavoila_mod1_wizards.php (working copy) @@ -253,6 +253,9 @@ $storageFolderPID = $this->apiObj->getStorageFolderPid($positionPid); $tmplHTML = array(); + $disallowedPageTemplateItems = $this->getDisallowedTSconfigItemsByFieldName ($positionPid, 'tx_templavoila_ds'); + $disallowedDesignTemplateItems = $this->getDisallowedTSconfigItemsByFieldName ($positionPid, 'tx_templavoila_to'); + switch ($templateType) { case 'tmplobj': // Create the "Default template" entry @@ -265,12 +268,17 @@ $tTO = 'tx_templavoila_tmplobj'; $tDS = 'tx_templavoila_datastructure'; - $where = $tTO . '.parent=0 AND ' . $tTO . '.pid=' . - intval($storageFolderPID).' AND ' . $tDS . '.scope=1' . - $this->buildRecordWhere($tTO) . $this->buildRecordWhere($tDS) . - t3lib_befunc::deleteClause ($tTO).t3lib_befunc::deleteClause ($tDS). - t3lib_BEfunc::versioningPlaceholderClause($tTO).t3lib_BEfunc::versioningPlaceholderClause($tDS); - + $where = $tTO . '.parent=0 AND ' . + $tTO . '.pid=' . intval($storageFolderPID) . ' AND ' . + ( $disallowedDesignTemplateItems ? $tTO . '.uid NOT IN(' . $disallowedDesignTemplateItems . ') AND ' : '' ) . + ( $disallowedPageTemplateItems ? $tDS . '.uid NOT IN(' . $disallowedPageTemplateItems . ') AND ' : '' ) . + $tDS . '.scope=1 ' . + $this->buildRecordWhere ($tTO) . + $this->buildRecordWhere ($tDS) . + t3lib_befunc::deleteClause ($tTO) . + t3lib_befunc::deleteClause ($tDS) . + t3lib_BEfunc::versioningPlaceholderClause($tTO) . + t3lib_BEfunc::versioningPlaceholderClause($tDS); $res = $TYPO3_DB->exec_SELECTquery ( $tTO . '.*', $tTO . ' LEFT JOIN ' . $tDS . ' ON ' . $tTO . '.datastructure = ' . $tDS . '.uid', @@ -433,6 +441,32 @@ } return (count($result) > 0 ? ' AND ' . $table . '.uid NOT IN (' . implode(',', $result) . ') ' : ''); } + + + /** + * Extract the disallowed TCAFORM field values of $fieldName given field + * + * @param integer $parentPageId + * @param string field name of TCAFORM + * @access private + * @return string comma seperated list of integer + */ + function getDisallowedTSconfigItemsByFieldName($parentPageId, $fieldName) { + + $disallowPageTemplateItems = ''; + $disallowPageTemplateList = array(); + + // Get PageTSconfig for reduce the output of selectded template structs + $disallowPageTemplateStruct = t3lib_BEfunc::getModTSconfig(abs($parentPageId), 'TCEFORM.pages.' . $fieldName); + + if ( isset($disallowPageTemplateStruct['properties']['removeItems']) ) { + $disallowedPageTemplateList = $disallowPageTemplateStruct['properties']['removeItems']; + } + + $tmp_disallowedPageTemplateItems = array_unique(t3lib_div::intExplode(',', t3lib_div::expandList($disallowedPageTemplateList), TRUE)); + + return ( count($tmp_disallowedPageTemplateItems) ) ? implode(',', $tmp_disallowedPageTemplateItems) : '0'; + } } if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/templavoila/mod1/class.tx_templavoila_mod1_wizards.php']) {