00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
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
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;
00100 $this->constants=array($configTemplate,"");
00101
00102 $theConstants = $this->generateConfig_constants();
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();
00135 $this->ext_categorizeEditableConstants($theConstants);
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
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)) {
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
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 ?>