1 <cfsetting enablecfoutputonly="Yes">
\r
3 * FCKeditor - The text editor for Internet - http://www.fckeditor.net
\r
4 * Copyright (C) 2003-2008 Frederico Caldeira Knabben
\r
6 * == BEGIN LICENSE ==
\r
8 * Licensed under the terms of any of the following licenses at your
\r
11 * - GNU General Public License Version 2 or later (the "GPL")
\r
12 * http://www.gnu.org/licenses/gpl.html
\r
14 * - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
\r
15 * http://www.gnu.org/licenses/lgpl.html
\r
17 * - Mozilla Public License Version 1.1 or later (the "MPL")
\r
18 * http://www.mozilla.org/MPL/MPL-1.1.html
\r
22 * ColdFusion integration.
\r
23 * Note this module is created for use with Coldfusion 4.52 and above.
\r
24 * For a cfc version for coldfusion mx check the fckeditor.cfc.
\r
28 * <cfmodule name="path/to/cfc/fckeditor"
\r
29 * instanceName="myEditor"
\r
38 * Attribute validation
\r
40 <cfparam name="attributes.instanceName" type="string">
\r
41 <cfparam name="attributes.width" type="string" default="100%">
\r
42 <cfparam name="attributes.height" type="string" default="200">
\r
43 <cfparam name="attributes.toolbarSet" type="string" default="Default">
\r
44 <cfparam name="attributes.value" type="string" default="">
\r
45 <cfparam name="attributes.basePath" type="string" default="/fckeditor/">
\r
46 <cfparam name="attributes.checkBrowser" type="boolean" default="true">
\r
47 <cfparam name="attributes.config" type="struct" default="#structNew()#">
\r
48 <cfinclude template="fckutils.cfm">
\r
51 * check browser compatibility via HTTP_USER_AGENT, if checkBrowser is true
\r
55 if( attributes.checkBrowser )
\r
57 isCompatibleBrowser = FCKeditor_IsCompatibleBrowser();
\r
61 // If we should not check browser compatibility, assume true
\r
62 isCompatibleBrowser = true;
\r
66 <cfif isCompatibleBrowser>
\r
69 * show html editor area for compatible browser
\r
73 // try to fix the basePath, if ending slash is missing
\r
74 if( len( attributes.basePath) and right( attributes.basePath, 1 ) is not "/" )
\r
75 attributes.basePath = attributes.basePath & "/";
\r
77 // construct the url
\r
78 sURL = attributes.basePath & "editor/fckeditor.html?InstanceName=" & attributes.instanceName;
\r
80 // append toolbarset name to the url
\r
81 if( len( attributes.toolbarSet ) )
\r
82 sURL = sURL & "&Toolbar=" & attributes.toolbarSet;
\r
84 // create configuration string: Key1=Value1&Key2=Value2&... (Key/Value:HTML encoded)
\r
87 * CFML doesn't store casesensitive names for structure keys, but the configuration names must be casesensitive for js.
\r
88 * So we need to find out the correct case for the configuration keys.
\r
89 * We "fix" this by comparing the caseless configuration keys to a list of all available configuration options in the correct case.
\r
90 * changed 20041206 hk@lwd.de (improvements are welcome!)
\r
93 lConfigKeys = lConfigKeys & "CustomConfigurationsPath,EditorAreaCSS,ToolbarComboPreviewCSS,DocType";
\r
94 lConfigKeys = lConfigKeys & ",BaseHref,FullPage,Debug,AllowQueryStringDebug,SkinPath";
\r
95 lConfigKeys = lConfigKeys & ",PreloadImages,PluginsPath,AutoDetectLanguage,DefaultLanguage,ContentLangDirection";
\r
96 lConfigKeys = lConfigKeys & ",ProcessHTMLEntities,IncludeLatinEntities,IncludeGreekEntities,ProcessNumericEntities,AdditionalNumericEntities";
\r
97 lConfigKeys = lConfigKeys & ",FillEmptyBlocks,FormatSource,FormatOutput,FormatIndentator";
\r
98 lConfigKeys = lConfigKeys & ",StartupFocus,ForcePasteAsPlainText,AutoDetectPasteFromWord,ForceSimpleAmpersand";
\r
99 lConfigKeys = lConfigKeys & ",TabSpaces,ShowBorders,SourcePopup,ToolbarStartExpanded,ToolbarCanCollapse";
\r
100 lConfigKeys = lConfigKeys & ",IgnoreEmptyParagraphValue,FloatingPanelsZIndex,TemplateReplaceAll,TemplateReplaceCheckbox";
\r
101 lConfigKeys = lConfigKeys & ",ToolbarLocation,ToolbarSets,EnterMode,ShiftEnterMode,Keystrokes";
\r
102 lConfigKeys = lConfigKeys & ",ContextMenu,BrowserContextMenuOnCtrl,FontColors,FontNames,FontSizes";
\r
103 lConfigKeys = lConfigKeys & ",FontFormats,StylesXmlPath,TemplatesXmlPath,SpellChecker,IeSpellDownloadUrl";
\r
104 lConfigKeys = lConfigKeys & ",SpellerPagesServerScript,FirefoxSpellChecker,MaxUndoLevels,DisableObjectResizing,DisableFFTableHandles";
\r
105 lConfigKeys = lConfigKeys & ",LinkDlgHideTarget ,LinkDlgHideAdvanced,ImageDlgHideLink ,ImageDlgHideAdvanced,FlashDlgHideAdvanced";
\r
106 lConfigKeys = lConfigKeys & ",ProtectedTags,BodyId,BodyClass,DefaultLinkTarget,CleanWordKeepsStructure";
\r
107 lConfigKeys = lConfigKeys & ",LinkBrowser,LinkBrowserURL,LinkBrowserWindowWidth,LinkBrowserWindowHeight,ImageBrowser";
\r
108 lConfigKeys = lConfigKeys & ",ImageBrowserURL,ImageBrowserWindowWidth,ImageBrowserWindowHeight,FlashBrowser,FlashBrowserURL";
\r
109 lConfigKeys = lConfigKeys & ",FlashBrowserWindowWidth ,FlashBrowserWindowHeight,LinkUpload,LinkUploadURL,LinkUploadWindowWidth";
\r
110 lConfigKeys = lConfigKeys & ",LinkUploadWindowHeight,LinkUploadAllowedExtensions,LinkUploadDeniedExtensions,ImageUpload,ImageUploadURL";
\r
111 lConfigKeys = lConfigKeys & ",ImageUploadAllowedExtensions,ImageUploadDeniedExtensions,FlashUpload,FlashUploadURL,FlashUploadAllowedExtensions";
\r
112 lConfigKeys = lConfigKeys & ",FlashUploadDeniedExtensions,SmileyPath,SmileyImages,SmileyColumns,SmileyWindowWidth,SmileyWindowHeight";
\r
116 for( key in attributes.config )
\r
118 iPos = listFindNoCase( lConfigKeys, key );
\r
121 if( len( sConfig ) )
\r
122 sConfig = sConfig & "&";
\r
124 fieldValue = attributes.config[key];
\r
125 fieldName = listGetAt( lConfigKeys, iPos );
\r
127 sConfig = sConfig & urlEncodedFormat( fieldName ) & '=' & urlEncodedFormat( fieldValue );
\r
133 <input type="hidden" id="#attributes.instanceName#" name="#attributes.instanceName#" value="#HTMLEditFormat(attributes.value)#" style="display:none" />
\r
134 <input type="hidden" id="#attributes.instanceName#___Config" value="#sConfig#" style="display:none" />
\r
135 <iframe id="#attributes.instanceName#___Frame" src="#sURL#" width="#attributes.width#" height="#attributes.height#" frameborder="0" scrolling="no"></iframe>
\r
141 * show plain textarea for non compatible browser
\r
145 // append unit "px" for numeric width and/or height values
\r
146 if( isNumeric( attributes.width ) )
\r
147 attributes.width = attributes.width & "px";
\r
148 if( isNumeric( attributes.height ) )
\r
149 attributes.height = attributes.height & "px";
\r
152 <!--- Fixed Bug ##1075166. hk@lwd.de 20041206 --->
\r
154 <textarea name="#attributes.instanceName#" rows="4" cols="40" style="WIDTH: #attributes.width#; HEIGHT: #attributes.height#">#HTMLEditFormat(attributes.value)#</textarea>
\r
159 <cfsetting enablecfoutputonly="No"><cfexit method="exittag">
\r