1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
\r
3 * FCKeditor - The text editor for Internet - http://www.fckeditor.net
\r
4 * Copyright (C) 2003-2007 Frederico Caldeira Knabben
\r
6 * == BEGIN LICENSE ==
\r
8 * Licensed under the terms of any of the following licenses at your
\r
11 * - GNU General Public License Version 2 or later (the "GPL")
\r
12 * http://www.gnu.org/licenses/gpl.html
\r
14 * - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
\r
15 * http://www.gnu.org/licenses/lgpl.html
\r
17 * - Mozilla Public License Version 1.1 or later (the "MPL")
\r
18 * http://www.mozilla.org/MPL/MPL-1.1.html
\r
22 * This page is used by all dialog box as the container.
\r
24 <html xmlns="http://www.w3.org/1999/xhtml">
\r
26 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
\r
27 <meta name="robots" content="noindex, nofollow" />
\r
28 <script type="text/javascript">
\r
30 // On some Gecko browsers (probably over slow connections) the
\r
31 // "dialogArguments" are not set so we must get it from the opener window.
\r
32 if ( !window.dialogArguments )
\r
33 window.dialogArguments = window.opener.FCKLastDialogInfo ;
\r
35 // Sets the Skin CSS
\r
36 document.write( '<link href="' + window.dialogArguments.Editor.FCKConfig.SkinPath + 'fck_dialog.css" type="text/css" rel="stylesheet">' ) ;
\r
38 // Sets the language direction.
\r
39 window.document.dir = window.dialogArguments.Editor.FCKLang.Dir ;
\r
41 var sTitle = window.dialogArguments.Title ;
\r
42 document.write( '<title>' + sTitle + '<\/title>' ) ;
\r
44 function LoadInnerDialog()
\r
46 if ( window.onresize )
\r
49 // First of all, translate the dialog box contents.
\r
50 window.dialogArguments.Editor.FCKLanguageManager.TranslatePage( document ) ;
\r
52 window.frames["frmMain"].document.location.href = window.dialogArguments.Page ;
\r
55 function InnerDialogLoaded()
\r
57 var oInnerDoc = document.getElementById('frmMain').contentWindow.document ;
\r
59 // Set the language direction.
\r
60 oInnerDoc.dir = window.dialogArguments.Editor.FCKLang.Dir ;
\r
62 // Sets the Skin CSS.
\r
63 oInnerDoc.write( '<link href="' + window.dialogArguments.Editor.FCKConfig.SkinPath + 'fck_dialog.css" type="text/css" rel="stylesheet">' ) ;
\r
65 SetOnKeyDown( oInnerDoc ) ;
\r
66 DisableContextMenu( oInnerDoc ) ;
\r
68 return window.dialogArguments.Editor ;
\r
71 function SetOkButton( showIt )
\r
73 document.getElementById('btnOk').style.visibility = ( showIt ? '' : 'hidden' ) ;
\r
76 var bAutoSize = false ;
\r
78 function SetAutoSize( autoSize )
\r
80 bAutoSize = autoSize ;
\r
84 function RefreshSize()
\r
88 var oInnerDoc = document.getElementById('frmMain').contentWindow.document ;
\r
92 iFrameHeight = oInnerDoc.body.offsetHeight ;
\r
94 iFrameHeight = document.getElementById('frmMain').contentWindow.innerHeight ;
\r
96 var iInnerHeight = oInnerDoc.body.scrollHeight ;
\r
98 var iDiff = iInnerHeight - iFrameHeight ;
\r
102 if ( document.all )
\r
103 window.dialogHeight = ( parseInt( window.dialogHeight, 10 ) + iDiff ) + 'px' ;
\r
105 window.resizeBy( 0, iDiff ) ;
\r
112 if ( window.frames["frmMain"].Ok && window.frames["frmMain"].Ok() )
\r
116 function Cancel( dontFireChange )
\r
118 if ( !dontFireChange )
\r
120 // All dialog windows, by default, will fire the "OnSelectionChange"
\r
121 // event, no matter the Ok or Cancel button has been pressed.
\r
122 window.dialogArguments.Editor.FCK.Events.FireEvent( 'OnSelectionChange' ) ;
\r
127 // Object that holds all available tabs.
\r
128 var oTabs = new Object() ;
\r
130 function TabDiv_OnClick()
\r
132 SetSelectedTab( this.TabCode ) ;
\r
135 function AddTab( tabCode, tabText, startHidden )
\r
137 if ( typeof( oTabs[ tabCode ] ) != 'undefined' )
\r
140 var eTabsRow = document.getElementById( 'Tabs' ) ;
\r
142 var oCell = eTabsRow.insertCell( eTabsRow.cells.length - 1 ) ;
\r
143 oCell.noWrap = true ;
\r
145 var oDiv = document.createElement( 'DIV' ) ;
\r
146 oDiv.className = 'PopupTab' ;
\r
147 oDiv.innerHTML = tabText ;
\r
148 oDiv.TabCode = tabCode ;
\r
149 oDiv.onclick = TabDiv_OnClick ;
\r
152 oDiv.style.display = 'none' ;
\r
154 eTabsRow = document.getElementById( 'TabsRow' ) ;
\r
156 oCell.appendChild( oDiv ) ;
\r
158 if ( eTabsRow.style.display == 'none' )
\r
160 var eTitleArea = document.getElementById( 'TitleArea' ) ;
\r
161 eTitleArea.className = 'PopupTitle' ;
\r
163 oDiv.className = 'PopupTabSelected' ;
\r
164 eTabsRow.style.display = '' ;
\r
166 if ( ! window.dialogArguments.Editor.FCKBrowserInfo.IsIE )
\r
167 window.onresize() ;
\r
170 oTabs[ tabCode ] = oDiv ;
\r
173 function SetSelectedTab( tabCode )
\r
175 for ( var sCode in oTabs )
\r
177 if ( sCode == tabCode )
\r
178 oTabs[sCode].className = 'PopupTabSelected' ;
\r
180 oTabs[sCode].className = 'PopupTab' ;
\r
183 if ( typeof( window.frames["frmMain"].OnDialogTabChange ) == 'function' )
\r
184 window.frames["frmMain"].OnDialogTabChange( tabCode ) ;
\r
187 function SetTabVisibility( tabCode, isVisible )
\r
189 var oTab = oTabs[ tabCode ] ;
\r
190 oTab.style.display = isVisible ? '' : 'none' ;
\r
192 if ( ! isVisible && oTab.className == 'PopupTabSelected' )
\r
194 for ( var sCode in oTabs )
\r
196 if ( oTabs[sCode].style.display != 'none' )
\r
198 SetSelectedTab( sCode ) ;
\r
205 function SetOnKeyDown( targetDocument )
\r
207 targetDocument.onkeydown = function ( e )
\r
209 e = e || event || this.parentWindow.event ;
\r
210 switch ( e.keyCode )
\r
213 var oTarget = e.srcElement || e.target ;
\r
214 if ( oTarget.tagName == 'TEXTAREA' )
\r
226 SetOnKeyDown( document ) ;
\r
228 function DisableContextMenu( targetDocument )
\r
230 if ( window.dialogArguments.Editor.FCKBrowserInfo.IsIE ) return ;
\r
232 // Disable Right-Click
\r
233 var oOnContextMenu = function( e )
\r
235 var sTagName = e.target.tagName ;
\r
236 if ( ! ( ( sTagName == "INPUT" && e.target.type == "text" ) || sTagName == "TEXTAREA" ) )
\r
237 e.preventDefault() ;
\r
239 targetDocument.addEventListener( 'contextmenu', oOnContextMenu, true ) ;
\r
241 DisableContextMenu( document ) ;
\r
243 if ( ! window.dialogArguments.Editor.FCKBrowserInfo.IsIE )
\r
245 window.onresize = function()
\r
247 var oFrame = document.getElementById("frmMain") ;
\r
252 oFrame.height = 0 ;
\r
254 var oCell = document.getElementById("FrameCell") ;
\r
255 var iHeight = oCell.offsetHeight ;
\r
257 oFrame.height = iHeight - 2 ;
\r
261 if ( window.dialogArguments.Editor.FCKBrowserInfo.IsIE )
\r
263 function Window_OnBeforeUnload()
\r
265 for ( var t in oTabs )
\r
268 window.dialogArguments.Editor = null ;
\r
270 window.attachEvent( "onbeforeunload", Window_OnBeforeUnload ) ;
\r
273 function Window_OnClose()
\r
275 window.dialogArguments.Editor.FCKFocusManager.Unlock() ;
\r
278 if ( window.addEventListener )
\r
279 window.addEventListener( 'unload', Window_OnClose, false ) ;
\r
283 <body onload="LoadInnerDialog();" class="PopupBody">
\r
284 <table height="100%" cellspacing="0" cellpadding="0" width="100%" border="0">
\r
286 <td id="TitleArea" class="PopupTitle PopupTitleBorder">
\r
287 <script type="text/javascript">
\r
288 document.write( sTitle ) ;
\r
292 <tr id="TabsRow" style="DISPLAY: none">
\r
293 <td class="PopupTabArea">
\r
294 <table border="0" cellpadding="0" cellspacing="0" width="100%">
\r
295 <tr id="Tabs" onselectstart="return false;">
\r
296 <td class="PopupTabEmptyArea"> </td>
\r
297 <td class="PopupTabEmptyArea" width="100%"> </td>
\r
303 <td id="FrameCell" height="100%" valign="top">
\r
304 <iframe id="frmMain" src="javascript:void(0)" name="frmMain" frameborder="0" height="100%" width="100%" scrolling="auto">
\r
309 <td class="PopupButtons">
\r
310 <table border="0" cellpadding="0" cellspacing="0">
\r
312 <td width="100%"> </td>
\r
313 <td nowrap="nowrap">
\r
314 <input id="btnOk" style="VISIBILITY: hidden;" type="button" value="Ok" class="Button" onclick="Ok();" fckLang="DlgBtnOK" />
\r
316 <input id="btnCancel" type="button" value="Cancel" class="Button" onclick="Cancel();" fckLang="DlgBtnCancel" />
\r