TYPO3 API  SVNRelease
db_new_content_el.php
Go to the documentation of this file.
00001 <?php
00002 /***************************************************************
00003 *  Copyright notice
00004 *
00005 *  (c) 1999-2011 Kasper Skårhøj (kasperYYYY@typo3.com)
00006 *  All rights reserved
00007 *
00008 *  This script is part of the TYPO3 project. The TYPO3 project is
00009 *  free software; you can redistribute it and/or modify
00010 *  it under the terms of the GNU General Public License as published by
00011 *  the Free Software Foundation; either version 2 of the License, or
00012 *  (at your option) any later version.
00013 *
00014 *  The GNU General Public License can be found at
00015 *  http://www.gnu.org/copyleft/gpl.html.
00016 *  A copy is found in the textfile GPL.txt and important notices to the license
00017 *  from the author is found in LICENSE.txt distributed with these scripts.
00018 *
00019 *
00020 *  This script is distributed in the hope that it will be useful,
00021 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00022 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00023 *  GNU General Public License for more details.
00024 *
00025 *  This copyright notice MUST APPEAR in all copies of the script!
00026 ***************************************************************/
00027 /**
00028  * New content elements wizard
00029  * (Part of the 'cms' extension)
00030  *
00031  * $Id: db_new_content_el.php 10120 2011-01-18 20:03:36Z ohader $
00032  * Revised for TYPO3 3.6 November/2003 by Kasper Skårhøj
00033  * XHTML compatible.
00034  *
00035  * @author  Kasper Skårhøj <kasperYYYY@typo3.com>
00036  */
00037 /**
00038  * [CLASS/FUNCTION INDEX of SCRIPT]
00039  *
00040  *
00041  *
00042  *  101: class ext_posMap extends t3lib_positionMap
00043  *  111:     function wrapRecordTitle($str,$row)
00044  *  125:     function onClickInsertRecord($row,$vv,$moveUid,$pid,$sys_lang=0)
00045  *
00046  *
00047  *  153: class SC_db_new_content_el
00048  *  176:     function init()
00049  *  212:     function main()
00050  *  359:     function printContent()
00051  *
00052  *              SECTION: OTHER FUNCTIONS:
00053  *  388:     function getWizardItems()
00054  *  398:     function wizardArray()
00055  *  549:     function removeInvalidElements(&$wizardItems)
00056  *
00057  * TOTAL FUNCTIONS: 8
00058  * (This index is automatically created/updated by the extension "extdeveval")
00059  *
00060  */
00061 
00062 
00063 unset($MCONF);
00064 require('conf.php');
00065 require($BACK_PATH.'init.php');
00066 require($BACK_PATH.'template.php');
00067 
00068     // Unset MCONF/MLANG since all we wanted was back path etc. for this particular script.
00069 unset($MCONF);
00070 unset($MLANG);
00071 
00072     // Merging locallang files/arrays:
00073 $LANG->includeLLFile('EXT:lang/locallang_misc.xml');
00074 $LOCAL_LANG_orig = $LOCAL_LANG;
00075 $LANG->includeLLFile('EXT:cms/layout/locallang_db_new_content_el.xml');
00076 $LOCAL_LANG = t3lib_div::array_merge_recursive_overrule($LOCAL_LANG_orig,$LOCAL_LANG);
00077 
00078     // Exits if 'cms' extension is not loaded:
00079 t3lib_extMgm::isLoaded('cms',1);
00080 
00081 
00082 
00083 
00084 
00085 
00086 
00087 /**
00088  * Local position map class
00089  *
00090  * @author  Kasper Skårhøj <kasperYYYY@typo3.com>
00091  * @package TYPO3
00092  * @subpackage core
00093  */
00094 class ext_posMap extends t3lib_positionMap {
00095     var $dontPrintPageInsertIcons = 1;
00096 
00097     /**
00098      * Wrapping the title of the record - here we just return it.
00099      *
00100      * @param   string      The title value.
00101      * @param   array       The record row.
00102      * @return  string      Wrapped title string.
00103      */
00104     function wrapRecordTitle($str,$row) {
00105         return $str;
00106     }
00107 
00108     /**
00109      * Create on-click event value.
00110      *
00111      * @param   array       The record.
00112      * @param   string      Column position value.
00113      * @param   integer     Move uid
00114      * @param   integer     PID value.
00115      * @param   integer     System language
00116      * @return  string
00117      */
00118     function onClickInsertRecord($row,$vv,$moveUid,$pid,$sys_lang=0) {
00119         $table='tt_content';
00120 
00121         $location=$this->backPath.'alt_doc.php?edit[tt_content]['.(is_array($row)?-$row['uid']:$pid).']=new&defVals[tt_content][colPos]='.$vv.'&defVals[tt_content][sys_language_uid]='.$sys_lang.'&returnUrl='.rawurlencode($GLOBALS['SOBE']->R_URI);
00122 
00123         return 'window.location.href=\''.$location.'\'+document.editForm.defValues.value; return false;';
00124     }
00125 }
00126 
00127 
00128 
00129 
00130 
00131 
00132 
00133 
00134 
00135 
00136 
00137 
00138 
00139 /**
00140  * Script Class for the New Content element wizard
00141  *
00142  * @author  Kasper Skårhøj <kasperYYYY@typo3.com>
00143  * @package TYPO3
00144  * @subpackage core
00145  */
00146 class SC_db_new_content_el {
00147 
00148         // Internal, static (from GPvars):
00149     var $id;                    // Page id
00150     var $sys_language=0;        // Sys language
00151     var $R_URI='';              // Return URL.
00152     var $colPos;                // If set, the content is destined for a specific column.
00153     var $uid_pid;               //
00154 
00155         // Internal, static:
00156     var $modTSconfig=array();   // Module TSconfig.
00157 
00158     /**
00159      * Internal backend template object
00160      *
00161      * @var mediumDoc
00162      */
00163     var $doc;
00164 
00165         // Internal, dynamic:
00166     var $include_once = array();    // Includes a list of files to include between init() and main() - see init()
00167     var $content;                   // Used to accumulate the content of the module.
00168     var $access;                    // Access boolean.
00169     var $config;                    // config of the wizard
00170 
00171 
00172     /**
00173      * Constructor, initializing internal variables.
00174      *
00175      * @return  void
00176      */
00177     function init() {
00178         global $BE_USER,$BACK_PATH,$TBE_MODULES_EXT;
00179 
00180             // Setting class files to include:
00181         if (is_array($TBE_MODULES_EXT['xMOD_db_new_content_el']['addElClasses']))   {
00182             $this->include_once = array_merge($this->include_once,$TBE_MODULES_EXT['xMOD_db_new_content_el']['addElClasses']);
00183         }
00184 
00185             // Setting internal vars:
00186         $this->id = intval(t3lib_div::_GP('id'));
00187         $this->sys_language = intval(t3lib_div::_GP('sys_language_uid'));
00188         $this->R_URI = t3lib_div::sanitizeLocalUrl(t3lib_div::_GP('returnUrl'));
00189         $this->colPos = t3lib_div::_GP('colPos');
00190         $this->uid_pid = intval(t3lib_div::_GP('uid_pid'));
00191 
00192         $this->MCONF['name'] = 'xMOD_db_new_content_el';
00193         $this->modTSconfig = t3lib_BEfunc::getModTSconfig($this->id, 'mod.wizards.newContentElement');
00194 
00195         $config = t3lib_BEfunc::getPagesTSconfig($this->id);
00196         $this->config = $config['mod.']['wizards.']['newContentElement.'];
00197 
00198             // Starting the document template object:
00199         $this->doc = t3lib_div::makeInstance('template');
00200         $this->doc->backPath = $BACK_PATH;
00201         $this->doc->setModuleTemplate('templates/db_new_content_el.html');
00202         $this->doc->JScode='';
00203         $this->doc->form='<form action="" name="editForm"><input type="hidden" name="defValues" value="" />';
00204 
00205             // Setting up the context sensitive menu:
00206         $this->doc->getContextMenuCode();
00207 
00208             // Getting the current page and receiving access information (used in main())
00209         $perms_clause = $BE_USER->getPagePermsClause(1);
00210         $this->pageinfo = t3lib_BEfunc::readPageAccess($this->id,$perms_clause);
00211         $this->access = is_array($this->pageinfo) ? 1 : 0;
00212     }
00213 
00214     /**
00215      * Creating the module output.
00216      *
00217      * @return  void
00218      */
00219     function main() {
00220         global $LANG,$BACK_PATH;
00221 
00222 
00223         if ($this->id && $this->access) {
00224 
00225                 // Init position map object:
00226             $posMap = t3lib_div::makeInstance('ext_posMap');
00227             $posMap->cur_sys_language = $this->sys_language;
00228             $posMap->backPath = $BACK_PATH;
00229 
00230             if ((string)$this->colPos!='')  {   // If a column is pre-set:
00231                 if ($this->uid_pid<0)   {
00232                     $row=array();
00233                     $row['uid']=abs($this->uid_pid);
00234                 } else {
00235                     $row='';
00236                 }
00237                 $this->onClickEvent = $posMap->onClickInsertRecord($row, $this->colPos, '', $this->uid_pid, $this->sys_language);
00238             } else {
00239                 $this->onClickEvent = '';
00240             }
00241 
00242 
00243             // ***************************
00244             // Creating content
00245             // ***************************
00246                 // use a wrapper div
00247             $this->content .= '<div id="user-setup-wrapper">';
00248             $this->content.=$this->doc->header($LANG->getLL('newContentElement'));
00249             $this->content.=$this->doc->spacer(5);
00250 
00251                 // Wizard
00252             $code='';
00253             $wizardItems = $this->getWizardItems();
00254 
00255                 // Wrapper for wizards
00256             $this->elementWrapper['sectionHeader'] = array('<h3 class="divider">', '</h3>');
00257             $this->elementWrapper['section'] = array('<table border="0" cellpadding="1" cellspacing="2">', '</table>');
00258             $this->elementWrapper['wizard'] = array('<tr>', '</tr>');
00259             $this->elementWrapper['wizardPart'] = array('<td>', '</td>');
00260                 // copy wrapper for tabs
00261             $this->elementWrapperForTabs = $this->elementWrapper;
00262 
00263 
00264                 // Hook for manipulating wizardItems, wrapper, onClickEvent etc.
00265             if(is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms']['db_new_content_el']['wizardItemsHook'])) {
00266                 foreach($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms']['db_new_content_el']['wizardItemsHook'] as $classData) {
00267                     $hookObject = t3lib_div::getUserObj($classData);
00268 
00269                     if(!($hookObject instanceof cms_newContentElementWizardsHook)) {
00270                         throw new UnexpectedValueException('$hookObject must implement interface cms_newContentElementWizardItemsHook', 1227834741);
00271                     }
00272 
00273                     $hookObject->manipulateWizardItems($wizardItems, $this);
00274                 }
00275             }
00276 
00277             if ($this->config['renderMode'] == 'tabs' && $this->elementWrapperForTabs != $this->elementWrapper) {
00278                     // restore wrapper for tabs if they are overwritten in hook
00279                 $this->elementWrapper = $this->elementWrapperForTabs;
00280             }
00281 
00282                 // add document inline javascript
00283             $this->doc->JScode = $this->doc->wrapScriptTags('
00284                 function goToalt_doc()  {   //
00285                     ' . $this->onClickEvent . '
00286                 }
00287 
00288                 if(top.refreshMenu) {
00289                     top.refreshMenu();
00290                 } else {
00291                     top.TYPO3ModuleMenu.refreshMenu();
00292                 }
00293             ');
00294 
00295                 // Traverse items for the wizard.
00296                 // An item is either a header or an item rendered with a radio button and title/description and icon:
00297             $cc = $key = 0;
00298             $menuItems = array();
00299             foreach ($wizardItems as $k => $wInfo)  {
00300                 if ($wInfo['header'])   {
00301                     $menuItems[] = array(
00302                             'label'   => htmlspecialchars($wInfo['header']),
00303                             'content' => $this->elementWrapper['section'][0]
00304                     );
00305                     $key = count($menuItems) - 1;
00306                 } else {
00307                     $content = '';
00308                         // Radio button:
00309                     $oC = "document.editForm.defValues.value=unescape('".rawurlencode($wInfo['params'])."');goToalt_doc();".(!$this->onClickEvent?"window.location.hash='#sel2';":'');
00310                     $content .= $this->elementWrapper['wizardPart'][0] .
00311                         '<input type="radio" name="tempB" value="' . htmlspecialchars($k) . '" onclick="' . htmlspecialchars($oC) . '" />' .
00312                         $this->elementWrapper['wizardPart'][1];
00313 
00314                         // Onclick action for icon/title:
00315                     $aOnClick = 'document.getElementsByName(\'tempB\')['.$cc.'].checked=1;'.$oC.'return false;';
00316 
00317                         // Icon:
00318                     $iInfo = @getimagesize($wInfo['icon']);
00319                     $content .= $this->elementWrapper['wizardPart'][0] .
00320                         '<a href="#" onclick="' . htmlspecialchars($aOnClick) . '">
00321                         <img' . t3lib_iconWorks::skinImg($this->doc->backPath, $wInfo['icon'], '') . ' alt="" /></a>' .
00322                         $this->elementWrapper['wizardPart'][1];
00323 
00324                         // Title + description:
00325                     $content .= $this->elementWrapper['wizardPart'][0] .
00326                         '<a href="#" onclick="' . htmlspecialchars($aOnClick) . '"><strong>' . htmlspecialchars($wInfo['title']) . '</strong><br />' .
00327                         nl2br(htmlspecialchars(trim($wInfo['description']))) . '</a>' .
00328                         $this->elementWrapper['wizardPart'][1];
00329 
00330                         // Finally, put it together in a container:
00331                     $menuItems[$key]['content'] .= $this->elementWrapper['wizard'][0] . $content . $this->elementWrapper['wizard'][1];
00332                     $cc++;
00333                 }
00334             }
00335                 // add closing section-tag
00336             foreach ($menuItems as $key => $val) {
00337                 $menuItems[$key]['content'] .=  $this->elementWrapper['section'][1];
00338             }
00339 
00340 
00341 
00342                 // Add the wizard table to the content, wrapped in tabs:
00343             if ($this->config['renderMode'] == 'tabs') {
00344                 $this->doc->inDocStylesArray[] = '
00345                     .typo3-dyntabmenu-divs { background-color: #fafafa; border: 1px solid #adadad; width: 680px; }
00346                     .typo3-dyntabmenu-divs table { margin: 15px; }
00347                     .typo3-dyntabmenu-divs table td { padding: 3px; }
00348                 ';
00349                 $code = $LANG->getLL('sel1', 1) . '<br /><br />' . $this->doc->getDynTabMenu($menuItems, 'new-content-element-wizard', FALSE, FALSE);
00350             } else {
00351                 $code = $LANG->getLL('sel1',1) . '<br /><br />';
00352                 foreach ($menuItems as $section) {
00353                     $code .= $this->elementWrapper['sectionHeader'][0] . $section['label'] . $this->elementWrapper['sectionHeader'][1] . $section['content'];
00354                 }
00355             }
00356 
00357             $this->content.= $this->doc->section(!$this->onClickEvent ? $LANG->getLL('1_selectType') : '', $code, 0, 1);
00358 
00359 
00360 
00361                 // If the user must also select a column:
00362             if (!$this->onClickEvent) {
00363 
00364                     // Add anchor "sel2"
00365                 $this->content.= $this->doc->section('','<a name="sel2"></a>');
00366                 $this->content.= $this->doc->spacer(20);
00367 
00368                     // Select position
00369                 $code = $LANG->getLL('sel2',1).'<br /><br />';
00370 
00371                     // Load SHARED page-TSconfig settings and retrieve column list from there, if applicable:
00372                 $modTSconfig_SHARED = t3lib_BEfunc::getModTSconfig($this->id,'mod.SHARED');
00373                 $colPosList = strcmp(trim($modTSconfig_SHARED['properties']['colPos_list']),'') ? trim($modTSconfig_SHARED['properties']['colPos_list']) : '1,0,2,3';
00374                 $colPosList = implode(',',array_unique(t3lib_div::intExplode(',',$colPosList)));        // Removing duplicates, if any
00375 
00376                     // Finally, add the content of the column selector to the content:
00377                 $code.= $posMap->printContentElementColumns($this->id,0,$colPosList,1,$this->R_URI);
00378                 $this->content.= $this->doc->section($LANG->getLL('2_selectPosition'),$code,0,1);
00379             }
00380 
00381                 // Close wrapper div
00382             $this->content .= '</div>';
00383         } else {        // In case of no access:
00384             $this->content = '';
00385             $this->content.= $this->doc->header($LANG->getLL('newContentElement'));
00386             $this->content.= $this->doc->spacer(5);
00387         }
00388 
00389             // Setting up the buttons and markers for docheader
00390         $docHeaderButtons = $this->getButtons();
00391         $markers['CSH'] = $docHeaderButtons['csh'];
00392         $markers['CONTENT'] = $this->content;
00393 
00394             // Build the <body> for the module
00395         $this->content = $this->doc->startPage($LANG->getLL('newContentElement'));
00396         $this->content.= $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers);
00397         $this->content .= $this->doc->sectionEnd();
00398         $this->content.= $this->doc->endPage();
00399         $this->content = $this->doc->insertStylesAndJS($this->content);
00400     }
00401 
00402     /**
00403      * Print out the accumulated content:
00404      *
00405      * @return  void
00406      */
00407     function printContent() {
00408         echo $this->content;
00409     }
00410 
00411     /**
00412      * Create the panel of buttons for submitting the form or otherwise perform operations.
00413      *
00414      * @return  array   all available buttons as an assoc. array
00415      */
00416     protected function getButtons() {
00417         global $LANG, $BACK_PATH;
00418 
00419         $buttons = array(
00420             'csh' => '',
00421             'back' => ''
00422         );
00423 
00424 
00425         if ($this->id && $this->access) {
00426                 // CSH
00427             $buttons['csh'] = t3lib_BEfunc::cshItem('xMOD_csh_corebe', 'new_ce', $GLOBALS['BACK_PATH'], '', TRUE);
00428 
00429                 // Back
00430             if ($this->R_URI)   {
00431                 $buttons['back'] = '<a href="' . htmlspecialchars($this->R_URI) . '" class="typo3-goBack" title="' . $LANG->getLL('goBack', TRUE) . '">' .
00432                         t3lib_iconWorks::getSpriteIcon('actions-view-go-back') .
00433                     '</a>';
00434             }
00435         }
00436 
00437 
00438         return $buttons;
00439     }
00440 
00441 
00442 
00443 
00444 
00445 
00446 
00447 
00448 
00449     /***************************
00450      *
00451      * OTHER FUNCTIONS:
00452      *
00453      ***************************/
00454 
00455 
00456     /**
00457      * Returns the content of wizardArray() function...
00458      *
00459      * @return  array       Returns the content of wizardArray() function...
00460      */
00461     function getWizardItems()   {
00462         return $this->wizardArray();
00463     }
00464 
00465     /**
00466      * Returns the array of elements in the wizard display.
00467      * For the plugin section there is support for adding elements there from a global variable.
00468      *
00469      * @return  array
00470      */
00471     function wizardArray()  {
00472 
00473         if (is_array($this->config)) {
00474             $wizards = $this->config['wizardItems.'];
00475         }
00476         $appendWizards = $this->wizard_appendWizards($wizards['elements.']);
00477 
00478         $wizardItems = array();
00479 
00480         if (is_array($wizards)) {
00481             foreach ($wizards as $groupKey => $wizardGroup) {
00482                 $groupKey = preg_replace('/\.$/', '', $groupKey);
00483                 $showItems = t3lib_div::trimExplode(',', $wizardGroup['show'], true);
00484                 $showAll = (strcmp($wizardGroup['show'], '*') ? false : true);
00485                 $groupItems = array();
00486 
00487                 if (is_array($appendWizards[$groupKey . '.']['elements.'])) {
00488                     $wizardElements = array_merge((array) $wizardGroup['elements.'], $appendWizards[$groupKey . '.']['elements.']);
00489                 } else {
00490                     $wizardElements = $wizardGroup['elements.'];
00491                 }
00492 
00493                 if (is_array($wizardElements)) {
00494                     foreach ($wizardElements as $itemKey => $itemConf) {
00495                         $itemKey = preg_replace('/\.$/', '', $itemKey);
00496                         if ($showAll || in_array($itemKey, $showItems)) {
00497                             $tmpItem = $this->wizard_getItem($groupKey, $itemKey, $itemConf);
00498                             if ($tmpItem) {
00499                                 $groupItems[$groupKey . '_' . $itemKey] = $tmpItem;
00500             }
00501         }
00502                     }
00503                 }
00504                 if (count($groupItems)) {
00505                     $wizardItems[$groupKey] = $this->wizard_getGroupHeader($groupKey, $wizardGroup);
00506                     $wizardItems = array_merge($wizardItems, $groupItems);
00507                 }
00508             }
00509         }
00510 
00511             // Remove elements where preset values are not allowed:
00512         $this->removeInvalidElements($wizardItems);
00513 
00514         return $wizardItems;
00515     }
00516 
00517     function wizard_appendWizards($wizardElements) {
00518         if (!is_array($wizardElements)) {
00519             $wizardElements = array();
00520         }
00521         if (is_array($GLOBALS['TBE_MODULES_EXT']['xMOD_db_new_content_el']['addElClasses'])) {
00522             foreach ($GLOBALS['TBE_MODULES_EXT']['xMOD_db_new_content_el']['addElClasses'] as $class => $path) {
00523                 require_once($path);
00524                 $modObj = t3lib_div::makeInstance($class);
00525                 $wizardElements = $modObj->proc($wizardElements);
00526             }
00527         }
00528         $returnElements = array();
00529         foreach ($wizardElements as $key => $wizardItem) {
00530             preg_match('/^[a-zA-Z0-9]+_/', $key, $group);
00531             $wizardGroup =  $group[0] ? substr($group[0], 0, -1) . '.' : $key;
00532             $returnElements[$wizardGroup]['elements.'][substr($key, strlen($wizardGroup)) . '.'] = $wizardItem;
00533         }
00534         return $returnElements;
00535     }
00536 
00537 
00538     function wizard_getItem($groupKey, $itemKey, $itemConf) {
00539         $itemConf['title'] = $GLOBALS['LANG']->sL($itemConf['title']);
00540         $itemConf['description'] = $GLOBALS['LANG']->sL($itemConf['description']);
00541         $itemConf['tt_content_defValues'] = $itemConf['tt_content_defValues.'];
00542         unset($itemConf['tt_content_defValues.']);
00543         return $itemConf;
00544     }
00545 
00546     function wizard_getGroupHeader($groupKey, $wizardGroup) {
00547         return array(
00548             'header' => $GLOBALS['LANG']->sL($wizardGroup['header'])
00549         );
00550     }
00551 
00552 
00553     /**
00554      * Checks the array for elements which might contain unallowed default values and will unset them!
00555      * 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).
00556      *
00557      * @param   array       Wizard items, passed by reference
00558      * @return  void
00559      */
00560     function removeInvalidElements(&$wizardItems)   {
00561         global $TCA;
00562 
00563             // Load full table definition:
00564         t3lib_div::loadTCA('tt_content');
00565 
00566             // Get TCEFORM from TSconfig of current page
00567         $row = array('pid' => $this->id);
00568         $TCEFORM_TSconfig = t3lib_BEfunc::getTCEFORM_TSconfig('tt_content', $row);
00569         $removeItems = t3lib_div::trimExplode(',', $TCEFORM_TSconfig['CType']['removeItems'], 1);
00570         $keepItems = t3lib_div::trimExplode(',', $TCEFORM_TSconfig['CType']['keepItems'], 1);
00571 
00572         $headersUsed = Array();
00573             // Traverse wizard items:
00574         foreach($wizardItems as $key => $cfg)   {
00575 
00576                 // Exploding parameter string, if any (old style)
00577             if ($wizardItems[$key]['params'])   {
00578                     // Explode GET vars recursively
00579                 $tempGetVars = t3lib_div::explodeUrl2Array($wizardItems[$key]['params'],TRUE);
00580                     // If tt_content values are set, merge them into the tt_content_defValues array, unset them from $tempGetVars and re-implode $tempGetVars into the param string (in case remaining parameters are around).
00581                 if (is_array($tempGetVars['defVals']['tt_content']))    {
00582                     $wizardItems[$key]['tt_content_defValues'] = array_merge(is_array($wizardItems[$key]['tt_content_defValues']) ? $wizardItems[$key]['tt_content_defValues'] : array(), $tempGetVars['defVals']['tt_content']);
00583                     unset($tempGetVars['defVals']['tt_content']);
00584                     $wizardItems[$key]['params'] = t3lib_div::implodeArrayForUrl('',$tempGetVars);
00585                 }
00586             }
00587 
00588                 // If tt_content_defValues are defined...:
00589             if (is_array($wizardItems[$key]['tt_content_defValues']))   {
00590 
00591                     // Traverse field values:
00592                 foreach($wizardItems[$key]['tt_content_defValues'] as $fN => $fV)   {
00593                     if (is_array($TCA['tt_content']['columns'][$fN]))   {
00594                             // Get information about if the field value is OK:
00595                         $config = &$TCA['tt_content']['columns'][$fN]['config'];
00596                         $authModeDeny = ($config['type']=='select' && $config['authMode'] && !$GLOBALS['BE_USER']->checkAuthMode('tt_content', $fN, $fV, $config['authMode']));
00597                         $isNotInKeepItems = (count($keepItems) && !in_array($fV, $keepItems));
00598 
00599                         if ($authModeDeny || ($fN=='CType' && in_array($fV,$removeItems)) || $isNotInKeepItems) {
00600                                 // Remove element all together:
00601                             unset($wizardItems[$key]);
00602                             break;
00603                         } else {
00604                                 // Add the parameter:
00605                             $wizardItems[$key]['params'].= '&defVals[tt_content]['.$fN.']='.rawurlencode($fV);
00606                             $tmp = explode('_', $key);
00607                             $headersUsed[$tmp[0]] = $tmp[0];
00608                         }
00609                     }
00610                 }
00611             }
00612         }
00613             // remove headers without elements
00614         foreach ($wizardItems as $key => $cfg)  {
00615             $tmp = explode('_',$key);
00616             if ($tmp[0] && !$tmp[1] && !in_array($tmp[0], $headersUsed))    {
00617                 unset($wizardItems[$key]);
00618             }
00619         }
00620     }
00621 }
00622 
00623 
00624 if (defined('TYPO3_MODE') && isset($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['ext/cms/layout/db_new_content_el.php'])) {
00625     include_once($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['ext/cms/layout/db_new_content_el.php']);
00626 }
00627 
00628 
00629 
00630 // Make instance:
00631 $SOBE = t3lib_div::makeInstance('SC_db_new_content_el');
00632 $SOBE->init();
00633 
00634 // Include files?
00635 foreach($SOBE->include_once as $INC_FILE)   include_once($INC_FILE);
00636 
00637 $SOBE->main();
00638 $SOBE->printContent();
00639 
00640 ?>