summaryrefslogtreecommitdiff
path: root/httemplate/elements/fckeditor/editor/fckdialog.html
blob: 7f26822e3b47cfef9c1cfdbc9551dc6cc08d43f5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!--
 * FCKeditor - The text editor for Internet - http://www.fckeditor.net
 * Copyright (C) 2003-2007 Frederico Caldeira Knabben
 *
 * == BEGIN LICENSE ==
 *
 * Licensed under the terms of any of the following licenses at your
 * choice:
 *
 *  - GNU General Public License Version 2 or later (the "GPL")
 *    http://www.gnu.org/licenses/gpl.html
 *
 *  - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
 *    http://www.gnu.org/licenses/lgpl.html
 *
 *  - Mozilla Public License Version 1.1 or later (the "MPL")
 *    http://www.mozilla.org/MPL/MPL-1.1.html
 *
 * == END LICENSE ==
 *
 * This page is used by all dialog box as the container.
-->
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<meta name="robots" content="noindex, nofollow" />
		<script type="text/javascript">

// On some Gecko browsers (probably over slow connections) the
// "dialogArguments" are not set so we must get it from the opener window.
if ( !window.dialogArguments )
	window.dialogArguments = window.opener.FCKLastDialogInfo ;

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

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

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

function LoadInnerDialog()
{
	if ( window.onresize )
		window.onresize() ;

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

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

function InnerDialogLoaded()
{
	var oInnerDoc = document.getElementById('frmMain').contentWindow.document ;

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

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

	SetOnKeyDown( oInnerDoc ) ;
	DisableContextMenu( oInnerDoc ) ;

	return window.dialogArguments.Editor ;
}

function SetOkButton( showIt )
{
	document.getElementById('btnOk').style.visibility = ( showIt ? '' : 'hidden' ) ;
}

var bAutoSize = false ;

function SetAutoSize( autoSize )
{
	bAutoSize = autoSize ;
	RefreshSize() ;
}

function RefreshSize()
{
	if ( bAutoSize )
	{
		var oInnerDoc = document.getElementById('frmMain').contentWindow.document ;

		var iFrameHeight ;
		if ( document.all )
			iFrameHeight = oInnerDoc.body.offsetHeight ;
		else
			iFrameHeight = document.getElementById('frmMain').contentWindow.innerHeight ;

		var iInnerHeight = oInnerDoc.body.scrollHeight ;

		var iDiff = iInnerHeight - iFrameHeight ;

		if ( iDiff > 0 )
		{
			if ( document.all )
				window.dialogHeight = ( parseInt( window.dialogHeight, 10 ) + iDiff ) + 'px' ;
			else
				window.resizeBy( 0, iDiff ) ;
		}
	}
}

function Ok()
{
	if ( window.frames["frmMain"].Ok && window.frames["frmMain"].Ok() )
		Cancel() ;
}

function Cancel( dontFireChange )
{
	if ( !dontFireChange )
	{
		// All dialog windows, by default, will fire the "OnSelectionChange"
		// event, no matter the Ok or Cancel button has been pressed.
		window.dialogArguments.Editor.FCK.Events.FireEvent( 'OnSelectionChange' ) ;
	}
	window.close() ;
}

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

function TabDiv_OnClick()
{
	SetSelectedTab( this.TabCode ) ;
}

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

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

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

	var oDiv = document.createElement( 'DIV' ) ;
	oDiv.className = 'PopupTab' ;
	oDiv.innerHTML = tabText ;
	oDiv.TabCode = tabCode ;
	oDiv.onclick = TabDiv_OnClick ;

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

	eTabsRow = document.getElementById( 'TabsRow' ) ;

	oCell.appendChild( oDiv ) ;

	if ( eTabsRow.style.display == 'none' )
	{
		var eTitleArea = document.getElementById( 'TitleArea' ) ;
		eTitleArea.className = 'PopupTitle' ;

		oDiv.className = 'PopupTabSelected' ;
		eTabsRow.style.display = '' ;

		if ( ! window.dialogArguments.Editor.FCKBrowserInfo.IsIE )
			window.onresize() ;
	}

	oTabs[ tabCode ] = oDiv ;
}

