source: companies/celepar/news_admin/templates/celepar/fckeditor/editor/_source/internals/fckdialog_gecko.js @ 763

Revision 763, 3.2 KB checked in by niltonneto, 15 years ago (diff)

Importação inicial do Expresso da Celepar

Line 
1/*
2 * FCKeditor - The text editor for internet
3 * Copyright (C) 2003-2006 Frederico Caldeira Knabben
4 *
5 * Licensed under the terms of the GNU Lesser General Public License:
6 *              http://www.opensource.org/licenses/lgpl-license.php
7 *
8 * For further information visit:
9 *              http://www.fckeditor.net/
10 *
11 * "Support Open Source software. What about a donation today?"
12 *
13 * File Name: fckdialog_gecko.js
14 *      Dialog windows operations. (Gecko specific implementations)
15 *
16 * File Authors:
17 *              Frederico Caldeira Knabben (fredck@fckeditor.net)
18 */
19
20FCKDialog.Show = function( dialogInfo, dialogName, pageUrl, dialogWidth, dialogHeight, parentWindow, resizable )
21{
22        var iTop  = (FCKConfig.ScreenHeight - dialogHeight) / 2 ;
23        var iLeft = (FCKConfig.ScreenWidth  - dialogWidth)  / 2 ;
24
25        var sOption  = "location=no,menubar=no,toolbar=no,dependent=yes,dialog=yes,minimizable=no,modal=yes,alwaysRaised=yes" +
26                ",resizable="  + ( resizable ? 'yes' : 'no' ) +
27                ",width="  + dialogWidth +
28                ",height=" + dialogHeight +
29                ",top="  + iTop +
30                ",left=" + iLeft ;
31
32        if ( !parentWindow )
33                parentWindow = window ;
34       
35        FCKFocusManager.Lock() ;
36       
37        var oWindow = parentWindow.open( '', 'FCKeditorDialog_' + dialogName, sOption, true ) ;
38       
39        if ( !oWindow )
40        {
41                alert( FCKLang.DialogBlocked ) ;
42                FCKFocusManager.Unlock() ;
43                return ;
44        }
45               
46        oWindow.moveTo( iLeft, iTop ) ;
47        oWindow.resizeTo( dialogWidth, dialogHeight ) ;
48        oWindow.focus() ;
49        oWindow.location.href = pageUrl ;
50       
51        oWindow.dialogArguments = dialogInfo ;
52       
53        // On some Gecko browsers (probably over slow connections) the
54        // "dialogArguments" are not set to the target window so we must
55        // put it in the opener window so it can be used by the target one.
56        parentWindow.FCKLastDialogInfo = dialogInfo ;
57       
58        this.Window = oWindow ;
59       
60        // Try/Catch must be used to avoit an error when using a frameset
61        // on a different domain:
62        // "Permission denied to get property Window.releaseEvents".
63        try
64        {
65                window.top.captureEvents( Event.CLICK | Event.MOUSEDOWN | Event.MOUSEUP | Event.FOCUS ) ;
66                window.top.parent.addEventListener( 'mousedown', this.CheckFocus, true ) ;
67                window.top.parent.addEventListener( 'mouseup', this.CheckFocus, true ) ;
68                window.top.parent.addEventListener( 'click', this.CheckFocus, true ) ;
69                window.top.parent.addEventListener( 'focus', this.CheckFocus, true ) ;
70        }
71        catch (e)
72        {}
73}
74
75FCKDialog.CheckFocus = function()
76{
77        // It is strange, but we have to check the FCKDialog existence to avoid a
78        // random error: "FCKDialog is not defined".
79        if ( typeof( FCKDialog ) != "object" )
80                return false ;
81       
82        if ( FCKDialog.Window && !FCKDialog.Window.closed )
83                FCKDialog.Window.focus() ;
84        else
85        {
86                // Try/Catch must be used to avoit an error when using a frameset
87                // on a different domain:
88                // "Permission denied to get property Window.releaseEvents".
89                try
90                {
91                        window.top.releaseEvents(Event.CLICK | Event.MOUSEDOWN | Event.MOUSEUP | Event.FOCUS) ;
92                        window.top.parent.removeEventListener( 'onmousedown', FCKDialog.CheckFocus, true ) ;
93                        window.top.parent.removeEventListener( 'mouseup', FCKDialog.CheckFocus, true ) ;
94                        window.top.parent.removeEventListener( 'click', FCKDialog.CheckFocus, true ) ;
95                        window.top.parent.removeEventListener( 'onfocus', FCKDialog.CheckFocus, true ) ;
96                }
97                catch (e)
98                {}
99        }
100        return false ;
101}
Note: See TracBrowser for help on using the repository browser.