Documentation TYPO3 par Ameos

class.tx_kickstarter_section_fields.php

00001 <?php
00002 /***************************************************************
00003 *  Copyright notice
00004 *
00005 *  (c) 2001-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 ***************************************************************/
00031 require_once(t3lib_extMgm::extPath('kickstarter').'class.tx_kickstarter_sectionbase.php');
00032 
00033 class tx_kickstarter_section_fields extends tx_kickstarter_sectionbase {
00034   var $sectionID = 'fields';
00035 
00039         function render_wizard() {
00040                 $lines=array();
00041 
00042                 $action = explode(':',$this->wizard->modData['wizAction']);
00043                 if ($action[0]=='edit') {
00044                         $this->regNewEntry($this->sectionID,$action[1]);
00045                         $lines = $this->catHeaderLines($lines,$this->sectionID,$this->wizard->options[$this->sectionID],'&nbsp;',$action[1]);
00046                         $piConf = $this->wizard->wizArray[$this->sectionID][$action[1]];
00047                         $ffPrefix='['.$this->sectionID.']['.$action[1].']';
00048 
00049                 }
00050 
00051 
00052                                 // Header field
00053                         $optValues = array(
00054                                 'tt_content' => 'Content (tt_content)',
00055                                 'fe_users' => 'Frontend Users (fe_users)',
00056                                 'fe_groups' => 'Frontend Groups (fe_groups)',
00057                                 'be_users' => 'Backend Users (be_users)',
00058                                 'be_groups' => 'Backend Groups (be_groups)',
00059                                 'tt_news' => 'News (tt_news)',
00060                                 'tt_address' => 'Address (tt_address)',
00061                                 'pages' => 'Pages (pages)',
00062                         );
00063 
00064                         foreach($GLOBALS['TCA'] as $tablename => $tableTCA) {
00065                                 if(!$optValues[$tablename]) {
00066                                         $optValues[$tablename] = $GLOBALS['LANG']->sL($tableTCA['ctrl']['title']).' ('.$tablename.')';
00067                                 }
00068                         }
00069 
00070                         $subContent = '<strong>Which table:<BR></strong>'.
00071                                         $this->renderSelectBox($ffPrefix.'[which_table]',$piConf['which_table'],$optValues).
00072                                         $this->whatIsThis('Select the table which should be extended with these extra fields.');
00073                         $lines[]='<tr'.$this->bgCol(3).'><td>'.$this->fw($subContent).
00074                                 '<input type="hidden" name="' . $this->piFieldName('wizArray_upd') . $ffPrefix . '[title]" value="' . ($piConf['which_table']?$optValues[$piConf['which_table']]:'') . '"></td></tr>';
00075 
00076 
00077 
00078 
00079 
00080                                 // PRESETS:
00081                         $selPresetBox=$this->presetBox($piConf['fields']);
00082 
00083                                 // FIelds
00084                         $c=array(0);
00085                         $this->usedNames=array();
00086                         if (is_array($piConf['fields']))        {
00087                                 $piConf['fields'] = $this->cleanFieldsAndDoCommands($piConf['fields'],$this->sectionID,$action[1]);
00088 
00089                                         // Do it for real...
00090                                 reset($piConf['fields']);
00091                                 while(list($k,$v)=each($piConf['fields']))      {
00092                                         $c[]=$k;
00093                                         $subContent=$this->renderField($ffPrefix.'[fields]['.$k.']',$v);
00094                                         $lines[]='<tr'.$this->bgCol(2).'><td>'.$this->fw('<strong>FIELD:</strong> <em>'.$v['fieldname'].'</em>').'</td></tr>';
00095                                         $lines[]='<tr'.$this->bgCol(3).'><td>'.$this->fw($subContent).'</td></tr>';
00096                                 }
00097                         }
00098 
00099 
00100                                 // New field:
00101                         $k=max($c)+1;
00102                         $v=array();
00103                         $lines[]='<tr'.$this->bgCol(2).'><td>'.$this->fw('<strong>NEW FIELD:</strong>').'</td></tr>';
00104                         $subContent=$this->renderField($ffPrefix.'[fields]['.$k.']',$v,1);
00105                         $lines[]='<tr'.$this->bgCol(3).'><td>'.$this->fw($subContent).'</td></tr>';
00106 
00107 
00108                         $lines[]='<tr'.$this->bgCol(3).'><td>'.$this->fw('<BR><BR>Load preset fields: <BR>'.$selPresetBox).'</td></tr>';
00109 
00110                 /* HOOK: Place a hook here, so additional output can be integrated */
00111                 if(is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['kickstarter']['add_cat_fields'])) {
00112                   foreach($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['kickstarter']['add_cat_fields'] as $_funcRef) {
00113                     $lines = t3lib_div::callUserFunction($_funcRef, $lines, $this);
00114                   }
00115                 }
00116 
00117                 $content = '<table border=0 cellpadding=2 cellspacing=2>'.implode('',$lines).'</table>';
00118                 return $content;
00119         }
00120 
00121 
00122 
00123 
00124         function presetBox(&$piConfFields)      {
00125                 $_PRESETS = $this->wizard->modData['_PRESET'];
00126 
00127                 $optValues = array();
00128 
00129                 /* Static Presets from DB-Table are disabled. Just leave the code in here for possible future use */
00130                 //              $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'kickstarter_static_presets', '');
00131                 //              while($presetRow = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
00132                 //                      $optValues[] = '<option value="'.htmlspecialchars($presetRow["fieldname"]).'">'.htmlspecialchars($presetRow["title"]." (".$presetRow["fieldname"].", type: ".$presetRow["type"].")").'</option>';
00133                 //                      if (is_array($_PRESETS) && in_array($presetRow["fieldname"],$_PRESETS)) {
00134                 //                              if (!is_array($piConfFields))   $piConfFields=array();
00135                 //                              $piConfFields[] = unserialize($presetRow["appdata"]);
00136                 //                      }
00137                 //              }
00138 
00139                         // Session presets:
00140                 $ses_optValues=array();
00141                 $sesdat = $GLOBALS['BE_USER']->getSessionData('kickstarter');
00142                 if (is_array($sesdat['presets']))       {
00143                         foreach($sesdat['presets'] as $kk1=>$vv1)       {
00144                                 if (is_array($vv1))     {
00145                                         foreach($vv1 as $kk2=>$vv2)     {
00146                                                 $ses_optValues[]='<option value="'.htmlspecialchars($kk1.'.'.$vv2['fieldname']).'">'.htmlspecialchars($kk1.': '.$vv2['title'].' ('.$vv2['fieldname'].', type: '.$vv2['type'].')').'</option>';
00147                                                 if (is_array($_PRESETS) && in_array($kk1.'.'.$vv2['fieldname'],$_PRESETS))      {
00148                                                         if (!is_array($piConfFields))   $piConfFields=array();
00149                                                         $piConfFields[] = $vv2;
00150                                                 }
00151                                         }
00152                                 }
00153                         }
00154                 }
00155                 if (count($ses_optValues))      {
00156                         $optValues = array_merge($optValues,count($optValues)?array('<option value=""></option>'):array(),array('<option value="">__Fields picked up in this session__:</option>'),$ses_optValues);
00157                 }
00158                 if (count($optValues))          $selPresetBox = '<select name="'.$this->piFieldName('_PRESET').'[]" size='.t3lib_div::intInRange(count($optValues),1,10).' multiple>'.implode('',$optValues).'</select>';
00159                 return $selPresetBox;
00160         }
00161         function cleanFieldsAndDoCommands($fConf,$catID,$action)        {
00162                 $newFConf=array();
00163                 $downFlag=0;
00164                 foreach($fConf as $k=>$v)       {
00165                         if ($v['type'] && trim($v['fieldname']))        {
00166                                 $v['fieldname'] = $this->cleanUpFieldName($v['fieldname']);
00167 
00168                                 if (!$v['_DELETE'])     {
00169                                         $newFConf[$k]=$v;
00170                                         if (t3lib_div::_GP($this->varPrefix.'_CMD_'.$v['fieldname'].'_UP_x') || $downFlag)      {
00171                                                 if (count($newFConf)>=2)        {
00172                                                         $lastKeys = array_slice(array_keys($newFConf),-2);
00173 
00174                                                         $buffer = Array();
00175                                                         $buffer[$lastKeys[1]] = $newFConf[$lastKeys[1]];
00176                                                         $buffer[$lastKeys[0]] = $newFConf[$lastKeys[0]];
00177 
00178                                                         unset($newFConf[$lastKeys[0]]);
00179                                                         unset($newFConf[$lastKeys[1]]);
00180 
00181                                                         $newFConf[$lastKeys[1]] = $buffer[$lastKeys[1]];
00182                                                         $newFConf[$lastKeys[0]] = $buffer[$lastKeys[0]];
00183                                                 }
00184                                                 $downFlag=0;
00185                                         } elseif (t3lib_div::_GP($this->varPrefix.'_CMD_'.$v['fieldname'].'_DOWN_x'))   {
00186                                                 $downFlag=1;
00187                                         }
00188                                 }
00189 
00190                                         // PRESET:
00191                                 //                              if (t3lib_div::_GP($this->varPrefix.'_CMD_'.$v["fieldname"].'_SAVE_x')) {
00192                                 //                                      $datArr=Array(
00193                                 //                                              "fieldname" => $v["fieldname"],
00194                                 //                                              "title" => $v["title"],
00195 //                                              "type" => $v["type"],
00196 //                                              "appdata" => serialize($v),
00197 //                                              "tstamp" => time()
00198 //                                      );
00199 
00200 //                                      $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('fieldname', 'kickstarter_static_presets', 'fieldname="'.$GLOBALS['TYPO3_DB']->quoteStr($v['fieldname'], 'kickstarter_static_presets').'"');
00201 //                                      if ($GLOBALS['TYPO3_DB']->sql_num_rows($res) || $v["_DELETE"])  {
00202 //                                              if ($v["_DELETE"])      {
00203 //                                                      $GLOBALS['TYPO3_DB']->exec_DELETEquery('kickstarter_static_presets', 'fieldname="'.$GLOBALS['TYPO3_DB']->quoteStr($v['fieldname'], 'kickstarter_static_presets').'"');
00204 //                                              } else {
00205 //                                                      $GLOBALS['TYPO3_DB']->exec_UPDATEquery('kickstarter_static_presets', 'fieldname="'.$GLOBALS['TYPO3_DB']->quoteStr($v['fieldname'], 'kickstarter_static_presets').'"', $datArr);
00206 //                                              }
00207 //                                      } else {
00208 //                                              $GLOBALS['TYPO3_DB']->exec_INSERTquery("kickstarter_static_presets", $datArr);
00209 //                                      }
00210 //                              }
00211                         } else {
00212                           //                            unset($this->wizArray[$catID][$action]["fields"][$k]);
00213                           //                            unset($fConf[$k]);
00214                         }
00215                 }
00216                 //              debug($newFConf);
00217                 $this->wizard->wizArray[$catID][$action]['fields'] = $newFConf;
00218                 $sesdat = $GLOBALS['BE_USER']->getSessionData('kickstarter');
00219                 $sesdat['presets'][$this->wizard->extKey.'-'.$catID.'-'.$action]=$newFConf;
00220                 $GLOBALS['BE_USER']->setAndSaveSessionData('kickstarter',$sesdat);
00221 
00222 #debug($newFConf);
00223                 return $newFConf;
00224         }
00225 
00226 
00227         function addOtherExtensionTables($optValues)    {
00228                 if (is_array($this->wizard->wizArray['tables']))        {
00229                         foreach($this->wizard->wizArray['tables'] as $k=>$info) {
00230                                 if (trim($info['tablename']))   {
00231                                         $tableName = $this->returnName($this->wizard->extKey,'tables',trim($info['tablename']));
00232                                         $optValues[$tableName]='Extension table: '.$info['title'].' ('.$tableName.')';
00233                                 }
00234                         }
00235                 }
00236                 return $optValues;
00237         }
00238         function cleanUpFieldName($str) {
00239                 $fieldName = ereg_replace('[^[:alnum:]_]','',strtolower($str));
00240                 if (!$fieldName || t3lib_div::inList($this->wizard->reservedTypo3Fields.','.$this->wizard->mysql_reservedFields,$fieldName) || in_array($fieldName,$this->usedNames))   {
00241                         $fieldName.=($fieldName?'_':'').t3lib_div::shortmd5(microtime());
00242                 }
00243                 $this->usedNames[]=$fieldName;
00244                 return $fieldName;
00245         }
00246 
00247 
00248         function renderField($prefix,$fConf,$dontRemove=0)      {
00249                 $onCP = $this->getOnChangeParts($prefix.'[fieldname]');
00250                 $fieldName = $this->renderStringBox($prefix.'[fieldname]',$fConf['fieldname']).
00251                         (!$dontRemove?' (Remove:'.$this->renderCheckBox($prefix.'[_DELETE]',0).')'.
00252                                 '<input type="image" hspace=2 src="'.$this->wizard->siteBackPath.TYPO3_mainDir.'gfx/pil2up.gif" name="'.$this->varPrefix.'_CMD_'.$fConf["fieldname"].'_UP" onClick="'.$onCP[1].'">'.
00253                                 '<input type="image" hspace=2 src="'.$this->wizard->siteBackPath.TYPO3_mainDir.'gfx/pil2down.gif" name="'.$this->varPrefix.'_CMD_'.$fConf["fieldname"].'_DOWN" onClick="'.$onCP[1].'">'.
00254                                 '<input type="image" hspace=2 src="'.$this->wizard->siteBackPath.TYPO3_mainDir.'gfx/savesnapshot.gif" name="'.$this->varPrefix.'_CMD_'.$fConf["fieldname"].'_SAVE" onClick="'.$onCP[1].'" title="Save this field setting as a preset.">':'');
00255 
00256                 $fieldTitle = ((string)$fConf['type'] != 'passthrough') ? $this->renderStringBox_lang('title',$prefix,$fConf) : '';
00257                 $typeCfg = '';
00258 
00259                         // Sorting
00260                 $optValues = array(
00261                         '' => '',
00262                         'input' => 'String input',
00263                         'input+' => 'String input, advanced',
00264                         'textarea' => 'Text area',
00265                         'textarea_rte' => 'Text area with RTE',
00266                         'textarea_nowrap' => 'Text area, No wrapping',
00267                         'check' => 'Checkbox, single',
00268                         'check_4' => 'Checkbox, 4 boxes in a row',
00269                         'check_10' => 'Checkbox, 10 boxes in two rows (max)',
00270                         'link' => 'Link',
00271                         'date' => 'Date',
00272                         'datetime' => 'Date and time',
00273                         'integer' => 'Integer, 10-1000',
00274                         'select' => 'Selectorbox',
00275                         'radio' => 'Radio buttons',
00276                         'rel' => 'Database relation',
00277                         'files' => 'Files',
00278                         'none' => 'Not editable, only displayed',
00279                         'passthrough' => '[Passthrough]',
00280                 );
00281                 $typeCfg.=$this->renderSelectBox($prefix.'[type]',$fConf['type'],$optValues);
00282                 $typeCfg.=$this->renderCheckBox($prefix.'[excludeField]',isset($fConf['excludeField'])?$fConf['excludeField']:1).' Is Exclude-field '.$this->whatIsThis('If a field is marked "Exclude-field", users can edit it ONLY if the field is specifically listed in one of the backend user groups of the user.\nIn other words, if a field is marked "Exclude-field" you can control which users can edit it and which cannot.').'<BR>';
00283 
00284                 $fDetails='';
00285                 switch((string)$fConf['type'])  {
00286                         case 'input+':
00287                                 $typeCfg.=$this->resImg('t_input.png','','');
00288 
00289                                 $fDetails.=$this->renderStringBox($prefix.'[conf_size]',$fConf['conf_size'],50).' Field width (5-48 relative, 30 default)<BR>';
00290                                 $fDetails.=$this->renderStringBox($prefix.'[conf_max]',$fConf['conf_max'],50).' Max characters<BR>';
00291                                 $fDetails.=$this->renderCheckBox($prefix.'[conf_required]',$fConf['conf_required']).'Required<BR>';
00292                                 $fDetails.=$this->resImg('t_input_required.png','hspace=20','','<BR><BR>');
00293 
00294                                 $fDetails.=$this->renderCheckBox($prefix.'[conf_varchar]',$fConf['conf_varchar']).'Create VARCHAR, not TINYTEXT field (if not forced INT)<BR>';
00295 
00296                                 $fDetails.=$this->renderCheckBox($prefix.'[conf_check]',$fConf['conf_check']).'Apply checkbox<BR>';
00297                                 $fDetails.=$this->resImg('t_input_check.png','hspace=20','','<BR><BR>');
00298 
00299                                 $optValues = array(
00300                                         '' => '',
00301                                         'date' => 'Date (day-month-year)',
00302                                         'time' => 'Time (hours, minutes)',
00303                                         'timesec' => 'Time + seconds',
00304                                         'datetime' => 'Date + Time',
00305                                         'year' => 'Year',
00306                                         'int' => 'Integer',
00307                                         'int+' => 'Integer 0-1000',
00308                                         'double2' => 'Floating point, x.xx',
00309                                         'alphanum' => 'Alphanumeric only',
00310                                         'upper' => 'Upper case',
00311                                         'lower' => 'Lower case',
00312                                 );
00313                                 $fDetails.='<BR>Evaluate value to:<BR>'.$this->renderSelectBox($prefix.'[conf_eval]',$fConf['conf_eval'],$optValues).'<BR>';
00314                                 $fDetails.=$this->renderCheckBox($prefix.'[conf_stripspace]',$fConf['conf_stripspace']).'Strip space<BR>';
00315                                 $fDetails.=$this->renderCheckBox($prefix.'[conf_pass]',$fConf['conf_pass']).'Is password field<BR>';
00316                                 $fDetails.=$this->resImg('t_input_password.png','hspace=20','','<BR><BR>');
00317 
00318                                 $fDetails.='<BR>';
00319                                 $fDetails.=$this->renderRadioBox($prefix.'[conf_unique]',$fConf['conf_unique'],'G').'Unique in whole database<BR>';
00320                                 $fDetails.=$this->renderRadioBox($prefix.'[conf_unique]',$fConf['conf_unique'],'L').'Unique inside parent page<BR>';
00321                                 $fDetails.=$this->renderRadioBox($prefix.'[conf_unique]',$fConf['conf_unique'],'').'Not unique (default)<BR>';
00322                                 $fDetails.='<BR>';
00323                                 $fDetails.=$this->renderCheckBox($prefix.'[conf_wiz_color]',$fConf['conf_wiz_color']).'Add colorpicker wizard<BR>';
00324                                 $fDetails.=$this->resImg('t_input_colorwiz.png','hspace=20','','<BR><BR>');
00325                                 $fDetails.=$this->renderCheckBox($prefix.'[conf_wiz_link]',$fConf['conf_wiz_link']).'Add link wizard<BR>';
00326                                 $fDetails.=$this->resImg('t_input_link2.png','hspace=20','','<BR><BR>');
00327                         break;
00328                         case 'input':
00329                                 $typeCfg.=$this->resImg('t_input.png','','');
00330 
00331                                 $fDetails.=$this->renderStringBox($prefix.'[conf_size]',$fConf['conf_size'],50).' Field width (5-48 relative, 30 default)<BR>';
00332                                 $fDetails.=$this->renderStringBox($prefix.'[conf_max]',$fConf['conf_max'],50).' Max characters<BR>';
00333                                 $fDetails.=$this->renderCheckBox($prefix.'[conf_required]',$fConf['conf_required']).'Required<BR>';
00334                                 $fDetails.=$this->resImg('t_input_required.png','hspace=20','','<BR><BR>');
00335 
00336                                 $fDetails.=$this->renderCheckBox($prefix.'[conf_varchar]',$fConf['conf_varchar']).'Create VARCHAR, not TINYTEXT field<BR>';
00337                         break;
00338                         case 'textarea':
00339                         case 'textarea_nowrap':
00340                                 $typeCfg.=$this->resImg('t_textarea.png','','');
00341 
00342                                 $fDetails.=$this->renderStringBox($prefix.'[conf_cols]',$fConf['conf_cols'],50).' Textarea width (5-48 relative, 30 default)<BR>';
00343                                 $fDetails.=$this->renderStringBox($prefix.'[conf_rows]',$fConf['conf_rows'],50).' Number of rows (height)<BR>';
00344                                 $fDetails.='<BR>';
00345                                 $fDetails.=$this->renderCheckBox($prefix.'[conf_wiz_example]',$fConf['conf_wiz_example']).'Add wizard example<BR>';
00346                                 $fDetails.=$this->resImg('t_textarea_wiz.png','hspace=20','','<BR><BR>');
00347                         break;
00348                         case 'textarea_rte':
00349                                 $typeCfg.=$this->resImg($fConf['conf_rte']!='tt_content'?'t_rte.png':'t_rte2.png','','');
00350 
00351                                 $optValues = array(
00352                                         'tt_content' => 'Transform content like the Content Element "Bodytext" field (default/old)',
00353                                         'basic' => 'Typical basic setup (new "Bodytext" field based on CSS stylesheets)',
00354                                         'moderate' => 'Moderate transform of images and links',
00355                                         'none' => 'No transformation at all',
00356                                         'custom' => 'Custom'
00357                                 );
00358                                 $fDetails.='<BR>Rich Text Editor Mode:<BR>'.$this->renderSelectBox($prefix.'[conf_rte]',$fConf['conf_rte'],$optValues).'<BR>';
00359                                 if ((string)$fConf['conf_rte']=='custom')       {
00360                                         $optValues = array(
00361                                                 'cut' => array('Cut button'),
00362                                                 'copy' => array('Copy button'),
00363                                                 'paste' => array('Paste button'),
00364                                                 'formatblock' => array('Paragraph formatting','<DIV>, <P>'),
00365                                                 'class' => array('Character formatting','<SPAN>)'),
00366                                                 'fontstyle' => array('Font face','<FONT face=>)'),
00367                                                 'fontsize' => array('Font size','<FONT size=>)'),
00368                                                 'textcolor' => array('Font color','<FONT color=>'),
00369                                                 'bold' => array('Bold','<STRONG>, <B>'),
00370                                                 'italic' => array('italic','<EM>, <I>'),
00371                                                 'underline' => array('Underline','<U>'),
00372                                                 'left' => array('Left align','<DIV>, <P>'),
00373                                                 'center' => array('Center align','<DIV>, <P>'),
00374                                                 'right' => array('Right align','<DIV>, <P>'),
00375                                                 'orderedlist' => array('Ordered bulletlist','<OL>, <LI>'),
00376                                                 'unorderedlist' => array('Unordered bulletlist','<UL>, <LI>'),
00377                                                 'outdent' => array('Outdent block','<BLOCKQUOTE>'),
00378                                                 'indent' => array('Indent block','<BLOCKQUOTE>'),
00379                                                 'link' => array('Link','<A>'),
00380                                                 'table' => array('Table','<TABLE>, <TR>, <TD>'),
00381                                                 'image' => array('Image','<IMG>'),
00382                                                 'line' => array('Ruler','<HR>'),
00383                                                 'user' => array('User defined',''),
00384                                                 'chMode' => array('Edit source?','')
00385                                         );
00386                                         $subLines=array();
00387                                         $subLines[]='<tr>
00388                                                 <td>&nbsp;</td>
00389                                                 <td>&nbsp;</td>
00390                                                 <td><strong>'.$this->fw('Button name:').'</strong></td>
00391                                                 <td><strong>'.$this->fw('Tags allowed:').'</strong></td>
00392                                         </tr>';
00393                                         foreach($optValues as $kk=>$vv) {
00394                                                 $subLines[]='<tr>
00395                                                         <td>'.$this->renderCheckBox($prefix.'[conf_rte_b_'.$kk.']',$fConf['conf_rte_b_'.$kk]).'</td>
00396                                                         <td>'.$this->resIcon($kk.'.png').'</td>
00397                                                         <td>'.$this->fw($vv[0]).'</td>
00398                                                         <td>'.$this->fw(htmlspecialchars($vv[1])).'</td>
00399                                                 </tr>';
00400                                         }
00401                                         $fDetails.='<table border=0 cellpadding=2 cellspacing=2>'.implode('',$subLines).'</table><BR>';
00402 
00403                                         $fDetails.='<BR><strong>Define specific colors:</strong><BR>
00404                                                 <em>Notice: Use only HEX-values for colors ("blue" should be #0000ff etc.)</em><BR>';
00405                                         for($a=1;$a<4;$a++)     {
00406                                                 $fDetails.='Color #'.$a.': '.$this->renderStringBox($prefix.'[conf_rte_color'.$a.']',$fConf['conf_rte_color'.$a],70).'<BR>';
00407                                         }
00408                                         $fDetails.=$this->resImg('t_rte_color.png','','','<BR><BR>');
00409 
00410                                         $fDetails.=$this->renderCheckBox($prefix.'[conf_rte_removecolorpicker]',$fConf['conf_rte_removecolorpicker']).'Hide colorpicker<BR>';
00411                                         $fDetails.=$this->resImg('t_rte_colorpicker.png','hspace=20','','<BR><BR>');
00412 
00413                                         $fDetails.='<BR><strong>Define classes:</strong><BR>';
00414                                         for($a=1;$a<7;$a++)     {
00415                                                 $fDetails.='Class Title:'.$this->renderStringBox($prefix.'[conf_rte_class'.$a.']',$fConf['conf_rte_class'.$a],100).
00416                                                   '<BR>CSS Style: {'.$this->renderStringBox($prefix.'[conf_rte_class'.$a.'_style]',$fConf['conf_rte_class'.$a.'_style'],250).'}'.
00417                                                   '<BR>';
00418                                         }
00419                                         $fDetails.=$this->resImg('t_rte_class.png','','','<BR><BR>');
00420 
00421 #                                       $fDetails.=$this->renderCheckBox($prefix."[conf_rte_removePdefaults]",$fConf["conf_rte_removePdefaults"])."<BR>";
00422                                         $optValues = array(
00423                                                 '0' => '',
00424                                                 '1' => 'Hide Hx and PRE from Paragraph selector.',
00425                                                 'H2H3' => 'Hide all, but H2,H3,P,PRE',
00426                                         );
00427                                         $fDetails.='<BR>Hide Paragraph Items:<BR>'.$this->renderSelectBox($prefix.'[conf_rte_removePdefaults]',$fConf['conf_rte_removePdefaults'],$optValues).'<BR>';
00428                                         $fDetails.=$this->resImg('t_rte_hideHx.png','hspace=20','','<BR><BR>');
00429 
00430                                         $fDetails.='<BR><strong>Misc:</strong><BR>';
00431 //                                      $fDetails.=$this->renderCheckBox($prefix.'[conf_rte_custom_php_processing]',$fConf['conf_rte_custom_php_processing']).'Custom PHP processing of content<BR>';
00432                                         $fDetails.=$this->renderCheckBox($prefix.'[conf_rte_div_to_p]',isset($fConf['conf_rte_div_to_p'])?$fConf['conf_rte_div_to_p']:1).htmlspecialchars('Convert all <DIV> to <P>').'<BR>';
00433                                 }
00434 
00435                                 $fDetails.='<BR>';
00436                                 $fDetails.=$this->renderCheckBox($prefix.'[conf_rte_fullscreen]',isset($fConf['conf_rte_fullscreen'])?$fConf['conf_rte_fullscreen']:1).'Fullscreen link<BR>';
00437                                 $fDetails.=$this->resImg('t_rte_fullscreen.png','hspace=20','','<BR><BR>');
00438 
00439                                 if (t3lib_div::inList('moderate,basic,custom',$fConf['conf_rte']))      {
00440                                         $fDetails.='<BR>';
00441                                         $fDetails.=$this->renderCheckBox($prefix.'[conf_rte_separateStorageForImages]',isset($fConf['conf_rte_separateStorageForImages'])?$fConf['conf_rte_separateStorageForImages']:1).'Storage of images in separate folder (in uploads/[extfolder]/rte/)<BR>';
00442                                 }
00443                                 if (t3lib_div::inList('moderate,custom',$fConf['conf_rte']))    {
00444                                         $fDetails.='<BR>';
00445                                         $fDetails.=$this->renderCheckBox($prefix.'[conf_mode_cssOrNot]',isset($fConf['conf_mode_cssOrNot'])?$fConf['conf_mode_cssOrNot']:1) . 'Use "ts_css" transformation instead of "ts_images-ts-reglinks"<BR>';
00446                                 }
00447                         break;
00448                         case 'check':
00449                                 $typeCfg.=$this->resImg('t_input_link.png','','');
00450                                 $fDetails.=$this->renderCheckBox($prefix.'[conf_check_default]',$fConf['conf_check_default']).'Checked by default<BR>';
00451                         break;
00452                         case 'select':
00453                         case 'radio':
00454                                 if ($fConf['type']=='radio')    {
00455                                         $typeCfg.=$this->resImg('t_radio.png','','');
00456                                 } else  {
00457                                         $typeCfg.=$this->resImg('t_sel.png','','');
00458                                 }
00459                                 $fDetails.='<BR><strong>Define values:</strong><BR>';
00460                                 $subLines=array();
00461                                         $subLines[]='<tr>
00462                                                 <td valign=top>'.$this->fw('Item label:').'</td>
00463                                                 <td valign=top>'.$this->fw('Item value:').'</td>
00464                                         </tr>';
00465                                 $nItems = $fConf['conf_select_items'] = isset($fConf['conf_select_items'])?t3lib_div::intInRange(intval($fConf['conf_select_items']),0,20):4;
00466                                 for($a=0;$a<$nItems;$a++)       {
00467                                         $subLines[]='<tr>
00468                                                 <td valign=top>'.$this->fw($this->renderStringBox_lang('conf_select_item_'.$a,$prefix,$fConf)).'</td>
00469                                                 <td valign=top>'.$this->fw($this->renderStringBox($prefix.'[conf_select_itemvalue_'.$a.']',isset($fConf['conf_select_itemvalue_'.$a])?$fConf['conf_select_itemvalue_'.$a]:$a,50)).'</td>
00470                                         </tr>';
00471                                 }
00472                                 $fDetails.='<table border=0 cellpadding=2 cellspacing=2>'.implode('',$subLines).'</table><BR>';
00473                                 $fDetails.=$this->renderStringBox($prefix.'[conf_select_items]',$fConf['conf_select_items'],50).' Number of values<BR>';
00474 
00475                                 if ($fConf['type']=='select')   {
00476                                         $fDetails.=$this->renderCheckBox($prefix.'[conf_select_icons]',$fConf['conf_select_icons']).'Add a dummy set of icons<BR>';
00477                                         $fDetails.=$this->resImg('t_select_icons.png','hspace=20','','<BR><BR>');
00478 
00479                                         $fDetails.=$this->renderStringBox($prefix.'[conf_relations]',t3lib_div::intInRange($fConf['conf_relations'],1,1000),50).' Max number of relations<BR>';
00480                                         $fDetails.=$this->renderStringBox($prefix.'[conf_relations_selsize]',t3lib_div::intInRange($fConf['conf_relations_selsize'],1,50),50).' Size of selector box<BR>';
00481 
00482                                         $fDetails.=$this->renderCheckBox($prefix.'[conf_select_pro]',$fConf['conf_select_pro']).'Add pre-processing with PHP-function<BR>';
00483                                 }
00484                         break;
00485                         case 'rel':
00486                                 if ($fConf['conf_rel_type']=='group' || !$fConf['conf_rel_type'])       {
00487                                         $typeCfg.=$this->resImg('t_rel_group.png','','');
00488                                 } elseif(intval($fConf['conf_relations'])>1)    {
00489                                         $typeCfg.=$this->resImg('t_rel_selmulti.png','','');
00490                                 } elseif(intval($fConf['conf_relations_selsize'])>1)    {
00491                                         $typeCfg.=$this->resImg('t_rel_selx.png','','');
00492                                 } else {
00493                                         $typeCfg.=$this->resImg('t_rel_sel1.png','','');
00494                                 }
00495 
00496 
00497                                 $optValues = array(
00498                                         'pages' => 'Pages table, (pages)',
00499                                         'fe_users' => 'Frontend Users, (fe_users)',
00500                                         'fe_groups' => 'Frontend Usergroups, (fe_groups)',
00501                                         'tt_content' => 'Content elements, (tt_content)',
00502                                         '_CUSTOM' => 'Custom table (enter name below)',
00503                                         '_ALL' => 'All tables allowed!',
00504                                 );
00505                                 if ($fConf['conf_rel_type']!='group')   {unset($optValues['_ALL']);}
00506                                 $optValues = $this->addOtherExtensionTables($optValues);
00507                                 $fDetails.='<BR>Create relation to table:<BR>'.$this->renderSelectBox($prefix.'[conf_rel_table]',$fConf['conf_rel_table'],$optValues).'<BR>';
00508                                 if ($fConf['conf_rel_table']=='_CUSTOM')        $fDetails.='Custom table name: '.$this->renderStringBox($prefix.'[conf_custom_table_name]',$fConf['conf_custom_table_name'],200).'<BR>';
00509 
00510                                 $optValues = array(
00511                                         'group' => 'Field with Element Browser',
00512                                         'select' => 'Selectorbox, select global',
00513                                         'select_cur' => 'Selectorbox, select from current page',
00514                                         'select_root' => 'Selectorbox, select from root page',
00515                                         'select_storage' => 'Selectorbox, select from storage page',
00516                                 );
00517                                 $fDetails.='<BR>Type:<BR>'.$this->renderSelectBox($prefix.'[conf_rel_type]',$fConf['conf_rel_type']?$fConf['conf_rel_type']:'group',$optValues).'<BR>';
00518                                 if (t3lib_div::intInRange($fConf['conf_relations'],1,1000)==1 && $fConf['conf_rel_type']!='group')      {
00519                                         $fDetails.=$this->renderCheckBox($prefix.'[conf_rel_dummyitem]',$fConf['conf_rel_dummyitem']).'Add a blank item to the selector<BR>';
00520                                 }
00521 
00522                                 $fDetails.=$this->renderStringBox($prefix.'[conf_relations]',t3lib_div::intInRange($fConf['conf_relations'],1,1000),50).' Max number of relations<BR>';
00523                                 $fDetails.=$this->renderStringBox($prefix.'[conf_relations_selsize]',t3lib_div::intInRange($fConf['conf_relations_selsize'],1,50),50).' Size of selector box<BR>';
00524                                 $fDetails.=$this->renderCheckBox($prefix.'[conf_relations_mm]',$fConf['conf_relations_mm']).'True M-M relations (otherwise commalist of values)<BR>';
00525 
00526 
00527                                 if ($fConf['conf_rel_type']!='group')   {
00528                                         $fDetails.='<BR>';
00529                                         $fDetails.=$this->renderCheckBox($prefix.'[conf_wiz_addrec]',$fConf['conf_wiz_addrec']).'Add "Add record" link<BR>';
00530                                         $fDetails.=$this->renderCheckBox($prefix.'[conf_wiz_listrec]',$fConf['conf_wiz_listrec']).'Add "List records" link<BR>';
00531                                         $fDetails.=$this->renderCheckBox($prefix.'[conf_wiz_editrec]',$fConf['conf_wiz_editrec']).'Add "Edit record" link<BR>';
00532                                         $fDetails.=$this->resImg("t_rel_wizards.png",'hspace=20','','<BR><BR>');
00533                                 }
00534                         break;
00535                         case 'files':
00536                                 if ($fConf['conf_files_type']=='images')        {
00537                                         $typeCfg.=$this->resImg('t_file_img.png','','');
00538                                 } elseif ($fConf['conf_files_type']=='webimages')       {
00539                                         $typeCfg.=$this->resImg('t_file_web.png','','');
00540                                 } else {
00541                                         $typeCfg.=$this->resImg('t_file_all.png','','');
00542                                 }
00543 
00544                                 $optValues = array(
00545                                         'images' => 'Imagefiles',
00546                                         'webimages' => 'Web-imagefiles (gif,jpg,png)',
00547                                         'all' => 'All files, except php/php3 extensions',
00548                                 );
00549                                 $fDetails.='<BR>Extensions:<BR>'.$this->renderSelectBox($prefix.'[conf_files_type]',$fConf['conf_files_type'],$optValues).'<BR>';
00550 
00551                                 $fDetails.=$this->renderStringBox($prefix.'[conf_files]',t3lib_div::intInRange($fConf['conf_files'],1,1000),50).' Max number of files<BR>';
00552                                 $fDetails.=$this->renderStringBox($prefix.'[conf_max_filesize]',t3lib_div::intInRange($fConf['conf_max_filesize'],1,1000,500),50).' Max filesize allowed (kb)<BR>';
00553                                 $fDetails.=$this->renderStringBox($prefix.'[conf_files_selsize]',t3lib_div::intInRange($fConf['conf_files_selsize'],1,50),50).' Size of selector box<BR>';
00554                                 $fDetails.=$this->resImg('t_file_size.png','','','<BR><BR>');
00555 //                              $fDetails.=$this->renderCheckBox($prefix.'[conf_files_mm]',$fConf['conf_files_mm']).'DB relations (very rare choice, normally the commalist is fine enough)<BR>';
00556                                 $fDetails.=$this->renderCheckBox($prefix.'[conf_files_thumbs]',$fConf['conf_files_thumbs']).'Show thumbnails<BR>';
00557                                 $fDetails.=$this->resImg('t_file_thumb.png','hspace=20','','<BR><BR>');
00558                         break;
00559                         case 'integer':
00560                                 $typeCfg.=$this->resImg('t_integer.png','','');
00561                         break;
00562                         case 'check_4':
00563                         case 'check_10':
00564                                 if ((string)$fConf['type']=='check_4')  {
00565                                         $typeCfg.=$this->resImg('t_check4.png','','');
00566                                 } else {
00567                                         $typeCfg.=$this->resImg('t_check10.png','','');
00568                                 }
00569                                 $nItems= t3lib_div::intInRange($fConf['conf_numberBoxes'],1,10,(string)$fConf['type']=='check_4'?4:10);
00570                                 $fDetails.=$this->renderStringBox($prefix.'[conf_numberBoxes]',$nItems,50).' Number of checkboxes<BR>';
00571 
00572                                 for($a=0;$a<$nItems;$a++)       {
00573                                         $fDetails.='<BR>Label '.($a+1).':<BR>'.$this->renderStringBox_lang('conf_boxLabel_'.$a,$prefix,$fConf);
00574                                 }
00575                         break;
00576                         case 'date':
00577                                 $typeCfg.=$this->resImg('t_date.png','','');
00578                         break;
00579                         case 'datetime':
00580                                 $typeCfg.=$this->resImg('t_datetime.png','','');
00581                         break;
00582                         case 'link':
00583                                 $typeCfg.=$this->resImg('t_link.png','','');
00584                         break;
00585                 }
00586 
00587                 if ($fConf['type'])     $typeCfg.=$this->textSetup('',$fDetails);
00588 
00589                 $content='<table border=0 cellpadding=0 cellspacing=0>
00590                         <tr><td valign=top>'.$this->fw('Field name:').'</td><td valign=top>'.$this->fw($fieldName).'</td></tr>
00591                         <tr><td valign=top>'.$this->fw('Field title:').'</td><td valign=top>'.$this->fw($fieldTitle).'</td></tr>
00592                         <tr><td valign=top>'.$this->fw('Field type:').'</td><td valign=top>'.$this->fw($typeCfg).'</td></tr>
00593                 </table>';
00594                 return $content;
00595         }
00596 
00597 
00598 
00599 
00603         function render_extPart($k,$config,$extKey) {
00604                 $WOP='[fields]['.$k.']';
00605                 $tableName=$config['which_table'];
00606         #       $tableName = $this->returnName($extKey,'fields',$tableName);
00607 #               $prefix = 'tx_'.str_replace('_','',$extKey).'_';
00608                 $prefix = $this->returnName($extKey,'fields').'_';
00609 
00610                 $DBfields=array();
00611                 $columns=array();
00612                 $ctrl=array();
00613                 $enFields=array();
00614 
00615                 if (is_array($config['fields']))        {
00616                         reset($config['fields']);
00617                         while(list($i,$fConf)=each($config['fields']))  {
00618                                 $fConf['fieldname'] = $prefix.$fConf['fieldname'];
00619                                 $this->makeFieldTCA($DBfields,$columns,$fConf,$WOP.'[fields]['.$i.']',$tableName,$extKey);
00620                         }
00621                 }
00622 
00623                 if ($tableName=='tt_address')   $this->wizard->EM_CONF_presets['dependencies'][]='tt_address';
00624                 if ($tableName=='tt_news')      $this->wizard->EM_CONF_presets['dependencies'][]='tt_news';
00625                 if (t3lib_div::inList('tt_content,fe_users,fe_groups',$tableName))      $this->wizard->EM_CONF_presets['dependencies'][]='cms';
00626 
00627                 $createTable = $this->wrapBody('
00628                         #
00629                         # Table structure for table \''.$tableName.'\'
00630                         #
00631                         CREATE TABLE '.$tableName.' (
00632                 ', ereg_replace(',[[:space:]]*$','',implode(chr(10),$DBfields)), '
00633 
00634                         );
00635                 ');
00636                 $this->wizard->ext_tables_sql[]=chr(10).$createTable.chr(10);
00637 
00638 
00639                         // Finalize ext_tables.php:
00640                 $this->wizard->ext_tables[]=$this->wrapBody('
00641                         $tempColumns = Array (
00642                                 ', implode(chr(10),$columns)    ,'
00643                         );
00644                 ');
00645 
00646 
00647                 list($typeList) = $this->implodeColumns($columns);
00648                 $applyToAll=1;
00649                 if (is_array($this->wizard->wizArray['pi']))    {
00650                         reset($this->wizard->wizArray['pi']);
00651                         while(list(,$fC)=each($this->wizard->wizArray['pi']))   {
00652                                 if ($fC['apply_extended']==$k)  {
00653                                         $applyToAll=0;
00654                                         $this->wizard->_apply_extended_types[$k]=$typeList;
00655                                 }
00656                         }
00657                 }
00658                 $this->wizard->ext_tables[]=$this->sPS('
00659                         t3lib_div::loadTCA("'.$tableName.'");
00660                         t3lib_extMgm::addTCAcolumns("'.$tableName.'",$tempColumns,1);
00661                         '.($applyToAll?'t3lib_extMgm::addToAllTCAtypes("'.$tableName.'","'.$typeList.'");':'').'
00662                 ');
00663         }
00664 
00665 
00666 
00667 
00668 
00669         function implodeColumns($columns)       {
00670                 reset($columns);
00671                 $outems=array();
00672                 $paltems=array();
00673                 $c=0;
00674                 $hiddenFlag=0;
00675                 $titleDivFlag=0;
00676                 while(list($fN)=each($columns)) {
00677                         if (!$hiddenFlag || !t3lib_div::inList('starttime,endtime,fe_group',$fN))       {
00678                                 $outTem = array($fN,'','','','');
00679                                 $outTem[3] = $this->wizard->_typeP[$fN];
00680                                 if ($c==0)      $outTem[4]='1-1-1';
00681                                 if ($fN=='title')       {
00682                                         $outTem[4]='2-2-2';
00683                                         $titleDivFlag=1;
00684                                 } elseif ($titleDivFlag)        {
00685                                         $outTem[4]='3-3-3';
00686                                         $titleDivFlag=0;
00687                                 }
00688                                 if ($fN=='hidden')      {
00689                                         $outTem[2]='1';
00690                                         $hiddenFlag=1;
00691                                 }
00692                                 $outems[] = str_replace(',','',str_replace(chr(9),';',trim(str_replace(';','',implode(chr(9),$outTem)))));
00693                                 $c++;
00694                         } else {
00695                                 $paltems[]=$fN;
00696                         }
00697                 }
00698                 return array(implode(', ',$outems),implode(', ',$paltems));
00699         }
00700         function makeFieldTCA(&$DBfields,&$columns,$fConf,$WOP,$table,$extKey)  {
00701                 if (!(string)$fConf['type'])    return;
00702                 $id = $table.'_'.$fConf['fieldname'];
00703 #debug($fConf);
00704 
00705                 $configL=array();
00706                 $t = (string)$fConf['type'];
00707                 switch($t)      {
00708                         case 'input':
00709                         case 'input+':
00710                                 $isString =1;
00711                                 $configL[]='"type" => "input",  ' . $this->WOPcomment('WOP:'.$WOP.'[type]');
00712                                 $configL[]='"size" => "' . t3lib_div::intInRange($fConf['conf_size'],5,48,30) . '",     ' .$this->WOPcomment('WOP:'.$WOP.'[conf_size]');
00713                                 if (intval($fConf['conf_max'])) $configL[]='"max" => "' . t3lib_div::intInRange($fConf['conf_max'],1,255).'",   '.$this->WOPcomment('WOP:'.$WOP.'[conf_max]');
00714 
00715                                 $evalItems=array();
00716                                 if ($fConf['conf_required'])    {$evalItems[0][] = 'required';                  $evalItems[1][] = $WOP.'[conf_required]';}
00717 
00718                                 if ($t=='input+')       {
00719                                         $isString = !$fConf['conf_eval'] || t3lib_div::inList('alphanum,upper,lower',$fConf['conf_eval']);
00720                                         if ($fConf['conf_varchar'] && $isString)                {$evalItems[0][] = 'trim';                      $evalItems[1][] = $WOP.'[conf_varchar]';}
00721                                         if ($fConf['conf_eval']=='int+')        {
00722                                                 $configL[]='"range" => Array ("lower"=>0,"upper"=>1000),        '.$this->WOPcomment('WOP:'.$WOP.'[conf_eval] = int+ results in a range setting');
00723                                                 $fConf['conf_eval']='int';
00724                                         }
00725                                         if ($fConf['conf_eval'])                {$evalItems[0][] = $fConf['conf_eval'];                 $evalItems[1][] = $WOP.'[conf_eval]';}
00726                                         if ($fConf['conf_check'])       $configL[]='"checkbox" => "'.($isString?'':'0').'",     '.$this->WOPcomment('WOP:'.$WOP.'[conf_check]');
00727 
00728                                         if ($fConf['conf_stripspace'])          {$evalItems[0][] = 'nospace';                   $evalItems[1][] = $WOP.'[conf_stripspace]';}
00729                                         if ($fConf['conf_pass'])                {$evalItems[0][] = 'password';                  $evalItems[1][] = $WOP.'[conf_pass]';}
00730                                         if ($fConf['conf_unique'])      {
00731                                                 if ($fConf['conf_unique']=='L')         {$evalItems[0][] = 'uniqueInPid';                       $evalItems[1][] = $WOP.'[conf_unique] = Local (unique in this page (PID))';}
00732                                                 if ($fConf['conf_unique']=='G')         {$evalItems[0][] = 'unique';                    $evalItems[1][] = $WOP.'[conf_unique] = Global (unique in whole database)';}
00733                                         }
00734 
00735                                         $wizards =array();
00736                                         if ($fConf['conf_wiz_color'])   {
00737                                                 $wizards[] = trim($this->sPS('
00738                                                         '.$this->WOPcomment('WOP:'.$WOP.'[conf_wiz_color]').'
00739                                                         "color" => Array(
00740                                                                 "title" => "Color:",
00741                                                                 "type" => "colorbox",
00742                                                                 "dim" => "12x12",
00743                                                                 "tableStyle" => "border:solid 1px black;",
00744                                                                 "script" => "wizard_colorpicker.php",
00745                                                                 "JSopenParams" => "height=300,width=250,status=0,menubar=0,scrollbars=1",
00746                                                         ),
00747                                                 '));
00748                                         }
00749                                         if ($fConf['conf_wiz_link'])    {
00750                                                 $wizards[] = trim($this->sPS('
00751                                                         '.$this->WOPcomment('WOP:'.$WOP.'[conf_wiz_link]').'
00752                                                         "link" => Array(
00753                                                                 "type" => "popup",
00754                                                                 "title" => "Link",
00755                                                                 "icon" => "link_popup.gif",
00756                                                                 "script" => "browse_links.php?mode=wizard",
00757                                                                 "JSopenParams" => "height=300,width=500,status=0,menubar=0,scrollbars=1"
00758                                                         ),
00759                                                 '));
00760                                         }
00761                                         if (count($wizards))    {
00762                                                 $configL[]=trim($this->wrapBody('
00763                                                         "wizards" => Array(
00764                                                                 "_PADDING" => 2,
00765                                                                 ',implode(chr(10),$wizards),'
00766                                                         ),
00767                                                 '));
00768                                         }
00769                                 } else {
00770                                         if ($fConf['conf_varchar'])             {$evalItems[0][] = 'trim';                      $evalItems[1][] = $WOP.'[conf_varchar]';}
00771                                 }
00772 
00773                                 if (count($evalItems))  $configL[]='"eval" => "'.implode(",",$evalItems[0]).'", '.$this->WOPcomment('WOP:'.implode(" / ",$evalItems[1]));
00774 
00775                                 if (!$isString) {
00776                                         $DBfields[] = $fConf['fieldname'] . ' int(11) DEFAULT \'0\' NOT NULL,';
00777                                 } elseif (!$fConf['conf_varchar'])              {
00778                                         $DBfields[] = $fConf['fieldname'] . ' tinytext NOT NULL,';
00779                                 } else {
00780                                         $varCharLn = (intval($fConf['conf_max'])?t3lib_div::intInRange($fConf['conf_max'],1,255):255);
00781                                         $DBfields[] = $fConf['fieldname'] . ' ' . ($varCharLn>$this->wizard->charMaxLng?'var':'') . 'char(' . $varCharLn .') DEFAULT "" NOT NULL,';
00782                                 }
00783                         break;
00784                         case 'link':
00785                                 $DBfields[] = $fConf['fieldname'].' tinytext NOT NULL,';
00786                                 $configL[]=trim($this->sPS('
00787                                         "type" => "input",
00788                                         "size" => "15",
00789                                         "max" => "255",
00790                                         "checkbox" => "",
00791                                         "eval" => "trim",
00792                                         "wizards" => Array(
00793                                                 "_PADDING" => 2,
00794                                                 "link" => Array(
00795                                                         "type" => "popup",
00796                                                         "title" => "Link",
00797                                                         "icon" => "link_popup.gif",
00798                                                         "script" => "browse_links.php?mode=wizard",
00799                                                         "JSopenParams" => "height=300,width=500,status=0,menubar=0,scrollbars=1"
00800                                                 )
00801                                         )
00802                                 '));
00803                         break;
00804                         case 'datetime':
00805                         case 'date':
00806                                 $DBfields[] = $fConf['fieldname'].' int(11) DEFAULT \'0\' NOT NULL,';
00807                                 $configL[]=trim($this->sPS('
00808                                         "type" => "input",
00809                                         "size" => "'.($t=="datetime"?12:8).'",
00810                                         "max" => "20",
00811                                         "eval" => "'.$t.'",
00812                                         "checkbox" => "0",
00813                                         "default" => "0"
00814                                 '));
00815                         break;
00816                         case 'integer':
00817                                 $DBfields[] = $fConf['fieldname'] . ' int(11) DEFAULT \'0\' NOT NULL,';
00818                                 $configL[]=trim($this->sPS('
00819                                         "type" => "input",
00820                                         "size" => "4",
00821                                         "max" => "4",
00822                                         "eval" => "int",
00823                                         "checkbox" => "0",
00824                                         "range" => Array (
00825                                                 "upper" => "1000",
00826                                                 "lower" => "10"
00827                                         ),
00828                                         "default" => 0
00829                                 '));
00830                         break;
00831                         case 'textarea':
00832                         case 'textarea_nowrap':
00833                                 $DBfields[] = $fConf['fieldname'].' text NOT NULL,';
00834                                 $configL[]='"type" => "text",';
00835                                 if ($t=='textarea_nowrap')      {
00836                                         $configL[]='"wrap" => "OFF",';
00837                                 }
00838                                 $configL[]='"cols" => "'.t3lib_div::intInRange($fConf["conf_cols"],5,48,30).'", '.$this->WOPcomment('WOP:'.$WOP.'[conf_cols]');
00839                                 $configL[]='"rows" => "'.t3lib_div::intInRange($fConf["conf_rows"],1,20,5).'",  '.$this->WOPcomment('WOP:'.$WOP.'[conf_rows]');
00840                                 if ($fConf["conf_wiz_example"]) {
00841                                         $wizards =array();
00842                                         $wizards[] = trim($this->sPS('
00843                                                 '.$this->WOPcomment('WOP:'.$WOP.'[conf_wiz_example]').'
00844                                                 "example" => Array(
00845                                                         "title" => "Example Wizard:",
00846                                                         "type" => "script",
00847                                                         "notNewRecords" => 1,
00848                                                         "icon" => t3lib_extMgm::extRelPath("'.$extKey.'")."'.$id.'/wizard_icon.gif",
00849                                                         "script" => t3lib_extMgm::extRelPath("'.$extKey.'")."'.$id.'/index.php",
00850                                                 ),
00851                                         '));
00852 
00853                                         $cN = $this->returnName($extKey,'class',$id.'wiz');
00854                                         $this->writeStandardBE_xMod(
00855                                                 $extKey,
00856                                                 array('title'=>'Example Wizard title...'),
00857                                                 $id.'/',
00858                                                 $cN,
00859                                                 0,
00860                                                 $id.'wiz'
00861                                         );
00862                                         $this->addFileToFileArray($id.'/wizard_icon.gif',t3lib_div::getUrl(t3lib_extMgm::extPath('kickstarter').'res/notfound.gif'));
00863 
00864                                         $configL[]=trim($this->wrapBody('
00865                                                 "wizards" => Array(
00866                                                         "_PADDING" => 2,
00867                                                         ',implode(chr(10),$wizards),'
00868                                                 ),
00869                                         '));
00870                                 }
00871                         break;
00872                         case 'textarea_rte':
00873                                 $DBfields[] = $fConf['fieldname'].' text NOT NULL,';
00874                                 $configL[]='"type" => "text",';
00875                                 $configL[]='"cols" => "30",';
00876                                 $configL[]='"rows" => "5",';
00877                                 if ($fConf['conf_rte_fullscreen'])      {
00878                                         $wizards =array();
00879                                         $wizards[] = trim($this->sPS('
00880                                                 '.$this->WOPcomment('WOP:'.$WOP.'[conf_rte_fullscreen]').'
00881                                                 "RTE" => Array(
00882                                                         "notNewRecords" => 1,
00883                                                         "RTEonly" => 1,
00884                                                         "type" => "script",
00885                                                         "title" => "Full screen Rich Text Editing|Formatteret redigering i hele vinduet",
00886                                                         "icon" => "wizard_rte2.gif",
00887                                                         "script" => "wizard_rte.php",
00888                                                 ),
00889                                         '));
00890                                         $configL[]=trim($this->wrapBody('
00891                                                 "wizards" => Array(
00892                                                         "_PADDING" => 2,
00893                                                         ',implode(chr(10),$wizards),'
00894                                                 ),
00895                                         '));
00896                                 }
00897 
00898                                 $rteImageDir = '';
00899                                 if ($fConf['conf_rte_separateStorageForImages'] && t3lib_div::inList('moderate,basic,custom',$fConf['conf_rte']))       {
00900                                         $this->wizard->EM_CONF_presets['createDirs'][]=$this->ulFolder($extKey).'rte/';
00901                                         $rteImageDir = '|imgpath='.$this->ulFolder($extKey).'rte/';
00902                                 }
00903 
00904                                 $transformation='ts_images-ts_reglinks';
00905                                 if ($fConf['conf_mode_cssOrNot'] && t3lib_div::inList('moderate,custom',$fConf['conf_rte']))    {
00906                                         $transformation='ts_css';
00907                                 }
00908 
00909 
00910                                 switch($fConf['conf_rte'])      {
00911                                         case 'tt_content':
00912                                                 $typeP = 'richtext[paste|bold|italic|underline|formatblock|class|left|center|right|orderedlist|unorderedlist|outdent|indent|link|image]:rte_transform[mode=ts]';
00913                                         break;
00914                                         case 'moderate':
00915                                                 $typeP = 'richtext[*]:rte_transform[mode='.$transformation.''.$rteImageDir.']';
00916                                         break;
00917                                         case 'basic':
00918                                                 $typeP = 'richtext[cut|copy|paste|formatblock|textcolor|bold|italic|underline|left|center|right|orderedlist|unorderedlist|outdent|indent|link|table|image|line|chMode]:rte_transform[mode=ts_css'.$rteImageDir.']';
00919                                                 $this->wizard->ext_localconf[]=trim($this->wrapBody("
00920                                                                 t3lib_extMgm::addPageTSConfig('
00921 
00922                                                                         # ***************************************************************************************
00923                                                                         # CONFIGURATION of RTE in table \"".$table."\", field \"".$fConf["fieldname"]."\"
00924                                                                         # ***************************************************************************************
00925 
00926                                                                         ",trim($this->slashValueForSingleDashes(str_replace(chr(9),"  ",$this->sPS("
00927                                                                                 RTE.config.".$table.".".$fConf["fieldname"]." {
00928                                                                                         hidePStyleItems = H1, H4, H5, H6
00929                                                                                         proc.exitHTMLparser_db=1
00930                                                                                         proc.exitHTMLparser_db {
00931                                                                                                 keepNonMatchedTags=1
00932                                                                                                 tags.font.allowedAttribs= color
00933                                                                                                 tags.font.rmTagIfNoAttrib = 1
00934                                                                                                 tags.font.nesting = global
00935                                                                                         }
00936                                                                                 }
00937                                                                         ")))),"
00938                                                                 ');
00939                                                 ",0));
00940                                         break;
00941                                         case 'none':
00942                                                 $typeP = 'richtext[*]';
00943                                         break;
00944                                         case 'custom':
00945                                                 $enabledButtons=array();
00946                                                 $traverseList = explode(',','cut,copy,paste,formatblock,class,fontstyle,fontsize,textcolor,bold,italic,underline,left,center,right,orderedlist,unorderedlist,outdent,indent,link,table,image,line,user,chMode');
00947                                                 $HTMLparser=array();
00948                                                 $fontAllowedAttrib=array();
00949                                                 $allowedTags_WOP = array();
00950                                                 $allowedTags=array();
00951                                                 while(list(,$lI)=each($traverseList))   {
00952                                                         $nothingDone=0;
00953                                                         if ($fConf['conf_rte_b_'.$lI])  {
00954                                                                 $enabledButtons[]=$lI;
00955                                                                 switch($lI)     {
00956                                                                         case 'formatblock':
00957                                                                         case 'left':
00958                                                                         case 'center':
00959                                                                         case 'right':
00960                                                                                 $allowedTags[]='div';
00961                                                                                 $allowedTags[]='p';
00962                                                                         break;
00963                                                                         case 'class':
00964                                                                                 $allowedTags[]='span';
00965                                                                         break;
00966                                                                         case 'fontstyle':
00967                                                                                 $allowedTags[]='font';
00968                                                                                 $fontAllowedAttrib[]='face';
00969                                                                         break;
00970                                                                         case 'fontsize':
00971                                                                                 $allowedTags[]='font';
00972                                                                                 $fontAllowedAttrib[]='size';
00973                                                                         break;
00974                                                                         case 'textcolor':
00975                                                                                 $allowedTags[]='font';
00976                                                                                 $fontAllowedAttrib[]='color';
00977                                                                         break;
00978                                                                         case 'bold':
00979                                                                                 $allowedTags[]='b';
00980                                                                                 $allowedTags[]='strong';
00981                                                                         break;
00982                                                                         case 'italic':
00983                                                                                 $allowedTags[]='i';
00984                                                                                 $allowedTags[]='em';
00985                                                                         break;
00986                                                                         case 'underline':
00987                                                                                 $allowedTags[]='u';
00988                                                                         break;
00989                                                                         case 'orderedlist':
00990                                                                                 $allowedTags[]='ol';
00991                                                                                 $allowedTags[]='li';
00992                                                                         break;
00993                                                                         case 'unorderedlist':
00994                                                                                 $allowedTags[]='ul';
00995                                                                                 $allowedTags[]='li';
00996                                                                         break;
00997                                                                         case 'outdent':
00998                                                                         case 'indent':
00999                                                                                 $allowedTags[]='blockquote';
01000                                                                         break;
01001                                                                         case 'link':
01002                                                                                 $allowedTags[]='a';
01003                                                                         break;
01004                                                                         case 'table':
01005                                                                                 $allowedTags[]='table';
01006                                                                                 $allowedTags[]='tr';
01007                                                                                 $allowedTags[]='td';
01008                                                                         break;
01009                                                                         case 'image':
01010                                                                                 $allowedTags[]='img';
01011                                                                         break;
01012                                                                         case 'line':
01013                                                                                 $allowedTags[]='hr';
01014                                                                         break;
01015                                                                         default:
01016                                                                                 $nothingDone=1;
01017                                                                         break;
01018                                                                 }
01019                                                                 if (!$nothingDone)      $allowedTags_WOP[] = $WOP.'[conf_rte_b_'.$lI.']';
01020                                                         }
01021                                                 }
01022                                                 if (count($fontAllowedAttrib))  {
01023                                                         $HTMLparser[]='tags.font.allowedAttribs = '.implode(',',$fontAllowedAttrib);
01024                                                         $HTMLparser[]='tags.font.rmTagIfNoAttrib = 1';
01025                                                         $HTMLparser[]='tags.font.nesting = global';
01026                                                 }
01027                                                 if (count($enabledButtons))     {
01028                                                         $typeP = 'richtext['.implode('|',$enabledButtons).']:rte_transform[mode='.$transformation.''.$rteImageDir.']';
01029                                                 }
01030 
01031                                                 $rte_colors=array();
01032                                                 $setupUpColors=array();
01033                                                 for ($a=1;$a<=3;$a++)   {
01034                                                         if ($fConf['conf_rte_color'.$a])        {
01035                                                                 $rte_colors[$id.'_color'.$a]=trim($this->sPS('
01036                                                                         '.$this->WOPcomment('WOP:'.$WOP.'[conf_rte_color'.$a.']').'
01037                                                                         '.$id.'_color'.$a.' {
01038                                                                                 name = Color '.$a.'
01039                                                                                 value = '.$fConf['conf_rte_color'.$a].'
01040                                                                         }
01041                                                                 '));
01042                                                                 $setupUpColors[]=trim($fConf['conf_rte_color'.$a]);
01043                                                         }
01044                                                 }
01045 
01046                                                 $rte_classes=array();
01047                                                 for ($a=1;$a<=6;$a++)   {
01048                                                         if ($fConf['conf_rte_class'.$a])        {
01049                                                                 $rte_classes[$id.'_class'.$a]=trim($this->sPS('
01050                                                                         '.$this->WOPcomment('WOP:'.$WOP.'[conf_rte_class'.$a.']').'
01051                                                                         '.$id.'_class'.$a.' {
01052                                                                                 name = '.$fConf['conf_rte_class'.$a].'
01053                                                                                 value = '.$fConf['conf_rte_class'.$a.'_style'].'
01054                                                                         }
01055                                                                 '));
01056                                                         }
01057                                                 }
01058 
01059                                                 $PageTSconfig= Array();
01060                                                 if ($fConf['conf_rte_removecolorpicker'])       {
01061                                                         $PageTSconfig[]='       '.$this->WOPcomment('WOP:'.$WOP.'[conf_rte_removecolorpicker]');
01062                                                         $PageTSconfig[]='disableColorPicker = 1';
01063                                                 }
01064                                                 if (count($rte_classes))        {
01065                                                         $PageTSconfig[]='       '.$this->WOPcomment('WOP:'.$WOP.'[conf_rte_class*]');
01066                                                         $PageTSconfig[]='classesParagraph = '.implode(', ',array_keys($rte_classes));
01067                                                         $PageTSconfig[]='classesCharacter = '.implode(', ',array_keys($rte_classes));
01068                                                         if (in_array('p',$allowedTags) || in_array('div',$allowedTags)) {
01069                                                                 $HTMLparser[]=' '.$this->WOPcomment('WOP:'.$WOP.'[conf_rte_class*]');
01070                                                                 if (in_array('p',$allowedTags)) {$HTMLparser[]='p.fixAttrib.class.list = ,'.implode(',',array_keys($rte_classes));}
01071                                                                 if (in_array('div',$allowedTags))       {$HTMLparser[]='div.fixAttrib.class.list = ,'.implode(',',array_keys($rte_classes));}
01072                                                         }
01073                                                 }
01074                                                 if (count($rte_colors))         {
01075                                                         $PageTSconfig[]='       '.$this->WOPcomment('WOP:'.$WOP.'[conf_rte_color*]');
01076                                                         $PageTSconfig[]='colors = '.implode(', ',array_keys($rte_colors));
01077 
01078                                                         if (in_array('color',$fontAllowedAttrib) && $fConf['conf_rte_removecolorpicker'])       {
01079                                                                 $HTMLparser[]=' '.$this->WOPcomment('WOP:'.$WOP.'[conf_rte_removecolorpicker]');
01080                                                                 $HTMLparser[]='tags.font.fixAttrib.color.list = ,'.implode(',',$setupUpColors);
01081                                                                 $HTMLparser[]='tags.font.fixAttrib.color.removeIfFalse = 1';
01082                                                         }
01083                                                 }
01084                                                 if (!strcmp($fConf['conf_rte_removePdefaults'],1))      {
01085                                                         $PageTSconfig[]='       '.$this->WOPcomment('WOP:'.$WOP.'[conf_rte_removePdefaults]');
01086                                                         $PageTSconfig[]='hidePStyleItems = H1, H2, H3, H4, H5, H6, PRE';
01087                                                 } elseif ($fConf['conf_rte_removePdefaults']=='H2H3')   {
01088                                                         $PageTSconfig[]='       '.$this->WOPcomment('WOP:'.$WOP.'[conf_rte_removePdefaults]');
01089                                                         $PageTSconfig[]='hidePStyleItems = H1, H4, H5, H6';
01090                                                 } else {
01091                                                         $allowedTags[]='h1';
01092                                                         $allowedTags[]='h2';
01093                                                         $allowedTags[]='h3';
01094                                                         $allowedTags[]='h4';
01095                                                         $allowedTags[]='h5';
01096                                                         $allowedTags[]='h6';
01097                                                         $allowedTags[]='pre';
01098                                                 }
01099 
01100 
01101                                                 $allowedTags = array_unique($allowedTags);
01102                                                 if (count($allowedTags))        {
01103                                                         $HTMLparser[]=' '.$this->WOPcomment('WOP:'.implode(' / ',$allowedTags_WOP));
01104                                                         $HTMLparser[]='allowTags = '.implode(', ',$allowedTags);
01105                                                 }
01106                                                 if ($fConf['conf_rte_div_to_p'])        {
01107                                                         $HTMLparser[]=' '.$this->WOPcomment('WOP:'.$WOP.'[conf_rte_div_to_p]');
01108                                                         $HTMLparser[]='tags.div.remap = P';
01109                                                 }
01110                                                 if (count($HTMLparser)) {
01111                                                         $PageTSconfig[]=trim($this->wrapBody('
01112                                                                 proc.exitHTMLparser_db=1
01113                                                                 proc.exitHTMLparser_db {
01114                                                                         ',implode(chr(10),$HTMLparser),'
01115                                                                 }
01116                                                         '));
01117                                                 }
01118 
01119                                                 $finalPageTSconfig=array();
01120                                                 if (count($rte_colors))         {
01121                                                         $finalPageTSconfig[]=trim($this->wrapBody('
01122                                                                 RTE.colors {
01123                                                                 ',implode(chr(10),$rte_colors),'
01124                                                                 }
01125                                                         '));
01126                                                 }
01127                                                 if (count($rte_classes))                {
01128                                                         $finalPageTSconfig[]=trim($this->wrapBody('
01129                                                                 RTE.classes {
01130                                                                 ',implode(chr(10),$rte_classes),'
01131                                                                 }
01132                                                         '));
01133                                                 }
01134                                                 if (count($PageTSconfig))               {
01135                                                         $finalPageTSconfig[]=trim($this->wrapBody('
01136                                                                 RTE.config.'.$table.'.'.$fConf['fieldname'].' {
01137                                                                 ',implode(chr(10),$PageTSconfig),'
01138                                                                 }
01139                                                         '));
01140                                                 }
01141                                                 if (count($finalPageTSconfig))  {
01142                                                         $this->wizard->ext_localconf[]=trim($this->wrapBody("
01143                                                                 t3lib_extMgm::addPageTSConfig('
01144 
01145                                                                         # ***************************************************************************************
01146                                                                         # CONFIGURATION of RTE in table \"".$table."\", field \"".$fConf["fieldname"]."\"
01147                                                                         # ***************************************************************************************
01148 
01149                                                                 ",trim($this->slashValueForSingleDashes(str_replace(chr(9),"  ",implode(chr(10).chr(10),$finalPageTSconfig)))),"
01150                                                                 ');
01151                                                         ",0));
01152                                                 }
01153                                         break;
01154                                 }
01155                                 $this->wizard->_typeP[$fConf['fieldname']]      = $typeP;
01156                         break;
01157                         case 'check':
01158                         case 'check_4':
01159                         case 'check_10':
01160                                 $configL[]='"type" => "check",';
01161                                 if ($t=='check')        {
01162                                         $DBfields[] = $fConf['fieldname'].' tinyint(3) DEFAULT \'0\' NOT NULL,';
01163                                         if ($fConf['conf_check_default'])       $configL[]='"default" => 1,     '.$this->WOPcomment('WOP:'.$WOP.'[conf_check_default]');
01164                                 } else {
01165                                         $DBfields[] = $fConf['fieldname'].' int(11) DEFAULT \'0\' NOT NULL,';
01166                                 }
01167                                 if ($t=='check_4' || $t=='check_10')    {
01168                                         $configL[]='"cols" => 4,';
01169                                         $cItems=array();
01170 #                                       $aMax = ($t=="check_4"?4:10);
01171                                         $aMax = intval($fConf["conf_numberBoxes"]);
01172                                         for($a=0;$a<$aMax;$a++) {
01173 //                                              $cItems[]='Array("'.($fConf["conf_boxLabel_".$a]?str_replace("\\'","'",addslashes($this->getSplitLabels($fConf,"conf_boxLabel_".$a))):'English Label '.($a+1).'|Danish Label '.($a+1).'|German Label '.($a+1).'| etc...').'", ""),';
01174                                                 $cItems[]='Array("'.addslashes($this->getSplitLabels_reference($fConf,"conf_boxLabel_".$a,$table.".".$fConf["fieldname"].".I.".$a)).'", ""),';
01175                                         }
01176                                         $configL[]=trim($this->wrapBody('
01177                                                 "items" => Array (
01178                                                         ',implode(chr(10),$cItems),'
01179                                                 ),
01180                                         '));
01181                                 }
01182                         break;
01183                         case 'radio':
01184                         case 'select':
01185                                 $configL[]='"type" => "'.($t=="select"?"select":"radio").'",';
01186                                 $notIntVal=0;
01187                                 $len=array();
01188                                 for($a=0;$a<t3lib_div::intInRange($fConf["conf_select_items"],1,20);$a++)       {
01189                                         $val = $fConf["conf_select_itemvalue_".$a];
01190                                         $notIntVal+= t3lib_div::testInt($val)?0:1;
01191                                         $len[]=strlen($val);
01192                                         if ($fConf["conf_select_icons"] && $t=="select")        {
01193                                                 $icon = ', t3lib_extMgm::extRelPath("'.$extKey.'")."'."selicon_".$id."_".$a.".gif".'"';
01194                                                                                 // Add wizard icon
01195                                                 $this->addFileToFileArray("selicon_".$id."_".$a.".gif",t3lib_div::getUrl(t3lib_extMgm::extPath("kickstarter")."res/wiz.gif"));
01196                                         } else $icon="";
01197 //                                      $cItems[]='Array("'.str_replace("\\'","'",addslashes($this->getSplitLabels($fConf,"conf_select_item_".$a))).'", "'.addslashes($val).'"'.$icon.'),';
01198                                         $cItems[]='Array("'.addslashes($this->getSplitLabels_reference($fConf,"conf_select_item_".$a,$table.".".$fConf["fieldname"].".I.".$a)).'", "'.addslashes($val).'"'.$icon.'),';
01199                                 }
01200                                 $configL[]=trim($this->wrapBody('
01201                                         '.$this->WOPcomment('WOP:'.$WOP.'[conf_select_items]').'
01202                                         "items" => Array (
01203                                                 ',implode(chr(10),$cItems),'
01204                                         ),
01205                                 '));
01206                                 if ($fConf['conf_select_pro'] && $t=='select')  {
01207                                         $cN = $this->returnName($extKey,'class',$id);
01208                                         $configL[]='"itemsProcFunc" => "'.$cN.'->main", '.$this->WOPcomment('WOP:'.$WOP.'[conf_select_pro]');
01209 
01210                                         $classContent= $this->sPS('
01211                                                 class '.$cN.' {
01212                                                         function main(&$params,&$pObj)  {
01213 /*                                                              debug("Hello World!",1);
01214                                                                 debug("\$params:",1);
01215                                                                 debug($params);
01216                                                                 debug("\$pObj:",1);
01217                                                                 debug($pObj);
01218         */
01219                                                                         // Adding an item!
01220                                                                 $params["items"][]=Array($pObj->sL("Added label by PHP function|Tilfřjet Dansk tekst med PHP funktion"), 999);
01221 
01222                                                                 // No return - the $params and $pObj variables are passed by reference, so just change content in then and it is passed back automatically...
01223                                                         }
01224                                                 }
01225                                         ');
01226 
01227                                         $this->addFileToFileArray('class.'.$cN.'.php',$this->PHPclassFile($extKey,'class.'.$cN.'.php',$classContent,'Class/Function which manipulates the item-array for table/field '.$id.'.'));
01228 
01229                                         $this->wizard->ext_tables[]=$this->sPS('
01230                                                 '.$this->WOPcomment('WOP:'.$WOP.'[conf_select_pro]:').'
01231                                                 if (TYPO3_MODE=="BE")   include_once(t3lib_extMgm::extPath("'.$extKey.'")."'.'class.'.$cN.'.php");
01232                                         ');
01233                                 }
01234 
01235                                 $numberOfRelations = t3lib_div::intInRange($fConf["conf_relations"],1,100);
01236                                 if ($t=="select")       {
01237                                         $configL[]='"size" => '.t3lib_div::intInRange($fConf["conf_relations_selsize"],1,100).',        '.$this->WOPcomment('WOP:'.$WOP.'[conf_relations_selsize]');
01238                                         $configL[]='"maxitems" => '.$numberOfRelations.',       '.$this->WOPcomment('WOP:'.$WOP.'[conf_relations]');
01239                                 }
01240 
01241                                 if ($numberOfRelations>1 && $t=="select")       {
01242                                         if ($numberOfRelations*4 < 256) {
01243                                                 $DBfields[] = $fConf["fieldname"]." varchar(".($numberOfRelations*4).") DEFAULT '' NOT NULL,";
01244                                         } else {
01245                                                 $DBfields[] = $fConf["fieldname"]." text NOT NULL,";
01246                                         }
01247                                 } elseif ($notIntVal)   {
01248                                         $varCharLn = t3lib_div::intInRange(max($len),1);
01249                                         $DBfields[] = $fConf["fieldname"]." ".($varCharLn>$this->wizard->charMaxLng?'var':'')."char(".$varCharLn.") DEFAULT '' NOT NULL,";
01250                                 } else {
01251                                         $DBfields[] = $fConf["fieldname"].' int(11) DEFAULT \'0\' NOT NULL,';
01252                                 }
01253                         break;
01254                         case "rel":
01255                                 if ($fConf["conf_rel_type"]=="group")   {
01256                                         $configL[]='"type" => "group",  '.$this->WOPcomment('WOP:'.$WOP.'[conf_rel_type]');
01257                                         $configL[]='"internal_type" => "db",    '.$this->WOPcomment('WOP:'.$WOP.'[conf_rel_type]');
01258                                 } else {
01259                                         $configL[]='"type" => "select", '.$this->WOPcomment('WOP:'.$WOP.'[conf_rel_type]');
01260                                 }
01261 
01262                                 if ($fConf["conf_rel_type"]!="group" && $fConf["conf_relations"]==1 && $fConf["conf_rel_dummyitem"])    {
01263                                         $configL[]=trim($this->wrapBody('
01264                                                 '.$this->WOPcomment('WOP:'.$WOP.'[conf_rel_dummyitem]').'
01265                                                 "items" => Array (
01266                                                         ','Array("",0),','
01267                                                 ),
01268                                         '));
01269                                 }
01270 
01271                                 if (t3lib_div::inList("tt_content,fe_users,fe_groups",$fConf["conf_rel_table"]))                $this->wizard->EM_CONF_presets["dependencies"][]="cms";
01272 
01273                                 if ($fConf["conf_rel_table"]=="_CUSTOM")        {
01274                                         $fConf["conf_rel_table"]=$fConf["conf_custom_table_name"]?$fConf["conf_custom_table_name"]:"NO_TABLE_NAME_AVAILABLE";
01275                                 }
01276 
01277                                 if ($fConf["conf_rel_type"]=="group")   {
01278                                         $configL[]='"allowed" => "'.($fConf["conf_rel_table"]!="_ALL"?$fConf["conf_rel_table"]:"*").'", '.$this->WOPcomment('WOP:'.$WOP.'[conf_rel_table]');
01279                                         if ($fConf["conf_rel_table"]=="_ALL")   $configL[]='"prepend_tname" => 1,       '.$this->WOPcomment('WOP:'.$WOP.'[conf_rel_table]=_ALL');
01280                                 } else {
01281                                         switch($fConf["conf_rel_type"]) {
01282                                                 case "select_cur":
01283                                                         $where="AND ".$fConf["conf_rel_table"].".pid=###CURRENT_PID### ";
01284                                                 break;
01285                                                 case "select_root":
01286                                                         $where="AND ".$fConf["conf_rel_table"].".pid=###SITEROOT### ";
01287                                                 break;
01288                                                 case "select_storage":
01289                                                         $where="AND ".$fConf["conf_rel_table"].".pid=###STORAGE_PID### ";
01290                                                 break;
01291                                                 default:
01292                                                         $where="";
01293                                                 break;
01294                                         }
01295                                         $configL[]='"foreign_table" => "'.$fConf["conf_rel_table"].'",  '.$this->WOPcomment('WOP:'.$WOP.'[conf_rel_table]');
01296                                         $configL[]='"foreign_table_where" => "'.$where.'ORDER BY '.$fConf["conf_rel_table"].'.uid",     '.$this->WOPcomment('WOP:'.$WOP.'[conf_rel_type]');
01297                                 }
01298                                 $configL[]='"size" => '.t3lib_div::intInRange($fConf["conf_relations_selsize"],1,100).',        '.$this->WOPcomment('WOP:'.$WOP.'[conf_relations_selsize]');
01299                                 $configL[]='"minitems" => 0,';
01300                                 $configL[]='"maxitems" => '.t3lib_div::intInRange($fConf["conf_relations"],1,100).',    '.$this->WOPcomment('WOP:'.$WOP.'[conf_relations]');
01301 
01302                                 if ($fConf["conf_relations_mm"])        {
01303                                         $mmTableName=$id."_mm";
01304                                         $configL[]='"MM" => "'.$mmTableName.'", '.$this->WOPcomment('WOP:'.$WOP.'[conf_relations_mm]');
01305                                         $DBfields[] = $fConf["fieldname"].' int(11) DEFAULT \'0\' NOT NULL,';
01306 
01307                                         $createTable = $this->sPS("
01308                                                 #
01309                                                 # Table structure for table '".$mmTableName."'
01310                                                 # ".$this->WOPcomment('WOP:'.$WOP.'[conf_relations_mm]')."
01311                                                 #
01312                                                 CREATE TABLE ".$mmTableName." (
01313                                                   uid_local int(11) DEFAULT '0' NOT NULL,
01314                                                   uid_foreign int(11) DEFAULT '0' NOT NULL,
01315                                                   tablenames varchar(30) DEFAULT '' NOT NULL,
01316                                                   sorting int(11) DEFAULT '0' NOT NULL,
01317                                                   KEY uid_local (uid_local),
01318                                                   KEY uid_foreign (uid_foreign)
01319                                                 );
01320                                         ");
01321                                         $this->wizard->ext_tables_sql[]=chr(10).$createTable.chr(10);
01322                                 } elseif (t3lib_div::intInRange($fConf["conf_relations"],1,100)>1 || $fConf["conf_rel_type"]=="group") {
01323                                         $DBfields[] = $fConf["fieldname"]." blob NOT NULL,";
01324                                 } else {
01325                                         $DBfields[] = $fConf["fieldname"].' int(11) DEFAULT \'0\' NOT NULL,';
01326                                 }
01327 
01328                                 if ($fConf["conf_rel_type"]!="group")   {
01329                                         $wTable=$fConf["conf_rel_table"];
01330                                         $wizards =array();
01331                                         if ($fConf["conf_wiz_addrec"])  {
01332                                                 $wizards[] = trim($this->sPS('
01333                                                         '.$this->WOPcomment('WOP:'.$WOP.'[conf_wiz_addrec]').'
01334                                                         "add" => Array(
01335                                                                 "type" => "script",
01336                                                                 "title" => "Create new record",
01337                                                                 "icon" => "add.gif",
01338                                                                 "params" => Array(
01339                                                                         "table"=>"'.$wTable.'",
01340                                                                         "pid" => "###CURRENT_PID###",
01341                                                                         "setValue" => "prepend"
01342                                                                 ),
01343                                                                 "script" => "wizard_add.php",
01344                                                         ),
01345                                                 '));
01346                                         }
01347                                         if ($fConf["conf_wiz_listrec"]) {
01348                                                 $wizards[] = trim($this->sPS('
01349                                                         '.$this->WOPcomment('WOP:'.$WOP.'[conf_wiz_listrec]').'
01350                                                         "list" => Array(
01351                                                                 "type" => "script",
01352                                                                 "title" => "List",
01353                                                                 "icon" => "list.gif",
01354                                                                 "params" => Array(
01355                                                                         "table"=>"'.$wTable.'",
01356                                                                         "pid" => "###CURRENT_PID###",
01357                                                                 ),
01358                                                                 "script" => "wizard_list.php",
01359                                                         ),
01360                                                 '));
01361                                         }
01362                                         if ($fConf["conf_wiz_editrec"]) {
01363                                                 $wizards[] = trim($this->sPS('
01364                                                         '.$this->WOPcomment('WOP:'.$WOP.'[conf_wiz_editrec]').'
01365                                                         "edit" => Array(
01366                                                                 "type" => "popup",
01367                                                                 "title" => "Edit",
01368                                                                 "script" => "wizard_edit.php",
01369                                                                 "popup_onlyOpenIfSelected" => 1,
01370                                                                 "icon" => "edit2.gif",
01371                                                                 "JSopenParams" => "height=350,width=580,status=0,menubar=0,scrollbars=1",
01372                                                         ),
01373                                                 '));
01374                                         }
01375                                         if (count($wizards))    {
01376                                                 $configL[]=trim($this->wrapBody('
01377                                                         "wizards" => Array(
01378                                                                 "_PADDING" => 2,
01379                                                                 "_VERTICAL" => 1,
01380                                                                 ',implode(chr(10),$wizards),'
01381                                                         ),
01382                                                 '));
01383                                         }
01384                                 }
01385                         break;
01386                         case "files":
01387                                 $configL[]='"type" => "group",';
01388                                 $configL[]='"internal_type" => "file",';
01389                                 switch($fConf["conf_files_type"])       {
01390                                         case "images":
01391                                                 $configL[]='"allowed" => $GLOBALS["TYPO3_CONF_VARS"]["GFX"]["imagefile_ext"],   '.$this->WOPcomment('WOP:'.$WOP.'[conf_files_type]');
01392                                         break;
01393                                         case "webimages":
01394                                                 $configL[]='"allowed" => "gif,png,jpeg,jpg",    '.$this->WOPcomment('WOP:'.$WOP.'[conf_files_type]');
01395                                         break;
01396                                         case "all":
01397                                                 $configL[]='"allowed" => "",    '.$this->WOPcomment('WOP:'.$WOP.'[conf_files_type]');
01398                                                 $configL[]='"disallowed" => "php,php3", '.$this->WOPcomment('WOP:'.$WOP.'[conf_files_type]');
01399                                         break;
01400                                 }
01401                                 $configL[]='"max_size" => '.t3lib_div::intInRange($fConf["conf_max_filesize"],1,1000,500).',    '.$this->WOPcomment('WOP:'.$WOP.'[conf_max_filesize]');
01402 
01403                                 $this->wizard->EM_CONF_presets["uploadfolder"]=1;
01404 
01405                                 $ulFolder = 'uploads/tx_'.str_replace("_","",$extKey);
01406                                 $configL[]='"uploadfolder" => "'.$ulFolder.'",';
01407                                 if ($fConf["conf_files_thumbs"])        $configL[]='"show_thumbs" => 1, '.$this->WOPcomment('WOP:'.$WOP.'[conf_files_thumbs]');
01408 
01409                                 $configL[]='"size" => '.t3lib_div::intInRange($fConf["conf_files_selsize"],1,100).',    '.$this->WOPcomment('WOP:'.$WOP.'[conf_files_selsize]');
01410                                 $configL[]='"minitems" => 0,';
01411                                 $configL[]='"maxitems" => '.t3lib_div::intInRange($fConf["conf_files"],1,100).',        '.$this->WOPcomment('WOP:'.$WOP.'[conf_files]');
01412 
01413                                 $DBfields[] = $fConf["fieldname"]." blob NOT NULL,";
01414                         break;
01415                         case "none":
01416                                 $DBfields[] = $fConf["fieldname"]." tinytext NOT NULL,";
01417                                 $configL[]=trim($this->sPS('
01418                                         "type" => "none",
01419                                 '));
01420                         break;
01421                         case "passthrough":
01422                                 $DBfields[] = $fConf["fieldname"]." tinytext NOT NULL,";
01423                                 $configL[]=trim($this->sPS('
01424                                         "type" => "passthrough",
01425                                 '));
01426                         break;
01427                         default:
01428                                 debug("Unknown type: ".(string)$fConf["type"]);
01429                         break;
01430                 }
01431 
01432                 if ($t=="passthrough")  {
01433                         $columns[$fConf["fieldname"]] = trim($this->wrapBody('
01434                                 "'.$fConf["fieldname"].'" => Array (            '.$this->WOPcomment('WOP:'.$WOP.'[fieldname]').'
01435                                         "config" => Array (
01436                                                 ',implode(chr(10),$configL),'
01437                                         )
01438                                 ),
01439                         ',2));
01440                 } else {
01441                         $columns[$fConf["fieldname"]] = trim($this->wrapBody('
01442                                 "'.$fConf["fieldname"].'" => Array (            '.$this->WOPcomment('WOP:'.$WOP.'[fieldname]').'
01443                                         "exclude" => '.($fConf["excludeField"]?1:0).',          '.$this->WOPcomment('WOP:'.$WOP.'[excludeField]').'
01444                                         "label" => "'.addslashes($this->getSplitLabels_reference($fConf,"title",$table.".".$fConf["fieldname"])).'",            '.$this->WOPcomment('WOP:'.$WOP.'[title]').'
01445                                         "config" => Array (
01446                                                 ',implode(chr(10),$configL),'
01447                                         )
01448                                 ),
01449                         ',2));
01450                 }
01451         }
01452         function ulFolder($eKey)        {
01453                 return "uploads/tx_".str_replace("_","",$eKey)."/";
01454         }
01455 
01456 
01457 }
01458 
01459 // Include ux_class extension?
01460 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/kickstarter/sections/class.tx_kickstarter_section_fields.php']) {
01461         include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/kickstarter/sections/class.tx_kickstarter_section_fields.php']);
01462 }
01463 
01464 
01465 ?>


Généré par Les experts TYPO3 avec  doxygen 1.4.6