Index: t3lib/class.t3lib_tsparser_ext.php =================================================================== --- t3lib/class.t3lib_tsparser_ext.php (revision 2914) +++ t3lib/class.t3lib_tsparser_ext.php (working copy) @@ -1126,9 +1126,10 @@ * @return [type] ... */ function ext_printFields($theConstants,$category) { - // This functions returns the HTML-code that creates the editor-layout of the module. + // This functions returns the HTML-code that creates the editor-layout of the module. reset($theConstants); $output=""; + $subcat=""; if (is_array($this->categories[$category])) { @@ -1147,205 +1148,237 @@ $output.=''; } - // if (substr($params["value"],0,2)!='{$') { - $label=$GLOBALS["LANG"]->sL($params["label"]); - $label_parts = explode(":",$label,2); - if (count($label_parts)==2) { - $head=trim($label_parts[0]); - $body=trim($label_parts[1]); - } else { - $head=trim($label_parts[0]); - $body=""; - } - if (strlen($head)>35) { + $label=$GLOBALS["LANG"]->sL($params["label"]); + $label_parts = explode(":",$label,2); + if (count($label_parts)==2) { + $head=trim($label_parts[0]); + $body=trim($label_parts[1]); + } else { + $head=trim($label_parts[0]); + $body=""; + } + if (strlen($head)>35) { if (!$body) {$body=$head;} $head=t3lib_div::fixed_lgd_cs($head,35); } - $typeDat=$this->ext_getTypeData($params["type"]); - $checked=""; - $p_field=""; - $raname = substr(md5($params["name"]),0,10); - $aname="'".$raname."'"; - if ($this->ext_dontCheckIssetValues || isset($this->objReg[$params["name"]])) { - $checked=" checked"; - list($fN,$fV,$params)=$this->ext_fNandV($params); + $typeDat=$this->ext_getTypeData($params["type"]); + $checked=""; + $p_field=""; + $raname = substr(md5($params["name"]),0,10); + $aname="'".$raname."'"; - switch($typeDat["type"]) { - case "int": - case "int+": - $p_field='formWidth(5).' onChange="uFormUrl('.$aname.')">'; - if ($typeDat["paramstr"]) { - $p_field.=' Range: '.$typeDat["paramstr"]; - } elseif ($typeDat["type"]=="int+") { - $p_field.=' Range: 0 - '; + list($fN,$fV,$params)=$this->ext_fNandV($params); + + switch($typeDat["type"]) { + case "int": + case "int+": + $p_field='formWidth(5).' onChange="uFormUrl('.$aname.')">'; + if ($typeDat["paramstr"]) { + $p_field.=' Range: '.$typeDat["paramstr"]; + } elseif ($typeDat["type"]=="int+") { + $p_field.=' Range: 0 - '; + } else { + $p_field.=' (Integer)'; + } + break; + case "color": + $colorNames=explode(",",",".$this->HTMLcolorList); + $p_field=""; + while(list(,$val)=each($colorNames)) { + $sel=""; + if ($val==strtolower($params["value"])) {$sel=" selected";} + $p_field.=''; + } + $p_field=''; + + $p_field.='formWidth(7).' onChange="uFormUrl('.$aname.')">'; + break; + case "wrap": + $wArr = explode("|",$fV); + $p_field='formWidth(29).' onChange="uFormUrl('.$aname.')">'; + $p_field.=' | '; + $p_field.='formWidth(15).' onChange="uFormUrl('.$aname.')">'; + break; + case "offset": + $wArr = explode(",",$fV); + $labels = t3lib_div::trimExplode(",",$typeDat["paramstr"]); + $p_field=($labels[0]?$labels[0]:"x").':formWidth(4).' onChange="uFormUrl('.$aname.')">'; + $p_field.=' , '; + $p_field.=($labels[1]?$labels[1]:"y").':formWidth(4).' onChange="uFormUrl('.$aname.')">'; + for ($aa=2;$aaformWidth(4).' onChange="uFormUrl('.$aname.')">'; } else { - $p_field.=' (Integer)'; + $p_field.=''; } - break; - case "color": - $colorNames=explode(",",",".$this->HTMLcolorList); + } + break; + case "options": + if (is_array($typeDat["params"])) { $p_field=""; - while(list(,$val)=each($colorNames)) { + while(list(,$val)=each($typeDat["params"])) { + $vParts = explode("=",$val,2); + $label = $vParts[0]; + $val = isset($vParts[1]) ? $vParts[1] : $vParts[0]; + + // option tag: $sel=""; - if ($val==strtolower($params["value"])) {$sel=" selected";} - $p_field.=''; - } - $p_field=''; - - $p_field.='formWidth(7).' onChange="uFormUrl('.$aname.')">'; - break; - case "wrap": - $wArr = explode("|",$fV); - $p_field='formWidth(29).' onChange="uFormUrl('.$aname.')">'; - $p_field.=' | '; - $p_field.='formWidth(15).' onChange="uFormUrl('.$aname.')">'; - break; - case "offset": - $wArr = explode(",",$fV); - $labels = t3lib_div::trimExplode(",",$typeDat["paramstr"]); - $p_field=($labels[0]?$labels[0]:"x").':formWidth(4).' onChange="uFormUrl('.$aname.')">'; - $p_field.=' , '; - $p_field.=($labels[1]?$labels[1]:"y").':formWidth(4).' onChange="uFormUrl('.$aname.')">'; - for ($aa=2;$aaformWidth(4).' onChange="uFormUrl('.$aname.')">'; - } else { - $p_field.=''; + if ($val==$params["value"]) { + $sel=" selected"; } + $p_field.=''; } - break; - case "options": - if (is_array($typeDat["params"])) { - $p_field=""; - while(list(,$val)=each($typeDat["params"])) { - $vParts = explode("=",$val,2); - $label = $vParts[0]; - $val = isset($vParts[1]) ? $vParts[1] : $vParts[0]; + $p_field=''; + } + break; + case "boolean": + $p_field=''; + $sel=""; + if ($fV) { + $sel=" checked"; + } + $p_field.=''; + break; + case "comment": + $p_field=''; + $sel=""; + if (!$fV) { + $sel=" checked"; + } + $p_field.=''; + break; + case "file": + $p_field=''; + $theImage=""; + $selectThisFile = $this->extractFromResources($this->setup["resources"],$params["value"]); + if ($params["value"] && !$selectThisFile) { + if (in_array($params["value"],$this->dirResources)) { + $selectThisFile=$params["value"]; + } + } + // extensionlist + $extList = $typeDat["paramstr"]; + $p_field=''; + if ($extList=="IMAGE_EXT") { + $extList = $GLOBALS["TYPO3_CONF_VARS"]["GFX"]["imagefile_ext"]; + } + reset($this->rArr); + $onlineResourceFlag=$this->ext_defaultOnlineResourceFlag; - // option tag: - $sel=""; - if ($val==$params["value"]) {$sel=" selected";} - $p_field.=''; - } - $p_field=''; - } - break; - case "boolean": - $p_field=''; - $sel=""; if ($fV) {$sel=" checked";} - $p_field.=''; - break; - case "comment": - $p_field=''; - $sel=""; if (!$fV) {$sel=" checked";} - $p_field.=''; - break; - case "file": - $p_field=''; -// debug($params["value"]); - $theImage=""; -// if ($this->) { - $selectThisFile = $this->extractFromResources($this->setup["resources"],$params["value"]); - if ($params["value"] && !$selectThisFile) { - if (in_array($params["value"],$this->dirResources)) { - $selectThisFile=$params["value"]; + while(list($c,$val)=each($this->rArr)) { + $val=trim($val); + $fI=t3lib_div::split_fileref($val); + if ($val && (!$extList || t3lib_div::inList($extList,$fI["fileext"]))) { + if ($onlineResourceFlag<=0 && substr($fI["path"],0,10)=="fileadmin/") { + if ($onlineResourceFlag<0) { + $p_field.=''; } + $p_field.=''; + $onlineResourceFlag=1; } -// debug($selectThisFile); - // extensionlist - $extList = $typeDat["paramstr"]; - $p_field=''; - if ($extList=="IMAGE_EXT") { - $extList = $GLOBALS["TYPO3_CONF_VARS"]["GFX"]["imagefile_ext"]; - } - reset($this->rArr); - $onlineResourceFlag=$this->ext_defaultOnlineResourceFlag; + $dims=$this->resourceDimensions[$val]; + $sel=""; - while(list($c,$val)=each($this->rArr)) { - $val=trim($val); - $fI=t3lib_div::split_fileref($val); -// debug($fI); - if ($val && (!$extList || t3lib_div::inList($extList,$fI["fileext"]))) { - if ($onlineResourceFlag<=0 && substr($fI["path"],0,10)=="fileadmin/") { - if ($onlineResourceFlag<0) { - $p_field.=''; - } - $p_field.=''; - $onlineResourceFlag=1; - } - $dims=$this->resourceDimensions[$val]; - $sel=""; - - // Check if $params["value"] is in the list of resources. - if ($selectThisFile && $selectThisFile==$val) { - $sel=" selected"; - if ($onlineResourceFlag<=0) { - $theImage=t3lib_BEfunc::thumbCode(array("resources"=>$selectThisFile),"sys_template","resources",$GLOBALS["BACK_PATH"],""); - } else { - $theImage=t3lib_BEfunc::thumbCode(array("resources"=>$fI["file"]),"sys_template","resources",$GLOBALS["BACK_PATH"],"",$fI["path"]); - } - } - - if ($onlineResourceFlag<=0) { - $onlineResourceFlag--; - // Value is set with a * - $val = $this->ext_setStar($val); - $p_field.=''; - } else { - $p_field.=''; - } + // Check if $params["value"] is in the list of resources. + if ($selectThisFile && $selectThisFile==$val) { + $sel=" selected"; + if ($onlineResourceFlag<=0) { + $theImage=t3lib_BEfunc::thumbCode(array("resources"=>$selectThisFile),"sys_template","resources",$GLOBALS["BACK_PATH"],""); + } else { + $theImage=t3lib_BEfunc::thumbCode(array("resources"=>$fI["file"]),"sys_template","resources",$GLOBALS["BACK_PATH"],"",$fI["path"]); } } - if (trim($params["value"]) && !$selectThisFile) { - $val = $params["value"]; - $p_field.=''; - $p_field.=''; - } - // } - $p_field=''; - $p_field.=$theImage; - if (!$this->ext_noCEUploadAndCopying) { - // Copy a resource - $copyFile = $this->extractFromResources($this->setup["resources"],$params["value"]); - if (!$copyFile) { - if ($params["value"]) { - $copyFile=PATH_site.$this->ext_detectAndFixExtensionPrefix($params["value"]); - } + if ($onlineResourceFlag<=0) { + $onlineResourceFlag--; + // Value is set with a * + $val = $this->ext_setStar($val); + $p_field.=''; } else { - // $copyFile=PATH_site."uploads/tf/".$copyFile; - $copyFile=""; + $p_field.=''; } -#debug($copyFile); - if ($copyFile && @is_file($copyFile)) { - $p_field.=''; + } + } + + if (trim($params["value"]) && !$selectThisFile) { + $val = $params["value"]; + $p_field.=''; + $p_field.=''; + } + + $p_field=''; + $p_field.=$theImage; + + if (!$this->ext_noCEUploadAndCopying) { + // Copy a resource + $copyFile = $this->extractFromResources($this->setup["resources"],$params["value"]); + if (!$copyFile) { + if ($params["value"]) { + $copyFile=PATH_site.$this->ext_detectAndFixExtensionPrefix($params["value"]); } - // Upload? - $p_field.='
'; - $p_field.='formWidth().' onChange="uFormUrl('.$aname.')" size="50" />'; + } else { + $copyFile=""; } - break; - case 'user': - $userFunction = $typeDat['paramstr']; - $userFunctionParams = array('fieldName' => $fN, 'fieldValue' => $fV); - $p_field = t3lib_div::callUserFunction($userFunction, $userFunctionParams, $this, ''); - break; - case 'small': - default: - $fwidth= $typeDat["type"]=="small" ? 10 : 46; - $p_field='formWidth($fwidth).' onChange="uFormUrl('.$aname.')">'; - break; + + if ($copyFile && @is_file($copyFile)) { + $p_field.=''; + } + + // Upload? + $p_field.='
'; + $p_field.='formWidth().' onChange="uFormUrl('.$aname.')" size="50" />'; + } + break; + case 'user': + $userFunction = $typeDat['paramstr']; + $userFunctionParams = array('fieldName' => $fN, 'fieldValue' => $fV); + $p_field = t3lib_div::callUserFunction($userFunction, $userFunctionParams, $this, ''); + break; + case 'small': + default: + $fwidth= $typeDat["type"]=="small" ? 10 : 46; + $p_field='formWidth($fwidth).' onChange="uFormUrl('.$aname.')">'; + break; + } + + /* Start Jeff Patch */ + + $userTyposcriptID = 'userTS-'.$params['name']; + $defaultTyposcriptID = 'defaultTS-'.$params['name']; + $checkboxName = 'check['.$params['name'].']'; + $checkboxID = $checkboxName; + + $deleteIconHTML = 'Revert to default Constant'; + $editIconHTML = 'Edit this Constant'; + + if (!$this->ext_dontCheckIssetValues) { + + /* Set the default styling options */ + if(isset($this->objReg[$params["name"]])) { + $checkboxValue = 'checked'; + $userTyposcriptStyle = ''; + $defaultTyposcriptStyle = 'style="display:none;"'; + } else { + $checkboxValue = ''; + $userTyposcriptStyle = 'style="display:none;"'; + $defaultTyposcriptStyle = ''; } + + $p_check = ''; + $p_field = $deleteIconHTML.$p_field; + $p_field = ''.$p_field.''; + } - if (!$this->ext_dontCheckIssetValues) $p_field=''.$p_field; if ($typeDat["type"]=="color" && substr($params["value"],0,2)!='{$') { - $p_field='
'.$p_field.' 
'; + $p_field = '
'.$p_field.' 
'; } else { - $p_field=''.$p_field.'
'; + $p_field = ''.$p_field.''; } $p_name = '
'; - $p_dlabel='Default: '.htmlspecialchars($params["default_value"]).'
'; + + $p_dlabel=''.$editIconHTML.htmlspecialchars($params["default_value"]).'
'; + $p_label = ''; $p_descrip = $body ? htmlspecialchars($body)."
" : ""; @@ -1354,11 +1387,11 @@ $output.=''.$p_name.''; $output.=''; $output.=''; - $output.=''.$p_descrip.$p_field.$p_dlabel.'
'; + $output.=''.$p_descrip.$p_check.$p_field.$p_dlabel.'
'; $output.=''; // } } else { - debug("Error. Constant did not exits. Should not happen."); + debug("Error. Constant did not exist. Should not happen."); } } $output=''.$output.'
'; Index: typo3/sysext/tstemplate/ts/index.php =================================================================== --- typo3/sysext/tstemplate/ts/index.php (revision 2914) +++ typo3/sysext/tstemplate/ts/index.php (working copy) @@ -99,7 +99,6 @@ $this->doc = t3lib_div::makeInstance("template"); $this->doc->backPath = $BACK_PATH; - // JavaScript $this->doc->JScode = ' '."\n"; + + $this->doc->JScode .= $this->doc->wrapScriptTags(' script_ended = 0; function jumpToUrl(URL) { // window.location.href = URL;