1
<cfsetting enablecfoutputonly="Yes">
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.cfm
15
* ColdFusion integration.
16
* Note this module is created for use with Coldfusion 4.52 and above.
17
* For a cfc version for coldfusion mx check the fckeditor.cfc.
21
* <cfmodule name="path/to/cfc/fckeditor"
22
* instanceName="myEditor"
31
* Hendrik Kramer (hk@lwd.de)
32
* Mark Woods (mark@thickpaddy.com)
35
* Attribute validation
37
<cfparam name="attributes.instanceName" type="string">
38
<cfparam name="attributes.width" type="string" default="100%">
39
<cfparam name="attributes.height" type="string" default="200">
40
<cfparam name="attributes.toolbarSet" type="string" default="Default">
41
<cfparam name="attributes.value" type="string" default="">
42
<cfparam name="attributes.basePath" type="string" default="/fckeditor/">
43
<cfparam name="attributes.checkBrowser" type="boolean" default="true">
44
<cfparam name="attributes.config" type="struct" default="#structNew()#">
47
* check browser compatibility via HTTP_USER_AGENT, if checkBrowser is true
51
if( attributes.checkBrowser )
53
sAgent = lCase( cgi.HTTP_USER_AGENT );
54
isCompatibleBrowser = false;
56
// check for Internet Explorer ( >= 5.5 )
57
if( find( "msie", sAgent ) and not find( "mac", sAgent ) and not find( "opera", sAgent ) )
59
// try to extract IE version
60
stResult = reFind( "msie ([5-9]\.[0-9])", sAgent, 1, true );
61
if( arrayLen( stResult.pos ) eq 2 )
64
sBrowserVersion = mid( sAgent, stResult.pos[2], stResult.len[2] );
65
if( sBrowserVersion GTE 5.5 )
66
isCompatibleBrowser = true;
69
// check for Gecko ( >= 20030210+ )
70
else if( find( "gecko/", sAgent ) )
72
// try to extract Gecko version date
73
stResult = reFind( "gecko/(200[3-9][0-1][0-9][0-3][0-9])", sAgent, 1, true );
74
if( arrayLen( stResult.pos ) eq 2 )
76
// get Gecko build (i18n date)
77
sBrowserVersion = mid( sAgent, stResult.pos[2], stResult.len[2] );
78
if( sBrowserVersion GTE 20030210 )
79
isCompatibleBrowser = true;
85
// If we should not check browser compatibility, assume true
86
isCompatibleBrowser = true;
90
<cfif isCompatibleBrowser>
93
* show html editor area for compatible browser
97
// try to fix the basePath, if ending slash is missing
98
if( len( attributes.basePath) and right( attributes.basePath, 1 ) is not "/" )
99
attributes.basePath = attributes.basePath & "/";
102
sURL = attributes.basePath & "editor/fckeditor.html?InstanceName=" & attributes.instanceName;
104
// append toolbarset name to the url
105
if( len( attributes.toolbarSet ) )
106
sURL = sURL & "&Toolbar=" & attributes.toolbarSet;
108
// create configuration string: Key1=Value1&Key2=Value2&... (Key/Value:HTML encoded)
111
* CFML doesn't store casesensitive names for structure keys, but the configuration names must be casesensitive for js.
112
* So we need to find out the correct case for the configuration keys.
113
* We "fix" this by comparing the caseless configuration keys to a list of all available configuration options in the correct case.
114
* changed 20041206 hk@lwd.de (improvements are welcome!)
117
lConfigKeys = lConfigKeys & "CustomConfigurationsPath,EditorAreaCSS,DocType,BaseHref,FullPage,Debug,SkinPath,PluginsPath,AutoDetectLanguage,DefaultLanguage,ContentLangDirection,EnableXHTML,EnableSourceXHTML,ProcessHTMLEntities,IncludeLatinEntities,IncludeGreekEntities";
118
lConfigKeys = lConfigKeys & ",FillEmptyBlocks,FormatSource,FormatOutput,FormatIndentator,GeckoUseSPAN,StartupFocus,ForcePasteAsPlainText,ForceSimpleAmpersand,TabSpaces,ShowBorders,UseBROnCarriageReturn";
119
lConfigKeys = lConfigKeys & ",ToolbarStartExpanded,ToolbarCanCollapse,ToolbarSets,ContextMenu,FontColors,FontNames,FontSizes,FontFormats,StylesXmlPath,SpellChecker,IeSpellDownloadUrl,MaxUndoLevels";
120
lConfigKeys = lConfigKeys & ",LinkBrowser,LinkBrowserURL,LinkBrowserWindowWidth,LinkBrowserWindowHeight";
121
lConfigKeys = lConfigKeys & ",LinkUpload,LinkUploadURL,LinkUploadWindowWidth,LinkUploadWindowHeight,LinkUploadAllowedExtensions,LinkUploadDeniedExtensions";
122
lConfigKeys = lConfigKeys & ",ImageBrowser,ImageBrowserURL,ImageBrowserWindowWidth,ImageBrowserWindowHeight,SmileyPath,SmileyImages,SmileyColumns,SmileyWindowWidth,SmileyWindowHeight";
126
for( key in attributes.config )
128
iPos = listFindNoCase( lConfigKeys, key );
132
sConfig = sConfig & "&";
134
fieldValue = attributes.config[key];
135
fieldName = listGetAt( lConfigKeys, iPos );
137
sConfig = sConfig & urlEncodedFormat( fieldName ) & '=' & urlEncodedFormat( fieldValue );
144
<input type="hidden" id="#attributes.instanceName#" name="#attributes.instanceName#" value="#HTMLEditFormat(attributes.value)#" style="display:none" />
145
<input type="hidden" id="#attributes.instanceName#___Config" value="#sConfig#" style="display:none" />
146
<iframe id="#attributes.instanceName#___Frame" src="#sURL#" width="#attributes.width#" height="#attributes.height#" frameborder="no" scrolling="no"></iframe>
153
* show plain textarea for non compatible browser
157
// append unit "px" for numeric width and/or height values
158
if( isNumeric( attributes.width ) )
159
attributes.width = attributes.width & "px";
160
if( isNumeric( attributes.height ) )
161
attributes.height = attributes.height & "px";
164
<!--- Fixed Bug ##1075166. hk@lwd.de 20041206 --->
167
<textarea name="#attributes.instanceName#" rows="4" cols="40" style="WIDTH: #attributes.width#; HEIGHT: #attributes.height#">#HTMLEditFormat(attributes.value)#</textarea>
173
<cfsetting enablecfoutputonly="No"><cfexit method="exittag">
b'\\ No newline at end of file'