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. |
---|
28 | if ( !window.dialogArguments ) |
---|
29 | window.dialogArguments = window.opener.FCKLastDialogInfo ; |
---|
30 | |
---|
31 | // Sets the Skin CSS |
---|
32 | document.write( '<link href="' + window.dialogArguments.Editor.FCKConfig.SkinPath + 'fck_dialog.css" type="text/css" rel="stylesheet">' ) ; |
---|
33 | |
---|
34 | // Sets the language direction. |
---|
35 | window.document.dir = window.dialogArguments.Editor.FCKLang.Dir ; |
---|
36 | |
---|
37 | var sTitle = window.dialogArguments.Title ; |
---|
38 | document.write( '<title>' + sTitle + '<\/title>' ) ; |
---|
39 | |
---|
40 | function 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 | |
---|
54 | function 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 | |
---|
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 | |
---|
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 | |
---|
109 | function Ok() |
---|
110 | { |
---|
111 | if ( window.frames["frmMain"].Ok && window.frames["frmMain"].Ok() ) |
---|
112 | Cancel() ; |
---|
113 | } |
---|
114 | |
---|
115 | function 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. |
---|
127 | var oTabs = new Object() ; |
---|
128 | |
---|
129 | function TabDiv_OnClick() |
---|
130 | { |
---|
131 | SetSelectedTab( this.TabCode ) ; |
---|
132 | } |
---|
133 | |
---|
134 | function 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 | |
---|
173 | function 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 | |
---|
187 | function 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 | |
---|
205 | function 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 | } |
---|
225 | SetOnKeyDown( document ) ; |
---|
226 | |
---|
227 | function 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 | } |
---|
240 | DisableContextMenu( document ) ; |
---|
241 | |
---|
242 | if ( ! 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 | |
---|
260 | if ( 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 | |
---|
272 | function Window_OnClose() |
---|
273 | { |
---|
274 | window.dialogArguments.Editor.FCKFocusManager.Unlock() ; |
---|
275 | } |
---|
276 | |
---|
277 | if ( 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"> |
---|
287 | document.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"> </td> |
---|
296 | <td class="PopupTabEmptyArea" width="100%"> </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%"> </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" /> <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> |
---|