/src/typo3_src-4.2.0alpha1/t3lib/class.t3lib_tceforms.php

00001 <?php
00002 /***************************************************************
00003 *  Copyright notice
00004 *
00005 *  (c) 1999-2006 Kasper Skaarhoj (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 ***************************************************************/
00183 require_once(PATH_t3lib.'class.t3lib_diff.php');
00184 require_once(PATH_t3lib.'class.t3lib_tceforms_inline.php');
00185 
00186 
00187 
00196 class t3lib_TCEforms    {
00197 
00198                 // variables not commented yet.... (do so...)
00199         var $palFieldArr = array();
00200         var $disableWizards = 0;
00201         var $isPalettedoc = 0;
00202         var $paletteMargin = 1;
00203         var $defStyle = ''; // 'font-family:Verdana;font-size:10px;';
00204         var $cachedTSconfig = array();
00205         var $cachedTSconfig_fieldLevel = array();
00206         var $cachedLanguageFlag = array();
00207         var $cachedAdditionalPreviewLanguages = NULL;
00208         var $transformedRow = array();
00209         var $extJSCODE = '';
00210         var $printNeededJS = array();
00211         var $hiddenFieldAccum=array();
00212         var $TBE_EDITOR_fieldChanged_func='';
00213         var $loadMD5_JS=1;
00214         var $prevBorderStyle='[nothing here...]';       // Something unique...
00215         var $allowUpload=0;                             // If set direct upload fields will be shown
00216         var $titleLen=15;                                       // @deprecated: $BE_USER->uc['titleLen'] but what is default??
00217         var $defaultLanguageData = array();     // Array where records in the default language is stored. (processed by transferdata)
00218         var $defaultLanguageData_diff = array();        // Array where records in the default language is stored (raw without any processing. used for making diff)
00219         var $additionalPreviewLanguageData = array();
00220 
00221 
00222                 // EXTERNAL, static
00223         var $backPath='';                                       // Set this to the 'backPath' pointing back to the typo3 admin directory from the script where this form is displayed.
00224         var $returnUrl='';                                      // Alternative return URL path (default is t3lib_div::linkThisScript())
00225         var $doSaveFieldName='';                        // Can be set to point to a field name in the form which will be set to '1' when the form is submitted with a *save* button. This way the recipient script can determine that the form was submitted for save and not "close" for example.
00226         var $palettesCollapsed=0;                       // Can be set true/false to whether palettes (secondary options) are in the topframe or in form. True means they are NOT IN-form. So a collapsed palette is one, which is shown in the top frame, not in the page.
00227         var $disableRTE=0;                                      // If set, the RTE is disabled (from form display, eg. by checkbox in the bottom of the page!)
00228         var $globalShowHelp=1;                          // If false, then all CSH will be disabled, regardless of settings in $this->edit_showFieldHelp
00229         var $localizationMode='';                       // If true, the forms are rendering only localization relevant fields of the records.
00230         var $fieldOrder='';                                     // Overrule the field order set in TCA[types][showitem], eg for tt_content this value, 'bodytext,image', would make first the 'bodytext' field, then the 'image' field (if set for display)... and then the rest in the old order.
00231         var $doPrintPalette=1;                          // If set to false, palettes will NEVER be rendered.
00232 
00238         var $clipObj=FALSE;
00239         var $enableClickMenu=FALSE;                     // Enable click menu on reference icons.
00240         var $enableTabMenu = FALSE;                     // Enable Tab Menus. If set to true, the JavaScript content from template::getDynTabMenuJScode() must be included in the document.
00241         var $renderReadonly = FALSE;            // When enabled all fields are rendered non-editable.
00242 
00243         var $form_rowsToStylewidth = 9.58;      // Form field width compensation: Factor from NN4 form field widths to style-aware browsers (like NN6+ and MSIE, with the $CLIENT[FORMSTYLE] value set)
00244         var $form_largeComp = 1.33;                     // Form field width compensation: Compensation for large documents, doc-tab (editing)
00245         var $charsPerRow=40;                            // The number of chars expected per row when the height of a text area field is automatically calculated based on the number of characters found in the field content.
00246         var $maxTextareaWidth=48;                       // The maximum abstract value for textareas
00247         var $maxInputWidth=48;                          // The maximum abstract value for input fields
00248         var $defaultMultipleSelectorStyle='width:250px;';       // Default style for the selector boxes used for multiple items in "select" and "group" types.
00249 
00250 
00251                 // INTERNAL, static
00252         var $prependFormFieldNames = 'data';            // The string to prepend formfield names with.
00253         var $prependCmdFieldNames = 'cmd';                      // The string to prepend commands for tcemain::process_cmdmap with.
00254         var $prependFormFieldNames_file = 'data_files';         // The string to prepend FILE form field names with.
00255         var $formName = 'editform';                                     // The name attribute of the form.
00256         var $allowOverrideMatrix = array();                     // Whitelist that allows TCA field configuration to be overridden by TSconfig, @see overrideFieldConf()
00257 
00258 
00259 
00260                 // INTERNAL, dynamic
00261         var $perms_clause='';                                           // Set by readPerms()  (caching)
00262         var $perms_clause_set=0;                                        // Set by readPerms()  (caching-flag)
00263         var $edit_showFieldHelp='';                                     // Used to indicate the mode of CSH (Context Sensitive Help), whether it should be icons-only ('icon'), full description ('text') or not at all (blank).
00264         var $docLarge=0;                                                        // If set, the forms will be rendered a little wider, more precisely with a factor of $this->form_largeComp.
00265         var $clientInfo=array();                                        // Loaded with info about the browser when class is instantiated.
00266         var $RTEenabled=0;                                                      // True, if RTE is possible for the current user (based on result from BE_USER->isRTE())
00267         var $RTEenabled_notReasons='';                          // If $this->RTEenabled was false, you can find the reasons listed in this array which is filled with reasons why the RTE could not be loaded)
00268         var $RTEcounter = 0;                                            // Counter that is incremented before an RTE is created. Can be used for unique ids etc.
00269 
00270         var $colorScheme;                                                       // Contains current color scheme
00271         var $classScheme;                                                       // Contains current class scheme
00272         var $defColorScheme;                                            // Contains the default color scheme
00273         var $defClassScheme;                                            // Contains the default class scheme
00274         var $fieldStyle;                                                        // Contains field style values
00275         var $borderStyle;                                                       // Contains border style values.
00276 
00277         var $commentMessages=array();                           // An accumulation of messages from the class.
00278 
00279                 // INTERNAL, templates
00280         var $totalWrap='<hr />|<hr />';                         // Total wrapping for the table rows.
00281         var $fieldTemplate='<b>###FIELD_NAME###</b><br />###FIELD_ITEM###<hr />';       // Field template
00282         var $sectionWrap='';                                            // Wrapping template code for a section
00283         var $palFieldTemplateHeader='';                         // Template for palette headers
00284         var $palFieldTemplate='';                                       // Template for palettes
00285 
00286                 // INTERNAL, working memory
00287         var $excludeElements='';                                        // Set to the fields NOT to display, if any.
00288         var $palettesRendered=array();                          // During rendering of forms this will keep track of which palettes has already been rendered (so they are not rendered twice by mistake)
00289         var $hiddenFieldListArr = array();                      // This array of fields will be set as hidden-fields instead of rendered normally! For instance palette fields edited in the top frame are set as hidden fields since the main form has to submit the values. The top frame actually just sets the value in the main form!
00290         var $requiredFields=array();                            // Used to register input-field names, which are required. (Done during rendering of the fields). This information is then used later when the JavaScript is made.
00291         var $requiredElements=array();                          // Used to register the min and max number of elements for selectorboxes where that apply (in the "group" type for instance)
00292         var $renderDepth=0;                                                     // Keeps track of the rendering depth of nested records.
00293         var $savedSchemes=array();                                      // Color scheme buffer.
00294         var $dynNestedStack = array();                          // holds the path an element is nested in (e.g. required for RTEhtmlarea)
00295 
00296                 // Internal, registers for user defined functions etc.
00297         var $additionalCode_pre = array();                      // Additional HTML code, printed before the form.
00298         var $additionalJS_pre = array();                        // Additional JavaScript, printed before the form
00299         var $additionalJS_post = array();                       // Additional JavaScript printed after the form
00300         var $additionalJS_submit = array();                     // Additional JavaScript executed on submit; If you set "OK" variable it will raise an error about RTEs not being loaded and offer to block further submission.
00301 
00307         var $inline;
00308         var $hookObjectsMainFields = array();                   // Array containing hook class instances called once for a form
00309         var $hookObjectsSingleField = array();                  // Array containing hook class instances called for each field
00310         var $extraFormHeaders = array();                        // Rows gettings inserted into the alt_doc headers (when called from alt_doc.php)
00311 
00312 
00313 
00314 
00315 
00321         function t3lib_TCEforms()       {
00322                 global $CLIENT, $TYPO3_CONF_VARS;
00323 
00324                 $this->clientInfo = t3lib_div::clientInfo();
00325 
00326                 $this->RTEenabled = $GLOBALS['BE_USER']->isRTE();
00327                 if (!$this->RTEenabled) {
00328                         $this->RTEenabled_notReasons = implode(chr(10),$GLOBALS['BE_USER']->RTE_errors);
00329                         $this->commentMessages[] = 'RTE NOT ENABLED IN SYSTEM due to:'.chr(10).$this->RTEenabled_notReasons;
00330                 }
00331 
00332                         // Default color+class scheme
00333                 $this->defColorScheme = array(
00334                         $GLOBALS['SOBE']->doc->bgColor, // Background for the field AND palette
00335                         t3lib_div::modifyHTMLColorAll($GLOBALS['SOBE']->doc->bgColor,-20),      // Background for the field header
00336                         t3lib_div::modifyHTMLColorAll($GLOBALS['SOBE']->doc->bgColor,-10),      // Background for the palette field header
00337                         'black',        // Field header font color
00338                         '#666666'       // Palette field header font color
00339                 );
00340                 $this->defColorScheme = array();
00341 
00342                         // Override / Setting defaults from TBE_STYLES array
00343                 $this->resetSchemes();
00344 
00345                         // Setting the current colorScheme to default.
00346                 $this->defColorScheme = $this->colorScheme;
00347                 $this->defClassScheme = $this->classScheme;
00348 
00349                         // Define whitelist that allows TCA field configuration to be overridden by TSconfig, @see overrideFieldConf():
00350                 $this->allowOverrideMatrix = array(
00351                         'input' => array('size', 'max'),
00352                         'text' => array('cols', 'rows', 'wrap'),
00353                         'check' => array('cols', 'showIfRTE'),
00354                         'select' => array('size', 'autoSizeMax', 'maxitems', 'minitems'),
00355                         'group' => array('size', 'autoSizeMax', 'max_size', 'show_thumbs', 'maxitems', 'minitems'),
00356                         'inline' => array('appearance', 'foreign_label', 'foreign_selector', 'foreign_unique', 'maxitems', 'minitems', 'size', 'autoSizeMax', 'symmetric_label'),
00357                 );
00358 
00359                 $this->inline = t3lib_div::makeInstance('t3lib_TCEforms_inline');
00360 
00361                         // Prepare user defined objects (if any) for hooks which extend this function:
00362                 $this->hookObjectsMainFields = array();
00363                 if (is_array ($TYPO3_CONF_VARS['SC_OPTIONS']['t3lib/class.t3lib_tceforms.php']['getMainFieldsClass']))  {
00364                         foreach ($TYPO3_CONF_VARS['SC_OPTIONS']['t3lib/class.t3lib_tceforms.php']['getMainFieldsClass'] as $classRef)   {
00365                                 $this->hookObjectsMainFields[] = &t3lib_div::getUserObj($classRef);
00366                         }
00367                 }
00368                 $this->hookObjectsSingleField = array();
00369                 if (is_array ($TYPO3_CONF_VARS['SC_OPTIONS']['t3lib/class.t3lib_tceforms.php']['getSingleFieldClass'])) {
00370                         foreach ($TYPO3_CONF_VARS['SC_OPTIONS']['t3lib/class.t3lib_tceforms.php']['getSingleFieldClass'] as $classRef)  {
00371                                 $this->hookObjectsSingleField[] = &t3lib_div::getUserObj($classRef);
00372                         }
00373                 }
00374 
00375         }
00376 
00382         function initDefaultBEmode()    {
00383                 global $BE_USER;
00384                 $this->prependFormFieldNames = 'data';
00385                 $this->formName = 'editform';
00386                 $this->setNewBEDesign();
00387                 $this->docLarge = $BE_USER->uc['edit_wideDocument'] ? 1 : 0;
00388                 $this->edit_showFieldHelp = $BE_USER->uc['edit_showFieldHelp'];
00389 
00390                 $this->edit_docModuleUpload = $BE_USER->uc['edit_docModuleUpload'];
00391                 $this->titleLen = $BE_USER->uc['titleLen'];             // @deprecated
00392 
00393                 $this->inline->init($this);
00394         }
00395 
00396 
00397 
00398 
00399 
00400 
00401 
00402 
00403 
00404 
00405 
00406 
00407 
00408 
00409 
00410 
00411 
00412         /*******************************************************
00413          *
00414          * Rendering the forms, fields etc
00415          *
00416          *******************************************************/
00417 
00429         function getSoloField($table,$row,$theFieldToReturn)    {
00430                 global $TCA;
00431 
00432                 if ($TCA[$table])       {
00433                         t3lib_div::loadTCA($table);
00434                         $typeNum = $this->getRTypeNum($table,$row);
00435                         if ($TCA[$table]['types'][$typeNum])    {
00436                                 $itemList = $TCA[$table]['types'][$typeNum]['showitem'];
00437                                 if ($itemList)  {
00438                                         $fields = t3lib_div::trimExplode(',',$itemList,1);
00439                                         $excludeElements = $this->excludeElements = $this->getExcludeElements($table,$row,$typeNum);
00440 
00441                                         reset($fields);
00442                                         while(list(,$fieldInfo)=each($fields))  {
00443                                                 $parts = explode(';',$fieldInfo);
00444 
00445                                                 $theField = trim($parts[0]);
00446                                                 if (!in_array($theField,$excludeElements) && !strcmp($theField,$theFieldToReturn))      {
00447                                                         if ($TCA[$table]['columns'][$theField]) {
00448                                                                 $sField = $this->getSingleField($table,$theField,$row,$parts[1],1,$parts[3],$parts[2]);
00449                                                                 return $sField['ITEM'];
00450                                                         }
00451                                                 }
00452                                         }
00453                                 }
00454                         }
00455                 }
00456         }
00457 
00468         function getMainFields($table,$row,$depth=0)    {
00469                 global $TCA, $TYPO3_CONF_VARS;
00470 
00471                 $this->renderDepth=$depth;
00472 
00473                         // Init vars:
00474                 $out_array = array(array());
00475                 $out_array_meta = array(array(
00476                         'title' => $this->getLL('l_generalTab')
00477                 ));
00478 
00479                 $out_pointer=0;
00480                 $out_sheet=0;
00481                 $this->palettesRendered=array();
00482                 $this->palettesRendered[$this->renderDepth][$table]=array();
00483 
00484                         // Hook: getMainFields_preProcess (requested by Thomas Hempel for use with the "dynaflex" extension)
00485                 foreach ($this->hookObjectsMainFields as $hookObj)      {
00486                         if (method_exists($hookObj,'getMainFields_preProcess')) {
00487                                 $hookObj->getMainFields_preProcess($table,$row,$this);
00488                         }
00489                 }
00490 
00491                 if ($TCA[$table])       {
00492 
00493                                 // Load the full TCA for the table.
00494                         t3lib_div::loadTCA($table);
00495 
00496                                 // Load the description content for the table.
00497                         if ($this->edit_showFieldHelp || $this->doLoadTableDescr($table))       {
00498                                 $GLOBALS['LANG']->loadSingleTableDescription($table);
00499                         }
00500                                 // Get the current "type" value for the record.
00501                         $typeNum = $this->getRTypeNum($table,$row);
00502 
00503                                 // Find the list of fields to display:
00504                         if ($TCA[$table]['types'][$typeNum])    {
00505                                 $itemList = $TCA[$table]['types'][$typeNum]['showitem'];
00506                                 if ($itemList)  {       // If such a list existed...
00507                                                 // Explode the field list and possibly rearrange the order of the fields, if configured for
00508                                         $fields = t3lib_div::trimExplode(',',$itemList,1);
00509                                         if ($this->fieldOrder)  {
00510                                                 $fields = $this->rearrange($fields);
00511                                         }
00512 
00513                                                 // Get excluded fields, added fiels and put it together:
00514                                         $excludeElements = $this->excludeElements = $this->getExcludeElements($table,$row,$typeNum);
00515                                         $fields = $this->mergeFieldsWithAddedFields($fields,$this->getFieldsToAdd($table,$row,$typeNum));
00516 
00517                                                 // If TCEforms will render a tab menu in the next step, push the name to the tab stack:
00518                                         if (strstr($itemList, '--div--') !== false && $this->enableTabMenu && $TCA[$table]['ctrl']['dividers2tabs']) {
00519                                                 $tabIdentString = 'TCEforms:'.$table.':'.$row['uid'];
00520                                                 $tabIdentStringMD5 = $GLOBALS['TBE_TEMPLATE']->getDynTabMenuId('TCEforms:'.$table.':'.$row['uid']);
00521                                                         // Remember that were currently working on the general tab:
00522                                                 if (isset($fields[0]) && strpos($fields[0], '--div--') !== 0) {
00523                                                         $this->pushToDynNestedStack('tab', $tabIdentStringMD5.'-1');
00524                                                 }
00525                                         }
00526 
00527                                                 // Traverse the fields to render:
00528                                         $cc=0;
00529                                         foreach($fields as $fieldInfo)  {
00530                                                         // Exploding subparts of the field configuration:
00531                                                 $parts = explode(';',$fieldInfo);
00532 
00533                                                         // Getting the style information out:
00534                                                 $color_style_parts = t3lib_div::trimExplode('-',$parts[4]);
00535                                                 if (strcmp($color_style_parts[0],''))   {
00536                                                         $this->setColorScheme($GLOBALS['TBE_STYLES']['colorschemes'][intval($color_style_parts[0])]);
00537                                                 }
00538                                                 if (strcmp($color_style_parts[1],''))   {
00539                                                         $this->fieldStyle = $GLOBALS['TBE_STYLES']['styleschemes'][intval($color_style_parts[1])];
00540                                                         if (!isset($this->fieldStyle))  $this->fieldStyle = $GLOBALS['TBE_STYLES']['styleschemes'][0];
00541                                                 }
00542                                                 if (strcmp($color_style_parts[2],''))   {
00543                                                         $this->wrapBorder($out_array[$out_sheet],$out_pointer);
00544                                                         $this->borderStyle = $GLOBALS['TBE_STYLES']['borderschemes'][intval($color_style_parts[2])];
00545                                                         if (!isset($this->borderStyle)) $this->borderStyle = $GLOBALS['TBE_STYLES']['borderschemes'][0];
00546                                                 }
00547 
00548                                                         // Render the field:
00549                                                 $theField = $parts[0];
00550                                                 if (!in_array($theField,$excludeElements))      {
00551                                                         if ($TCA[$table]['columns'][$theField]) {
00552                                                                 $sFieldPal='';
00553 
00554                                                                 if ($parts[2] && !isset($this->palettesRendered[$this->renderDepth][$table][$parts[2]]))        {
00555                                                                         $sFieldPal=$this->getPaletteFields($table,$row,$parts[2]);
00556                                                                         $this->palettesRendered[$this->renderDepth][$table][$parts[2]] = 1;
00557                                                                 }
00558                                                                 $sField = $this->getSingleField($table,$theField,$row,$parts[1],0,$parts[3],$parts[2]);
00559                                                                 if ($sField)    { $sField.= $sFieldPal; }
00560 
00561                                                                 $out_array[$out_sheet][$out_pointer].= $sField;
00562                                                         } elseif ($theField=='--div--') {
00563                                                                 if ($cc>0)      {
00564                                                                         $out_array[$out_sheet][$out_pointer].=$this->getDivider();
00565 
00566                                                                         if ($this->enableTabMenu && $TCA[$table]['ctrl']['dividers2tabs'])      {
00567                                                                                 $this->wrapBorder($out_array[$out_sheet],$out_pointer);
00568                                                                                         // Remove last tab entry from the dynNestedStack:
00569                                                                                 $out_sheet++;
00570                                                                                         // Remove the previous sheet from stack (if any):
00571                                                                                 $this->popFromDynNestedStack('tab', $tabIdentStringMD5.'-'.($out_sheet));
00572                                                                                         // Remember on which sheet we're currently working:
00573                                                                                 $this->pushToDynNestedStack('tab', $tabIdentStringMD5.'-'.($out_sheet+1));
00574                                                                                 $out_array[$out_sheet] = array();
00575                                                                                 $out_array_meta[$out_sheet]['title'] = $this->sL($parts[1]);
00576                                                                         }
00577                                                                 } else {        // Setting alternative title for "General" tab if "--div--" is the very first element.
00578                                                                         $out_array_meta[$out_sheet]['title'] = $this->sL($parts[1]);
00579                                                                                 // Only add the first tab to the dynNestedStack if there are more tabs:
00580                                                                         if (strpos($itemList, '--div--', strlen($fieldInfo))) {
00581                                                                                 $this->pushToDynNestedStack('tab', $tabIdentStringMD5.'-1');
00582                                                                         }
00583                                                                 }
00584                                                         } elseif($theField=='--palette--')      {
00585                                                                 if ($parts[2] && !isset($this->palettesRendered[$this->renderDepth][$table][$parts[2]]))        {
00586                                                                                 // render a 'header' if not collapsed
00587                                                                         if ($TCA[$table]['palettes'][$parts[2]]['canNotCollapse'] AND $parts[1]) {
00588                                                                                 $out_array[$out_sheet][$out_pointer].=$this->getPaletteFields($table,$row,$parts[2],$this->sL($parts[1]));
00589                                                                         } else {
00590                                                                                 $out_array[$out_sheet][$out_pointer].=$this->getPaletteFields($table,$row,$parts[2],'','',$this->sL($parts[1]));
00591                                                                         }
00592                                                                         $this->palettesRendered[$this->renderDepth][$table][$parts[2]] = 1;
00593                                                                 }
00594                                                         }
00595                                                 }
00596 
00597                                                 $cc++;
00598                                         }
00599                                 }
00600                         }
00601                 }
00602 
00603                         // Hook: getMainFields_postProcess (requested by Thomas Hempel for use with the "dynaflex" extension)
00604                 foreach ($this->hookObjectsMainFields as $hookObj)      {
00605                         if (method_exists($hookObj,'getMainFields_postProcess'))        {
00606                                 $hookObj->getMainFields_postProcess($table,$row,$this);
00607                         }
00608                 }
00609 
00610                         // Wrapping a border around it all:
00611                 $this->wrapBorder($out_array[$out_sheet],$out_pointer);
00612 
00613                         // Resetting styles:
00614                 $this->resetSchemes();
00615 
00616                         // Rendering Main palettes, if any
00617                 $mParr = t3lib_div::trimExplode(',',$TCA[$table]['ctrl']['mainpalette']);
00618                 $i = 0;
00619                 if (count($mParr))      {
00620                         foreach ($mParr as $mP) {
00621                                 if (!isset($this->palettesRendered[$this->renderDepth][$table][$mP]))   {
00622                                         $temp_palettesCollapsed=$this->palettesCollapsed;
00623                                         $this->palettesCollapsed=0;
00624                                         $label = ($i==0?$this->getLL('l_generalOptions'):$this->getLL('l_generalOptions_more'));
00625                                         $out_array[$out_sheet][$out_pointer].=$this->getPaletteFields($table,$row,$mP,$label);
00626                                         $this->palettesCollapsed=$temp_palettesCollapsed;
00627                                         $this->palettesRendered[$this->renderDepth][$table][$mP] = 1;
00628                                 }
00629                                 $this->wrapBorder($out_array[$out_sheet],$out_pointer);
00630                                 $i++;
00631                                 if ($this->renderDepth) {
00632                                         $this->renderDepth--;
00633                                 }
00634                         }
00635                 }
00636 
00637                         // Return the imploded $out_array:
00638                 if ($out_sheet>0)       {       // There were --div-- dividers around...
00639 
00640                                 // Create parts array for the tab menu:
00641                         $parts = array();
00642                         foreach ($out_array as $idx => $sheetContent)   {
00643                                 $parts[] = array(
00644                                         'label' => $out_array_meta[$idx]['title'],
00645                                         'content' => '<table border="0" cellspacing="0" cellpadding="0" width="100%">'.
00646                                                         implode('',$sheetContent).
00647                                                 '</table>'
00648                                 );
00649                         }
00650 
00651                                 // Unset the current level of tab menus:
00652                         $this->popFromDynNestedStack('tab', $tabIdentStringMD5.'-'.($out_sheet+1));
00653 
00654                         return '
00655                                 <tr>
00656                                         <td colspan="2">
00657                                         '.$this->getDynTabMenu($parts, $tabIdentString).'
00658                                         </td>
00659                                 </tr>';
00660                 } else {        // Only one, so just implode:
00661                         return implode('',$out_array[$out_sheet]);
00662                 }
00663         }
00664 
00675         function getListedFields($table,$row,$list)     {
00676                 global $TCA;
00677 
00678                 t3lib_div::loadTCA($table);
00679                 if ($this->edit_showFieldHelp || $this->doLoadTableDescr($table))       {
00680                         $GLOBALS['LANG']->loadSingleTableDescription($table);
00681                 }
00682 
00683                 $out = '';
00684                 $types_fieldConfig = t3lib_BEfunc::getTCAtypes($table,$row,1);
00685 
00686                 $editFieldList=array_unique(t3lib_div::trimExplode(',',$list,1));
00687                 foreach($editFieldList as $theFieldC)   {
00688                         list($theField,$palFields) = split('\[|\]',$theFieldC);
00689                         $theField = trim($theField);
00690                         $palFields = trim($palFields);
00691                         if ($TCA[$table]['columns'][$theField]) {
00692                                 $parts = t3lib_div::trimExplode(';',$types_fieldConfig[$theField]['origString']);
00693                                 $sField = $this->getSingleField($table,$theField,$row,$parts[1],0,$parts[3],0); // Don't sent palette pointer - there are no options anyways for a field-list.
00694                                 $out.= $sField;
00695                         } elseif($theField=='--div--')  {
00696                                 $out.= $this->getDivider();
00697                         }
00698                         if ($palFields) {
00699                                 $out.= $this->getPaletteFields($table,$row,'','',implode(',',t3lib_div::trimExplode('|',$palFields,1)));
00700                         }
00701                 }
00702 
00703                 return $out;
00704         }
00705 
00717         function getPaletteFields($table,$row,$palette,$header='',$itemList='',$collapsedHeader='')     {
00718                 global $TCA;
00719                 if (!$this->doPrintPalette)     return '';
00720 
00721                 $out='';
00722                 $palParts = array();
00723                 t3lib_div::loadTCA($table);
00724 
00725                         // Getting excludeElements, if any.
00726                 if (!is_array($this->excludeElements))  {
00727                         $this->excludeElements = $this->getExcludeElements($table,$row,$this->getRTypeNum($table,$row));
00728                 }
00729 
00730                         // Render the palette TCEform elements.
00731                 if ($TCA[$table] && (is_array($TCA[$table]['palettes'][$palette]) || $itemList))        {
00732                         $itemList = $itemList?$itemList:$TCA[$table]['palettes'][$palette]['showitem'];
00733                         if ($itemList)  {
00734                                 $fields = t3lib_div::trimExplode(',',$itemList,1);
00735                                 reset($fields);
00736                                 while(list(,$fieldInfo)=each($fields))  {
00737                                         $parts = t3lib_div::trimExplode(';',$fieldInfo);
00738                                         $theField = $parts[0];
00739 
00740                                         if (!in_array($theField,$this->excludeElements) && $TCA[$table]['columns'][$theField])  {
00741                                                 $this->palFieldArr[$palette][] = $theField;
00742                                                 if ($this->isPalettesCollapsed($table,$palette))        {
00743                                                         $this->hiddenFieldListArr[] = $theField;
00744                                                 }
00745 
00746                                                 $part = $this->getSingleField($table,$theField,$row,$parts[1],1,'',$parts[2]);
00747                                                 if (is_array($part))    {
00748                                                         $palParts[] = $part;
00749                                                 }
00750                                         }
00751                                 }
00752                         }
00753                 }
00754                         // Put palette together if there are fields in it:
00755                 if (count($palParts))   {
00756                         if ($header)    {
00757                                 $out.= $this->intoTemplate(array(
00758                                                                 'HEADER' => htmlspecialchars($header)
00759                                                         ),
00760                                                         $this->palFieldTemplateHeader
00761                                                 );
00762                         }
00763                         $out.= $this->intoTemplate(array(
00764                                                         'PALETTE' => $this->printPalette($palParts)
00765                                                 ),
00766                                                 $this->palFieldTemplate
00767                                         );
00768                 }
00769                         // If a palette is collapsed (not shown in form, but in top frame instead) AND a collapse header string is given, then make that string a link to activate the palette.
00770                 if ($this->isPalettesCollapsed($table,$palette) && $collapsedHeader)    {
00771                         $pC = $this->intoTemplate(array(
00772                                                         'PALETTE' => $this->wrapOpenPalette('<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/options.gif','width="18" height="16"').' border="0" title="'.htmlspecialchars($this->getLL('l_moreOptions')).'" align="top" alt="" /><strong>'.$collapsedHeader.'</strong>',$table,$row,$palette),
00773                                                 ),
00774                                                 $this->palFieldTemplate
00775                                         );
00776                         $out.= $pC;
00777                 }
00778 
00779                 return $out;
00780         }
00781 
00794         function getSingleField($table,$field,$row,$altName='',$palette=0,$extra='',$pal=0)     {
00795                 global $TCA,$BE_USER;
00796 
00797                         // Hook: getSingleField_preProcess
00798                 foreach ($this->hookObjectsSingleField as $hookObj)     {
00799                         if (method_exists($hookObj,'getSingleField_preProcess'))        {
00800                                 $hookObj->getSingleField_preProcess($table, $field, $row, $altName, $palette, $extra, $pal, $this);
00801                         }
00802                 }
00803 
00804                 $out = '';
00805                 $PA = array();
00806                 $PA['altName'] = $altName;
00807                 $PA['palette'] = $palette;
00808                 $PA['extra'] = $extra;
00809                 $PA['pal'] = $pal;
00810 
00811                         // Make sure to load full $TCA array for the table:
00812                 t3lib_div::loadTCA($table);
00813 
00814                         // Get the TCA configuration for the current field:
00815                 $PA['fieldConf'] = $TCA[$table]['columns'][$field];
00816                 $PA['fieldConf']['config']['form_type'] = $PA['fieldConf']['config']['form_type'] ? $PA['fieldConf']['config']['form_type'] : $PA['fieldConf']['config']['type'];       // Using "form_type" locally in this script
00817 
00818                 $skipThisField = $this->inline->skipField($table, $field, $row, $PA['fieldConf']['config']);
00819 
00820                         // Now, check if this field is configured and editable (according to excludefields + other configuration)
00821                 if (    is_array($PA['fieldConf']) &&
00822                                 !$skipThisField &&
00823                                 (!$PA['fieldConf']['exclude'] || $BE_USER->check('non_exclude_fields',$table.':'.$field)) &&
00824                                 $PA['fieldConf']['config']['form_type']!='passthrough' &&
00825                                 ($this->RTEenabled || !$PA['fieldConf']['config']['showIfRTE']) &&
00826                                 (!$PA['fieldConf']['displayCond'] || $this->isDisplayCondition($PA['fieldConf']['displayCond'],$row)) &&
00827                                 (!$TCA[$table]['ctrl']['languageField'] || $PA['fieldConf']['l10n_display'] || strcmp($PA['fieldConf']['l10n_mode'],'exclude') || $row[$TCA[$table]['ctrl']['languageField']]<=0) &&
00828                                 (!$TCA[$table]['ctrl']['languageField'] || !$this->localizationMode || $this->localizationMode===$PA['fieldConf']['l10n_cat'])
00829                         )       {
00830 
00831 
00832 
00833                                 // Fetching the TSconfig for the current table/field. This includes the $row which means that
00834                         $PA['fieldTSConfig'] = $this->setTSconfig($table,$row,$field);
00835 
00836                                 // If the field is NOT disabled from TSconfig (which it could have been) then render it
00837                         if (!$PA['fieldTSConfig']['disabled'])  {
00838                                         // Override fieldConf by fieldTSconfig:
00839                                 $PA['fieldConf']['config'] = $this->overrideFieldConf($PA['fieldConf']['config'], $PA['fieldTSConfig']);
00840 
00841                                         // Init variables:
00842                                 $PA['itemFormElName']=$this->prependFormFieldNames.'['.$table.']['.$row['uid'].']['.$field.']';         // Form field name
00843                                 $PA['itemFormElName_file']=$this->prependFormFieldNames_file.'['.$table.']['.$row['uid'].']['.$field.']';       // Form field name, in case of file uploads
00844                                 $PA['itemFormElValue']=$row[$field];            // The value to show in the form field.
00845                                 $PA['itemFormElID']=$this->prependFormFieldNames.'_'.$table.'_'.$row['uid'].'_'.$field;
00846 
00847                                         // set field to read-only if configured for translated records to show default language content as readonly
00848                                 if ($PA['fieldConf']['l10n_display'] AND t3lib_div::inList($PA['fieldConf']['l10n_display'], 'defaultAsReadonly') AND $row[$TCA[$table]['ctrl']['languageField']]) {
00849                                         $PA['fieldConf']['config']['readOnly'] =  true;
00850                                         $PA['itemFormElValue'] = $this->defaultLanguageData[$table.':'.$row['uid']][$field];
00851                                 }
00852 
00853                                         // Create a JavaScript code line which will ask the user to save/update the form due to changing the element. This is used for eg. "type" fields and others configured with "requestUpdate"
00854                                 if (
00855                                         ($TCA[$table]['ctrl']['type'] && !strcmp($field,$TCA[$table]['ctrl']['type'])) ||
00856                                         ($TCA[$table]['ctrl']['requestUpdate'] && t3lib_div::inList($TCA[$table]['ctrl']['requestUpdate'],$field))) {
00857                                         if($GLOBALS['BE_USER']->jsConfirmation(1))      {
00858                                                 $alertMsgOnChange = 'if (confirm(TBE_EDITOR.labels.onChangeAlert) && TBE_EDITOR.checkSubmit(-1)){ TBE_EDITOR.submitForm() };';
00859                                         } else {
00860                                                 $alertMsgOnChange = 'if (TBE_EDITOR.checkSubmit(-1)){ TBE_EDITOR.submitForm() };';
00861                                         }
00862                                 } else {
00863                                         $alertMsgOnChange = '';
00864                                 }
00865 
00866                                         // Render as a hidden field?
00867                                 if (in_array($field,$this->hiddenFieldListArr)) {
00868                                         $this->hiddenFieldAccum[]='<input type="hidden" name="'.$PA['itemFormElName'].'" value="'.htmlspecialchars($PA['itemFormElValue']).'" />';
00869                                 } else {        // Render as a normal field:
00870 
00871                                                 // If the field is NOT a palette field, then we might create an icon which links to a palette for the field, if one exists.
00872                                         if (!$PA['palette'])    {
00873                                                 if ($PA['pal'] && $this->isPalettesCollapsed($table,$PA['pal']))        {
00874                                                         list($thePalIcon,$palJSfunc) = $this->wrapOpenPalette('<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/options.gif','width="18" height="16"').' border="0" title="'.htmlspecialchars($this->getLL('l_moreOptions')).'" alt="" />',$table,$row,$PA['pal'],1);
00875                                                 } else {
00876                                                         $thePalIcon = '';
00877                                                         $palJSfunc = '';
00878                                                 }
00879                                         }
00880                                                 // onFocus attribute to add to the field:
00881                                         $PA['onFocus'] = ($palJSfunc && !$BE_USER->uc['dontShowPalettesOnFocusInAB']) ? ' onfocus="'.htmlspecialchars($palJSfunc).'"' : '';
00882 
00883                                                 // Find item
00884                                         $item='';
00885                                         $PA['label'] = $PA['altName'] ? $PA['altName'] : $PA['fieldConf']['label'];
00886                                         $PA['label'] = $this->sL($PA['label']);
00887                                                 // JavaScript code for event handlers:
00888                                         $PA['fieldChangeFunc']=array();
00889                                         $PA['fieldChangeFunc']['TBE_EDITOR_fieldChanged'] = "TBE_EDITOR.fieldChanged('".$table."','".$row['uid']."','".$field."','".$PA['itemFormElName']."');";
00890                                         $PA['fieldChangeFunc']['alert']=$alertMsgOnChange;
00891                                                 // if this is the child of an inline type and it is the field creating the label
00892                                         if ($this->inline->isInlineChildAndLabelField($table, $field)) {
00893                                                 $PA['fieldChangeFunc']['inline'] = "inline.handleChangedField('".$PA['itemFormElName']."','".$this->inline->inlineNames['object']."[$table][".$row['uid']."]');";
00894                                         }
00895 
00896                                                 // Based on the type of the item, call a render function:
00897                                         $item = $this->getSingleField_SW($table,$field,$row,$PA);
00898 
00899                                                 // Add language + diff
00900                                         if ($PA['fieldConf']['l10n_display'] && (t3lib_div::inList($PA['fieldConf']['l10n_display'], 'hideDiff') || t3lib_div::inList($PA['fieldConf']['l10n_display'], 'defaultAsReadonly'))) {
00901                                                 $renderLanguageDiff = false;
00902                                         } else {
00903                                                 $renderLanguageDiff = true;
00904                                         }
00905 
00906                                         if ($renderLanguageDiff) {
00907                                                 $item = $this->renderDefaultLanguageContent($table,$field,$row,$item);
00908                                                 $item = $this->renderDefaultLanguageDiff($table,$field,$row,$item);
00909                                         }
00910 
00911                                                 // If the record has been saved and the "linkTitleToSelf" is set, we make the field name into a link, which will load ONLY this field in alt_doc.php
00912                                         $PA['label'] = t3lib_div::deHSCentities(htmlspecialchars($PA['label']));
00913                                         if (t3lib_div::testInt($row['uid']) && $PA['fieldTSConfig']['linkTitleToSelf'] && !t3lib_div::_GP('columnsOnly'))       {
00914                                                 $lTTS_url = $this->backPath.'alt_doc.php?edit['.$table.']['.$row['uid'].']=edit&columnsOnly='.$field.'&returnUrl='.rawurlencode($this->thisReturnUrl());
00915                                                 $PA['label'] = '<a href="'.htmlspecialchars($lTTS_url).'">'.$PA['label'].'</a>';
00916                                         }
00917 
00918                                                 // Create output value:
00919                                         if ($PA['fieldConf']['config']['form_type']=='user' && $PA['fieldConf']['config']['noTableWrapping'])   {
00920                                                 $out = $item;
00921                                         } elseif ($PA['palette'])       {
00922                                                         // Array:
00923                                                 $out=array(
00924                                                         'NAME'=>$PA['label'],
00925                                                         'ID'=>$row['uid'],
00926                                                         'FIELD'=>$field,
00927                                                         'TABLE'=>$table,
00928                                                         'ITEM'=>$item,
00929                                                         'HELP_ICON' => $this->helpTextIcon($table,$field,1)
00930                                                 );
00931                                                 $out = $this->addUserTemplateMarkers($out,$table,$field,$row,$PA);
00932                                         } else {
00933                                                         // String:
00934                                                 $out=array(
00935                                                         'NAME'=>$PA['label'],
00936                                                         'ITEM'=>$item,
00937                                                         'TABLE'=>$table,
00938                                                         'ID'=>$row['uid'],
00939                                                         'HELP_ICON'=>$this->helpTextIcon($table,$field),
00940                                                         'HELP_TEXT'=>$this->helpText($table,$field),
00941                                                         'PAL_LINK_ICON'=>$thePalIcon,
00942                                                         'FIELD'=>$field
00943                                                 );
00944                                                 $out = $this->addUserTemplateMarkers($out,$table,$field,$row,$PA);
00945                                                         // String:
00946                                                 $out=$this->intoTemplate($out);
00947                                         }
00948                                 }
00949                         } else $this->commentMessages[]=$this->prependFormFieldNames.'['.$table.']['.$row['uid'].']['.$field.']: Disabled by TSconfig';
00950                 }
00951                         // Hook: getSingleField_postProcess
00952                 foreach ($this->hookObjectsSingleField as $hookObj)     {
00953                         if (method_exists($hookObj,'getSingleField_postProcess'))       {
00954                                 $hookObj->getSingleField_postProcess($table, $field, $row, $out, $PA, $this);
00955                         }
00956                 }
00957                         // Return value (string or array)
00958                 return $out;
00959         }
00960 
00972         function getSingleField_SW($table,$field,$row,&$PA)     {
00973                 $PA['fieldConf']['config']['form_type'] = $PA['fieldConf']['config']['form_type'] ? $PA['fieldConf']['config']['form_type'] : $PA['fieldConf']['config']['type'];       // Using "form_type" locally in this script
00974 
00975                 switch($PA['fieldConf']['config']['form_type']) {
00976                         case 'input':
00977                                 $item = $this->getSingleField_typeInput($table,$field,$row,$PA);
00978                         break;
00979                         case 'text':
00980                                 $item = $this->getSingleField_typeText($table,$field,$row,$PA);
00981                         break;
00982                         case 'check':
00983                                 $item = $this->getSingleField_typeCheck($table,$field,$row,$PA);
00984                         break;
00985                         case 'radio':
00986                                 $item = $this->getSingleField_typeRadio($table,$field,$row,$PA);
00987                         break;
00988                         case 'select':
00989                                 $item = $this->getSingleField_typeSelect($table,$field,$row,$PA);
00990                         break;
00991                         case 'group':
00992                                 $item = $this->getSingleField_typeGroup($table,$field,$row,$PA);
00993                         break;
00994                         case 'inline':
00995                                 $item = $this->inline->getSingleField_typeInline($table,$field,$row,$PA);
00996                         break;
00997                         case 'none':
00998                                 $item = $this->getSingleField_typeNone($table,$field,$row,$PA);
00999                         break;
01000                         case 'user':
01001                                 $item = $this->getSingleField_typeUser($table,$field,$row,$PA);
01002                         break;
01003                         case 'flex':
01004                                 $item = $this->getSingleField_typeFlex($table,$field,$row,$PA);
01005                         break;
01006                         default:
01007                                 $item = $this->getSingleField_typeUnknown($table,$field,$row,$PA);
01008                         break;
01009                 }
01010 
01011                 return $item;
01012         }
01013 
01014 
01015 
01016 
01017 
01018 
01019 
01020 
01021 
01022 
01023 
01024 
01025 
01026 
01027 
01028 
01029 
01030 
01031 
01032         /**********************************************************
01033          *
01034          * Rendering of each TCEform field type
01035          *
01036          ************************************************************/
01037 
01048         function getSingleField_typeInput($table,$field,$row,&$PA)      {
01049                 // typo3FormFieldSet(theField, evallist, is_in, checkbox, checkboxValue)
01050                 // typo3FormFieldGet(theField, evallist, is_in, checkbox, checkboxValue, checkbox_off)
01051 
01052                 $config = $PA['fieldConf']['config'];
01053 
01054 #               $specConf = $this->getSpecConfForField($table,$row,$field);
01055                 $specConf = $this->getSpecConfFromString($PA['extra'], $PA['fieldConf']['defaultExtras']);
01056                 $size = t3lib_div::intInRange($config['size']?$config['size']:30,5,$this->maxInputWidth);
01057                 $evalList = t3lib_div::trimExplode(',',$config['eval'],1);
01058 
01059 
01060                 if($this->renderReadonly || $config['readOnly'])  {
01061                         $itemFormElValue = $PA['itemFormElValue'];
01062                         if (in_array('date',$evalList)) {
01063                                 $config['format'] = 'date';
01064                         } elseif (in_array('date',$evalList))   {
01065                                 $config['format'] = 'date';
01066                         } elseif (in_array('datetime',$evalList))       {
01067                                 $config['format'] = 'datetime';
01068                         } elseif (in_array('time',$evalList))   {
01069                                 $config['format'] = 'time';
01070                         }
01071                         if (in_array('password',$evalList))     {
01072                                 $itemFormElValue = $itemFormElValue ? '*********' : '';
01073                         }
01074                         return $this->getSingleField_typeNone_render($config, $itemFormElValue);
01075                 }
01076 
01077                 foreach ($evalList as $func) {
01078                         switch ($func) {
01079                                 case 'required':
01080                                         $this->requiredFields[$table.'_'.$row['uid'].'_'.$field]=$PA['itemFormElName'];
01081                                         break;
01082                                 default:
01083                                         if (substr($func, 0, 3) == 'tx_')       {
01084                                                 // Pair hook to the one in t3lib_TCEmain::checkValue_input_Eval()
01085                                                 $evalObj = t3lib_div::getUserObj($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tce']['formevals'][$func].':&'.$func);
01086                                                 if (is_object($evalObj) && method_exists($evalObj, 'deevaluateFieldValue'))     {
01087                                                         $_params = array(
01088                                                                 'value' => $PA['itemFormElValue']
01089                                                         );
01090                                                         $PA['itemFormElValue'] = $evalObj->deevaluateFieldValue($_params);
01091                                                 }
01092                                         }
01093                                         break;
01094                         }
01095                 }
01096 
01097                 $paramsList = "'".$PA['itemFormElName']."','".implode(',',$evalList)."','".trim($config['is_in'])."',".(isset($config['checkbox'])?1:0).",'".$config['checkbox']."'";
01098                 if (isset($config['checkbox'])) {
01099                                 // Setting default "click-checkbox" values for eval types "date" and "datetime":
01100                         $thisMidnight = mktime(0,0,0);
01101                         $checkSetValue = in_array('date',$evalList) ? $thisMidnight : '';
01102                         $checkSetValue = in_array('datetime',$evalList) ? time() : $checkSetValue;
01103 
01104                         $cOnClick = 'typo3form.fieldGet('.$paramsList.',1,\''.$checkSetValue.'\');'.implode('',$PA['fieldChangeFunc']);
01105                         $item.='<input type="checkbox"'.$this->insertDefStyle('check').' name="'.$PA['itemFormElName'].'_cb" onclick="'.htmlspecialchars($cOnClick).'" />';
01106                 }
01107 
01108                 $PA['fieldChangeFunc'] = array_merge(array('typo3form.fieldGet'=>'typo3form.fieldGet('.$paramsList.');'), $PA['fieldChangeFunc']);
01109                 $mLgd = ($config['max']?$config['max']:256);
01110                 $iOnChange = implode('',$PA['fieldChangeFunc']);
01111                 $item.='<input type="text" name="'.$PA['itemFormElName'].'_hr" value=""'.$this->formWidth($size).' maxlength="'.$mLgd.'" onchange="'.htmlspecialchars($iOnChange).'"'.$PA['onFocus'].' />';     // This is the EDITABLE form field.
01112                 $item.='<input type="hidden" name="'.$PA['itemFormElName'].'" value="'.htmlspecialchars($PA['itemFormElValue']).'" />';                 // This is the ACTUAL form field - values from the EDITABLE field must be transferred to this field which is the one that is written to the database.
01113                 $this->extJSCODE.='typo3form.fieldSet('.$paramsList.');';
01114 
01115                         // going through all custom evaluations configured for this field
01116                 foreach ($evalList as $evalData) {
01117                         if (substr($evalData, 0, 3) == 'tx_')   {
01118                                 $evalObj = t3lib_div::getUserObj($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tce']['formevals'][$evalData].':&'.$evalData);
01119                                 if(is_object($evalObj) && method_exists($evalObj, 'returnFieldJS'))     {
01120                                         $this->extJSCODE .= "\n\nfunction ".$evalData."(value) {\n".$evalObj->returnFieldJS()."\n}\n";
01121                                 }
01122                         }
01123                 }
01124 
01125                         // Creating an alternative item without the JavaScript handlers.
01126                 $altItem = '<input type="hidden" name="'.$PA['itemFormElName'].'_hr" value="" />';
01127                 $altItem.= '<input type="hidden" name="'.$PA['itemFormElName'].'" value="'.htmlspecialchars($PA['itemFormElValue']).'" />';
01128 
01129                         // Wrap a wizard around the item?
01130                 $item= $this->renderWizards(array($item,$altItem),$config['wizards'],$table,$row,$field,$PA,$PA['itemFormElName'].'_hr',$specConf);
01131 
01132                 return $item;
01133         }
01134 
01145         function getSingleField_typeText($table,$field,$row,&$PA)       {
01146 
01147                         // Init config:
01148                 $config = $PA['fieldConf']['config'];
01149 
01150                 if($this->renderReadonly || $config['readOnly'])  {
01151                         return $this->getSingleField_typeNone_render($config, $PA['itemFormElValue']);
01152                 }
01153 
01154                         // Setting columns number:
01155                 $cols = t3lib_div::intInRange($config['cols'] ? $config['cols'] : 30, 5, $this->maxTextareaWidth);
01156 
01157                         // Setting number of rows:
01158                 $origRows = $rows = t3lib_div::intInRange($config['rows'] ? $config['rows'] : 5, 1, 20);
01159                 if (strlen($PA['itemFormElValue']) > $this->charsPerRow*2)      {
01160                         $cols = $this->maxTextareaWidth;
01161                         $rows = t3lib_div::intInRange(round(strlen($PA['itemFormElValue'])/$this->charsPerRow), count(explode(chr(10),$PA['itemFormElValue'])), 20);
01162                         if ($rows<$origRows)    $rows = $origRows;
01163                 }
01164 
01165                         // Init RTE vars:
01166                 $RTEwasLoaded = 0;                              // Set true, if the RTE is loaded; If not a normal textarea is shown.
01167                 $RTEwouldHaveBeenLoaded = 0;    // Set true, if the RTE would have been loaded if it wasn't for the disable-RTE flag in the bottom of the page...
01168 
01169                         // "Extra" configuration; Returns configuration for the field based on settings found in the "types" fieldlist. Traditionally, this is where RTE configuration has been found.
01170                 $specConf = $this->getSpecConfFromString($PA['extra'], $PA['fieldConf']['defaultExtras']);
01171 
01172                         // Setting up the altItem form field, which is a hidden field containing the value
01173                 $altItem = '<input type="hidden" name="'.htmlspecialchars($PA['itemFormElName']).'" value="'.htmlspecialchars($PA['itemFormElValue