Documentation TYPO3 par Ameos |
00001 <?php 00002 /*************************************************************** 00003 * Copyright notice 00004 * 00005 * (c) 1999-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 ***************************************************************/ 00060 require_once(PATH_t3lib.'class.t3lib_tsparser_ext.php'); 00061 00062 00063 00064 00065 00066 00067 00068 00069 00070 00071 00079 class t3lib_tsStyleConfig extends t3lib_tsparser_ext { 00080 // internal 00081 var $categories = array(); 00082 var $ext_dontCheckIssetValues=1; 00083 var $ext_CEformName="tsStyleConfigForm"; 00084 var $ext_noCEUploadAndCopying=1; 00085 var $ext_printAll=1; 00086 var $ext_defaultOnlineResourceFlag=1; 00087 00088 var $ext_incomingValues = array(); 00089 00090 00098 function ext_initTSstyleConfig($configTemplate,$pathRel,$pathAbs,$backPath) { 00099 $this->tt_track = 0; // Do not log time-performance information 00100 $this->constants=array($configTemplate,""); 00101 00102 $theConstants = $this->generateConfig_constants(); // The editable constants are returned in an array. 00103 00104 $this->ext_localGfxPrefix=$pathAbs; 00105 $this->ext_localWebGfxPrefix=$backPath.$pathRel; 00106 $this->ext_backPath = $backPath; 00107 00108 return $theConstants; 00109 } 00110 00118 function ext_setValueArray($theConstants,$valueArray) { 00119 00120 $temp = $this->flatSetup; 00121 $this->flatSetup = Array(); 00122 $this->flattenSetup($valueArray,"",""); 00123 $this->objReg = $this->ext_realValues = $this->flatSetup; 00124 $this->flatSetup = $temp; 00125 00126 00127 reset($theConstants); 00128 while(list($k,$p)=each($theConstants)) { 00129 if (isset($this->objReg[$k])) { 00130 $theConstants[$k]["value"] = $this->ext_realValues[$k]; 00131 } 00132 } 00133 00134 $this->categories=array(); // Reset the default pool of categories. 00135 $this->ext_categorizeEditableConstants($theConstants); // The returned constants are sorted in categories, that goes into the $this->categories array 00136 00137 return $theConstants; 00138 } 00139 00145 function ext_getCategoriesForModMenu() { 00146 return $this->ext_getCategoryLabelArray(); 00147 } 00148 00155 function ext_makeHelpInformationForCategory($cat) { 00156 return $this->ext_getTSCE_config($cat); 00157 } 00158 00168 function ext_getForm($cat,$theConstants,$script="",$addFields="") { 00169 $this->ext_makeHelpInformationForCategory($cat); 00170 $printFields = trim($this->ext_printFields($theConstants,$cat)); 00171 00172 $content=''; 00173 $content.=' 00174 <script language="javascript" type="text/javascript"> 00175 function uFormUrl(aname) { 00176 document.'.$this->ext_CEformName.'.action = "'.t3lib_div::linkThisScript().'#"+aname; 00177 } 00178 </script> 00179 '; 00180 $content.= '<form action="'.($script?$script:t3lib_div::linkThisScript()).'" name="'.$this->ext_CEformName.'" method="POST" enctype="'.$GLOBALS["TYPO3_CONF_VARS"]["SYS"]["form_enctype"].'">'; 00181 $content.= $addFields; 00182 # $content.= '<input type="Submit" name="submit" value="Update"><BR>'; 00183 $content.= $printFields; 00184 $content.= '<input type="Submit" name="submit" value="Update">'; 00185 00186 $example = $this->ext_displayExample(); 00187 $content.= $example?'<HR>'.$example:""; 00188 00189 return $content; 00190 } 00191 00197 function ext_displayExample() { 00198 global $SOBE,$tmpl; 00199 if ($this->helpConfig["imagetag"] || $this->helpConfig["description"] || $this->helpConfig["header"]) { 00200 $out = '<div align="center">'.$this->helpConfig["imagetag"].'</div><BR>'. 00201 ($this->helpConfig["description"] ? implode(explode("//",$this->helpConfig["description"]),"<BR>")."<BR>" : ""). 00202 ($this->helpConfig["bulletlist"] ? "<ul><li>".implode(explode("//",$this->helpConfig["bulletlist"]),"<li>")."</ul>" : "<BR>"); 00203 } 00204 return $out; 00205 } 00206 00213 function ext_mergeIncomingWithExisting($arr) { 00214 $parseObj = t3lib_div::makeInstance("t3lib_TSparser"); 00215 $parseObj->parse(implode(chr(10),$this->ext_incomingValues)); 00216 $arr2 = $parseObj->setup; 00217 return t3lib_div::array_merge_recursive_overrule($arr,$arr2); 00218 } 00219 00220 // extends: 00221 function ext_getKeyImage($key) { 00222 return '<img'.t3lib_iconWorks::skinImg($this->ext_backPath,'gfx/rednumbers/'.$key.'.gif','').' hspace="2" align="top" alt="" />'; 00223 } 00224 00231 function ext_getTSCE_config_image($imgConf) { 00232 $iFile=$this->ext_localGfxPrefix.$imgConf; 00233 $tFile=$this->ext_localWebGfxPrefix.$imgConf; 00234 $imageInfo=@getImagesize($iFile); 00235 return '<img src="'.$tFile.'" '.$imageInfo[3].'>'; 00236 } 00237 00244 function ext_fNandV($params) { 00245 $fN='data['.$params["name"].']'; 00246 $fV=$params["value"]=isset($this->ext_realValues[$params["name"]]) ? $this->ext_realValues[$params["name"]] : $params["default_value"]; 00247 if (ereg("^{[\$][a-zA-Z0-9\.]*}$",trim($fV),$reg)) { // Values entered from the constantsedit cannot be constants! 230502; removed \{ and set { 00248 $fV=""; 00249 } 00250 $fV=htmlspecialchars($fV); 00251 #debug(array($params,$fN,$fV,isset($this->ext_realValues[$params["name"]]))); 00252 return array($fN,$fV,$params); 00253 } 00254 00261 function ext_loadResources($absPath) { 00262 $this->ext_readDirResources($GLOBALS["TYPO3_CONF_VARS"]["MODS"]["web_ts"]["onlineResourceDir"]); 00263 if (is_dir($absPath)) { 00264 $absPath = ereg_replace("\/$","",$absPath); 00265 $this->readDirectory($absPath); 00266 } 00267 $this->ext_resourceDims(); 00268 } 00269 00277 function ext_putValueInConf($key, $var) { 00278 $this->ext_incomingValues[$key]=$key."=".$var; 00279 } 00280 00287 function ext_removeValueInConf($key) { 00288 // Nothing... 00289 } 00290 } 00291 00292 00293 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['t3lib/class.t3lib_tsstyleconfig.php']) { 00294 include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['t3lib/class.t3lib_tsstyleconfig.php']); 00295 } 00296 ?>