1
<cfcomponent output="false" displayname="FCKeditor" hint="Create an instance of the FCKeditor.">
3
* FCKeditor - The text editor for internet
4
* Copyright (C) 2003-2005 Frederico Caldeira Knabben
6
* Licensed under the terms of the GNU Lesser General Public License:
7
* http://www.opensource.org/licenses/lgpl-license.php
9
* For further information visit:
10
* http://www.fckeditor.net/
12
* "Support Open Source software. What about a donation today?"
14
* File Name: fckeditor.cfc
15
* ColdFusion MX integration.
16
* Note this CFC is created for use only with Coldfusion MX and above.
17
* For older version, check the fckeditor.cfm.
22
* fckEditor = createObject("component", "fckEditorV2/fckeditor");
23
* fckEditor.instanceName="myEditor";
24
* fckEditor.basePath="/fckEditorV2/";
25
* fckEditor.value="This is my <strong>initial</strong> html text.";
26
* fckEditor.width="100%";
27
* fckEditor.height="200";
28
* // ... additional parameters ...
29
* fckEditor.create(); // create instance now.
32
* See your macromedia coldfusion mx documentation for more info.
35
* Do not use path names with a "." (dot) in the name. This is a coldfusion
36
* limitation with the cfc invocation.
39
* Hendrik Kramer (hk@lwd.de)
46
hint="Initialize the FCKeditor instance."
49
<cfparam name="this.instanceName" type="string" />
50
<cfparam name="this.width" type="string" default="100%" />
51
<cfparam name="this.height" type="string" default="200" />
52
<cfparam name="this.toolbarSet" type="string" default="Default" />
53
<cfparam name="this.value" type="string" default="" />
54
<cfparam name="this.basePath" type="string" default="/fckeditor/" />
55
<cfparam name="this.checkBrowser" type="boolean" default="true" />
56
<cfparam name="this.config" type="struct" default="#structNew()#" />
59
// display the html editor or a plain textarea?
73
hint="Check browser compatibility via HTTP_USER_AGENT, if checkBrowser is true"
77
var sAgent = lCase( cgi.HTTP_USER_AGENT );
79
var sBrowserVersion = "";
81
// do not check if argument "checkBrowser" is false
82
if( not this.checkBrowser )
85
// check for Internet Explorer ( >= 5.5 )
86
if( find( "msie", sAgent ) and not find( "mac", sAgent ) and not find( "opera", sAgent ) )
88
// try to extract IE version
89
stResult = reFind( "msie ([5-9]\.[0-9])", sAgent, 1, true );
90
if( arrayLen( stResult.pos ) eq 2 )
93
sBrowserVersion = mid( sAgent, stResult.pos[2], stResult.len[2] );
94
return ( sBrowserVersion GTE 5.5 );
97
// check for Gecko ( >= 20030210+ )
98
else if( find( "gecko/", sAgent ) )
100
// try to extract Gecko version date
101
stResult = reFind( "gecko/(200[3-9][0-1][0-9][0-3][0-9])", sAgent, 1, true );
102
if( arrayLen( stResult.pos ) eq 2 )
104
// get Gecko build (i18n date)
105
sBrowserVersion = mid( sAgent, stResult.pos[2], stResult.len[2] );
106
return ( sBrowserVersion GTE 20030210 );
119
hint="Create a textarea field for non-compatible browsers."
123
// append unit "px" for numeric width and/or height values
124
if( isNumeric( this.width ) )
125
this.width = this.width & "px";
126
if( isNumeric( this.height ) )
127
this.height = this.height & "px";
132
<textarea name="#this.instanceName#" rows="4" cols="40" style="WIDTH: #width#; HEIGHT: #height#">#HTMLEditFormat(this.value)#</textarea>
139
name="showHTMLEditor"
143
hint="Create the html editor instance for compatible browsers."
149
// try to fix the basePath, if ending slash is missing
150
if( len( this.basePath) and right( this.basePath, 1 ) is not "/" )
151
this.basePath = this.basePath & "/";
154
sURL = this.basePath & "editor/fckeditor.html?InstanceName=" & this.instanceName;
156
// append toolbarset name to the url
157
if( len( this.toolbarSet ) )
158
sURL = sURL & "&Toolbar=" & this.toolbarSet;
163
<input type="hidden" id="#this.instanceName#" name="#this.instanceName#" value="#HTMLEditFormat(this.value)#" style="display:none" />
164
<input type="hidden" id="#this.instanceName#___Config" value="#GetConfigFieldString()#" style="display:none" />
165
<iframe id="#this.instanceName#___Frame" src="#sURL#" width="#this.width#" height="#this.height#" frameborder="no" scrolling="no"></iframe>
172
name="GetConfigFieldString"
176
hint="Create configuration string: Key1=Value1&Key2=Value2&... (Key/Value:HTML encoded)"
184
var lConfigKeys = "";
188
* CFML doesn't store casesensitive names for structure keys, but the configuration names must be casesensitive for js.
189
* So we need to find out the correct case for the configuration keys.
190
* We "fix" this by comparing the caseless configuration keys to a list of all available configuration options in the correct case.
191
* changed 20041206 hk@lwd.de (improvements are welcome!)
193
lConfigKeys = lConfigKeys & "CustomConfigurationsPath,EditorAreaCSS,DocType,BaseHref,FullPage,Debug,SkinPath,PluginsPath,AutoDetectLanguage,DefaultLanguage,ContentLangDirection,EnableXHTML,EnableSourceXHTML,ProcessHTMLEntities,IncludeLatinEntities,IncludeGreekEntities";
194
lConfigKeys = lConfigKeys & ",FillEmptyBlocks,FormatSource,FormatOutput,FormatIndentator,GeckoUseSPAN,StartupFocus,ForcePasteAsPlainText,ForceSimpleAmpersand,TabSpaces,ShowBorders,UseBROnCarriageReturn";
195
lConfigKeys = lConfigKeys & ",ToolbarStartExpanded,ToolbarCanCollapse,ToolbarSets,ContextMenu,FontColors,FontNames,FontSizes,FontFormats,StylesXmlPath,SpellChecker,IeSpellDownloadUrl,MaxUndoLevels";
196
lConfigKeys = lConfigKeys & ",LinkBrowser,LinkBrowserURL,LinkBrowserWindowWidth,LinkBrowserWindowHeight";
197
lConfigKeys = lConfigKeys & ",LinkUpload,LinkUploadURL,LinkUploadWindowWidth,LinkUploadWindowHeight,LinkUploadAllowedExtensions,LinkUploadDeniedExtensions";
198
lConfigKeys = lConfigKeys & ",ImageBrowser,ImageBrowserURL,ImageBrowserWindowWidth,ImageBrowserWindowHeight,SmileyPath,SmileyImages,SmileyColumns,SmileyWindowWidth,SmileyWindowHeight";
200
for( key in this.config )
202
iPos = listFindNoCase( lConfigKeys, key );
206
sParams = sParams & "&";
208
fieldValue = this.config[key];
209
fieldName = listGetAt( lConfigKeys, iPos );
211
// set all boolean possibilities in CFML to true/false values
212
if( isBoolean( fieldValue) and fieldValue )
214
else if( isBoolean( fieldValue) )
215
fieldValue = "false";
217
sParams = sParams & HTMLEditFormat( fieldName ) & '=' & HTMLEditFormat( fieldValue );
b'\\ No newline at end of file'