t3lib/class.t3lib_tceforms.php

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