source: trunk/admin/inc/FCKeditor/editor/fckdialog.html@ 146

Last change on this file since 146 was 2, checked in by root, 15 years ago

importo il progetto

File size: 8.1 KB
Line 
1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
2<!--
3 * FCKeditor - The text editor for internet
4 * Copyright (C) 2003-2006 Frederico Caldeira Knabben
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 *
12 * "Support Open Source software. What about a donation today?"
13 *
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-->
20<html xmlns="http://www.w3.org/1999/xhtml">
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.
28if ( !window.dialogArguments )
29 window.dialogArguments = window.opener.FCKLastDialogInfo ;
30
31// Sets the Skin CSS
32document.write( '<link href="' + window.dialogArguments.Editor.FCKConfig.SkinPath + 'fck_dialog.css" type="text/css" rel="stylesheet">' ) ;
33
34// Sets the language direction.
35window.document.dir = window.dialogArguments.Editor.FCKLang.Dir ;
36
37var sTitle = window.dialogArguments.Title ;
38document.write( '<title>' + sTitle + '<\/title>' ) ;
39
40function LoadInnerDialog()
41{
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
45 if ( window.onresize )
46 window.onresize() ;
47
48 // First of all, translate the dialog box contents.
49 window.dialogArguments.Editor.FCKLanguageManager.TranslatePage( document ) ;
50
51 window.frames["frmMain"].document.location.href = window.dialogArguments.Page ;
52}
53
54function InnerDialogLoaded()
55{
56 var oInnerDoc = document.getElementById('frmMain').contentWindow.document ;
57
58 // Set the language direction.
59 oInnerDoc.dir = window.dialogArguments.Editor.FCKLang.Dir ;
60
61 // Sets the Skin CSS.
62 oInnerDoc.write( '<link href="' + window.dialogArguments.Editor.FCKConfig.SkinPath + 'fck_dialog.css" type="text/css" rel="stylesheet">' ) ;
63
64 SetOnKeyDown( oInnerDoc ) ;
65 DisableContextMenu( oInnerDoc ) ;
66
67 return window.dialogArguments.Editor ;
68}
69
70function SetOkButton( showIt )
71{
72 document.getElementById('btnOk').style.visibility = ( showIt ? '' : 'hidden' ) ;
73}
74
75var bAutoSize = false ;
76
77function SetAutoSize( autoSize )
78{
79 bAutoSize = autoSize ;
80 RefreshSize() ;
81}
82
83function RefreshSize()
84{
85 if ( bAutoSize )
86 {
87 var oInnerDoc = document.getElementById('frmMain').contentWindow.document ;
88
89 var iFrameHeight ;
90 if ( document.all )
91 iFrameHeight = oInnerDoc.body.offsetHeight ;
92 else
93 iFrameHeight = document.getElementById('frmMain').contentWindow.innerHeight ;
94
95 var iInnerHeight = oInnerDoc.body.scrollHeight ;
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
109function Ok()
110{
111 if ( window.frames["frmMain"].Ok && window.frames["frmMain"].Ok() )
112 Cancel() ;
113}
114
115function Cancel( dontFireChange )
116{
117 if ( !dontFireChange )
118 {
119 // All dialog windows, by default, will fire the "OnSelectionChange"
120 // event, no matter the Ok or Cancel button has been pressed.
121 window.dialogArguments.Editor.FCK.Events.FireEvent( 'OnSelectionChange' ) ;
122 }
123 window.close() ;
124}
125
126// Object that holds all available tabs.
127var oTabs = new Object() ;
128
129function TabDiv_OnClick()
130{
131 SetSelectedTab( this.TabCode ) ;
132}
133
134function AddTab( tabCode, tabText, startHidden )
135{
136 if ( typeof( oTabs[ tabCode ] ) != 'undefined' )
137 return ;
138
139 var eTabsRow = document.getElementById( 'Tabs' ) ;
140
141 var oCell = eTabsRow.insertCell( eTabsRow.cells.length - 1 ) ;
142 oCell.noWrap = true ;
143
144 var oDiv = document.createElement( 'DIV' ) ;
145 oDiv.className = 'PopupTab' ;
146 oDiv.innerHTML = tabText ;
147 oDiv.TabCode = tabCode ;
148 oDiv.onclick = TabDiv_OnClick ;
149
150 if ( startHidden )
151 oDiv.style.display = 'none' ;
152
153 eTabsRow = document.getElementById( 'TabsRow' ) ;
154
155 oCell.appendChild( oDiv ) ;
156
157 if ( eTabsRow.style.display == 'none' )
158 {
159 var eTitleArea = document.getElementById( 'TitleArea' ) ;
160 eTitleArea.className = 'PopupTitle' ;
161
162 oDiv.className = 'PopupTabSelected' ;
163 eTabsRow.style.display = '' ;
164
165 if ( ! window.dialogArguments.Editor.FCKBrowserInfo.IsIE )
166 window.onresize() ;
167 }
168
169 oTabs[ tabCode ] = oDiv ;
170 oTabs[ tabCode ].Index = oTabs.length - 1 ;
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' ) return ;
215 Ok() ;
216 return false ;
217 case 27 : // ESC
218 Cancel() ;
219 return false ;
220 break ;
221 }
222 return true ;
223 }
224}
225SetOnKeyDown( document ) ;
226
227function DisableContextMenu( targetDocument )
228{
229 if ( window.dialogArguments.Editor.FCKBrowserInfo.IsIE ) return ;
230
231 // Disable Right-Click
232 var oOnContextMenu = function( e )
233 {
234 var sTagName = e.target.tagName ;
235 if ( ! ( ( sTagName == "INPUT" && e.target.type == "text" ) || sTagName == "TEXTAREA" ) )
236 e.preventDefault() ;
237 }
238 targetDocument.addEventListener( 'contextmenu', oOnContextMenu, true ) ;
239}
240DisableContextMenu( document ) ;
241
242if ( ! window.dialogArguments.Editor.FCKBrowserInfo.IsIE )
243{
244 window.onresize = function()
245 {
246 var oFrame = document.getElementById("frmMain") ;
247
248 if ( ! oFrame )
249 return ;
250
251 oFrame.height = 0 ;
252
253 var oCell = document.getElementById("FrameCell") ;
254 var iHeight = oCell.offsetHeight ;
255
256 oFrame.height = iHeight - 2 ;
257 }
258}
259
260if ( window.dialogArguments.Editor.FCKBrowserInfo.IsIE )
261{
262 function Window_OnBeforeUnload()
263 {
264 for ( var t in oTabs )
265 oTabs[t] = null ;
266
267 window.dialogArguments.Editor = null ;
268 }
269 window.attachEvent( "onbeforeunload", Window_OnBeforeUnload ) ;
270}
271
272function Window_OnClose()
273{
274 window.dialogArguments.Editor.FCKFocusManager.Unlock() ;
275}
276
277if ( window.addEventListener )
278 window.addEventListener( 'unload', Window_OnClose, false ) ;
279
280 </script>
281 </head>
282 <body onload="LoadInnerDialog();" class="PopupBody">
283 <table height="100%" cellspacing="0" cellpadding="0" width="100%" border="0">
284 <tr>
285 <td id="TitleArea" class="PopupTitle PopupTitleBorder">
286 <script type="text/javascript">
287document.write( sTitle ) ;
288 </script>
289 </td>
290 </tr>
291 <tr id="TabsRow" style="DISPLAY: none">
292 <td class="PopupTabArea">
293 <table border="0" cellpadding="0" cellspacing="0" width="100%">
294 <tr id="Tabs" onselectstart="return false;">
295 <td class="PopupTabEmptyArea">&nbsp;</td>
296 <td class="PopupTabEmptyArea" width="100%">&nbsp;</td>
297 </tr>
298 </table>
299 </td>
300 </tr>
301 <tr>
302 <td id="FrameCell" height="100%" valign="top">
303 <iframe id="frmMain" src="fckblank.html" name="frmMain" frameborder="0" height="100%" width="100%" scrolling="auto">
304 </iframe>
305 </td>
306 </tr>
307 <tr>
308 <td class="PopupButtons">
309 <table border="0" cellpadding="0" cellspacing="0">
310 <tr>
311 <td width="100%">&nbsp;</td>
312 <td nowrap="nowrap">
313 <input id="btnOk" style="VISIBILITY: hidden; width: 100px" type="button" value="Ok" class="Button"
314 onclick="Ok();" fckLang="DlgBtnOK" />&nbsp; <input type="button" value="Cancel" class="Button" onclick="Cancel();" fckLang="DlgBtnCancel" />
315 </td>
316 </tr>
317 </table>
318 </td>
319 </tr>
320 </table>
321 </body>
322</html>
Note: See TracBrowser for help on using the repository browser.