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
110function Ok()
111{
112	if ( window.frames["frmMain"].Ok && window.frames["frmMain"].Ok() )
113		Cancel() ;
114}
115
116function Cancel( dontFireChange )
117{
118	if ( !dontFireChange )
119	{
120		// All dialog windows, by default, will fire the "OnSelectionChange"
121		// event, no matter the Ok or Cancel button has been pressed.
122		window.dialogArguments.Editor.FCK.Events.FireEvent( 'OnSelectionChange' ) ;
123	}
124	window.close() ;
125}
126
127// Object that holds all available tabs.
128var oTabs = new Object() ;
129
130function TabDiv_OnClick()
131{
132	SetSelectedTab( this.TabCode ) ;
133}
134
135function AddTab( tabCode, tabText, startHidden )
136{
137	if ( typeof( oTabs[ tabCode ] ) != 'undefined' )
138		return ;
139
140	var eTabsRow = document.getElementById( 'Tabs' ) ;
141
142	var oCell = eTabsRow.insertCell(  eTabsRow.cells.length - 1 ) ;
143	oCell.noWrap = true ;
144
145	var oDiv = document.createElement( 'DIV' ) ;
146	oDiv.className = 'PopupTab' ;
147	oDiv.innerHTML = tabText ;
148	oDiv.TabCode = tabCode ;
149	oDiv.onclick = TabDiv_OnClick ;
150
151	if ( startHidden )
152		oDiv.style.display = 'none' ;
153
154	eTabsRow = document.getElementById( 'TabsRow' ) ;
155
156	oCell.appendChild( oDiv ) ;
157
158	if ( eTabsRow.style.display == 'none' )
159	{
160		var eTitleArea = document.getElementById( 'TitleArea' ) ;
161		eTitleArea.className = 'PopupTitle' ;
162
163		oDiv.className = 'PopupTabSelected' ;
164		eTabsRow.style.display = '' ;
165
166		if ( ! window.dialogArguments.Editor.FCKBrowserInfo.IsIE )
167			window.onresize() ;
168	}
169
170	oTabs[ tabCode ] = oDiv ;
171}
172
173function SetSelectedTab( tabCode )
174{
175	for ( var sCode in oTabs )
176	{
177		if ( sCode == tabCode )
178			oTabs[sCode].className = 'PopupTabSelected' ;
179		else
180			oTabs[sCode].className = 'PopupTab' ;
181	}
182
183	if ( typeof( window.frames["frmMain"].OnDialogTabChange ) == 'function' )
184		window.frames["frmMain"].OnDialogTabChange( tabCode ) ;
185}
186
187function SetTabVisibility( tabCode, isVisible )
188{
189	var oTab = oTabs[ tabCode ] ;
190	oTab.style.display = isVisible ? '' : 'none' ;
191
192	if ( ! isVisible && oTab.className == 'PopupTabSelected' )
193	{
194		for ( var sCode in oTabs )
195		{
196			if ( oTabs[sCode].style.display != 'none' )
197			{
198				SetSelectedTab( sCode ) ;
199				break ;
200			}
201		}
202	}
203}
204
205function SetOnKeyDown( targetDocument )
206{
207	targetDocument.onkeydown = function ( e )
208	{
209		e = e || event || this.parentWindow.event ;
210		switch ( e.keyCode )
211		{
212			case 13 :		// ENTER
213				var oTarget = e.srcElement || e.target ;
214				if ( oTarget.tagName == 'TEXTAREA' )
215					return true ;
216				Ok() ;
217				return false ;
218			case 27 :		// ESC
219				Cancel() ;
220				return false ;
221				break ;
222		}
223		return true ;
224	}
225}
226SetOnKeyDown( document ) ;
227
228function DisableContextMenu( targetDocument )
229{
230	if ( window.dialogArguments.Editor.FCKBrowserInfo.IsIE ) return ;
231
232	// Disable Right-Click
233	var oOnContextMenu = function( e )
234	{
235		var sTagName = e.target.tagName ;
236		if ( ! ( ( sTagName == "INPUT" && e.target.type == "text" ) || sTagName == "TEXTAREA" ) )
237			e.preventDefault() ;
238	}
239	targetDocument.addEventListener( 'contextmenu', oOnContextMenu, true ) ;
240}
241DisableContextMenu( document ) ;
242
243if ( ! window.dialogArguments.Editor.FCKBrowserInfo.IsIE )
244{
245	window.onresize = function()
246	{
247		var oFrame = document.getElementById("frmMain") ;
248
249		if ( ! oFrame )
250		return ;
251
252		oFrame.height = 0 ;
253
254		var oCell = document.getElementById("FrameCell") ;
255		var iHeight = oCell.offsetHeight ;
256
257		oFrame.height = iHeight - 2 ;
258	}
259}
260
261if ( window.dialogArguments.Editor.FCKBrowserInfo.IsIE )
262{
263	function Window_OnBeforeUnload()
264	{
265		for ( var t in oTabs )
266			oTabs[t] = null ;
267
268		window.dialogArguments.Editor = null ;
269	}
270	window.attachEvent( "onbeforeunload", Window_OnBeforeUnload ) ;
271}
272
273function Window_OnClose()
274{
275	window.dialogArguments.Editor.FCKFocusManager.Unlock() ;
276}
277
278if ( window.addEventListener )
279	window.addEventListener( 'unload', Window_OnClose, false ) ;
280
281		</script>
282	</head>
283	<body onload="LoadInnerDialog();" class="PopupBody">
284		<table height="100%" cellspacing="0" cellpadding="0" width="100%" border="0">
285			<tr>
286				<td id="TitleArea" class="PopupTitle PopupTitleBorder">
287					<script type="text/javascript">
288document.write( sTitle ) ;
289					</script>
290				</td>
291			</tr>
292			<tr id="TabsRow" style="DISPLAY: none">
293				<td class="PopupTabArea">
294					<table border="0" cellpadding="0" cellspacing="0" width="100%">
295						<tr id="Tabs" onselectstart="return false;">
296							<td class="PopupTabEmptyArea">&nbsp;</td>
297							<td class="PopupTabEmptyArea" width="100%">&nbsp;</td>
298						</tr>
299					</table>
300				</td>
301			</tr>
302			<tr>
303				<td id="FrameCell" height="100%" valign="top">
304					<iframe id="frmMain" src="javascript:void(0)" name="frmMain" frameborder="0" height="100%" width="100%" scrolling="auto">
305					</iframe>
306				</td>
307			</tr>
308			<tr>
309				<td class="PopupButtons">
310					<table border="0" cellpadding="0" cellspacing="0">
311						<tr>
312							<td width="100%">&nbsp;</td>
313							<td nowrap="nowrap">
314								<input id="btnOk" style="VISIBILITY: hidden;" type="button" value="Ok" class="Button" onclick="Ok();" fckLang="DlgBtnOK" />
315								&nbsp;
316								<input id="btnCancel" type="button" value="Cancel" class="Button" onclick="Cancel();" fckLang="DlgBtnCancel" />
317							</td>
318						</tr>
319					</table>
320				</td>
321			</tr>
322		</table>
323	</body>
324</html>