Subversion Repositories Applications.papyrus

Rev

Details | Last modification | View Log | RSS feed

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