1
<cfcomponent output="false" displayname="FCKeditor" hint="Create an instance of the FCKeditor.">
4
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
5
* Copyright (C) 2003-2009 Frederico Caldeira Knabben
9
* Licensed under the terms of any of the following licenses at your
12
* - GNU General Public License Version 2 or later (the "GPL")
13
* http://www.gnu.org/licenses/gpl.html
15
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
16
* http://www.gnu.org/licenses/lgpl.html
18
* - Mozilla Public License Version 1.1 or later (the "MPL")
19
* http://www.mozilla.org/MPL/MPL-1.1.html
23
* ColdFusion MX integration.
24
* Note this CFC is created for use only with Coldfusion MX and above.
25
* For older version, check the fckeditor.cfm.
30
* fckEditor = createObject("component", "fckeditor.fckeditor");
31
* fckEditor.instanceName="myEditor";
32
* fckEditor.basePath="/fckeditor/";
33
* fckEditor.value="<p>This is my <strong>initial</strong> html text.</p>";
34
* fckEditor.width="100%";
35
* fckEditor.height="200";
36
* // ... additional parameters ...
37
* fckEditor.create(); // create instance now.
40
* See your macromedia coldfusion mx documentation for more info.
43
* Do not use path names with a "." (dot) in the name. This is a coldfusion
44
* limitation with the cfc invocation.
47
<cfinclude template="fckutils.cfm">
54
hint="Outputs the editor HTML in the place where the function is called"
56
<cfoutput>#CreateHtml()#</cfoutput>
64
hint="Retrieves the editor HTML"
67
<cfparam name="this.instanceName" type="string" />
68
<cfparam name="this.width" type="string" default="100%" />
69
<cfparam name="this.height" type="string" default="200" />
70
<cfparam name="this.toolbarSet" type="string" default="Default" />
71
<cfparam name="this.value" type="string" default="" />
72
<cfparam name="this.basePath" type="string" default="/fckeditor/" />
73
<cfparam name="this.checkBrowser" type="boolean" default="true" />
74
<cfparam name="this.config" type="struct" default="#structNew()#" />
77
// display the html editor or a plain textarea?
79
return getHtmlEditor();
91
hint="Check browser compatibility via HTTP_USER_AGENT, if checkBrowser is true"
95
var sAgent = lCase( cgi.HTTP_USER_AGENT );
97
var sBrowserVersion = "";
99
// do not check if argument "checkBrowser" is false
100
if( not this.checkBrowser )
103
return FCKeditor_IsCompatibleBrowser();
112
hint="Create a textarea field for non-compatible browsers."
114
<cfset var result = "" />
115
<cfset var sWidthCSS = "" />
116
<cfset var sHeightCSS = "" />
119
if( Find( "%", this.width ) gt 0)
120
sWidthCSS = this.width;
122
sWidthCSS = this.width & "px";
124
if( Find( "%", this.width ) gt 0)
125
sHeightCSS = this.height;
127
sHeightCSS = this.height & "px";
129
result = "<textarea name=""#this.instanceName#"" rows=""4"" cols=""40"" style=""width: #sWidthCSS#; height: #sHeightCSS#"">#HTMLEditFormat(this.value)#</textarea>" & chr(13) & chr(10);
139
hint="Create the html editor instance for compatible browsers."
141
<cfset var sURL = "" />
142
<cfset var result = "" />
145
// try to fix the basePath, if ending slash is missing
146
if( len( this.basePath) and right( this.basePath, 1 ) is not "/" )
147
this.basePath = this.basePath & "/";
150
sURL = this.basePath & "editor/fckeditor.html?InstanceName=" & this.instanceName;
152
// append toolbarset name to the url
153
if( len( this.toolbarSet ) )
154
sURL = sURL & "&Toolbar=" & this.toolbarSet;
158
result = result & "<input type=""hidden"" id=""#this.instanceName#"" name=""#this.instanceName#"" value=""#HTMLEditFormat(this.value)#"" style=""display:none"" />" & chr(13) & chr(10);
159
result = result & "<input type=""hidden"" id=""#this.instanceName#___Config"" value=""#GetConfigFieldString()#"" style=""display:none"" />" & chr(13) & chr(10);
160
result = result & "<iframe id=""#this.instanceName#___Frame"" src=""#sURL#"" width=""#this.width#"" height=""#this.height#"" frameborder=""0"" scrolling=""no""></iframe>" & chr(13) & chr(10);
166
name="GetConfigFieldString"
170
hint="Create configuration string: Key1=Value1&Key2=Value2&... (Key/Value:HTML encoded)"
172
<cfset var sParams = "" />
173
<cfset var key = "" />
174
<cfset var fieldValue = "" />
175
<cfset var fieldLabel = "" />
176
<cfset var lConfigKeys = "" />
177
<cfset var iPos = "" />
181
* CFML doesn't store casesensitive names for structure keys, but the configuration names must be casesensitive for js.
182
* So we need to find out the correct case for the configuration keys.
183
* We "fix" this by comparing the caseless configuration keys to a list of all available configuration options in the correct case.
184
* changed 20041206 hk@lwd.de (improvements are welcome!)
186
lConfigKeys = lConfigKeys & "CustomConfigurationsPath,EditorAreaCSS,ToolbarComboPreviewCSS,DocType";
187
lConfigKeys = lConfigKeys & ",BaseHref,FullPage,Debug,AllowQueryStringDebug,SkinPath";
188
lConfigKeys = lConfigKeys & ",PreloadImages,PluginsPath,AutoDetectLanguage,DefaultLanguage,ContentLangDirection";
189
lConfigKeys = lConfigKeys & ",ProcessHTMLEntities,IncludeLatinEntities,IncludeGreekEntities,ProcessNumericEntities,AdditionalNumericEntities";
190
lConfigKeys = lConfigKeys & ",FillEmptyBlocks,FormatSource,FormatOutput,FormatIndentator";
191
lConfigKeys = lConfigKeys & ",StartupFocus,ForcePasteAsPlainText,AutoDetectPasteFromWord,ForceSimpleAmpersand";
192
lConfigKeys = lConfigKeys & ",TabSpaces,ShowBorders,SourcePopup,ToolbarStartExpanded,ToolbarCanCollapse";
193
lConfigKeys = lConfigKeys & ",IgnoreEmptyParagraphValue,FloatingPanelsZIndex,TemplateReplaceAll,TemplateReplaceCheckbox";
194
lConfigKeys = lConfigKeys & ",ToolbarLocation,ToolbarSets,EnterMode,ShiftEnterMode,Keystrokes";
195
lConfigKeys = lConfigKeys & ",ContextMenu,BrowserContextMenuOnCtrl,FontColors,FontNames,FontSizes";
196
lConfigKeys = lConfigKeys & ",FontFormats,StylesXmlPath,TemplatesXmlPath,SpellChecker,IeSpellDownloadUrl";
197
lConfigKeys = lConfigKeys & ",SpellerPagesServerScript,FirefoxSpellChecker,MaxUndoLevels,DisableObjectResizing,DisableFFTableHandles";
198
lConfigKeys = lConfigKeys & ",LinkDlgHideTarget,LinkDlgHideAdvanced,ImageDlgHideLink,ImageDlgHideAdvanced,FlashDlgHideAdvanced";
199
lConfigKeys = lConfigKeys & ",ProtectedTags,BodyId,BodyClass,DefaultLinkTarget,CleanWordKeepsStructure";
200
lConfigKeys = lConfigKeys & ",LinkBrowser,LinkBrowserURL,LinkBrowserWindowWidth,LinkBrowserWindowHeight,ImageBrowser";
201
lConfigKeys = lConfigKeys & ",ImageBrowserURL,ImageBrowserWindowWidth,ImageBrowserWindowHeight,FlashBrowser,FlashBrowserURL";
202
lConfigKeys = lConfigKeys & ",FlashBrowserWindowWidth,FlashBrowserWindowHeight,LinkUpload,LinkUploadURL,LinkUploadWindowWidth";
203
lConfigKeys = lConfigKeys & ",LinkUploadWindowHeight,LinkUploadAllowedExtensions,LinkUploadDeniedExtensions,ImageUpload,ImageUploadURL";
204
lConfigKeys = lConfigKeys & ",ImageUploadAllowedExtensions,ImageUploadDeniedExtensions,FlashUpload,FlashUploadURL,FlashUploadAllowedExtensions";
205
lConfigKeys = lConfigKeys & ",FlashUploadDeniedExtensions,SmileyPath,SmileyImages,SmileyColumns,SmileyWindowWidth,SmileyWindowHeight";
207
for( key in this.config )
209
iPos = listFindNoCase( lConfigKeys, key );
213
sParams = sParams & "&";
215
fieldValue = this.config[key];
216
fieldName = listGetAt( lConfigKeys, iPos );
218
// set all boolean possibilities in CFML to true/false values
219
if( isBoolean( fieldValue) and fieldValue )
221
else if( isBoolean( fieldValue) )
222
fieldValue = "false";
224
sParams = sParams & HTMLEditFormat( fieldName ) & '=' & HTMLEditFormat( fieldValue );