2
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
3
* Copyright (C) 2003-2007 Frederico Caldeira Knabben
7
* Licensed under the terms of any of the following licenses at your
10
* - GNU General Public License Version 2 or later (the "GPL")
11
* http://www.gnu.org/licenses/gpl.html
13
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
14
* http://www.gnu.org/licenses/lgpl.html
16
* - Mozilla Public License Version 1.1 or later (the "MPL")
17
* http://www.mozilla.org/MPL/MPL-1.1.html
21
* Dialog windows operations. (Gecko specific implementations)
24
FCKDialog.Show = function( dialogInfo, dialogName, pageUrl, dialogWidth, dialogHeight, parentWindow, resizable )
26
var iTop = (FCKConfig.ScreenHeight - dialogHeight) / 2 ;
27
var iLeft = (FCKConfig.ScreenWidth - dialogWidth) / 2 ;
29
var sOption = "location=no,menubar=no,toolbar=no,dependent=yes,dialog=yes,minimizable=no,modal=yes,alwaysRaised=yes" +
30
",resizable=" + ( resizable ? 'yes' : 'no' ) +
31
",width=" + dialogWidth +
32
",height=" + dialogHeight +
37
parentWindow = window ;
39
FCKFocusManager.Lock() ;
41
var oWindow = parentWindow.open( '', 'FCKeditorDialog_' + dialogName, sOption, true ) ;
45
alert( FCKLang.DialogBlocked ) ;
46
FCKFocusManager.Unlock() ;
50
oWindow.moveTo( iLeft, iTop ) ;
51
oWindow.resizeTo( dialogWidth, dialogHeight ) ;
53
oWindow.location.href = pageUrl ;
55
oWindow.dialogArguments = dialogInfo ;
57
// On some Gecko browsers (probably over slow connections) the
58
// "dialogArguments" are not set to the target window so we must
59
// put it in the opener window so it can be used by the target one.
60
parentWindow.FCKLastDialogInfo = dialogInfo ;
62
this.Window = oWindow ;
64
// Try/Catch must be used to avoit an error when using a frameset
65
// on a different domain:
66
// "Permission denied to get property Window.releaseEvents".
69
window.top.parent.addEventListener( 'mousedown', this.CheckFocus, true ) ;
70
window.top.parent.addEventListener( 'mouseup', this.CheckFocus, true ) ;
71
window.top.parent.addEventListener( 'click', this.CheckFocus, true ) ;
72
window.top.parent.addEventListener( 'focus', this.CheckFocus, true ) ;
78
FCKDialog.CheckFocus = function()
80
// It is strange, but we have to check the FCKDialog existence to avoid a
81
// random error: "FCKDialog is not defined".
82
if ( typeof( FCKDialog ) != "object" )
85
if ( FCKDialog.Window && !FCKDialog.Window.closed )
86
FCKDialog.Window.focus() ;
89
// Try/Catch must be used to avoit an error when using a frameset
90
// on a different domain:
91
// "Permission denied to get property Window.releaseEvents".
94
window.top.parent.removeEventListener( 'onmousedown', FCKDialog.CheckFocus, true ) ;
95
window.top.parent.removeEventListener( 'mouseup', FCKDialog.CheckFocus, true ) ;
96
window.top.parent.removeEventListener( 'click', FCKDialog.CheckFocus, true ) ;
97
window.top.parent.removeEventListener( 'onfocus', FCKDialog.CheckFocus, true ) ;