1
<cfsetting enablecfoutputonly="Yes">
3
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
4
* Copyright (C) 2003-2007 Frederico Caldeira Knabben
8
* Licensed under the terms of any of the following licenses at your
11
* - GNU General Public License Version 2 or later (the "GPL")
12
* http://www.gnu.org/licenses/gpl.html
14
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
15
* http://www.gnu.org/licenses/lgpl.html
17
* - Mozilla Public License Version 1.1 or later (the "MPL")
18
* http://www.mozilla.org/MPL/MPL-1.1.html
22
* ColdFusion integration.
23
* Note this module is created for use with Coldfusion 4.52 and above.
24
* For a cfc version for coldfusion mx check the fckeditor.cfc.
28
* <cfmodule name="path/to/cfc/fckeditor"
29
* instanceName="myEditor"
38
* Attribute validation
40
<cfparam name="attributes.instanceName" type="string">
41
<cfparam name="attributes.width" type="string" default="100%">
42
<cfparam name="attributes.height" type="string" default="200">
43
<cfparam name="attributes.toolbarSet" type="string" default="Default">
44
<cfparam name="attributes.value" type="string" default="">
45
<cfparam name="attributes.basePath" type="string" default="/fckeditor/">
46
<cfparam name="attributes.checkBrowser" type="boolean" default="true">
47
<cfparam name="attributes.config" type="struct" default="#structNew()#">
50
* check browser compatibility via HTTP_USER_AGENT, if checkBrowser is true
54
if( attributes.checkBrowser )
56
sAgent = lCase( cgi.HTTP_USER_AGENT );
57
isCompatibleBrowser = false;
59
// check for Internet Explorer ( >= 5.5 )
60
if( find( "msie", sAgent ) and not find( "mac", sAgent ) and not find( "opera", sAgent ) )
62
// try to extract IE version
63
stResult = reFind( "msie ([5-9]\.[0-9])", sAgent, 1, true );
64
if( arrayLen( stResult.pos ) eq 2 )
67
sBrowserVersion = mid( sAgent, stResult.pos[2], stResult.len[2] );
68
if( sBrowserVersion GTE 5.5 )
69
isCompatibleBrowser = true;
72
// check for Gecko ( >= 20030210+ )
73
else if( find( "gecko/", sAgent ) )
75
// try to extract Gecko version date
76
stResult = reFind( "gecko/(200[3-9][0-1][0-9][0-3][0-9])", sAgent, 1, true );
77
if( arrayLen( stResult.pos ) eq 2 )
79
// get Gecko build (i18n date)
80
sBrowserVersion = mid( sAgent, stResult.pos[2], stResult.len[2] );
81
if( sBrowserVersion GTE 20030210 )
82
isCompatibleBrowser = true;
88
// If we should not check browser compatibility, assume true
89
isCompatibleBrowser = true;
93
<cfif isCompatibleBrowser>
96
* show html editor area for compatible browser
100
// try to fix the basePath, if ending slash is missing
101
if( len( attributes.basePath) and right( attributes.basePath, 1 ) is not "/" )
102
attributes.basePath = attributes.basePath & "/";
105
sURL = attributes.basePath & "editor/fckeditor.html?InstanceName=" & attributes.instanceName;
107
// append toolbarset name to the url
108
if( len( attributes.toolbarSet ) )
109
sURL = sURL & "&Toolbar=" & attributes.toolbarSet;
111
// create configuration string: Key1=Value1&Key2=Value2&... (Key/Value:HTML encoded)
114
* CFML doesn't store casesensitive names for structure keys, but the configuration names must be casesensitive for js.
115
* So we need to find out the correct case for the configuration keys.
116
* We "fix" this by comparing the caseless configuration keys to a list of all available configuration options in the correct case.
117
* changed 20041206 hk@lwd.de (improvements are welcome!)
120
lConfigKeys = lConfigKeys & "DisableEnterKeyHandler,CustomConfigurationsPath,EditorAreaCSS,ToolbarComboPreviewCSS,DocType";
121
lConfigKeys = lConfigKeys & ",BaseHref,FullPage,Debug,AllowQueryStringDebug,SkinPath";
122
lConfigKeys = lConfigKeys & ",PreloadImages,PluginsPath,AutoDetectLanguage,DefaultLanguage,ContentLangDirection";
123
lConfigKeys = lConfigKeys & ",ProcessHTMLEntities,IncludeLatinEntities,IncludeGreekEntities,ProcessNumericEntities,AdditionalNumericEntities";
124
lConfigKeys = lConfigKeys & ",FillEmptyBlocks,FormatSource,FormatOutput,FormatIndentator,ForceStrongEm";
125
lConfigKeys = lConfigKeys & ",GeckoUseSPAN,StartupFocus,ForcePasteAsPlainText,AutoDetectPasteFromWord,ForceSimpleAmpersand";
126
lConfigKeys = lConfigKeys & ",TabSpaces,ShowBorders,SourcePopup,ToolbarStartExpanded,ToolbarCanCollapse";
127
lConfigKeys = lConfigKeys & ",IgnoreEmptyParagraphValue,PreserveSessionOnFileBrowser,FloatingPanelsZIndex,TemplateReplaceAll,TemplateReplaceCheckbox";
128
lConfigKeys = lConfigKeys & ",ToolbarLocation,ToolbarSets,EnterMode,ShiftEnterMode,Keystrokes";
129
lConfigKeys = lConfigKeys & ",ContextMenu,BrowserContextMenuOnCtrl,FontColors,FontNames,FontSizes";
130
lConfigKeys = lConfigKeys & ",FontFormats,StylesXmlPath,TemplatesXmlPath,SpellChecker,IeSpellDownloadUrl";
131
lConfigKeys = lConfigKeys & ",SpellerPagesServerScript,FirefoxSpellChecker,MaxUndoLevels,DisableObjectResizing,DisableFFTableHandles";
132
lConfigKeys = lConfigKeys & ",LinkDlgHideTarget ,LinkDlgHideAdvanced,ImageDlgHideLink ,ImageDlgHideAdvanced,FlashDlgHideAdvanced";
133
lConfigKeys = lConfigKeys & ",ProtectedTags,BodyId,BodyClass,DefaultLinkTarget,CleanWordKeepsStructure";
134
lConfigKeys = lConfigKeys & ",LinkBrowser,LinkBrowserURL,LinkBrowserWindowWidth,LinkBrowserWindowHeight,ImageBrowser";
135
lConfigKeys = lConfigKeys & ",ImageBrowserURL,ImageBrowserWindowWidth,ImageBrowserWindowHeight,FlashBrowser,FlashBrowserURL";
136
lConfigKeys = lConfigKeys & ",FlashBrowserWindowWidth ,FlashBrowserWindowHeight,LinkUpload,LinkUploadURL,LinkUploadWindowWidth";
137
lConfigKeys = lConfigKeys & ",LinkUploadWindowHeight,LinkUploadAllowedExtensions,LinkUploadDeniedExtensions,ImageUpload,ImageUploadURL";
138
lConfigKeys = lConfigKeys & ",ImageUploadAllowedExtensions,ImageUploadDeniedExtensions,FlashUpload,FlashUploadURL,FlashUploadAllowedExtensions";
139
lConfigKeys = lConfigKeys & ",FlashUploadDeniedExtensions,SmileyPath,SmileyImages,SmileyColumns,SmileyWindowWidth,SmileyWindowHeight";
143
for( key in attributes.config )
145
iPos = listFindNoCase( lConfigKeys, key );
149
sConfig = sConfig & "&";
151
fieldValue = attributes.config[key];
152
fieldName = listGetAt( lConfigKeys, iPos );
154
sConfig = sConfig & urlEncodedFormat( fieldName ) & '=' & urlEncodedFormat( fieldValue );
161
<input type="hidden" id="#attributes.instanceName#" name="#attributes.instanceName#" value="#HTMLEditFormat(attributes.value)#" style="display:none" />
162
<input type="hidden" id="#attributes.instanceName#___Config" value="#sConfig#" style="display:none" />
163
<iframe id="#attributes.instanceName#___Frame" src="#sURL#" width="#attributes.width#" height="#attributes.height#" frameborder="0" scrolling="no"></iframe>
170
* show plain textarea for non compatible browser
174
// append unit "px" for numeric width and/or height values
175
if( isNumeric( attributes.width ) )
176
attributes.width = attributes.width & "px";
177
if( isNumeric( attributes.height ) )
178
attributes.height = attributes.height & "px";
181
<!--- Fixed Bug ##1075166. hk@lwd.de 20041206 --->
184
<textarea name="#attributes.instanceName#" rows="4" cols="40" style="WIDTH: #attributes.width#; HEIGHT: #attributes.height#">#HTMLEditFormat(attributes.value)#</textarea>
190
<cfsetting enablecfoutputonly="No"><cfexit method="exittag">
b'\\ No newline at end of file'