Changeset 332

Show
Ignore:
Timestamp:
2007-05-29 11:03:38 (17 months ago)
Author:
fredck
Message:

Fixed #520 : The "Select Field" properties dialog was not correctly handling select options with &, < and >.

Location:
FCKeditor/trunk
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • FCKeditor/trunk/editor/dialog/fck_select/fck_select.js

    r132 r332  
    6262        var oTxtValue   = document.getElementById( "txtValue" ) ; 
    6363 
    64         oListText.options[ iIndex ].innerHTML   = oTxtText.value ; 
     64        oListText.options[ iIndex ].innerHTML   = HTMLEncode( oTxtText.value ) ; 
    6565        oListText.options[ iIndex ].value               = oTxtText.value ; 
    6666 
    67         oListValue.options[ iIndex ].innerHTML  = oTxtValue.value ; 
     67        oListValue.options[ iIndex ].innerHTML  = HTMLEncode( oTxtValue.value ) ; 
    6868        oListValue.options[ iIndex ].value              = oTxtValue.value ; 
    6969 
     
    116116 
    117117        var oOption = combo.options[ iActualIndex ] ; 
    118         var sText       = oOption.innerHTML ; 
     118        var sText       = HTMLDecode( oOption.innerHTML ) ; 
    119119        var sValue      = oOption.value ; 
    120120 
     
    163163                combo.options.add( oOption ) ; 
    164164 
    165         oOption.innerHTML = optionText.length > 0 ? optionText : '&nbsp;' ; 
     165        oOption.innerHTML = optionText.length > 0 ? HTMLEncode( optionText ) : '&nbsp;' ; 
    166166        oOption.value     = optionValue ; 
    167167 
    168168        return oOption ; 
    169169} 
     170 
     171function HTMLEncode( text ) 
     172{ 
     173        if ( !text ) 
     174                return '' ; 
     175 
     176        text = text.replace( /&/g, '&amp;' ) ; 
     177        text = text.replace( /</g, '&lt;' ) ; 
     178        text = text.replace( />/g, '&gt;' ) ; 
     179 
     180        return text ; 
     181} 
     182 
     183 
     184function HTMLDecode( text ) 
     185{ 
     186        if ( !text ) 
     187                return '' ; 
     188 
     189        text = text.replace( /&gt;/g, '>' ) ; 
     190        text = text.replace( /&lt;/g, '<' ) ; 
     191        text = text.replace( /&amp;/g, '&' ) ; 
     192 
     193        return text ; 
     194} 
  • FCKeditor/trunk/editor/dialog/fck_select.html

    r308 r332  
    5959                for ( var i = 0 ; i < oActiveEl.options.length ; i++ ) 
    6060                { 
    61                         var sText       = oActiveEl.options[i].innerHTML ; 
     61                        var sText       = HTMLDecode( oActiveEl.options[i].innerHTML ) ; 
    6262                        var sValue      = oActiveEl.options[i].value ; 
    6363 
  • FCKeditor/trunk/_whatsnew.html

    r329 r332  
    108108                        form had a button named "submit" the "Save" command didn't work in Firefox.</li> 
    109109                <li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/414">#414</a>] If tracing was  
    110                 globally enabled in Asp.net 2 then the Asp.Net connector did fail.</li> 
     110                globally enabled in Asp.Net 2.0 then the Asp.Net connector did fail.</li> 
     111                <li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/520">#520</a>] The "Select 
     112                        Field" properties dialog was not correctly handling select options with &amp;, &lt; 
     113                        and &gt;.</li> 
    111114        </ul> 
    112115        <h3>