Documentation TYPO3 par Ameos

class.tx_kickstarter_compilefiles.php

00001 <?php
00002 /***************************************************************
00003 *  Copyright notice
00004 *
00005 *  (c) 2001-2004 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 ***************************************************************/
00034 class tx_kickstarter_compilefiles {
00035 
00036                 // Internal:
00037         var $fileArray=array();
00038         var $ext_tables=array();
00039         var $ext_tca=array();
00040         var $ext_tables_sql=array();
00041         var $ext_localconf=array();
00042         var $ext_locallang=array();
00043         var $ext_locallang_db=array();
00044 
00045         var $extKey="";
00046 
00047         var $charMaxLng = 2;    // Varchars are created instead of chars when over this length.
00048 
00049 
00050         function makeFilesArray($extKey)        {
00051 
00052                 $this->ext_localconf=array();
00053                 $this->ext_tables=array();
00054                 $this->fileArray=array();
00055 
00056                         // TSconfig?
00057                 if (is_array($this->wizArray["TSconfig"]))      {
00058                         $content = current($this->wizArray["TSconfig"]);
00059                                 // Page TSconfig:
00060                         if (trim($content["page_TSconfig"]))    {
00061                                 $this->ext_localconf[]=trim($this->wrapBody("
00062                                         t3lib_extMgm::addPageTSConfig('
00063                                         ",trim($this->slashValueForSingleDashes($content["page_TSconfig"])),"
00064                                         ');
00065                                 "));
00066                         }
00067                                 // User TSconfig:
00068                         if (trim($content["user_TSconfig"]))    {
00069                                 $this->ext_localconf[]=trim($this->wrapBody("
00070                                         t3lib_extMgm::addUserTSConfig('
00071                                         ",trim($this->slashValueForSingleDashes($content["user_TSconfig"])),"
00072                                         ');
00073                                 "));
00074                         }
00075                 }
00076 
00077                         // TypoScript
00078                 if (is_array($this->wizArray["ts"]))    {
00079                         $content = current($this->wizArray["ts"]);
00080                                 // Page TSconfig:
00081                         if (trim($content["constants"]))        {
00082                                 $this->addFileToFileArray("ext_typoscript_constants.txt",$content["constants"],1);
00083                                 $this->EM_CONF_presets["clearCacheOnLoad"]=1;
00084                         }
00085                                 // User TSconfig:
00086                         if (trim($content["setup"]))    {
00087                                 $this->addFileToFileArray("ext_typoscript_setup.txt",$content["setup"],1);
00088                                 $this->EM_CONF_presets["clearCacheOnLoad"]=1;
00089 #debug(array($this->fileArray["ext_typoscript_setup.txt"]));
00090                         }
00091                 }
00092 
00093                 if (is_array($this->wizArray["module"]))        {
00094                         reset($this->wizArray["module"]);
00095                         while(list($k,$config)=each($this->wizArray["module"])) {
00096                                 $this->renderExtPart_module($k,$config,$extKey);
00097                         }
00098                 }
00099 
00100                 if (is_array($this->wizArray["moduleFunction"]))        {
00101                         reset($this->wizArray["moduleFunction"]);
00102                         while(list($k,$config)=each($this->wizArray["moduleFunction"])) {
00103                                 $this->renderExtPart_moduleFunction($k,$config,$extKey);
00104                         }
00105                 }
00106 
00107                 if (is_array($this->wizArray["cm"]))    {
00108                         reset($this->wizArray["cm"]);
00109                         while(list($k,$config)=each($this->wizArray["cm"]))     {
00110                                 $this->renderExtPart_cm($k,$config,$extKey);
00111                         }
00112                 }
00113 
00114                 // This should be BEFORE PI.
00115                 if (is_array($this->wizArray["fields"]))        {
00116                         reset($this->wizArray["fields"]);
00117                         while(list($k,$config)=each($this->wizArray["fields"])) {
00118                                 $this->renderExtPart_fields($k,$config,$extKey);
00119                                 $this->EM_CONF_presets["modify_tables"][]=$config["which_table"];
00120                         }
00121                 }
00122 
00123                 if (is_array($this->wizArray["tables"]))        {
00124                         reset($this->wizArray["tables"]);
00125                         while(list($k,$config)=each($this->wizArray["tables"])) {
00126                                 $this->renderExtPart_tables($k,$config,$extKey);
00127                         }
00128                 }
00129 
00130                 if (is_array($this->wizArray["pi"]))    {
00131                         reset($this->wizArray["pi"]);
00132                         while(list($k,$config)=each($this->wizArray["pi"]))     {
00133                                 $this->renderExtPart_PI($k,$config,$extKey);
00134                                 $this->EM_CONF_presets["clearCacheOnLoad"]=1;
00135                         }
00136                         $this->EM_CONF_presets["dependencies"][]="cms";
00137                 }
00138 
00139                 if (is_array($this->wizArray["sv"]))    {
00140                         reset($this->wizArray["sv"]);
00141                         while(list($k,$config)=each($this->wizArray["sv"]))     {
00142                                 $this->renderExtPart_SV($k,$config,$extKey);
00143                                 $this->EM_CONF_presets["clearCacheOnLoad"]=1;
00144                         }
00145                 }
00146 
00147                 // Write the ext_localconf.php file:
00148                 if (count($this->ext_localconf))        {
00149                         $this->addFileToFileArray("ext_localconf.php",trim($this->wrapBody('
00150                                 <?php
00151                                 if (!defined ("TYPO3_MODE"))    die ("Access denied.");
00152                                         ',
00153                                 implode(chr(10),$this->ext_localconf),
00154                                 '?>
00155                         ',0)));
00156                 }
00157                 // Write the ext_tables.php file:
00158                 if (count($this->ext_tables))   {
00159                         $this->addFileToFileArray("ext_tables.php",trim($this->wrapBody('
00160                                 <?php
00161                                 if (!defined ("TYPO3_MODE"))    die ("Access denied.");
00162 
00163                                 ',implode(chr(10),$this->ext_tables),'
00164                                 ?>
00165                         ',0)));
00166                 }
00167                 // Write the tca.php file:
00168                 if (count($this->ext_tca))      {
00169                         $this->addFileToFileArray("tca.php",trim($this->wrapBody('
00170                                 <?php
00171                                 if (!defined ("TYPO3_MODE"))    die ("Access denied.");
00172 
00173                                 ',implode(chr(10),$this->ext_tca),'
00174                                 ?>
00175                         ',0)));
00176                 }
00177                 // Write the ext_tables.sql file:
00178                 if (count($this->ext_tables_sql))       {
00179                         $this->addFileToFileArray("ext_tables.sql",trim($this->sPS(implode(chr(10),$this->ext_tables_sql))));
00180                 }
00181                 // Local lang file:
00182                 if (count($this->ext_locallang))        {
00183                         $this->addLocalLangFile($this->ext_locallang,"locallang.php",'Language labels for extension "'.$extKey.'"');
00184                 }
00185                 // Local lang DB file:
00186                 if (count($this->ext_locallang_db))     {
00187                         $this->addLocalLangFile($this->ext_locallang_db,"locallang_db.php",'Language labels for database tables/fields belonging to extension "'.$extKey.'"');
00188                 }
00189 
00190                 // The form used to generate the extension:
00191                 $this->dontPrintImages = 1;
00192                 $this->addFileToFileArray("doc/wizard_form.html",trim($this->sPS('
00193                         <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
00194 
00195                         <html>
00196                         <head>
00197                                 <title>Untitled</title>
00198                         </head>
00199 
00200                         <body>
00201 
00202                                 '.$this->totalForm().'
00203                         </body>
00204                         </html>
00205                 ')));
00206                 $this->addFileToFileArray("doc/wizard_form.dat",serialize($this->wizArray));
00207 
00208                         // icon:
00209                 $this->addFileToFileArray("ext_icon.gif",t3lib_div::getUrl(t3lib_extMgm::extPath("kickstarter")."res/notfound.gif"));
00210 
00211 
00212 #               debug($this->wizArray);
00213 #               debug ($this->fileArray);
00214 #               return $dataArr;
00215         }
00216 
00217 
00218         function addLocalLangFile($arr,$filename,$description)  {
00219                 $lines=array();
00220                 reset($arr);
00221                 $lines[]='<?php';
00222                 $lines[]=trim($this->sPS('
00228                 '));
00229                 $lines[]='';
00230                 $lines[]='$LOCAL_LANG = Array (';
00231                 while(list($lK,$labels)=each($arr))     {
00232                         if (is_array($labels))  {
00233                                 $lines[]='      "'.$lK.'" => Array (';
00234                                 while(list($l,$v)=each($labels))        {
00235                                         if (strcmp($v[0],""))   $lines[]='              "'.$l.'" => "'.addslashes($v[0]).'",    '.$this->WOPcomment($v[1]);
00236                                 }
00237                                 $lines[]='      ),';
00238                         }
00239                 }
00240                 $lines[]=');';
00241                 $lines[]='?>';
00242                 $this->addFileToFileArray($filename,implode(chr(10),$lines));
00243         }
00244 
00248         function renderExtPart_fields($k,$config,$extKey)       {
00249                 $WOP="[fields][".$k."]";
00250                 $tableName=$config["which_table"];
00251         #       $tableName = $this->returnName($extKey,"fields",$tableName);
00252 #               $prefix = "tx_".str_replace("_","",$extKey)."_";
00253                 $prefix = $this->returnName($extKey,"fields")."_";
00254 
00255                 $DBfields=array();
00256                 $columns=array();
00257                 $ctrl=array();
00258                 $enFields=array();
00259 
00260                 if (is_array($config["fields"]))        {
00261                         reset($config["fields"]);
00262                         while(list($i,$fConf)=each($config["fields"]))  {
00263                                 $fConf["fieldname"] = $prefix.$fConf["fieldname"];
00264                                 $this->makeFieldTCA($DBfields,$columns,$fConf,$WOP."[fields][".$i."]",$tableName,$extKey);
00265                         }
00266                 }
00267 
00268                 if ($tableName=="tt_address")   $this->EM_CONF_presets["dependencies"][]="tt_address";
00269                 if ($tableName=="tt_news")      $this->EM_CONF_presets["dependencies"][]="tt_news";
00270                 if (t3lib_div::inList("tt_content,fe_users,fe_groups",$tableName))      $this->EM_CONF_presets["dependencies"][]="cms";
00271 
00272                 $createTable = $this->wrapBody('
00273                         #
00274                         # Table structure for table \''.$tableName.'\'
00275                         #
00276                         CREATE TABLE '.$tableName.' (
00277                 ', ereg_replace(",[[:space:]]*$","",implode(chr(10),$DBfields)), '
00278 
00279                         );
00280                 ');
00281                 $this->ext_tables_sql[]=chr(10).$createTable.chr(10);
00282 
00283 
00284                         // Finalize ext_tables.php:
00285                 $this->ext_tables[]=$this->wrapBody('
00286                         $tempColumns = Array (
00287                                 ', implode(chr(10),$columns)    ,'
00288                         );
00289                 ');
00290 
00291 
00292                 list($typeList) = $this->implodeColumns($columns);
00293                 $applyToAll=1;
00294                 if (is_array($this->wizArray["pi"]))    {
00295                         reset($this->wizArray["pi"]);
00296                         while(list(,$fC)=each($this->wizArray["pi"]))   {
00297                                 if ($fC["apply_extended"]==$k)  {
00298                                         $applyToAll=0;
00299                                         $this->_apply_extended_types[$k]=$typeList;
00300                                 }
00301                         }
00302                 }
00303                 $this->ext_tables[]=$this->sPS('
00304                         t3lib_div::loadTCA("'.$tableName.'");
00305                         t3lib_extMgm::addTCAcolumns("'.$tableName.'",$tempColumns,1);
00306                         '.($applyToAll?'t3lib_extMgm::addToAllTCAtypes("'.$tableName.'","'.$typeList.'");':'').'
00307                 ');
00308         }
00309 
00313         function renderExtPart_tables($k,$config,$extKey)       {
00314                 $WOP="[tables][".$k."]";
00315                 $tableName=$config["tablename"];
00316                 $tableName = $this->returnName($extKey,"tables",$tableName);
00317 
00318                 $DBfields=array();
00319                 $columns=array();
00320                 $ctrl=array();
00321                 $enFields=array();
00322 
00323 //str_replace("\\'","'",addslashes($this->getSplitLabels($config,"title")))
00324                 $ctrl[] = trim($this->sPS('
00325                         "title" => "'.$this->getSplitLabels_reference($config,"title",$tableName).'",           '.$this->WOPcomment('WOP:'.$WOP.'[title]').'
00326                         "label" => "'.($config["header_field"]?$config["header_field"]:"uid").'",       '.$this->WOPcomment('WOP:'.$WOP.'[header_field]').'
00327                         "tstamp" => "tstamp",
00328                         "crdate" => "crdate",
00329                         "cruser_id" => "cruser_id",
00330                 ',0));
00331                 $DBfields[] = trim($this->sPS("
00332                         uid int(11) DEFAULT '0' NOT NULL auto_increment,
00333                         pid int(11) DEFAULT '0' NOT NULL,
00334                         tstamp int(11) unsigned DEFAULT '0' NOT NULL,
00335                         crdate int(11) unsigned DEFAULT '0' NOT NULL,
00336                         cruser_id int(11) unsigned DEFAULT '0' NOT NULL,
00337                 ",0));
00338 
00339                 if ($config["type_field"])      {
00340                         $ctrl[] = '"type" => "'.$config["type_field"].'",       '.$this->WOPcomment('WOP:'.$WOP.'[type_field]');
00341                 }
00342                 if ($config["versioning"])      {
00343                         $ctrl[] = '"versioning" => "1", '.$this->WOPcomment('WOP:'.$WOP.'[versioning]');
00344                         $DBfields[] = "t3ver_oid int(11) unsigned DEFAULT '0' NOT NULL,";
00345                         $DBfields[] = "t3ver_id int(11) unsigned DEFAULT '0' NOT NULL,";
00346                         $DBfields[] = "t3ver_label varchar(30) DEFAULT '' NOT NULL,";
00347                 }
00348                 if ($config["localization"])    {
00349                         $ctrl[] = '"languageField" => "sys_language_uid",       '.$this->WOPcomment('WOP:'.$WOP.'[localization]');
00350                         $ctrl[] = '"transOrigPointerField" => "l18n_parent",    '.$this->WOPcomment('WOP:'.$WOP.'[localization]');
00351                         $ctrl[] = '"transOrigDiffSourceField" => "l18n_diffsource",     '.$this->WOPcomment('WOP:'.$WOP.'[localization]');
00352 
00353                         $DBfields[] = "sys_language_uid int(11) DEFAULT '0' NOT NULL,";
00354                         $DBfields[] = "l18n_parent int(11) DEFAULT '0' NOT NULL,";
00355                         $DBfields[] = "l18n_diffsource mediumblob NOT NULL,";
00356 
00357                         $columns["sys_language_uid"] = trim($this->sPS("
00358                                 'sys_language_uid' => Array (           ".$this->WOPcomment('WOP:'.$WOP.'[localization]')."
00359                                         'exclude' => 1,
00360                                         'label' => 'LLL:EXT:lang/locallang_general.php:LGL.language',
00361                                         'config' => Array (
00362                                                 'type' => 'select',
00363                                                 'foreign_table' => 'sys_language',
00364                                                 'foreign_table_where' => 'ORDER BY sys_language.title',
00365                                                 'items' => Array(
00366                                                         Array('LLL:EXT:lang/locallang_general.php:LGL.allLanguages',-1),
00367                                                         Array('LLL:EXT:lang/locallang_general.php:LGL.default_value',0)
00368                                                 )
00369                                         )
00370                                 ),
00371                         "));
00372 
00373                         $columns["l18n_parent"] = trim($this->sPS("
00374                                 'l18n_parent' => Array (                ".$this->WOPcomment('WOP:'.$WOP.'[localization]')."
00375                                         'displayCond' => 'FIELD:sys_language_uid:>:0',
00376                                         'exclude' => 1,
00377                                         'label' => 'LLL:EXT:lang/locallang_general.php:LGL.l18n_parent',
00378                                         'config' => Array (
00379                                                 'type' => 'select',
00380                                                 'items' => Array (
00381                                                         Array('', 0),
00382                                                 ),
00383                                                 'foreign_table' => '".$tableName."',
00384                                                 'foreign_table_where' => 'AND ".$tableName.".pid=###CURRENT_PID### AND ".$tableName.".sys_language_uid IN (-1,0)',
00385                                         )
00386                                 ),
00387                         "));
00388 
00389                         $columns["l18n_diffsource"] = trim($this->sPS("
00390                                 'l18n_diffsource' => Array (            ".$this->WOPcomment('WOP:'.$WOP.'[localization]')."
00391                                         'config' => Array (
00392                                                 'type' => 'passthrough'
00393                                         )
00394                                 ),
00395                         "));
00396                 }
00397                 if ($config["sorting"]) {
00398                         $ctrl[] = '"sortby" => "sorting",       '.$this->WOPcomment('WOP:'.$WOP.'[sorting]');
00399                         $DBfields[] = "sorting int(10) unsigned DEFAULT '0' NOT NULL,";
00400                 } else {
00401                         $ctrl[] = '"default_sortby" => "ORDER BY '.trim($config["sorting_field"].' '.($config["sorting_desc"]?"DESC":"")).'",   '.$this->WOPcomment('WOP:'.$WOP.'[sorting] / '.$WOP.'[sorting_field] / '.$WOP.'[sorting_desc]');
00402                 }
00403                 if ($config["add_deleted"])     {
00404                         $ctrl[] = '"delete" => "deleted",       '.$this->WOPcomment('WOP:'.$WOP.'[add_deleted]');
00405                         $DBfields[] = "deleted tinyint(4) unsigned DEFAULT '0' NOT NULL,";
00406                 }
00407                 if ($config["add_hidden"])      {
00408                         $enFields[] = '"disabled" => "hidden",  '.$this->WOPcomment('WOP:'.$WOP.'[add_hidden]');
00409                         $DBfields[] = "hidden tinyint(4) unsigned DEFAULT '0' NOT NULL,";
00410                         $columns["hidden"] = trim($this->sPS('
00411                                 "hidden" => Array (             '.$this->WOPcomment('WOP:'.$WOP.'[add_hidden]').'
00412                                         "exclude" => 1,
00413                                         "label" => "LLL:EXT:lang/locallang_general.php:LGL.hidden",
00414                                         "config" => Array (
00415                                                 "type" => "check",
00416                                                 "default" => "0"
00417                                         )
00418                                 ),
00419                         '));
00420                 }
00421                 if ($config["add_starttime"])   {
00422                         $enFields[] = '"starttime" => "starttime",      '.$this->WOPcomment('WOP:'.$WOP.'[add_starttime]');
00423                         $DBfields[] = "starttime int(11) unsigned DEFAULT '0' NOT NULL,";
00424                         $columns["starttime"] = trim($this->sPS('
00425                                 "starttime" => Array (          '.$this->WOPcomment('WOP:'.$WOP.'[add_starttime]').'
00426                                         "exclude" => 1,
00427                                         "label" => "LLL:EXT:lang/locallang_general.php:LGL.starttime",
00428                                         "config" => Array (
00429                                                 "type" => "input",
00430                                                 "size" => "8",
00431                                                 "max" => "20",
00432                                                 "eval" => "date",
00433                                                 "default" => "0",
00434                                                 "checkbox" => "0"
00435                                         )
00436                                 ),
00437                         '));
00438                 }
00439                 if ($config["add_endtime"])     {
00440                         $enFields[] = '"endtime" => "endtime",  '.$this->WOPcomment('WOP:'.$WOP.'[add_endtime]');
00441                         $DBfields[] = "endtime int(11) unsigned DEFAULT '0' NOT NULL,";
00442                         $columns["endtime"] = trim($this->sPS('
00443                                 "endtime" => Array (            '.$this->WOPcomment('WOP:'.$WOP.'[add_endtime]').'
00444                                         "exclude" => 1,
00445                                         "label" => "LLL:EXT:lang/locallang_general.php:LGL.endtime",
00446                                         "config" => Array (
00447                                                 "type" => "input",
00448                                                 "size" => "8",
00449                                                 "max" => "20",
00450                                                 "eval" => "date",
00451                                                 "checkbox" => "0",
00452                                                 "default" => "0",
00453                                                 "range" => Array (
00454                                                         "upper" => mktime(0,0,0,12,31,2020),
00455                                                         "lower" => mktime(0,0,0,date("m")-1,date("d"),date("Y"))
00456                                                 )
00457                                         )
00458                                 ),
00459                         '));
00460                 }
00461                 if ($config["add_access"])      {
00462                         $enFields[] = '"fe_group" => "fe_group",        '.$this->WOPcomment('WOP:'.$WOP.'[add_access]');
00463                         $DBfields[] = "fe_group int(11) DEFAULT '0' NOT NULL,";
00464                         $columns["fe_group"] = trim($this->sPS('
00465                                 "fe_group" => Array (           '.$this->WOPcomment('WOP:'.$WOP.'[add_access]').'
00466                                         "exclude" => 1,
00467                                         "label" => "LLL:EXT:lang/locallang_general.php:LGL.fe_group",
00468                                         "config" => Array (
00469                                                 "type" => "select",
00470                                                 "items" => Array (
00471                                                         Array("", 0),
00472                                                         Array("LLL:EXT:lang/locallang_general.php:LGL.hide_at_login", -1),
00473                                                         Array("LLL:EXT:lang/locallang_general.php:LGL.any_login", -2),
00474                                                         Array("LLL:EXT:lang/locallang_general.php:LGL.usergroups", "--div--")
00475                                                 ),
00476                                                 "foreign_table" => "fe_groups"
00477                                         )
00478                                 ),
00479                         '));
00480                 }
00481                         // Add enable fields in header:
00482                 if (is_array($enFields) && count($enFields))    {
00483                         $ctrl[]=trim($this->wrapBody('
00484                                 "enablecolumns" => Array (              '.$this->WOPcomment('WOP:'.$WOP.'[add_hidden] / '.$WOP.'[add_starttime] / '.$WOP.'[add_endtime] / '.$WOP.'[add_access]').'
00485                                 ',implode(chr(10),$enFields),'
00486                                 ),
00487                         '));
00488                 }
00489                         // Add dynamic config file.
00490                 $ctrl[]= '"dynamicConfigFile" => t3lib_extMgm::extPath($_EXTKEY)."tca.php",';
00491                 $ctrl[]= '"iconfile" => t3lib_extMgm::extRelPath($_EXTKEY)."icon_'.$tableName.'.gif",';
00492 
00493                 if ($config["allow_on_pages"])  {
00494                         $this->ext_tables[]=$this->sPS('
00495                                 '.$this->WOPcomment('WOP:'.$WOP.'[allow_on_pages]').'
00496                                 t3lib_extMgm::allowTableOnStandardPages("'.$tableName.'");
00497                         ');
00498                 }
00499                 if ($config["allow_ce_insert_records"]) {
00500                         $this->ext_tables[]=$this->sPS('
00501                                 '.$this->WOPcomment('WOP:'.$WOP.'[allow_ce_insert_records]').'
00502                                 t3lib_extMgm::addToInsertRecords("'.$tableName.'");
00503                         ');
00504                 }
00505                 if ($config["save_and_new"])    {
00506                         $this->ext_localconf[]=trim($this->wrapBody("
00507                                 t3lib_extMgm::addUserTSConfig('
00508                                         ","options.saveDocNew.".$tableName."=1","
00509                                 ');
00510                         "));
00511                 }
00512 
00513                 if (is_array($config["fields"]))        {
00514                         reset($config["fields"]);
00515                         while(list($i,$fConf)=each($config["fields"]))  {
00516                                 $this->makeFieldTCA($DBfields,$columns,$fConf,$WOP."[fields][".$i."]",$tableName,$extKey);
00517                         }
00518                 }
00519 
00520 
00521 
00522                         // Finalize tables.sql:
00523                 $DBfields[]=$this->sPS('
00524                         PRIMARY KEY (uid),
00525                         KEY parent (pid)
00526                 ');
00527                 $createTable = $this->wrapBody('
00528                         #
00529                         # Table structure for table \''.$tableName.'\'
00530                         #
00531                         CREATE TABLE '.$tableName.' (
00532                 ', implode(chr(10),$DBfields), '
00533                         );
00534                 ');
00535                 $this->ext_tables_sql[]=chr(10).$createTable.chr(10);
00536 
00537                         // Finalize tca.php:
00538                 $tca_file="";
00539                 list($typeList,$palList) = $this->implodeColumns($columns);
00540                 $tca_file.=$this->wrapBody('
00541                         $TCA["'.$tableName.'"] = Array (
00542                                 "ctrl" => $TCA["'.$tableName.'"]["ctrl"],
00543                                 "interface" => Array (
00544                                         "showRecordFieldList" => "'.implode(",",array_keys($columns)).'"
00545                                 ),
00546                                 "feInterface" => $TCA["'.$tableName.'"]["feInterface"],
00547                                 "columns" => Array (
00548                         ', trim(implode(chr(10),$columns))      ,'
00549                                 ),
00550                                 "types" => Array (
00551                                         "0" => Array("showitem" => "'.$typeList.'")
00552                                 ),
00553                                 "palettes" => Array (
00554                                         "1" => Array("showitem" => "'.$palList.'")
00555                                 )
00556                         );
00557                 ',2);
00558                 $this->ext_tca[]=chr(10).$tca_file.chr(10);
00559 
00560                         // Finalize ext_tables.php:
00561                 $this->ext_tables[]=$this->wrapBody('
00562                         $TCA["'.$tableName.'"] = Array (
00563                                 "ctrl" => Array (
00564                         ', implode(chr(10),$ctrl)       ,'
00565                                 ),
00566                                 "feInterface" => Array (
00567                                         "fe_admin_fieldList" => "'.implode(", ",array_keys($columns)).'",
00568                                 )
00569                         );
00570                 ',2);
00571 
00572 
00573                                 // Add wizard icon
00574                         $this->addFileToFileArray($pathSuffix."icon_".$tableName.".gif",t3lib_div::getUrl(t3lib_extMgm::extPath("kickstarter")."res/".$config["defIcon"]));
00575 
00576         }
00577 
00578         function implodeColumns($columns)       {
00579                 reset($columns);
00580                 $outems=array();
00581                 $paltems=array();
00582                 $c=0;
00583                 $hiddenFlag=0;
00584                 $titleDivFlag=0;
00585                 while(list($fN)=each($columns)) {
00586                         if (!$hiddenFlag || !t3lib_div::inList("starttime,endtime,fe_group",$fN))       {
00587                                 $outTem = array($fN,"","","","");
00588                                 $outTem[3] = $this->_typeP[$fN];
00589                                 if ($c==0)      $outTem[4]="1-1-1";
00590                                 if ($fN=="title")       {
00591                                         $outTem[4]="2-2-2";
00592                                         $titleDivFlag=1;
00593                                 } elseif ($titleDivFlag)        {
00594                                         $outTem[4]="3-3-3";
00595                                         $titleDivFlag=0;
00596                                 }
00597                                 if ($fN=="hidden")      {
00598                                         $outTem[2]="1";
00599                                         $hiddenFlag=1;
00600                                 }
00601                                 $outems[] = str_replace(",","",str_replace(chr(9),";",trim(str_replace(";","",implode(chr(9),$outTem)))));
00602                                 $c++;
00603                         } else {
00604                                 $paltems[]=$fN;
00605                         }
00606                 }
00607                 return array(implode(", ",$outems),implode(", ",$paltems));
00608         }
00609         function makeFieldTCA(&$DBfields,&$columns,$fConf,$WOP,$table,$extKey)  {
00610                 if (!(string)$fConf["type"])    return;
00611                 $id = $table."_".$fConf["fieldname"];
00612 #debug($fConf);
00613 
00614                 $configL=array();
00615                 $t = (string)$fConf["type"];
00616                 switch($t)      {
00617                         case "input":
00618                         case "input+":
00619                                 $isString =1;
00620                                 $configL[]='"type" => "input",  '.$this->WOPcomment('WOP:'.$WOP.'[type]');
00621                                 $configL[]='"size" => "'.t3lib_div::intInRange($fConf["conf_size"],5,48,30).'", '.$this->WOPcomment('WOP:'.$WOP.'[conf_size]');
00622                                 if (intval($fConf["conf_max"])) $configL[]='"max" => "'.t3lib_div::intInRange($fConf["conf_max"],1,255).'",     '.$this->WOPcomment('WOP:'.$WOP.'[conf_max]');
00623 
00624                                 $evalItems=array();
00625                                 if ($fConf["conf_required"])    {$evalItems[0][] = "required";                  $evalItems[1][] = $WOP.'[conf_required]';}
00626 
00627                                 if ($t=="input+")       {
00628                                         $isString = !$fConf["conf_eval"] || t3lib_div::inList("alphanum,upper,lower",$fConf["conf_eval"]);
00629                                         if ($fConf["conf_varchar"] && $isString)                {$evalItems[0][] = "trim";                      $evalItems[1][] = $WOP.'[conf_varchar]';}
00630                                         if ($fConf["conf_eval"]=="int+")        {
00631                                                 $configL[]='"range" => Array ("lower"=>0,"upper"=>1000),        '.$this->WOPcomment('WOP:'.$WOP.'[conf_eval] = int+ results in a range setting');
00632                                                 $fConf["conf_eval"]="int";
00633                                         }
00634                                         if ($fConf["conf_eval"])                {$evalItems[0][] = $fConf["conf_eval"];                 $evalItems[1][] = $WOP.'[conf_eval]';}
00635                                         if ($fConf["conf_check"])       $configL[]='"checkbox" => "'.($isString?"":"0").'",     '.$this->WOPcomment('WOP:'.$WOP.'[conf_check]');
00636 
00637                                         if ($fConf["conf_stripspace"])          {$evalItems[0][] = "nospace";                   $evalItems[1][] = $WOP.'[conf_stripspace]';}
00638                                         if ($fConf["conf_pass"])                {$evalItems[0][] = "password";                  $evalItems[1][] = $WOP.'[conf_pass]';}
00639                                         if ($fConf["conf_unique"])      {
00640                                                 if ($fConf["conf_unique"]=="L")         {$evalItems[0][] = "uniqueInPid";                       $evalItems[1][] = $WOP.'[conf_unique] = Local (unique in this page (PID))';}
00641                                                 if ($fConf["conf_unique"]=="G")         {$evalItems[0][] = "unique";                    $evalItems[1][] = $WOP.'[conf_unique] = Global (unique in whole database)';}
00642                                         }
00643 
00644                                         $wizards =array();
00645                                         if ($fConf["conf_wiz_color"])   {
00646                                                 $wizards[] = trim($this->sPS('
00647                                                         '.$this->WOPcomment('WOP:'.$WOP.'[conf_wiz_color]').'
00648                                                         "color" => Array(
00649                                                                 "title" => "Color:",
00650                                                                 "type" => "colorbox",
00651                                                                 "dim" => "12x12",
00652                                                                 "tableStyle" => "border:solid 1px black;",
00653                                                                 "script" => "wizard_colorpicker.php",
00654                                                                 "JSopenParams" => "height=300,width=250,status=0,menubar=0,scrollbars=1",
00655                                                         ),
00656                                                 '));
00657                                         }
00658                                         if ($fConf["conf_wiz_link"])    {
00659                                                 $wizards[] = trim($this->sPS('
00660                                                         '.$this->WOPcomment('WOP:'.$WOP.'[conf_wiz_link]').'
00661                                                         "link" => Array(
00662                                                                 "type" => "popup",
00663                                                                 "title" => "Link",
00664                                                                 "icon" => "link_popup.gif",
00665                                                                 "script" => "browse_links.php?mode=wizard",
00666                                                                 "JSopenParams" => "height=300,width=500,status=0,menubar=0,scrollbars=1"
00667                                                         ),
00668                                                 '));
00669                                         }
00670                                         if (count($wizards))    {
00671                                                 $configL[]=trim($this->wrapBody('
00672                                                         "wizards" => Array(
00673                                                                 "_PADDING" => 2,
00674                                                                 ',implode(chr(10),$wizards),'
00675                                                         ),
00676                                                 '));
00677                                         }
00678                                 } else {
00679                                         if ($fConf["conf_varchar"])             {$evalItems[0][] = "trim";                      $evalItems[1][] = $WOP.'[conf_varchar]';}
00680                                 }
00681 
00682                                 if (count($evalItems))  $configL[]='"eval" => "'.implode(",",$evalItems[0]).'", '.$this->WOPcomment('WOP:'.implode(" / ",$evalItems[1]));
00683 
00684                                 if (!$isString) {
00685                                         $DBfields[] = $fConf["fieldname"]." int(11) DEFAULT '0' NOT NULL,";
00686                                 } elseif (!$fConf["conf_varchar"])              {
00687                                         $DBfields[] = $fConf["fieldname"]." tinytext NOT NULL,";
00688                                 } else {
00689                                         $varCharLn = (intval($fConf["conf_max"])?t3lib_div::intInRange($fConf["conf_max"],1,255):255);
00690                                         $DBfields[] = $fConf["fieldname"]." ".($varCharLn>$this->charMaxLng?'var':'')."char(".$varCharLn.") DEFAULT '' NOT NULL,";
00691                                 }
00692                         break;
00693                         case "link":
00694                                 $DBfields[] = $fConf["fieldname"]." tinytext NOT NULL,";
00695                                 $configL[]=trim($this->sPS('
00696                                         "type" => "input",
00697                                         "size" => "15",
00698                                         "max" => "255",
00699                                         "checkbox" => "",
00700                                         "eval" => "trim",
00701                                         "wizards" => Array(
00702                                                 "_PADDING" => 2,
00703                                                 "link" => Array(
00704                                                         "type" => "popup",
00705                                                         "title" => "Link",
00706                                                         "icon" => "link_popup.gif",
00707                                                         "script" => "browse_links.php?mode=wizard",
00708                                                         "JSopenParams" => "height=300,width=500,status=0,menubar=0,scrollbars=1"
00709                                                 )
00710                                         )
00711                                 '));
00712                         break;
00713                         case "datetime":
00714                         case "date":
00715                                 $DBfields[] = $fConf["fieldname"]." int(11) DEFAULT '0' NOT NULL,";
00716                                 $configL[]=trim($this->sPS('
00717                                         "type" => "input",
00718                                         "size" => "'.($t=="datetime"?12:8).'",
00719                                         "max" => "20",
00720                                         "eval" => "'.$t.'",
00721                                         "checkbox" => "0",
00722                                         "default" => "0"
00723                                 '));
00724                         break;
00725                         case "integer":
00726                                 $DBfields[] = $fConf["fieldname"]." int(11) DEFAULT '0' NOT NULL,";
00727                                 $configL[]=trim($this->sPS('
00728                                         "type" => "input",
00729                                         "size" => "4",
00730                                         "max" => "4",
00731                                         "eval" => "int",
00732                                         "checkbox" => "0",
00733                                         "range" => Array (
00734                                                 "upper" => "1000",
00735                                                 "lower" => "10"
00736                                         ),
00737                                         "default" => 0
00738                                 '));
00739                         break;
00740                         case "textarea":
00741                         case "textarea_nowrap":
00742                                 $DBfields[] = $fConf["fieldname"]." text NOT NULL,";
00743                                 $configL[]='"type" => "text",';
00744                                 if ($t=="textarea_nowrap")      {
00745                                         $configL[]='"wrap" => "OFF",';
00746                                 }
00747                                 $configL[]='"cols" => "'.t3lib_div::intInRange($fConf["conf_cols"],5,48,30).'", '.$this->WOPcomment('WOP:'.$WOP.'[conf_cols]');
00748                                 $configL[]='"rows" => "'.t3lib_div::intInRange($fConf["conf_rows"],1,20,5).'",  '.$this->WOPcomment('WOP:'.$WOP.'[conf_rows]');
00749                                 if ($fConf["conf_wiz_example"]) {
00750                                         $wizards =array();
00751                                         $wizards[] = trim($this->sPS('
00752                                                 '.$this->WOPcomment('WOP:'.$WOP.'[conf_wiz_example]').'
00753                                                 "example" => Array(
00754                                                         "title" => "Example Wizard:",
00755                                                         "type" => "script",
00756                                                         "notNewRecords" => 1,
00757                                                         "icon" => t3lib_extMgm::extRelPath("'.$extKey.'")."'.$id.'/wizard_icon.gif",
00758                                                         "script" => t3lib_extMgm::extRelPath("'.$extKey.'")."'.$id.'/index.php",
00759                                                 ),
00760                                         '));
00761 
00762                                         $cN = $this->returnName($extKey,"class",$id."wiz");
00763                                         $this->writeStandardBE_xMod(
00764                                                 $extKey,
00765                                                 array("title"=>"Example Wizard title..."),
00766                                                 $id.'/',
00767                                                 $cN,
00768                                                 0,
00769                                                 $id."wiz"
00770                                         );
00771                                         $this->addFileToFileArray($id."/wizard_icon.gif",t3lib_div::getUrl(t3lib_extMgm::extPath("kickstarter")."res/notfound.gif"));
00772 
00773                                         $configL[]=trim($this->wrapBody('
00774                                                 "wizards" => Array(
00775                                                         "_PADDING" => 2,
00776                                                         ',implode(chr(10),$wizards),'
00777                                                 ),
00778                                         '));
00779                                 }
00780                         break;
00781                         case "textarea_rte":
00782                                 $DBfields[] = $fConf["fieldname"]." text NOT NULL,";
00783                                 $configL[]='"type" => "text",';
00784                                 $configL[]='"cols" => "30",';
00785                                 $configL[]='"rows" => "5",';
00786                                 if ($fConf["conf_rte_fullscreen"])      {
00787                                         $wizards =array();
00788                                         $wizards[] = trim($this->sPS('
00789                                                 '.$this->WOPcomment('WOP:'.$WOP.'[conf_rte_fullscreen]').'
00790                                                 "RTE" => Array(
00791                                                         "notNewRecords" => 1,
00792                                                         "RTEonly" => 1,
00793                                                         "type" => "script",
00794                                                         "title" => "Full screen Rich Text Editing|Formatteret redigering i hele vinduet",
00795                                                         "icon" => "wizard_rte2.gif",
00796                                                         "script" => "wizard_rte.php",
00797                                                 ),
00798                                         '));
00799                                         $configL[]=trim($this->wrapBody('
00800                                                 "wizards" => Array(
00801                                                         "_PADDING" => 2,
00802                                                         ',implode(chr(10),$wizards),'
00803                                                 ),
00804                                         '));
00805                                 }
00806 
00807                                 $rteImageDir = "";
00808                                 if ($fConf["conf_rte_separateStorageForImages"] && t3lib_div::inList("moderate,basic,custom",$fConf["conf_rte"]))       {
00809                                         $this->EM_CONF_presets["createDirs"][]=$this->ulFolder($extKey)."rte/";
00810                                         $rteImageDir = "|imgpath=".$this->ulFolder($extKey)."rte/";
00811                                 }
00812 
00813                                 $transformation="ts_images-ts_reglinks";
00814                                 if ($fConf["conf_mode_cssOrNot"] && t3lib_div::inList("moderate,custom",$fConf["conf_rte"]))    {
00815                                         $transformation="ts_css";
00816                                 }
00817 
00818 
00819                                 switch($fConf["conf_rte"])      {
00820                                         case "tt_content":
00821                                                 $typeP = 'richtext[paste|bold|italic|underline|formatblock|class|left|center|right|orderedlist|unorderedlist|outdent|indent|link|image]:rte_transform[mode=ts]';
00822                                         break;
00823                                         case "moderate":
00824                                                 $typeP = 'richtext[*]:rte_transform[mode='.$transformation.''.$rteImageDir.']';
00825                                         break;
00826                                         case "basic":
00827                                                 $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.']';
00828                                                 $this->ext_localconf[]=trim($this->wrapBody("
00829                                                                 t3lib_extMgm::addPageTSConfig('
00830 
00831                                                                         # ***************************************************************************************
00832                                                                         # CONFIGURATION of RTE in table \"".$table."\", field \"".$fConf["fieldname"]."\"
00833                                                                         # ***************************************************************************************
00834 
00835                                                                         ",trim($this->slashValueForSingleDashes(str_replace(chr(9),"  ",$this->sPS("
00836                                                                                 RTE.config.".$table.".".$fConf["fieldname"]." {
00837                                                                                         hidePStyleItems = H1, H4, H5, H6
00838                                                                                         proc.exitHTMLparser_db=1
00839                                                                                         proc.exitHTMLparser_db {
00840                                                                                                 keepNonMatchedTags=1
00841                                                                                                 tags.font.allowedAttribs= color
00842                                                                                                 tags.font.rmTagIfNoAttrib = 1
00843                                                                                                 tags.font.nesting = global
00844                                                                                         }
00845                                                                                 }
00846                                                                         ")))),"
00847                                                                 ');
00848                                                 ",0));
00849                                         break;
00850                                         case "none":
00851                                                 $typeP = 'richtext[*]';
00852                                         break;
00853                                         case "custom":
00854                                                 $enabledButtons=array();
00855                                                 $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");
00856                                                 $HTMLparser=array();
00857                                                 $fontAllowedAttrib=array();
00858                                                 $allowedTags_WOP = array();
00859                                                 $allowedTags=array();
00860                                                 while(list(,$lI)=each($traverseList))   {
00861                                                         $nothingDone=0;
00862                                                         if ($fConf["conf_rte_b_".$lI])  {
00863                                                                 $enabledButtons[]=$lI;
00864                                                                 switch($lI)     {
00865                                                                         case "formatblock":
00866                                                                         case "left":
00867                                                                         case "center":
00868                                                                         case "right":
00869                                                                                 $allowedTags[]="div";
00870                                                                                 $allowedTags[]="p";
00871                                                                         break;
00872                                                                         case "class":
00873                                                                                 $allowedTags[]="span";
00874                                                                         break;
00875                                                                         case "fontstyle":
00876                                                                                 $allowedTags[]="font";
00877                                                                                 $fontAllowedAttrib[]="face";
00878                                                                         break;
00879                                                                         case "fontsize":
00880                                                                                 $allowedTags[]="font";
00881                                                                                 $fontAllowedAttrib[]="size";
00882                                                                         break;
00883                                                                         case "textcolor":
00884                                                                                 $allowedTags[]="font";
00885                                                                                 $fontAllowedAttrib[]="color";
00886                                                                         break;
00887                                                                         case "bold":
00888                                                                                 $allowedTags[]="b";
00889                                                                                 $allowedTags[]="strong";
00890                                                                         break;
00891                                                                         case "italic":
00892                                                                                 $allowedTags[]="i";
00893                                                                                 $allowedTags[]="em";
00894                                                                         break;
00895                                                                         case "underline":
00896                                                                                 $allowedTags[]="u";
00897                                                                         break;
00898                                                                         case "orderedlist":
00899                                                                                 $allowedTags[]="ol";
00900                                                                                 $allowedTags[]="li";
00901                                                                         break;
00902                                                                         case "unorderedlist":
00903                                                                                 $allowedTags[]="ul";
00904                                                                                 $allowedTags[]="li";
00905                                                                         break;
00906                                                                         case "outdent":
00907                                                                         case "indent":
00908                                                                                 $allowedTags[]="blockquote";
00909                                                                         break;
00910                                                                         case "link":
00911                                                                                 $allowedTags[]="a";
00912                                                                         break;
00913                                                                         case "table":
00914                                                                                 $allowedTags[]="table";
00915                                                                                 $allowedTags[]="tr";
00916                                                                                 $allowedTags[]="td";
00917                                                                         break;
00918                                                                         case "image":
00919                                                                                 $allowedTags[]="img";
00920                                                                         break;
00921                                                                         case "line":
00922                                                                                 $allowedTags[]="hr";
00923                                                                         break;
00924                                                                         default:
00925                                                                                 $nothingDone=1;
00926                                                                         break;
00927                                                                 }
00928                                                                 if (!$nothingDone)      $allowedTags_WOP[] = $WOP.'[conf_rte_b_'.$lI.']';
00929                                                         }
00930                                                 }
00931                                                 if (count($fontAllowedAttrib))  {
00932                                                         $HTMLparser[]="tags.font.allowedAttribs = ".implode(",",$fontAllowedAttrib);
00933                                                         $HTMLparser[]="tags.font.rmTagIfNoAttrib = 1";
00934                                                         $HTMLparser[]="tags.font.nesting = global";
00935                                                 }
00936                                                 if (count($enabledButtons))     {
00937                                                         $typeP = 'richtext['.implode("|",$enabledButtons).']:rte_transform[mode='.$transformation.''.$rteImageDir.']';
00938                                                 }
00939 
00940                                                 $rte_colors=array();
00941                                                 $setupUpColors=array();
00942                                                 for ($a=1;$a<=3;$a++)   {
00943                                                         if ($fConf["conf_rte_color".$a])        {
00944                                                                 $rte_colors[$id.'_color'.$a]=trim($this->sPS('
00945                                                                         '.$this->WOPcomment('WOP:'.$WOP.'[conf_rte_color'.$a.']').'
00946                                                                         '.$id.'_color'.$a.' {
00947                                                                                 name = Color '.$a.'
00948                                                                                 value = '.$fConf["conf_rte_color".$a].'
00949                                                                         }
00950                                                                 '));
00951                                                                 $setupUpColors[]=trim($fConf["conf_rte_color".$a]);
00952                                                         }
00953                                                 }
00954 
00955                                                 $rte_classes=array();
00956                                                 for ($a=1;$a<=6;$a++)   {
00957                                                         if ($fConf["conf_rte_class".$a])        {
00958                                                                 $rte_classes[$id.'_class'.$a]=trim($this->sPS('
00959                                                                         '.$this->WOPcomment('WOP:'.$WOP.'[conf_rte_class'.$a.']').'
00960                                                                         '.$id.'_class'.$a.' {
00961                                                                                 name = '.$fConf["conf_rte_class".$a].'
00962                                                                                 value = '.$fConf["conf_rte_class".$a."_style"].'
00963                                                                         }
00964                                                                 '));
00965                                                         }
00966                                                 }
00967 
00968                                                 $PageTSconfig= Array();
00969                                                 if ($fConf["conf_rte_removecolorpicker"])       {
00970                                                         $PageTSconfig[]="       ".$this->WOPcomment('WOP:'.$WOP.'[conf_rte_removecolorpicker]');
00971                                                         $PageTSconfig[]="disableColorPicker = 1";
00972                                                 }
00973                                                 if (count($rte_classes))        {
00974                                                         $PageTSconfig[]="       ".$this->WOPcomment('WOP:'.$WOP.'[conf_rte_class*]');
00975                                                         $PageTSconfig[]="classesParagraph = ".implode(", ",array_keys($rte_classes));
00976                                                         $PageTSconfig[]="classesCharacter = ".implode(", ",array_keys($rte_classes));
00977                                                         if (in_array("p",$allowedTags) || in_array("div",$allowedTags)) {
00978                                                                 $HTMLparser[]=" ".$this->WOPcomment('WOP:'.$WOP.'[conf_rte_class*]');
00979                                                                 if (in_array("p",$allowedTags)) {$HTMLparser[]="p.fixAttrib.class.list = ,".implode(",",array_keys($rte_classes));}
00980                                                                 if (in_array("div",$allowedTags))       {$HTMLparser[]="div.fixAttrib.class.list = ,".implode(",",array_keys($rte_classes));}
00981                                                         }
00982                                                 }
00983                                                 if (count($rte_colors))         {
00984                                                         $PageTSconfig[]="       ".$this->WOPcomment('WOP:'.$WOP.'[conf_rte_color*]');
00985                                                         $PageTSconfig[]="colors = ".implode(", ",array_keys($rte_colors));
00986 
00987                                                         if (in_array("color",$fontAllowedAttrib) && $fConf["conf_rte_removecolorpicker"])       {
00988                                                                 $HTMLparser[]=" ".$this->WOPcomment('WOP:'.$WOP.'[conf_rte_removecolorpicker]');
00989                                                                 $HTMLparser[]="tags.font.fixAttrib.color.list = ,".implode(",",$setupUpColors);
00990                                                                 $HTMLparser[]="tags.font.fixAttrib.color.removeIfFalse = 1";
00991                                                         }
00992                                                 }
00993                                                 if (!strcmp($fConf["conf_rte_removePdefaults"],1))      {
00994                                                         $PageTSconfig[]="       ".$this->WOPcomment('WOP:'.$WOP.'[conf_rte_removePdefaults]');
00995                                                         $PageTSconfig[]="hidePStyleItems = H1, H2, H3, H4, H5, H6, PRE";
00996                                                 } elseif ($fConf["conf_rte_removePdefaults"]=="H2H3")   {
00997                                                         $PageTSconfig[]="       ".$this->WOPcomment('WOP:'.$WOP.'[conf_rte_removePdefaults]');
00998                                                         $PageTSconfig[]="hidePStyleItems = H1, H4, H5, H6";
00999                                                 } else {
01000                                                         $allowedTags[]="h1";
01001                                                         $allowedTags[]="h2";
01002                                                         $allowedTags[]="h3";
01003                                                         $allowedTags[]="h4";
01004                                                         $allowedTags[]="h5";
01005                                                         $allowedTags[]="h6";
01006                                                         $allowedTags[]="pre";
01007                                                 }
01008 
01009 
01010                                                 $allowedTags = array_unique($allowedTags);
01011                                                 if (count($allowedTags))        {
01012                                                         $HTMLparser[]=" ".$this->WOPcomment('WOP:'.implode(" / ",$allowedTags_WOP));
01013                                                         $HTMLparser[]='allowTags = '.implode(", ",$allowedTags);
01014                                                 }
01015                                                 if ($fConf["conf_rte_div_to_p"])        {
01016                                                         $HTMLparser[]=" ".$this->WOPcomment('WOP:'.$WOP.'[conf_rte_div_to_p]');
01017                                                         $HTMLparser[]='tags.div.remap = P';
01018                                                 }
01019                                                 if (count($HTMLparser)) {
01020                                                         $PageTSconfig[]=trim($this->wrapBody('
01021                                                                 proc.exitHTMLparser_db=1
01022                                                                 proc.exitHTMLparser_db {
01023                                                                         ',implode(chr(10),$HTMLparser),'
01024                                                                 }
01025                                                         '));
01026                                                 }
01027 
01028                                                 $finalPageTSconfig=array();
01029                                                 if (count($rte_colors))         {
01030                                                         $finalPageTSconfig[]=trim($this->wrapBody('
01031                                                                 RTE.colors {
01032                                                                 ',implode(chr(10),$rte_colors),'
01033                                                                 }
01034                                                         '));
01035                                                 }
01036                                                 if (count($rte_classes))                {
01037                                                         $finalPageTSconfig[]=trim($this->wrapBody('
01038                                                                 RTE.classes {
01039                                                                 ',implode(chr(10),$rte_classes),'
01040                                                                 }
01041                                                         '));
01042                                                 }
01043                                                 if (count($PageTSconfig))               {
01044                                                         $finalPageTSconfig[]=trim($this->wrapBody('
01045                                                                 RTE.config.'.$table.'.'.$fConf["fieldname"].' {
01046                                                                 ',implode(chr(10),$PageTSconfig),'
01047                                                                 }
01048                                                         '));
01049                                                 }
01050                                                 if (count($finalPageTSconfig))  {
01051                                                         $this->ext_localconf[]=trim($this->wrapBody("
01052                                                                 t3lib_extMgm::addPageTSConfig('
01053 
01054                                                                         # ***************************************************************************************
01055                                                                         # CONFIGURATION of RTE in table \"".$table."\", field \"".$fConf["fieldname"]."\"
01056                                                                         # ***************************************************************************************
01057 
01058                                                                 ",trim($this->slashValueForSingleDashes(str_replace(chr(9),"  ",implode(chr(10).chr(10),$finalPageTSconfig)))),"
01059                                                                 ');
01060                                                         ",0));
01061                                                 }
01062                                         break;
01063                                 }
01064                                 $this->_typeP[$fConf["fieldname"]]      = $typeP;
01065                         break;
01066                         case "check":
01067                         case "check_4":
01068                         case "check_10":
01069                                 $configL[]='"type" => "check",';
01070                                 if ($t=="check")        {
01071                                         $DBfields[] = $fConf["fieldname"]." tinyint(3) unsigned DEFAULT '0' NOT NULL,";
01072                                         if ($fConf["conf_check_default"])       $configL[]='"default" => 1,     '.$this->WOPcomment('WOP:'.$WOP.'[conf_check_default]');
01073                                 } else {
01074                                         $DBfields[] = $fConf["fieldname"]." int(11) unsigned DEFAULT '0' NOT NULL,";
01075                                 }
01076                                 if ($t=="check_4" || $t=="check_10")    {
01077                                         $configL[]='"cols" => 4,';
01078                                         $cItems=array();
01079 #                                       $aMax = ($t=="check_4"?4:10);
01080                                         $aMax = intval($fConf["conf_numberBoxes"]);
01081                                         for($a=0;$a<$aMax;$a++) {
01082 //                                              $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...').'", ""),';
01083                                                 $cItems[]='Array("'.addslashes($this->getSplitLabels_reference($fConf,"conf_boxLabel_".$a,$table.".".$fConf["fieldname"].".I.".$a)).'", ""),';
01084                                         }
01085                                         $configL[]=trim($this->wrapBody('
01086                                                 "items" => Array (
01087                                                         ',implode(chr(10),$cItems),'
01088                                                 ),
01089                                         '));
01090                                 }
01091                         break;
01092                         case "radio":
01093                         case "select":
01094                                 $configL[]='"type" => "'.($t=="select"?"select":"radio").'",';
01095                                 $notIntVal=0;
01096                                 $len=array();
01097                                 for($a=0;$a<t3lib_div::intInRange($fConf["conf_select_items"],1,20);$a++)       {
01098                                         $val = $fConf["conf_select_itemvalue_".$a];
01099                                         $notIntVal+= t3lib_div::testInt($val)?0:1;
01100                                         $len[]=strlen($val);
01101                                         if ($fConf["conf_select_icons"] && $t=="select")        {
01102                                                 $icon = ', t3lib_extMgm::extRelPath("'.$extKey.'")."'."selicon_".$id."_".$a.".gif".'"';
01103                                                                                 // Add wizard icon
01104                                                 $this->addFileToFileArray("selicon_".$id."_".$a.".gif",t3lib_div::getUrl(t3lib_extMgm::extPath("kickstarter")."res/wiz.gif"));
01105                                         } else $icon="";
01106 //                                      $cItems[]='Array("'.str_replace("\\'","'",addslashes($this->getSplitLabels($fConf,"conf_select_item_".$a))).'", "'.addslashes($val).'"'.$icon.'),';
01107                                         $cItems[]='Array("'.addslashes($this->getSplitLabels_reference($fConf,"conf_select_item_".$a,$table.".".$fConf["fieldname"].".I.".$a)).'", "'.addslashes($val).'"'.$icon.'),';
01108                                 }
01109                                 $configL[]=trim($this->wrapBody('
01110                                         '.$this->WOPcomment('WOP:'.$WOP.'[conf_select_items]').'
01111                                         "items" => Array (
01112                                                 ',implode(chr(10),$cItems),'
01113                                         ),
01114                                 '));
01115                                 if ($fConf["conf_select_pro"] && $t=="select")  {
01116                                         $cN = $this->returnName($extKey,"class",$id);
01117                                         $configL[]='"itemsProcFunc" => "'.$cN.'->main", '.$this->WOPcomment('WOP:'.$WOP.'[conf_select_pro]');
01118 
01119                                         $classContent= $this->sPS('
01120                                                 class '.$cN.' {
01121                                                         function main(&$params,&$pObj)  {
01122 /*                                                              debug("Hello World!",1);
01123                                                                 debug("\$params:",1);
01124                                                                 debug($params);
01125                                                                 debug("\$pObj:",1);
01126                                                                 debug($pObj);
01127         */
01128                                                                         // Adding an item!
01129                                                                 $params["items"][]=Array($pObj->sL("Added label by PHP function|Tilføjet Dansk tekst med PHP funktion"), 999);
01130 
01131                                                                 // No return - the $params and $pObj variables are passed by reference, so just change content in then and it is passed back automatically...
01132                                                         }
01133                                                 }
01134                                         ');
01135 
01136                                         $this->addFileToFileArray("class.".$cN.".php",$this->PHPclassFile($extKey,"class.".$cN.".php",$classContent,"Class/Function which manipulates the item-array for table/field ".$id."."));
01137 
01138                                         $this->ext_tables[]=$this->sPS('
01139                                                 '.$this->WOPcomment('WOP:'.$WOP.'[conf_select_pro]:').'
01140                                                 if (TYPO3_MODE=="BE")   include_once(t3lib_extMgm::extPath("'.$extKey.'")."'.'class.'.$cN.'.php");
01141                                         ');
01142                                 }
01143 
01144                                 $numberOfRelations = t3lib_div::intInRange($fConf["conf_relations"],1,100);
01145                                 if ($t=="select")       {
01146                                         $configL[]='"size" => '.t3lib_div::intInRange($fConf["conf_relations_selsize"],1,100).',        '.$this->WOPcomment('WOP:'.$WOP.'[conf_relations_selsize]');
01147                                         $configL[]='"maxitems" => '.$numberOfRelations.',       '.$this->WOPcomment('WOP:'.$WOP.'[conf_relations]');
01148                                 }
01149 
01150                                 if ($numberOfRelations>1 && $t=="select")       {
01151                                         if ($numberOfRelations*4 < 256) {
01152                                                 $DBfields[] = $fConf["fieldname"]." varchar(".($numberOfRelations*4).") DEFAULT '' NOT NULL,";
01153                                         } else {
01154                                                 $DBfields[] = $fConf["fieldname"]." text NOT NULL,";
01155                                         }
01156                                 } elseif ($notIntVal)   {
01157                                         $varCharLn = t3lib_div::intInRange(max($len),1);
01158                                         $DBfields[] = $fConf["fieldname"]." ".($varCharLn>$this->charMaxLng?'var':'')."char(".$varCharLn.") DEFAULT '' NOT NULL,";
01159                                 } else {
01160                                         $DBfields[] = $fConf["fieldname"]." int(11) unsigned DEFAULT '0' NOT NULL,";
01161                                 }
01162                         break;
01163                         case "rel":
01164                                 if ($fConf["conf_rel_type"]=="group")   {
01165                                         $configL[]='"type" => "group",  '.$this->WOPcomment('WOP:'.$WOP.'[conf_rel_type]');
01166                                         $configL[]='"internal_type" => "db",    '.$this->WOPcomment('WOP:'.$WOP.'[conf_rel_type]');
01167                                 } else {
01168                                         $configL[]='"type" => "select", '.$this->WOPcomment('WOP:'.$WOP.'[conf_rel_type]');
01169                                 }
01170 
01171                                 if ($fConf["conf_rel_type"]!="group" && $fConf["conf_relations"]==1 && $fConf["conf_rel_dummyitem"])    {
01172                                         $configL[]=trim($this->wrapBody('
01173                                                 '.$this->WOPcomment('WOP:'.$WOP.'[conf_rel_dummyitem]').'
01174                                                 "items" => Array (
01175                                                         ','Array("",0),','
01176                                                 ),
01177                                         '));
01178                                 }
01179 
01180                                 if (t3lib_div::inList("tt_content,fe_users,fe_groups",$fConf["conf_rel_table"]))                $this->EM_CONF_presets["dependencies"][]="cms";
01181 
01182                                 if ($fConf["conf_rel_table"]=="_CUSTOM")        {
01183                                         $fConf["conf_rel_table"]=$fConf["conf_custom_table_name"]?$fConf["conf_custom_table_name"]:"NO_TABLE_NAME_AVAILABLE";
01184                                 }
01185 
01186                                 if ($fConf["conf_rel_type"]=="group")   {
01187                                         $configL[]='"allowed" => "'.($fConf["conf_rel_table"]!="_ALL"?$fConf["conf_rel_table"]:"*").'", '.$this->WOPcomment('WOP:'.$WOP.'[conf_rel_table]');
01188                                         if ($fConf["conf_rel_table"]=="_ALL")   $configL[]='"prepend_tname" => 1,       '.$this->WOPcomment('WOP:'.$WOP.'[conf_rel_table]=_ALL');
01189                                 } else {
01190                                         switch($fConf["conf_rel_type"]) {
01191                                                 case "select_cur":
01192                                                         $where="AND ".$fConf["conf_rel_table"].".pid=###CURRENT_PID### ";
01193                                                 break;
01194                                                 case "select_root":
01195                                                         $where="AND ".$fConf["conf_rel_table"].".pid=###SITEROOT### ";
01196                                                 break;
01197                                                 case "select_storage":
01198                                                         $where="AND ".$fConf["conf_rel_table"].".pid=###STORAGE_PID### ";
01199                                                 break;
01200                                                 default:
01201                                                         $where="";
01202                                                 break;
01203                                         }
01204                                         $configL[]='"foreign_table" => "'.$fConf["conf_rel_table"].'",  '.$this->WOPcomment('WOP:'.$WOP.'[conf_rel_table]');
01205                                         $configL[]='"foreign_table_where" => "'.$where.'ORDER BY '.$fConf["conf_rel_table"].'.uid",     '.$this->WOPcomment('WOP:'.$WOP.'[conf_rel_type]');
01206                                 }
01207                                 $configL[]='"size" => '.t3lib_div::intInRange($fConf["conf_relations_selsize"],1,100).',        '.$this->WOPcomment('WOP:'.$WOP.'[conf_relations_selsize]');
01208                                 $configL[]='"minitems" => 0,';
01209                                 $configL[]='"maxitems" => '.t3lib_div::intInRange($fConf["conf_relations"],1,100).',    '.$this->WOPcomment('WOP:'.$WOP.'[conf_relations]');
01210 
01211                                 if ($fConf["conf_relations_mm"])        {
01212                                         $mmTableName=$id."_mm";
01213                                         $configL[]='"MM" => "'.$mmTableName.'", '.$this->WOPcomment('WOP:'.$WOP.'[conf_relations_mm]');
01214                                         $DBfields[] = $fConf["fieldname"]." int(11) unsigned DEFAULT '0' NOT NULL,";
01215 
01216                                         $createTable = $this->sPS("
01217                                                 #
01218                                                 # Table structure for table '".$mmTableName."'
01219                                                 # ".$this->WOPcomment('WOP:'.$WOP.'[conf_relations_mm]')."
01220                                                 #
01221                                                 CREATE TABLE ".$mmTableName." (
01222                                                   uid_local int(11) unsigned DEFAULT '0' NOT NULL,
01223                                                   uid_foreign int(11) unsigned DEFAULT '0' NOT NULL,
01224                                                   tablenames varchar(30) DEFAULT '' NOT NULL,
01225                                                   sorting int(11) unsigned DEFAULT '0' NOT NULL,
01226                                                   KEY uid_local (uid_local),
01227                                                   KEY uid_foreign (uid_foreign)
01228                                                 );
01229                                         ");
01230                                         $this->ext_tables_sql[]=chr(10).$createTable.chr(10);
01231                                 } elseif (t3lib_div::intInRange($fConf["conf_relations"],1,100)>1 || $fConf["conf_rel_type"]=="group") {
01232                                         $DBfields[] = $fConf["fieldname"]." blob NOT NULL,";
01233                                 } else {
01234                                         $DBfields[] = $fConf["fieldname"]." int(11) unsigned DEFAULT '0' NOT NULL,";
01235                                 }
01236 
01237                                 if ($fConf["conf_rel_type"]!="group")   {
01238                                         $wTable=$fConf["conf_rel_table"];
01239                                         $wizards =array();
01240                                         if ($fConf["conf_wiz_addrec"])  {
01241                                                 $wizards[] = trim($this->sPS('
01242                                                         '.$this->WOPcomment('WOP:'.$WOP.'[conf_wiz_addrec]').'
01243                                                         "add" => Array(
01244                                                                 "type" => "script",
01245                                                                 "title" => "Create new record",
01246                                                                 "icon" => "add.gif",
01247                                                                 "params" => Array(
01248                                                                         "table"=>"'.$wTable.'",
01249                                                                         "pid" => "###CURRENT_PID###",
01250                                                                         "setValue" => "prepend"
01251                                                                 ),
01252                                                                 "script" => "wizard_add.php",
01253                                                         ),
01254                                                 '));
01255                                         }
01256                                         if ($fConf["conf_wiz_listrec"]) {
01257                                                 $wizards[] = trim($this->sPS('
01258                                                         '.$this->WOPcomment('WOP:'.$WOP.'[conf_wiz_listrec]').'
01259                                                         "list" => Array(
01260                                                                 "type" => "script",
01261                                                                 "title" => "List",
01262                                                                 "icon" => "list.gif",
01263                                                                 "params" => Array(
01264                                                                         "table"=>"'.$wTable.'",
01265                                                                         "pid" => "###CURRENT_PID###",
01266                                                                 ),
01267                                                                 "script" => "wizard_list.php",
01268                                                         ),
01269                                                 '));
01270                                         }
01271                                         if ($fConf["conf_wiz_editrec"]) {
01272                                                 $wizards[] = trim($this->sPS('
01273                                                         '.$this->WOPcomment('WOP:'.$WOP.'[conf_wiz_editrec]').'
01274                                                         "edit" => Array(
01275                                                                 "type" => "popup",
01276                                                                 "title" => "Edit",
01277                                                                 "script" => "wizard_edit.php",
01278                                                                 "popup_onlyOpenIfSelected" => 1,
01279                                                                 "icon" => "edit2.gif",
01280                                                                 "JSopenParams" => "height=350,width=580,status=0,menubar=0,scrollbars=1",
01281                                                         ),
01282                                                 '));
01283                                         }
01284                                         if (count($wizards))    {
01285                                                 $configL[]=trim($this->wrapBody('
01286                                                         "wizards" => Array(
01287                                                                 "_PADDING" => 2,
01288                                                                 "_VERTICAL" => 1,
01289                                                                 ',implode(chr(10),$wizards),'
01290                                                         ),
01291                                                 '));
01292                                         }
01293                                 }
01294                         break;
01295                         case "files":
01296                                 $configL[]='"type" => "group",';
01297                                 $configL[]='"internal_type" => "file",';
01298                                 switch($fConf["conf_files_type"])       {
01299                                         case "images":
01300                                                 $configL[]='"allowed" => $GLOBALS["TYPO3_CONF_VARS"]["GFX"]["imagefile_ext"],   '.$this->WOPcomment('WOP:'.$WOP.'[conf_files_type]');
01301                                         break;
01302                                         case "webimages":
01303                                                 $configL[]='"allowed" => "gif,png,jpeg,jpg",    '.$this->WOPcomment('WOP:'.$WOP.'[conf_files_type]');
01304                                         break;
01305                                         case "all":
01306                                                 $configL[]='"allowed" => "",    '.$this->WOPcomment('WOP:'.$WOP.'[conf_files_type]');
01307                                                 $configL[]='"disallowed" => "php,php3", '.$this->WOPcomment('WOP:'.$WOP.'[conf_files_type]');
01308                                         break;
01309                                 }
01310                                 $configL[]='"max_size" => '.t3lib_div::intInRange($fConf["conf_max_filesize"],1,1000,500).',    '.$this->WOPcomment('WOP:'.$WOP.'[conf_max_filesize]');
01311 
01312                                 $this->EM_CONF_presets["uploadfolder"]=1;
01313 
01314                                 $ulFolder = 'uploads/tx_'.str_replace("_","",$extKey);
01315                                 $configL[]='"uploadfolder" => "'.$ulFolder.'",';
01316                                 if ($fConf["conf_files_thumbs"])        $configL[]='"show_thumbs" => 1, '.$this->WOPcomment('WOP:'.$WOP.'[conf_files_thumbs]');
01317 
01318                                 $configL[]='"size" => '.t3lib_div::intInRange($fConf["conf_files_selsize"],1,100).',    '.$this->WOPcomment('WOP:'.$WOP.'[conf_files_selsize]');
01319                                 $configL[]='"minitems" => 0,';
01320                                 $configL[]='"maxitems" => '.t3lib_div::intInRange($fConf["conf_files"],1,100).',        '.$this->WOPcomment('WOP:'.$WOP.'[conf_files]');
01321 
01322                                 $DBfields[] = $fConf["fieldname"]." blob NOT NULL,";
01323                         break;
01324                         case "none":
01325                                 $DBfields[] = $fConf["fieldname"]." tinytext NOT NULL,";
01326                                 $configL[]=trim($this->sPS('
01327                                         "type" => "none",
01328                                 '));
01329                         break;
01330                         case "passthrough":
01331                                 $DBfields[] = $fConf["fieldname"]." tinytext NOT NULL,";
01332                                 $configL[]=trim($this->sPS('
01333                                         "type" => "passthrough",
01334                                 '));
01335                         break;
01336                         default:
01337                                 debug("Unknown type: ".(string)$fConf["type"]);
01338                         break;
01339                 }
01340 
01341                 if ($t=="passthrough")  {
01342                         $columns[$fConf["fieldname"]] = trim($this->wrapBody('
01343                                 "'.$fConf["fieldname"].'" => Array (            '.$this->WOPcomment('WOP:'.$WOP.'[fieldname]').'
01344                                         "config" => Array (
01345                                                 ',implode(chr(10),$configL),'
01346                                         )
01347                                 ),
01348                         ',2));
01349                 } else {
01350                         $columns[$fConf["fieldname"]] = trim($this->wrapBody('
01351                                 "'.$fConf["fieldname"].'" => Array (            '.$this->WOPcomment('WOP:'.$WOP.'[fieldname]').'
01352                                         "exclude" => '.($fConf["excludeField"]?1:0).',          '.$this->WOPcomment('WOP:'.$WOP.'[excludeField]').'
01353                                         "label" => "'.addslashes($this->getSplitLabels_reference($fConf,"title",$table.".".$fConf["fieldname"])).'",            '.$this->WOPcomment('WOP:'.$WOP.'[title]').'
01354                                         "config" => Array (
01355                                                 ',implode(chr(10),$configL),'
01356                                         )
01357                                 ),
01358                         ',2));
01359                 }
01360         }
01361 
01365         function renderExtPart_PI($k,$config,$extKey)   {
01366                 $WOP="[pi][".$k."]";
01367                 $cN = $this->returnName($extKey,"class","pi".$k);
01368                 $pathSuffix = "pi".$k."/";
01369 
01370 #debug($config);
01371                 $setType="";
01372                 switch($config["addType"])      {
01373                         case "list_type":
01374                                 $setType="list_type";
01375 
01376                                 $this->ext_tables[]=$this->sPS('
01377                                         '.$this->WOPcomment('WOP:'.$WOP.'[addType]').'
01378                                         t3lib_div::loadTCA("tt_content");
01379                                         $TCA["tt_content"]["types"]["list"]["subtypes_excludelist"][$_EXTKEY."_pi'.$k.'"]="layout,select_key";
01380                                         '.($config["apply_extended"]?'$TCA["tt_content"]["types"]["list"]["subtypes_addlist"][$_EXTKEY."_pi'.$k.'"]="'.$this->_apply_extended_types[$config["apply_extended"]].'";':'').'
01381                                 ');
01382 
01383                                 $this->ext_localconf[]=$this->sPS('
01384                                         '.$this->WOPcomment('WOP:'.$WOP.'[addType] / '.$WOP.'[tag_name]').'
01385                                           ## Extending TypoScript from static template uid=43 to set up userdefined tag:
01386                                         t3lib_extMgm::addTypoScript($_EXTKEY,"editorcfg","
01387                                                 tt_content.CSS_editor.ch.'.$cN.' = < plugin.'.$cN.'.CSS_editor
01388                                         ",43);
01389                                 ');
01390                         break;
01391                         case "textbox":
01392                                 $setType="splash_layout";
01393 
01394                                 if ($config["apply_extended"])  {
01395                                         $this->ext_tables[]=$this->sPS('
01396                                                 '.$this->WOPcomment('WOP:'.$WOP.'[addType]').'
01397                                                 t3lib_div::loadTCA("tt_content");
01398                                                 $TCA["tt_content"]["types"]["splash"]["subtype_value_field"]="splash_layout";
01399                                                 $TCA["tt_content"]["types"]["splash"]["subtypes_addlist"][$_EXTKEY."_pi'.$k.'"]="'.$this->_apply_extended_types[$config["apply_extended"]].'";
01400                                         ');
01401                                 }
01402                         break;
01403                         case "menu_sitemap":
01404                                 $setType="menu_type";
01405 
01406                                 if ($config["apply_extended"])  {
01407                                         $this->ext_tables[]=$this->sPS('
01408                                                 '.$this->WOPcomment('WOP:'.$WOP.'[addType]').'
01409                                                 t3lib_div::loadTCA("tt_content");
01410                                                 $TCA["tt_content"]["types"]["menu"]["subtype_value_field"]="menu_type";
01411                                                 $TCA["tt_content"]["types"]["menu"]["subtypes_addlist"][$_EXTKEY."_pi'.$k.'"]="'.$this->_apply_extended_types[$config["apply_extended"]].'";
01412                                         ');
01413                                 }
01414                         break;
01415                         case "ce":
01416                                 $setType="CType";
01417 
01418                                 $tFields=array();
01419                                 $tFields[] = "CType;;4;button;1-1-1, header;;3;;2-2-2";
01420                                 if ($config["apply_extended"])  {
01421                                         $tFields[] = $this->_apply_extended_types[$config["apply_extended"]];
01422                                 }
01423                                 $this->ext_tables[]=$this->sPS('
01424                                         '.$this->WOPcomment('WOP:'.$WOP.'[addType]').'
01425                                         t3lib_div::loadTCA("tt_content");
01426                                         $TCA["tt_content"]["types"][$_EXTKEY."_pi'.$k.'"]["showitem"]="'.implode(", ",$tFields).'";
01427                                 ');
01428                         break;
01429                         case "header":
01430                                 $setType="header_layout";
01431                         break;
01432                         case "includeLib":
01433                                 if ($config["plus_user_ex"])    $setType="includeLib";
01434                         break;
01435                         case "typotags":
01436                                 $tagName = ereg_replace("[^a-z0-9_]","",strtolower($config["tag_name"]));
01437                                 if ($tagName)   {
01438                                         $this->ext_localconf[]=$this->sPS('
01439                                                 '.$this->WOPcomment('WOP:'.$WOP.'[addType] / '.$WOP.'[tag_name]').'
01440                                                   ## Extending TypoScript from static template uid=43 to set up userdefined tag:
01441                                                 t3lib_extMgm::addTypoScript($_EXTKEY,"setup","
01442                                                         tt_content.text.20.parseFunc.tags.'.$tagName.' = < plugin.".t3lib_extMgm::getCN($_EXTKEY)."_pi'.$k.'
01443                                                 ",43);
01444                                         ');
01445                                 }
01446                         break;
01447                         default:
01448                         break;
01449                 }
01450 
01451                 $cache= $config["plus_user_obj"] ? 0 : 1;
01452 
01453                 $this->ext_localconf[]=$this->sPS('
01454                         '.$this->WOPcomment('WOP:'.$WOP.'[addType]').'
01455                         t3lib_extMgm::addPItoST43($_EXTKEY,"pi'.$k.'/class.'.$cN.'.php","_pi'.$k.'","'.$setType.'",'.$cache.');
01456                 ');
01457 
01458                 if ($setType && !t3lib_div::inList("typotags,includeLib",$setType))     {
01459                         $this->ext_tables[]=$this->sPS('
01460                                 '.$this->WOPcomment('WOP:'.$WOP.'[addType]').'
01461                                 t3lib_extMgm::addPlugin(Array("'.addslashes($this->getSplitLabels_reference($config,"title","tt_content.".$setType."_pi".$k)).'", $_EXTKEY."_pi'.$k.'"),"'.$setType.'");
01462                         ');
01463                 }
01464 
01465                         // Make Plugin class:
01466                 switch($config["addType"])      {
01467                         case "list_type":
01468                                 if ($config["list_default"])    {
01469                                         if (is_array($this->wizArray["tables"][$config["list_default"]]))       {
01470                                                 $tempTableConf = $this->wizArray["tables"][$config["list_default"]];
01471                                                 $tableName = $this->returnName($extKey,"tables",$tempTableConf["tablename"]);
01472 
01473                                                 $ll=array();
01474 
01475                                                 $theLines = Array();
01476                                                 $theLines["getListRow"]=Array();
01477                                                 $theLines["getListHeader"]=Array();
01478                                                 $theLines["getFieldContent"]=Array();
01479                                                 $theLines["getFieldHeader"]=Array();
01480                                                 $theLines["singleRows"]=Array();
01481                                                 $theLines["listItemRows"]=Array();
01482                                                 $theLines["singleRows_section"]=Array();
01483                                                 $P_classes=array();
01484 
01485                                                 $theLines["searchFieldList"]=Array();
01486                                                 $theLines["orderByList"]=Array();
01487 
01488                                                 $tcol="uid";
01489                                                 $theLines["getListRow"][$tcol] = '<td><p>\'.$this->getFieldContent("'.$tcol.'").\'</p></td>';
01490                                                 $theLines["getListHeader"][$tcol] = '<td><p>\'.$this->getFieldHeader_sortLink("'.$tcol.'").\'</p></td>';
01491                                                 $theLines["orderByList"][$tcol]=$tcol;
01492 
01493                                                 if (is_array($tempTableConf["fields"])) {
01494                                                         reset($tempTableConf["fields"]);
01495                                                         while(list(,$fC)=each($tempTableConf["fields"]))        {
01496                                                                 $tcol = $fC["fieldname"];
01497                                                                 if ($tcol)      {
01498                                                                         $theLines["singleRows"][$tcol] = trim($this->sPS('
01499                                                                                 <tr>
01500                                                                                         <td nowrap valign="top"\'.$this->pi_classParam("singleView-HCell").\'><p>\'.$this->getFieldHeader("'.$tcol.'").\'</p></td>
01501                                                                                         <td valign="top"><p>\'.$this->getFieldContent("'.$tcol.'").\'</p></td>
01502                                                                                 </tr>
01503                                                                         '));
01504 
01505                                                                         if ($this->fieldIsRTE($fC))     {
01506                                                                                 $theLines["singleRows_section"][$tcol] = trim($this->sPS('
01507                                                                                         \'.$this->getFieldContent("'.$tcol.'").\'
01508                                                                                 '));
01509                                                                         } else {
01510                                                                                 $tempN='singleViewField-'.str_replace("_","-",$tcol);
01511                                                                                 $theLines["singleRows_section"][$tcol] = trim($this->sPS('
01512                                                                                         <p\'.$this->pi_classParam("'.$tempN.'").\'><strong>\'.$this->getFieldHeader("'.$tcol.'").\':</strong> \'.$this->getFieldContent("'.$tcol.'").\'</p>
01513                                                                                 '));
01514                                                                                 $P_classes["SV"][]=$tempN;
01515                                                                         }
01516 
01517                                                                         if (!strstr($fC["type"],"textarea"))    {
01518                                                                                 $theLines["getListRow"][$tcol] = '<td valign="top"><p>\'.$this->getFieldContent("'.$tcol.'").\'</p></td>';
01519                                                                                 $theLines["getListHeader"][$tcol] = '<td nowrap><p>\'.$this->getFieldHeader("'.$tcol.'").\'</p></td>';
01520 
01521                                                                                 $tempN='listrowField-'.str_replace("_","-",$tcol);
01522                                                                                 $theLines["listItemRows"][$tcol] = trim($this->sPS('
01523                                                                                         <p\'.$this->pi_classParam("'.$tempN.'").\'>\'.$this->getFieldContent("'.$tcol.'").\'</p>
01524                                                                                 '));
01525                                                                                 $P_classes["LV"][]=$tempN;
01526                                                                         }
01527 
01528 
01529                                                                         $this->addLocalConf($ll,array("listFieldHeader_".$tcol=>$fC["title"]),"listFieldHeader_".$tcol,"pi",$k,1,1);
01530 
01531                                                                         if ($tcol=="title")     {
01532                                                                                 $theLines["getFieldContent"][$tcol] = trim($this->sPS('
01533                                                                                                 case "'.$tcol.'":
01534                                                                                                                 // This will wrap the title in a link.
01535                                                                                                         return $this->pi_list_linkSingle($this->internal["currentRow"]["'.$tcol.'"],$this->internal["currentRow"]["uid"],1);
01536                                                                                                 break;
01537                                                                                 '));
01538                                                                                 $theLines["getFieldHeader"][$tcol] = trim($this->sPS('
01539                                                                                                 case "'.$tcol.'":
01540                                                                                                         return $this->pi_getLL("listFieldHeader_'.$tcol.'","<em>'.$tcol.'</em>");
01541                                                                                                 break;
01542                                                                                 '));
01543                                                                         } elseif ($this->fieldIsRTE($fC)) {
01544                                                                                         $theLines["getFieldContent"][$tcol] = trim($this->sPS('
01545                                                                                                         case "'.$tcol.'":
01546                                                                                                                 return $this->pi_RTEcssText($this->internal["currentRow"]["'.$tcol.'"]);
01547                                                                                                         break;
01548                                                                                         '));
01549                                                                         } elseif ($fC["type"]=="datetime")      {
01550                                                                                 $theLines["getFieldContent"][$tcol] = trim($this->sPS('
01551                                                                                                 case "'.$tcol.'":
01552                                                                                                         return strftime("%d-%m-%y %H:%M:%S",$this->internal["currentRow"]["'.$tcol.'"]);
01553                                                                                                 break;
01554                                                                                 '));
01555                                                                         } elseif ($fC["type"]=="date")  {
01556                                                                                 $theLines["getFieldContent"][$tcol] = trim($this->sPS('
01557                                                                                                 case "'.$tcol.'":
01558                                                                                                                 // For a numbers-only date, use something like: %d-%m-%y
01559                                                                                                         return strftime("%A %e. %B %Y",$this->internal["currentRow"]["'.$tcol.'"]);
01560                                                                                                 break;
01561                                                                                 '));
01562                                                                         }
01563                                                                         if (strstr($fC["type"],"input"))        {
01564                                                                                 $theLines["getListHeader"][$tcol] = '<td><p>\'.$this->getFieldHeader_sortLink("'.$tcol.'").\'</p></td>';
01565                                                                                 $theLines["orderByList"][$tcol]=$tcol;
01566                                                                         }
01567                                                                         if (strstr($fC["type"],"input")||strstr($fC["type"],"textarea"))        {
01568                                                                                 $theLines["searchFieldList"][$tcol]=$tcol;
01569                                                                         }
01570                                                                 }
01571                                                         }
01572                                                 }
01573 
01574                                                 $theLines["singleRows"]["tstamp"] = trim($this->sPS('
01575                                                         <tr>
01576                                                                 <td nowrap\'.$this->pi_classParam("singleView-HCell").\'><p>Last updated:</p></td>
01577                                                                 <td valign="top"><p>\'.date("d-m-Y H:i",$this->internal["currentRow"]["tstamp"]).\'</p></td>
01578                                                         </tr>
01579                                                 '));
01580                                                 $theLines["singleRows"]["crdate"] = trim($this->sPS('
01581                                                         <tr>
01582                                                                 <td nowrap\'.$this->pi_classParam("singleView-HCell").\'><p>Created:</p></td>
01583                                                                 <td valign="top"><p>\'.date("d-m-Y H:i",$this->internal["currentRow"]["crdate"]).\'</p></td>
01584                                                         </tr>
01585                                                 '));
01586 
01587                                                         // Add title to local lang file
01588                                                 $ll = $this->addStdLocalLangConf($ll,$k);
01589 
01590                                                 $this->addLocalLangFile($ll,$pathSuffix."locallang.php",'Language labels for plugin "'.$cN.'"');
01591 
01592 
01593                                                 $innerMainContent = $this->sPS('
01597                                                         function main($content,$conf)   {
01598                                                                 switch((string)$conf["CMD"])    {
01599                                                                         case "singleView":
01600                                                                                 list($t) = explode(":",$this->cObj->currentRecord);
01601                                                                                 $this->internal["currentTable"]=$t;
01602                                                                                 $this->internal["currentRow"]=$this->cObj->data;
01603                                                                                 return $this->pi_wrapInBaseClass($this->singleView($content,$conf));
01604                                                                         break;
01605                                                                         default:
01606                                                                                 if (strstr($this->cObj->currentRecord,"tt_content"))    {
01607                                                                                         $conf["pidList"] = $this->cObj->data["pages"];
01608                                                                                         $conf["recursive"] = $this->cObj->data["recursive"];
01609                                                                                 }
01610                                                                                 return $this->pi_wrapInBaseClass($this->listView($content,$conf));
01611                                                                         break;
01612                                                                 }
01613                                                         }
01614                                                 ');
01615 
01616                                                 $innerMainContent.= $this->sPS('
01620                                                         function listView($content,$conf)       {
01621                                                                 $this->conf=$conf;              // Setting the TypoScript passed to this function in $this->conf
01622                                                                 $this->pi_setPiVarDefaults();
01623                                                                 $this->pi_loadLL();             // Loading the LOCAL_LANG values
01624                                                                 '.(!$cache ? '$this->pi_USER_INT_obj=1; // Configuring so caching is not expected. This value means that no cHash params are ever set. We do this, because it\'s a USER_INT object!' : '').'
01625                                                                 $lConf = $this->conf["listView."];      // Local settings for the listView function
01626 
01627                                                                 if ($this->piVars["showUid"])   {       // If a single element should be displayed:
01628                                                                         $this->internal["currentTable"] = "'.$tableName.'";
01629                                                                         $this->internal["currentRow"] = $this->pi_getRecord("'.$tableName.'",$this->piVars["showUid"]);
01630 
01631                                                                         $content = $this->singleView($content,$conf);
01632                                                                         return $content;
01633                                                                 } else {
01634                                                                         $items=array(
01635                                                                                 "1"=> $this->pi_getLL("list_mode_1","Mode 1"),
01636                                                                                 "2"=> $this->pi_getLL("list_mode_2","Mode 2"),
01637                                                                                 "3"=> $this->pi_getLL("list_mode_3","Mode 3"),
01638                                                                         );
01639                                                                         if (!isset($this->piVars["pointer"]))   $this->piVars["pointer"]=0;
01640                                                                         if (!isset($this->piVars["mode"]))      $this->piVars["mode"]=1;
01641 
01642                                                                                 // Initializing the query parameters:
01643                                                                         list($this->internal["orderBy"],$this->internal["descFlag"]) = explode(":",$this->piVars["sort"]);
01644                                                                         $this->internal["results_at_a_time"]=t3lib_div::intInRange($lConf["results_at_a_time"],0,1000,3);               // Number of results to show in a listing.
01645                                                                         $this->internal["maxPages"]=t3lib_div::intInRange($lConf["maxPages"],0,1000,2);;                // The maximum number of "pages" in the browse-box: "Page 1", "Page 2", etc.
01646                                                                         $this->internal["searchFieldList"]="'.implode(",",$theLines["searchFieldList"]).'";
01647                                                                         $this->internal["orderByList"]="'.implode(",",$theLines["orderByList"]).'";
01648 
01649                                                                                 // Get number of records:
01650                                                                         $res = $this->pi_exec_query("'.$tableName.'",1);
01651                                                                         list($this->internal["res_count"]) = $GLOBALS[\'TYPO3_DB\']->sql_fetch_row($res);
01652 
01653                                                                                 // Make listing query, pass query to SQL database:
01654                                                                         $res = $this->pi_exec_query("'.$tableName.'");
01655                                                                         $this->internal["currentTable"] = "'.$tableName.'";
01656 
01657                                                                                 // Put the whole list together:
01658                                                                         $fullTable="";  // Clear var;
01659                                                                 #       $fullTable.=t3lib_div::view_array($this->piVars);       // DEBUG: Output the content of $this->piVars for debug purposes. REMEMBER to comment out the IP-lock in the debug() function in t3lib/config_default.php if nothing happens when you un-comment this line!
01660 
01661                                                                                 // Adds the mode selector.
01662                                                                         $fullTable.=$this->pi_list_modeSelector($items);
01663 
01664                                                                                 // Adds the whole list table
01665                                                                         $fullTable.='.($config["list_default_listmode"]?'$this->makelist($res);':'$this->pi_list_makelist($res);').'
01666 
01667                                                                                 // Adds the search box:
01668                                                                         $fullTable.=$this->pi_list_searchBox();
01669 
01670                                                                                 // Adds the result browser:
01671                                                                         $fullTable.=$this->pi_list_browseresults();
01672 
01673                                                                                 // Returns the content from the plugin.
01674                                                                         return $fullTable;
01675                                                                 }
01676                                                         }
01677                                                 ');
01678 
01679 
01680                                                 if ($config["list_default_listmode"])   {
01681                                                         $innerMainContent.= $this->wrapBody('
01685                                                                 function makelist($res) {
01686                                                                         $items=Array();
01687                                                                                 // Make list table rows
01688                                                                         while($this->internal["currentRow"] = $GLOBALS[\'TYPO3_DB\']->sql_fetch_assoc($res))    {
01689                                                                                 $items[]=$this->makeListItem();
01690                                                                         }
01691 
01692                                                                         $out = \'<div\'.$this->pi_classParam("listrow").\'>
01693                                                                                 \'.implode(chr(10),$items).\'
01694                                                                                 </div>\';
01695                                                                         return $out;
01696                                                                 }
01697 
01701                                                                 function makeListItem() {
01702                                                                         $out=\'
01703                                                                                 ',implode(chr(10),$theLines["listItemRows"]),'
01704                                                                                 \';
01705                                                                         return $out;
01706                                                                 }
01707                                                         ',3);
01708                                                 }
01709 
01710                                                 // Single display:
01711                                                 if ($config["list_default_singlemode"]) {
01712                                                         $innerMainContent.= $this->wrapBody('
01716                                                                 function singleView($content,$conf)     {
01717                                                                         $this->conf=$conf;
01718                                                                         $this->pi_setPiVarDefaults();
01719                                                                         $this->pi_loadLL();
01720                                                                         '.(!$cache ? '$this->pi_USER_INT_obj=1; // Configuring so caching is not expected. This value means that no cHash params are ever set. We do this, because it\'s a USER_INT object!' : '').'
01721 
01722                                                                                 // This sets the title of the page for use in indexed search results:
01723                                                                         if ($this->internal["currentRow"]["title"])     $GLOBALS["TSFE"]->indexedDocTitle=$this->internal["currentRow"]["title"];
01724 
01725                                                                         $content=\'<div\'.$this->pi_classParam("singleView").\'>
01726                                                                                 <H2>Record "\'.$this->internal["currentRow"]["uid"].\'" from table "\'.$this->internal["currentTable"].\'":</H2>
01727                                                                                 ',implode(chr(10),$theLines["singleRows_section"]),'
01728                                                                         <p>\'.$this->pi_list_linkSingle($this->pi_getLL("back","Back"),0).\'</p></div>\'.
01729                                                                         $this->pi_getEditPanel();
01730 
01731                                                                         return $content;
01732                                                                 }
01733                                                         ',3);
01734                                                 } else {
01735                                                         $innerMainContent.= $this->wrapBody('
01739                                                                 function singleView($content,$conf)     {
01740                                                                         $this->conf=$conf;
01741                                                                         $this->pi_setPiVarDefaults();
01742                                                                         $this->pi_loadLL();
01743                                                                         '.(!$cache ? '$this->pi_USER_INT_obj=1; // Configuring so caching is not expected. This value means that no cHash params are ever set. We do this, because it\'s a USER_INT object!' : '').'
01744 
01745                                                                                 // This sets the title of the page for use in indexed search results:
01746                                                                         if ($this->internal["currentRow"]["title"])     $GLOBALS["TSFE"]->indexedDocTitle=$this->internal["currentRow"]["title"];
01747 
01748                                                                         $content=\'<div\'.$this->pi_classParam("singleView").\'>
01749                                                                                 <H2>Record "\'.$this->internal["currentRow"]["uid"].\'" from table "\'.$this->internal["currentTable"].\'":</H2>
01750                                                                                 <table>
01751                                                                                         ',implode(chr(10),$theLines["singleRows"]),'
01752                                                                                 </table>
01753                                                                         <p>\'.$this->pi_list_linkSingle($this->pi_getLL("back","Back"),0).\'</p></div>\'.
01754                                                                         $this->pi_getEditPanel();
01755 
01756                                                                         return $content;
01757                                                                 }
01758                                                         ',3);
01759                                                 }
01760 
01761                                                 $this->ext_localconf[]=$this->sPS('
01762                                                         '.$this->WOPcomment('WOP:'.$WOP.'[...]').'
01763                                                         t3lib_extMgm::addTypoScript($_EXTKEY,"setup","
01764                                                                 tt_content.shortcut.20.0.conf.'.$tableName.' = < plugin.".t3lib_extMgm::getCN($_EXTKEY)."_pi'.$k.'
01765                                                                 tt_content.shortcut.20.0.conf.'.$tableName.'.CMD = singleView
01766                                                         ",43);
01767                                                 ');
01768 
01769                                                 if (!$config["list_default_listmode"])  {
01770                                                         $innerMainContent.= $this->wrapBody('
01774                                                                 function pi_list_row($c)        {
01775                                                                         $editPanel = $this->pi_getEditPanel();
01776                                                                         if ($editPanel) $editPanel="<TD>".$editPanel."</TD>";
01777 
01778                                                                         return \'<tr\'.($c%2 ? $this->pi_classParam("listrow-odd") : "").\'>
01779                                                                                         ',implode(chr(10),$theLines["getListRow"]),'
01780                                                                                         \'.$editPanel.\'
01781                                                                                 </tr>\';
01782                                                                 }
01783                                                         ',3);
01784                                                         $innerMainContent.= $this->wrapBody('
01788                                                                 function pi_list_header()       {
01789                                                                         return \'<tr\'.$this->pi_classParam("listrow-header").\'>
01790                                                                                         ',implode(chr(10),$theLines["getListHeader"]),'
01791                                                                                 </tr>\';
01792                                                                 }
01793                                                         ',3);
01794                                                 }
01795                                                 $innerMainContent.= $this->wrapBody('
01799                                                         function getFieldContent($fN)   {
01800                                                                 switch($fN) {
01801                                                                         case "uid":
01802                                                                                 return $this->pi_list_linkSingle($this->internal["currentRow"][$fN],$this->internal["currentRow"]["uid"],1);    // The "1" means that the display of single items is CACHED! Set to zero to disable caching.
01803                                                                         break;
01804                                                                         ',implode(chr(10),$theLines["getFieldContent"]),'
01805                                                                         default:
01806                                                                                 return $this->internal["currentRow"][$fN];
01807                                                                         break;
01808                                                                 }
01809                                                         }
01810                                                 ',2);
01811                                                 $innerMainContent.= $this->wrapBody('
01815                                                         function getFieldHeader($fN)    {
01816                                                                 switch($fN) {
01817                                                                         ',implode(chr(10),$theLines["getFieldHeader"]),'
01818                                                                         default:
01819                                                                                 return $this->pi_getLL("listFieldHeader_".$fN,"[".$fN."]");
01820                                                                         break;
01821                                                                 }
01822                                                         }
01823                                                 ',2);
01824                                                 $innerMainContent.= $this->sPS('
01828                                                         function getFieldHeader_sortLink($fN)   {
01829                                                                 return $this->pi_linkTP_keepPIvars($this->getFieldHeader($fN),array("sort"=>$fN.":".($this->internal["descFlag"]?0:1)));
01830                                                         }
01831                                                 ');
01832 
01833 
01834 
01835 
01836 
01837 
01838                                                 $CSS_editor_code="";
01839                                                 $pCSSSel = str_replace("_","-",$cN);
01840 
01841                                                 if ($config["list_default_listmode"])   {
01842                                                         $temp_merge=array();
01843                                                         if (is_array($P_classes["LV"])) {
01844                                                                 while(list($c,$LVc)=each($P_classes["LV"]))     {
01845                                                                         $temp_merge[]=$this->sPS('
01846                                                                                 P_'.$c.' = ['.$LVc.']
01847                                                                                 P_'.$c.'.selector = +.'.$pCSSSel.'-'.$LVc.'
01848                                                                                 P_'.$c.'.attribs = BODYTEXT
01849                                                                                 P_'.$c.'.example = <p class="'.$pCSSSel.'-'.$LVc.'">['.$LVc.'] text <a href="#">with a link</a> in it.</p><p class="'.$pCSSSel.'-'.$LVc.'">In principio creavit Deus caelum et terram terra autem erat inanis et vacua et tenebrae super faciem abyssi et spiritus...</p>
01850                                                                                 P_'.$c.'.exampleStop = 1
01851                                                                                 P_'.$c.'.ch.links = < CSS_editor.ch.A
01852                                                                         ',1);
01853                                                                 }
01854                                                         }
01855                                                         $CSS_editor_code.=$this->wrapBody('
01856                                                                 list = List display
01857                                                                 list.selector = .'.$pCSSSel.'-listrow
01858                                                                 list.example = <div class="'.$pCSSSel.'-listrow"><p>This is regular bodytext in the list display.</p><p>Viditque Deus cuncta quae fecit et erant valde bona et factum est vespere et mane dies sextus.</p></div>
01859                                                                 list.exampleWrap = <div class="'.$pCSSSel.'-listrow"> | </div>
01860                                                                 list.ch.P < .P
01861                                                                 list.ch.P.exampleStop = 0
01862                                                                 list.ch.P.ch {
01863                                                                 ',implode(chr(10),$temp_merge),'
01864                                                                 }
01865                                                         ');
01866                                                 } else {
01867                                                         $CSS_editor_code.=$this->sPS('
01868                                                                 list = List display
01869                                                                 list.selector = .'.$pCSSSel.'-listrow
01870                                                                 list.example = <div class="'.$pCSSSel.'-listrow"><table><tr class="'.$pCSSSel.'-listrow-header"><td nowrap><p>Time / Date:</p></td><td><p><a HREF="#">Title:</a></p></td></tr><tr><td valign="top"><p>25-08-02</p></td><td valign="top"><p><a HREF="#">New company name...</a></p></td></tr><tr class="'.$pCSSSel.'-listrow-odd"><td valign="top"><p>16-08-02</p></td><td valign="top"><p><a HREF="#">Yet another headline here</a></p></td></tr><tr><td valign="top"><p>05-08-02</p></td><td valign="top"><p><a HREF="#">The third line - even row</a></p></td></tr></table></div>
01871                                                                 list.exampleStop = 1
01872                                                                 list.ch {
01873                                                                         TABLE = Table
01874                                                                         TABLE.selector = TABLE
01875                                                                         TABLE.attribs = TABLE
01876                                                                         TD = Table cells
01877                                                                         TD.selector = TD
01878                                                                         TD.attribs = TD
01879                                                                         TD_header = Header row cells
01880                                                                         TD_header.selector = TR.'.$pCSSSel.'-listrow-header TD
01881                                                                         TD_header.attribs = TD
01882                                                                         TD_odd = Odd rows cells
01883                                                                         TD_odd.selector = TR.'.$pCSSSel.'-listrow-odd TD
01884                                                                         TD_odd.attribs = TD
01885                                                                 }
01886                                                                 list.ch.TD.ch.P < .P
01887                                                                 list.ch.TD_header.ch.P < .P
01888                                                                 list.ch.TD_odd.ch.P < .P
01889                                                         ');
01890                                                 }
01891 
01892                                                 if ($config["list_default_singlemode"]) {
01893                                                         $temp_merge=array();
01894                                                         if (is_array($P_classes["SV"])) {
01895                                                                 while(list($c,$LVc)=each($P_classes["SV"]))     {
01896                                                                         $temp_merge[]=$this->sPS('
01897                                                                                 P_'.$c.' = ['.$LVc.']
01898                                                                                 P_'.$c.'.selector = +.'.$pCSSSel.'-'.$LVc.'
01899                                                                                 P_'.$c.'.attribs = BODYTEXT
01900                                                                                 P_'.$c.'.example = <p class="'.$pCSSSel.'-'.$LVc.'">['.$LVc.'] text <a href="#">with a link</a> in it.</p><p class="'.$pCSSSel.'-'.$LVc.'">In principio creavit Deus caelum et terram terra autem erat inanis et vacua et tenebrae super faciem abyssi et spiritus...</p>
01901                                                                                 P_'.$c.'.exampleStop = 1
01902                                                                                 P_'.$c.'.ch.links = < CSS_editor.ch.A
01903                                                                         ',1);
01904                                                                 }
01905                                                         }
01906                                                         $CSS_editor_code.=$this->wrapBody('
01907                                                                 single = Single display
01908                                                                 single.selector = .'.$pCSSSel.'-singleView
01909                                                                 single.example = <div class="'.$pCSSSel.'-singleView"><H2>Header, if any:</H2><p>This is regular bodytext in the list display.</p><p>Viditque Deus cuncta quae fecit et erant valde bona et factum est vespere et mane dies sextus.</p><p><a href="#">Back</a></p></div>
01910                                                                 single.exampleWrap = <div class="'.$pCSSSel.'-singleView"> | </div>
01911                                                                 single.ch.P < .P
01912                                                                 single.ch.P.exampleStop = 0
01913                                                                 single.ch.P.ch {
01914                                                                 ',implode(chr(10),$temp_merge),'
01915                                                                 }
01916                                                         ');
01917                                                 } else {
01918                                                         $CSS_editor_code.=$this->sPS('
01919                                                                 single = Single display
01920                                                                 single.selector = .'.$pCSSSel.'-singleView
01921                                                                 single.example = <div class="'.$pCSSSel.'-singleView"><H2>Header, if any:</H2><table><tr><td nowrap valign="top" class="'.$pCSSSel.'-singleView-HCell"><p>Date:</p></td><td valign="top"><p>13-09-02</p></td></tr><tr><td nowrap valign="top" class="'.$pCSSSel.'-singleView-HCell"><p>Title:</p></td><td valign="top"><p><a HREF="#">New title line</a></p></td></tr><tr><td nowrap valign="top" class="'.$pCSSSel.'-singleView-HCell"><p>Teaser text:</p></td><td valign="top"><p>Vocavitque Deus firmamentum caelum et factum est vespere et mane dies secundus dixit vero Deus congregentur.</p><p>Aquae quae sub caelo sunt in locum unum et appareat arida factumque est ita et vocavit Deus aridam terram congregationesque aquarum appellavit maria et vidit Deus quod esset bonum et ait germinet terra herbam virentem et facientem semen et lignum pomiferum faciens fructum iuxta genus suum cuius semen in semet ipso sit super terram et factum est ita et protulit terra herbam virentem et adferentem semen iuxta genus suum lignumque faciens fructum et habens unumquodque sementem secundum speciem suam et vidit Deus quod esset bonum.</p></td></tr><tr><td nowrap class="'.$pCSSSel.'-singleView-HCell"><p>Last updated:</p></td><td valign="top"><p>25-08-2002 18:28</p></td></tr><tr><td nowrap class="'.$pCSSSel.'-singleView-HCell"><p>Created:</p></td><td valign="top"><p>25-08-2002 18:27</p></td></tr></table><p><a href="#">Back</a></p></div>
01922                                                                 single.exampleStop = 1
01923                                                                 single.ch {
01924                                                                         TABLE = Table
01925                                                                         TABLE.selector = TABLE
01926                                                                         TABLE.attribs = TABLE
01927                                                                         TD = Table cells
01928                                                                         TD.selector = TD
01929                                                                         TD.attribs = TD
01930                                                                         TD.ch {
01931                                                                                 TD = Header cells
01932                                                                                 TD.selector = +.'.$pCSSSel.'-singleView-HCell
01933                                                                                 TD.attribs = TD
01934                                                                         }
01935                                                                 }
01936                                                                 single.ch.P < .P
01937                                                                 single.ch.H2 < .H2
01938                                                                 single.ch.TD.ch.P < .P
01939                                                                 single.ch.TD.ch.TD.ch.P < .P
01940                                                         ');
01941                                                 }
01942 
01943                                                 $this->addFileToFileArray($config["plus_not_staticTemplate"]?"ext_typoscript_editorcfg.txt":$pathSuffix."static/editorcfg.txt",$this->wrapBody('
01944                                                         plugin.'.$cN.'.CSS_editor = Plugin: "'.$cN.'"
01945                                                         plugin.'.$cN.'.CSS_editor.selector = .'.$pCSSSel.'
01946                                                         plugin.'.$cN.'.CSS_editor.exampleWrap = <HR><strong>Plugin: "'.$cN.'"</strong><HR><div class="'.$pCSSSel.'"> | </div>
01947                                                         plugin.'.$cN.'.CSS_editor.ch {
01948                                                                 P = Text
01949                                                                 P.selector = P
01950                                                                 P.attribs = BODYTEXT
01951                                                                 P.example = <p>General text wrapped in &lt;P&gt;:<BR>This is text <a href="#">with a link</a> in it. In principio creavit Deus caelum et terram terra autem erat inanis et vacua et tenebrae super faciem abyssi et spiritus...</p>
01952                                                                 P.exampleStop = 1
01953                                                                 P.ch.links = < CSS_editor.ch.A
01954 
01955                                                                 H2 = Header 2
01956                                                                 H2.selector = H2
01957                                                                 H2.attribs = HEADER
01958                                                                 H2.example = <H2>Header 2 example <a href="#"> with link</a></H2><p>Bodytext, Et praeessent diei ac nocti et dividerent lucem ac tenebras et vidit Deus quod esset bonum et factum est...</p>
01959                                                                 H2.ch.links = < CSS_editor.ch.A
01960                                                                 H2.exampleStop = 1
01961 
01962                                                                 H3 = Header 3
01963                                                                 H3.selector = H3
01964                                                                 H3.attribs = HEADER
01965                                                                 H3.example = <h3>Header 3 example <a href="#"> with link</a></h3><p>Bodytext, Et praeessent diei ac nocti et dividerent lucem ac tenebras et vidit Deus quod esset bonum et factum est...</p>
01966                                                                 H3.ch.links = < CSS_editor.ch.A
01967                                                                 H3.exampleStop = 1
01968 
01969 
01970                                                                         ## LISTING:
01971                                                                 modeSelector = Mode selector
01972                                                                 modeSelector.selector = .'.$pCSSSel.'-modeSelector
01973                                                                 modeSelector.example = <div class="'.$pCSSSel.'-modeSelector"><table><tr><td class="'.$pCSSSel.'-modeSelector-SCell"><p><a HREF="#">Mode 1 (S)</a></p></td><td><p><a HREF="#">Mode 2</a></p></td><td><p><a HREF="#">Mode 3</a></p></td></tr></table></div>
01974                                                                 modeSelector.exampleStop = 1
01975                                                                 modeSelector.ch.P < .P
01976                                                                 modeSelector.ch.TABLE = Table
01977                                                                 modeSelector.ch.TABLE.selector = TABLE
01978                                                                 modeSelector.ch.TABLE.attribs = TABLE
01979                                                                 modeSelector.ch.TD = Table cells
01980                                                                 modeSelector.ch.TD.selector = TD
01981                                                                 modeSelector.ch.TD.attribs = TD
01982                                                                 modeSelector.ch.TD.ch {
01983                                                                   TD = Selected table cells
01984                                                                   TD.selector = + .'.$pCSSSel.'-modeSelector-SCell
01985                                                                   TD.attribs = TD
01986                                                                 }
01987                                                                 modeSelector.ch.TD.ch.TD.ch.P < .P
01988 
01989 
01990                                                                 browsebox = Browsing box
01991                                                                 browsebox.selector = .'.$pCSSSel.'-browsebox
01992                                                                 browsebox.example = <div class="'.$pCSSSel.'-browsebox"><p>Displaying results <span class="'.$pCSSSel.'-browsebox-strong">1 to 3</span> out of <span class="'.$pCSSSel.'-browsebox-strong">4</span></p><table><tr><td class="'.$pCSSSel.'-browsebox-SCell"><p><a HREF="#">Page 1 (S)</a></p></td><td><p><a HREF="#">Page 2</a></p></td><td><p><a HREF="#">Next ></a></p></td></tr></table></div>
01993                                                                 browsebox.exampleStop = 1
01994                                                                 browsebox.ch.P < .P
01995                                                                 browsebox.ch.P.ch.strong = Emphasized numbers
01996                                                                 browsebox.ch.P.ch.strong {
01997                                                                   selector = SPAN.'.$pCSSSel.'-browsebox-strong
01998                                                                   attribs = TEXT
01999                                                                 }
02000                                                                 browsebox.ch.TABLE = Table
02001                                                                 browsebox.ch.TABLE.selector = TABLE
02002                                                                 browsebox.ch.TABLE.attribs = TABLE
02003                                                                 browsebox.ch.TD = Table cells
02004                                                                 browsebox.ch.TD.selector = TD
02005                                                                 browsebox.ch.TD.attribs = TD
02006                                                                 browsebox.ch.TD.ch {
02007                                                                   TD = Selected table cells
02008                                                                   TD.selector = + .'.$pCSSSel.'-browsebox-SCell
02009                                                                   TD.attribs = TD
02010                                                                 }
02011                                                                 browsebox.ch.TD.ch.P < .P
02012                                                                 browsebox.ch.TD.ch.TD.ch.P < .P
02013 
02014 
02015                                                                 searchbox = Search box
02016                                                                 searchbox.selector = .'.$pCSSSel.'-searchbox
02017                                                                 searchbox.example = <div class="'.$pCSSSel.'-searchbox"><table><form action="#" method="POST"><tr><td><input type="text" name="'.$cN.'[sword]" value="Search word" class="'.$pCSSSel.'-searchbox-sword"></td><td><input type="submit" value="Search" class="'.$pCSSSel.'-searchbox-button"></td></tr></form></table></div>
02018                                                                 searchbox.exampleStop = 1
02019                                                                 searchbox.ch {
02020                                                                         TABLE = Table
02021                                                                         TABLE.selector = TABLE
02022                                                                         TABLE.attribs = TABLE
02023                                                                         TD = Table cells
02024                                                                         TD.selector = TD
02025                                                                         TD.attribs = TD
02026                                                                         INPUT = Form fields
02027                                                                         INPUT.selector = INPUT
02028                                                                         INPUT.attribs = TEXT,background-color,width
02029                                                                         INPUT.ch {
02030                                                                                 sword = Search word field
02031                                                                                 sword.selector = +.'.$pCSSSel.'-searchbox-sword
02032                                                                                 sword.attribs = TEXT,background-color,width
02033 
02034                                                                                 button = Submit button
02035                                                                                 button.selector = +.'.$pCSSSel.'-searchbox-button
02036                                                                                 button.attribs = TEXT,background-color,width
02037                                                                         }
02038                                                                 }
02039                                                                 ',$CSS_editor_code,'
02040                                                         }
02041                                                 '),1);
02042 
02043                                                 $this->addFileToFileArray($config["plus_not_staticTemplate"]?"ext_typoscript_setup.txt":$pathSuffix."static/setup.txt",$this->sPS('
02044                                                         plugin.'.$cN.' {
02045                                                                 CMD =
02046                                                                 pidList =
02047                                                                 recursive =
02048                                                         }
02049                                                         plugin.'.$cN.'.listView {
02050                                                                 results_at_a_time =
02051                                                                 maxPages =
02052                                                         }
02053                                                           # Example of default set CSS styles (these go into the document header):
02054                                                         plugin.'.$cN.'._CSS_DEFAULT_STYLE (
02055                                                           .'.$pCSSSel.' H2 { margin-top: 0px; margin-bottom: 0px; }
02056                                                         )
02057                                                           # Example of how to overrule LOCAL_LANG values for the plugin:
02058                                                         plugin.'.$cN.'._LOCAL_LANG.default {
02059                                                           pi_list_searchBox_search = Search!
02060                                                         }
02061                                                           # Example of how to set default values from TS in the incoming array, $this->piVars of the plugin:
02062                                                         plugin.'.$cN.'._DEFAULT_PI_VARS.test = test
02063                                                 '),1);
02064 
02065                                                 $this->EM_CONF_presets["clearCacheOnLoad"]=1;
02066 
02067                                                 if (!$config["plus_not_staticTemplate"])        {
02068                                                         $this->ext_tables[]=$this->sPS('
02069                                                                 t3lib_extMgm::addStaticFile($_EXTKEY,"'.$pathSuffix.'static/","'.addslashes(trim($config['title'])).'");
02070                                                         ');
02071                                                 }
02072                                         }
02073                                 } else {
02074                                                 // Add title to local lang file
02075                                         $ll=$this->addStdLocalLangConf($ll,$k,1);
02076                                         $this->addLocalConf($ll,array("submit_button_label"=>"Click here to submit value"),"submit_button_label","pi",$k,1,1);
02077 
02078                                         $this->addLocalLangFile($ll,$pathSuffix."locallang.php",'Language labels for plugin "'.$cN.'"');
02079 
02080 
02081                                         $innerMainContent = $this->sPS('
02085                                                 function main($content,$conf)   {
02086                                                         $this->conf=$conf;
02087                                                         $this->pi_setPiVarDefaults();
02088                                                         $this->pi_loadLL();
02089                                                         '.(!$cache ? '$this->pi_USER_INT_obj=1; // Configuring so caching is not expected. This value means that no cHash params are ever set. We do this, because it\'s a USER_INT object!' : '').'
02090 
02091                                                         $content=\'
02092                                                                 <strong>This is a few paragraphs:</strong><BR>
02093                                                                 <p>This is line 1</p>
02094                                                                 <p>This is line 2</p>
02095 
02096                                                                 <h3>This is a form:</h3>
02097                                                                 <form action="\'.$this->pi_getPageLink($GLOBALS["TSFE"]->id).\'" method="POST">
02098                                                                         <input type="hidden" name="no_cache" value="1">
02099                                                                         <input type="text" name="\'.$this->prefixId.\'[input_field]" value="\'.htmlspecialchars($this->piVars["input_field"]).\'">
02100                                                                         <input type="submit" name="\'.$this->prefixId.\'[submit_button]" value="\'.htmlspecialchars($this->pi_getLL("submit_button_label")).\'">
02101                                                                 </form>
02102                                                                 <BR>
02103                                                                 <p>You can click here to \'.$this->pi_linkToPage("get to this page again",$GLOBALS["TSFE"]->id).\'</p>
02104                                                         \';
02105 
02106                                                         return $this->pi_wrapInBaseClass($content);
02107                                                 }
02108                                         ');
02109 
02110 
02111                                         $CSS_editor_code="";
02112                                         $pCSSSel = str_replace("_","-",$cN);
02113 
02114                                         $this->addFileToFileArray($config["plus_not_staticTemplate"]?"ext_typoscript_editorcfg.txt":$pathSuffix."static/editorcfg.txt",$this->sPS('
02115                                                 plugin.'.$cN.'.CSS_editor = Plugin: "'.$cN.'"
02116                                                 plugin.'.$cN.'.CSS_editor.selector = .'.$pCSSSel.'
02117                                                 plugin.'.$cN.'.CSS_editor.exampleWrap = <HR><strong>Plugin: "'.$cN.'"</strong><HR><div class="'.$pCSSSel.'"> | </div>
02118                                                 plugin.'.$cN.'.CSS_editor.ch {
02119                                                         P = Text
02120                                                         P.selector = P
02121                                                         P.attribs = BODYTEXT
02122                                                         P.example = <p>General text wrapped in &lt;P&gt;:<BR>This is text <a href="#">with a link</a> in it. In principio creavit Deus caelum et terram terra autem erat inanis et vacua et tenebrae super faciem abyssi et spiritus...</p>
02123                                                         P.exampleStop = 1
02124                                                         P.ch.links = < CSS_editor.ch.A
02125 
02126                                                         H3 = Header 3
02127                                                         H3.selector = H3
02128                                                         H3.attribs = HEADER
02129                                                         H3.example = <h3>Header 3 example <a href="#"> with link</a></h3><p>Bodytext, Et praeessent diei ac nocti et dividerent lucem ac tenebras et vidit Deus quod esset bonum et factum est...</p>
02130                                                         H3.ch.links = < CSS_editor.ch.A
02131                                                         H3.exampleStop = 1
02132                                                 }
02133                                         '),1);
02134 
02135                                         if (!$config["plus_not_staticTemplate"])        {
02136                                                 $this->ext_tables[]=$this->sPS('
02137                                                         t3lib_extMgm::addStaticFile($_EXTKEY,"'.$pathSuffix.'static/","'.addslashes(trim($config['title'])).'");
02138                                                 ');
02139                                         }
02140                                 }
02141                         break;
02142                         case "textbox":
02143                                 $this->ext_localconf[]=$this->sPS('
02144                                           ## Setting TypoScript for the image in the textbox:
02145                                         t3lib_extMgm::addTypoScript($_EXTKEY,"setup","
02146                                                 plugin.'.$cN.'_pi'.$k.'.IMAGEcObject {
02147                                                   file.width=100
02148                                                 }
02149                                         ",43);
02150                                 ');
02151 
02152                                 $innerMainContent = $this->sPS('
02156                                         function main($content,$conf)   {
02157 
02158                                                         // Processes the image-field content:
02159                                                         // $conf["IMAGEcObject."] is passed to the getImage() function as TypoScript
02160                                                         // configuration for the image (except filename which is set automatically here)
02161                                                 $imageFiles = explode(",",$this->cObj->data["image"]);  // This returns an array with image-filenames, if many
02162                                                 $imageRows=array();     // Accumulates the images
02163                                                 reset($imageFiles);
02164                                                 while(list(,$iFile)=each($imageFiles))  {
02165                                                         $imageRows[] = "<tr>
02166                                                                 <td>".$this->getImage($iFile,$conf["IMAGEcObject."])."</td>
02167                                                         </tr>";
02168                                                 }
02169                                                 $imageBlock = count($imageRows)?\'<table border=0 cellpadding=5 cellspacing=0>\'.implode("",$imageRows).\'</table>\':\'<img src=clear.gif width=100 height=1>\';
02170 
02171                                                         // Sets bodytext
02172                                                 $bodyText = nl2br($this->cObj->data["bodytext"]);
02173 
02174                                                         // And compiles everything into a table:
02175                                                 $finalContent = \'<table border=1>
02176                                                         <tr>
02177                                                                 <td valign=top>\'.$imageBlock.\'</td>
02178                                                                 <td valign=top>\'.$bodyText.\'</td>
02179                                                         </tr>
02180                                                 </table>\';
02181 
02182                                                         // And returns content
02183                                                 return $finalContent;
02184                                         }
02189                                         function getImage($filename,$TSconf)    {
02190                                                 list($theImage)=explode(",",$filename);
02191                                                 $TSconf["file"] = "uploads/pics/".$theImage;
02192                                                 $img = $this->cObj->IMAGE($TSconf);
02193                                                 return $img;
02194                                         }
02195                                 ');
02196                         break;
02197                         case "header":
02198                                 $innerMainContent = $this->sPS('
02202                                         function main($content,$conf)   {
02203                                                 return "<H1>".$this->cObj->data["header"]."</H1>";
02204                                         }
02205                                 ');
02206                         break;
02207                         case "menu_sitemap":
02208                                 $innerMainContent = $this->sPS('
02209 
02213                                         function main($content,$conf)   {
02214                                                         // Get the PID from which to make the menu.
02215                                                         // If a page is set as reference in the \'Startingpoint\' field, use that
02216                                                         // Otherwise use the page\'s id-number from TSFE
02217                                                 $menuPid = intval($this->cObj->data["pages"]?$this->cObj->data["pages"]:$GLOBALS["TSFE"]->id);
02218 
02219                                                         // Now, get an array with all the subpages to this pid:
02220                                                         // (Function getMenu() is found in class.t3lib_page.php)
02221                                                 $menuItems_level1 = $GLOBALS["TSFE"]->sys_page->getMenu($menuPid);
02222 
02223                                                         // Prepare vars:
02224                                                 $tRows=array();
02225 
02226                                                         // Traverse menuitems:
02227                                                 reset($menuItems_level1);
02228                                                 while(list($uid,$pages_row)=each($menuItems_level1))    {
02229                                                         $tRows[]=\'<tr bgColor="#cccccc"><td>\'.$this->pi_linkToPage(
02230                                                                 $pages_row["nav_title"]?$pages_row["nav_title"]:$pages_row["title"],
02231                                                                 $pages_row["uid"],
02232                                                                 $pages_row["target"]
02233                                                         ).\'</td></tr>\';
02234                                                 }
02235 
02236                                                 $totalMenu = \'<table border=0 cellpadding=0 cellspacing=2>
02237                                                         <tr><td>This is a menu. Go to your favourite page:</td></tr>
02238                                                         \'.implode(\'\',$tRows).
02239                                                         \'</table><BR>(\'.$this->tellWhatToDo(\'Click here if you want to know where to change the menu design\').\')\';
02240 
02241                                                 return $totalMenu;
02242                                         }
02243 
02244                                         function tellWhatToDo($str)     {
02245                                                 return \'<a href="#" onClick="alert(\\\'Open the PHP-file \'.t3lib_extMgm::siteRelPath("'.$extKey.'").\''.$pathSuffix.'class.'.$cN.'.php and edit the function main()\nto change how the menu is rendered! It is pure PHP coding!\\\')">\'.$str.\'</a>\';
02246                                         }
02247                                 ');
02248                         break;
02249                         case "typotags":
02250                                 $innerMainContent = $this->sPS('
02254                                         function main($content,$conf)   {
02255                                                 $tag_content = $this->cObj->getCurrentVal();
02256                                                 return "<b>".$this->tellWhatToDo(strtoupper($tag_content))."</b>";
02257                                         }
02258                                         function tellWhatToDo($str)     {
02259                                                 return \'<a href="#" onClick="alert(\\\'Open the PHP-file \'.t3lib_extMgm::siteRelPath("'.$extKey.'").\''.$pathSuffix.'class.'.$cN.'.php and edit the function main()\nto change how the tag content is processed!\\\')">\'.$str.\'</a>\';
02260                                         }
02261                                 ');
02262                         break;
02263                         default:
02264                                 $innerMainContent = $this->sPS('
02268                                         function main($content,$conf)   {
02269                                                 return "Hello World!<HR>
02270                                                         Here is the TypoScript passed to the method:".
02271                                                                         t3lib_div::view_array($conf);
02272                                         }
02273                                 ');
02274                         break;
02275                 }
02276                 $indexContent= $this->wrapBody('
02277                         require_once(PATH_tslib."class.tslib_pibase.php");
02278 
02279                         class '.$cN.' extends tslib_pibase {
02280                                 var $prefixId = "'.$cN.'";              // Same as class name
02281                                 var $scriptRelPath = "'.($pathSuffix."class.".$cN.".php").'";   // Path to this script relative to the extension dir.
02282                                 var $extKey = "'.$extKey.'";    // The extension key.
02283 
02284                                 ',$innerMainContent,'
02285                         }
02286                 ');
02287                 $this->addFileToFileArray($pathSuffix."class.".$cN.".php",$this->PHPclassFile($extKey,$pathSuffix."class.".$cN.".php",$indexContent,"Plugin '".$config["title"]."' for the '".$extKey."' extension."));
02288 
02289                         // Add wizard?
02290                 if ($config["plus_wiz"] && $config["addType"]=="list_type")     {
02291                         $this->addLocalConf($this->ext_locallang,$config,"title","pi",$k);
02292                         $this->addLocalConf($this->ext_locallang,$config,"plus_wiz_description","pi",$k);
02293 
02294                         $indexContent= $this->sPS('
02295                                 class '.$cN.'_wizicon {
02296                                         function proc($wizardItems)     {
02297                                                 global $LANG;
02298 
02299                                                 $LL = $this->includeLocalLang();
02300 
02301                                                 $wizardItems["plugins_'.$cN.'"] = array(
02302                                                         "icon"=>t3lib_extMgm::extRelPath("'.$extKey.'")."'.$pathSuffix.'ce_wiz.gif",
02303                                                         "title"=>$LANG->getLLL("pi'.$k.'_title",$LL),
02304                                                         "description"=>$LANG->getLLL("pi'.$k.'_plus_wiz_description",$LL),
02305                                                         "params"=>"&defVals[tt_content][CType]=list&defVals[tt_content][list_type]='.$extKey.'_pi'.$k.'"
02306                                                 );
02307 
02308                                                 return $wizardItems;
02309                                         }
02310                                         function includeLocalLang()     {
02311                                                 include(t3lib_extMgm::extPath("'.$extKey.'")."locallang.php");
02312                                                 return $LOCAL_LANG;
02313                                         }
02314                                 }
02315                         ');
02316                         $this->addFileToFileArray($pathSuffix."class.".$cN."_wizicon.php",$this->PHPclassFile($extKey,$pathSuffix."class.".$cN."_wizicon.php",$indexContent,"Class that adds the wizard icon."));
02317 
02318                                 // Add wizard icon
02319                         $this->addFileToFileArray($pathSuffix."ce_wiz.gif",t3lib_div::getUrl(t3lib_extMgm::extPath("kickstarter")."res/wiz.gif"));
02320 
02321                                 // Add clear.gif
02322                         $this->addFileToFileArray($pathSuffix."clear.gif",t3lib_div::getUrl(t3lib_extMgm::extPath("kickstarter")."res/clear.gif"));
02323 
02324                         $this->ext_tables[]=$this->sPS('
02325                                 '.$this->WOPcomment('WOP:'.$WOP.'[plus_wiz]:').'
02326                                 if (TYPO3_MODE=="BE")   $TBE_MODULES_EXT["xMOD_db_new_content_el"]["addElClasses"]["'.$cN.'_wizicon"] = t3lib_extMgm::extPath($_EXTKEY)."pi'.$k.'/class.'.$cN.'_wizicon.php";
02327                         ');
02328                 }
02329         }
02330 
02334         function renderExtPart_SV($k,$config,$extKey)   {
02335                 $WOP='[sv]['.$k.']';
02336                 $cN = $this->returnName($extKey,'class','sv'.$k);
02337                 $pathSuffix = 'sv'.$k.'/';
02338 
02339                 $this->ext_tables[]=$this->sPS('
02340                         '.$this->WOPcomment('WOP:'.$WOP.'[type]').'
02341                         t3lib_extMgm::addService($_EXTKEY,  \''.$config['type'].'\' /* sv type */,  \''.$cN.'\' /* sv key */,
02342                                         array(
02343 
02344                                                 \'title\' => \''.addslashes($config['title']).'\','.$this->WOPcomment(' WOP:'.$WOP.'[title]').'
02345                                                 \'description\' => \''.addslashes($config['description']).'\','.$this->WOPcomment('     WOP:'.$WOP.'[description]').'
02346 
02347                                                 \'subtype\' => \''.$config['subtype'].'\','.$this->WOPcomment(' WOP:'.$WOP.'[subtype]').'
02348 
02349                                                 \'available\' => TRUE,
02350                                                 \'priority\' => '.$config['priority'].','.$this->WOPcomment('   WOP:'.$WOP.'[priority]').'
02351                                                 \'quality\' => '.$config['quality'].','.$this->WOPcomment('     WOP:'.$WOP.'[quality]').'
02352 
02353                                                 \'os\' => \''.$config['os'].'\','.$this->WOPcomment('   WOP:'.$WOP.'[os]').'
02354                                                 \'exec\' => \''.$config['exec'].'\','.$this->WOPcomment('       WOP:'.$WOP.'[exec]').'
02355 
02356                                                 \'classFile\' => t3lib_extMgm::extPath($_EXTKEY).\'sv'.$k.'/class.'.$cN.'.php\',
02357                                                 \'className\' => \''.$cN.'\',
02358                                         )
02359                                 );
02360                 ');
02361 
02362                 $innerMainContent = $this->sPS('
02363 
02367                         function init() {
02368                                 $available = parent::init();
02369 
02370                                 // Here you can initialize your class.
02371 
02372                                 // The class have to do a strict check if the service is available.
02373                                 // The needed external programs are already checked in the parent class.
02374 
02375                                 // If there\'s no reason for initialization you can remove this function.
02376 
02377                                 return $available;
02378                         }
02379 
02389                         function process($content=\'\', $type=\'\', $conf=array())      {
02390 
02391                                 // Depending on the service type there\'s not a process() function.
02392                                 // You have to implement the API of that service type.
02393 
02394                                 return FALSE;
02395                         }
02396                 ');
02397 
02398                 $indexContent= $this->wrapBody('
02399                         require_once(PATH_t3lib.\'class.t3lib_svbase.php\');
02400 
02401                         class '.$cN.' extends t3lib_svbase {
02402                                 var $prefixId = \''.$cN.'\';            // Same as class name
02403                                 var $scriptRelPath = \''.($pathSuffix.'class.'.$cN.'.php').'\'; // Path to this script relative to the extension dir.
02404                                 var $extKey = \''.$extKey.'\';  // The extension key.
02405 
02406                                 ',$innerMainContent,'
02407                         }
02408                 ');
02409                 $this->addFileToFileArray($pathSuffix."class.".$cN.".php",$this->PHPclassFile($extKey,$pathSuffix."class.".$cN.".php",$indexContent,"Service '".$config['title']."' for the '".$extKey."' extension."));
02410         }
02411 
02415         function renderExtPart_module($k,$config,$extKey)       {
02416                 $WOP="[module][".$k."]";
02417                 $mN = ($config["position"]!="_MAIN"?$config["position"]."_":"").$this->returnName($extKey,"module","M".$k);
02418                 $cN = $this->returnName($extKey,"class","module".$k);
02419                 $pathSuffix = "mod".$k."/";
02420 
02421                         // Insert module:
02422                 switch($config["subpos"])       {
02423                         case "top":
02424                                 $subPos="top";
02425                         break;
02426                         case "web_after_page":
02427                                 $subPos="after:layout";
02428                         break;
02429                         case "web_before_info":
02430                                 $subPos="before:info";
02431                         break;
02432                 }
02433                 $this->ext_tables[]=$this->sPS('
02434                         '.$this->WOPcomment('WOP:'.$WOP).'
02435                         if (TYPO3_MODE=="BE")   {
02436                                         '.$this->WOPcomment('1. and 2. parameter is WOP:'.$WOP.'[position] , 3. parameter is WOP:'.$WOP.'[subpos]').'
02437                                 t3lib_extMgm::addModule("'.
02438                                         ($config["position"]!="_MAIN"?$config["position"]:$this->returnName($extKey,"module","M".$k)).
02439                                         '","'.
02440                                         ($config["position"]!="_MAIN"?$this->returnName($extKey,"module","M".$k):"").
02441                                         '","'.
02442                                         $subPos.
02443                                         '",t3lib_extMgm::extPath($_EXTKEY)."'.$pathSuffix.'");
02444                         }
02445                 ');
02446 
02447                         // Make conf.php file:
02448                 $content = $this->sPS('
02449                                 // DO NOT REMOVE OR CHANGE THESE 3 LINES:
02450                         define("TYPO3_MOD_PATH", "ext/'.$extKey.'/'.$pathSuffix.'");
02451                         $BACK_PATH="../../../";
02452                         $MCONF["name"]="'.$mN.'";
02453 
02454                                 '.$this->WOPcomment('WOP:'.$WOP.'[admin_only]: If the flag was set the value is "admin", otherwise "user,group"').'
02455                         $MCONF["access"]="'.($config["admin_only"]?"admin":"user,group").'";
02456                         $MCONF["script"]="index.php";
02457 
02458                         $MLANG["default"]["tabs_images"]["tab"] = "moduleicon.gif";
02459                         $MLANG["default"]["ll_ref"]="LLL:EXT:'.$extKey.'/'.$pathSuffix.'locallang_mod.php";
02460                 ');
02461                 $this->EM_CONF_presets["module"][]=ereg_replace("\/$","",$pathSuffix);
02462 
02463 
02464                 $ll=array();
02465                 $this->addLocalConf($ll,$config,"title","module",$k,1,0,"mlang_tabs_tab");
02466                 $this->addLocalConf($ll,$config,"description","module",$k,1,0,"mlang_labels_tabdescr");
02467                 $this->addLocalConf($ll,$config,"tablabel","module",$k,1,0,"mlang_labels_tablabel");
02468                 $this->addLocalLangFile($ll,$pathSuffix."locallang_mod.php",'Language labels for module "'.$mN.'" - header, description');
02469 
02470 //                      $MLANG["default"]["tabs"]["tab"] = "'.addslashes($config["title"]).'";  '.$this->WOPcomment('WOP:'.$WOP.'[title]').'
02471 //                      $MLANG["default"]["labels"]["tabdescr"] = "'.addslashes($config["description"]).'";     '.$this->WOPcomment('WOP:'.$WOP.'[description]').'
02472 //                      $MLANG["default"]["labels"]["tablabel"] = "'.addslashes($config["tablabel"]).'";        '.$this->WOPcomment('WOP:'.$WOP.'[tablabel]').'
02473 
02474 /*
02475                 if (count($this->selectedLanguages))    {
02476                         reset($this->selectedLanguages);
02477                         while(list($lk,$lv)=each($this->selectedLanguages))     {
02478                                 if ($lv)        {
02479                                         $content.= $this->sPS('
02480                                                         // '.$this->languages[$lk].' language:
02481                                                 $MLANG["'.$lk.'"]["tabs"]["tab"] = "'.addslashes($config["title_".$lk]).'";     '.$this->WOPcomment('WOP:'.$WOP.'[title_'.$lk.']').'
02482                                                 $MLANG["'.$lk.'"]["labels"]["tabdescr"] = "'.addslashes($config["description_".$lk]).'";        '.$this->WOPcomment('WOP:'.$WOP.'[description_'.$lk.']').'
02483                                                 $MLANG["'.$lk.'"]["labels"]["tablabel"] = "'.addslashes($config["tablabel_".$lk]).'";   '.$this->WOPcomment('WOP:'.$WOP.'[tablabel_'.$lk.']').'
02484                                         ');
02485                                 }
02486                         }
02487                 }
02488 */
02489                 $content=$this->wrapBody('
02490                         <?php
02491                         ',$content,'
02492                         ?>
02493                 ',0);
02494 
02495                 $this->addFileToFileArray($pathSuffix."conf.php",trim($content));
02496 
02497                         // Add title to local lang file
02498                 $ll=array();
02499                 $this->addLocalConf($ll,$config,"title","module",$k,1);
02500                 $this->addLocalConf($ll,array("function1"=>"Function #1"),"function1","module",$k,1,1);
02501                 $this->addLocalConf($ll,array("function2"=>"Function #2"),"function2","module",$k,1,1);
02502                 $this->addLocalConf($ll,array("function3"=>"Function #3"),"function3","module",$k,1,1);
02503                 $this->addLocalLangFile($ll,$pathSuffix."locallang.php",'Language labels for module "'.$mN.'"');
02504 
02505                         // Add clear.gif
02506                 $this->addFileToFileArray($pathSuffix."clear.gif",t3lib_div::getUrl(t3lib_extMgm::extPath("kickstarter")."res/clear.gif"));
02507 
02508                         // Add clear.gif
02509                 $this->addFileToFileArray($pathSuffix."moduleicon.gif",t3lib_div::getUrl(t3lib_extMgm::extPath("kickstarter")."res/notfound_module.gif"));
02510 
02511 
02512                         // Make module index.php file:
02513                 $indexContent = $this->sPS('
02514                                 // DEFAULT initialization of a module [BEGIN]
02515                         unset($MCONF);
02516                         require ("conf.php");
02517                         require ($BACK_PATH."init.php");
02518                         require ($BACK_PATH."template.php");
02519                         $LANG->includeLLFile("EXT:'.$extKey.'/'.$pathSuffix.'locallang.php");
02520                         #include ("locallang.php");
02521                         require_once (PATH_t3lib."class.t3lib_scbase.php");
02522                         $BE_USER->modAccess($MCONF,1);  // This checks permissions and exits if the users has no permission for entry.
02523                                 // DEFAULT initialization of a module [END]
02524                 ');
02525 
02526                 $indexContent.= $this->sPS('
02527                         class '.$cN.' extends t3lib_SCbase {
02528                                 var $pageinfo;
02529 
02533                                 function init() {
02534                                         global $BE_USER,$LANG,$BACK_PATH,$TCA_DESCR,$TCA,$CLIENT,$TYPO3_CONF_VARS;
02535 
02536                                         parent::init();
02537 
02538                                         /*
02539                                         if (t3lib_div::_GP("clear_all_cache"))  {
02540                                                 $this->include_once[]=PATH_t3lib."class.t3lib_tcemain.php";
02541                                         }
02542                                         */
02543                                 }
02544 
02548                                 function menuConfig()   {
02549                                         global $LANG;
02550                                         $this->MOD_MENU = Array (
02551                                                 "function" => Array (
02552                                                         "1" => $LANG->getLL("function1"),
02553                                                         "2" => $LANG->getLL("function2"),
02554                                                         "3" => $LANG->getLL("function3"),
02555                                                 )
02556                                         );
02557                                         parent::menuConfig();
02558                                 }
02559 
02560                                         // If you chose "web" as main module, you will need to consider the $this->id parameter which will contain the uid-number of the page clicked in the page tree
02564                                 function main() {
02565                                         global $BE_USER,$LANG,$BACK_PATH,$TCA_DESCR,$TCA,$CLIENT,$TYPO3_CONF_VARS;
02566 
02567                                         // Access check!
02568                                         // The page will show only if there is a valid page and if this page may be viewed by the user
02569                                         $this->pageinfo = t3lib_BEfunc::readPageAccess($this->id,$this->perms_clause);
02570                                         $access = is_array($this->pageinfo) ? 1 : 0;
02571 
02572                                         if (($this->id && $access) || ($BE_USER->user["admin"] && !$this->id))  {
02573 
02574                                                         // Draw the header.
02575                                                 $this->doc = t3lib_div::makeInstance("mediumDoc");
02576                                                 $this->doc->backPath = $BACK_PATH;
02577                                                 $this->doc->form=\'<form action="" method="POST">\';
02578 
02579                                                         // JavaScript
02580                                                 $this->doc->JScode = \'
02581                                                         <script language="javascript" type="text/javascript">
02582                                                                 script_ended = 0;
02583                                                                 function jumpToUrl(URL) {
02584                                                                         document.location = URL;
02585                                                                 }
02586                                                         </script>
02587                                                 \';
02588                                                 $this->doc->postCode=\'
02589                                                         <script language="javascript" type="text/javascript">
02590                                                                 script_ended = 1;
02591                                                                 if (top.fsMod) top.fsMod.recentIds["web"] = \'.intval($this->id).\';
02592                                                         </script>
02593                                                 \';
02594 
02595                                                 $headerSection = $this->doc->getHeader("pages",$this->pageinfo,$this->pageinfo["_thePath"])."<br>".$LANG->sL("LLL:EXT:lang/locallang_core.php:labels.path").": ".t3lib_div::fixed_lgd_pre($this->pageinfo["_thePath"],50);
02596 
02597                                                 $this->content.=$this->doc->startPage($LANG->getLL("title"));
02598                                                 $this->content.=$this->doc->header($LANG->getLL("title"));
02599                                                 $this->content.=$this->doc->spacer(5);
02600                                                 $this->content.=$this->doc->section("",$this->doc->funcMenu($headerSection,t3lib_BEfunc::getFuncMenu($this->id,"SET[function]",$this->MOD_SETTINGS["function"],$this->MOD_MENU["function"])));
02601                                                 $this->content.=$this->doc->divider(5);
02602 
02603 
02604                                                 // Render content:
02605                                                 $this->moduleContent();
02606 
02607 
02608                                                 // ShortCut
02609                                                 if ($BE_USER->mayMakeShortcut())        {
02610                                                         $this->content.=$this->doc->spacer(20).$this->doc->section("",$this->doc->makeShortcutIcon("id",implode(",",array_keys($this->MOD_MENU)),$this->MCONF["name"]));
02611                                                 }
02612 
02613                                                 $this->content.=$this->doc->spacer(10);
02614                                         } else {
02615                                                         // If no access or if ID == zero
02616 
02617                                                 $this->doc = t3lib_div::makeInstance("mediumDoc");
02618                                                 $this->doc->backPath = $BACK_PATH;
02619 
02620                                                 $this->content.=$this->doc->startPage($LANG->getLL("title"));
02621                                                 $this->content.=$this->doc->header($LANG->getLL("title"));
02622                                                 $this->content.=$this->doc->spacer(5);
02623                                                 $this->content.=$this->doc->spacer(10);
02624                                         }
02625                                 }
02626 
02630                                 function printContent() {
02631 
02632                                         $this->content.=$this->doc->endPage();
02633                                         echo $this->content;
02634                                 }
02635 
02639                                 function moduleContent()        {
02640                                         switch((string)$this->MOD_SETTINGS["function"]) {
02641                                                 case 1:
02642                                                         $content="<div align=center><strong>Hello World!</strong></div><BR>
02643                                                                 The \'Kickstarter\' has made this module automatically, it contains a default framework for a backend module but apart from it does nothing useful until you open the script \'".substr(t3lib_extMgm::extPath("'.$extKey.'"),strlen(PATH_site))."'.$pathSuffix.'index.php\' and edit it!
02644                                                                 <HR>
02645                                                                 <BR>This is the GET/POST vars sent to the script:<BR>".
02646                                                                 "GET:".t3lib_div::view_array($_GET)."<BR>".
02647                                                                 "POST:".t3lib_div::view_array($_POST)."<BR>".
02648                                                                 "";
02649                                                         $this->content.=$this->doc->section("Message #1:",$content,0,1);
02650                                                 break;
02651                                                 case 2:
02652                                                         $content="<div align=center><strong>Menu item #2...</strong></div>";
02653                                                         $this->content.=$this->doc->section("Message #2:",$content,0,1);
02654                                                 break;
02655                                                 case 3:
02656                                                         $content="<div align=center><strong>Menu item #3...</strong></div>";
02657                                                         $this->content.=$this->doc->section("Message #3:",$content,0,1);
02658                                                 break;
02659                                         }
02660                                 }
02661                         }
02662                 ');
02663 
02664                 $SOBE_extras["firstLevel"]=0;
02665                 $SOBE_extras["include"]=1;
02666                 $this->addFileToFileArray($pathSuffix."index.php",$this->PHPclassFile($extKey,$pathSuffix."index.php",$indexContent,"Module '".$config["title"]."' for the '".$extKey."' extension.",$cN,$SOBE_extras));
02667 
02668         }
02669 
02673         function renderExtPart_moduleFunction($k,$config,$extKey)       {
02674                 $WOP="[moduleFunction][".$k."]";
02675                 $cN = $this->returnName($extKey,"class","modfunc".$k);
02676                 $pathSuffix = "modfunc".$k."/";
02677 
02678                 $position =$config["position"];
02679                 $subPos="";
02680                 switch($config["position"])     {
02681                         case "user_task";
02682                                 $this->EM_CONF_presets["dependencies"][]="taskcenter";
02683                         break;
02684                         case "web_ts";
02685                                 $this->EM_CONF_presets["dependencies"][]="tstemplate";
02686                         break;
02687                         case "web_func_wizards";
02688                                 $this->EM_CONF_presets["dependencies"][]="func_wizards";
02689                                 $position="web_func";
02690                                 $subPos="wiz";
02691                         break;
02692                 }
02693 
02694                 $this->ext_tables[]=$this->sPS('
02695                         if (TYPO3_MODE=="BE")   {
02696                                 t3lib_extMgm::insertModuleFunction(
02697                                         "'.$position.'",                '.$this->WOPcomment('WOP:'.$WOP.'[position]').'
02698                                         "'.$cN.'",
02699                                         t3lib_extMgm::extPath($_EXTKEY)."'.$pathSuffix.'class.'.$cN.'.php",
02700                                         "'.addslashes($this->getSplitLabels_reference($config,"title","moduleFunction.".$cN)).'"'.($subPos?',
02701                                         "'.$subPos.'"   '.$this->WOPcomment('WOP:'.$WOP.'[position]'):'').'
02702                                 );
02703                         }
02704                 ');
02705 
02706 
02707                         // Add title to local lang file
02708                 $ll=array();
02709                 $this->addLocalConf($ll,$config,"title","module",$k,1);
02710                 $this->addLocalConf($ll,array("checklabel"=>"Check box #1"),"checklabel","modfunc",$k,1,1);
02711                 $this->addLocalLangFile($ll,$pathSuffix."locallang.php",'Language labels for module "'.$mN.'"');
02712 
02713                 if ($position!="user_task")     {
02714                         $indexContent.= $this->sPS('
02715                                 require_once(PATH_t3lib."class.t3lib_extobjbase.php");
02716 
02717                                 class '.$cN.' extends t3lib_extobjbase {
02718                                         function modMenu()      {
02719                                                 global $LANG;
02720 
02721                                                 return Array (
02722                                                         "'.$cN.'_check" => "",
02723                                                 );
02724                                         }
02725 
02726                                         function main() {
02727                                                         // Initializes the module. Done in this function because we may need to re-initialize if data is submitted!
02728                                                 global $SOBE,$BE_USER,$LANG,$BACK_PATH,$TCA_DESCR,$TCA,$CLIENT,$TYPO3_CONF_VARS;
02729 
02730                                                 $theOutput.=$this->pObj->doc->spacer(5);
02731                                                 $theOutput.=$this->pObj->doc->section($LANG->getLL("title"),"Dummy content here...",0,1);
02732 
02733                                                 $menu=array();
02734                                                 $menu[]=t3lib_BEfunc::getFuncCheck($this->pObj->id,"SET['.$cN.'_check]",$this->pObj->MOD_SETTINGS["'.$cN.'_check"]).$LANG->getLL("checklabel");
02735                                                 $theOutput.=$this->pObj->doc->spacer(5);
02736                                                 $theOutput.=$this->pObj->doc->section("Menu",implode(" - ",$menu),0,1);
02737 
02738                                                 return $theOutput;
02739                                         }
02740                                 }
02741                         ');
02742                 } else {
02743                         $indexContent.= $this->sPS('
02744                                 class '.$cN.' extends mod_user_task {
02748                                         function overview_main(&$pObj)  {
02749                                                 $icon = \'<img src="\'.$this->backPath.t3lib_extMgm::extRelPath("'.$extKey.'").\'ext_icon.gif" width=18 height=16 class="absmiddle">\';
02750                                                 $content.=$pObj->doc->section($icon."&nbsp;".$this->headLink("'.$cN.'",0),$this->overviewContent(),1,1);
02751                                                 return $content;
02752                                         }
02753                                         function main() {
02754                                                 global $BE_USER,$LANG,$BACK_PATH,$TCA_DESCR,$TCA,$CLIENT,$TYPO3_CONF_VARS;
02755 
02756                                                 return $this->mainContent();
02757                                         }
02758                                         function overviewContent()      {
02759                                                 return "Content in overview frame...";
02760                                         }
02761                                         function mainContent()  {
02762                                                 return "Content in main frame...";
02763                                         }
02764                                 }
02765                         ');
02766                 }
02767 
02768                 $this->addFileToFileArray($pathSuffix."class.".$cN.".php",$this->PHPclassFile($extKey,$pathSuffix."class.".$cN.".php",$indexContent,"Module extension (addition to function menu) '".$config["title"]."' for the '".$extKey."' extension."));
02769         }
02770 
02774         function renderExtPart_cm($k,$config,$extKey)   {
02775                 $WOP="[cm][".$k."]";
02776                 $cN = $this->returnName($extKey,"class","cm".$k);
02777                 $filename = 'class.'.$cN.'.php';
02778                 $pathSuffix = "cm".$k."/";
02779 
02780                         // This will make sure our item is inserted in the clickmenu!
02781                 $this->ext_tables[]=$this->sPS('
02782                         '.$this->WOPcomment('WOP:'.$WOP.':').'
02783                         if (TYPO3_MODE=="BE")   {
02784                                 $GLOBALS["TBE_MODULES_EXT"]["xMOD_alt_clickmenu"]["extendCMclasses"][]=array(
02785                                         "name" => "'.$cN.'",
02786                                         "path" => t3lib_extMgm::extPath($_EXTKEY)."'.$filename.'"
02787                                 );
02788                         }
02789                 ');
02790                         // Add title to the locallang file.
02791                 $this->addLocalConf($this->ext_locallang,$config,"title","cm",$k);
02792 
02793                         // Add icon
02794                 $this->addFileToFileArray($pathSuffix."cm_icon.gif",t3lib_div::getUrl(t3lib_extMgm::extPath("kickstarter")."res/notfound_module.gif"));
02795 
02796                         //      Building class:
02797                 $content = "";
02798                 $content.=$this->sPS('
02799                                 // Adds the regular item:
02800                         $LL = $this->includeLL();
02801 
02802                                 // Repeat this (below) for as many items you want to add!
02803                                 // Remember to add entries in the localconf.php file for additional titles.
02804                         $url = t3lib_extMgm::extRelPath("'.$extKey.'")."'.$pathSuffix.'index.php?id=".$uid;
02805                         $localItems[] = $backRef->linkItem(
02806                                 $GLOBALS["LANG"]->getLLL("cm'.$k.'_title",$LL),
02807                                 $backRef->excludeIcon(\'<img src="\'.t3lib_extMgm::extRelPath("'.$extKey.'").\''.$pathSuffix.'cm_icon.gif" width="15" height="12" border=0 align=top>\'),
02808                                 $backRef->urlRefForCM($url),
02809                                 1       // Disables the item in the top-bar. Set this to zero if you with the item to appear in the top bar!
02810                         );
02811                 ');
02812                 if ($config["second_level"])    {
02813                         $secondContent = $content;
02814                         $secondContent.=chr(10).'$menuItems=array_merge($menuItems,$localItems);';
02815 
02816                         $content = "";
02817                         $content.=$this->sPS('
02818                                 $LL = $this->includeLL();
02819 
02820                                 $localItems[]="spacer";
02821                                 $localItems["moreoptions_'.$cN.'"]=$backRef->linkItem(
02822                                         $GLOBALS["LANG"]->getLLL("cm'.$k.'_title_activate",$LL),
02823                                         $backRef->excludeIcon(\'<img src="\'.t3lib_extMgm::extRelPath("'.$extKey.'").\''.$pathSuffix.'cm_icon_activate.gif" width="15" height="12" border=0 align=top>\'),
02824                                         "top.loadTopMenu(\'".t3lib_div::linkThisScript()."&cmLevel=1&subname=moreoptions_'.$cN.'\');return false;",
02825                                         0,
02826                                         1
02827                                 );
02828                         ');
02829 
02830                                 // Add activate title to the locallang file.
02831                         $this->addLocalConf($this->ext_locallang,array("title_activate"=>"...Second level ->"),"title_activate","cm",$k,0,1);
02832                                 // Add activate icon
02833                         $this->addFileToFileArray($pathSuffix."cm_icon_activate.gif",t3lib_div::getUrl(t3lib_extMgm::extPath("kickstarter")."res/notfound_module.gif"));
02834                 }
02835 
02836                 if ($config["only_page"])       $content=$this->sPS('
02837                                 // Returns directly, because the clicked item was not from the pages table '.$this->WOPcomment('(WOP:'.$WOP.'[only_page])').'
02838                         if ($table!="pages")    return $menuItems;
02839                 ').$content;
02840 
02841                 $content.=$this->sPS('
02842                         '.$this->WOPcomment('(WOP:'.$WOP.'[options] BEGIN) Inserts the item at the chosen location').'
02843                 ');
02844                 if ($config["options"]=="top")  {       // In top:
02845                         $content.=$this->sPS('
02846                                 $menuItems=array_merge($localItems,$menuItems);
02847                         ');
02848                 } elseif ($config["options"]=="before_delete")  {       // Just before "Delete" and its preceding divider line:
02849                         $content.=$this->sPS('
02850                                         // Find position of "delete" element:
02851                                 reset($menuItems);
02852                                 $c=0;
02853                                 while(list($k)=each($menuItems))        {
02854                                         $c++;
02855                                         if (!strcmp($k,"delete"))       break;
02856                                 }
02857                                         // .. subtract two (delete item + divider line)
02858                                 $c-=2;
02859                                         // ... and insert the items just before the delete element.
02860                                 array_splice(
02861                                         $menuItems,
02862                                         $c,
02863                                         0,
02864                                         $localItems
02865                                 );
02866                         ');
02867                 } else  {       // In bottom (default):
02868                         $content.=$this->sPS('
02869                                 // Simply merges the two arrays together and returns ...
02870                                 $menuItems=array_merge($menuItems,$localItems);
02871                         ');
02872                 }
02873                 $content.=$this->sPS('
02874                         '.$this->WOPcomment('(WOP:'.$WOP.'[options] END)').'
02875                 ');
02876 
02877                 if ($config["only_if_edit"])    $content=$this->wrapBody('
02878                         if ($backRef->editOK)   {
02879                         ',$content,'
02880                         }
02881                 ');
02882 
02883 
02884                 if ($config["remove_view"])     $content.=$this->sPS('
02885                                 // Removes the view-item from clickmenu  '.$this->WOPcomment('(WOP:'.$WOP.'[remove_view])').'
02886                         unset($menuItems["view"]);
02887                 ');
02888 
02889                 $content=$this->wrapBody('
02890                         if (!$backRef->cmLevel) {
02891                         ',$content,'
02892                         }
02893                 ');
02894 
02895                 if ($config["second_level"])    {
02896                         $content.=$this->wrapBody('
02897                                 else {
02898                                 ',$secondContent,'
02899                                 }
02900                         ');
02901                 }
02902 
02903 
02904 
02905 
02906                         // Now wrap the function body around this:
02907                 $content=$this->wrapBody('
02908                         function main(&$backRef,$menuItems,$table,$uid) {
02909                                 global $BE_USER,$TCA,$LANG;
02910 
02911                                 $localItems = Array();
02912                                 ',$content,'
02913                                 return $menuItems;
02914                         }
02915                 ');
02916                         // Add include locallanguage function:
02917                 $content.=$this->addLLFunc($extKey);
02918 
02919                         // Now wrap the function body around this:
02920                 $content=$this->wrapBody('
02921                         class '.$cN.' {
02922                                 ',$content,'
02923                         }
02924                 ');
02925 
02926 
02927 #               $this->printPre($content);
02928 
02929                 $this->addFileToFileArray($filename,$this->PHPclassFile($extKey,$filename,$content,"Addition of an item to the clickmenu"));
02930 
02931 
02932                 $cN = $this->returnName($extKey,"class","cm".$k);
02933                 $this->writeStandardBE_xMod($extKey,$config,$pathSuffix,$cN,$k,"cm");
02934         }
02935 
02936         function writeStandardBE_xMod($extKey,$config,$pathSuffix,$cN,$k,$k_prefix)     {
02937                         // Make conf.php file:
02938                 $content = $this->sPS('
02939                                 // DO NOT REMOVE OR CHANGE THESE 3 LINES:
02940                         define("TYPO3_MOD_PATH", "ext/'.$extKey.'/'.$pathSuffix.'");
02941                         $BACK_PATH="../../../";
02942                         $MCONF["name"]="xMOD_'.$cN.'";
02943                 ');
02944                 $content=$this->wrapBody('
02945                         <?php
02946                         ',$content,'
02947                         ?>
02948                 ',0);
02949                 $this->addFileToFileArray($pathSuffix."conf.php",trim($content));
02950                 $this->EM_CONF_presets["module"][]=ereg_replace("\/$","",$pathSuffix);
02951 
02952                         // Add title to local lang file
02953                 $ll=array();
02954                 $this->addLocalConf($ll,$config,"title",$k_prefix,$k,1);
02955                 $this->addLocalConf($ll,array("function1"=>"Function #1"),"function1",$k_prefix,$k,1,1);
02956                 $this->addLocalConf($ll,array("function2"=>"Function #2"),"function2",$k_prefix,$k,1,1);
02957                 $this->addLocalConf($ll,array("function3"=>"Function #3"),"function3",$k_prefix,$k,1,1);
02958                 $this->addLocalLangFile($ll,$pathSuffix."locallang.php",'Language labels for '.$extKey.' module '.$k_prefix.$k);
02959 
02960                         // Add clear.gif
02961                 $this->addFileToFileArray($pathSuffix."clear.gif",t3lib_div::getUrl(t3lib_extMgm::extPath("kickstarter")."res/clear.gif"));
02962 
02963                         // Make module index.php file:
02964                 $indexContent = $this->sPS('
02965                                 // DEFAULT initialization of a module [BEGIN]
02966                         unset($MCONF);
02967                         require ("conf.php");
02968                         require ($BACK_PATH."init.php");
02969                         require ($BACK_PATH."template.php");
02970                         $LANG->includeLLFile("EXT:'.$extKey.'/'.$pathSuffix.'locallang.php");
02971                         #include ("locallang.php");
02972                         require_once (PATH_t3lib."class.t3lib_scbase.php");
02973                                 // ....(But no access check here...)
02974                                 // DEFAULT initialization of a module [END]
02975                 ');
02976 
02977                 $indexContent.= $this->sPS('
02978                         class '.$cN.' extends t3lib_SCbase {
02982                                 function menuConfig()   {
02983                                         global $LANG;
02984                                         $this->MOD_MENU = Array (
02985                                                 "function" => Array (
02986                                                         "1" => $LANG->getLL("function1"),
02987                                                         "2" => $LANG->getLL("function2"),
02988                                                         "3" => $LANG->getLL("function3"),
02989                                                 )
02990                                         );
02991                                         parent::menuConfig();
02992                                 }
02993 
02997                                 function main() {
02998                                         global $BE_USER,$LANG,$BACK_PATH,$TCA_DESCR,$TCA,$CLIENT,$TYPO3_CONF_VARS;
02999 
03000                                                 // Draw the header.
03001                                         $this->doc = t3lib_div::makeInstance("mediumDoc");
03002                                         $this->doc->backPath = $BACK_PATH;
03003                                         $this->doc->form=\'<form action="" method="POST">\';
03004 
03005                                                 // JavaScript
03006                                         $this->doc->JScode = \'
03007                                                 <script language="javascript" type="text/javascript">
03008                                                         script_ended = 0;
03009                                                         function jumpToUrl(URL) {
03010                                                                 document.location = URL;
03011                                                         }
03012                                                 </script>
03013                                         \';
03014 
03015                                         $this->pageinfo = t3lib_BEfunc::readPageAccess($this->id,$this->perms_clause);
03016                                         $access = is_array($this->pageinfo) ? 1 : 0;
03017                                         if (($this->id && $access) || ($BE_USER->user["admin"] && !$this->id))  {
03018                                                 if ($BE_USER->user["admin"] && !$this->id)      {
03019                                                         $this->pageinfo=array("title" => "[root-level]","uid"=>0,"pid"=>0);
03020                                                 }
03021 
03022                                                 $headerSection = $this->doc->getHeader("pages",$this->pageinfo,$this->pageinfo["_thePath"])."<br>".$LANG->sL("LLL:EXT:lang/locallang_core.php:labels.path").": ".t3lib_div::fixed_lgd_pre($this->pageinfo["_thePath"],50);
03023 
03024                                                 $this->content.=$this->doc->startPage($LANG->getLL("title"));
03025                                                 $this->content.=$this->doc->header($LANG->getLL("title"));
03026                                                 $this->content.=$this->doc->spacer(5);
03027                                                 $this->content.=$this->doc->section("",$this->doc->funcMenu($headerSection,t3lib_BEfunc::getFuncMenu($this->id,"SET[function]",$this->MOD_SETTINGS["function"],$this->MOD_MENU["function"])));
03028                                                 $this->content.=$this->doc->divider(5);
03029 
03030 
03031                                                 // Render content:
03032                                                 $this->moduleContent();
03033 
03034 
03035                                                 // ShortCut
03036                                                 if ($BE_USER->mayMakeShortcut())        {
03037                                                         $this->content.=$this->doc->spacer(20).$this->doc->section("",$this->doc->makeShortcutIcon("id",implode(",",array_keys($this->MOD_MENU)),$this->MCONF["name"]));
03038                                                 }
03039                                         }
03040                                         $this->content.=$this->doc->spacer(10);
03041                                 }
03042                                 function printContent() {
03043 
03044                                         $this->content.=$this->doc->endPage();
03045                                         echo $this->content;
03046                                 }
03047 
03048                                 function moduleContent()        {
03049                                         switch((string)$this->MOD_SETTINGS["function"]) {
03050                                                 case 1:
03051                                                         $content="<div align=center><strong>Hello World!</strong></div><BR>
03052                                                                 The \'Kickstarter\' has made this module automatically, it contains a default framework for a backend module but apart from it does nothing useful until you open the script \'".substr(t3lib_extMgm::extPath("'.$extKey.'"),strlen(PATH_site))."'.$pathSuffix.'index.php\' and edit it!
03053                                                                 <HR>
03054                                                                 <BR>This is the GET/POST vars sent to the script:<BR>".
03055                                                                 "GET:".t3lib_div::view_array($_GET)."<BR>".
03056                                                                 "POST:".t3lib_div::view_array($_POST)."<BR>".
03057                                                                 "";
03058                                                         $this->content.=$this->doc->section("Message #1:",$content,0,1);
03059                                                 break;
03060                                                 case 2:
03061                                                         $content="<div align=center><strong>Menu item #2...</strong></div>";
03062                                                         $this->content.=$this->doc->section("Message #2:",$content,0,1);
03063                                                 break;
03064                                                 case 3:
03065                                                         $content="<div align=center><strong>Menu item #3...</strong></div>";
03066                                                         $this->content.=$this->doc->section("Message #3:",$content,0,1);
03067                                                 break;
03068                                         }
03069                                 }
03070                         }
03071                 ');
03072 
03073                 $this->addFileToFileArray($pathSuffix."index.php",$this->PHPclassFile($extKey,$pathSuffix."index.php",$indexContent,$extKey.' module '.$k_prefix.$k,$cN));
03074         }
03075 
03076         function addLLfunc($extKey)     {
03077                 return $this->sPS('
03081                         function includeLL()    {
03082                                 include(t3lib_extMgm::extPath("'.$extKey.'")."locallang.php");
03083                                 return $LOCAL_LANG;
03084                         }
03085                 ');
03086         }
03087         function addStdLocalLangConf($ll,$k,$onlyMode=0)        {
03088                 $this->addLocalConf($ll,array(
03089                         "list_mode_1"=>"Mode 1",
03090                         "list_mode_1_dk"=>"Visning 1"
03091                 ),"list_mode_1","pi",$k,1,1);
03092                 $this->addLocalConf($ll,array(
03093                         "list_mode_2"=>"Mode 2",
03094                         "list_mode_2_dk"=>"Visning 2"
03095                 ),"list_mode_2","pi",$k,1,1);
03096                 $this->addLocalConf($ll,array(
03097                         "list_mode_3"=>"Mode 3",
03098                         "list_mode_3_dk"=>"Visning 3"
03099                 ),"list_mode_3","pi",$k,1,1);
03100                 $this->addLocalConf($ll,array(
03101                         "back"=>"Back",
03102                         "back_dk"=>"Tilbage"
03103                 ),"back","pi",$k,1,1);
03104 
03105                 if (!$onlyMode) {
03106                         $this->addLocalConf($ll,array(
03107                                 "pi_list_browseresults_prev"=>"< Previous",
03108                                 "pi_list_browseresults_prev_dk"=>"< Forrige"
03109                         ),"pi_list_browseresults_prev","pi",$k,1,1);
03110                         $this->addLocalConf($ll,array(
03111                                 "pi_list_browseresults_page"=>"Page",
03112                                 "pi_list_browseresults_page_dk"=>"Side"
03113                         ),"pi_list_browseresults_page","pi",$k,1,1);
03114                         $this->addLocalConf($ll,array(
03115                                 "pi_list_browseresults_next"=>"Next >",
03116                                 "pi_list_browseresults_next_dk"=>"Næste >"
03117                         ),"pi_list_browseresults_next","pi",$k,1,1);
03118                         $this->addLocalConf($ll,array(
03119                                 "pi_list_browseresults_displays"=>"Displaying results ###SPAN_BEGIN###%s to %s</span> out of ###SPAN_BEGIN###%s</span>",
03120                                 "pi_list_browseresults_displays_dk"=>"Viser resultaterne ###SPAN_BEGIN###%s til %s</span> ud af ###SPAN_BEGIN###%s</span>"
03121                         ),"pi_list_browseresults_displays","pi",$k,1,1);
03122 
03123                         $this->addLocalConf($ll,array(
03124                                 "pi_list_searchBox_search"=>"Search",
03125                                 "pi_list_searchBox_search_dk"=>"Søg"
03126                         ),"pi_list_searchBox_search","pi",$k,1,1);
03127                 }
03128 
03129                 return $ll;
03130         }
03131         function wrapBody($before,$content,$after,$indent=1)    {
03132                 $parts=array();
03133                 $parts[] = $this->sPS($before,0);
03134                 $parts[] = $this->indentLines(rtrim($content),$indent);
03135                 $parts[] = chr(10).$this->sPS($after,0);
03136 
03137                 return implode("",$parts);
03138         }
03139         function sPS($content,$preLines=1)      {
03140                 $lines = explode(chr(10),str_replace(chr(13),"",$content));
03141                 $lastLineWithContent=0;
03142                 $firstLineWithContent=-1;
03143                 $min=array();
03144                 reset($lines);
03145                 while(list($k,$v)=each($lines)) {
03146                         if (trim($v))   {
03147                                 if ($firstLineWithContent==-1)  $firstLineWithContent=$k;
03148                                 list($preSpace) = split("[^[:space:]]",$v,2);
03149                                 $min[]=count(explode(chr(9),$preSpace));
03150                                 $lastLineWithContent=$k;
03151                         }
03152                 }
03153                 $number_of=count($min) ? min($min) : 0;
03154                 $newLines=array();
03155                 if ($firstLineWithContent>=0)   {
03156                         for ($a=$firstLineWithContent;$a<=$lastLineWithContent;$a++)    {
03157                                 $parts = explode(chr(9),$lines[$a],$number_of);
03158                                 $newLines[]=end($parts);
03159                         }
03160                 }
03161                 return str_pad("",$preLines,chr(10)).implode(chr(10),$newLines).chr(10);
03162         }
03163         function indentLines($content,$number=1)        {
03164                 $preTab = str_pad("",$number,chr(9));
03165                 $lines = explode(chr(10),str_replace(chr(13),"",$content));
03166                 while(list($k,$v)=each($lines)) {
03167                         $lines[$k]=$preTab.$v;
03168                 }
03169                 return implode(chr(10),$lines);
03170         }
03171 
03172         function printPre($content)     {
03173                 echo '<pre>'.htmlspecialchars(str_replace(chr(9),"    ",$content)).'</pre>';
03174         }
03175         function addLocalConf(&$lArray,$confArray,$key,$prefix,$subPrefix,$dontPrefixKey=0,$noWOP=0,$overruleKey="")    {
03176                 reset($this->languages);
03177 
03178                 $overruleKey = $overruleKey ? $overruleKey : ($dontPrefixKey?"":$prefix.$subPrefix."_").$key;
03179 
03180                 $lArray["default"][$overruleKey] = array($confArray[$key],(!$noWOP?'WOP:['.$prefix.']['.$subPrefix.']['.$key.']':''));
03181                 while(list($k)=each($this->languages))  {
03182                         $lArray[$k][$overruleKey] = array(trim($confArray[$key."_".$k]),(!$noWOP?'WOP:['.$prefix.']['.$subPrefix.']['.$key."_".$k.']':''));
03183                 }
03184                 return $lArray;
03185         }
03186 
03187         function replaceMarkers($content,$markers)      {
03188                 reset($markers);
03189                 while(list($k,$v)=each($markers))       {
03190                         $content = str_replace($k,$v,$content);
03191                 }
03192                 return $content;
03193         }
03194         function returnName($extKey,$type,$suffix="")   {
03195                 if (substr($extKey,0,5)=="user_")       {
03196                         $extKey = substr($extKey,5);
03197                         switch($type)   {
03198                                 case "class":
03199                                         return "user_".str_replace("_","",$extKey).($suffix?"_".$suffix:"");
03200                                 break;
03201                                 case "tables":
03202                                 case "fields":
03203                                 case "fields":
03204                                         return "user_".str_replace("_","",$extKey).($suffix?"_".$suffix:"");
03205                                 break;
03206                                 case "module":
03207                                         return "u".str_replace("_","",$extKey).$suffix;
03208                                 break;
03209                         }
03210                 } else {
03211                         switch($type)   {
03212                                 case "class":
03213                                         return "tx_".str_replace("_","",$extKey).($suffix?"_".$suffix:"");
03214                                 break;
03215                                 case "tables":
03216                                 case "fields":
03217                                 case "fields":
03218                                         return "tx_".str_replace("_","",$extKey).($suffix?"_".$suffix:"");
03219                                 break;
03220                                 case "module":
03221                                         return "tx".str_replace("_","",$extKey).$suffix;
03222                                 break;
03223                         }
03224                 }
03225         }
03226 
03227 
03228         function PHPclassFile($extKey,$filename,$content,$desrc,$SOBE_class="",$SOBE_extras="") {
03229                 $file = trim($this->sPS('
03230                         <?php
03231                         /***************************************************************
03232                         *  Copyright notice
03233                         *
03234                         *  (c) 2004 '.$this->userField("name").' ('.$this->userField("email").')
03235                         *  All rights reserved
03236                         *
03237                         *  This script is part of the TYPO3 project. The TYPO3 project is
03238                         *  free software; you can redistribute it and/or modify
03239                         *  it under the terms of the GNU General Public License as published by
03240                         *  the Free Software Foundation; either version 2 of the License, or
03241                         *  (at your option) any later version.
03242                         *
03243                         *  The GNU General Public License can be found at
03244                         *  http://www.gnu.org/copyleft/gpl.html.
03245                         *
03246                         *  This script is distributed in the hope that it will be useful,
03247                         *  but WITHOUT ANY WARRANTY; without even the implied warranty of
03248                         *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
03249                         *  GNU General Public License for more details.
03250                         *
03251                         *  This copyright notice MUST APPEAR in all copies of the script!
03252                         ***************************************************************/
03258                 '));
03259 
03260                 $file.="\n\n\n".$content."\n\n\n";
03261 
03262                 $file.=trim($this->sPS('
03263 
03264                         if (defined("TYPO3_MODE") && $TYPO3_CONF_VARS[TYPO3_MODE]["XCLASS"]["ext/'.$extKey.'/'.$filename.'"])   {
03265                                 include_once($TYPO3_CONF_VARS[TYPO3_MODE]["XCLASS"]["ext/'.$extKey.'/'.$filename.'"]);
03266                         }
03267                         '.($SOBE_class?'
03268 
03269 
03270 
03271                         // Make instance:
03272                         $SOBE = t3lib_div::makeInstance("'.$SOBE_class.'");
03273                         $SOBE->init();
03274                         '.($SOBE_extras["include"]?'
03275                         // Include files?
03276                         foreach($SOBE->include_once as $INC_FILE)       include_once($INC_FILE);':'').'
03277                         '.($SOBE_extras["firstLevel"]?'
03278                         $SOBE->checkExtObj();   // Checking for first level external objects':'').'
03279                         $SOBE->main();
03280                         $SOBE->printContent();
03281                         ':'').'
03282                         ?>
03283                 '));
03284 
03285                 return $file;
03286         }
03287 
03288 
03289         function slashValueForSingleDashes($value)      {
03290                 return str_replace("'","\'",str_replace('\\','\\\\',$value));
03291         }
03292         function getSplitLabels_reference($config,$key,$LLkey)  {
03293                 $this->ext_locallang_db["default"][$LLkey]=array(trim($config[$key]));
03294                 if (count($this->languages))    {
03295                         reset($this->languages);
03296                         while(list($lk,$lv)=each($this->languages))     {
03297                                 if (isset($this->selectedLanguages[$lk]))       {
03298                                         $this->ext_locallang_db[$lk][$LLkey]=array(trim($config[$key."_".$lk]));
03299                                 }
03300                         }
03301                 }
03302                 return "LLL:EXT:".$this->extKey."/locallang_db.php:".$LLkey;
03303         }
03304         function getSplitLabels($config,$key)   {
03305                 $language=array();
03306                 $language[]=str_replace("|","",$config[$key]);
03307                 if (count($this->languages))    {
03308                         reset($this->languages);
03309                         while(list($lk,$lv)=each($this->languages))     {
03310                                 if (isset($this->selectedLanguages[$lk]))       {
03311                                         $language[]=str_replace("|","",$config[$key."_".$lk]);
03312                                 } else $language[]="";
03313                         }
03314                 }
03315                 $out = implode("|",$language);
03316                 $out = str_replace(chr(10),"",$out);
03317                 $out = rtrim(str_replace("|",chr(10),$out));
03318                 $out = str_replace(chr(10),"|",$out);
03319                 return $out;
03320         }
03321         function makeFileArray($name,$content)  {
03322         #       echo '<HR><strong>'.$name.'</strong><HR><pre>'.htmlspecialchars($content).'</pre>';
03323 
03324                 return array(
03325                         "name" => $name,
03326                         "size" => strlen($content),
03327                         "mtime" => time(),
03328                         "is_executable" => 0,
03329                         "content" => $content,
03330                         "content_md5" => md5($content)
03331                 );
03332         }
03333         function addFileToFileArray($name,$content,$mode=0)     {
03334                 switch($mode)   {
03335                         case 1: // Append
03336                                 $this->fileArray[$name]=$this->makeFileArray($name,$this->fileArray[$name]["content"].chr(10).$content);
03337                         break;
03338                         case -1:        // Prepend
03339                                 $this->fileArray[$name]=$this->makeFileArray($name,$content.chr(10).$this->fileArray[$name]["content"]);
03340                         break;
03341                         default:        // Substitution:
03342                                 $this->fileArray[$name]=$this->makeFileArray($name,$content);
03343                         break;
03344                 }
03345         }
03346         function WOPcomment($str)       {
03347                 return $str&&$this->outputWOP ? "## ".$str : "";
03348         }
03349         function makeEMCONFpreset($prefix="")   {
03350                 $this->_addArray = $this->wizArray["emconf"][1];
03351                 $EM_CONF=array();
03352                 $presetFields = explode(",","title,description,category,shy,dependencies,conflicts,priority,module,state,internal,uploadfolder,createDirs,modify_tables,clearCacheOnLoad,lockType,author,author_email,author_company,private,download_password,version");
03353                 while(list(,$s)=each($presetFields))    {
03354                         $EM_CONF[$prefix.$s]="";
03355                 }
03356 
03357 
03358                 $EM_CONF[$prefix."uploadfolder"] = $this->EM_CONF_presets["uploadfolder"]?1:0;
03359                 $EM_CONF[$prefix."clearCacheOnLoad"] = $this->EM_CONF_presets["clearCacheOnLoad"]?1:0;
03360 
03361                 if (is_array($this->EM_CONF_presets["createDirs"]))     {
03362                         $EM_CONF[$prefix."createDirs"] = implode(",",array_unique($this->EM_CONF_presets["createDirs"]));
03363                 }
03364 
03365                 if (is_array($this->EM_CONF_presets["dependencies"]) || $this->wizArray["emconf"][1]["dependencies"])   {
03366                         $aa= t3lib_div::trimExplode(",",strtolower($this->wizArray["emconf"][1]["dependencies"]),1);
03367                         $EM_CONF[$prefix."dependencies"] = implode(",",array_unique(array_merge($this->EM_CONF_presets["dependencies"],$aa)));
03368                 }
03369                 unset($this->_addArray["dependencies"]);
03370                 if (is_array($this->EM_CONF_presets["module"])) {
03371                         $EM_CONF[$prefix."module"] = implode(",",array_unique($this->EM_CONF_presets["module"]));
03372                 }
03373                 if (is_array($this->EM_CONF_presets["modify_tables"]))  {
03374                         $EM_CONF[$prefix."modify_tables"] = implode(",",array_unique($this->EM_CONF_presets["modify_tables"]));
03375                 }
03376 
03377                 return $EM_CONF;
03378         }
03379         function userField($k)  {
03380           $v = "";
03381           if($k == "name") {
03382             $v = ($GLOBALS['BE_USER']->user['realName'] != "") ? $GLOBALS['BE_USER']->user['realName'] : $this->wizArray["emconf"][1]["author"];
03383           } else if ($k == "email") {
03384             $v = ($GLOBALS['BE_USER']->user['email'] != "") ? $GLOBALS['BE_USER']->user['email'] : $this->wizArray["emconf"][1]["author_email"];
03385           }
03386           return $v;
03387         }
03388 
03389         function ulFolder($eKey)        {
03390                 return "uploads/tx_".str_replace("_","",$eKey)."/";
03391         }
03392         function fieldIsRTE($fC)        {
03393                 return !strcmp($fC["type"],"textarea_rte") &&
03394                                                 ($fC["conf_rte"]=="basic" ||
03395                                                 (t3lib_div::inList("custom,moderate",$fC["conf_rte"]) && $fC["conf_mode_cssOrNot"])
03396                                                 );
03397         }
03398 }
03399 
03400 // Include extension?
03401 if (defined("TYPO3_MODE") && $TYPO3_CONF_VARS[TYPO3_MODE]["XCLASS"]["ext/kickstarter/modfunc1/class.tx_kickstarter_compilefiles.php"]) {
03402         include_once($TYPO3_CONF_VARS[TYPO3_MODE]["XCLASS"]["ext/kickstarter/modfunc1/class.tx_kickstarter_compilefiles.php"]);
03403 }
03404 
03405 ?>


Généré par L'expert TYPO3 avec  doxygen 1.4.6