Changeset 443

Show
Ignore:
Timestamp:
2007-07-13 11:38:44 (3 years ago)
Author:
alfonsoml
Message:

The changes in [427] broke the handling of popup windows in the link dialog. Fix it.

Files:
1 modified

Legend:

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

    r388 r443  
    2727var FCKConfig   = oEditor.FCKConfig ; 
    2828var FCKRegexLib = oEditor.FCKRegexLib ; 
     29var FCKTools    = oEditor.FCKTools ; 
    2930 
    3031//#### Dialog Tabs 
     
    182183        } 
    183184 
    184         var aIds = oEditor.FCKTools.GetAllChildrenIds( oEditor.FCK.EditorDocument.body ) ; 
     185        var aIds = FCKTools.GetAllChildrenIds( oEditor.FCK.EditorDocument.body ) ; 
    185186 
    186187        bHasAnchors = ( aAnchors.length > 0 || aIds.length > 0 ) ; 
     
    190191                var sName = aAnchors[i].name ; 
    191192                if ( sName && sName.length > 0 ) 
    192                         oEditor.FCKTools.AddSelectOption( GetE('cmbAnchorName'), sName, sName ) ; 
     193                        FCKTools.AddSelectOption( GetE('cmbAnchorName'), sName, sName ) ; 
    193194        } 
    194195 
    195196        for ( i = 0 ; i < aIds.length ; i++ ) 
    196197        { 
    197                 oEditor.FCKTools.AddSelectOption( GetE('cmbAnchorId'), aIds[i], aIds[i] ) ; 
     198                FCKTools.AddSelectOption( GetE('cmbAnchorId'), aIds[i], aIds[i] ) ; 
    198199        } 
    199200 
     
    224225 
    225226        // Accesible popups, the popup data is in the onclick attribute 
    226         if ( !oPopupMatch ) { 
     227        if ( !oPopupMatch )  
     228        { 
    227229                var onclick = oLink.getAttribute( 'onclick_fckprotectedatt' ) ; 
    228                 oPopupMatch = oRegex.OnClickPopup.exec( onclick ) ; 
    229                 if( oPopupMatch ) 
    230                 { 
    231                         GetE( 'cmbTarget' ).value = 'popup' ; 
    232                         FillPopupFields( oPopupMatch[1], oPopupMatch[2] ) ; 
    233                         SetTarget( 'popup' ) ; 
     230                if ( onclick ) 
     231                { 
     232                        // Decode the protected string 
     233                        onclick = FCKTools.DecodeHex( onclick ) ; 
     234                         
     235                        oPopupMatch = oRegex.OnClickPopup.exec( onclick ) ; 
     236                        if( oPopupMatch ) 
     237                        { 
     238                                GetE( 'cmbTarget' ).value = 'popup' ; 
     239                                FillPopupFields( oPopupMatch[1], oPopupMatch[2] ) ; 
     240                                SetTarget( 'popup' ) ; 
     241                        } 
    234242                } 
    235243        } 
     
    348356        GetE('tdTargetFrame').style.display     = ( targetType == 'popup' ? 'none' : '' ) ; 
    349357        GetE('tdPopupName').style.display       = 
    350                 GetE('tablePopupFeatures').style.display = ( targetType == 'popup' ? '' : 'none' ) ; 
     358        GetE('tablePopupFeatures').style.display = ( targetType == 'popup' ? '' : 'none' ) ; 
    351359 
    352360        switch ( targetType ) 
     
    550558                SetAttribute( oLink, '_fcksavedurl', sUri ) ; 
    551559 
     560                var onclick; 
    552561                // Accesible popups 
    553562                if( GetE('cmbTarget').value == 'popup' ) 
    554563                { 
    555                         SetAttribute( oLink, 'onclick_fckprotectedatt', " onclick=\"" + BuildOnClickPopup() + "\"") ; 
     564                        onclick = BuildOnClickPopup() ; 
     565                        // Encode the attribute 
     566                        onclick = FCKTools.EncodeToHex( " onclick=\"" + onclick + "\"" )  ; 
     567                        SetAttribute( oLink, 'onclick_fckprotectedatt', onclick ) ; 
    556568                } 
    557569                else 
     
    559571                        // Check if the previous onclick was for a popup: 
    560572                        // In that case remove the onclick handler. 
    561                         var onclick = oLink.getAttribute( 'onclick_fckprotectedatt' ) ; 
    562                         if( oRegex.OnClickPopup.test( onclick ) ) 
    563                                 SetAttribute( oLink, 'onclick_fckprotectedatt', '' ) ; 
     573                        onclick = oLink.getAttribute( 'onclick_fckprotectedatt' ) ; 
     574                        if ( onclick ) 
     575                        { 
     576                                // Decode the protected string 
     577                                onclick = FCKTools.DecodeHex( onclick ) ; 
     578                         
     579                                if( oRegex.OnClickPopup.test( onclick ) ) 
     580                                        SetAttribute( oLink, 'onclick_fckprotectedatt', '' ) ; 
     581                        } 
    564582                } 
    565583