Changeset 1398

Show
Ignore:
Timestamp:
2008-01-24 04:47:11 (2 years ago)
Author:
martinkou
Message:

Fixed #35 : Merged floating_dialog branch to trunk.

Location:
FCKeditor/trunk
Files:
2 removed
45 modified
25 copied

Legend:

Unmodified
Added
Removed
  • FCKeditor/trunk/editor/dialog/common/fck_dialog_common.js

    r1192 r1398  
    9191} 
    9292 
    93 var KeyIdentifierMap =  
    94 { 
    95         End             : 35, 
    96         Home    : 36, 
    97         Left    : 37, 
    98         Right   : 39, 
    99         'U+00007F' : 46         // Delete 
    100 }  
     93function SelectField( elementId ) 
     94{ 
     95        var element = GetE( elementId ) ; 
     96        element.focus() ; 
     97        element.select() ; 
     98} 
    10199 
    102100// Functions used by text fields to accept numbers only. 
    103 function IsDigit( e ) 
    104 { 
    105         if ( !e ) 
    106                 e = event ; 
    107  
    108         var iCode = ( e.keyCode || e.charCode ) ; 
    109          
    110         if ( !iCode && e.keyIdentifier && ( e.keyIdentifier in KeyIdentifierMap ) )  
    111                         iCode = KeyIdentifierMap[ e.keyIdentifier ] ; 
    112  
    113         return ( 
    114                         ( iCode >= 48 && iCode <= 57 )          // Numbers 
    115                         || (iCode >= 35 && iCode <= 40)         // Arrows, Home, End 
    116                         || iCode == 8                                           // Backspace 
    117                         || iCode == 46                                          // Delete 
    118                         || iCode == 9                                           // Tab 
    119         ) ; 
    120 } 
     101var IsDigit = ( function() 
     102        { 
     103                var KeyIdentifierMap =  
     104                { 
     105                        End                     : 35, 
     106                        Home            : 36, 
     107                        Left            : 37, 
     108                        Right           : 39, 
     109                        'U+00007F'      : 46            // Delete 
     110                } ; 
     111 
     112                return function ( e ) 
     113                        { 
     114                                if ( !e ) 
     115                                        e = event ; 
     116 
     117                                var iCode = ( e.keyCode || e.charCode ) ; 
     118                                 
     119                                if ( !iCode && e.keyIdentifier && ( e.keyIdentifier in KeyIdentifierMap ) )  
     120                                                iCode = KeyIdentifierMap[ e.keyIdentifier ] ; 
     121 
     122                                return ( 
     123                                                ( iCode >= 48 && iCode <= 57 )          // Numbers 
     124                                                || (iCode >= 35 && iCode <= 40)         // Arrows, Home, End 
     125                                                || iCode == 8                                           // Backspace 
     126                                                || iCode == 46                                          // Delete 
     127                                                || iCode == 9                                           // Tab 
     128                                ) ; 
     129                        } 
     130        } )() ; 
    121131 
    122132String.prototype.Trim = function() 
  • FCKeditor/trunk/editor/dialog/fck_anchor.html

    r1108 r1398  
    3030                <script type="text/javascript"> 
    3131 
    32 var oEditor     = window.parent.InnerDialogLoaded() ; 
    33 var FCK         = oEditor.FCK ; 
    34 var FCKBrowserInfo = oEditor.FCKBrowserInfo ; 
    35 var FCKTools = oEditor.FCKTools ; 
    36 var FCKRegexLib = oEditor.FCKRegexLib ; 
    37  
    38 // Gets the document DOM 
    39 var oDOM = oEditor.FCK.EditorDocument ; 
    40  
    41 var oFakeImage = FCK.Selection.GetSelectedElement() ; 
     32var dialog                      = window.parent ; 
     33var oEditor                     = dialog.InnerDialogLoaded() ; 
     34 
     35var FCK                         = oEditor.FCK ; 
     36var FCKBrowserInfo      = oEditor.FCKBrowserInfo ; 
     37var FCKTools            = oEditor.FCKTools ; 
     38var FCKRegexLib         = oEditor.FCKRegexLib ; 
     39 
     40var oDOM                        = FCK.EditorDocument ; 
     41 
     42var oFakeImage = dialog.Selection.GetSelectedElement() ; 
     43 
    4244var oAnchor ; 
    4345 
     
    7072        window.parent.SetOkButton( true ) ; 
    7173        window.parent.SetAutoSize( true ) ; 
     74 
     75        SelectField( 'txtName' ) ; 
    7276} 
    7377 
  • FCKeditor/trunk/editor/dialog/fck_button.html

    r1108 r1398  
    3030        <script type="text/javascript"> 
    3131 
    32 var oEditor = window.parent.InnerDialogLoaded() ; 
     32var dialog      = window.parent ; 
     33var oEditor     = dialog.InnerDialogLoaded() ; 
    3334 
    3435// Gets the document DOM 
    3536var oDOM = oEditor.FCK.EditorDocument ; 
    3637 
    37 var oActiveEl = oEditor.FCKSelection.GetSelectedElement() ; 
     38var oActiveEl = dialog.Selection.GetSelectedElement() ; 
    3839 
    3940window.onload = function() 
     
    5354                oActiveEl = null ; 
    5455 
    55         window.parent.SetOkButton( true ) ; 
    56         window.parent.SetAutoSize( true ) ; 
     56        dialog.SetOkButton( true ) ; 
     57        dialog.SetAutoSize( true ) ; 
     58        SelectField( 'txtName' ) ; 
    5759} 
    5860 
  • FCKeditor/trunk/editor/dialog/fck_checkbox.html

    r1108 r1398  
    3030                <script type="text/javascript"> 
    3131 
    32 var oEditor = window.parent.InnerDialogLoaded() ; 
     32var dialog      = window.parent ; 
     33var oEditor     = dialog.InnerDialogLoaded() ; 
    3334 
    3435// Gets the document DOM 
    3536var oDOM = oEditor.FCK.EditorDocument ; 
    3637 
    37 var oActiveEl = oEditor.FCKSelection.GetSelectedElement() ; 
     38var oActiveEl = dialog.Selection.GetSelectedElement() ; 
    3839 
    3940window.onload = function() 
     
    5152                oActiveEl = null ; 
    5253 
    53         window.parent.SetOkButton( true ) ; 
    54         window.parent.SetAutoSize( true ) ; 
     54        dialog.SetOkButton( true ) ; 
     55        dialog.SetAutoSize( true ) ; 
     56        SelectField( 'txtName' ) ; 
    5557} 
    5658 
  • FCKeditor/trunk/editor/dialog/fck_colorselector.html

    r1192 r1398  
    137137function Ok() 
    138138{ 
    139         if ( typeof(window.parent.args.CustomValue) == 'function' ) 
    140                 window.parent.args.CustomValue( document.getElementById('selcolor').value ) ; 
     139        if ( typeof(window.parent.Args().CustomValue) == 'function' ) 
     140                window.parent.Args().CustomValue( document.getElementById('selcolor').value ) ; 
    141141 
    142142        return true ; 
  • FCKeditor/trunk/editor/dialog/fck_docprops.html

    r644 r1398  
    375375        switch ( wich ) 
    376376        { 
    377                 case 'Back'                     : oEditor.FCKDialog.OpenDialog( 'FCKDialog_Color', FCKLang.DlgColorTitle, 'dialog/fck_colorselector.html', 400, 330, SelectBackColor, window ) ; return ; 
    378                 case 'ColorText'        : oEditor.FCKDialog.OpenDialog( 'FCKDialog_Color', FCKLang.DlgColorTitle, 'dialog/fck_colorselector.html', 400, 330, SelectColorText, window ) ; return ; 
    379                 case 'ColorLink'        : oEditor.FCKDialog.OpenDialog( 'FCKDialog_Color', FCKLang.DlgColorTitle, 'dialog/fck_colorselector.html', 400, 330, SelectColorLink, window ) ; return ; 
    380                 case 'ColorVisited'     : oEditor.FCKDialog.OpenDialog( 'FCKDialog_Color', FCKLang.DlgColorTitle, 'dialog/fck_colorselector.html', 400, 330, SelectColorVisited, window ) ; return ; 
    381                 case 'ColorActive'      : oEditor.FCKDialog.OpenDialog( 'FCKDialog_Color', FCKLang.DlgColorTitle, 'dialog/fck_colorselector.html', 400, 330, SelectColorActive, window ) ; return ; 
     377                case 'Back'                     : oEditor.FCKDialog.OpenDialog( 'FCKDialog_Color', FCKLang.DlgColorTitle, 'dialog/fck_colorselector.html', 410, 320, SelectBackColor, window ) ; return ; 
     378                case 'ColorText'        : oEditor.FCKDialog.OpenDialog( 'FCKDialog_Color', FCKLang.DlgColorTitle, 'dialog/fck_colorselector.html', 410, 320, SelectColorText, window ) ; return ; 
     379                case 'ColorLink'        : oEditor.FCKDialog.OpenDialog( 'FCKDialog_Color', FCKLang.DlgColorTitle, 'dialog/fck_colorselector.html', 410, 320, SelectColorLink, window ) ; return ; 
     380                case 'ColorVisited'     : oEditor.FCKDialog.OpenDialog( 'FCKDialog_Color', FCKLang.DlgColorTitle, 'dialog/fck_colorselector.html', 410, 320, SelectColorVisited, window ) ; return ; 
     381                case 'ColorActive'      : oEditor.FCKDialog.OpenDialog( 'FCKDialog_Color', FCKLang.DlgColorTitle, 'dialog/fck_colorselector.html', 410, 320, SelectColorActive, window ) ; return ; 
    382382        } 
    383383} 
  • FCKeditor/trunk/editor/dialog/fck_flash/fck_flash.js

    r1253 r1398  
    2222 */ 
    2323 
    24 var oEditor             = window.parent.InnerDialogLoaded() ; 
     24var dialog              = window.parent ; 
     25var oEditor             = dialog.InnerDialogLoaded() ; 
    2526var FCK                 = oEditor.FCK ; 
    2627var FCKLang             = oEditor.FCKLang ; 
     
    3031 
    3132// Set the dialog tabs. 
    32 window.parent.AddTab( 'Info', oEditor.FCKLang.DlgInfoTab ) ; 
     33dialog.AddTab( 'Info', oEditor.FCKLang.DlgInfoTab ) ; 
    3334 
    3435if ( FCKConfig.FlashUpload ) 
    35         window.parent.AddTab( 'Upload', FCKLang.DlgLnkUpload ) ; 
     36        dialog.AddTab( 'Upload', FCKLang.DlgLnkUpload ) ; 
    3637 
    3738if ( !FCKConfig.FlashDlgHideAdvanced ) 
    38         window.parent.AddTab( 'Advanced', oEditor.FCKLang.DlgAdvancedTag ) ; 
     39        dialog.AddTab( 'Advanced', oEditor.FCKLang.DlgAdvancedTag ) ; 
    3940 
    4041// Function called when a dialog tag is selected. 
     
    4748 
    4849// Get the selected flash embed (if available). 
    49 var oFakeImage = FCK.Selection.GetSelectedElement() ; 
     50var oFakeImage = dialog.Selection.GetSelectedElement() ; 
    5051var oEmbed ; 
    5152 
     
    7374                GetE('frmUpload').action = FCKConfig.FlashUploadURL ; 
    7475 
    75         window.parent.SetAutoSize( true ) ; 
     76        dialog.SetAutoSize( true ) ; 
    7677 
    7778        // Activate the "OK" button. 
    78         window.parent.SetOkButton( true ) ; 
     79        dialog.SetOkButton( true ) ; 
     80 
     81        SelectField( 'txtUrl' ) ; 
    7982} 
    8083 
     
    115118        if ( GetE('txtUrl').value.length == 0 ) 
    116119        { 
    117                 window.parent.SetSelectedTab( 'Info' ) ; 
     120                dialog.SetSelectedTab( 'Info' ) ; 
    118121                GetE('txtUrl').focus() ; 
    119122 
     
    228231        UpdatePreview() ; 
    229232 
    230         window.parent.SetSelectedTab( 'Info' ) ; 
     233        dialog.SetSelectedTab( 'Info' ) ; 
    231234} 
    232235 
  • FCKeditor/trunk/editor/dialog/fck_form.html

    r1108 r1398  
    3030        <script type="text/javascript"> 
    3131 
    32 var oEditor = window.parent.InnerDialogLoaded() ; 
     32var dialog      = window.parent ; 
     33var oEditor = dialog.InnerDialogLoaded() ; 
    3334 
    3435// Gets the document DOM 
    3536var oDOM = oEditor.FCK.EditorDocument ; 
    3637 
    37 var oActiveEl = oEditor.FCKSelection.MoveToAncestorNode( 'FORM' ) ; 
     38var oActiveEl = dialog.Selection.GetSelection().MoveToAncestorNode( 'FORM' ) ; 
    3839 
    3940window.onload = function() 
     
    5152                oActiveEl = null ; 
    5253 
    53         window.parent.SetOkButton( true ) ; 
    54         window.parent.SetAutoSize( true ) ; 
     54        dialog.SetOkButton( true ) ; 
     55        dialog.SetAutoSize( true ) ; 
     56        SelectField( 'txtName' ) ; 
    5557} 
    5658 
  • FCKeditor/trunk/editor/dialog/fck_hiddenfield.html

    r1108 r1398  
    1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" > 
     1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" > 
    22<!-- 
    33 * FCKeditor - The text editor for Internet - http://www.fckeditor.net 
     
    3030        <script type="text/javascript"> 
    3131 
    32 var oEditor = window.parent.InnerDialogLoaded() ; 
     32var dialog      = window.parent ; 
     33var oEditor = dialog.InnerDialogLoaded() ; 
     34 
    3335var FCK = oEditor.FCK ; 
    3436 
     
    3739 
    3840// Get the selected flash embed (if available). 
    39 var oFakeImage = FCK.Selection.GetSelectedElement() ; 
     41var oFakeImage = dialog.Selection.GetSelectedElement() ; 
    4042var oActiveEl ; 
    4143 
     
    5961        } 
    6062 
    61         window.parent.SetOkButton( true ) ; 
    62         window.parent.SetAutoSize( true ) ; 
     63        dialog.SetOkButton( true ) ; 
     64        dialog.SetAutoSize( true ) ; 
     65        SelectField( 'txtName' ) ; 
    6366} 
    6467 
  • FCKeditor/trunk/editor/dialog/fck_image/fck_image.js

    r1253 r1398  
    2222 */ 
    2323 
    24 var oEditor             = window.parent.InnerDialogLoaded() ; 
     24var dialog              = window.parent ; 
     25var oEditor             = dialog.InnerDialogLoaded() ; 
    2526var FCK                 = oEditor.FCK ; 
    2627var FCKLang             = oEditor.FCKLang ; 
     
    3334 
    3435// Set the dialog tabs. 
    35 window.parent.AddTab( 'Info', FCKLang.DlgImgInfoTab ) ; 
     36dialog.AddTab( 'Info', FCKLang.DlgImgInfoTab ) ; 
    3637 
    3738if ( !bImageButton && !FCKConfig.ImageDlgHideLink ) 
    38         window.parent.AddTab( 'Link', FCKLang.DlgImgLinkTab ) ; 
     39        dialog.AddTab( 'Link', FCKLang.DlgImgLinkTab ) ; 
    3940 
    4041if ( FCKConfig.ImageUpload ) 
    41         window.parent.AddTab( 'Upload', FCKLang.DlgLnkUpload ) ; 
     42        dialog.AddTab( 'Upload', FCKLang.DlgLnkUpload ) ; 
    4243 
    4344if ( !FCKConfig.ImageDlgHideAdvanced ) 
    44         window.parent.AddTab( 'Advanced', FCKLang.DlgAdvancedTag ) ; 
     45        dialog.AddTab( 'Advanced', FCKLang.DlgAdvancedTag ) ; 
    4546 
    4647// Function called when a dialog tag is selected. 
     
    5455 
    5556// Get the selected image (if available). 
    56 var oImage = FCK.Selection.GetSelectedElement() ; 
     57var oImage = dialog.Selection.GetSelectedElement() ; 
    5758 
    5859if ( oImage && oImage.tagName != 'IMG' && !( oImage.tagName == 'INPUT' && oImage.type == 'image' ) ) 
     
    6061 
    6162// Get the active link. 
    62 var oLink = FCK.Selection.MoveToAncestorNode( 'A' ) ; 
     63var oLink = dialog.Selection.GetSelection().MoveToAncestorNode( 'A' ) ; 
    6364 
    6465var oImageOriginal ; 
     
    112113                GetE('frmUpload').action = FCKConfig.ImageUploadURL ; 
    113114 
    114         window.parent.SetAutoSize( true ) ; 
     115        dialog.SetAutoSize( true ) ; 
    115116 
    116117        // Activate the "OK" button. 
    117         window.parent.SetOkButton( true ) ; 
     118        dialog.SetOkButton( true ) ; 
     119 
     120        SelectField( 'txtUrl' ) ; 
    118121} 
    119122 
     
    198201        if ( GetE('txtUrl').value.length == 0 ) 
    199202        { 
    200                 window.parent.SetSelectedTab( 'Info' ) ; 
     203                dialog.SetSelectedTab( 'Info' ) ; 
    201204                GetE('txtUrl').focus() ; 
    202205 
     
    247250                else                    // Creating a new link. 
    248251                { 
     252                        dialog.Selection.EnsureSelection() ; 
     253 
    249254                        if ( !bHasImage ) 
    250255                                oEditor.FCKSelection.SelectNode( oImage ) ; 
     
    434439        } 
    435440 
    436         window.parent.SetSelectedTab( 'Info' ) ; 
     441        dialog.SetSelectedTab( 'Info' ) ; 
    437442} 
    438443 
  • FCKeditor/trunk/editor/dialog/fck_link/fck_link.js

    r1253 r1398  
    2222 */ 
    2323 
    24 var oEditor             = window.parent.InnerDialogLoaded() ; 
     24var dialog      = window.parent ; 
     25var oEditor = dialog.InnerDialogLoaded() ; 
     26 
    2527var FCK                 = oEditor.FCK ; 
    2628var FCKLang             = oEditor.FCKLang ; 
     
    3234 
    3335// Set the dialog tabs. 
    34 window.parent.AddTab( 'Info', FCKLang.DlgLnkInfoTab ) ; 
     36dialog.AddTab( 'Info', FCKLang.DlgLnkInfoTab ) ; 
    3537 
    3638if ( !FCKConfig.LinkDlgHideTarget ) 
    37         window.parent.AddTab( 'Target', FCKLang.DlgLnkTargetTab, true ) ; 
     39        dialog.AddTab( 'Target', FCKLang.DlgLnkTargetTab, true ) ; 
    3840 
    3941if ( FCKConfig.LinkUpload ) 
    40         window.parent.AddTab( 'Upload', FCKLang.DlgLnkUpload, true ) ; 
     42        dialog.AddTab( 'Upload', FCKLang.DlgLnkUpload, true ) ; 
    4143 
    4244if ( !FCKConfig.LinkDlgHideAdvanced ) 
    43         window.parent.AddTab( 'Advanced', FCKLang.DlgAdvancedTag ) ; 
     45        dialog.AddTab( 'Advanced', FCKLang.DlgAdvancedTag ) ; 
    4446 
    4547// Function called when a dialog tag is selected. 
     
    5153        ShowE('divAttribs'      , ( tabCode == 'Advanced' ) ) ; 
    5254 
    53         window.parent.SetAutoSize( true ) ; 
     55        dialog.SetAutoSize( true ) ; 
    5456} 
    5557 
     
    125127 
    126128// oLink: The actual selected link in the editor. 
    127 var oLink = FCK.Selection.MoveToAncestorNode( 'A' ) ; 
     129var oLink = dialog.Selection.GetSelection().MoveToAncestorNode( 'A' ) ; 
    128130if ( oLink ) 
    129131        FCK.Selection.SelectNode( oLink ) ; 
     
    157159 
    158160        // Activate the "OK" button. 
    159         window.parent.SetOkButton( true ) ; 
     161        dialog.SetOkButton( true ) ; 
     162        SelectField( 'txtUrl' ) ; 
    160163} 
    161164 
     
    339342 
    340343        if ( !FCKConfig.LinkDlgHideTarget ) 
    341                 window.parent.SetTabVisibility( 'Target'        , (linkType == 'url') ) ; 
     344                dialog.SetTabVisibility( 'Target'       , (linkType == 'url') ) ; 
    342345 
    343346        if ( FCKConfig.LinkUpload ) 
    344                 window.parent.SetTabVisibility( 'Upload'        , (linkType == 'url') ) ; 
     347                dialog.SetTabVisibility( 'Upload'       , (linkType == 'url') ) ; 
    345348 
    346349        if ( !FCKConfig.LinkDlgHideAdvanced ) 
    347                 window.parent.SetTabVisibility( 'Advanced'      , (linkType != 'anchor' || bHasAnchors) ) ; 
     350                dialog.SetTabVisibility( 'Advanced'     , (linkType != 'anchor' || bHasAnchors) ) ; 
    348351 
    349352        if ( linkType == 'email' ) 
    350                 window.parent.SetAutoSize( true ) ; 
     353                dialog.SetAutoSize( true ) ; 
    351354} 
    352355 
     
    372375 
    373376        if ( targetType == 'popup' ) 
    374                 window.parent.SetAutoSize( true ) ; 
     377                dialog.SetAutoSize( true ) ; 
    375378} 
    376379 
     
    621624 
    622625        // Select the (first) link. 
     626        dialog.Selection.EnsureSelection() ; 
    623627        oEditor.FCKSelection.SelectNode( aLinks[0] ); 
    624628 
     
    635639        document.getElementById('txtUrl').value = url ; 
    636640        OnUrlChange() ; 
    637         window.parent.SetSelectedTab( 'Info' ) ; 
     641        dialog.SetSelectedTab( 'Info' ) ; 
    638642} 
    639643 
  • FCKeditor/trunk/editor/dialog/fck_listprop.html

    r1108 r1398  
    3030        <script type="text/javascript"> 
    3131 
    32 var oEditor = window.parent.InnerDialogLoaded() ; 
     32var dialog      = window.parent ; 
     33var oEditor = dialog.InnerDialogLoaded() ; 
    3334 
    3435// Gets the document DOM 
     
    3637var sListType = ( location.search == '?OL' ? 'OL' : 'UL' ) ; 
    3738 
    38 var oActiveEl = oEditor.FCKSelection.MoveToAncestorNode( sListType ) ; 
     39var oActiveEl = dialog.Selection.GetSelection().MoveToAncestorNode( sListType ) ; 
    3940var oActiveSel ; 
    4041 
     
    6465        } 
    6566 
    66         window.parent.SetOkButton( true ) ; 
    67         window.parent.SetAutoSize( true ) ; 
     67        dialog.SetOkButton( true ) ; 
     68        dialog.SetAutoSize( true ) ; 
     69 
     70        SelectField( 'txtStartPosition' ) ; 
    6871} 
    6972 
  • FCKeditor/trunk/editor/dialog/fck_paste.html

    r1192 r1398  
    139139                var range = new oEditor.FCKDomRange( oEditor.FCK.EditorWindow ) ; 
    140140                var oDoc = oEditor.FCK.EditorDocument ; 
     141                dialog.Selection.EnsureSelection() ; 
    141142                range.MoveToSelection() ; 
    142143                range.DeleteContents() ; 
  • FCKeditor/trunk/editor/dialog/fck_radiobutton.html

    r1108 r1398  
    3030                <script type="text/javascript"> 
    3131 
    32 var oEditor = window.parent.InnerDialogLoaded() ; 
     32var dialog      = window.parent ; 
     33var oEditor = dialog.InnerDialogLoaded() ; 
    3334 
    3435// Gets the document DOM 
    3536var oDOM = oEditor.FCK.EditorDocument ; 
    3637 
    37 var oActiveEl = oEditor.FCKSelection.GetSelectedElement() ; 
     38var oActiveEl = dialog.Selection.GetSelectedElement() ; 
    3839 
    3940window.onload = function() 
     
    5152                oActiveEl = null ; 
    5253 
    53         window.parent.SetOkButton( true ) ; 
    54         window.parent.SetAutoSize( true ) ; 
     54        dialog.SetOkButton( true ) ; 
     55        dialog.SetAutoSize( true ) ; 
     56        SelectField( 'txtName' ) ; 
    5557} 
    5658 
  • FCKeditor/trunk/editor/dialog/fck_replace.html

    r1124 r1398  
    3030        <script type="text/javascript"> 
    3131 
    32 var oEditor = window.parent.InnerDialogLoaded() ; 
     32var dialog      = window.parent ; 
     33var oEditor = dialog.InnerDialogLoaded() ; 
     34var dialogArguments = dialog.Args() ; 
     35 
    3336var FCKLang = oEditor.FCKLang ; 
    3437 
    35 window.parent.AddTab( 'Find', FCKLang.DlgFindTitle ) ; 
    36 window.parent.AddTab( 'Replace', FCKLang.DlgReplaceTitle ) ; 
     38dialog.AddTab( 'Find', FCKLang.DlgFindTitle ) ; 
     39dialog.AddTab( 'Replace', FCKLang.DlgReplaceTitle ) ; 
    3740var idMap = {} ; 
    3841 
     
    4649 
    4750        if ( tabCode == 'Replace' ) 
    48                 window.parent.SetAutoSize( true ) ; 
     51                dialog.SetAutoSize( true ) ; 
     52} 
     53 
     54// Place a range at the start of document. 
     55// This will be the starting point of our search. 
     56var GlobalRange = new oEditor.FCKDomRange( oEditor.FCK.EditorWindow ) ; 
     57GlobalRange.SetStart( oEditor.FCK.EditorDocument.body, 1 ) ; 
     58GlobalRange.SetEnd( oEditor.FCK.EditorDocument.body, 1 ) ; 
     59GlobalRange.Collapse( true ) ; 
     60 
     61var HighlightRange = null ; 
     62function Highlight() 
     63{ 
     64        if ( HighlightRange ) 
     65                ClearHighlight() ; 
     66        var cloneRange = GlobalRange.Clone() ; 
     67        oEditor.FCKStyles.GetStyle( '_FCK_SelectionHighlight' ).ApplyToRange( cloneRange, false, true ) ; 
     68        HighlightRange = cloneRange ; 
     69        GlobalRange = HighlightRange.Clone() ; 
     70} 
     71 
     72function ClearHighlight() 
     73{ 
     74        if ( HighlightRange ) 
     75        { 
     76                oEditor.FCKStyles.GetStyle( '_FCK_SelectionHighlight' ).RemoveFromRange( HighlightRange, false, true ) ; 
     77                HighlightRange = null ; 
     78        } 
    4979} 
    5080 
     
    5484        oEditor.FCKLanguageManager.TranslatePage( document ) ; 
    5585 
    56         // Place the cursor at the start of document. 
    57         // This will be the starting point of our search. 
    58         var range = new oEditor.FCKDomRange( oEditor.FCK.EditorWindow ) ; 
    59         range.SetStart( oEditor.FCK.EditorDocument.body, 1 ) ; 
    60         range.SetEnd( oEditor.FCK.EditorDocument.body, 1 ) ; 
    61         range.Collapse( true ) ; 
    62         range.Select() ; 
    63  
    6486        // Show the appropriate tab at startup. 
    65         if ( window.parent.name.search( 'Replace' ) == -1 ) 
    66         { 
    67                 window.parent.SetSelectedTab( 'Find' ) ; 
    68                 window.parent.SetAutoSize( true ) ; 
     87        if ( dialogArguments.CustomValue == 'Find' ) 
     88        { 
     89                dialog.SetSelectedTab( 'Find' ) ; 
     90                dialog.SetAutoSize( true ) ; 
    6991        } 
    7092        else 
    71                 window.parent.SetSelectedTab( 'Replace' ) ; 
    72  
     93                dialog.SetSelectedTab( 'Replace' ) ; 
     94 
     95        SelectField( 'txtFind' + dialogArguments.CustomValue ) ; 
    7396} 
    7497 
     
    79102                        document.getElementById('btnFind').disabled = 
    80103                                ( document.getElementById(idMap["FindText"]).value.length == 0 ) ; 
    81 } 
    82  
    83 function GetSelection() 
    84 { 
    85         var range = new oEditor.FCKDomRange( oEditor.FCK.EditorWindow ) ; 
    86         range.MoveToSelection() ; 
    87         return range.CreateBookmark2() ; 
    88104} 
    89105 
     
    262278        // Start from the end of the current selection. 
    263279        var matcher = new KmpMatch( GetSearchString(), ! GetCheckCase() ) ; 
    264         var cursor = GetSelection().End ; 
     280        var cursor = GlobalRange.CreateBookmark2().End ; 
    265281        var matchState = KMP_NOMATCH ; 
    266282        var matchBookmark = null ; 
     
    342358        } 
    343359 
    344         // If we've found a match, select the match. 
     360        // If we've found a match, highlight the match. 
    345361        if ( matchState == KMP_MATCHED ) 
    346362        { 
    347                 var range = new oEditor.FCKDomRange( oEditor.FCK.EditorWindow ) ; 
    348                 range.MoveToBookmark2( matchBookmark ) ; 
    349                 range.Select() ; 
    350                 var focus = range._Range.endContainer ; 
     363                GlobalRange.MoveToBookmark2( matchBookmark ) ; 
     364                Highlight() ; 
     365                var focus = GlobalRange._Range.endContainer ; 
    351366                while ( focus && focus.nodeType != 1 ) 
    352367                        focus = focus.parentNode ; 
     
    368383function Find() 
    369384{ 
    370         var range = new oEditor.FCKDomRange( oEditor.FCK.EditorWindow ) ; 
    371         range.MoveToSelection() ; 
    372         range.Collapse( false ) ; 
    373         range.Select() ; 
    374  
    375385        if ( ! _Find() ) 
     386        { 
     387                ClearHighlight() ; 
    376388                alert( FCKLang.DlgFindNotFoundMsg ) ; 
     389        } 
    377390} 
    378391 
    379392function Replace() 
    380393{ 
    381         var selection = new oEditor.FCKDomRange( oEditor.FCK.EditorWindow ) ; 
    382         selection.MoveToSelection() ; 
    383  
    384         if ( selection.CheckIsCollapsed() ) 
     394        if ( GlobalRange.CheckIsCollapsed() ) 
    385395        { 
    386396                if (! _Find() ) 
     397                { 
     398                        ClearHighlight() ; 
    387399                        alert( FCKLang.DlgFindNotFoundMsg ) ; 
     400                } 
    388401        } 
    389402        else 
    390403        { 
    391404                oEditor.FCKUndo.SaveUndoStep() ; 
    392                 selection.DeleteContents() ; 
    393                 selection.InsertNode( oEditor.FCK.EditorDocument.createTextNode( GetReplaceString() ) ) ; 
    394                 selection.Collapse( false ) ; 
    395                 selection.Select() ; 
     405                GlobalRange.DeleteContents() ; 
     406                GlobalRange.InsertNode( oEditor.FCK.EditorDocument.createTextNode( GetReplaceString() ) ) ; 
     407                GlobalRange.Collapse( false ) ; 
    396408        } 
    397409} 
     
    400412{ 
    401413        oEditor.FCKUndo.SaveUndoStep() ; 
    402         var range = new oEditor.FCKDomRange( oEditor.FCK.EditorWindow ) ; 
    403  
    404414        var replaceCount = 0 ; 
    405415 
    406416        while ( _Find() ) 
    407417        { 
    408                 range.MoveToSelection() ; 
    409                 range.DeleteContents() ; 
    410                 range.InsertNode( oEditor.FCK.EditorDocument.createTextNode( GetReplaceString() ) ) ; 
    411                 range.Collapse( false ) ; 
    412                 range.Select() ; 
     418                dialog.Selection.EnsureSelection() ; 
     419                GlobalRange.DeleteContents() ; 
     420                GlobalRange.InsertNode( oEditor.FCK.EditorDocument.createTextNode( GetReplaceString() ) ) ; 
     421                GlobalRange.Collapse( false ) ; 
    413422                replaceCount++ ; 
    414423        } 
    415424        if ( replaceCount == 0 ) 
     425        { 
     426                ClearHighlight() ; 
    416427                alert( FCKLang.DlgFindNotFoundMsg ) ; 
    417         window.parent.Cancel() ; 
    418 } 
     428        } 
     429        dialog.Cancel() ; 
     430} 
     431 
     432window.onunload = function(){ ClearHighlight() ; } 
    419433        </script> 
    420434</head> 
  • FCKeditor/trunk/editor/dialog/fck_select.html

    r1108 r1398  
    3131                <script type="text/javascript"> 
    3232 
    33 var oEditor = window.parent.InnerDialogLoaded() ; 
     33var dialog      = window.parent ; 
     34var oEditor = dialog.InnerDialogLoaded() ; 
    3435 
    3536// Gets the document DOM 
    3637var oDOM = oEditor.FCK.EditorDocument ; 
    3738 
    38 var oActiveEl = oEditor.FCKSelection.GetSelectedElement() ; 
     39var oActiveEl = dialog.Selection.GetSelectedElement() ; 
    3940 
    4041var oListText ; 
     
    6970                oActiveEl = null ; 
    7071 
    71         window.parent.SetOkButton( true ) ; 
    72         window.parent.SetAutoSize( true ) ; 
     72        dialog.SetOkButton( true ) ; 
     73        dialog.SetAutoSize( true ) ; 
     74        SelectField( 'txtName' ) ; 
    7375} 
    7476 
  • FCKeditor/trunk/editor/dialog/fck_smiley.html

    r1192 r1398  
    3737        <script type="text/javascript"> 
    3838 
    39 var oEditor = window.parent.InnerDialogLoaded() ; 
     39var dialog      = window.parent ; 
     40var oEditor = dialog.InnerDialogLoaded() ; 
    4041 
    4142window.onload = function () 
     
    4445        oEditor.FCKLanguageManager.TranslatePage(document) ; 
    4546 
    46         window.parent.SetAutoSize( true ) ; 
     47        dialog.SetAutoSize( true ) ; 
    4748} 
    4849 
    4950function InsertSmiley( url ) 
    5051{ 
     52        dialog.Selection.EnsureSelection() ; 
     53 
    5154        oEditor.FCKUndo.SaveUndoStep() ; 
     55 
    5256        var oImg = oEditor.FCK.InsertElement( 'img' ) ; 
    5357        oImg.src = url ; 
     
    5963        document.body.innerHTML = '' ; 
    6064 
    61         window.parent.Cancel() ; 
     65        dialog.Cancel() ; 
    6266} 
    6367 
  • FCKeditor/trunk/editor/dialog/fck_specialchar.html

    r1283 r1398  
    4444{ 
    4545        oEditor.FCKUndo.SaveUndoStep() ; 
     46        parent.Selection.EnsureSelection() ; 
    4647        oEditor.FCK.InsertHtml( charValue || "" ) ; 
    4748        window.parent.Cancel() ; 
  • FCKeditor/trunk/editor/dialog/fck_tablecell.html

    r453 r1398  
    3030        <script type="text/javascript"> 
    3131 
    32 var oEditor = window.parent.InnerDialogLoaded() ; 
     32var dialog      = window.parent ; 
     33var oEditor = dialog.InnerDialogLoaded() ; 
    3334 
    3435// Gets the document DOM 
     
    3637 
    3738// Array of selected Cells 
     39dialog.Selection.EnsureSelection() ; 
    3840var aCells = oEditor.FCKTableHandler.GetSelectedCells() ; 
    3941 
     
    4547        SetStartupValue() ; 
    4648 
    47         window.parent.SetOkButton( true ) ; 
    48         window.parent.SetAutoSize( true ) ; 
     49        dialog.SetOkButton( true ) ; 
     50        dialog.SetAutoSize( true ) ; 
     51        SelectField( 'txtWidth' ) ; 
    4952} 
    5053 
     
    119122function SelectColor( wich ) 
    120123{ 
    121         oEditor.FCKDialog.OpenDialog( 'FCKDialog_Color', oEditor.FCKLang.DlgColorTitle, 'dialog/fck_colorselector.html', 400, 330, wich == 'Back' ? SelectBackColor : SelectBorderColor, window ) ; 
     124        oEditor.FCKDialog.OpenDialog( 'FCKDialog_Color', oEditor.FCKLang.DlgColorTitle, 'dialog/fck_colorselector.html', 410, 320, wich == 'Back' ? SelectBackColor : SelectBorderColor, window ) ; 
    122125} 
    123126 
  • FCKeditor/trunk/editor/dialog/fck_table.html

    r933 r1398  
    3030        <script type="text/javascript"> 
    3131 
    32 var oEditor = window.parent.InnerDialogLoaded() ; 
     32var dialog      = window.parent ; 
     33var oEditor = dialog.InnerDialogLoaded() ; 
     34var dialogArguments = dialog.Args() ; 
    3335 
    3436// Gets the document DOM 
     
    3739// Gets the table if there is one selected. 
    3840var table ; 
    39 var e = oEditor.FCKSelection.GetSelectedElement() ; 
     41var e = dialog.Selection.GetSelectedElement() ; 
    4042 
    4143if ( ( !e && document.location.search.substr(1) == 'Parent' ) || ( e && e.tagName != 'TABLE' ) ) 
     
    8991                document.getElementById('txtRows').disabled    = true ; 
    9092                document.getElementById('txtColumns').disabled = true ; 
    91         } 
    92  
    93         window.parent.SetOkButton( true ) ; 
    94         window.parent.SetAutoSize( true ) ; 
     93                SelectField( 'txtWidth' ) ; 
     94        } 
     95        else 
     96                SelectField( 'txtRows' ) ; 
     97 
     98        dialog.SetOkButton( true ) ; 
     99        dialog.SetAutoSize( true ) ; 
    95100} 
    96101 
  • FCKeditor/trunk/editor/dialog/fck_textarea.html

    r1108 r1398  
    3030                <script type="text/javascript"> 
    3131 
    32 var oEditor = window.parent.InnerDialogLoaded() ; 
     32var dialog      = window.parent ; 
     33var oEditor = dialog.InnerDialogLoaded() ; 
    3334 
    3435// Gets the document DOM 
    3536var oDOM = oEditor.FCK.EditorDocument ; 
    3637 
    37 var oActiveEl = oEditor.FCKSelection.GetSelectedElement() ; 
     38var oActiveEl = dialog.Selection.GetSelectedElement() ; 
    3839 
    3940window.onload = function() 
     
    5152                oActiveEl = null ; 
    5253 
    53         window.parent.SetOkButton( true ) ; 
    54         window.parent.SetAutoSize( true ) ; 
     54        dialog.SetOkButton( true ) ; 
     55        dialog.SetAutoSize( true ) ; 
     56        SelectField( 'txtName' ) ; 
    5557} 
    5658 
  • FCKeditor/trunk/editor/dialog/fck_textfield.html

    r1108 r1398  
    3030        <script type="text/javascript"> 
    3131 
    32 var oEditor = window.parent.InnerDialogLoaded() ; 
     32var dialog      = window.parent ; 
     33var oEditor = dialog.InnerDialogLoaded() ; 
    3334 
    3435// Gets the document DOM 
    3536var oDOM = oEditor.FCK.EditorDocument ; 
    3637 
    37 var oActiveEl = oEditor.FCKSelection.GetSelectedElement() ; 
     38var oActiveEl = dialog.Selection.GetSelectedElement() ; 
    3839 
    3940window.onload = function() 
     
    5556                oActiveEl = null ; 
    5657 
    57         window.parent.SetOkButton( true ) ; 
    58         window.parent.SetAutoSize( true ) ; 
     58        dialog.SetOkButton( true ) ; 
     59        dialog.SetAutoSize( true ) ; 
     60        SelectField( 'txtName' ) ; 
    5961} 
    6062 
  • FCKeditor/trunk/editor/dtd/fck_xhtml10strict.js

    r1211 r1398  
    1 /* 
     1/* 
    22 * FCKeditor - The text editor for Internet - http://www.fckeditor.net 
    33 * Copyright (C) 2003-2007 Frederico Caldeira Knabben 
  • FCKeditor/trunk/editor/dtd/fck_xhtml10transitional.js

    r1211 r1398  
    1 /* 
     1/* 
    22 * FCKeditor - The text editor for Internet - http://www.fckeditor.net 
    33 * Copyright (C) 2003-2007 Frederico Caldeira Knabben 
  • FCKeditor/trunk/editor/fckdialog.html

    r1192 r1398  
    1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> 
     1<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
    22<!-- 
    33 * FCKeditor - The text editor for Internet - http://www.fckeditor.net 
     
    2424<html xmlns="http://www.w3.org/1999/xhtml"> 
    2525        <head> 
     26                <title></title> 
    2627                <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
    2728                <meta name="robots" content="noindex, nofollow" /> 
    2829                <script type="text/javascript"> 
    2930 
    30 var args = window.dialogArguments ; 
    31  
    32 // Automatically detect the correct document.domain (#123). 
     31var E = frameElement._DialogArguments.Editor ; 
     32 
     33// It seems referencing to frameElement._DialogArguments directly would lead to memory leaks in IE. 
     34// So let's use functions to access its members instead. 
     35function Args() 
     36{ 
     37        return frameElement._DialogArguments ; 
     38} 
     39 
     40function ParentDialog( dialog ) 
     41{ 
     42        return dialog ? dialog._ParentDialog : frameElement._ParentDialog ; 
     43} 
     44 
     45// Domain relaxation logic. 
    3346(function() 
    3447{ 
     
    4053                try 
    4154                { 
    42                         var parentDomain = window.opener ? window.opener.document.domain : args.Editor.document.domain ; 
    43                          
     55                        var parentDomain = ( Args().TopWindow || E ).document.domain ; 
     56 
    4457                        if ( document.domain != parentDomain ) 
    4558                                document.domain = parentDomain ; 
     59 
    4660                        break ; 
    4761                } 
    4862                catch( e ) {} 
    49                  
     63 
    5064                // Remove a domain part: www.mytest.example.com => mytest.example.com => example.com ... 
    5165                d = d.replace( /.*?(?:\.|$)/, '' ) ; 
     
    5367                if ( d.length == 0 ) 
    5468                        break ;         // It was not able to detect the domain. 
    55                  
     69 
    5670                document.domain = d ; 
    5771        } 
    58 })() ;  
    59  
    60 // On some Gecko browsers (probably over slow connections) the 
    61 // "dialogArguments" are not set so we must get it from the opener window. 
    62 if ( !args ) 
    63         args = window.dialogArguments = window.opener.FCKLastDialogInfo ; 
     72})() ; 
     73 
     74var FCK                         = E.FCK ; 
     75var FCKTools            = E.FCKTools ; 
     76var FCKDomTools         = E.FCKDomTools ; 
     77var FCKDialog           = E.FCKDialog ; 
     78var FCKBrowserInfo      = E.FCKBrowserInfo ; 
     79var FCKConfig           = E.FCKConfig ; 
     80 
     81// Steal the focus so that the caret would no longer stay in the editor iframe. 
     82window.focus() ; 
    6483 
    6584// Sets the Skin CSS 
    66 document.write( '<link href="' + args.Editor.FCKConfig.SkinPath + 'fck_dialog.css" type="text/css" rel="stylesheet">' ) ; 
     85document.write( '<link href="' + FCKConfig.SkinPath + 'fck_dialog.css" type="text/css" rel="stylesheet">' ) ; 
    6786 
    6887// Sets the language direction. 
    69 window.document.dir = args.Editor.FCKLang.Dir ; 
    70  
    71 // IE does not set the window name in showModalDialog(), let's set it here. 
    72 if ( args.Editor.FCKBrowserInfo.IsIE ) 
    73         window.name = args.DialogName ; 
    74  
    75 var sTitle = args.Title ; 
    76 document.write( '<title>' + sTitle + '<\/title>' ) ; 
    77  
    78 function LoadInnerDialog() 
    79 { 
    80         if ( window.onresize ) 
    81                 window.onresize() ; 
    82  
    83         // First of all, translate the dialog box contents. 
    84         args.Editor.FCKLanguageManager.TranslatePage( document ) ; 
    85  
    86         document.getElementById( 'FrameCell' ).innerHTML = '<iframe id="frmMain" src="' + args.Page + '" name="frmMain" frameborder="0" height="100%" width="100%" scrolling="auto"></iframe>' ; 
    87 } 
    88  
    89 function InnerDialogLoaded() 
    90 { 
    91         var oInnerDoc = document.getElementById('frmMain').contentWindow.document ; 
    92  
    93         // Set the language direction. 
    94         oInnerDoc.dir = args.Editor.FCKLang.Dir ; 
    95  
    96         // Sets the Skin CSS. 
    97         oInnerDoc.write( '<link href="' + args.Editor.FCKConfig.SkinPath + 'fck_dialog.css" type="text/css" rel="stylesheet">' ) ; 
    98  
    99         SetOnKeyDown( oInnerDoc ) ; 
    100         DisableContextMenu( oInnerDoc ) ; 
    101  
    102         return args.Editor ; 
    103 } 
    104  
    105 function SetOkButton( showIt ) 
    106 { 
    107         document.getElementById('btnOk').style.visibility = ( showIt ? '' : 'hidden' ) ; 
    108 } 
    109  
    110 var bAutoSize = false ; 
    111  
    112 function SetAutoSize( autoSize ) 
    113 { 
    114         bAutoSize = autoSize ; 
    115         RefreshSize() ; 
    116 } 
    117  
    118 function RefreshSize() 
    119 { 
    120         if ( bAutoSize ) 
    121         { 
    122                 var oInnerDoc = document.getElementById('frmMain').contentWindow.document ; 
    123  
    124                 var iFrameHeight ; 
    125                 if ( document.all ) 
    126                         iFrameHeight = oInnerDoc.body.offsetHeight ; 
     88var langDir = window.document.dir = E.FCKLang.Dir ; 
     89 
     90// For IE6-, the fck_dialog_ie6.js is loaded, used to fix limitations in the browser. 
     91if ( FCKBrowserInfo.IsIE && !FCKBrowserInfo.IsIE7 ) 
     92        document.write( '<' + 'script type="text/javascript" src="' + FCKConfig.SkinPath + 'fck_dialog_ie6.js"><' + '\/script>' ) ; 
     93 
     94FCKTools.RegisterDollarFunction( window ) ; 
     95 
     96// Resize related functions. 
     97var Sizer = function() 
     98{ 
     99        var bAutoSize = false ; 
     100 
     101        var retval = { 
     102                // Sets whether the dialog should auto-resize according to its content's height. 
     103                SetAutoSize : function( autoSize ) 
     104                { 
     105                        bAutoSize = autoSize ; 
     106                        this.RefreshSize() ; 
     107                }, 
     108 
     109                // Fit the dialog container's layout to the inner iframe's external size. 
     110                RefreshContainerSize : function() 
     111                { 
     112                        var frmMain = $( 'frmMain' ) ; 
     113 
     114                        if ( frmMain ) 
     115                        { 
     116                                // Get the container size. 
     117                                var height = $( 'contents' ).offsetHeight ; 
     118 
     119                                // Subtract the size of other elements. 
     120                                height -= $( 'TitleArea' ).offsetHeight ; 
     121                                height -= $( 'TabsRow' ).offsetHeight ; 
     122                                height -= $( 'DialogButtons' ).offsetHeight ; 
     123 
     124                                frmMain.style.height = Math.max( height, 0 ) + 'px' ; 
     125                        } 
     126                }, 
     127 
     128                // Resize and re-layout the dialog. 
     129                // Triggers the onresize event for the layout logic. 
     130                ResizeDialog : function( width, height ) 
     131                { 
     132                        FCKDomTools.SetElementStyles( window.frameElement, 
     133                                        { 
     134                                                'width' : width + 'px', 
     135                                                'height' : height + 'px' 
     136                                        } ) ; 
     137 
     138                        // If the skin have defined a function for resize fixes, call it now. 
     139                        if ( typeof window.DoResizeFixes == 'function' ) 
     140                                window.DoResizeFixes() ; 
     141                }, 
     142 
     143                // if bAutoSize is true, automatically fit the dialog size and layout to 
     144                // accomodate the inner iframe's internal height. 
     145                // if bAutoSize is false, then only the layout logic for the dialog decorations 
     146                // is run to accomodate the inner iframe's external height. 
     147                RefreshSize : function() 
     148                { 
     149                        if ( bAutoSize ) 
     150                        { 
     151                                var frmMain             = $( 'frmMain' ) ; 
     152                                var innerDoc    = frmMain.contentWindow.document ; 
     153                                var isStrict    = FCKTools.IsStrictMode( innerDoc ) ; 
     154 
     155                                // Get the size of the frame contents. 
     156                                var innerWidth  = isStrict ? innerDoc.documentElement.scrollWidth : innerDoc.body.scrollWidth ; 
     157                                var innerHeight = isStrict ? innerDoc.documentElement.scrollHeight : innerDoc.body.scrollHeight ; 
     158 
     159                                // Get the current frame size. 
     160                                var frameSize = FCKTools.GetViewPaneSize( frmMain.contentWindow ) ; 
     161 
     162                                var deltaWidth  = innerWidth - frameSize.Width ; 
     163                                var deltaHeight = innerHeight - frameSize.Height ; 
     164 
     165                                // If the contents fits the current size. 
     166                                if ( deltaWidth <= 0 && deltaHeight <= 0 ) 
     167                                        return ; 
     168 
     169                                var dialogWidth         = frameElement.offsetWidth + Math.max( deltaWidth, 0 ) ; 
     170                                var dialogHeight        = frameElement.offsetHeight + Math.max( deltaHeight, 0 ) ; 
     171 
     172                                this.ResizeDialog( dialogWidth, dialogHeight ) ; 
     173                        } 
     174                        this.RefreshContainerSize() ; 
     175                } 
     176        } 
     177 
     178        /** 
     179         * Safari seems to have a bug with the time when RefreshSize() is executed - it 
     180         * thinks frmMain's innerHeight is 0 if we query the value too soon after the 
     181         * page is loaded in some circumstances. (#1316) 
     182         * TODO : Maybe this is not needed anymore after #35. 
     183         */ 
     184        if ( FCKBrowserInfo.IsSafari ) 
     185        { 
     186                var originalRefreshSize = retval.RefreshSize ; 
     187 
     188                retval.RefreshSize = function() 
     189                { 
     190                        window.setTimeout( originalRefreshSize, 1 ) ; 
     191                } 
     192        } 
     193 
     194        window.onresize = function() 
     195        { 
     196                retval.RefreshContainerSize() ; 
     197        } 
     198 
     199        window.SetAutoSize = FCKTools.Bind( retval, retval.SetAutoSize ) ; 
     200 
     201        return retval ; 
     202}() ; 
     203 
     204// Manages the throbber image that appears if the inner part of dialog is taking too long to load. 
     205var Throbber = function() 
     206{ 
     207        var timer ; 
     208 
     209        var updateThrobber = function() 
     210        { 
     211                var throbberParent = $( 'throbberBlock' ) ; 
     212                var throbberBlocks = throbberParent.childNodes ; 
     213                var lastClass = throbberParent.lastChild.className ; 
     214 
     215                // From the last to the second one, copy the class from the previous one. 
     216                for ( var i = throbberBlocks.length - 1 ; i > 0 ; i-- ) 
     217                        throbberBlocks[i].className = throbberBlocks[i-1].className ; 
     218 
     219                // For the first one, copy the last class (rotation). 
     220                throbberBlocks[0].className = lastClass ; 
     221        } 
     222 
     223        return { 
     224                Show : function( waitMilliseconds ) 
     225                { 
     226                        // Auto-setup the Show function to be called again after the 
     227                        // requested amount of time. 
     228                        if ( waitMilliseconds && waitMilliseconds > 0 ) 
     229                        { 
     230                                timer = FCKTools.SetTimeout( this.Show, waitMilliseconds, this, null, window ) ; 
     231                                return ; 
     232                        } 
     233 
     234                        var throbberParent = $( 'throbberBlock' ) ; 
     235 
     236                        // Create the throbber blocks. 
     237                        var classIds = [ 1,2,3,4,5,4,3,2 ] ; 
     238                        while ( classIds.length > 0 ) 
     239                                throbberParent.appendChild( document.createElement( 'div' ) ).className = ' throbber_' + classIds.shift() ; 
     240 
     241                        // Center the throbber. 
     242                        var frm = $( 'contents' ) ; 
     243                        var frmCoords = FCKTools.GetDocumentPosition( window, frm ) ; 
     244                        var x = frmCoords.x + ( frm.offsetWidth - throbberParent.offsetWidth ) / 2 ; 
     245                        var y = frmCoords.y + ( frm.offsetHeight - throbberParent.offsetHeight ) / 2 ; 
     246                        throbberParent.style.left = parseInt( x, 10 ) + 'px' ; 
     247                        throbberParent.style.top = parseInt( y, 10 ) + 'px' ; 
     248 
     249                        // Show it. 
     250                        throbberParent.style.visibility = ''  ; 
     251 
     252                        // Setup the animation interval. 
     253                        timer = setInterval( updateThrobber, 100 ) ; 
     254                }, 
     255 
     256                Hide : function() 
     257                { 
     258                        if ( timer ) 
     259                        { 
     260                                clearInterval( timer ) ; 
     261                                timer = null ; 
     262                        } 
     263 
     264                        var throbberParent = document.getElementById( 'throbberBlock' ) ; 
     265                        if ( throbberParent ) 
     266                                FCKDomTools.RemoveNode( throbberParent ) ; 
     267                } 
     268        } ; 
     269}() ; 
     270 
     271// Drag and drop handlers. 
     272var DragAndDrop = function() 
     273{ 
     274        var registeredWindows = [] ; 
     275        var lastCoords ; 
     276        var currentPos ; 
     277 
     278        var cleanUpHandlers = function() 
     279        { 
     280                for ( var i = 0 ; i < registeredWindows.length ; i++ ) 
     281                { 
     282                        FCKTools.RemoveEventListener( registeredWindows[i].document, 'mousemove', dragMouseMoveHandler ) ; 
     283                        FCKTools.RemoveEventListener( registeredWindows[i].document, 'mouseup', dragMouseUpHandler ) ; 
     284                } 
     285        } 
     286 
     287        var dragMouseMoveHandler = function( evt ) 
     288        { 
     289                if ( !lastCoords ) 
     290                        return ; 
     291 
     292                if ( !evt ) 
     293                        evt = FCKTools.GetElementDocument( this ).parentWindow.event ; 
     294 
     295                // Updated the last coordinates. 
     296                var currentCoords = 
     297                { 
     298                        x : evt.screenX, 
     299                        y : evt.screenY 
     300                } ; 
     301 
     302                currentPos = 
     303                { 
     304                        x : currentPos.x + ( currentCoords.x - lastCoords.x ), 
     305                        y : currentPos.y + ( currentCoords.y - lastCoords.y ) 
     306                } ; 
     307 
     308                lastCoords = currentCoords ; 
     309 
     310                frameElement.style.left = currentPos.x + 'px' ; 
     311                frameElement.style.top  = currentPos.y + 'px' ; 
     312 
     313                if ( evt.preventDefault ) 
     314                        evt.preventDefault() ; 
    127315                else 
    128                         iFrameHeight = document.getElementById('frmMain').contentWindow.innerHeight ; 
    129  
    130                 var iInnerHeight = oInnerDoc.body.scrollHeight ; 
    131  
    132                 var iDiff = iInnerHeight - iFrameHeight ; 
    133  
    134                 if ( iDiff > 0 ) 
    135                 { 
    136                         if ( document.all ) 
    137                                 window.dialogHeight = ( parseInt( window.dialogHeight, 10 ) + iDiff ) + 'px' ; 
     316                        evt.returnValue = false ; 
     317        } 
     318 
     319        var dragMouseUpHandler = function( evt ) 
     320        { 
     321                if ( !lastCoords ) 
     322                        return ; 
     323                if ( !evt ) 
     324                        evt = FCKTools.GetElementDocument( this ).parentWindow.event ; 
     325                cleanUpHandlers() ; 
     326                lastCoords = null ; 
     327        } 
     328 
     329        return { 
     330 
     331                MouseDownHandler : function( evt ) 
     332                { 
     333                        var view = null ; 
     334                        if ( !evt ) 
     335                        { 
     336                                view = FCKTools.GetElementDocument( this ).parentWindow ; 
     337                                evt = view.event ; 
     338                        } 
    138339                        else 
    139                                 window.resizeBy( 0, iDiff ) ; 
    140                 } 
    141         } 
    142 } 
    143  
    144 // Kludge for #1316: Safari seems to have a bug with the time when RefreshSize() is executed - it thinks frmMain's innerHeight  
    145 // is 0 if we query the value too soon after the page is loaded in some circumstances. 
    146 if ( args.Editor.FCKBrowserInfo.IsSafari ) 
    147 { 
    148         window.OriginalRefreshSize = RefreshSize ; 
    149  
    150         RefreshSize = function() 
    151         { 
    152                 window.setTimeout( window.OriginalRefreshSize, 1 ); 
    153         } 
    154 } 
    155  
    156 function Ok() 
    157 { 
    158         if ( window.frames["frmMain"].Ok && window.frames["frmMain"].Ok() ) 
    159                 Cancel() ; 
    160 } 
    161  
    162 function Cancel( dontFireChange ) 
    163 { 
    164         if ( !dontFireChange && !args.Editor.FCK.EditMode ) 
    165         { 
    166                 // All dialog windows, by default, will fire the "OnSelectionChange" 
    167                 // event, no matter the Ok or Cancel button has been pressed. 
    168                 args.Editor.FCK.Events.FireEvent( 'OnSelectionChange' ) ; 
    169         } 
    170         window.close() ; 
    171 } 
    172  
    173 // Object that holds all available tabs. 
    174 var oTabs = new Object() ; 
    175  
    176 function TabDiv_OnClick() 
    177 { 
    178         SetSelectedTab( this.TabCode ) ; 
    179 } 
    180  
    181 function AddTab( tabCode, tabText, startHidden ) 
    182 { 
    183         if ( typeof( oTabs[ tabCode ] ) != 'undefined' ) 
     340                                view = evt.view ; 
     341 
     342                        var target = evt.srcElement || evt.target ; 
     343                        if ( target.id == 'closeButton' || target.className == 'DialogTab' || target.className == 'DialogTabSelected' ) 
     344                                return ; 
     345 
     346                        lastCoords = 
     347                        { 
     348                                x : evt.screenX, 
     349                                y : evt.screenY 
     350                        } ; 
     351 
     352                        // Save the current IFRAME position. 
     353                        currentPos = 
     354                        { 
     355                                x : parseInt( FCKDomTools.GetCurrentElementStyle( frameElement, 'left' ), 10 ), 
     356                                y : parseInt( FCKDomTools.GetCurrentElementStyle( frameElement, 'top' ), 10 ) 
     357                        } ; 
     358 
     359                        for ( var i = 0 ; i < registeredWindows.length ; i++ ) 
     360                        { 
     361                                FCKTools.AddEventListener( registeredWindows[i].document, 'mousemove', dragMouseMoveHandler ) ; 
     362                                FCKTools.AddEventListener( registeredWindows[i].document, 'mouseup', dragMouseUpHandler ) ; 
     363                        } 
     364 
     365                        if ( evt.preventDefault ) 
     366                                evt.preventDefault() ; 
     367                        else 
     368                                evt.returnValue = false ; 
     369                }, 
     370 
     371                RegisterHandlers : function( w ) 
     372                { 
     373                        registeredWindows.push( w ) ; 
     374                } 
     375        } 
     376}() ; 
     377 
     378// Selection related functions. 
     379var Selection = function() 
     380{ 
     381        return { 
     382                /** 
     383                 * Ensures that the editing area contains an active selection. This is a 
     384                 * requirement for IE, as it looses the selection when the focus moves to other 
     385                 * frames. 
     386                 */ 
     387                EnsureSelection : function() 
     388                { 
     389                        if ( FCKDialog.SelectionData ) 
     390                                FCKDialog.SelectionData.select() ; 
     391                }, 
     392 
     393                /** 
     394                 * Get the FCKSelection object for the editor instance. 
     395                 */ 
     396                GetSelection : function() 
     397                { 
     398                        this.EnsureSelection() ; 
     399                        return FCK.Selection ; 
     400                }, 
     401 
     402                /** 
     403                 * Get the selected element in the editing area (for object selections). 
     404                 */ 
     405                GetSelectedElement : function() 
     406                { 
     407                        return this.GetSelection().GetSelectedElement() ; 
     408                } 
     409        } ; 
     410}() ; 
     411 
     412// Tab related functions. 
     413var Tabs = function() 
     414{ 
     415        // Only element ids should be stored here instead of element references since setSelectedTab and TabDiv_OnClick 
     416        // would build circular references with the element references inside and cause memory leaks in IE6. 
     417        var oTabs = new Object() ; 
     418 
     419        var setSelectedTab = function( tabCode ) 
     420        { 
     421                for ( var sCode in oTabs ) 
     422                { 
     423                        if ( sCode == tabCode ) 
     424                                $( oTabs[sCode] ).className = 'DialogTabSelected' ; 
     425                        else 
     426                                $( oTabs[sCode] ).className = 'DialogTab' ; 
     427                } 
     428 
     429                if ( typeof( window.frames["frmMain"].OnDialogTabChange ) == 'function' ) 
     430                        window.frames["frmMain"].OnDialogTabChange( tabCode ) ; 
     431        } 
     432 
     433        function TabDiv_OnClick() 
     434        { 
     435                setSelectedTab( this.TabCode ) ; 
     436        } 
     437 
     438        window.AddTab = function( tabCode, tabText, startHidden ) 
     439        { 
     440                if ( typeof( oTabs[ tabCode ] ) != 'undefined' ) 
     441                        return ; 
     442 
     443                var eTabsRow = $( 'Tabs' ) ; 
     444 
     445                var oCell = eTabsRow.insertCell(  eTabsRow.cells.length - 1 ) ; 
     446                oCell.noWrap = true ; 
     447 
     448                var oDiv = document.createElement( 'DIV' ) ; 
     449                oDiv.className = 'DialogTab' ; 
     450                oDiv.innerHTML = tabText ; 
     451                oDiv.TabCode = tabCode ; 
     452                oDiv.onclick = TabDiv_OnClick ; 
     453                oDiv.id = Math.random() ; 
     454 
     455                if ( startHidden ) 
     456                        oDiv.style.display = 'none' ; 
     457 
     458                eTabsRow = $( 'TabsRow' ) ; 
     459 
     460                oCell.appendChild( oDiv ) ; 
     461 
     462                if ( eTabsRow.style.display == 'none' ) 
     463                { 
     464                        var eTitleArea = $( 'TitleArea' ) ; 
     465                        eTitleArea.className = 'DialogTitle' ; 
     466 
     467                        oDiv.className = 'DialogTabSelected' ; 
     468                        eTabsRow.style.display = '' ; 
     469 
     470                        if ( window.onresize ) 
     471                                window.onresize() ; 
     472                } 
     473 
     474                oTabs[ tabCode ] = oDiv.id ; 
     475 
     476                FCKTools.DisableSelection( oDiv ) ; 
     477        } ; 
     478 
     479        window.SetSelectedTab = setSelectedTab ; 
     480 
     481        window.SetTabVisibility = function( tabCode, isVisible ) 
     482        { 
     483                var oTab = $( oTabs[ tabCode ] ) ; 
     484                oTab.style.display = isVisible ? '' : 'none' ; 
     485 
     486                if ( ! isVisible && oTab.className == 'DialogTabSelected' ) 
     487                { 
     488                        for ( var sCode in oTabs ) 
     489                        { 
     490                                if ( $( oTabs[sCode] ).style.display != 'none' ) 
     491                                { 
     492                                        setSelectedTab( sCode ) ; 
     493                                        break ; 
     494                                } 
     495                        } 
     496                } 
     497        } ; 
     498}() ; 
     499 
     500// readystatechange handler for registering drag and drop handlers in cover 
     501// iframes, defined out here to avoid memory leak. 
     502// Do NOT put this function as a private function as it will induce memory leak 
     503// in IE and it's not detectable with Drip or sIEve and undetectable leaks are 
     504// really nasty (sigh). 
     505var onReadyRegister = function() 
     506{ 
     507        if ( this.readyState != 'complete' ) 
    184508                return ; 
    185  
    186         var eTabsRow = document.getElementById( 'Tabs' ) ; 
    187  
    188         var oCell = eTabsRow.insertCell(  eTabsRow.cells.length - 1 ) ; 
    189         oCell.noWrap = true ; 
    190  
    191         var oDiv = document.createElement( 'DIV' ) ; 
    192         oDiv.className = 'PopupTab' ; 
    193         oDiv.innerHTML = tabText ; 
    194         oDiv.TabCode = tabCode ; 
    195         oDiv.onclick = TabDiv_OnClick ; 
    196  
    197         if ( startHidden ) 
    198                 oDiv.style.display = 'none' ; 
    199  
    200         eTabsRow = document.getElementById( 'TabsRow' ) ; 
    201  
    202         oCell.appendChild( oDiv ) ; 
    203  
    204         if ( eTabsRow.style.display == 'none' ) 
    205         { 
    206                 var eTitleArea = document.getElementById( 'TitleArea' ) ; 
    207                 eTitleArea.className = 'PopupTitle' ; 
    208  
    209                 oDiv.className = 'PopupTabSelected' ; 
    210                 eTabsRow.style.display = '' ; 
    211  
    212                 if ( window.onresize ) 
    213                         window.onresize() ; 
    214         } 
    215  
    216         oTabs[ tabCode ] = oDiv ; 
    217 } 
    218  
    219 function SetSelectedTab( tabCode ) 
    220 { 
    221         for ( var sCode in oTabs ) 
    222         { 
    223                 if ( sCode == tabCode ) 
    224                         oTabs[sCode].className = 'PopupTabSelected' ; 
    225                 else 
    226                         oTabs[sCode].className = 'PopupTab' ; 
    227         } 
    228  
    229         if ( typeof( window.frames["frmMain"].OnDialogTabChange ) == 'function' ) 
    230                 window.frames["frmMain"].OnDialogTabChange( tabCode ) ; 
    231 } 
    232  
    233 function SetTabVisibility( tabCode, isVisible ) 
    234 { 
    235         var oTab = oTabs[ tabCode ] ; 
    236         oTab.style.display = isVisible ? '' : 'none' ; 
    237  
    238         if ( ! isVisible && oTab.className == 'PopupTabSelected' ) 
    239         { 
    240                 for ( var sCode in oTabs ) 
    241                 { 
    242                         if ( oTabs[sCode].style.display != 'none' ) 
    243                         { 
    244                                 SetSelectedTab( sCode ) ; 
    245                                 break ; 
    246                         } 
    247                 } 
    248         } 
    249 } 
    250  
    251 function SetOnKeyDown( targetDocument ) 
    252 { 
    253         targetDocument.onkeydown = function ( e ) 
    254         { 
    255                 e = e || event || this.parentWindow.event ; 
    256                 switch ( e.keyCode ) 
    257                 { 
    258                         case 13 :               // ENTER 
    259                                 var oTarget = e.srcElement || e.target ; 
    260                                 if ( oTarget.tagName == 'TEXTAREA' ) 
    261                                         return true ; 
    262                                 Ok() ; 
    263                                 return false ; 
    264                         case 27 :               // ESC 
    265                                 Cancel() ; 
    266                                 return false ; 
    267                                 break ; 
    268                 } 
    269                 return true ; 
    270         } 
    271 } 
    272 SetOnKeyDown( document ) ; 
    273  
    274 function DisableContextMenu( targetDocument ) 
    275 { 
    276         if ( args.Editor.FCKBrowserInfo.IsIE ) return ; 
    277  
    278         // Disable Right-Click 
    279         var oOnContextMenu = function( e ) 
     509        DragAndDrop.RegisterHandlers( this.contentWindow ) ; 
     510} ; 
     511 
     512// The business logic of the dialog, dealing with operational things like 
     513// dialog open/dialog close/enable/disable/etc. 
     514(function() 
     515{ 
     516        var setOnKeyDown = function( targetDocument ) 
     517        { 
     518                targetDocument.onkeydown = function ( e ) 
     519                { 
     520                        e = e || event || this.parentWindow.event ; 
     521                        switch ( e.keyCode ) 
     522                        { 
     523                                case 13 :               // ENTER 
     524                                        var oTarget = e.srcElement || e.target ; 
     525                                        if ( oTarget.tagName == 'TEXTAREA' ) 
     526                                                return true ; 
     527                                        Ok() ; 
     528                                        return false ; 
     529 
     530                                case 27 :               // ESC 
     531                                        Cancel() ; 
     532                                        return false ; 
     533                        } 
     534                        return true ; 
     535                } 
     536        } ; 
     537 
     538        var contextMenuBlocker = function( e ) 
    280539        { 
    281540                var sTagName = e.target.tagName ; 
    282541                if ( ! ( ( sTagName == "INPUT" && e.target.type == "text" ) || sTagName == "TEXTAREA" ) ) 
    283542                        e.preventDefault() ; 
    284         } 
    285         targetDocument.addEventListener( 'contextmenu', oOnContextMenu, true ) ; 
    286 } 
    287 DisableContextMenu( document ) ; 
    288  
    289 if ( args.Editor.FCKBrowserInfo.IsGecko && !args.Editor.FCKBrowserInfo.IsOpera ) 
    290 { 
    291         window.onresize = function( e ) 
    292         { 
    293                 // Running in Chrome makes the window receive the event including subframes. 
    294                 // we care only about this window. Ticket #1642 
    295                 if ( e && e.originalTarget !== document ) 
    296                                 return ; 
    297  
    298                 var oFrame = document.getElementById("frmMain") ; 
    299  
    300                 if ( ! oFrame ) 
     543        } ; 
     544 
     545        var disableContextMenu = function( targetDocument ) 
     546        { 
     547                if ( FCKBrowserInfo.IsIE ) 
    301548                        return ; 
    302549 
    303                 oFrame.height = 0 ; 
    304  
    305                 var oCell = document.getElementById("FrameCell") ; 
    306                 var iHeight = oCell.offsetHeight ; 
    307  
    308                 oFrame.height = iHeight - 2 ; 
    309         } 
    310 } 
    311  
    312 if ( args.Editor.FCKBrowserInfo.IsIE ) 
    313 { 
    314         function Window_OnBeforeUnload() 
    315         { 
    316                 for ( var t in oTabs ) 
    317                         oTabs[t] = null ; 
    318  
    319                 args.Editor = null ; 
    320         } 
    321         window.attachEvent( "onbeforeunload", Window_OnBeforeUnload ) ; 
    322 } 
    323  
    324 function Window_OnClose() 
    325 { 
    326         args.Editor.FCKFocusManager.Unlock() ; 
    327 } 
    328  
    329 if ( window.addEventListener ) 
    330         window.addEventListener( 'unload', Window_OnClose, false ) ; 
    331  
     550                targetDocument.addEventListener( 'contextmenu', contextMenuBlocker, true ) ; 
     551        } ; 
     552 
     553        // Program entry point. 
     554        window.Init = function() 
     555        { 
     556                // Start the throbber timer. 
     557                Throbber.Show( 1000 ) ; 
     558 
     559                Sizer.RefreshContainerSize() ; 
     560                LoadInnerDialog() ; 
     561 
     562                FCKTools.DisableSelection( document.body ) ; 
     563 
     564                // Make the title area draggable. 
     565                var titleElement = $( 'header' ) ; 
     566                titleElement.onmousedown = DragAndDrop.MouseDownHandler ; 
     567 
     568                // Connect mousemove and mouseup events from dialog frame and outer window to dialog dragging logic. 
     569                DragAndDrop.RegisterHandlers( window ) ; 
     570                DragAndDrop.RegisterHandlers( Args().TopWindow ) ; 
     571 
     572                // Disable the previous dialog if it exists. 
     573                if ( ParentDialog() ) 
     574                { 
     575                        ParentDialog().contentWindow.SetEnabled( false ) ; 
     576                        if ( FCKBrowserInfo.IsIE && !FCKBrowserInfo.IsIE7 ) 
     577                        { 
     578                                var currentParent = ParentDialog() ; 
     579                                while ( currentParent ) 
     580                                { 
     581                                        var blockerFrame = currentParent.contentWindow.$( 'blocker' ) ; 
     582                                        if ( blockerFrame.readyState == 'complete' ) 
     583                                                DragAndDrop.RegisterHandlers( blockerFrame.contentWindow ) ; 
     584                                        else 
     585                                                blockerFrame.onreadystatechange = onReadyRegister ; 
     586                                        currentParent = ParentDialog( currentParent ) ; 
     587                                } 
     588                        } 
     589                        else 
     590                        { 
     591                                var currentParent = ParentDialog() ; 
     592                                while ( currentParent ) 
     593                                { 
     594                                        DragAndDrop.RegisterHandlers( currentParent.contentWindow ) ; 
     595                                        currentParent = ParentDialog( currentParent ) ; 
     596                                } 
     597                        } 
     598                } 
     599 
     600                // If this is the only dialog on screen, enable the background cover. 
     601                if ( FCKBrowserInfo.IsIE && !FCKBrowserInfo.IsIE7 ) 
     602                { 
     603                        var blockerFrame = FCKDialog.GetCover().firstChild ; 
     604                        if ( blockerFrame.readyState == 'complete' ) 
     605                                DragAndDrop.RegisterHandlers( blockerFrame.contentWindow ) ; 
     606                        else 
     607                                blockerFrame.onreadystatechange = onReadyRegister; 
     608                } 
     609 
     610                // Add Enter/Esc hotkeys and disable context menu for the dialog. 
     611                setOnKeyDown( document ) ; 
     612                disableContextMenu( document ) ; 
     613        } ; 
     614 
     615        window.LoadInnerDialog = function() 
     616        { 
     617                if ( window.onresize ) 
     618                        window.onresize() ; 
     619 
     620                // First of all, translate the dialog box contents. 
     621                E.FCKLanguageManager.TranslatePage( document ) ; 
     622 
     623                // Create the IFRAME that holds the dialog contents. 
     624                $( 'innerContents' ).innerHTML = '<iframe id="frmMain" src="' + Args().Page + '" name="frmMain" frameborder="0" width="100%" height="100%" scrolling="auto" style="visibility: hidden;" allowtransparency="true"></iframe>' ; 
     625        } ; 
     626 
     627        window.InnerDialogLoaded = function() 
     628        { 
     629                // If the dialog has been closed before the iframe is loaded, do nothing. 
     630                if ( !frameElement.parentNode ) 
     631                        return null ; 
     632 
     633                Throbber.Hide() ; 
     634 
     635                var frmMain = $('frmMain') ; 
     636                var innerWindow = frmMain.contentWindow ; 
     637                var innerDoc = innerWindow.document ; 
     638 
     639                // Show the loaded iframe. 
     640                frmMain.style.visibility = '' ; 
     641 
     642                // Set the language direction. 
     643                innerDoc.dir = langDir ; 
     644 
     645                // Sets the Skin CSS. 
     646                innerDoc.write( '<link href="' + FCKConfig.SkinPath + 'fck_dialog.css" type="text/css" rel="stylesheet">' ) ; 
     647 
     648                setOnKeyDown( innerDoc ) ; 
     649                disableContextMenu( innerDoc ) ; 
     650 
     651                Sizer.RefreshContainerSize(); 
     652 
     653                DragAndDrop.RegisterHandlers( innerWindow ) ; 
     654 
     655                innerWindow.focus() ; 
     656 
     657                return E ; 
     658        } ; 
     659 
     660        window.SetOkButton = function( showIt ) 
     661        { 
     662                $('btnOk').style.visibility = ( showIt ? '' : 'hidden' ) ; 
     663        } ; 
     664 
     665        window.Ok = function() 
     666        { 
     667                Selection.EnsureSelection() ; 
     668 
     669                var frmMain = window.frames["frmMain"] ; 
     670 
     671                if ( frmMain.Ok && frmMain.Ok() ) 
     672                        CloseDialog() ; 
     673                else 
     674                        frmMain.focus() ; 
     675        } ; 
     676 
     677        window.Cancel = function( dontFireChange ) 
     678        { 
     679                return CloseDialog( dontFireChange ) ; 
     680        } ; 
     681 
     682        window.CloseDialog = function( dontFireChange ) 
     683        { 
     684                Throbber.Hide() ; 
     685 
     686                Selection.EnsureSelection() ; 
     687 
     688                // Points the src to a non-existent location to avoid loading errors later, in case the dialog 
     689                // haven't been completed loaded at this point. 
     690                if ( $( 'frmMain' ) ) 
     691                        $( 'frmMain' ).src = FCKTools.GetVoidUrl() ; 
     692 
     693                if ( !dontFireChange && !FCK.EditMode ) 
     694                { 
     695                        // All dialog windows, by default, will fire the "OnSelectionChange" 
     696                        // event, no matter the Ok or Cancel button has been pressed. 
     697                        FCK.Events.FireEvent( 'OnSelectionChange' ) ; 
     698                } 
     699 
     700                FCKDialog.OnDialogClose( window ) ; 
     701        } ; 
     702 
     703        window.SetEnabled = function( isEnabled ) 
     704        { 
     705                var cover = $( 'cover' ) ; 
     706                cover.style.display = isEnabled ? 'none' : '' ; 
     707 
     708                if ( FCKBrowserInfo.IsIE && !FCKBrowserInfo.IsIE7 ) 
     709                { 
     710                        if ( !isEnabled ) 
     711                        { 
     712                                // Inser the blocker IFRAME before the cover. 
     713                                var blocker = document.createElement( 'iframe' ) ; 
     714                                blocker.src = FCKTools.GetVoidUrl() ; 
     715                                blocker.hideFocus = true ; 
     716                                blocker.frameBorder = 0 ; 
     717                                blocker.id = blocker.className = 'blocker' ; 
     718                                cover.appendChild( blocker ) ; 
     719                        } 
     720                        else 
     721                        { 
     722                                var blocker = $( 'blocker' ) ; 
     723                                if ( blocker && blocker.parentNode ) 
     724                                        blocker.parentNode.removeChild( blocker ) ; 
     725                        } 
     726                } 
     727        } ; 
     728})() ; 
    332729                </script> 
    333730        </head> 
    334         <body onload="LoadInnerDialog();" class="PopupBody"> 
    335                 <table height="100%" cellspacing="0" cellpadding="0" width="100%" border="0"> 
    336                         <tr> 
    337                                 <td id="TitleArea" class="PopupTitle PopupTitleBorder"> 
     731        <body onload="Init();" class="DialogBody"> 
     732                <div class="contents" id="contents"> 
     733                        <div id="header"> 
     734                                <div id="TitleArea" class="DialogTitle DialogTitleBorder"> 
    338735                                        <script type="text/javascript"> 
    339 document.write( sTitle ) ; 
     736document.write( Args().Title ) ; 
    340737                                        </script> 
    341                                 </td> 
    342                         </tr> 
    343                         <tr id="TabsRow" style="DISPLAY: none"> 
    344                                 <td class="PopupTabArea"> 
     738                                        <div id="closeButton" onclick="Cancel();"></div> 
     739                                </div> 
     740                                <div id="TabsRow" class="DialogTabArea" style="display: none"> 
    345741                                        <table border="0" cellpadding="0" cellspacing="0" width="100%"> 
    346                                                 <tr id="Tabs" onselectstart="return false;"> 
    347                                                         <td class="PopupTabEmptyArea">&nbsp;</td> 
    348                                                         <td class="PopupTabEmptyArea" width="100%">&nbsp;</td> 
     742                                                <tr id="Tabs"> 
     743                                                        <td class="DialogTabEmptyArea">&nbsp;</td> 
     744                                                        <td class="DialogTabEmptyArea" width="100%">&nbsp;</td> 
    349745                                                </tr> 
    350746                                        </table> 
    351                                 </td> 
    352                         </tr> 
    353                         <tr> 
    354                                 <td id="FrameCell" height="100%" valign="top"> 
    355                                         &nbsp; 
    356                                 </td> 
    357                         </tr> 
    358                         <tr> 
    359                                 <td class="PopupButtons"> 
    360                                         <table border="0" cellpadding="0" cellspacing="0"> 
    361                                                 <tr> 
    362                                                         <td width="100%">&nbsp;</td> 
    363                                                         <td nowrap="nowrap"> 
    364                                                                 <input id="btnOk" style="VISIBILITY: hidden;" type="button" value="Ok" class="Button" onclick="Ok();" fckLang="DlgBtnOK" /> 
    365                                                                 &nbsp;  
    366                                                                 <input id="btnCancel" type="button" value="Cancel" class="Button" onclick="Cancel();" fckLang="DlgBtnCancel" /> 
    367                                                         </td> 
    368                                                 </tr> 
    369                                         </table> 
    370                                 </td> 
    371                         </tr> 
    372                 </table> 
     747                                </div> 
     748                        </div> 
     749                        <div id="innerContents"></div> 
     750                        <div id="DialogButtons" class="DialogButtons"> 
     751                                <table border="0" cellpadding="0" cellspacing="0"> 
     752                                        <tr> 
     753                                                <td width="100%">&nbsp;</td> 
     754                                                <td nowrap="nowrap"> 
     755                                                        <input id="btnOk" style="visibility: hidden;" type="button" value="Ok" class="Button" onclick="Ok();" fckLang="DlgBtnOK" /> 
     756                                                        &nbsp; 
     757                                                        <input id="btnCancel" type="button" value="Cancel" class="Button" onclick="Cancel();" fckLang="DlgBtnCancel" /> 
     758                                                </td> 
     759                                        </tr> 
     760                                </table> 
     761                        </div> 
     762                </div> 
     763                <div class="tl"></div> 
     764                <div class="tc"></div> 
     765                <div class="tr"></div> 
     766                <div class="ml"></div> 
     767                <div class="mr"></div> 
     768                <div class="bl"></div> 
     769                <div class="bc"></div> 
     770                <div class="br"></div> 
     771                <div class="cover" id="cover" style="display:none"></div> 
     772                <div id="throbberBlock" style="position: absolute; visibility: hidden"></div> 
     773                <script type="text/javascript"> 
     774                        // Set the class name for language direction. 
     775                        document.body.className += ' ' + langDir ; 
     776 
     777                        var cover = $( 'cover' ) ; 
     778                        cover.style.backgroundColor = FCKConfig.BackgroundBlockerColor ; 
     779                        FCKDomTools.SetOpacity( cover, FCKConfig.BackgroundBlockerOpacity ) ; 
     780                </script> 
    373781        </body> 
    374782</html> 
  • FCKeditor/trunk/editor/fckeditor.html

    r1300 r1398  
    182182LoadScript( '_source/internals/fcktoolbarset.js' ) ; 
    183183LoadScript( '_source/internals/fckdialog.js' ) ; 
    184 LoadScript( '_source/internals/fckdialog_' + sSuffix + '.js' ) ; 
    185184LoadScript( '_source/classes/fckmenuitem.js' ) ; 
    186185LoadScript( '_source/classes/fckmenublock.js' ) ; 
     
    238237 
    239238FCKConfig_PreProcess() ; 
     239 
     240// Popup the debug window if debug mode is set to true. It guarantees that the 
     241// first debug message will not be lost. 
     242if ( FCKConfig.Debug ) 
     243        FCKDebug._GetWindow() ; 
    240244 
    241245// Load the active skin CSS. 
  • FCKeditor/trunk/editor/filemanager/connectors/aspx/connector.aspx

    r1203 r1398  
    1 <%@ Page Language="c#" Trace="false" Inherits="FredCK.FCKeditorV2.FileBrowser.Connector" AutoEventWireup="false" %> 
     1<%@ Page Language="c#" Trace="false" Inherits="FredCK.FCKeditorV2.FileBrowser.Connector" AutoEventWireup="false" %> 
    22<%@ Register Src="config.ascx" TagName="Config" TagPrefix="FCKeditor" %> 
    33<%-- 
  • FCKeditor/trunk/editor/filemanager/connectors/aspx/upload.aspx

    r1203 r1398  
    1 <%@ Page Language="c#" Trace="false" Inherits="FredCK.FCKeditorV2.FileBrowser.Uploader" AutoEventWireup="false" %> 
     1<%@ Page Language="c#" Trace="false" Inherits="FredCK.FCKeditorV2.FileBrowser.Uploader" AutoEventWireup="false" %> 
    22<%@ Register Src="config.ascx" TagName="Config" TagPrefix="FCKeditor" %> 
    33<%-- 
  • FCKeditor/trunk/editor/plugins/placeholder/fckplugin.js

    r308 r1398  
    2323 
    2424// Register the related command. 
    25 FCKCommands.RegisterCommand( 'Placeholder', new FCKDialogCommand( 'Placeholder', FCKLang.PlaceholderDlgTitle, FCKPlugins.Items['placeholder'].Path + 'fck_placeholder.html', 340, 170 ) ) ; 
     25FCKCommands.RegisterCommand( 'Placeholder', new FCKDialogCommand( 'Placeholder', FCKLang.PlaceholderDlgTitle, FCKPlugins.Items['placeholder'].Path + 'fck_placeholder.html', 340, 160 ) ) ; 
    2626 
    2727// Create the "Plaholder" toolbar button. 
  • FCKeditor/trunk/editor/skins/default/fck_dialog.css

    r447 r1398  
    1 /* 
     1/* 
    22 * FCKeditor - The text editor for Internet - http://www.fckeditor.net 
    33 * Copyright (C) 2003-2007 Frederico Caldeira Knabben 
     
    2222 */ 
    2323 
     24html, body 
     25{ 
     26        background-color: transparent; 
     27        margin: 0px; 
     28        padding: 0px; 
     29} 
     30 
    2431body 
    2532{ 
    26         margin: 0px; 
    2733        padding: 10px; 
    2834} 
     
    3945} 
    4046 
    41 .PopupBody 
    42 { 
    43         margin: 0px; 
     47.DialogBody 
     48{ 
     49        height: 100%; 
     50        width: 100%; 
     51        overflow: hidden; 
     52        background-color: transparent; 
    4453        padding: 0px; 
    4554} 
    4655 
    47 .PopupTitle 
     56#header 
     57{ 
     58        cursor: move; 
     59} 
     60 
     61.DialogTitle 
    4862{ 
    4963        font-weight: bold; 
     
    5468} 
    5569 
    56 .PopupButtons 
    57 { 
     70.DialogButtons 
     71{ 
     72        position: absolute; 
     73        bottom: 0px; 
    5874        border-top: #d5d59d 1px solid; 
    5975        background-color: #e3e3c7; 
     
    8399} 
    84100 
    85 .PopupTitleBorder 
     101.DialogTitleBorder 
    86102{ 
    87103        border-bottom: #d5d59d 1px solid; 
    88104} 
    89105 
    90 .PopupTabArea 
     106.DialogTabArea 
    91107{ 
    92108        color: #737357; 
     
    94110} 
    95111 
    96 .PopupTabEmptyArea 
    97 { 
    98         padding-left: 10px ; 
     112.DialogTabEmptyArea 
     113{ 
     114        padding-left: 10px; 
    99115        border-bottom: #d5d59d 1px solid; 
    100116} 
    101117 
    102 .PopupTab, .PopupTabSelected 
     118.DialogTab, .DialogTabSelected 
    103119{ 
    104120        border-right: #d5d59d 1px solid; 
     
    109125} 
    110126 
    111 .PopupTab 
     127.DialogTab 
    112128{ 
    113129        margin-top: 1px; 
     
    117133} 
    118134 
    119 .PopupTabSelected 
    120 { 
    121         font-weight:bold; 
     135.DialogTabSelected 
     136{ 
     137        font-weight: bold; 
    122138        cursor: default; 
    123139        padding-top: 4px; 
     
    126142} 
    127143 
    128 .PopupSelectionBox 
     144.DialogSelectionBox 
    129145{ 
    130146        border: #ff9933 1px solid !important; 
     
    134150} 
    135151 
    136 #tdBrowse  
     152#tdBrowse 
    137153{ 
    138154        vertical-align: bottom; 
    139155} 
     156 
     157/** 
     158 * Dialog frame related styles. 
     159 */ 
     160 
     161.contents 
     162{ 
     163        position: absolute; 
     164        top: 2px; 
     165        left: 16px; 
     166        right: 16px; 
     167        bottom: 20px; 
     168        background-color: #f1f1e3; 
     169        overflow: hidden; 
     170        z-index: 1; 
     171} 
     172 
     173.tl, .tr, .tc, .bl, .br, .bc 
     174{ 
     175        position: absolute; 
     176        background-image: url(images/sprites.png); 
     177        background-repeat: no-repeat; 
     178} 
     179 
     180* html .tl, * html .tr, * html .tc, * html .bl, * html .br, * html .bc 
     181{ 
     182        background-image: url(images/sprites.gif); 
     183} 
     184 
     185.ml, .mr 
     186{ 
     187        position: absolute; 
     188        background-image: url(images/dialog.sides.png); 
     189        background-repeat: repeat-y; 
     190} 
     191 
     192* html .ml, * html .mr 
     193{ 
     194        background-image: url(images/dialog.sides.gif); 
     195} 
     196 
     197.rtl .ml, .rtl .mr 
     198{ 
     199        position: absolute; 
     200        background-image: url(images/dialog.sides.rtl.png); 
     201        background-repeat: repeat-y; 
     202} 
     203 
     204* html .rtl .ml, * html .rtl .mr 
     205{ 
     206        background-image: url(images/dialog.sides.gif); 
     207} 
     208 
     209.tl 
     210{ 
     211        top: 0px; 
     212        left: 0px; 
     213        width: 16px; 
     214        height: 16px; 
     215        background-position: -16px -16px; 
     216} 
     217 
     218.rtl .tl 
     219{ 
     220        background-position: -16px -397px; 
     221} 
     222 
     223.tr 
     224{ 
     225        top: 0px; 
     226        right: 0px; 
     227        width: 16px; 
     228        height: 16px; 
     229        background-position: -16px -76px; 
     230} 
     231 
     232.rtl .tr 
     233{ 
     234        background-position: -16px -457px; 
     235} 
     236 
     237.tc 
     238{ 
     239        top: 0px; 
     240        right: 16px; 
     241        left: 16px; 
     242        height: 16px; 
     243        background-position: 0px -136px; 
     244        background-repeat: repeat-x; 
     245} 
     246 
     247.ml 
     248{ 
     249        top: 16px; 
     250        left: 0px; 
     251        width: 16px; 
     252        bottom: 51px; 
     253        background-position: 0px 0px; 
     254} 
     255 
     256.mr 
     257{ 
     258        top: 16px; 
     259        right: 0px; 
     260        width: 16px; 
     261        bottom: 51px; 
     262        background-position: -16px 0px; 
     263} 
     264 
     265.bl 
     266{ 
     267        bottom: 0px; 
     268        left: 0px; 
     269        width: 30px; 
     270        height: 51px; 
     271        background-position: -16px -196px; 
     272} 
     273 
     274.rtl .bl 
     275{ 
     276        background-position: -16px -517px; 
     277} 
     278 
     279.br 
     280{ 
     281        bottom: 0px; 
     282        right: 0px; 
     283        width: 30px; 
     284        height: 51px; 
     285        background-position: -16px -263px; 
     286} 
     287 
     288.rtl .br 
     289{ 
     290        background-position: -16px -584px; 
     291} 
     292 
     293.bc 
     294{ 
     295        bottom: 0px; 
     296        right: 30px; 
     297        left: 30px; 
     298        height: 51px; 
     299        background-position: 0px -330px; 
     300        background-repeat: repeat-x; 
     301} 
     302 
     303/* For IE6. Do not change it. */ 
     304* html .blocker 
     305{ 
     306        position: absolute; 
     307        width: 100%; 
     308        height: 100%; 
     309        z-index: 12; 
     310        filter: progid:DXImageTransform.Microsoft.Alpha(opacity=0); 
     311} 
     312 
     313/* The layer used to cover the dialog when opening a child dialog. */ 
     314.cover 
     315{ 
     316        position: absolute; 
     317        top: 0px; 
     318        left: 14px; 
     319        right: 14px; 
     320        bottom: 18px; 
     321        z-index: 11; 
     322} 
     323 
     324#closeButton 
     325{ 
     326        position: absolute; 
     327        right: 0px; 
     328        top: 0px; 
     329        margin-top: 5px; 
     330        margin-right: 10px; 
     331        width: 20px; 
     332        height: 20px; 
     333        cursor: pointer; 
     334        background-image: url(images/sprites.png); 
     335        background-repeat: no-repeat; 
     336        background-position: -16px -651px; 
     337} 
     338 
     339* html #closeButton 
     340{ 
     341        cursor: hand; 
     342        background-image: url(images/sprites.gif); 
     343} 
     344 
     345.rtl #closeButton 
     346{ 
     347        right: auto; 
     348        left: 0px; 
     349        margin-left: 10px; 
     350} 
     351 
     352#closeButton:hover 
     353{ 
     354        background-position: -16px -687px; 
     355} 
     356 
     357#throbberBlock  
     358{ 
     359        z-index: 10;  
     360} 
     361 
     362#throbberBlock div 
     363{ 
     364        float: left; 
     365        width: 8px; 
     366        height: 9px; 
     367        margin-left: 2px; 
     368        margin-right: 2px; 
     369        font-size: 1px; /* IE6 */ 
     370} 
     371 
     372/*  
     373        Color Gradient Generator: 
     374        http://www.herethere.net/~samson/php/color_gradient/?cbegin=737357&cend=E3E3C7&steps=4 
     375*/ 
     376 
     377.throbber_1 
     378{ 
     379        background-color: #737357; 
     380} 
     381 
     382.throbber_2 
     383{ 
     384        background-color: #8f8f73; 
     385} 
     386 
     387.throbber_3 
     388{ 
     389        background-color: #abab8f; 
     390} 
     391 
     392.throbber_4 
     393{ 
     394        background-color: #c7c7ab; 
     395} 
     396 
     397.throbber_5 
     398{ 
     399        background-color: #e3e3c7; 
     400} 
  • FCKeditor/trunk/editor/skins/office2003/fck_dialog.css

    r447 r1398  
    1 /* 
     1/* 
    22 * FCKeditor - The text editor for Internet - http://www.fckeditor.net 
    33 * Copyright (C) 2003-2007 Frederico Caldeira Knabben 
     
    2222 */ 
    2323 
     24html, body 
     25{ 
     26        background-color: transparent; 
     27        margin: 0px; 
     28        padding: 0px; 
     29} 
     30 
    2431body 
    2532{ 
    26         margin: 0px; 
    2733        padding: 10px; 
    28         background-color: #f7f8fd; 
    2934} 
    3035 
     
    4045} 
    4146 
    42 .PopupBody 
    43 { 
    44         margin: 0px; 
     47.DialogBody 
     48{ 
     49        height: 100%; 
     50        width: 100%; 
     51        overflow: hidden; 
     52        background-color: transparent; 
    4553        padding: 0px; 
    4654} 
    4755 
    48 .PopupTitle 
     56#header 
     57{ 
     58        cursor: move; 
     59} 
     60 
     61.DialogTitle 
    4962{ 
    5063        font-weight: bold; 
     
    5568} 
    5669 
    57 .PopupButtons 
    58 { 
     70.DialogButtons 
     71{ 
     72        position: absolute; 
     73        bottom: 0px; 
    5974        border-top: #466ca6 1px solid; 
    6075        background-color: #8cb2fd; 
     
    8499} 
    85100 
    86 .PopupTitleBorder 
     101.DialogTitleBorder 
    87102{ 
    88103        border-bottom: #d5d59d 1px solid; 
    89104} 
    90105 
    91 .PopupTabArea 
     106.DialogTabArea