1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
2<!--
3 * FCKeditor - The text editor for Internet - http://www.fckeditor.net
4 * Copyright (C) 2003-2007 Frederico Caldeira Knabben
5 *
6 * == BEGIN LICENSE ==
7 *
8 * Licensed under the terms of any of the following licenses at your
9 * choice:
10 *
11 *  - GNU General Public License Version 2 or later (the "GPL")
12 *    http://www.gnu.org/licenses/gpl.html
13 *
14 *  - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
15 *    http://www.gnu.org/licenses/lgpl.html
16 *
17 *  - Mozilla Public License Version 1.1 or later (the "MPL")
18 *    http://www.mozilla.org/MPL/MPL-1.1.html
19 *
20 * == END LICENSE ==
21 *
22 * This page is used by all dialog box as the container.
23-->
24<html xmlns="http://www.w3.org/1999/xhtml">
25	<head>
26		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
27		<meta name="robots" content="noindex, nofollow" />
28		<script type="text/javascript">
29
30// On some Gecko browsers (probably over slow connections) the
31// "dialogArguments" are not set so we must get it from the opener window.
32if ( !window.dialogArguments )
33	window.dialogArguments = window.opener.FCKLastDialogInfo ;
34
35// Sets the Skin CSS
36document.write( '<link href="' + window.dialogArguments.Editor.FCKConfig.SkinPath + 'fck_dialog.css" type="text/css" rel="stylesheet">' ) ;
37
38// Sets the language direction.
39window.document.dir = window.dialogArguments.Editor.FCKLang.Dir ;
40
41var sTitle = window.dialogArguments.Title ;
42document.write( '<title>' + sTitle + '<\/title>' ) ;
43
44function LoadInnerDialog()
45{
46	if ( window.onresize )
47		window.onresize() ;
48
49	// First of all, translate the dialog box contents.
50	window.dialogArguments.Editor.FCKLanguageManager.TranslatePage( document ) ;
51
52	window.frames["frmMain"].document.location.href = window.dialogArguments.Page ;
53}
54
55function InnerDialogLoaded()
56{
57	var oInnerDoc = document.getElementById('frmMain').contentWindow.document ;
58
59	// Set the language direction.
60	oInnerDoc.dir = window.dialogArguments.Editor.FCKLang.Dir ;
61
62	// Sets the Skin CSS.
63	oInnerDoc.write( '<link href="' + window.dialogArguments.Editor.FCKConfig.SkinPath + 'fck_dialog.css" type="text/css" rel="stylesheet">' ) ;
64
65	SetOnKeyDown( oInnerDoc ) ;
66	DisableContextMenu( oInnerDoc ) ;
67
68	return window.dialogArguments.Editor ;
69}
70
71function SetOkButton( showIt )
72{
73	document.getElementById('btnOk').style.visibility = ( showIt ? '' : 'hidden' ) ;
74}
75
76var bAutoSize = false ;
77
78function SetAutoSize( autoSize )
79{
80	bAutoSize = autoSize ;
81	RefreshSize() ;
82}
83
84function RefreshSize()
85{
86	if ( bAutoSize )
87	{
88		var oInnerDoc = document.getElementById('frmMain').contentWindow.document ;
89
90		var iFrameHeight ;
91		if ( document.all )
92			iFrameHeight = oInnerDoc.body.offsetHeight ;
93		else
94			iFrameHeight = document.getElementById('frmMain').contentWindow.innerHeight ;
95
96		var iInnerHeight = oInnerDoc.body.scrollHeight ;
97
98		var iDiff = iInnerHeight - iFrameHeight ;
99
100		if ( iDiff > 0 )
101		{
102			if ( document.all )
103				window.dialogHeight = ( parseInt( window.dialogHeight, 10 ) + iDiff ) + 'px' ;
104			else
105				window.resizeBy( 0, iDiff ) ;
106		}
107	}
108}
109
110// Kludge for #1316: Safari seems to have a bug with the time when RefreshSize() is executed - it thinks frmMain's innerHeight
111// is 0 if we query the value too soon after the page is loaded in some circumstances.
112if ( window.dialogArguments.Editor.FCKBrowserInfo.IsSafari )
113{
114	window.OriginalRefreshSize = RefreshSize ;
115
116	RefreshSize = function()
117	{
118		window.setTimeout( window.OriginalRefreshSize, 1 );
119	}
120}
121
122function Ok()
123{
124	if ( window.frames["frmMain"].Ok && window.frames["frmMain"].Ok() )
125		Cancel() ;
126}
127
128function Cancel( dontFireChange )
129{
130	if ( !dontFireChange && !window.dialogArguments.Editor.FCK.EditMode )
131	{
132		// All dialog windows, by default, will fire the "OnSelectionChange"
133		// event, no matter the Ok or Cancel button has been pressed.
134		window.dialogArguments.Editor.FCK.Events.FireEvent( 'OnSelectionChange' ) ;
135	}
136	window.close() ;
137}
138
139// Object that holds all available tabs.
140var oTabs = new Object() ;
141
142function TabDiv_OnClick()
143{
144	SetSelectedTab( this.TabCode ) ;
145}
146
147function AddTab( tabCode, tabText, startHidden )
148{
149	if ( typeof( oTabs[ tabCode ] ) != 'undefined' )
150		return ;
151
152	var eTabsRow = document.getElementById( 'Tabs' ) ;
153
154	var oCell = eTabsRow.insertCell(  eTabsRow.cells.length - 1 ) ;
155	oCell.noWrap = true ;
156
157	var oDiv = document.createElement( 'DIV' ) ;
158	oDiv.className = 'PopupTab' ;
159	oDiv.innerHTML = tabText ;
160	oDiv.TabCode = tabCode ;
161	oDiv.onclick = TabDiv_OnClick ;
162
163	if ( startHidden )
164		oDiv.style.display = 'none' ;
165
166	eTabsRow = document.getElementById( 'TabsRow' ) ;
167
168	oCell.appendChild( oDiv ) ;
169
170	if ( eTabsRow.style.display == 'none' )
171	{
172		var eTitleArea = document.getElementById( 'TitleArea' ) ;
173		eTitleArea.className = 'PopupTitle' ;
174
175		oDiv.className = 'PopupTabSelected' ;
176		eTabsRow.style.display = '' ;
177
178		if ( ! window.dialogArguments.Editor.FCKBrowserInfo.IsIE )
179			window.onresize() ;
180	}
181
182	oTabs[ tabCode ] = oDiv ;
183}
184
185function SetSelectedTab( tabCode )
186{
187	for ( var sCode in oTabs )
188	{
189		if ( sCode == tabCode )
190			oTabs[sCode].className = 'PopupTabSelected' ;
191		else
192			oTabs[sCode].className = 'PopupTab' ;
193	}
194
195	if ( typeof( window.frames["frmMain"].OnDialogTabChange ) == 'function' )
196		window.frames["frmMain"].OnDialogTabChange( tabCode ) ;
197}
198
199function SetTabVisibility( tabCode, isVisible )
200{
201	var oTab = oTabs[ tabCode ] ;
202	oTab.style.display = isVisible ? '' : 'none' ;
203
204	if ( ! isVisible && oTab.className == 'PopupTabSelected' )
205	{
206		for ( var sCode in oTabs )
207		{
208			if ( oTabs[sCode].style.display != 'none' )
209			{
210				SetSelectedTab( sCode ) ;
211				break ;
212			}
213		}
214	}
215}
216
217function SetOnKeyDown( targetDocument )
218{
219	targetDocument.onkeydown = function ( e )
220	{
221		e = e || event || this.parentWindow.event ;
222		switch ( e.keyCode )
223		{
224			case 13 :		// ENTER
225				var oTarget = e.srcElement || e.target ;
226				if ( oTarget.tagName == 'TEXTAREA' )
227					return true ;
228				Ok() ;
229				return false ;
230			case 27 :		// ESC
231				Cancel() ;
232				return false ;
233				break ;
234		}
235		return true ;
236	}
237}
238SetOnKeyDown( document ) ;
239
240function DisableContextMenu( targetDocument )
241{
242	if ( window.dialogArguments.Editor.FCKBrowserInfo.IsIE ) return ;
243
244	// Disable Right-Click
245	var oOnContextMenu = function( e )
246	{
247		var sTagName = e.target.tagName ;
248		if ( ! ( ( sTagName == "INPUT" && e.target.type == "text" ) || sTagName == "TEXTAREA" ) )
249			e.preventDefault() ;
250	}
251	targetDocument.addEventListener( 'contextmenu', oOnContextMenu, true ) ;
252}
253DisableContextMenu( document ) ;
254
255if ( ! window.dialogArguments.Editor.FCKBrowserInfo.IsIE )
256{
257	window.onresize = function()
258	{
259		var oFrame = document.getElementById("frmMain") ;
260
261		if ( ! oFrame )
262		return ;
263
264		oFrame.height = 0 ;
265
266		var oCell = document.getElementById("FrameCell") ;
267		var iHeight = oCell.offsetHeight ;
268
269		oFrame.height = iHeight - 2 ;
270	}
271}
272
273if ( window.dialogArguments.Editor.FCKBrowserInfo.IsIE )
274{
275	function Window_OnBeforeUnload()
276	{
277		for ( var t in oTabs )
278			oTabs[t] = null ;
279
280		window.dialogArguments.Editor = null ;
281	}
282	window.attachEvent( "onbeforeunload", Window_OnBeforeUnload ) ;
283}
284
285function Window_OnClose()
286{
287	window.dialogArguments.Editor.FCKFocusManager.Unlock() ;
288}
289
290if ( window.addEventListener )
291	window.addEventListener( 'unload', Window_OnClose, false ) ;
292
293		</script>
294	</head>
295	<body onload="LoadInnerDialog();" class="PopupBody">
296		<table height="100%" cellspacing="0" cellpadding="0" width="100%" border="0">
297			<tr>
298				<td id="TitleArea" class="PopupTitle PopupTitleBorder">
299					<script type="text/javascript">
300document.write( sTitle ) ;
301					</script>
302				</td>
303			</tr>
304			<tr id="TabsRow" style="DISPLAY: none">
305				<td class="PopupTabArea">
306					<table border="0" cellpadding="0" cellspacing="0" width="100%">
307						<tr id="Tabs" onselectstart="return false;">
308							<td class="PopupTabEmptyArea">&nbsp;</td>
309							<td class="PopupTabEmptyArea" width="100%">&nbsp;</td>
310						</tr>
311					</table>
312				</td>
313			</tr>
314			<tr>
315				<td id="FrameCell" height="100%" valign="top">
316					<iframe id="frmMain" src="javascript:void(0)" name="frmMain" frameborder="0" height="100%" width="100%" scrolling="auto">
317					</iframe>
318				</td>
319			</tr>
320			<tr>
321				<td class="PopupButtons">
322					<table border="0" cellpadding="0" cellspacing="0">
323						<tr>
324							<td width="100%">&nbsp;</td>
325							<td nowrap="nowrap">
326								<input id="btnOk" style="VISIBILITY: hidden;" type="button" value="Ok" class="Button" onclick="Ok();" fckLang="DlgBtnOK" />
327								&nbsp;
328								<input id="btnCancel" type="button" value="Cancel" class="Button" onclick="Cancel();" fckLang="DlgBtnCancel" />
329							</td>
330						</tr>
331					</table>
332				</td>
333			</tr>
334		</table>
335	</body>
336</html>
337