[ Index ] |
|
Code source de Typo3 4.1.3 |
1 <?php 2 /*************************************************************** 3 * Copyright notice 4 * 5 * (c) 1999-2006 Kasper Skaarhoj (kasperYYYY@typo3.com) 6 * All rights reserved 7 * 8 * This script is part of the TYPO3 project. The TYPO3 project is 9 * free software; you can redistribute it and/or modify 10 * it under the terms of the GNU General Public License as published by 11 * the Free Software Foundation; either version 2 of the License, or 12 * (at your option) any later version. 13 * 14 * The GNU General Public License can be found at 15 * http://www.gnu.org/copyleft/gpl.html. 16 * A copy is found in the textfile GPL.txt and important notices to the license 17 * from the author is found in LICENSE.txt distributed with these scripts. 18 * 19 * 20 * This script is distributed in the hope that it will be useful, 21 * but WITHOUT ANY WARRANTY; without even the implied warranty of 22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 23 * GNU General Public License for more details. 24 * 25 * This copyright notice MUST APPEAR in all copies of the script! 26 ***************************************************************/ 27 /** 28 * Provides a simplified layer for making Constant Editor style configuration forms 29 * 30 * $Id: class.t3lib_tsstyleconfig.php 1421 2006-04-10 09:27:15Z mundaun $ 31 * 32 * @author Kasper Skaarhoj <kasperYYYY@typo3.com> 33 */ 34 /** 35 * [CLASS/FUNCTION INDEX of SCRIPT] 36 * 37 * 38 * 39 * 79: class t3lib_tsStyleConfig extends t3lib_tsparser_ext 40 * 98: function ext_initTSstyleConfig($configTemplate,$pathRel,$pathAbs,$backPath) 41 * 118: function ext_setValueArray($theConstants,$valueArray) 42 * 145: function ext_getCategoriesForModMenu() 43 * 155: function ext_makeHelpInformationForCategory($cat) 44 * 168: function ext_getForm($cat,$theConstants,$script="",$addFields="") 45 * 175: function uFormUrl(aname) 46 * 197: function ext_displayExample() 47 * 213: function ext_mergeIncomingWithExisting($arr) 48 * 221: function ext_getKeyImage($key) 49 * 231: function ext_getTSCE_config_image($imgConf) 50 * 244: function ext_fNandV($params) 51 * 262: function ext_loadResources($absPath) 52 * 278: function ext_putValueInConf($key, $var) 53 * 288: function ext_removeValueInConf($key) 54 * 55 * TOTAL FUNCTIONS: 14 56 * (This index is automatically created/updated by the extension "extdeveval") 57 * 58 */ 59 60 require_once(PATH_t3lib.'class.t3lib_tsparser_ext.php'); 61 62 63 64 65 66 67 68 69 70 71 72 /** 73 * Provides a simplified layer for making Constant Editor style configuration forms 74 * 75 * @author Kasper Skaarhoj <kasperYYYY@typo3.com> 76 * @package TYPO3 77 * @subpackage t3lib 78 */ 79 class t3lib_tsStyleConfig extends t3lib_tsparser_ext { 80 // internal 81 var $categories = array(); 82 var $ext_dontCheckIssetValues=1; 83 var $ext_CEformName="tsStyleConfigForm"; 84 var $ext_noCEUploadAndCopying=1; 85 var $ext_printAll=1; 86 var $ext_defaultOnlineResourceFlag=1; 87 88 var $ext_incomingValues = array(); 89 90 91 /** 92 * @param string pathRel is the path relative to the typo3/ directory 93 * @param string pathAbs is the absolute path from root 94 * @param string backPath is the backReference from current position to typo3/ dir 95 * @param [type] $backPath: ... 96 * @return [type] ... 97 */ 98 function ext_initTSstyleConfig($configTemplate,$pathRel,$pathAbs,$backPath) { 99 $this->tt_track = 0; // Do not log time-performance information 100 $this->constants=array($configTemplate,""); 101 102 $theConstants = $this->generateConfig_constants(); // The editable constants are returned in an array. 103 104 $this->ext_localGfxPrefix=$pathAbs; 105 $this->ext_localWebGfxPrefix=$backPath.$pathRel; 106 $this->ext_backPath = $backPath; 107 108 return $theConstants; 109 } 110 111 /** 112 * [Describe function...] 113 * 114 * @param [type] $theConstants: ... 115 * @param [type] $valueArray: ... 116 * @return [type] ... 117 */ 118 function ext_setValueArray($theConstants,$valueArray) { 119 120 $temp = $this->flatSetup; 121 $this->flatSetup = Array(); 122 $this->flattenSetup($valueArray,"",""); 123 $this->objReg = $this->ext_realValues = $this->flatSetup; 124 $this->flatSetup = $temp; 125 126 127 reset($theConstants); 128 while(list($k,$p)=each($theConstants)) { 129 if (isset($this->objReg[$k])) { 130 $theConstants[$k]["value"] = $this->ext_realValues[$k]; 131 } 132 } 133 134 $this->categories=array(); // Reset the default pool of categories. 135 $this->ext_categorizeEditableConstants($theConstants); // The returned constants are sorted in categories, that goes into the $this->categories array 136 137 return $theConstants; 138 } 139 140 /** 141 * [Describe function...] 142 * 143 * @return [type] ... 144 */ 145 function ext_getCategoriesForModMenu() { 146 return $this->ext_getCategoryLabelArray(); 147 } 148 149 /** 150 * [Describe function...] 151 * 152 * @param [type] $cat: ... 153 * @return [type] ... 154 */ 155 function ext_makeHelpInformationForCategory($cat) { 156 return $this->ext_getTSCE_config($cat); 157 } 158 159 /** 160 * [Describe function...] 161 * 162 * @param [type] $cat: ... 163 * @param [type] $theConstants: ... 164 * @param [type] $script: ... 165 * @param [type] $addFields: ... 166 * @return [type] ... 167 */ 168 function ext_getForm($cat,$theConstants,$script="",$addFields="") { 169 $this->ext_makeHelpInformationForCategory($cat); 170 $printFields = trim($this->ext_printFields($theConstants,$cat)); 171 172 $content=''; 173 $content.=' 174 <script language="javascript" type="text/javascript"> 175 function uFormUrl(aname) { 176 document.'.$this->ext_CEformName.'.action = "'.t3lib_div::linkThisScript().'#"+aname; 177 } 178 </script> 179 '; 180 $content.= '<form action="'.($script?$script:t3lib_div::linkThisScript()).'" name="'.$this->ext_CEformName.'" method="POST" enctype="'.$GLOBALS["TYPO3_CONF_VARS"]["SYS"]["form_enctype"].'">'; 181 $content.= $addFields; 182 # $content.= '<input type="Submit" name="submit" value="Update"><BR>'; 183 $content.= $printFields; 184 $content.= '<input type="Submit" name="submit" value="Update">'; 185 186 $example = $this->ext_displayExample(); 187 $content.= $example?'<HR>'.$example:""; 188 189 return $content; 190 } 191 192 /** 193 * [Describe function...] 194 * 195 * @return [type] ... 196 */ 197 function ext_displayExample() { 198 global $SOBE,$tmpl; 199 if ($this->helpConfig["imagetag"] || $this->helpConfig["description"] || $this->helpConfig["header"]) { 200 $out = '<div align="center">'.$this->helpConfig["imagetag"].'</div><BR>'. 201 ($this->helpConfig["description"] ? implode(explode("//",$this->helpConfig["description"]),"<BR>")."<BR>" : ""). 202 ($this->helpConfig["bulletlist"] ? "<ul><li>".implode(explode("//",$this->helpConfig["bulletlist"]),"<li>")."</ul>" : "<BR>"); 203 } 204 return $out; 205 } 206 207 /** 208 * [Describe function...] 209 * 210 * @param [type] $arr: ... 211 * @return [type] ... 212 */ 213 function ext_mergeIncomingWithExisting($arr) { 214 $parseObj = t3lib_div::makeInstance("t3lib_TSparser"); 215 $parseObj->parse(implode(chr(10),$this->ext_incomingValues)); 216 $arr2 = $parseObj->setup; 217 return t3lib_div::array_merge_recursive_overrule($arr,$arr2); 218 } 219 220 // extends: 221 function ext_getKeyImage($key) { 222 return '<img'.t3lib_iconWorks::skinImg($this->ext_backPath,'gfx/rednumbers/'.$key.'.gif','').' hspace="2" align="top" alt="" />'; 223 } 224 225 /** 226 * [Describe function...] 227 * 228 * @param [type] $imgConf: ... 229 * @return [type] ... 230 */ 231 function ext_getTSCE_config_image($imgConf) { 232 $iFile=$this->ext_localGfxPrefix.$imgConf; 233 $tFile=$this->ext_localWebGfxPrefix.$imgConf; 234 $imageInfo=@getImagesize($iFile); 235 return '<img src="'.$tFile.'" '.$imageInfo[3].'>'; 236 } 237 238 /** 239 * [Describe function...] 240 * 241 * @param [type] $params: ... 242 * @return [type] ... 243 */ 244 function ext_fNandV($params) { 245 $fN='data['.$params["name"].']'; 246 $fV=$params["value"]=isset($this->ext_realValues[$params["name"]]) ? $this->ext_realValues[$params["name"]] : $params["default_value"]; 247 $reg = array(); 248 if (preg_match('/^\{[\$][a-zA-Z0-9\.]*\}$/',trim($fV),$reg)) { // Values entered from the constantsedit cannot be constants! 249 $fV=""; 250 } 251 $fV=htmlspecialchars($fV); 252 #debug(array($params,$fN,$fV,isset($this->ext_realValues[$params["name"]]))); 253 return array($fN,$fV,$params); 254 } 255 256 /** 257 * [Describe function...] 258 * 259 * @param [type] $absPath: ... 260 * @return [type] ... 261 */ 262 function ext_loadResources($absPath) { 263 $this->ext_readDirResources($GLOBALS["TYPO3_CONF_VARS"]["MODS"]["web_ts"]["onlineResourceDir"]); 264 if (is_dir($absPath)) { 265 $absPath = ereg_replace("\/$","",$absPath); 266 $this->readDirectory($absPath); 267 } 268 $this->ext_resourceDims(); 269 } 270 271 /** 272 * [Describe function...] 273 * 274 * @param [type] $key: ... 275 * @param [type] $var: ... 276 * @return [type] ... 277 */ 278 function ext_putValueInConf($key, $var) { 279 $this->ext_incomingValues[$key]=$key."=".$var; 280 } 281 282 /** 283 * [Describe function...] 284 * 285 * @param [type] $key: ... 286 * @return [type] ... 287 */ 288 function ext_removeValueInConf($key) { 289 // Nothing... 290 } 291 } 292 293 294 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['t3lib/class.t3lib_tsstyleconfig.php']) { 295 include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['t3lib/class.t3lib_tsstyleconfig.php']); 296 } 297 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Sun Nov 25 17:13:16 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |