Subversion Repositories Applications.papyrus

Rev

Details | Last modification | View Log | RSS feed

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