Documentation TYPO3 par Ameos

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         var $clipObj=FALSE;                                     // Set to initialized clipboard object; Then the element browser will offer a link to paste in records from clipboard.
00233         var $enableClickMenu=FALSE;                     // Enable click menu on reference icons.
00234         var $enableTabMenu = FALSE;                     // Enable Tab Menus. If set to true, the JavaScript content from template::getDynTabMenuJScode() must be included in the document.
00235         var $renderReadonly = FALSE;            // When enabled all fields are rendered non-editable.
00236 
00237         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)
00238         var $form_largeComp = 1.33;                     // Form field width compensation: Compensation for large documents, doc-tab (editing)
00239         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.
00240         var $maxTextareaWidth=48;                       // The maximum abstract value for textareas
00241         var $maxInputWidth=48;                          // The maximum abstract value for input fields
00242         var $defaultMultipleSelectorStyle='width:250px;';       // Default style for the selector boxes used for multiple items in "select" and "group" types.
00243 
00244 
00245                 // INTERNAL, static
00246         var $prependFormFieldNames = 'data';            // The string to prepend formfield names with.
00247         var $prependCmdFieldNames = 'cmd';                      // The string to prepend commands for tcemain::process_cmdmap with.
00248         var $prependFormFieldNames_file = 'data_files';         // The string to prepend FILE form field names with.
00249         var $formName = 'editform';                                     // The name attribute of the form.
00250         var $allowOverrideMatrix = array();                     // Whitelist that allows TCA field configuration to be overridden by TSconfig, @see overrideFieldConf()
00251 
00252 
00253 
00254                 // INTERNAL, dynamic
00255         var $perms_clause='';                                           // Set by readPerms()  (caching)
00256         var $perms_clause_set=0;                                        // Set by readPerms()  (caching-flag)
00257         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).
00258         var $docLarge=0;                                                        // If set, the forms will be rendered a little wider, more precisely with a factor of $this->form_largeComp.
00259         var $clientInfo=array();                                        // Loaded with info about the browser when class is instantiated.
00260         var $RTEenabled=0;                                                      // True, if RTE is possible for the current user (based on result from BE_USER->isRTE())
00261         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)
00262         var $RTEcounter = 0;                                            // Counter that is incremented before an RTE is created. Can be used for unique ids etc.
00263 
00264         var $colorScheme;                                                       // Contains current color scheme
00265         var $classScheme;                                                       // Contains current class scheme
00266         var $defColorScheme;                                            // Contains the default color scheme
00267         var $defClassScheme;                                            // Contains the default class scheme
00268         var $fieldStyle;                                                        // Contains field style values
00269         var $borderStyle;                                                       // Contains border style values.
00270 
00271         var $commentMessages=array();                           // An accumulation of messages from the class.
00272 
00273                 // INTERNAL, templates
00274         var $totalWrap='<hr />|<hr />';                         // Total wrapping for the table rows.
00275         var $fieldTemplate='<b>###FIELD_NAME###</b><br />###FIELD_ITEM###<hr />';       // Field template
00276         var $sectionWrap='';                                            // Wrapping template code for a section
00277         var $palFieldTemplateHeader='';                         // Template for palette headers
00278         var $palFieldTemplate='';                                       // Template for palettes
00279 
00280                 // INTERNAL, working memory
00281         var $excludeElements='';                                        // Set to the fields NOT to display, if any.
00282         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)
00283         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!
00284         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.
00285         var $requiredElements=array();                          // Used to register the min and max number of elements for selectorboxes where that apply (in the "group" type for instance)
00286         var $renderDepth=0;                                                     // Keeps track of the rendering depth of nested records.
00287         var $savedSchemes=array();                                      // Color scheme buffer.
00288         var $dynTabLevelStack = array();                        // holds tab dividers which were cascaded, required for RTE&IRRE
00289 
00290                 // Internal, registers for user defined functions etc.
00291         var $additionalCode_pre = array();                      // Additional HTML code, printed before the form.
00292         var $additionalJS_pre = array();                        // Additional JavaScript, printed before the form
00293         var $additionalJS_post = array();                       // Additional JavaScript printed after the form
00294         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.
00295 
00296         var $inline;                                                            // Instance of t3lib_tceforms_inline
00297         var $hookObjectsMainFields = array();                   // Array containing hook class instances called once for a form
00298         var $hookObjectsSingleField = array();                  // Array containing hook class instances called for each field
00299         var $extraFormHeaders = array();                        // Rows gettings inserted into the alt_doc headers (when called from alt_doc.php)
00300 
00301 
00302 
00303 
00304 
00310         function t3lib_TCEforms()       {
00311                 global $CLIENT, $TYPO3_CONF_VARS;
00312 
00313                 $this->clientInfo = t3lib_div::clientInfo();
00314 
00315                 $this->RTEenabled = $GLOBALS['BE_USER']->isRTE();
00316                 if (!$this->RTEenabled) {
00317                         $this->RTEenabled_notReasons = implode(chr(10),$GLOBALS['BE_USER']->RTE_errors);
00318                         $this->commentMessages[] = 'RTE NOT ENABLED IN SYSTEM due to:'.chr(10).$this->RTEenabled_notReasons;
00319                 }
00320 
00321                         // Default color+class scheme
00322                 $this->defColorScheme = array(
00323                         $GLOBALS['SOBE']->doc->bgColor, // Background for the field AND palette
00324                         t3lib_div::modifyHTMLColorAll($GLOBALS['SOBE']->doc->bgColor,-20),      // Background for the field header
00325                         t3lib_div::modifyHTMLColorAll($GLOBALS['SOBE']->doc->bgColor,-10),      // Background for the palette field header
00326                         'black',        // Field header font color
00327                         '#666666'       // Palette field header font color
00328                 );
00329                 $this->defColorScheme = array();
00330 
00331                         // Override / Setting defaults from TBE_STYLES array
00332                 $this->resetSchemes();
00333 
00334                         // Setting the current colorScheme to default.
00335                 $this->defColorScheme = $this->colorScheme;
00336                 $this->defClassScheme = $this->classScheme;
00337 
00338                         // Define whitelist that allows TCA field configuration to be overridden by TSconfig, @see overrideFieldConf():
00339                 $this->allowOverrideMatrix = array(
00340                         'input' => array('size', 'max'),
00341                         'text' => array('cols', 'rows', 'wrap'),
00342                         'check' => array('cols', 'showIfRTE'),
00343                         'select' => array('size', 'autoSizeMax', 'maxitems', 'minitems'),
00344                         'group' => array('size', 'autoSizeMax', 'max_size', 'show_thumbs', 'maxitems', 'minitems'),
00345                         'inline' => array('appearance', 'foreign_label', 'foreign_selector', 'foreign_unique', 'maxitems', 'minitems', 'size', 'autoSizeMax', 'symmetric_label'),
00346                 );
00347 
00348                 $this->inline = t3lib_div::makeInstance('t3lib_TCEforms_inline');
00349 
00350                         // Prepare user defined objects (if any) for hooks which extend this function:
00351                 $this->hookObjectsMainFields = array();
00352                 if (is_array ($TYPO3_CONF_VARS['SC_OPTIONS']['t3lib/class.t3lib_tceforms.php']['getMainFieldsClass']))  {
00353                         foreach ($TYPO3_CONF_VARS['SC_OPTIONS']['t3lib/class.t3lib_tceforms.php']['getMainFieldsClass'] as $classRef)   {
00354                                 $this->hookObjectsMainFields[] = &t3lib_div::getUserObj($classRef);
00355                         }
00356                 }
00357                 $this->hookObjectsSingleField = array();
00358                 if (is_array ($TYPO3_CONF_VARS['SC_OPTIONS']['t3lib/class.t3lib_tceforms.php']['getSingleFieldClass'])) {
00359                         foreach ($TYPO3_CONF_VARS['SC_OPTIONS']['t3lib/class.t3lib_tceforms.php']['getSingleFieldClass'] as $classRef)  {
00360                                 $this->hookObjectsSingleField[] = &t3lib_div::getUserObj($classRef);
00361                         }
00362                 }
00363 
00364         }
00365 
00371         function initDefaultBEmode()    {
00372                 global $BE_USER;
00373                 $this->prependFormFieldNames = 'data';
00374                 $this->formName = 'editform';
00375                 $this->setNewBEDesign();
00376                 $this->docLarge = $BE_USER->uc['edit_wideDocument'] ? 1 : 0;
00377                 $this->edit_showFieldHelp = $BE_USER->uc['edit_showFieldHelp'];
00378 
00379                 $this->edit_docModuleUpload = $BE_USER->uc['edit_docModuleUpload'];
00380                 $this->titleLen = $BE_USER->uc['titleLen'];             // @deprecated
00381 
00382                 $this->inline->init($this);
00383         }
00384 
00385 
00386 
00387 
00388 
00389 
00390 
00391 
00392 
00393 
00394 
00395 
00396 
00397 
00398 
00399 
00400 
00401         /*******************************************************
00402          *
00403          * Rendering the forms, fields etc
00404          *
00405          *******************************************************/
00406 
00418         function getSoloField($table,$row,$theFieldToReturn)    {
00419                 global $TCA;
00420 
00421                 if ($TCA[$table])       {
00422                         t3lib_div::loadTCA($table);
00423                         $typeNum = $this->getRTypeNum($table,$row);
00424                         if ($TCA[$table]['types'][$typeNum])    {
00425                                 $itemList = $TCA[$table]['types'][$typeNum]['showitem'];
00426                                 if ($itemList)  {
00427                                         $fields = t3lib_div::trimExplode(',',$itemList,1);
00428                                         $excludeElements = $this->excludeElements = $this->getExcludeElements($table,$row,$typeNum);
00429 
00430                                         reset($fields);
00431                                         while(list(,$fieldInfo)=each($fields))  {
00432                                                 $parts = explode(';',$fieldInfo);
00433 
00434                                                 $theField = trim($parts[0]);
00435                                                 if (!in_array($theField,$excludeElements) && !strcmp($theField,$theFieldToReturn))      {
00436                                                         if ($TCA[$table]['columns'][$theField]) {
00437                                                                 $sField = $this->getSingleField($table,$theField,$row,$parts[1],1,$parts[3],$parts[2]);
00438                                                                 return $sField['ITEM'];
00439                                                         }
00440                                                 }
00441                                         }
00442                                 }
00443                         }
00444                 }
00445         }
00446 
00457         function getMainFields($table,$row,$depth=0)    {
00458                 global $TCA, $TYPO3_CONF_VARS;
00459 
00460                 $this->renderDepth=$depth;
00461 
00462                         // Init vars:
00463                 $out_array = array(array());
00464                 $out_array_meta = array(array(
00465                         'title' => $this->getLL('l_generalTab')
00466                 ));
00467 
00468                 $out_pointer=0;
00469                 $out_sheet=0;
00470                 $this->palettesRendered=array();
00471                 $this->palettesRendered[$this->renderDepth][$table]=array();
00472 
00473                         // Hook: getMainFields_preProcess (requested by Thomas Hempel for use with the "dynaflex" extension)
00474                 foreach ($this->hookObjectsMainFields as $hookObj)      {
00475                         if (method_exists($hookObj,'getMainFields_preProcess')) {
00476                                 $hookObj->getMainFields_preProcess($table,$row,$this);
00477                         }
00478                 }
00479 
00480                 if ($TCA[$table])       {
00481 
00482                                 // Load the full TCA for the table.
00483                         t3lib_div::loadTCA($table);
00484 
00485                                 // Load the description content for the table.
00486                         if ($this->edit_showFieldHelp || $this->doLoadTableDescr($table))       {
00487                                 $GLOBALS['LANG']->loadSingleTableDescription($table);
00488                         }
00489                                 // Get the current "type" value for the record.
00490                         $typeNum = $this->getRTypeNum($table,$row);
00491 
00492                                 // Find the list of fields to display:
00493                         if ($TCA[$table]['types'][$typeNum])    {
00494                                 $itemList = $TCA[$table]['types'][$typeNum]['showitem'];
00495                                 if ($itemList)  {       // If such a list existed...
00496                                                 // if TCEforms will render a tab menu in the next step, push the name to the tab stack
00497                                         if (strstr($itemList, '--div--') !== false && $this->enableTabMenu && $TCA[$table]['ctrl']['dividers2tabs']) {
00498                                                 $tabIdentString = 'TCEforms:'.$table.':'.$row['uid'];
00499                                                 $tabIdentStringMD5 = $GLOBALS['TBE_TEMPLATE']->getDynTabMenuId('TCEforms:'.$table.':'.$row['uid']);
00500                                                 $this->dynTabLevelStack[$tabIdentStringMD5] = 1;
00501                                         }
00502 
00503                                                 // Explode the field list and possibly rearrange the order of the fields, if configured for
00504                                         $fields = t3lib_div::trimExplode(',',$itemList,1);
00505                                         if ($this->fieldOrder)  {
00506                                                 $fields = $this->rearrange($fields);
00507                                         }
00508 
00509                                                 // Get excluded fields, added fiels and put it together:
00510                                         $excludeElements = $this->excludeElements = $this->getExcludeElements($table,$row,$typeNum);
00511                                         $fields = $this->mergeFieldsWithAddedFields($fields,$this->getFieldsToAdd($table,$row,$typeNum));
00512 
00513                                                 // Traverse the fields to render:
00514                                         $cc=0;
00515                                         foreach($fields as $fieldInfo)  {
00516                                                         // Exploding subparts of the field configuration:
00517                                                 $parts = explode(';',$fieldInfo);
00518 
00519                                                         // Getting the style information out:
00520                                                 $color_style_parts = t3lib_div::trimExplode('-',$parts[4]);
00521                                                 if (strcmp($color_style_parts[0],''))   {
00522                                                         $this->setColorScheme($GLOBALS['TBE_STYLES']['colorschemes'][intval($color_style_parts[0])]);
00523                                                 }
00524                                                 if (strcmp($color_style_parts[1],''))   {
00525                                                         $this->fieldStyle = $GLOBALS['TBE_STYLES']['styleschemes'][intval($color_style_parts[1])];
00526                                                         if (!isset($this->fieldStyle))  $this->fieldStyle = $GLOBALS['TBE_STYLES']['styleschemes'][0];
00527                                                 }
00528                                                 if (strcmp($color_style_parts[2],''))   {
00529                                                         $this->wrapBorder($out_array[$out_sheet],$out_pointer);
00530                                                         $this->borderStyle = $GLOBALS['TBE_STYLES']['borderschemes'][intval($color_style_parts[2])];
00531                                                         if (!isset($this->borderStyle)) $this->borderStyle = $GLOBALS['TBE_STYLES']['borderschemes'][0];
00532                                                 }
00533 
00534                                                         // Render the field:
00535                                                 $theField = $parts[0];
00536                                                 if (!in_array($theField,$excludeElements))      {
00537                                                         if ($TCA[$table]['columns'][$theField]) {
00538                                                                 $sFieldPal='';
00539 
00540                                                                 if ($parts[2] && !isset($this->palettesRendered[$this->renderDepth][$table][$parts[2]]))        {
00541                                                                         $sFieldPal=$this->getPaletteFields($table,$row,$parts[2]);
00542                                                                         $this->palettesRendered[$this->renderDepth][$table][$parts[2]] = 1;
00543                                                                 }
00544                                                                 $sField = $this->getSingleField($table,$theField,$row,$parts[1],0,$parts[3],$parts[2]);
00545                                                                 if ($sField)    { $sField.= $sFieldPal; }
00546 
00547                                                                 $out_array[$out_sheet][$out_pointer].= $sField;
00548                                                         } elseif ($theField=='--div--') {
00549                                                                 if ($cc>0)      {
00550                                                                         $out_array[$out_sheet][$out_pointer].=$this->getDivider();
00551 
00552                                                                         if ($this->enableTabMenu && $TCA[$table]['ctrl']['dividers2tabs'])      {
00553                                                                                 $this->wrapBorder($out_array[$out_sheet],$out_pointer);
00554                                                                                 $out_sheet++;
00555                                                                                         // remember what sheet we're currently in
00556                                                                                 $this->dynTabLevelStack[$tabIdentStringMD5] = $out_sheet+1;
00557                                                                                 $out_array[$out_sheet] = array();
00558                                                                                 $out_array_meta[$out_sheet]['title'] = $this->sL($parts[1]);
00559                                                                         }
00560                                                                 } else {        // Setting alternative title for "General" tab if "--div--" is the very first element.
00561                                                                         $out_array_meta[$out_sheet]['title'] = $this->sL($parts[1]);
00562                                                                 }
00563                                                         } elseif($theField=='--palette--')      {
00564                                                                 if ($parts[2] && !isset($this->palettesRendered[$this->renderDepth][$table][$parts[2]]))        {
00565                                                                                 // render a 'header' if not collapsed
00566                                                                         if ($TCA[$table]['palettes'][$parts[2]]['canNotCollapse'] AND $parts[1]) {
00567                                                                                 $out_array[$out_sheet][$out_pointer].=$this->getPaletteFields($table,$row,$parts[2],$this->sL($parts[1]));
00568                                                                         } else {
00569                                                                                 $out_array[$out_sheet][$out_pointer].=$this->getPaletteFields($table,$row,$parts[2],'','',$this->sL($parts[1]));
00570                                                                         }
00571                                                                         $this->palettesRendered[$this->renderDepth][$table][$parts[2]] = 1;
00572                                                                 }
00573                                                         }
00574                                                 }
00575 
00576                                                 $cc++;
00577                                         }
00578                                 }
00579                         }
00580                 }
00581 
00582                         // Hook: getMainFields_postProcess (requested by Thomas Hempel for use with the "dynaflex" extension)
00583                 foreach ($this->hookObjectsMainFields as $hookObj)      {
00584                         if (method_exists($hookObj,'getMainFields_postProcess'))        {
00585                                 $hookObj->getMainFields_postProcess($table,$row,$this);
00586                         }
00587                 }
00588 
00589                         // Wrapping a border around it all:
00590                 $this->wrapBorder($out_array[$out_sheet],$out_pointer);
00591 
00592                         // Resetting styles:
00593                 $this->resetSchemes();
00594 
00595                         // Rendering Main palettes, if any
00596                 $mParr = t3lib_div::trimExplode(',',$TCA[$table]['ctrl']['mainpalette']);
00597                 $i = 0;
00598                 if (count($mParr))      {
00599                         foreach ($mParr as $mP) {
00600                                 if (!isset($this->palettesRendered[$this->renderDepth][$table][$mP]))   {
00601                                         $temp_palettesCollapsed=$this->palettesCollapsed;
00602                                         $this->palettesCollapsed=0;
00603                                         $label = ($i==0?$this->getLL('l_generalOptions'):$this->getLL('l_generalOptions_more'));
00604                                         $out_array[$out_sheet][$out_pointer].=$this->getPaletteFields($table,$row,$mP,$label);
00605                                         $this->palettesCollapsed=$temp_palettesCollapsed;
00606                                         $this->palettesRendered[$this->renderDepth][$table][$mP] = 1;
00607                                 }
00608                                 $this->wrapBorder($out_array[$out_sheet],$out_pointer);
00609                                 $i++;
00610                                 if ($this->renderDepth) {
00611                                         $this->renderDepth--;
00612                                 }
00613                         }
00614                 }
00615 
00616                         // Return the imploded $out_array:
00617                 if ($out_sheet>0)       {       // There were --div-- dividers around...
00618 
00619                                 // Create parts array for the tab menu:
00620                         $parts = array();
00621                         foreach ($out_array as $idx => $sheetContent)   {
00622                                 $parts[] = array(
00623                                         'label' => $out_array_meta[$idx]['title'],
00624                                         'content' => '<table border="0" cellspacing="0" cellpadding="0" width="100%">'.
00625                                                         implode('',$sheetContent).
00626                                                 '</table>'
00627                                 );
00628                         }
00629 
00630                                 // unset the current level of tab menus
00631                         unset($this->dynTabLevelStack[$tabIdentStringMD5]);
00632 
00633                         return '
00634                                 <tr>
00635                                         <td colspan="2">
00636                                         '.$this->getDynTabMenu($parts, $tabIdentString).'
00637                                         </td>
00638                                 </tr>';
00639                 } else {        // Only one, so just implode:
00640                         return implode('',$out_array[$out_sheet]);
00641                 }
00642         }
00643 
00654         function getListedFields($table,$row,$list)     {
00655                 global $TCA;
00656 
00657                 t3lib_div::loadTCA($table);
00658                 if ($this->edit_showFieldHelp || $this->doLoadTableDescr($table))       {
00659                         $GLOBALS['LANG']->loadSingleTableDescription($table);
00660                 }
00661 
00662                 $out = '';
00663                 $types_fieldConfig = t3lib_BEfunc::getTCAtypes($table,$row,1);
00664 
00665                 $editFieldList=array_unique(t3lib_div::trimExplode(',',$list,1));
00666                 foreach($editFieldList as $theFieldC)   {
00667                         list($theField,$palFields) = split('\[|\]',$theFieldC);
00668                         $theField = trim($theField);
00669                         $palFields = trim($palFields);
00670                         if ($TCA[$table]['columns'][$theField]) {
00671                                 $parts = t3lib_div::trimExplode(';',$types_fieldConfig[$theField]['origString']);
00672                                 $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.
00673                                 $out.= $sField;
00674                         } elseif($theField=='--div--')  {
00675                                 $out.= $this->getDivider();
00676                         }
00677                         if ($palFields) {
00678                                 $out.= $this->getPaletteFields($table,$row,'','',implode(',',t3lib_div::trimExplode('|',$palFields,1)));
00679                         }
00680                 }
00681 
00682                 return $out;
00683         }
00684 
00696         function getPaletteFields($table,$row,$palette,$header='',$itemList='',$collapsedHeader='')     {
00697                 global $TCA;
00698                 if (!$this->doPrintPalette)     return '';
00699 
00700                 $out='';
00701                 $palParts = array();
00702                 t3lib_div::loadTCA($table);
00703 
00704                         // Getting excludeElements, if any.
00705                 if (!is_array($this->excludeElements))  {
00706                         $this->excludeElements = $this->getExcludeElements($table,$row,$this->getRTypeNum($table,$row));
00707                 }
00708 
00709                         // Render the palette TCEform elements.
00710                 if ($TCA[$table] && (is_array($TCA[$table]['palettes'][$palette]) || $itemList))        {
00711                         $itemList = $itemList?$itemList:$TCA[$table]['palettes'][$palette]['showitem'];
00712                         if ($itemList)  {
00713                                 $fields = t3lib_div::trimExplode(',',$itemList,1);
00714                                 reset($fields);
00715                                 while(list(,$fieldInfo)=each($fields))  {
00716                                         $parts = t3lib_div::trimExplode(';',$fieldInfo);
00717                                         $theField = $parts[0];
00718 
00719                                         if (!in_array($theField,$this->excludeElements) && $TCA[$table]['columns'][$theField])  {
00720                                                 $this->palFieldArr[$palette][] = $theField;
00721                                                 if ($this->isPalettesCollapsed($table,$palette))        {
00722                                                         $this->hiddenFieldListArr[] = $theField;
00723                                                 }
00724 
00725                                                 $part = $this->getSingleField($table,$theField,$row,$parts[1],1,'',$parts[2]);
00726                                                 if (is_array($part))    {
00727                                                         $palParts[] = $part;
00728                                                 }
00729                                         }
00730                                 }
00731                         }
00732                 }
00733                         // Put palette together if there are fields in it:
00734                 if (count($palParts))   {
00735                         if ($header)    {
00736                                 $out.= $this->intoTemplate(array(
00737                                                                 'HEADER' => htmlspecialchars($header)
00738                                                         ),
00739                                                         $this->palFieldTemplateHeader
00740                                                 );
00741                         }
00742                         $out.= $this->intoTemplate(array(
00743                                                         'PALETTE' => $this->printPalette($palParts)
00744                                                 ),
00745                                                 $this->palFieldTemplate
00746                                         );
00747                 }
00748                         // 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.
00749                 if ($this->isPalettesCollapsed($table,$palette) && $collapsedHeader)    {
00750                         $pC = $this->intoTemplate(array(
00751                                                         '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),
00752                                                 ),
00753                                                 $this->palFieldTemplate
00754                                         );
00755                         $out.= $pC;
00756                 }
00757 
00758                 return $out;
00759         }
00760 
00773         function getSingleField($table,$field,$row,$altName='',$palette=0,$extra='',$pal=0)     {
00774                 global $TCA,$BE_USER;
00775 
00776                         // Hook: getSingleField_preProcess
00777                 foreach ($this->hookObjectsSingleField as $hookObj)     {
00778                         if (method_exists($hookObj,'getSingleField_preProcess'))        {
00779                                 $hookObj->getSingleField_preProcess($table, $field, $row, $altName, $palette, $extra, $pal, $this);
00780                         }
00781                 }
00782 
00783                 $out = '';
00784                 $PA = array();
00785                 $PA['altName'] = $altName;
00786                 $PA['palette'] = $palette;
00787                 $PA['extra'] = $extra;
00788                 $PA['pal'] = $pal;
00789 
00790                         // Make sure to load full $TCA array for the table:
00791                 t3lib_div::loadTCA($table);
00792 
00793                         // Get the TCA configuration for the current field:
00794                 $PA['fieldConf'] = $TCA[$table]['columns'][$field];
00795                 $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
00796 
00797                 $skipThisField = $this->inline->skipField($table, $field, $row, $PA['fieldConf']['config']);
00798 
00799                         // Now, check if this field is configured and editable (according to excludefields + other configuration)
00800                 if (    is_array($PA['fieldConf']) &&
00801                                 !$skipThisField &&
00802                                 (!$PA['fieldConf']['exclude'] || $BE_USER->check('non_exclude_fields',$table.':'.$field)) &&
00803                                 $PA['fieldConf']['config']['form_type']!='passthrough' &&
00804                                 ($this->RTEenabled || !$PA['fieldConf']['config']['showIfRTE']) &&
00805                                 (!$PA['fieldConf']['displayCond'] || $this->isDisplayCondition($PA['fieldConf']['displayCond'],$row)) &&
00806                                 (!$TCA[$table]['ctrl']['languageField'] || $PA['fieldConf']['l10n_display'] || strcmp($PA['fieldConf']['l10n_mode'],'exclude') || $row[$TCA[$table]['ctrl']['languageField']]<=0) &&
00807                                 (!$TCA[$table]['ctrl']['languageField'] || !$this->localizationMode || $this->localizationMode===$PA['fieldConf']['l10n_cat'])
00808                         )       {
00809 
00810 
00811 
00812                                 // Fetching the TSconfig for the current table/field. This includes the $row which means that
00813                         $PA['fieldTSConfig'] = $this->setTSconfig($table,$row,$field);
00814 
00815                                 // If the field is NOT disabled from TSconfig (which it could have been) then render it
00816                         if (!$PA['fieldTSConfig']['disabled'])  {
00817                                         // Override fieldConf by fieldTSconfig:
00818                                 $PA['fieldConf']['config'] = $this->overrideFieldConf($PA['fieldConf']['config'], $PA['fieldTSConfig']);
00819 
00820                                         // Init variables:
00821                                 $PA['itemFormElName']=$this->prependFormFieldNames.'['.$table.']['.$row['uid'].']['.$field.']';         // Form field name
00822                                 $PA['itemFormElName_file']=$this->prependFormFieldNames_file.'['.$table.']['.$row['uid'].']['.$field.']';       // Form field name, in case of file uploads
00823                                 $PA['itemFormElValue']=$row[$field];            // The value to show in the form field.
00824                                 $PA['itemFormElID']=$this->prependFormFieldNames.'_'.$table.'_'.$row['uid'].'_'.$field;
00825 
00826                                         // set field to read-only if configured for translated records to show default language content as readonly
00827                                 if ($PA['fieldConf']['l10n_display'] AND t3lib_div::inList($PA['fieldConf']['l10n_display'], 'defaultAsReadonly') AND $row[$TCA[$table]['ctrl']['languageField']]) {
00828                                         $PA['fieldConf']['config']['readOnly'] =  true;
00829                                         $PA['itemFormElValue'] = $this->defaultLanguageData[$table.':'.$row['uid']][$field];
00830                                 }
00831 
00832                                         // 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"
00833                                 if (
00834                                         ($TCA[$table]['ctrl']['type'] && !strcmp($field,$TCA[$table]['ctrl']['type'])) ||
00835                                         ($TCA[$table]['ctrl']['requestUpdate'] && t3lib_div::inList($TCA[$table]['ctrl']['requestUpdate'],$field))) {
00836                                         if($GLOBALS['BE_USER']->jsConfirmation(1))      {
00837                                                 $alertMsgOnChange = 'if (confirm(TBE_EDITOR.labels.onChangeAlert) && TBE_EDITOR.checkSubmit(-1)){ TBE_EDITOR.submitForm() };';
00838                                         } else {
00839                                                 $alertMsgOnChange = 'if (TBE_EDITOR.checkSubmit(-1)){ TBE_EDITOR.submitForm() };';
00840                                         }
00841                                 } else {
00842                                         $alertMsgOnChange = '';
00843                                 }
00844 
00845                                         // Render as a hidden field?
00846                                 if (in_array($field,$this->hiddenFieldListArr)) {
00847                                         $this->hiddenFieldAccum[]='<input type="hidden" name="'.$PA['itemFormElName'].'" value="'.htmlspecialchars($PA['itemFormElValue']).'" />';
00848                                 } else {        // Render as a normal field:
00849 
00850                                                 // 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.
00851                                         if (!$PA['palette'])    {
00852                                                 if ($PA['pal'] && $this->isPalettesCollapsed($table,$PA['pal']))        {
00853                                                         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);
00854                                                 } else {
00855                                                         $thePalIcon = '';
00856                                                         $palJSfunc = '';
00857                                                 }
00858                                         }
00859                                                 // onFocus attribute to add to the field:
00860                                         $PA['onFocus'] = ($palJSfunc && !$BE_USER->uc['dontShowPalettesOnFocusInAB']) ? ' onfocus="'.htmlspecialchars($palJSfunc).'"' : '';
00861 
00862                                                 // Find item
00863                                         $item='';
00864                                         $PA['label'] = $PA['altName'] ? $PA['altName'] : $PA['fieldConf']['label'];
00865                                         $PA['label'] = $this->sL($PA['label']);
00866                                                 // JavaScript code for event handlers:
00867                                         $PA['fieldChangeFunc']=array();
00868                                         $PA['fieldChangeFunc']['TBE_EDITOR_fieldChanged'] = "TBE_EDITOR.fieldChanged('".$table."','".$row['uid']."','".$field."','".$PA['itemFormElName']."');";
00869                                         $PA['fieldChangeFunc']['alert']=$alertMsgOnChange;
00870                                                 // if this is the child of an inline type and it is the field creating the label
00871                                         if ($this->inline->isInlineChildAndLabelField($table, $field)) {
00872                                                 $PA['fieldChangeFunc']['inline'] = "inline.handleChangedField('".$PA['itemFormElName']."','".$this->inline->inlineNames['object']."[$table][".$row['uid']."]');";
00873                                         }
00874 
00875                                                 // Based on the type of the item, call a render function:
00876                                         $item = $this->getSingleField_SW($table,$field,$row,$PA);
00877 
00878                                                 // Add language + diff
00879                                         if ($PA['fieldConf']['l10n_display'] && (t3lib_div::inList($PA['fieldConf']['l10n_display'], 'hideDiff') || t3lib_div::inList($PA['fieldConf']['l10n_display'], 'defaultAsReadonly'))) {
00880                                                 $renderLanguageDiff = false;
00881                                         } else {
00882                                                 $renderLanguageDiff = true;
00883                                         }
00884 
00885                                         if ($renderLanguageDiff) {
00886                                                 $item = $this->renderDefaultLanguageContent($table,$field,$row,$item);
00887                                                 $item = $this->renderDefaultLanguageDiff($table,$field,$row,$item);
00888                                         }
00889 
00890                                                 // 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
00891                                         $PA['label'] = t3lib_div::deHSCentities(htmlspecialchars($PA['label']));
00892                                         if (t3lib_div::testInt($row['uid']) && $PA['fieldTSConfig']['linkTitleToSelf']) {
00893                                                 $lTTS_url = $this->backPath.'alt_doc.php?edit['.$table.']['.$row['uid'].']=edit&columnsOnly='.$field.
00894                                                                         ($PA['fieldTSConfig']['linkTitleToSelf.']['returnUrl']?'&returnUrl='.rawurlencode($this->thisReturnUrl()):'');
00895                                                 $PA['label'] = '<a href="'.htmlspecialchars($lTTS_url).'">'.$PA['label'].'</a>';
00896                                         }
00897 
00898                                                 // Create output value:
00899                                         if ($PA['fieldConf']['config']['form_type']=='user' && $PA['fieldConf']['config']['noTableWrapping'])   {
00900                                                 $out = $item;
00901                                         } elseif ($PA['palette'])       {
00902                                                         // Array:
00903                                                 $out=array(
00904                                                         'NAME'=>$PA['label'],
00905                                                         'ID'=>$row['uid'],
00906                                                         'FIELD'=>$field,
00907                                                         'TABLE'=>$table,
00908                                                         'ITEM'=>$item,
00909                                                         'HELP_ICON' => $this->helpTextIcon($table,$field,1)
00910                                                 );
00911                                                 $out = $this->addUserTemplateMarkers($out,$table,$field,$row,$PA);
00912                                         } else {
00913                                                         // String:
00914                                                 $out=array(
00915                                                         'NAME'=>$PA['label'],
00916                                                         'ITEM'=>$item,
00917                                                         'TABLE'=>$table,
00918                                                         'ID'=>$row['uid'],
00919                                                         'HELP_ICON'=>$this->helpTextIcon($table,$field),
00920                                                         'HELP_TEXT'=>$this->helpText($table,$field),
00921                                                         'PAL_LINK_ICON'=>$thePalIcon,
00922                                                         'FIELD'=>$field
00923                                                 );
00924                                                 $out = $this->addUserTemplateMarkers($out,$table,$field,$row,$PA);
00925                                                         // String:
00926                                                 $out=$this->intoTemplate($out);
00927                                         }
00928                                 }
00929                         } else $this->commentMessages[]=$this->prependFormFieldNames.'['.$table.']['.$row['uid'].']['.$field.']: Disabled by TSconfig';
00930                 }
00931                         // Hook: getSingleField_postProcess
00932                 foreach ($this->hookObjectsSingleField as $hookObj)     {
00933                         if (method_exists($hookObj,'getSingleField_postProcess'))       {
00934                                 $hookObj->getSingleField_postProcess($table, $field, $row, $out, $PA, $this);
00935                         }
00936                 }
00937                         // Return value (string or array)
00938                 return $out;
00939         }
00940 
00952         function getSingleField_SW($table,$field,$row,&$PA)     {
00953                 $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
00954 
00955                 switch($PA['fieldConf']['config']['form_type']) {
00956                         case 'input':
00957                                 $item = $this->getSingleField_typeInput($table,$field,$row,$PA);
00958                         break;
00959                         case 'text':
00960                                 $item = $this->getSingleField_typeText($table,$field,$row,$PA);
00961                         break;
00962                         case 'check':
00963                                 $item = $this->getSingleField_typeCheck($table,$field,$row,$PA);
00964                         break;
00965                         case 'radio':
00966                                 $item = $this->getSingleField_typeRadio($table,$field,$row,$PA);
00967                         break;
00968                         case 'select':
00969                                 $item = $this->getSingleField_typeSelect($table,$field,$row,$PA);
00970                         break;
00971                         case 'group':
00972                                 $item = $this->getSingleField_typeGroup($table,$field,$row,$PA);
00973                         break;
00974                         case 'inline':
00975                                 $item = $this->inline->getSingleField_typeInline($table,$field,$row,$PA);
00976                         break;
00977                         case 'none':
00978                                 $item = $this->getSingleField_typeNone($table,$field,$row,$PA);
00979                         break;
00980                         case 'user':
00981                                 $item = $this->getSingleField_typeUser($table,$field,$row,$PA);
00982                         break;
00983                         case 'flex':
00984                                 $item = $this->getSingleField_typeFlex($table,$field,$row,$PA);
00985                         break;
00986                         default:
00987                                 $item = $this->getSingleField_typeUnknown($table,$field,$row,$PA);
00988                         break;
00989                 }
00990 
00991                 return $item;
00992         }
00993 
00994 
00995 
00996 
00997 
00998 
00999 
01000 
01001 
01002 
01003 
01004 
01005 
01006 
01007 
01008 
01009 
01010 
01011 
01012         /**********************************************************
01013          *
01014          * Rendering of each TCEform field type
01015          *
01016          ************************************************************/
01017 
01028         function getSingleField_typeInput($table,$field,$row,&$PA)      {
01029                 // typo3FormFieldSet(theField, evallist, is_in, checkbox, checkboxValue)
01030                 // typo3FormFieldGet(theField, evallist, is_in, checkbox, checkboxValue, checkbox_off)
01031 
01032                 $config = $PA['fieldConf']['config'];
01033 
01034 #               $specConf = $this->getSpecConfForField($table,$row,$field);
01035                 $specConf = $this->getSpecConfFromString($PA['extra'], $PA['fieldConf']['defaultExtras']);
01036                 $size = t3lib_div::intInRange($config['size']?$config['size']:30,5,$this->maxInputWidth);
01037                 $evalList = t3lib_div::trimExplode(',',$config['eval'],1);
01038 
01039 
01040                 if($this->renderReadonly || $config['readOnly'])  {
01041                         $itemFormElValue = $PA['itemFormElValue'];
01042                         if (in_array('date',$evalList)) {
01043                                 $config['format'] = 'date';
01044                         } elseif (in_array('date',$evalList))   {
01045                                 $config['format'] = 'date';
01046                         } elseif (in_array('datetime',$evalList))       {
01047                                 $config['format'] = 'datetime';
01048                         } elseif (in_array('time',$evalList))   {
01049                                 $config['format'] = 'time';
01050                         }
01051                         if (in_array('password',$evalList))     {
01052                                 $itemFormElValue = $itemFormElValue ? '*********' : '';
01053                         }
01054                         return $this->getSingleField_typeNone_render($config, $itemFormElValue);
01055                 }
01056 
01057                 if (in_array('required',$evalList))     {
01058                         $this->requiredFields[$table.'_'.$row['uid'].'_'.$field]=$PA['itemFormElName'];
01059                 }
01060 
01061                 $paramsList = "'".$PA['itemFormElName']."','".implode(',',$evalList)."','".trim($config['is_in'])."',".(isset($config['checkbox'])?1:0).",'".$config['checkbox']."'";
01062                 if (isset($config['checkbox'])) {
01063                                 // Setting default "click-checkbox" values for eval types "date" and "datetime":
01064                         $thisMidnight = mktime(0,0,0);
01065                         $checkSetValue = in_array('date',$evalList) ? $thisMidnight : '';
01066                         $checkSetValue = in_array('datetime',$evalList) ? time() : $checkSetValue;
01067 
01068                         $cOnClick = 'typo3form.fieldGet('.$paramsList.',1,\''.$checkSetValue.'\');'.implode('',$PA['fieldChangeFunc']);
01069                         $item.='<input type="checkbox"'.$this->insertDefStyle('check').' name="'.$PA['itemFormElName'].'_cb" onclick="'.htmlspecialchars($cOnClick).'" />';
01070                 }
01071 
01072                 $PA['fieldChangeFunc'] = array_merge(array('typo3form.fieldGet'=>'typo3form.fieldGet('.$paramsList.');'), $PA['fieldChangeFunc']);
01073                 $mLgd = ($config['max']?$config['max']:256);
01074                 $iOnChange = implode('',$PA['fieldChangeFunc']);
01075                 $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.
01076                 $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.
01077                 $this->extJSCODE.='typo3form.fieldSet('.$paramsList.');';
01078 
01079                         // going through all custom evaluations configured for this field
01080                 foreach ($evalList as $evalData) {
01081                         if (substr($evalData, 0, 3) == 'tx_')   {
01082                                 $evalObj = t3lib_div::getUserObj($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tce']['formevals'][$evalData].':&'.$evalData);
01083                                 if(is_object($evalObj) && method_exists($evalObj, 'returnFieldJS'))     {
01084                                         $this->extJSCODE .= "\n\nfunction ".$evalData."(value) {\n".$evalObj->returnFieldJS()."\n}\n";
01085                                 }
01086                         }
01087                 }
01088 
01089                         // Creating an alternative item without the JavaScript handlers.
01090                 $altItem = '<input type="hidden" name="'.$PA['itemFormElName'].'_hr" value="" />';
01091                 $altItem.= '<input type="hidden" name="'.$PA['itemFormElName'].'" value="'.htmlspecialchars($PA['itemFormElValue']).'" />';
01092 
01093                         // Wrap a wizard around the item?
01094                 $item= $this->renderWizards(array($item,$altItem),$config['wizards'],$table,$row,$field,$PA,$PA['itemFormElName'].'_hr',$specConf);
01095 
01096                 return $item;
01097         }
01098 
01109         function getSingleField_typeText($table,$field,$row,&$PA)       {
01110 
01111                         // Init config:
01112                 $config = $PA['fieldConf']['config'];
01113 
01114                 if($this->renderReadonly || $config['readOnly'])  {
01115                         return $this->getSingleField_typeNone_render($config, $PA['itemFormElValue']);
01116                 }
01117 
01118                         // Setting columns number:
01119                 $cols = t3lib_div::intInRange($config['cols'] ? $config['cols'] : 30, 5, $this->maxTextareaWidth);
01120 
01121                         // Setting number of rows:
01122                 $origRows = $rows = t3lib_div::intInRange($config['rows'] ? $config['rows'] : 5, 1, 20);
01123                 if (strlen($PA['itemFormElValue']) > $this->charsPerRow*2)      {
01124                         $cols = $this->maxTextareaWidth;
01125                         $rows = t3lib_div::intInRange(round(strlen($PA['itemFormElValue'])/$this->charsPerRow), count(explode(chr(10),$PA['itemFormElValue'])), 20);
01126                         if ($rows<$origRows)    $rows = $origRows;
01127                 }
01128 
01129                         // Init RTE vars:
01130                 $RTEwasLoaded = 0;                              // Set true, if the RTE is loaded; If not a normal textarea is shown.
01131                 $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...
01132 
01133                         // "Extra" configuration; Returns configuration for the field based on settings found in the "types" fieldlist. Traditionally, this is where RTE configuration has been found.
01134                 $specConf = $this->getSpecConfFromString($PA['extra'], $PA['fieldConf']['defaultExtras']);
01135 
01136                         // Setting up the altItem form field, which is a hidden field containing the value
01137                 $altItem = '<input type="hidden" name="'.htmlspecialchars($PA['itemFormElName']).'" value="'.htmlspecialchars($PA['itemFormElValue']).'" />';
01138 
01139                         // If RTE is generally enabled (TYPO3_CONF_VARS and user settings)
01140                 if ($this->RTEenabled) {
01141                         $p = t3lib_BEfunc::getSpecConfParametersFromArray($specConf['rte_transform']['parameters']);
01142                         if (isset($specConf['richtext']) && (!$p['flag'] || !$row[$p['flag']])) {       // If the field is configured for RTE and if any flag-field is not set to disable it.
01143                                 t3lib_BEfunc::fixVersioningPid($table,$row);
01144                                 list($tscPID,$thePidValue) = $this->getTSCpid($table,$row['uid'],$row['pid']);
01145 
01146                                         // If the pid-value is not negative (that is, a pid could NOT be fetched)
01147                                 if ($thePidValue >= 0)  {
01148                                         $RTEsetup = $GLOBALS['BE_USER']->getTSConfig('RTE',t3lib_BEfunc::getPagesTSconfig($tscPID));
01149                                         $RTEtypeVal = t3lib_BEfunc::getTCAtypeValue($table,$row);
01150                                         $thisConfig = t3lib_BEfunc::RTEsetup($RTEsetup['properties'],$table,$field,$RTEtypeVal);
01151 
01152                                         if (!$thisConfig['disabled'])   {
01153                                                 if (!$this->disableRTE) {
01154                                                         $this->RTEcounter++;
01155 
01156                                                                 // Find alternative relative path for RTE images/links:
01157                                                         $eFile = t3lib_parsehtml_proc::evalWriteFile($specConf['static_write'], $row);
01158                                                         $RTErelPath = is_array($eFile) ? dirname($eFile['relEditFile']) : '';
01159 
01160                                                                 // Get RTE object, draw form and set flag:
01161                                                         $RTEobj = &t3lib_BEfunc::RTEgetObj();
01162                                                         $item = $RTEobj->drawRTE($this,$table,$field,$row,$PA,$specConf,$thisConfig,$RTEtypeVal,$RTErelPath,$thePidValue);
01163 
01164                                                                 // Wizard:
01165                                                         $item = $this->renderWizards(array($item,$altItem),$config['wizards'],$table,$row,$field,$PA,$PA['itemFormElName'],$specConf,1);
01166 
01167                                                         $RTEwasLoaded = 1;
01168