event refactor, landing on HEAD!
[freeside.git] / httemplate / elements / fckeditor / editor / fckeditor.html
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">\r
2 <!--\r
3  * FCKeditor - The text editor for Internet - http://www.fckeditor.net\r
4  * Copyright (C) 2003-2007 Frederico Caldeira Knabben\r
5  *\r
6  * == BEGIN LICENSE ==\r
7  *\r
8  * Licensed under the terms of any of the following licenses at your\r
9  * choice:\r
10  *\r
11  *  - GNU General Public License Version 2 or later (the "GPL")\r
12  *    http://www.gnu.org/licenses/gpl.html\r
13  *\r
14  *  - GNU Lesser General Public License Version 2.1 or later (the "LGPL")\r
15  *    http://www.gnu.org/licenses/lgpl.html\r
16  *\r
17  *  - Mozilla Public License Version 1.1 or later (the "MPL")\r
18  *    http://www.mozilla.org/MPL/MPL-1.1.html\r
19  *\r
20  * == END LICENSE ==\r
21  *\r
22  * Main page that holds the editor.\r
23 -->\r
24 <html xmlns="http://www.w3.org/1999/xhtml">\r
25 <head>\r
26         <title>FCKeditor</title>\r
27         <meta name="robots" content="noindex, nofollow" />\r
28         <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />\r
29         <meta http-equiv="Cache-Control" content="public" />\r
30         <script type="text/javascript">\r
31 \r
32 // Instead of loading scripts and CSSs using inline tags, all scripts are\r
33 // loaded by code. In this way we can guarantee the correct processing order,\r
34 // otherwise external scripts and inline scripts could be executed in an\r
35 // unwanted order (IE).\r
36 \r
37 function LoadScript( url )\r
38 {\r
39         document.write( '<scr' + 'ipt type="text/javascript" src="' + url + '" onerror="alert(\'Error loading \' + this.src);"><\/scr' + 'ipt>' ) ;\r
40 }\r
41 \r
42 function LoadCss( url )\r
43 {\r
44         document.write( '<link href="' + url + '" type="text/css" rel="stylesheet" onerror="alert(\'Error loading \' + this.src);" />' ) ;\r
45 }\r
46 \r
47 // Main editor scripts.\r
48 var sSuffix = /msie/.test( navigator.userAgent.toLowerCase() ) ? 'ie' : 'gecko' ;\r
49 \r
50 LoadScript( 'js/fckeditorcode_' + sSuffix + '.js' ) ;\r
51 \r
52 // Base configuration file.\r
53 LoadScript( '../fckconfig.js' ) ;\r
54 \r
55         </script>\r
56         <script type="text/javascript">\r
57 \r
58 if ( FCKBrowserInfo.IsIE )\r
59 {\r
60         // Remove IE mouse flickering.\r
61         try\r
62         {\r
63                 document.execCommand( 'BackgroundImageCache', false, true ) ;\r
64         }\r
65         catch (e)\r
66         {\r
67                 // We have been reported about loading problems caused by the above\r
68                 // line. For safety, let's just ignore errors.\r
69         }\r
70 \r
71         // Create the default cleanup object used by the editor.\r
72         FCK.IECleanup = new FCKIECleanup( window ) ;\r
73         FCK.IECleanup.AddItem( FCKTempBin, FCKTempBin.Reset ) ;\r
74         FCK.IECleanup.AddItem( FCK, FCK_Cleanup ) ;\r
75 }\r
76 \r
77 // The config hidden field is processed immediately, because\r
78 // CustomConfigurationsPath may be set in the page.\r
79 FCKConfig.ProcessHiddenField() ;\r
80 \r
81 // Load the custom configurations file (if defined).\r
82 if ( FCKConfig.CustomConfigurationsPath.length > 0 )\r
83         LoadScript( FCKConfig.CustomConfigurationsPath ) ;\r
84 \r
85         </script>\r
86         <script type="text/javascript">\r
87 \r
88 // Load configurations defined at page level.\r
89 FCKConfig_LoadPageConfig() ;\r
90 \r
91 FCKConfig_PreProcess() ;\r
92 \r
93 // Load the active skin CSS.\r
94 LoadCss( FCKConfig.SkinPath + 'fck_editor.css' ) ;\r
95 \r
96 // Load the language file.\r
97 FCKLanguageManager.Initialize() ;\r
98 LoadScript( 'lang/' + FCKLanguageManager.ActiveLanguage.Code + '.js' ) ;\r
99 \r
100         </script>\r
101         <script type="text/javascript">\r
102 \r
103 // Initialize the editing area context menu.\r
104 FCK_ContextMenu_Init() ;\r
105 \r
106 FCKPlugins.Load() ;\r
107 \r
108         </script>\r
109         <script type="text/javascript">\r
110 \r
111 // Set the editor interface direction.\r
112 window.document.dir = FCKLang.Dir ;\r
113 \r
114 // Activate pasting operations.\r
115 if ( FCKConfig.ForcePasteAsPlainText || FCKConfig.AutoDetectPasteFromWord )\r
116         FCK.Events.AttachEvent( 'OnPaste', FCK.Paste ) ;\r
117 \r
118         </script>\r
119         <script type="text/javascript">\r
120 \r
121 window.onload = function()\r
122 {\r
123         InitializeAPI() ;\r
124 \r
125         if ( FCKBrowserInfo.IsIE )\r
126                 FCK_PreloadImages() ;\r
127         else\r
128                 LoadToolbarSetup() ;\r
129 }\r
130 \r
131 function LoadToolbarSetup()\r
132 {\r
133         FCKeditorAPI._FunctionQueue.Add( LoadToolbar ) ;\r
134 }\r
135 \r
136 function LoadToolbar()\r
137 {\r
138         var oToolbarSet = FCK.ToolbarSet = FCKToolbarSet_Create() ;\r
139 \r
140         if ( oToolbarSet.IsLoaded )\r
141                 StartEditor() ;\r
142         else\r
143         {\r
144                 oToolbarSet.OnLoad = StartEditor ;\r
145                 oToolbarSet.Load( FCKURLParams['Toolbar'] || 'Default' ) ;\r
146         }\r
147 }\r
148 \r
149 function StartEditor()\r
150 {\r
151         // Remove the onload listener.\r
152         FCK.ToolbarSet.OnLoad = null ;\r
153 \r
154         FCKeditorAPI._FunctionQueue.Remove( LoadToolbar ) ;\r
155 \r
156         FCK.Events.AttachEvent( 'OnStatusChange', WaitForActive ) ;\r
157 \r
158         // Start the editor.\r
159         FCK.StartEditor() ;\r
160 }\r
161 \r
162 function WaitForActive( editorInstance, newStatus )\r
163 {\r
164         if ( newStatus == FCK_STATUS_ACTIVE )\r
165         {\r
166                 if ( FCKBrowserInfo.IsGecko )\r
167                         FCKTools.RunFunction( window.onresize ) ;\r
168 \r
169                 _AttachFormSubmitToAPI() ;\r
170 \r
171                 FCK.SetStatus( FCK_STATUS_COMPLETE ) ;\r
172 \r
173                 // Call the special "FCKeditor_OnComplete" function that should be present in\r
174                 // the HTML page where the editor is located.\r
175                 if ( typeof( window.parent.FCKeditor_OnComplete ) == 'function' )\r
176                         window.parent.FCKeditor_OnComplete( FCK ) ;\r
177         }\r
178 }\r
179 \r
180 // Gecko browsers doens't calculate well that IFRAME size so we must\r
181 // recalculate it every time the window size changes.\r
182 if ( FCKBrowserInfo.IsGecko )\r
183 {\r
184         function Window_OnResize()\r
185         {\r
186                 if ( FCKBrowserInfo.IsOpera )\r
187                         return ;\r
188 \r
189                 var oCell = document.getElementById( 'xEditingArea' ) ;\r
190 \r
191                 var eInnerElement = oCell.firstChild ;\r
192                 if ( eInnerElement )\r
193                 {\r
194                         eInnerElement.style.height = 0 ;\r
195                         eInnerElement.style.height = oCell.scrollHeight - 2 ;\r
196                 }\r
197         }\r
198         window.onresize = Window_OnResize ;\r
199 }\r
200 \r
201         </script>\r
202 </head>\r
203 <body>\r
204         <table width="100%" cellpadding="0" cellspacing="0" style="height: 100%; table-layout: fixed">\r
205                 <tr id="xToolbarRow" style="display: none">\r
206                         <td id="xToolbarSpace" style="overflow: hidden">\r
207                                 <table width="100%" cellpadding="0" cellspacing="0">\r
208                                         <tr id="xCollapsed" style="display: none">\r
209                                                 <td id="xExpandHandle" class="TB_Expand" colspan="3">\r
210                                                         <img class="TB_ExpandImg" alt="" src="images/spacer.gif" width="8" height="4" /></td>\r
211                                         </tr>\r
212                                         <tr id="xExpanded" style="display: none">\r
213                                                 <td id="xTBLeftBorder" class="TB_SideBorder" style="width: 1px; display: none;"></td>\r
214                                                 <td id="xCollapseHandle" style="display: none" class="TB_Collapse" valign="bottom">\r
215                                                         <img class="TB_CollapseImg" alt="" src="images/spacer.gif" width="8" height="4" /></td>\r
216                                                 <td id="xToolbar" class="TB_ToolbarSet"></td>\r
217                                                 <td class="TB_SideBorder" style="width: 1px"></td>\r
218                                         </tr>\r
219                                 </table>\r
220                         </td>\r
221                 </tr>\r
222                 <tr>\r
223                         <td id="xEditingArea" valign="top" style="height: 100%"></td>\r
224                 </tr>\r
225         </table>\r
226 </body>\r
227 </html>\r