Project

General

Profile

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.
32
if ( !window.dialogArguments )
33
	window.dialogArguments = window.opener.FCKLastDialogInfo ;
34

    
35
// Sets the Skin CSS
36
document.write( '<link href="' + window.dialogArguments.Editor.FCKConfig.SkinPath + 'fck_dialog.css" type="text/css" rel="stylesheet">' ) ;
37

    
38
// Sets the language direction.
39
window.document.dir = window.dialogArguments.Editor.FCKLang.Dir ;
40

    
41
// IE does not set the window name in showModalDialog(), let's set it here.
42
if ( window.dialogArguments.Editor.FCKBrowserInfo.IsIE )
43
	window.name = window.dialogArguments.DialogName ;
44

    
45
var sTitle = window.dialogArguments.Title ;
46
document.write( '<title>' + sTitle + '<\/title>' ) ;
47

    
48
function LoadInnerDialog()
49
{
50
	if ( window.onresize )
51
		window.onresize() ;
52

    
53
	// First of all, translate the dialog box contents.
54
	window.dialogArguments.Editor.FCKLanguageManager.TranslatePage( document ) ;
55

    
56
	window.frames["frmMain"].document.location.href = window.dialogArguments.Page ;
57
}
58

    
59
function InnerDialogLoaded()
60
{
61
	var oInnerDoc = document.getElementById('frmMain').contentWindow.document ;
62

    
63
	// Set the language direction.
64
	oInnerDoc.dir = window.dialogArguments.Editor.FCKLang.Dir ;
65

    
66
	// Sets the Skin CSS.
67
	oInnerDoc.write( '<link href="' + window.dialogArguments.Editor.FCKConfig.SkinPath + 'fck_dialog.css" type="text/css" rel="stylesheet">' ) ;
68

    
69
	SetOnKeyDown( oInnerDoc ) ;
70
	DisableContextMenu( oInnerDoc ) ;
71

    
72
	return window.dialogArguments.Editor ;
73
}
74

    
75
function SetOkButton( showIt )
76
{
77
	document.getElementById('btnOk').style.visibility = ( showIt ? '' : 'hidden' ) ;
78
}
79

    
80
var bAutoSize = false ;
81

    
82
function SetAutoSize( autoSize )
83
{
84
	bAutoSize = autoSize ;
85
	RefreshSize() ;
86
}
87

    
88
function RefreshSize()
89
{
90
	if ( bAutoSize )
91
	{
92
		var oInnerDoc = document.getElementById('frmMain').contentWindow.document ;
93

    
94
		var iFrameHeight ;
95
		if ( document.all )
96
			iFrameHeight = oInnerDoc.body.offsetHeight ;
97
		else
98
			iFrameHeight = document.getElementById('frmMain').contentWindow.innerHeight ;
99

    
100
		var iInnerHeight = oInnerDoc.body.scrollHeight ;
101

    
102
		var iDiff = iInnerHeight - iFrameHeight ;
103

    
104
		if ( iDiff > 0 )
105
		{
106
			if ( document.all )
107
				window.dialogHeight = ( parseInt( window.dialogHeight, 10 ) + iDiff ) + 'px' ;
108
			else
109
				window.resizeBy( 0, iDiff ) ;
110
		}
111
	}
112
}
113

    
114
// Kludge for #1316: Safari seems to have a bug with the time when RefreshSize() is executed - it thinks frmMain's innerHeight 
115
// is 0 if we query the value too soon after the page is loaded in some circumstances.
116
if ( window.dialogArguments.Editor.FCKBrowserInfo.IsSafari )
117
{
118
	window.OriginalRefreshSize = RefreshSize ;
119

    
120
	RefreshSize = function()
121
	{
122
		window.setTimeout( window.OriginalRefreshSize, 1 );
123
	}
124
}
125

    
126
function Ok()
127
{
128
	if ( window.frames["frmMain"].Ok && window.frames["frmMain"].Ok() )
129
		Cancel() ;
130
}
131

    
132
function Cancel( dontFireChange )
133
{
134
	if ( !dontFireChange && !window.dialogArguments.Editor.FCK.EditMode )
135
	{
136
		// All dialog windows, by default, will fire the "OnSelectionChange"
137
		// event, no matter the Ok or Cancel button has been pressed.
138
		window.dialogArguments.Editor.FCK.Events.FireEvent( 'OnSelectionChange' ) ;
139
	}
140
	window.close() ;
141
}
142

    
143
// Object that holds all available tabs.
144
var oTabs = new Object() ;
145

    
146
function TabDiv_OnClick()
147
{
148
	SetSelectedTab( this.TabCode ) ;
149
}
150

    
151
function AddTab( tabCode, tabText, startHidden )
152
{
153
	if ( typeof( oTabs[ tabCode ] ) != 'undefined' )
154
		return ;
155

    
156
	var eTabsRow = document.getElementById( 'Tabs' ) ;
157

    
158
	var oCell = eTabsRow.insertCell(  eTabsRow.cells.length - 1 ) ;
159
	oCell.noWrap = true ;
160

    
161
	var oDiv = document.createElement( 'DIV' ) ;
162
	oDiv.className = 'PopupTab' ;
163
	oDiv.innerHTML = tabText ;
164
	oDiv.TabCode = tabCode ;
165
	oDiv.onclick = TabDiv_OnClick ;
166

    
167
	if ( startHidden )
168
		oDiv.style.display = 'none' ;
169

    
170
	eTabsRow = document.getElementById( 'TabsRow' ) ;
171

    
172
	oCell.appendChild( oDiv ) ;
173

    
174
	if ( eTabsRow.style.display == 'none' )
175
	{
176
		var eTitleArea = document.getElementById( 'TitleArea' ) ;
177
		eTitleArea.className = 'PopupTitle' ;
178

    
179
		oDiv.className = 'PopupTabSelected' ;
180
		eTabsRow.style.display = '' ;
181

    
182
		if ( ! window.dialogArguments.Editor.FCKBrowserInfo.IsIE )
183
			window.onresize() ;
184
	}
185

    
186
	oTabs[ tabCode ] = oDiv ;
187
}
188

    
189
function SetSelectedTab( tabCode )
190
{
191
	for ( var sCode in oTabs )
192
	{
193
		if ( sCode == tabCode )
194
			oTabs[sCode].className = 'PopupTabSelected' ;
195
		else
196
			oTabs[sCode].className = 'PopupTab' ;
197
	}
198

    
199
	if ( typeof( window.frames["frmMain"].OnDialogTabChange ) == 'function' )
200
		window.frames["frmMain"].OnDialogTabChange( tabCode ) ;
201
}
202

    
203
function SetTabVisibility( tabCode, isVisible )
204
{
205
	var oTab = oTabs[ tabCode ] ;
206
	oTab.style.display = isVisible ? '' : 'none' ;
207

    
208
	if ( ! isVisible && oTab.className == 'PopupTabSelected' )
209
	{
210
		for ( var sCode in oTabs )
211
		{
212
			if ( oTabs[sCode].style.display != 'none' )
213
			{
214
				SetSelectedTab( sCode ) ;
215
				break ;
216
			}
217
		}
218
	}
219
}
220

    
221
function SetOnKeyDown( targetDocument )
222
{
223
	targetDocument.onkeydown = function ( e )
224
	{
225
		e = e || event || this.parentWindow.event ;
226
		switch ( e.keyCode )
227
		{
228
			case 13 :		// ENTER
229
				var oTarget = e.srcElement || e.target ;
230
				if ( oTarget.tagName == 'TEXTAREA' )
231
					return true ;
232
				Ok() ;
233
				return false ;
234
			case 27 :		// ESC
235
				Cancel() ;
236
				return false ;
237
				break ;
238
		}
239
		return true ;
240
	}
241
}
242
SetOnKeyDown( document ) ;
243

    
244
function DisableContextMenu( targetDocument )
245
{
246
	if ( window.dialogArguments.Editor.FCKBrowserInfo.IsIE ) return ;
247

    
248
	// Disable Right-Click
249
	var oOnContextMenu = function( e )
250
	{
251
		var sTagName = e.target.tagName ;
252
		if ( ! ( ( sTagName == "INPUT" && e.target.type == "text" ) || sTagName == "TEXTAREA" ) )
253
			e.preventDefault() ;
254
	}
255
	targetDocument.addEventListener( 'contextmenu', oOnContextMenu, true ) ;
256
}
257
DisableContextMenu( document ) ;
258

    
259
if ( ! window.dialogArguments.Editor.FCKBrowserInfo.IsIE )
260
{
261
	window.onresize = function()
262
	{
263
		var oFrame = document.getElementById("frmMain") ;
264

    
265
		if ( ! oFrame )
266
		return ;
267

    
268
		oFrame.height = 0 ;
269

    
270
		var oCell = document.getElementById("FrameCell") ;
271
		var iHeight = oCell.offsetHeight ;
272

    
273
		oFrame.height = iHeight - 2 ;
274
	}
275
}
276

    
277
if ( window.dialogArguments.Editor.FCKBrowserInfo.IsIE )
278
{
279
	function Window_OnBeforeUnload()
280
	{
281
		for ( var t in oTabs )
282
			oTabs[t] = null ;
283

    
284
		window.dialogArguments.Editor = null ;
285
	}
286
	window.attachEvent( "onbeforeunload", Window_OnBeforeUnload ) ;
287
}
288

    
289
function Window_OnClose()
290
{
291
	window.dialogArguments.Editor.FCKFocusManager.Unlock() ;
292
}
293

    
294
if ( window.addEventListener )
295
	window.addEventListener( 'unload', Window_OnClose, false ) ;
