MSIE fixes for #7336 (by Jeff Segars)
authorDmitry Dulepov <dmitry.dulepov@gmail.com>
Mon, 4 Feb 2008 08:28:34 +0000 (08:28 +0000)
committerDmitry Dulepov <dmitry.dulepov@gmail.com>
Mon, 4 Feb 2008 08:28:34 +0000 (08:28 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@3046 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
t3lib/class.t3lib_tsparser_ext.php
typo3/js/constantEditor.js
typo3/stylesheet.css

index 2b083ad..bd09cbb 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2008-02-02  Dmitry Dulepov  <dmitry@typo3.org>
+
+       * MSIE fixes for #7336 (by Jeff Segars)
+
 2008-02-03  Oliver Hader  <oh@inpublica.de>
 
        * (feature) Added feature #6087: IRRE - Localization of child records
index eb376f0..5daa53d 100755 (executable)
@@ -105,7 +105,7 @@ require_once(PATH_t3lib.'class.t3lib_tstemplate.php');
 class t3lib_tsparser_ext extends t3lib_TStemplate      {
 
        var $edit_divider = '###MOD_TS:EDITABLE_CONSTANTS###';          // This string is used to indicate the point in a template from where the editable constants are listed. Any vars before this point (if it exists though) is regarded as default values.
-       var $HTMLcolorList = 'aqua,black,blue,fuchsia,gray,green,lime,maroon,navy,olive,purple,red,silver,teal,yellow,white';
+       var $HTMLcolorList = 'aqua,beige,black,blue,brown,fuchsia,gold,gray,green,lime,maroon,navy,olive,orange,purple,red,silver,tan,teal,turquoise,yellow,white';
 
                // internal
        var $categories = array(
@@ -1175,9 +1175,9 @@ class t3lib_tsparser_ext extends t3lib_TStemplate {
                                                                }
                                                                $p_field.='<option value="'.htmlspecialchars($val).'"'.$sel.'>'.$val.'</option>';
                                                        }
-                                                       $p_field='<select id="'.$fN.'" name="C'.$fN.'" onChange="document.'.$this->ext_CEformName.'[\''.$fN.'\'].value=this.options[this.selectedIndex].value; uFormUrl('.$aname.');">'.$p_field.'</select>';
+                                                       $p_field='<select id="select-'.$fN.'" rel="'.$fN.'" name="C'.$fN.'" class="typo3-tstemplate-ceditor-color-select" onChange="uFormUrl('.$aname.');">'.$p_field.'</select>';
 
-                                                       $p_field.='<input type="text" name="'.$fN.'" value="'.$fV.'"'.$GLOBALS['TBE_TEMPLATE']->formWidth(7).' onChange="uFormUrl('.$aname.')" />';
+                                                       $p_field.='<input type="text" id="input-'.$fN.'" rel="'.$fN.'" name="'.$fN.'" class="typo3-tstemplate-ceditor-color-input" value="'.$fV.'"'.$GLOBALS['TBE_TEMPLATE']->formWidth(7).' onChange="uFormUrl('.$aname.')" />';
                                                break;
                                                case 'wrap':
                                                        $wArr = explode('|',$fV);
@@ -1335,7 +1335,7 @@ class t3lib_tsparser_ext extends t3lib_TStemplate {
 
                                        // Handle type=color specially
                                        if ($typeDat['type']=='color' && substr($params['value'],0,2)!='{$')    {
-                                               $color = '<div class="typo3-tstemplate-ceditor-colorblock" style="background-color:'.$params['value'].';">&nbsp;</div>';
+                                               $color = '<div id="colorbox-'.$fN.'" class="typo3-tstemplate-ceditor-colorblock" style="background-color:'.$params['value'].';">&nbsp;</div>';
                                        } else {
                                                $color = '';
                                        }
@@ -1570,10 +1570,24 @@ class t3lib_tsparser_ext extends t3lib_TStemplate       {
                                                                $col=array();
                                                                if($var && !t3lib_div::inList($this->HTMLcolorList,strtolower($var)))   {
                                                                        $var = ereg_replace('[^A-Fa-f0-9]*','',$var);
-                                                                       $col[]=HexDec(substr($var,0,2));
-                                                                       $col[]=HexDec(substr($var,2,2));
-                                                                       $col[]=HexDec(substr($var,4,2));
-                                                                       $var='#'.strtoupper(substr('0'.DecHex($col[0]),-2).substr('0'.DecHex($col[1]),-2).substr('0'.DecHex($col[2]),-2));
+                                                                       $useFullHex = strlen($var) > 3;
+
+                                                                       $col[]=HexDec(substr($var,0,1));
+                                                                       $col[]=HexDec(substr($var,1,1));
+                                                                       $col[]=HexDec(substr($var,2,1));                                                                        
+                                                                       
+                                                                       if($useFullHex) {
+                                                                               $col[]=HexDec(substr($var,3,1));
+                                                                               $col[]=HexDec(substr($var,4,1));
+                                                                               $col[]=HexDec(substr($var,5,1));
+                                                                       }
+
+                                                                       $var = substr('0'.DecHex($col[0]),-1).substr('0'.DecHex($col[1]),-1).substr('0'.DecHex($col[2]),-1);
+                                                                       if($useFullHex) {
+                                                                               $var .= substr('0'.DecHex($col[3]),-1).substr('0'.DecHex($col[4]),-1).substr('0'.DecHex($col[5]),-1);
+                                                                       }
+                                                                       
+                                                                       $var = '#'.strtoupper($var);
                                                                }
                                                        break;
                                                        case 'comment':
index d980ab0..ef91686 100644 (file)
@@ -41,6 +41,8 @@ var ModuleConstantEditor = Class.create({
                        // initialize event listeners
                Event.observe(document, 'dom:loaded', function(){
                        $$('.typo3-tstemplate-ceditor-control').invoke('observe', 'click', this.changeProperty);
+                       $$('.typo3-tstemplate-ceditor-color-select').invoke('observe', 'change', this.updateColorFromSelect);
+                       $$('.typo3-tstemplate-ceditor-color-input').invoke('observe', 'change', this.updateColorFromInput);
                }.bind(this));
                
        },
@@ -51,8 +53,8 @@ var ModuleConstantEditor = Class.create({
        changeProperty: function(event) {
                var editIcon = Event.element(event);
                var paramName = editIcon.readAttribute('rel');
-               var defaultDiv       = $('defaultTS-'+paramName);
-               var userDiv       = $('userTS-'+paramName);
+               var defaultDiv = $('defaultTS-'+paramName);
+               var userDiv = $('userTS-'+paramName);
                var checkBox = $('check[' + paramName + ']');
                
                if(editIcon.hasClassName('editIcon')) {
@@ -66,7 +68,38 @@ var ModuleConstantEditor = Class.create({
                        $(defaultDiv).show(); 
                        $(checkBox).setValue('').disable();
                }
-       }       
+       },
+       
+       updateColorFromSelect: function(event) {
+               var colorSelect = Event.element(event);
+               var paramName = colorSelect.readAttribute('rel');
+               
+               var colorValue = colorSelect.getValue();
+               var colorInput = $('input-'+paramName);
+               var colorBox = $('colorbox-'+paramName);
+               
+               $(colorInput).setValue(colorValue);
+               $(colorBox).setStyle({backgroundColor: colorValue});
+       },
+       
+       updateColorFromInput: function(event) {
+               var colorInput = Event.element(event);
+               var paramName = colorInput.readAttribute('rel');
+               
+               var colorValue = colorInput.getValue();
+               var colorBox = $('colorbox-'+paramName);
+               var colorSelect = $('select-'+paramName);
+
+               $(colorBox).setStyle({backgroundColor: colorValue});
+               
+               $(colorSelect).childElements().each(function(option) {
+                       if(option.value == colorValue) {
+                               option.selected = true;
+                       } else {
+                               option.selected = false;
+                       }
+               });
+       }
        
 });
 
index 02f765e..3bf5248 100755 (executable)
@@ -293,8 +293,8 @@ UL.tree LI.active UL, UL.tree UL LI.active UL       { background-color: #f7f3ef; }
 div#treeOptions, div#treeOptions * { float: left; }
 div#treeOptions                { width: 100%; height: 24px; background: #fff; margin: 0 0 5px; border-bottom: 1px solid #ccc; }
 div#treeFilterBox      { width: 158px; margin-top: 2px; height: 22px; background: #fff url('gfx/search_bubble.png') no-repeat 8px 0; padding-left: 10px; }
-input#treeFilter       { height: 14px; width: 120px; margin: 3px 0 0 17px; border: 0; }
-img#treeFilterReset    { border: 0; margin: 5px 0 0 4px; cursor: pointer; visibility: hidden; }
+input#treeFilter       { height: 14px; width: 120px; margin: 4px 0 0 18px !important; border: 0; }
+img#treeFilterReset    { border: 0; margin: 5px 0 0 !important; cursor: pointer; visibility: hidden; }
 div#treeOptionButtons  { float: right; }
 div#treeOptionButtons a        { margin: 5px 1px 0; }
 
@@ -370,7 +370,7 @@ BODY#typo3-alt-doc-nodoc-php P IMG { vertical-align: middle; margin-left: 5px; }
 BODY#typo3-alt-doc-nodoc-php { margin-left: 5px; }
 
 /* Record editing (alt_doc.php) */
-div#typo3-docheader { postion: absolute; top: 0; left: 0; z-index: 5; min-width: 350px; }
+div#typo3-docheader { postion: absolute; top: 0; left: 0; z-index: 5; min-width: 260px; }
 div#typo3-docheader-row1 { height: 22px; background: #cbc7c3; }
 div#typo3-docheader-row2 { background: #e4e0db; height: 27px; line-height: 27px; border-bottom: 1px solid #000; }
 div#typo3-docheader div.buttonsleft  { margin: 0 0 0 3px; line-height: 16px; float: left; }
@@ -488,8 +488,10 @@ DIV#typo3-listOptions { margin: 10px 0px 10px 0px; }
 
 /* Web > Template */
 .typo3-tstemplate-ceditor-control { margin-right: 3px; vertical-align: bottom;cursor:pointer;}
-DIV.typo3-tstemplate-ceditor-row { margin-top: 5px; }
-DIV.typo3-tstemplate-ceditor-colorblock { display: inline-block; margin-left: 5px; width: 50px; }
+DIV.typo3-tstemplate-ceditor-row { margin-top: 2px; padding: 3px;}
+DIV.typo3-tstemplate-ceditor-colorblock { display: -moz-inline-box; display: inline-block; margin-left: 5px; width: 50px; }
+* html DIV.typo3-tstemplate-ceditor-colorblock { display: inline; } /* IE 6 Fix */
+* + html DIV.typo3-tstemplate-ceditor-colorblock { display: inline; } /* IE 7 Fix */
 DL.typo3-tstemplate-ceditor-constant { margin: 0px 0px 20px 10px }
 DL.typo3-tstemplate-ceditor-constant dd { margin-left: 0px; }
 DL.typo3-tstemplate-ceditor-constant dt { display: inline; margin-right: 5px; }