function SetSelectedTab( tabCode )
{
	for ( var sCode in oTabs )
	{
		if ( sCode == tabCode )
			oTabs[sCode].className = 'PopupTabSelected' ;
		else
			oTabs[sCode].className = 'PopupTab' ;
	}

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

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

	if ( ! isVisible && oTab.className == 'PopupTabSelected' )
	{
		for ( var sCode in oTabs )
		{
			if ( oTabs[sCode].style.display != 'none' )
			{
				SetSelectedTab( sCode ) ;
				break ;
			}
		}
	}
}

function SetOnKeyDown( targetDocument )
{
	targetDocument.onkeydown = function ( e )
	{
		e = e || event || this.parentWindow.event ;
		switch ( e.keyCode )
		{
			case 13 :		// ENTER
				var oTarget = e.srcElement || e.target ;
				if ( oTarget.tagName == 'TEXTAREA' )
					return true ;
				Ok() ;
				return false ;
			case 27 :		// ESC
				Cancel() ;
				return false ;
				break ;
		}
		return true ;
	}
}
SetOnKeyDown( document ) ;

function DisableContextMenu( targetDocument )
{
	if ( window.dialogArguments.Editor.FCKBrowserInfo.IsIE ) return ;

	// Disable Right-Click
	var oOnContextMenu = function( e )
	{
		var sTagName = e.target.tagName ;
		if ( ! ( ( sTagName == "INPUT" && e.target.type == "text" ) || sTagName == "TEXTAREA" ) )
			e.preventDefault() ;
	}
	targetDocument.addEventListener( 'contextmenu', oOnContextMenu, true ) ;
}
DisableContextMenu( document ) ;

if ( ! window.dialogArguments.Editor.FCKBrowserInfo.IsIE )
{
	window.onresize = function()
	{
		var oFrame = document.getElementById("frmMain") ;

		if ( ! oFrame )
		return ;

		oFrame.height = 0 ;

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

		oFrame.height = iHeight - 2 ;
	}
}

if ( window.dialogArguments.Editor.FCKBrowserInfo.IsIE )
{
	function Window_OnBeforeUnload()
	{
		for ( var t in oTabs )
			oTabs[t] = null ;

		window.dialogArguments.Editor = null ;
	}
	window.attachEvent( "onbeforeunload", Window_OnBeforeUnload ) ;
}

function Window_OnClose()
{
	window.dialogArguments.Editor.FCKFocusManager.Unlock() ;
}

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

		</script>
	</head>
	<body onload="LoadInnerDialog();" class="PopupBody">
		<table height="100%" cellspacing="0" cellpadding="0" width="100%" border="0">
			<tr>
				<td id="TitleArea" class="PopupTitle PopupTitleBorder">
					<script type="text/javascript">
document.write( sTitle ) ;
					</script>
				</td>
			</tr>
			<tr id="TabsRow" style="DISPLAY: none">
				<td class="PopupTabArea">
					<table border="0" cellpadding="0" cellspacing="0" width="100%">
						<tr id="Tabs" onselectstart="return false;">
							<td class="PopupTabEmptyArea">&nbsp;</td>
							<td class="PopupTabEmptyArea" width="100%">&nbsp;</td>
						</tr>
					</table>
				</td>
			</tr>
			<tr>
				<td id="FrameCell" height="100%" valign="top">
					<iframe id="frmMain" src="javascript:void(0)" name="frmMain" frameborder="0" height="100%" width="100%" scrolling="auto">
					</iframe>
				</td>
			</tr>
			<tr>
				<td class="PopupButtons">
					<table border="0" cellpadding="0" cellspacing="0">
						<tr>
							<td width="100%">&nbsp;</td>
							<td nowrap="nowrap">
								<input id="btnOk" style="VISIBILITY: hidden;" type="button" value="Ok" class="Button" onclick="Ok();" fckLang="DlgBtnOK" />
								&nbsp; 
								<input id="btnCancel" type="button" value="Cancel" class="Button" onclick="Cancel();" fckLang="DlgBtnCancel" />
							</td>
						</tr>
					</table>
				</td>
			</tr>
		</table>
	</body>
</html>