Index: typo3/interfaces/interface.cms_newContentElementWiszardItemsHook.php =================================================================== --- typo3/interfaces/interface.cms_newContentElementWiszardItemsHook.php (revision 0) +++ typo3/interfaces/interface.cms_newContentElementWiszardItemsHook.php (revision 0) @@ -0,0 +1,49 @@ + +* All rights reserved +* +* This script is part of the TYPO3 project. The TYPO3 project is +* free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* The GNU General Public License can be found at +* http://www.gnu.org/copyleft/gpl.html. +* A copy is found in the textfile GPL.txt and important notices to the license +* from the author is found in LICENSE.txt distributed with these scripts. +* +* +* This script is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* This copyright notice MUST APPEAR in all copies of the script! +***************************************************************/ + + +/** + * interface for classes which hook into SC_db_new_content_el and manipulater wizardItems array + * + * @author Steffen Kamper + * @package TYPO3 + * @subpackage cms + */ +interface cms_newContentElementWiszardsHook { + + /** + * modifies WizardItems array + * + * @param array array of Wizard Items + * @param SC_db_new_content_el parent object New Content element wizard + * @return void + */ + public function manipulateWizardItems(&$wizardItems, &$parentObject); + +} + +?> \ No newline at end of file Index: typo3/sysext/cms/ext_localconf.php =================================================================== --- typo3/sysext/cms/ext_localconf.php (revision 4494) +++ typo3/sysext/cms/ext_localconf.php (working copy) @@ -7,6 +7,150 @@ options.saveDocNew.pages_language_overlay = 0 '); +t3lib_extMgm::addPageTSConfig(' +mod.xMOD_db_new_content_el.wizardItems { + common.header = LLL:EXT:cms/layout/locallang_db_new_content_el.xml:common + common.elements { + regularText { + icon = gfx/c_wiz/regular_text.gif + title = LLL:EXT:cms/layout/locallang_db_new_content_el.xml:common_regularText_title + description = LLL:EXT:cms/layout/locallang_db_new_content_el.xml:common_regularText_description + tt_content_defValues { + CType = text + } + } + textImage { + icon = gfx/c_wiz/text_image_right.gif + title = LLL:EXT:cms/layout/locallang_db_new_content_el.xml:common_textImage_title + description = LLL:EXT:cms/layout/locallang_db_new_content_el.xml:common_textImage_description + tt_content_defValues { + CType = textpic + imageorient = 17 + } + } + imagesOnly { + icon = gfx/c_wiz/images_only.gif + title = LLL:EXT:cms/layout/locallang_db_new_content_el.xml:common_imagesOnly_title + description = LLL:EXT:cms/layout/locallang_db_new_content_el.xml:common_imagesOnly_description + tt_content_defValues { + CType = image + imagecols = 2 + } + } + bulletList { + icon = gfx/c_wiz/bullet_list.gif + title = LLL:EXT:cms/layout/locallang_db_new_content_el.xml:common_bulletList_title + description = LLL:EXT:cms/layout/locallang_db_new_content_el.xml:common_bulletList_description + tt_content_defValues { + CType = bullets + } + } + table { + icon = gfx/c_wiz/table.gif + title = LLL:EXT:cms/layout/locallang_db_new_content_el.xml:common_table_title + description = LLL:EXT:cms/layout/locallang_db_new_content_el.xml:common_table_description + tt_content_defValues { + CType = table + } + } + + } + common.show = regularText,textImage,imagesOnly,bulletList,table + + special.header = LLL:EXT:cms/layout/locallang_db_new_content_el.xml:special + special.elements { + filelinks { + icon = gfx/c_wiz/filelinks.gif + title = LLL:EXT:cms/layout/locallang_db_new_content_el.xml:special_filelinks_title + description = LLL:EXT:cms/layout/locallang_db_new_content_el.xml:special_filelinks_description + tt_content_defValues { + CType = uploads + } + } + multimedia { + icon = gfx/c_wiz/multimedia.gif + title = LLL:EXT:cms/layout/locallang_db_new_content_el.xml:special_multimedia_title + description = LLL:EXT:cms/layout/locallang_db_new_content_el.xml:special_multimedia_description + tt_content_defValues { + CType = multimedia + } + } + sitemap { + icon = gfx/c_wiz/sitemap2.gif + title = LLL:EXT:cms/layout/locallang_db_new_content_el.xml:special_sitemap_title + description = LLL:EXT:cms/layout/locallang_db_new_content_el.xml:special_sitemap_description + tt_content_defValues { + CType = menu + menu_type = 2 + } + } + plainHTML { + icon = gfx/c_wiz/html.gif + title = LLL:EXT:cms/layout/locallang_db_new_content_el.xml:special_plainHTML_title + description = LLL:EXT:cms/layout/locallang_db_new_content_el.xml:special_plainHTML_description + tt_content_defValues { + CType = html + } + } + + } + special.show = filelinks,multimedia,sitemap, plainHTML + + forms.header = LLL:EXT:cms/layout/locallang_db_new_content_el.xml:forms + forms.elements { + mail { + icon = gfx/c_wiz/mailform.gif + title = LLL:EXT:cms/layout/locallang_db_new_content_el.xml:forms_mail_title + description = LLL:EXT:cms/layout/locallang_db_new_content_el.xml:forms_mail_description + tt_content_defValues { + CType = mailform + bodytext ( +# Example content: +Name: | *name = input,40 | Enter your name here +Email: | *email=input,40 | +Address: | address=textarea,40,5 | +Contact me: | tv=check | 1 + +|formtype_mail = submit | Send form! +|html_enabled=hidden | 1 +|subject=hidden| This is the subject + ) + } + } + search { + icon = gfx/c_wiz/searchform.gif + title = LLL:EXT:cms/layout/locallang_db_new_content_el.xml:forms_search_title + description = LLL:EXT:cms/layout/locallang_db_new_content_el.xml:forms_search_description + tt_content_defValues { + CType = search + } + } + login { + icon = gfx/c_wiz/login_form.gif + title = LLL:EXT:cms/layout/locallang_db_new_content_el.xml:forms_login_title + description = LLL:EXT:cms/layout/locallang_db_new_content_el.xml:forms_login_description + tt_content_defValues { + CType = login + } + } + + } + forms.show = mail,search,login + + plugins.header = LLL:EXT:cms/layout/locallang_db_new_content_el.xml:plugins + plugins.elements { + general { + icon = gfx/c_wiz/user_defined.gif + title = LLL:EXT:cms/layout/locallang_db_new_content_el.xml:plugins_general_title + description = LLL:EXT:cms/layout/locallang_db_new_content_el.xml:plugins_general_description + tt_content_defValues.CType = list + } + } + plugins.show = * +} + +'); + $TYPO3_CONF_VARS['SYS']['contentTable'] = 'tt_content'; $TYPO3_CONF_VARS['FE']['eID_include']['tx_cms_showpic'] = 'EXT:cms/tslib/showpic.php'; @@ -32,4 +176,4 @@ $TYPO3_CONF_VARS['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['moveRecordClass'][] = 'EXT:cms/tslib/hooks/class.tx_cms_treelistcacheupdate.php:&tx_cms_treelistCacheUpdate'; -?> \ No newline at end of file +?> Index: typo3/sysext/cms/layout/db_new_content_el.php =================================================================== --- typo3/sysext/cms/layout/db_new_content_el.php (revision 4494) +++ typo3/sysext/cms/layout/db_new_content_el.php (working copy) @@ -202,6 +202,7 @@ $this->doc->backPath = $BACK_PATH; $this->doc->setModuleTemplate('templates/db_new_content_el.html'); $this->doc->JScode=''; + $this->doc->JScodeLibArray['dyntabmenu'] = $this->doc->getDynTabMenuJScode(); $this->doc->form='
'; // Setting up the context sensitive menu: @@ -239,79 +240,103 @@ } else { $onClickEvent=''; } - + + + $this->doc->inDocStylesArray[] = ' + .typo3-dyntabmenu-divs {background-color: #fafafa; border: 1px solid #000; width: 680px;} + .typo3-dyntabmenu-divs table {margin: 15px;} + .typo3-dyntabmenu-divs table td {padding: 3px;} + '; + $this->doc->JScode=$this->doc->wrapScriptTags(' function goToalt_doc() { // '.$onClickEvent.' } + + if(top.refreshMenu) { + top.refreshMenu(); + } else { + top.TYPO3ModuleMenu.refreshMenu(); + } + + if(top.shortcutFrame) { + top.shortcutFrame.refreshShortcuts(); + } '); + + // *************************** // Creating content // *************************** - $this->content=''; + // use a wrapper div + $this->content .= '
'; $this->content.=$this->doc->header($LANG->getLL('newContentElement')); $this->content.=$this->doc->spacer(5); // Wizard $code=''; - $lines=array(); $wizardItems = $this->getWizardItems(); + // Hook for manipulating wizardItems + if(is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms']['db_new_content_el']['wizardItemsHook'])) { + foreach($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms']['db_new_content_el']['wizardItemsHook'] as $classData) { + $hookObject = &t3lib_div::getUserObj($classData); + + if(!($hookObject instanceof cms_newContentElementWiszardsHook)) { + throw new UnexpectedValueException('$hookObject must implement interface cms_newContentElementWiszardItemsHook', 1227834741); + } + + $hookObject->manipulateWizardItems($wizardItems, $this); + } + } + // Traverse items for the wizard. // An item is either a header or an item rendered with a radio button and title/description and icon: $cc=0; + $key = 0; + foreach ($wizardItems as $k => $wInfo) { if ($wInfo['header']) { - if ($cc>0) $lines[]=' - -
- '; - $lines[]=' - - '.htmlspecialchars($wInfo['header']).' - '; + $menuItems[] = array( + 'label' => htmlspecialchars($wInfo['header']), + 'content' => '' + ); + $key = count($menuItems) - 1; } else { - $tL=array(); - + $content = ''; // Radio button: - $oC = "document.editForm.defValues.value=unescape('".rawurlencode($wInfo['params'])."');goToalt_doc();".(!$onClickEvent?"window.location.hash='#sel2';":''); - $tL[]=''; + $oC = "document.editForm.defValues.value=unescape('" . rawurlencode($wInfo['params']) . "');goToalt_doc();" . (!$onClickEvent ? "window.location.hash='#sel2';" : ''); + $content .= ''; // Onclick action for icon/title: - $aOnClick = 'document.getElementsByName(\'tempB\')['.$cc.'].checked=1;'.$this->doc->thisBlur().$oC.'return false;'; + $aOnClick = 'document.getElementsByName(\'tempB\')[' . $cc . '].checked=1;' . $this->doc->thisBlur() . $oC . 'return false;'; // Icon: $iInfo = @getimagesize($wInfo['icon']); - $tL[]='doc->backPath,$wInfo['icon'],'').' alt="" />'; + $content .= ''; // Title + description: - $tL[]=''.htmlspecialchars($wInfo['title']).'
'.nl2br(htmlspecialchars(trim($wInfo['description']))).'
'; + $content .= ''; // Finally, put it together in a table row: - $lines[]=' - - - - '; + $menuItems[$key]['content'] .= '' . $content . ''; $cc++; } } - // Add the wizard table to the content: - $code.=$LANG->getLL('sel1',1).'

+ // add closing table-tag + foreach ($menuItems as $key => $val) { + $menuItems[$key]['content'] .= '
doc->backPath, $wInfo['icon'], '') . ' alt="" />' . htmlspecialchars($wInfo['title']) . '
' . nl2br(htmlspecialchars(trim($wInfo['description']))) . '
'.implode('',$tL).'
'; + } + + // Add the wizard table to the content, wrapped in tabs: + $code = $LANG->getLL('sel1',1) . '

' . $this->doc->getDynTabMenu($menuItems, 'new-content-element-wizard', false, false, 100); + + $this->content.= $this->doc->section(!$onClickEvent ? $LANG->getLL('1_selectType') : '', $code, 0, 1); - - - '.implode('',$lines).' -
'; - $this->content.= $this->doc->section(!$onClickEvent?$LANG->getLL('1_selectType'):'',$code,0,1); - - // If the user must also select a column: if (!$onClickEvent) { @@ -347,6 +372,8 @@ $this->content.= $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers); $this->content.= $this->doc->endPage(); $this->content = $this->doc->insertStylesAndJS($this->content); + // end of wrapper div + $this->content .= '
'; } /** @@ -419,149 +446,88 @@ * @return array */ function wizardArray() { - global $LANG,$TBE_MODULES_EXT; + $config = t3lib_BEfunc::getPagesTSconfig($this->id); + $config = $config['mod.']['xMOD_db_new_content_el.']; + if (is_array($config)) { + $wizards = $config['wizardItems.']; + } + $appendWizards = $this->wizard_appendWizards($wizards['elements.']); + + $wizardItems = array(); - $wizardItems = array( - 'common' => array('header'=>$LANG->getLL('common')), - 'common_regularText' => array( // Regular text element - 'icon'=>'gfx/c_wiz/regular_text.gif', - 'title'=>$LANG->getLL('common_regularText_title'), - 'description'=>$LANG->getLL('common_regularText_description'), - 'tt_content_defValues' => array( - 'CType' => 'text' - ) - ), - 'common_textImage' => array( // Text with image - 'icon'=>'gfx/c_wiz/text_image_right.gif', - 'title'=>$LANG->getLL('common_textImage_title'), - 'description'=>$LANG->getLL('common_textImage_description'), - 'tt_content_defValues' => array( - 'CType' => 'textpic', - 'imageorient' => 17 - ) - ), - 'common_imagesOnly' => array( // Images only - 'icon'=>'gfx/c_wiz/images_only.gif', - 'title'=>$LANG->getLL('common_imagesOnly_title'), - 'description'=>$LANG->getLL('common_imagesOnly_description'), - 'tt_content_defValues' => array( - 'CType' => 'image', - 'imagecols' => 2 - ) - ), - 'common_bulletList' => array( // Bullet list - 'icon'=>'gfx/c_wiz/bullet_list.gif', - 'title'=>$LANG->getLL('common_bulletList_title'), - 'description'=>$LANG->getLL('common_bulletList_description'), - 'tt_content_defValues' => array( - 'CType' => 'bullets', - ) - ), - 'common_table' => array( // Table - 'icon'=>'gfx/c_wiz/table.gif', - 'title'=>$LANG->getLL('common_table_title'), - 'description'=>$LANG->getLL('common_table_description'), - 'tt_content_defValues' => array( - 'CType' => 'table', - ) - ), - 'special' => array('header'=>$LANG->getLL('special')), - 'special_filelinks' => array( // Filelinks - 'icon'=>'gfx/c_wiz/filelinks.gif', - 'title'=>$LANG->getLL('special_filelinks_title'), - 'description'=>$LANG->getLL('special_filelinks_description'), - 'tt_content_defValues' => array( - 'CType' => 'uploads', - ) - ), - 'special_multimedia' => array( // Multimedia - 'icon'=>'gfx/c_wiz/multimedia.gif', - 'title'=>$LANG->getLL('special_multimedia_title'), - 'description'=>$LANG->getLL('special_multimedia_description'), - 'tt_content_defValues' => array( - 'CType' => 'multimedia', - ) - ), - 'special_sitemap' => array( // Sitemap - 'icon'=>'gfx/c_wiz/sitemap2.gif', - 'title'=>$LANG->getLL('special_sitemap_title'), - 'description'=>$LANG->getLL('special_sitemap_description'), - 'tt_content_defValues' => array( - 'CType' => 'menu', - 'menu_type' => 2 - ) - ), - 'special_plainHTML' => array( // Plain HTML - 'icon'=>'gfx/c_wiz/html.gif', - 'title'=>$LANG->getLL('special_plainHTML_title'), - 'description'=>$LANG->getLL('special_plainHTML_description'), - 'tt_content_defValues' => array( - 'CType' => 'html', - ) - ), - 'forms' => array('header'=>$LANG->getLL('forms')), - 'forms_mail' => array( // Mail form - 'icon'=>'gfx/c_wiz/mailform.gif', - 'title'=>$LANG->getLL('forms_mail_title'), - 'description'=>$LANG->getLL('forms_mail_description'), - 'tt_content_defValues' => array( - 'CType' => 'mailform', - 'bodytext' => trim(' -# Example content: -Name: | *name = input,40 | Enter your name here -Email: | *email=input,40 | -Address: | address=textarea,40,5 | -Contact me: | tv=check | 1 + if (is_array($wizards)) { + foreach($wizards as $groupKey => $wizardGroup) { + $groupKey = preg_replace('/\.$/', '', $groupKey); + $showItems = t3lib_div::trimExplode(',', $wizardGroup['show'], true); + $showAll = strcmp($wizardGroup['show'], '*')?false:true; + $groupItems = array(); + + if (is_array($appendWizards[$groupKey . '.']['elements.'])) { + $wizardElements = array_merge((array) $wizardGroup['elements.'], $appendWizards[$groupKey . '.']['elements.']); + } else { + $wizardElements = $wizardGroup['elements.']; + } + + if (is_array($wizardElements)) { + foreach ($wizardElements as $itemKey => $itemConf) { + $itemKey = preg_replace('/\.$/', '', $itemKey); + if ($showAll || in_array($itemKey, $showItems)) { + $tmpItem = $this->wizard_getItem($groupKey, $itemKey, $itemConf); + if ($tmpItem) { + $groupItems[$groupKey . '_' . $itemKey] = $tmpItem; + } + } + } + } + if (count($groupItems)) { + $wizardItems[$groupKey] = $this->wizard_getGroupHeader($groupKey, $wizardGroup); + $wizardItems = array_merge($wizardItems, $groupItems); + } + } + } -|formtype_mail = submit | Send form! -|html_enabled=hidden | 1 -|subject=hidden| This is the subject - ') - ) - ), - 'forms_search' => array( // Search form - 'icon'=>'gfx/c_wiz/searchform.gif', - 'title'=>$LANG->getLL('forms_search_title'), - 'description'=>$LANG->getLL('forms_search_description'), - 'tt_content_defValues' => array( - 'CType' => 'search', - ) - ), - 'forms_login' => array( // Login form - 'icon'=>'gfx/c_wiz/login_form.gif', - 'title'=>$LANG->getLL('forms_login_title'), - 'description'=>$LANG->getLL('forms_login_description'), - 'tt_content_defValues' => array( - 'CType' => 'login', - ) - ), - 'plugins' => array('header'=>$LANG->getLL('plugins')), - 'plugins_general' => array( // General plugin - 'icon'=>'gfx/c_wiz/user_defined.gif', - 'title'=>$LANG->getLL('plugins_general_title'), - 'description'=>$LANG->getLL('plugins_general_description'), - 'tt_content_defValues' => array( - 'CType' => 'list', - ) - ), - ); + // Remove elements where preset values are not allowed: + $this->removeInvalidElements($wizardItems); + return $wizardItems; + } - // PLUG-INS: - if (is_array($TBE_MODULES_EXT['xMOD_db_new_content_el']['addElClasses'])) { - reset($TBE_MODULES_EXT['xMOD_db_new_content_el']['addElClasses']); - while(list($class,$path)=each($TBE_MODULES_EXT['xMOD_db_new_content_el']['addElClasses'])) { - $modObj = t3lib_div::makeInstance($class); - $wizardItems = $modObj->proc($wizardItems); + function wizard_appendWizards($wizardElements) { + if (!is_array($wizardElements)) { + $wizardElements = array(); + } + if (is_array($GLOBALS['TBE_MODULES_EXT']['xMOD_db_new_content_el']['addElClasses'])) { + foreach ($GLOBALS['TBE_MODULES_EXT']['xMOD_db_new_content_el']['addElClasses'] as $class => $path) { + require_once($path); + $modObj = t3lib_div::makeInstance($class); + $wizardElements = $modObj->proc($wizardElements); } + } + $returnElements = array(); + foreach ($wizardElements as $key => $wizardItem) { + preg_match('/^[a-zA-Z0-9]+_/', $key, $group); + $wizardGroup = $group[0] ? substr($group[0], 0, -1) . '.' : $key; + $returnElements[$wizardGroup]['elements.'][substr($key, strlen($wizardGroup)) . '.'] = $wizardItem; } + return $returnElements; + } - // Remove elements where preset values are not allowed: - $this->removeInvalidElements($wizardItems); - return $wizardItems; + function wizard_getItem($groupKey, $itemKey, $itemConf) { + $itemConf['title'] = $GLOBALS['LANG']->sL($itemConf['title']); + $itemConf['description'] = $GLOBALS['LANG']->sL($itemConf['description']); + $itemConf['tt_content_defValues'] = $itemConf['tt_content_defValues.']; + unset($itemConf['tt_content_defValues.']); + return $itemConf; } + function wizard_getGroupHeader($groupKey, $wizardGroup) { + return array( + 'header' => $GLOBALS['LANG']->sL($wizardGroup['header']) + ); + } + + /** * Checks the array for elements which might contain unallowed default values and will unset them! * Looks for the "tt_content_defValues" key in each element and if found it will traverse that array as fieldname / value pairs and check. The values will be added to the "params" key of the array (which should probably be unset or empty by default). @@ -647,4 +613,4 @@ $SOBE->main(); $SOBE->printContent(); -?> \ No newline at end of file +?>