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 
00185 
00186 
00195 class t3lib_TCEforms    {
00196 
00197                 // variables not commented yet.... (do so...)
00198         var $palFieldArr = array();
00199         var $disableWizards = 0;
00200         var $isPalettedoc = 0;
00201         var $paletteMargin = 1;
00202         var $defStyle = ''; // 'font-family:Verdana;font-size:10px;';
00203         var $cachedTSconfig = array();
00204         var $cachedTSconfig_fieldLevel = array();
00205         var $transformedRow = array();
00206         var $extJSCODE = '';
00207         var $printNeededJS = array();
00208         var $hiddenFieldAccum=array();
00209         var $TBE_EDITOR_fieldChanged_func='';
00210         var $loadMD5_JS=1;
00211         var $prevBorderStyle='[nothing here...]';       // Something unique...
00212         var $allowUpload=0;                             // If set direct upload fields will be shown
00213         var $titleLen=15;                                       // $BE_USER->uc['titleLen'] but what is default??
00214         var $defaultLanguageData = array();     // Array where records in the default language is stored. (processed by transferdata)
00215         var $defaultLanguageData_diff = array();        // Array where records in the default language is stored (raw without any processing. used for making diff)
00216 
00217 
00218                 // EXTERNAL, static
00219         var $backPath='';                                       // Set this to the 'backPath' pointing back to the typo3 admin directory from the script where this form is displayed.
00220         var $returnUrl='';                                      // Alternative return URL path (default is t3lib_div::linkThisScript())
00221         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.
00222         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.
00223         var $disableRTE=0;                                      // If set, the RTE is disabled (from form display, eg. by checkbox in the bottom of the page!)
00224         var $globalShowHelp=1;                          // If false, then all CSH will be disabled, regardless of settings in $this->edit_showFieldHelp
00225         var $localizationMode='';               // If true, the forms are rendering only localization relevant fields of the records.
00226         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.
00227         var $doPrintPalette=1;                          // If set to false, palettes will NEVER be rendered.
00228         var $clipObj=FALSE;                                     // Set to initialized clipboard object; Then the element browser will offer a link to paste in records from clipboard.
00229         var $enableClickMenu=FALSE;                     // Enable click menu on reference icons.
00230         var $enableTabMenu = FALSE;                     // Enable Tab Menus. If set to true, the JavaScript content from template::getDynTabMenuJScode() must be included in the document.
00231         var $renderReadonly = FALSE;            // When enabled all fields are rendered non-editable.
00232 
00233         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)
00234         var $form_largeComp = 1.33;                     // Form field width compensation: Compensation for large documents, doc-tab (editing)
00235         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.
00236         var $maxTextareaWidth=48;                       // The maximum abstract value for textareas
00237         var $maxInputWidth=48;                          // The maximum abstract value for input fields
00238         var $defaultMultipleSelectorStyle='width:250px;';       // Default style for the selector boxes used for multiple items in "select" and "group" types.
00239 
00240 
00241                 // INTERNAL, static
00242         var $prependFormFieldNames = 'data';            // The string to prepend formfield names with.
00243         var $prependFormFieldNames_file = 'data_files';         // The string to prepend FILE form field names with.
00244         var $formName = 'editform';                                     // The name attribute of the form.
00245 
00246 
00247 
00248                 // INTERNAL, dynamic
00249         var $perms_clause='';                                           // Set by readPerms()  (caching)
00250         var $perms_clause_set=0;                                        // Set by readPerms()  (caching-flag)
00251         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).
00252         var $docLarge=0;                                                        // If set, the forms will be rendered a little wider, more precisely with a factor of $this->form_largeComp.
00253         var $clientInfo=array();                                        // Loaded with info about the browser when class is instantiated.
00254         var $RTEenabled=0;                                                      // True, if RTE is possible for the current user (based on result from BE_USER->isRTE())
00255         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)
00256         var $RTEcounter = 0;                                            // Counter that is incremented before an RTE is created. Can be used for unique ids etc.
00257 
00258         var $colorScheme;                                                       // Contains current color scheme
00259         var $classScheme;                                                       // Contains current class scheme
00260         var $defColorScheme;                                            // Contains the default color scheme
00261         var $defClassScheme;                                            // Contains the default class scheme
00262         var $fieldStyle;                                                        // Contains field style values
00263         var $borderStyle;                                                       // Contains border style values.
00264 
00265         var $commentMessages=array();                           // An accumulation of messages from the class.
00266 
00267                 // INTERNAL, templates
00268         var $totalWrap='<hr />|<hr />';                         // Total wrapping for the table rows.
00269         var $fieldTemplate='<b>###FIELD_NAME###</b><br />###FIELD_ITEM###<hr />';       // Field template
00270         var $sectionWrap='';                                            // Wrapping template code for a section
00271         var $palFieldTemplateHeader='';                         // Template for palette headers
00272         var $palFieldTemplate='';                                       // Template for palettes
00273 
00274                 // INTERNAL, working memory
00275         var $excludeElements='';                                        // Set to the fields NOT to display, if any.
00276         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)
00277         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!
00278         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.
00279         var $requiredElements=array();                          // Used to register the min and max number of elements for selectorboxes where that apply (in the "group" type for instance)
00280         var $renderDepth=0;                                                     // Keeps track of the rendering depth of nested records.
00281         var $savedSchemes=array();                                      // Color scheme buffer.
00282 
00283                 // Internal, registers for user defined functions etc.
00284         var $additionalCode_pre = array();                      // Additional HTML code, printed before the form.
00285         var $additionalJS_pre = array();                        // Additional JavaScript, printed before the form
00286         var $additionalJS_post = array();                       // Additional JavaScript printed after the form
00287         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.
00288 
00289 
00290 
00291 
00292 
00293 
00294 
00300         function t3lib_TCEforms()       {
00301                 global $CLIENT;
00302 
00303                 $this->clientInfo = t3lib_div::clientInfo();
00304 
00305                 $this->RTEenabled = $GLOBALS['BE_USER']->isRTE();
00306                 if (!$this->RTEenabled) {
00307                         $this->RTEenabled_notReasons = implode(chr(10),$GLOBALS['BE_USER']->RTE_errors);
00308                         $this->commentMessages[] = 'RTE NOT ENABLED IN SYSTEM due to:'.chr(10).$this->RTEenabled_notReasons;
00309                 }
00310 
00311                         // Default color+class scheme
00312                 $this->defColorScheme = array(
00313                         $GLOBALS['SOBE']->doc->bgColor, // Background for the field AND palette
00314                         t3lib_div::modifyHTMLColorAll($GLOBALS['SOBE']->doc->bgColor,-20),      // Background for the field header
00315                         t3lib_div::modifyHTMLColorAll($GLOBALS['SOBE']->doc->bgColor,-10),      // Background for the palette field header
00316                         'black',        // Field header font color
00317                         '#666666'       // Palette field header font color
00318                 );
00319                 $this->defColorScheme = array();
00320 
00321                         // Override / Setting defaults from TBE_STYLES array
00322                 $this->resetSchemes();
00323 
00324                         // Setting the current colorScheme to default.
00325                 $this->defColorScheme = $this->colorScheme;
00326                 $this->defClassScheme = $this->classScheme;
00327         }
00328 
00334         function initDefaultBEmode()    {
00335                 global $BE_USER;
00336                 $this->prependFormFieldNames = 'data';
00337                 $this->formName = 'editform';
00338                 $this->setNewBEDesign();
00339                 $this->docLarge = $BE_USER->uc['edit_wideDocument'] ? 1 : 0;
00340                 $this->edit_showFieldHelp = $BE_USER->uc['edit_showFieldHelp'];
00341 
00342                 $this->edit_docModuleUpload = $BE_USER->uc['edit_docModuleUpload'];
00343                 $this->titleLen = $BE_USER->uc['titleLen'];
00344         }
00345 
00346 
00347 
00348 
00349 
00350 
00351 
00352 
00353 
00354 
00355 
00356 
00357 
00358 
00359 
00360 
00361 
00362         /*******************************************************
00363          *
00364          * Rendering the forms, fields etc
00365          *
00366          *******************************************************/
00367 
00379         function getSoloField($table,$row,$theFieldToReturn)    {
00380                 global $TCA;
00381 
00382                 if ($TCA[$table])       {
00383                         t3lib_div::loadTCA($table);
00384                         $typeNum = $this->getRTypeNum($table,$row);
00385                         if ($TCA[$table]['types'][$typeNum])    {
00386                                 $itemList = $TCA[$table]['types'][$typeNum]['showitem'];
00387                                 if ($itemList)  {
00388                                         $fields = t3lib_div::trimExplode(',',$itemList,1);
00389                                         $excludeElements = $this->excludeElements = $this->getExcludeElements($table,$row,$typeNum);
00390 
00391                                         reset($fields);
00392                                         while(list(,$fieldInfo)=each($fields))  {
00393                                                 $parts = explode(';',$fieldInfo);
00394 
00395                                                 $theField = trim($parts[0]);
00396                                                 if (!in_array($theField,$excludeElements) && !strcmp($theField,$theFieldToReturn))      {
00397                                                         if ($TCA[$table]['columns'][$theField]) {
00398                                                                 $sField = $this->getSingleField($table,$theField,$row,$parts[1],1,$parts[3],$parts[2]);
00399                                                                 return $sField['ITEM'];
00400                                                         }
00401                                                 }
00402                                         }
00403                                 }
00404                         }
00405                 }
00406         }
00407 
00418         function getMainFields($table,$row,$depth=0)    {
00419                 global $TCA, $TYPO3_CONF_VARS;
00420 
00421                 $this->renderDepth=$depth;
00422 
00423                         // Init vars:
00424                 $out_array = array(array());
00425                 $out_array_meta = array(array(
00426                         'title' => $this->getLL('l_generalTab')
00427                 ));
00428 
00429                 $out_pointer=0;
00430                 $out_sheet=0;
00431                 $this->palettesRendered=array();
00432                 $this->palettesRendered[$this->renderDepth][$table]=array();
00433 
00434                         // First prepare user defined objects (if any) for hooks which extend this function:
00435                 $hookObjectsArr = array();
00436                 if (is_array ($TYPO3_CONF_VARS['SC_OPTIONS']['t3lib/class.t3lib_tceforms.php']['getMainFieldsClass']))  {
00437                         foreach ($TYPO3_CONF_VARS['SC_OPTIONS']['t3lib/class.t3lib_tceforms.php']['getMainFieldsClass'] as $classRef)   {
00438                                 $hookObjectsArr[] = &t3lib_div::getUserObj($classRef);
00439                         }
00440                 }
00441 
00442                         // Hook: getMainFields_preProcess (requested by Thomas Hempel for use with the "dynaflex" extension)
00443                 foreach ($hookObjectsArr as $hookObj)   {
00444                         if (method_exists($hookObj,'getMainFields_preProcess')) {
00445                                 $hookObj->getMainFields_preProcess($table,$row,$this);
00446                         }
00447                 }
00448 
00449                 if ($TCA[$table])       {
00450 
00451                                 // Load the full TCA for the table.
00452                         t3lib_div::loadTCA($table);
00453 
00454                                 // Load the description content for the table.
00455                         if ($this->edit_showFieldHelp || $this->doLoadTableDescr($table))       {
00456                                 $GLOBALS['LANG']->loadSingleTableDescription($table);
00457                         }
00458                                 // Get the current "type" value for the record.
00459                         $typeNum = $this->getRTypeNum($table,$row);
00460 
00461                                 // Find the list of fields to display:
00462                         if ($TCA[$table]['types'][$typeNum])    {
00463                                 $itemList = $TCA[$table]['types'][$typeNum]['showitem'];
00464                                 if ($itemList)  {       // If such a list existed...
00465 
00466                                                 // Explode the field list and possibly rearrange the order of the fields, if configured for
00467                                         $fields = t3lib_div::trimExplode(',',$itemList,1);
00468                                         if ($this->fieldOrder)  {
00469                                                 $fields = $this->rearrange($fields);
00470                                         }
00471 
00472                                                 // Get excluded fields, added fiels and put it together:
00473                                         $excludeElements = $this->excludeElements = $this->getExcludeElements($table,$row,$typeNum);
00474                                         $fields = $this->mergeFieldsWithAddedFields($fields,$this->getFieldsToAdd($table,$row,$typeNum));
00475 
00476                                                 // Traverse the fields to render:
00477                                         $cc=0;
00478                                         foreach($fields as $fieldInfo)  {
00479                                                         // Exploding subparts of the field configuration:
00480                                                 $parts = explode(';',$fieldInfo);
00481 
00482                                                         // Getting the style information out:
00483                                                 $color_style_parts = t3lib_div::trimExplode('-',$parts[4]);
00484                                                 if (strcmp($color_style_parts[0],''))   {
00485                                                         $this->setColorScheme($GLOBALS['TBE_STYLES']['colorschemes'][intval($color_style_parts[0])]);
00486                                                 }
00487                                                 if (strcmp($color_style_parts[1],''))   {
00488                                                         $this->fieldStyle = $GLOBALS['TBE_STYLES']['styleschemes'][intval($color_style_parts[1])];
00489                                                         if (!isset($this->fieldStyle))  $this->fieldStyle = $GLOBALS['TBE_STYLES']['styleschemes'][0];
00490                                                 }
00491                                                 if (strcmp($color_style_parts[2],''))   {
00492                                                         $this->wrapBorder($out_array[$out_sheet],$out_pointer);
00493                                                         $this->borderStyle = $GLOBALS['TBE_STYLES']['borderschemes'][intval($color_style_parts[2])];
00494                                                         if (!isset($this->borderStyle)) $this->borderStyle = $GLOBALS['TBE_STYLES']['borderschemes'][0];
00495                                                 }
00496 
00497                                                         // Render the field:
00498                                                 $theField = $parts[0];
00499                                                 if (!in_array($theField,$excludeElements))      {
00500                                                         if ($TCA[$table]['columns'][$theField]) {
00501                                                                 $sFieldPal='';
00502 
00503                                                                 if ($parts[2] && !isset($this->palettesRendered[$this->renderDepth][$table][$parts[2]]))        {
00504                                                                         $sFieldPal=$this->getPaletteFields($table,$row,$parts[2]);
00505                                                                         $this->palettesRendered[$this->renderDepth][$table][$parts[2]] = 1;
00506                                                                 }
00507                                                                 $sField = $this->getSingleField($table,$theField,$row,$parts[1],0,$parts[3],$parts[2]);
00508                                                                 if ($sField)    $sField.=$sFieldPal;
00509 
00510                                                                 $out_array[$out_sheet][$out_pointer].= $sField;
00511                                                         } elseif ($theField=='--div--') {
00512                                                                 if ($cc>0)      {
00513                                                                         $out_array[$out_sheet][$out_pointer].=$this->getDivider();
00514 
00515                                                                         if ($this->enableTabMenu && $TCA[$table]['ctrl']['dividers2tabs'])      {
00516                                                                                 $this->wrapBorder($out_array[$out_sheet],$out_pointer);
00517                                                                                 $out_sheet++;
00518                                                                                 $out_array[$out_sheet] = array();
00519                                                                                 $out_array_meta[$out_sheet]['title'] = $this->sL($parts[1]);
00520                                                                         }
00521                                                                 } else {        // Setting alternative title for "General" tab if "--div--" is the very first element.
00522                                                                         $out_array_meta[$out_sheet]['title'] = $this->sL($parts[1]);
00523                                                                 }
00524                                                         } elseif($theField=='--palette--')      {
00525                                                                 if ($parts[2] && !isset($this->palettesRendered[$this->renderDepth][$table][$parts[2]]))        {
00526                                                                                 // render a 'header' if not collapsed
00527                                                                         if ($TCA[$table]['palettes'][$parts[2]]['canNotCollapse'] AND $parts[1]) {
00528                                                                                 $out_array[$out_sheet][$out_pointer].=$this->getPaletteFields($table,$row,$parts[2],$this->sL($parts[1]));
00529                                                                         } else {
00530                                                                                 $out_array[$out_sheet][$out_pointer].=$this->getPaletteFields($table,$row,$parts[2],'','',$this->sL($parts[1]));
00531                                                                         }
00532                                                                         $this->palettesRendered[$this->renderDepth][$table][$parts[2]] = 1;
00533                                                                 }
00534                                                         }
00535                                                 }
00536 
00537                                                 $cc++;
00538                                         }
00539                                 }
00540                         }
00541                 }
00542 
00543                         // Hook: getMainFields_postProcess (requested by Thomas Hempel for use with the "dynaflex" extension)
00544                 foreach ($hookObjectsArr as $hookObj)   {
00545                         if (method_exists($hookObj,'getMainFields_postProcess'))        {
00546                                 $hookObj->getMainFields_postProcess($table,$row,$this);
00547                         }
00548                 }
00549 
00550                         // Wrapping a border around it all:
00551                 $this->wrapBorder($out_array[$out_sheet],$out_pointer);
00552 
00553                         // Resetting styles:
00554                 $this->resetSchemes();
00555 
00556                         // Rendering Main palettes, if any
00557                 $mParr = t3lib_div::trimExplode(',',$TCA[$table]['ctrl']['mainpalette']);
00558                 $i = 0;
00559                 if (count($mParr))      {
00560                         foreach ($mParr as $mP) {
00561                                 if (!isset($this->palettesRendered[$this->renderDepth][$table][$mP]))   {
00562                                         $temp_palettesCollapsed=$this->palettesCollapsed;
00563                                         $this->palettesCollapsed=0;
00564                                         $label = ($i==0?$this->getLL('l_generalOptions'):$this->getLL('l_generalOptions_more'));
00565                                         $out_array[$out_sheet][$out_pointer].=$this->getPaletteFields($table,$row,$mP,$label);
00566                                         $this->palettesCollapsed=$temp_palettesCollapsed;
00567                                         $this->palettesRendered[$this->renderDepth][$table][$mP] = 1;
00568                                 }
00569                                 $this->wrapBorder($out_array[$out_sheet],$out_pointer);
00570                                 $i++;
00571                                 if ($this->renderDepth) {
00572                                         $this->renderDepth--;
00573                                 }
00574                         }
00575                 }
00576 
00577 
00578                         // Return the imploded $out_array:
00579                 if ($out_sheet>0)       {       // There were --div-- dividers around...
00580 
00581                                 // Create parts array for the tab menu:
00582                         $parts = array();
00583                         foreach($out_array as $idx => $sheetContent)    {
00584                                 $parts[] = array(
00585                                         'label' => $out_array_meta[$idx]['title'],
00586                                         'content' => '<table border="0" cellspacing="0" cellpadding="0" width="100%">'.
00587                                                         implode('',$sheetContent).
00588                                                 '</table>'
00589                                 );
00590                         }
00591 
00592                         return '
00593                                 <tr>
00594                                         <td colspan="2">
00595                                         '.$this->getDynTabMenu($parts, 'TCEforms:'.$table.':'.$row['uid']).'
00596                                         </td>
00597                                 </tr>';
00598                 } else {        // Only one, so just implode:
00599                         return implode('',$out_array[$out_sheet]);
00600                 }
00601         }
00602 
00613         function getListedFields($table,$row,$list)     {
00614                 global $TCA;
00615 
00616                 t3lib_div::loadTCA($table);
00617                 if ($this->edit_showFieldHelp || $this->doLoadTableDescr($table))       {
00618                         $GLOBALS['LANG']->loadSingleTableDescription($table);
00619                 }
00620 
00621                 $out='';
00622                 $types_fieldConfig=t3lib_BEfunc::getTCAtypes($table,$row,1);
00623 
00624                 $editFieldList=array_unique(t3lib_div::trimExplode(',',$list,1));
00625                 foreach($editFieldList as $theFieldC)   {
00626                         list($theField,$palFields) = split('\[|\]',$theFieldC);
00627                         $theField = trim($theField);
00628                         $palFields = trim($palFields);
00629                         if ($TCA[$table]['columns'][$theField]) {
00630                                 $parts = t3lib_div::trimExplode(';',$types_fieldConfig[$theField]['origString']);
00631                                 $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.
00632                                 $out.= $sField;
00633                         } elseif($theField=='--div--')  {
00634                                 $out.=$this->getDivider();
00635                         }
00636                         if ($palFields) {
00637                                 $out.=$this->getPaletteFields($table,$row,'','',implode(',',t3lib_div::trimExplode('|',$palFields,1)));
00638                         }
00639                 }
00640                 return $out;
00641         }
00642 
00654         function getPaletteFields($table,$row,$palette,$header='',$itemList='',$collapsedHeader='')     {
00655                 global $TCA;
00656                 if (!$this->doPrintPalette)     return '';
00657 
00658                 $out='';
00659                 $palParts=array();
00660                 t3lib_div::loadTCA($table);
00661 
00662                         // Getting excludeElements, if any.
00663                 if (!is_array($this->excludeElements))  {
00664                         $this->excludeElements = $this->getExcludeElements($table,$row,$this->getRTypeNum($table,$row));
00665                 }
00666 
00667                         // Render the palette TCEform elements.
00668                 if ($TCA[$table] && (is_array($TCA[$table]['palettes'][$palette]) || $itemList))        {
00669                         $itemList = $itemList?$itemList:$TCA[$table]['palettes'][$palette]['showitem'];
00670                         if ($itemList)  {
00671                                 $fields = t3lib_div::trimExplode(',',$itemList,1);
00672                                 reset($fields);
00673                                 while(list(,$fieldInfo)=each($fields))  {
00674                                         $parts = t3lib_div::trimExplode(';',$fieldInfo);
00675                                         $theField = $parts[0];
00676 
00677                                         if (!in_array($theField,$this->excludeElements) && $TCA[$table]['columns'][$theField])  {
00678                                                 $this->palFieldArr[$palette][] = $theField;
00679                                                 if ($this->isPalettesCollapsed($table,$palette))        {
00680                                                         $this->hiddenFieldListArr[] = $theField;
00681                                                 }
00682 
00683                                                 $part=$this->getSingleField($table,$theField,$row,$parts[1],1,'',$parts[2]);
00684                                                 if (is_array($part))    {
00685                                                         $palParts[]=$part;
00686                                                 }
00687                                         }
00688                                 }
00689                         }
00690                 }
00691                         // Put palette together if there are fields in it:
00692                 if (count($palParts))   {
00693                         if ($header)    {
00694                                 $out.=  $this->intoTemplate(array(
00695                                                                 'HEADER' => htmlspecialchars($header)
00696                                                         ),
00697                                                         $this->palFieldTemplateHeader
00698                                                 );
00699                         }
00700                         $out.=  $this->intoTemplate(array(
00701                                                         'PALETTE' => $this->printPalette($palParts)
00702                                                 ),
00703                                                 $this->palFieldTemplate
00704                                         );
00705                 }
00706                         // 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.
00707                 if ($this->isPalettesCollapsed($table,$palette) && $collapsedHeader)    {
00708                         $pC=    $this->intoTemplate(array(
00709                                                         '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),
00710                                                 ),
00711                                                 $this->palFieldTemplate
00712                                         );
00713                         $out.=$pC;
00714                 }
00715                 return $out;
00716         }
00717 
00730         function getSingleField($table,$field,$row,$altName='',$palette=0,$extra='',$pal=0)     {
00731                 global $TCA,$BE_USER;
00732 
00733                 $out = '';
00734                 $PA = array();
00735                 $PA['altName'] = $altName;
00736                 $PA['palette'] = $palette;
00737                 $PA['extra'] = $extra;
00738                 $PA['pal'] = $pal;
00739 
00740                         // Make sure to load full $TCA array for the table:
00741                 t3lib_div::loadTCA($table);
00742 
00743                         // Get the TCA configuration for the current field:
00744                 $PA['fieldConf'] = $TCA[$table]['columns'][$field];
00745                 $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
00746 
00747                         // Now, check if this field is configured and editable (according to excludefields + other configuration)
00748                 if (    is_array($PA['fieldConf']) &&
00749                                 (!$PA['fieldConf']['exclude'] || $BE_USER->check('non_exclude_fields',$table.':'.$field)) &&
00750                                 $PA['fieldConf']['config']['form_type']!='passthrough' &&
00751                                 ($this->RTEenabled || !$PA['fieldConf']['config']['showIfRTE']) &&
00752                                 (!$PA['fieldConf']['displayCond'] || $this->isDisplayCondition($PA['fieldConf']['displayCond'],$row)) &&
00753                                 (!$TCA[$table]['ctrl']['languageField'] || $PA['fieldConf']['l10n_display'] || strcmp($PA['fieldConf']['l10n_mode'],'exclude') || $row[$TCA[$table]['ctrl']['languageField']]<=0) &&
00754                                 (!$TCA[$table]['ctrl']['languageField'] || !$this->localizationMode || $this->localizationMode===$PA['fieldConf']['l10n_cat'])
00755                         )       {
00756 
00757 
00758 
00759                                 // Fetching the TSconfig for the current table/field. This includes the $row which means that
00760                         $PA['fieldTSConfig'] = $this->setTSconfig($table,$row,$field);
00761 
00762                                 // If the field is NOT disabled from TSconfig (which it could have been) then render it
00763                         if (!$PA['fieldTSConfig']['disabled'])  {
00764 
00765                                         // Init variables:
00766                                 $PA['itemFormElName']=$this->prependFormFieldNames.'['.$table.']['.$row['uid'].']['.$field.']';         // Form field name
00767                                 $PA['itemFormElName_file']=$this->prependFormFieldNames_file.'['.$table.']['.$row['uid'].']['.$field.']';       // Form field name, in case of file uploads
00768                                 $PA['itemFormElValue']=$row[$field];            // The value to show in the form field.
00769 
00770                                         // set field to read-only if configured for translated records to show default language content as readonly
00771                                 if ($PA['fieldConf']['l10n_display'] AND t3lib_div::inList($PA['fieldConf']['l10n_display'], 'defaultAsReadonly') AND $row[$TCA[$table]['ctrl']['languageField']]) {
00772                                         $PA['fieldConf']['config']['readOnly'] =  true;
00773                                         $PA['itemFormElValue'] = $this->defaultLanguageData[$table.':'.$row['uid']][$field];
00774                                 }
00775 
00776                                         // 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"
00777                                 if (
00778                                         ($TCA[$table]['ctrl']['type'] && !strcmp($field,$TCA[$table]['ctrl']['type'])) ||
00779                                         ($TCA[$table]['ctrl']['requestUpdate'] && t3lib_div::inList($TCA[$table]['ctrl']['requestUpdate'],$field))) {
00780                                         if($GLOBALS['BE_USER']->jsConfirmation(1))      {
00781                                                 $alertMsgOnChange = 'if (confirm('.$GLOBALS['LANG']->JScharCode($this->getLL('m_onChangeAlert')).') && TBE_EDITOR_checkSubmit(-1)){ TBE_EDITOR_submitForm() };';
00782                                         } else {
00783                                                 $alertMsgOnChange = 'if (TBE_EDITOR_checkSubmit(-1)){ TBE_EDITOR_submitForm() };';
00784                                         }
00785                                 } else {
00786                                         $alertMsgOnChange = '';
00787                                 }
00788 
00789                                         // Render as a hidden field?
00790                                 if (in_array($field,$this->hiddenFieldListArr)) {
00791                                         $this->hiddenFieldAccum[]='<input type="hidden" name="'.$PA['itemFormElName'].'" value="'.htmlspecialchars($PA['itemFormElValue']).'" />';
00792                                 } else {        // Render as a normal field:
00793 
00794                                                 // 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.
00795                                         if (!$PA['palette'])    {
00796                                                 if ($PA['pal'] && $this->isPalettesCollapsed($table,$PA['pal']))        {
00797                                                         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);
00798                                                 } else {
00799                                                         $thePalIcon = '';
00800                                                         $palJSfunc = '';
00801                                                 }
00802                                         }
00803                                                 // onFocus attribute to add to the field:
00804                                         $PA['onFocus'] = ($palJSfunc && !$BE_USER->uc['dontShowPalettesOnFocusInAB']) ? ' onfocus="'.htmlspecialchars($palJSfunc).'"' : '';
00805 
00806                                                 // Find item
00807                                         $item='';
00808                                         $PA['label'] = $PA['altName'] ? $PA['altName'] : $PA['fieldConf']['label'];
00809                                         $PA['label'] = $this->sL($PA['label']);
00810                                                 // JavaScript code for event handlers:
00811                                         $PA['fieldChangeFunc']=array();
00812                                         $PA['fieldChangeFunc']['TBE_EDITOR_fieldChanged'] = "TBE_EDITOR_fieldChanged('".$table."','".$row['uid']."','".$field."','".$PA['itemFormElName']."');";
00813                                         $PA['fieldChangeFunc']['alert']=$alertMsgOnChange;
00814 
00815                                                 // Based on the type of the item, call a render function:
00816                                         $item = $this->getSingleField_SW($table,$field,$row,$PA);
00817 
00818 
00819                                                 // Add language + diff
00820                                         if ($PA['fieldConf']['l10n_display'] && (t3lib_div::inList($PA['fieldConf']['l10n_display'], 'hideDiff') || t3lib_div::inList($PA['fieldConf']['l10n_display'], 'defaultAsReadonly'))) {
00821                                                 $renderLanguageDiff = false;
00822                                         } else {
00823                                                 $renderLanguageDiff = true;
00824                                         }
00825 
00826                                         if ($renderLanguageDiff) {
00827                                                 $item = $this->renderDefaultLanguageContent($table,$field,$row,$item);
00828                                                 $item = $this->renderDefaultLanguageDiff($table,$field,$row,$item);
00829                                         }
00830                                                 // 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
00831                                         $PA['label'] = t3lib_div::deHSCentities(htmlspecialchars($PA['label']));
00832                                         if (t3lib_div::testInt($row['uid']) && $PA['fieldTSConfig']['linkTitleToSelf']) {
00833                                                 $lTTS_url = $this->backPath.'alt_doc.php?edit['.$table.']['.$row['uid'].']=edit&columnsOnly='.$field.
00834                                                                         ($PA['fieldTSConfig']['linkTitleToSelf.']['returnUrl']?'&returnUrl='.rawurlencode($this->thisReturnUrl()):'');
00835                                                 $PA['label'] = '<a href="'.htmlspecialchars($lTTS_url).'">'.$PA['label'].'</a>';
00836                                         }
00837 
00838                                                 // Create output value:
00839                                         if ($PA['fieldConf']['config']['form_type']=='user' && $PA['fieldConf']['config']['noTableWrapping'])   {
00840                                                 $out = $item;
00841                                         } elseif ($PA['palette'])       {
00842                                                         // Array:
00843                                                 $out=array(
00844                                                         'NAME'=>$PA['label'],
00845                                                         'ID'=>$row['uid'],
00846                                                         'FIELD'=>$field,
00847                                                         'TABLE'=>$table,
00848                                                         'ITEM'=>$item,
00849                                                         'HELP_ICON' => $this->helpTextIcon($table,$field,1)
00850                                                 );
00851                                                 $out = $this->addUserTemplateMarkers($out,$table,$field,$row,$PA);
00852                                         } else {
00853                                                         // String:
00854                                                 $out=array(
00855                                                         'NAME'=>$PA['label'],
00856                                                         'ITEM'=>$item,
00857                                                         'TABLE'=>$table,
00858                                                         'ID'=>$row['uid'],
00859                                                         'HELP_ICON'=>$this->helpTextIcon($table,$field),
00860                                                         'HELP_TEXT'=>$this->helpText($table,$field),
00861                                                         'PAL_LINK_ICON'=>$thePalIcon,
00862                                                         'FIELD'=>$field
00863                                                 );
00864                                                 $out = $this->addUserTemplateMarkers($out,$table,$field,$row,$PA);
00865                                                         // String:
00866                                                 $out=$this->intoTemplate($out);
00867                                         }
00868                                 }
00869                         } else $this->commentMessages[]=$this->prependFormFieldNames.'['.$table.']['.$row['uid'].']['.$field.']: Disabled by TSconfig';
00870                 }
00871                         // Return value (string or array)
00872                 return $out;
00873         }
00874 
00886         function getSingleField_SW($table,$field,$row,&$PA)     {
00887                 $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
00888 
00889                 switch($PA['fieldConf']['config']['form_type']) {
00890                         case 'input':
00891                                 $item = $this->getSingleField_typeInput($table,$field,$row,$PA);
00892                         break;
00893                         case 'text':
00894                                 $item = $this->getSingleField_typeText($table,$field,$row,$PA);
00895                         break;
00896                         case 'check':
00897                                 $item = $this->getSingleField_typeCheck($table,$field,$row,$PA);
00898                         break;
00899                         case 'radio':
00900                                 $item = $this->getSingleField_typeRadio($table,$field,$row,$PA);
00901                         break;
00902                         case 'select':
00903                                 $item = $this->getSingleField_typeSelect($table,$field,$row,$PA);
00904                         break;
00905                         case 'group':
00906                                 $item = $this->getSingleField_typeGroup($table,$field,$row,$PA);
00907                         break;
00908                         case 'none':
00909                                 $item = $this->getSingleField_typeNone($table,$field,$row,$PA);
00910                         break;
00911                         case 'user':
00912                                 $item = $this->getSingleField_typeUser($table,$field,$row,$PA);
00913                         break;
00914                         case 'flex':
00915                                 $item = $this->getSingleField_typeFlex($table,$field,$row,$PA);
00916                         break;
00917                         default:
00918                                 $item = $this->getSingleField_typeUnknown($table,$field,$row,$PA);
00919                         break;
00920                 }
00921 
00922                 return $item;
00923         }
00924 
00925 
00926 
00927 
00928 
00929 
00930 
00931 
00932 
00933 
00934 
00935 
00936 
00937 
00938 
00939 
00940 
00941 
00942 
00943         /**********************************************************
00944          *
00945          * Rendering of each TCEform field type
00946          *
00947          ************************************************************/
00948 
00959         function getSingleField_typeInput($table,$field,$row,&$PA)      {
00960                 // typo3FormFieldSet(theField, evallist, is_in, checkbox, checkboxValue)
00961                 // typo3FormFieldGet(theField, evallist, is_in, checkbox, checkboxValue, checkbox_off)
00962 
00963                 $config = $PA['fieldConf']['config'];
00964 
00965 #               $specConf = $this->getSpecConfForField($table,$row,$field);
00966                 $specConf = $this->getSpecConfFromString($PA['extra'], $PA['fieldConf']['defaultExtras']);
00967                 $size = t3lib_div::intInRange($config['size']?$config['size']:30,5,$this->maxInputWidth);
00968                 $evalList = t3lib_div::trimExplode(',',$config['eval'],1);
00969 
00970 
00971                 if($this->renderReadonly || $config['readOnly'])  {
00972                         $itemFormElValue = $PA['itemFormElValue'];
00973                         if (in_array('date',$evalList)) {
00974                                 $config['format'] = 'date';
00975                         } elseif (in_array('date',$evalList))   {
00976                                 $config['format'] = 'date';
00977                         } elseif (in_array('datetime',$evalList))       {
00978                                 $config['format'] = 'datetime';
00979                         } elseif (in_array('time',$evalList))   {
00980                                 $config['format'] = 'time';
00981                         }
00982                         if (in_array('password',$evalList))     {
00983                                 $itemFormElValue = $itemFormElValue ? '*********' : '';
00984                         }
00985                         return $this->getSingleField_typeNone_render($config, $itemFormElValue);
00986                 }
00987 
00988                 if (in_array('required',$evalList))     {
00989                         $this->requiredFields[$table.'_'.$row['uid'].'_'.$field]=$PA['itemFormElName'];
00990                 }
00991 
00992                 $paramsList = "'".$PA['itemFormElName']."','".implode(',',$evalList)."','".trim($config['is_in'])."',".(isset($config['checkbox'])?1:0).",'".$config['checkbox']."'";
00993                 if (isset($config['checkbox'])) {
00994                                 // Setting default "click-checkbox" values for eval types "date" and "datetime":
00995                         $thisMidnight = mktime(0,0,0);
00996                         $checkSetValue = in_array('date',$evalList) ? $thisMidnight : '';
00997                         $checkSetValue = in_array('datetime',$evalList) ? time() : $checkSetValue;
00998 
00999                         $cOnClick = 'typo3FormFieldGet('.$paramsList.',1,\''.$checkSetValue.'\');'.implode('',$PA['fieldChangeFunc']);
01000                         $item.='<input type="checkbox"'.$this->insertDefStyle('check').' name="'.$PA['itemFormElName'].'_cb" onclick="'.htmlspecialchars($cOnClick).'" />';
01001                 }
01002 
01003                 $PA['fieldChangeFunc'] = array_merge(array('typo3FormFieldGet'=>'typo3FormFieldGet('.$paramsList.');'), $PA['fieldChangeFunc']);
01004                 $mLgd = ($config['max']?$config['max']:256);
01005                 $iOnChange = implode('',$PA['fieldChangeFunc']);
01006                 $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.
01007                 $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.
01008                 $this->extJSCODE.='typo3FormFieldSet('.$paramsList.');';
01009 
01010                         // going through all custom evaluations configured for this field
01011                 foreach ($evalList as $evalData) {
01012                         if (substr($evalData, 0, 3) == 'tx_')   {
01013                                 $evalObj = t3lib_div::getUserObj($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tce']['formevals'][$evalData].':&'.$evalData);
01014                                 if(is_object($evalObj) && method_exists($evalObj, 'returnFieldJS'))     {
01015                                         $this->extJSCODE .= "\n\nfunction ".$evalData."(value) {\n".$evalObj->returnFieldJS()."\n}\n";
01016                                 }
01017                         }
01018                 }
01019 
01020                         // Creating an alternative item without the JavaScript handlers.
01021                 $altItem = '<input type="hidden" name="'.$PA['itemFormElName'].'_hr" value="" />';
01022                 $altItem.= '<input type="hidden" name="'.$PA['itemFormElName'].'" value="'.htmlspecialchars($PA['itemFormElValue']).'" />';
01023 
01024                         // Wrap a wizard around the item?
01025                 $item= $this->renderWizards(array($item,$altItem),$config['wizards'],$table,$row,$field,$PA,$PA['itemFormElName'].'_hr',$specConf);
01026 
01027                 return $item;
01028         }
01029 
01040         function getSingleField_typeText($table,$field,$row,&$PA)       {
01041 
01042                         // Init config:
01043                 $config = $PA['fieldConf']['config'];
01044 
01045                 if($this->renderReadonly || $config['readOnly'])  {
01046                         return $this->getSingleField_typeNone_render($config, $PA['itemFormElValue']);
01047                 }
01048 
01049                         // Setting columns number:
01050                 $cols = t3lib_div::intInRange($config['cols'] ? $config['cols'] : 30, 5, $this->maxTextareaWidth);
01051 
01052                         // Setting number of rows:
01053                 $origRows = $rows = t3lib_div::intInRange($config['rows'] ? $config['rows'] : 5, 1, 20);
01054                 if (strlen($PA['itemFormElValue']) > $this->charsPerRow*2)      {
01055                         $cols = $this->maxTextareaWidth;
01056                         $rows = t3lib_div::intInRange(round(strlen($PA['itemFormElValue'])/$this->charsPerRow), count(explode(chr(10),$PA['itemFormElValue'])), 20);
01057                         if ($rows<$origRows)    $rows = $origRows;
01058                 }
01059 
01060                         // Init RTE vars:
01061                 $RTEwasLoaded = 0;                              // Set true, if the RTE is loaded; If not a normal textarea is shown.
01062                 $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...
01063 
01064                         // "Extra" configuration; Returns configuration for the field based on settings found in the "types" fieldlist. Traditionally, this is where RTE configuration has been found.
01065                 $specConf = $this->getSpecConfFromString($PA['extra'], $PA['fieldConf']['defaultExtras']);
01066 
01067                         // Setting up the altItem form field, which is a hidden field containing the value
01068                 $altItem = '<input type="hidden" name="'.htmlspecialchars($PA['itemFormElName']).'" value="'.htmlspecialchars($PA['itemFormElValue']).'" />';
01069 
01070                         // If RTE is generally enabled (TYPO3_CONF_VARS and user settings)
01071                 if ($this->RTEenabled) {
01072                         $p = t3lib_BEfunc::getSpecConfParametersFromArray($specConf['rte_transform']['parameters']);
01073                         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.
01074                                 t3lib_BEfunc::fixVersioningPid($table,$row);
01075                                 list($tscPID,$thePidValue) = $this->getTSCpid($table,$row['uid'],$row['pid']);
01076 
01077                                         // If the pid-value is not negative (that is, a pid could NOT be fetched)
01078                                 if ($thePidValue >= 0)  {
01079                                         $RTEsetup = $GLOBALS['BE_USER']->getTSConfig('RTE',t3lib_BEfunc::getPagesTSconfig($tscPID));
01080                                         $RTEtypeVal = t3lib_BEfunc::getTCAtypeValue($table,$row);
01081                                         $thisConfig = t3lib_BEfunc::RTEsetup($RTEsetup['properties'],$table,$field,$RTEtypeVal);
01082 
01083                                         if (!$thisConfig['disabled'])   {
01084                                                 if (!$this->disableRTE) {
01085                                                         $this->RTEcounter++;
01086 
01087                                                                 // Find alternative relative path for RTE images/links:
01088                                                         $eFile = t3lib_parsehtml_proc::evalWriteFile($specConf['static_write'], $row);
01089                                                         $RTErelPath = is_array($eFile) ? dirname($eFile['relEditFile']) : '';
01090 
01091                                                                 // Get RTE object, draw form and set flag:
01092                                                         $RTEobj = &t3lib_BEfunc::RTEgetObj();
01093                                                         $item = $RTEobj->drawRTE($this,$table,$field,$row,$PA,$specConf,$thisConfig,$RTEtypeVal,$RTErelPath,$thePidValue);
01094 
01095                                                                 // Wizard:
01096                                                         $item = $this->renderWizards(array($item,$altItem),$config['wizards'],$table,$row,$field,$PA,$PA['itemFormElName'],$specConf,1);
01097 
01098                                                         $RTEwasLoaded = 1;
01099                                                 } else {
01100                                                         $RTEwouldHaveBeenLoaded = 1;
01101                                                         $this->commentMessages[] = $PA['itemFormElName'].': RTE is disabled by the on-page RTE-flag (probably you can enable it by the check-box in the bottom of this page!)';
01102                                                 }
01103                                         } else $this->commentMessages[] = $PA['itemFormElName'].': RTE is disabled by the Page TSconfig, "RTE"-key (eg. by RTE.default.disabled=0 or such)';
01104                                 } else $this->commentMessages[] = $PA['itemFormElName'].': PID value could NOT be fetched. Rare error, normally with new records.';
01105                         } else {
01106                                 if (!isset($specConf['richtext']))      $this->commentMessages[] = $PA['itemFormElName'].': RTE was not configured for this field in TCA-types';
01107                                 if (!(!$p['flag'] || !$row[$p['flag']]))         $this->commentMessages[] = $PA['itemFormElName'].': Field-flag ('.$PA['flag'].') has been set to disable RTE!';
01108                         }
01109                 }
01110 
01111                         // Display ordinary field if RTE was not loaded.
01112                 if (!$RTEwasLoaded) {
01113                         if ($specConf['rte_only'])      {       // Show message, if no RTE (field can only be edited with RTE!)
01114                                 $item = '<p><em>'.htmlspecialchars($this->getLL('l_noRTEfound')).'</em></p>';
01115                         } else {
01116                                 if ($specConf['nowrap'])        {
01117                                         $wrap = 'off';
01118                                 } else {
01119                                         $wrap = ($config['wrap'] ? $config['wrap'] : 'virtual');
01120                                 }
01121 
01122                                 $classes = array();
01123                                 if ($specConf['fixed-font'])    { $classes[] = 'fixed-font'; }
01124                                 if ($specConf['enable-tab'])    { $classes[] = 'enable-tab'; }
01125 
01126                                 if (count($classes))    {
01127                                         $class = ' class="'.implode(' ',$classes).'"';
01128                                 } else $class='';
01129 
01130                                 $iOnChange = implode('',$PA['fieldChangeFunc']);
01131                                 $item.= '
01132                                                         <textarea name="'.$PA['itemFormElName'].'"'.$this->formWidthText($cols,$wrap).$class.' rows="'.$rows.'" wrap="'.$wrap.'" onchange="'.htmlspecialchars($iOnChange).'"'.$PA['onFocus'].'>'.
01133                                                         t3lib_div::formatForTextarea($PA['itemFormElValue']).
01134                                                         '</textarea>';
01135                                 $item = $this->renderWizards(array($item,$altItem),$config['wizards'],$table,$row,$field,$PA,$PA['itemFormElName'],$specConf,$RTEwouldHaveBeenLoaded);
01136                         }
01137                 }
01138 
01139                         // Return field HTML:
01140                 return $item;
01141         }
01142 
01153         function getSingleField_typeCheck($table,$field,$row,&$PA)      {
01154                 $config = $PA['fieldConf']['config'];
01155 
01156                 $disabled = '';
01157                 if($this->renderReadonly || $config['readOnly'])  {
01158                         $disabled = ' disabled="disabled"';
01159                 }
01160 
01161                         // Traversing the array of items:
01162                 $selItems = $this->initItemArray($PA['fieldConf']);
01163                 if ($config['itemsProcFunc']) $selItems = $this->procItems($selItems,$PA['fieldTSConfig']['itemsProcFunc.'],$config,$table,$row,$field);
01164 
01165                 if (!count($selItems))  {
01166                         $selItems[]=array('','');
01167                 }
01168                 $thisValue = intval($PA['itemFormElValue']);
01169 
01170                 $cols = intval($config['cols']);
01171                 if ($cols > 1)  {
01172                         $item.= '<table border="0" cellspacing="0" cellpadding="0" class="typo3-TCEforms-checkboxArray">';
01173                         for ($c=0;$c<count($selItems);$c++) {
01174                                 $p = $selItems[$c];
01175                                 if(!($c%$cols)) { $item.='<tr>'; }
01176                                 $cBP = $this->checkBoxParams($PA['itemFormElName'],$thisValue,$c,count($selItems),implode('',$PA['fieldChangeFunc']));
01177                                 $cBName = $PA['itemFormElName'].'_'.$c;
01178                                 $item.= '<td nowrap="nowrap">'.
01179                                                 '<input type="checkbox"'.$this->insertDefStyle('check').' value="1" name="'.$cBName.'"'.$cBP.$disabled.' />'.
01180                                                 $this->wrapLabels(htmlspecialchars($p[0]).'&nbsp;').
01181                                                 '</td>';
01182                                 if(($c%$cols)+1==$cols) {$item.='</tr>';}
01183                         }
01184                         if ($c%$cols)   {
01185                                 $rest=$cols-($c%$cols);
01186                                 for ($c=0;$c<$rest;$c++) {
01187                                         $item.= '<td></td>';
01188                                 }
01189                                 if ($c>0)       { $item.= '</tr>'; }
01190                         }
01191                         $item.= '</table>';
01192                 } else {
01193                         for ($c=0;$c<count($selItems);$c++) {
01194                                 $p = $selItems[$c];
01195                                 $cBP = $this->checkBoxParams($PA['itemFormElName'],$thisValue,$c,count($selItems),implode('',$PA['fieldChangeFunc']));
</