296

    
297
		</script>
298
	</head>
299
	<body onload="LoadInnerDialog();" class="PopupBody">
300
		<table height="100%" cellspacing="0" cellpadding="0" width="100%" border="0">
301
			<tr>
302
				<td id="TitleArea" class="PopupTitle PopupTitleBorder">
303
					<script type="text/javascript">
304
document.write( sTitle ) ;
305
					</script>
306
				</td>
307
			</tr>
308
			<tr id="TabsRow" style="DISPLAY: none">
309
				<td class="PopupTabArea">
310
					<table border="0" cellpadding="0" cellspacing="0" width="100%">
311
						<tr id="Tabs" onselectstart="return false;">
312
							<td class="PopupTabEmptyArea">&nbsp;</td>
313
							<td class="PopupTabEmptyArea" width="100%">&nbsp;</td>
314
						</tr>
315
					</table>
316
				</td>
317
			</tr>
318
			<tr>
319
				<td id="FrameCell" height="100%" valign="top">
320
					<iframe id="frmMain" src="javascript:void(0)" name="frmMain" frameborder="0" height="100%" width="100%" scrolling="auto">
321
					</iframe>
322
				</td>
323
			</tr>
324
			<tr>
325
				<td class="PopupButtons">
326
					<table border="0" cellpadding="0" cellspacing="0">
327
						<tr>
328
							<td width="100%">&nbsp;</td>
329
							<td nowrap="nowrap">
330
								<input id="btnOk" style="VISIBILITY: hidden;" type="button" value="Ok" class="Button" onclick="Ok();" fckLang="DlgBtnOK" />
331
								&nbsp; 
332
								<input id="btnCancel" type="button" value="Cancel" class="Button" onclick="Cancel();" fckLang="DlgBtnCancel" />
333
							</td>
334
						</tr>
335
					</table>
336
				</td>
337
			</tr>
338
		</table>
339
	</body>
340
</html>
(2-2/5)