Index: mod1/class.tx_templavoila_mod1_wizards.php =================================================================== --- mod1/class.tx_templavoila_mod1_wizards.php (revision 27884) +++ mod1/class.tx_templavoila_mod1_wizards.php (working copy) @@ -59,7 +59,7 @@ * @package TYPO3 * @subpackage tx_templavoila */ - + require_once(PATH_t3lib.'class.t3lib_tceforms.php'); class tx_templavoila_mod1_wizards { @@ -68,6 +68,7 @@ var $pObj; // A pointer to the parent object, that is the templavoila page module script. Set by calling the method init() of this class. var $doc; // A reference to the doc object of the parent object. var $extKey; // A reference to extension key of the parent object. + var $TCAdefaultOverride; // Config of TCAdefaults // Local variables @@ -106,13 +107,20 @@ function renderWizard_createNewPage ($positionPid) { global $LANG, $BE_USER, $TYPO3_CONF_VARS; + // Get default TCA values specific for the page and user + $temp = t3lib_BEfunc::getModTSconfig(abs($positionPid) , 'TCAdefaults'); + if (isset($temp['properties'])) { + $this->TCAdefaultOverride = $temp['properties']; + } + // The user already submitted the create page form: - if (t3lib_div::_GP('doCreate')) { + if (t3lib_div::_GP('doCreate') || isset($this->TCAdefaultOverride['pages.']['tx_templavoila_to'])) { // Check if the HTTP_REFERER is valid $refInfo = parse_url(t3lib_div::getIndpEnv('HTTP_REFERER')); $httpHost = t3lib_div::getIndpEnv('TYPO3_HOST_ONLY'); if ($httpHost == $refInfo['host'] || t3lib_div::_GP('vC') == $BE_USER->veriCode() || $TYPO3_CONF_VARS['SYS']['doNotCheckReferer']) { + // Create new page $newID = $this->createPage (t3lib_div::_GP('data'), $positionPid); if ($newID > 0) { @@ -227,6 +235,8 @@ $content .= ''; $content .= ''; $content .= ''; + + $content .= $this->doc->endPage(); return $content; } @@ -256,13 +266,11 @@ switch ($templateType) { case 'tmplobj': // Create the "Default template" entry - $previewIconFilename = $GLOBALS['BACK_PATH'].'../'.t3lib_extMgm::siteRelPath($this->extKey).'res1/default_previewicon.gif'; - $previewIcon = ''; - $description = htmlspecialchars($LANG->getLL ('template_descriptiondefault')); - $tmplHTML [] = ' -
-

'.htmlspecialchars($LANG->getLL ('template_titledefault')).'

'.$previewIcon.'

'.$description.'

'; + //Fetch Default TO + $fakeRow = array('uid' => abs($positionPid)); + $defaultTO = $this->pObj->apiObj->getContentTree_fetchPageTemplateObject($fakeRow); + //Fetch all TO's but the default $tTO = 'tx_templavoila_tmplobj'; $tDS = 'tx_templavoila_datastructure'; $where = $tTO . '.parent=0 AND ' . $tTO . '.pid=' . @@ -277,7 +285,28 @@ $where ); + // Create the "Default template" entry + $previewIconFilename = $this->doc->backPath . '../' . t3lib_extMgm::siteRelPath($this->extKey) . 'res1/default_previewicon.gif'; + $previewIcon = ''; + $description = $defaultTO['description'] ? htmlspecialchars($defaultTO['description']) : $LANG->getLL ('template_descriptiondefault', 1); + $tmplHTML [] = ' + + + + + + +
+

' . htmlspecialchars($LANG->getLL ('template_titleInherit')) . '

+
' . $previewIcon . ' +

' . htmlspecialchars($defaultTO['title']) . '

' . $description . '

+
'; + + while (false !== ($row = $TYPO3_DB->sql_fetch_assoc($res))) { + if ($row['uid'] === $defaultTO['uid']) { + continue; + } // Check if preview icon exists, otherwise use default icon: $tmpFilename = 'uploads/tx_templavoila/'.$row['previewicon']; $previewIconFilename = (@is_file(PATH_site.$tmpFilename)) ? ($GLOBALS['BACK_PATH'].'../'.$tmpFilename) : ($GLOBALS['BACK_PATH'].'../'.t3lib_extMgm::siteRelPath($this->extKey).'res1/default_previewicon.gif'); @@ -384,16 +413,14 @@ $tce = t3lib_div::makeInstance('t3lib_TCEmain'); - // set default TCA values specific for the page and user - $TCAdefaultOverride = t3lib_BEfunc::getModTSconfig($positionPid , 'TCAdefaults'); - - if (is_array($TCAdefaultOverride)) { - $tce->setDefaultsFromUserTS($TCAdefaultOverride); + if (is_array($this->TCAdefaultOverride)) { + $tce->setDefaultsFromUserTS($this->TCAdefaultOverride); } $tce->stripslashes_values=0; $tce->start($dataArr,array()); $tce->process_datamap(); + return $tce->substNEWwithIDs['NEW']; } @@ -414,7 +441,7 @@ /** * Create sql condition for given table to limit records according to user access. - * + * * @param string $table Table nme to fetch records from * @return string Condition or empty string */ @@ -425,7 +452,7 @@ foreach($GLOBALS['BE_USER']->userGroups as $group) { $items = t3lib_div::trimExplode(',', $group['tx_templavoila_access'], 1); foreach ($items as $ref) { - if (strstr($ref, $table)) { + if (strstr($ref, $table)) { $result[] = intval(substr($ref, $prefLen)); } } Index: mod1/locallang.xml =================================================================== --- mod1/locallang.xml (revision 27884) +++ mod1/locallang.xml (working copy) @@ -40,6 +40,7 @@ +