comparison wiki/htdocs/applets/FCKeditor/fckeditor.cfm @ 0:77665d8e2254

tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0 (automatically generated log message) imported from: moin--main--1.5--base-0
author Thomas Waldmann <tw-public@gmx.de>
date Thu, 22 Sep 2005 15:09:50 +0000
parents
children 00a0fa898ed5
comparison
equal deleted inserted replaced
-1:000000000000 0:77665d8e2254
1 <cfsetting enablecfoutputonly="Yes">
2 <!--- @Packager.Header
3 <FileDescription>
4 ColdFusion integration.
5 Note this module is created for use with Coldfusion 4.52 and above.
6 For a cfc version for coldfusion mx check the fckeditor.cfc.
7
8 Syntax:
9
10 &lt;cfmodule name="path/to/cfc/fckeditor"
11 instanceName="myEditor"
12 toolbarSet="..."
13 width="..."
14 height="..:"
15 value="..."
16 config="..."
17 &gt;
18 </FileDescription>
19 <Author name="Hendrik Kramer" email="hk@lwd.de" />
20 --->
21 <!--- ::
22 * Attribute validation
23 :: --->
24 <cfparam name="attributes.instanceName" type="string">
25 <cfparam name="attributes.width" type="string" default="100%">
26 <cfparam name="attributes.height" type="string" default="200">
27 <cfparam name="attributes.toolbarSet" type="string" default="Default">
28 <cfparam name="attributes.value" type="string" default="">
29 <cfparam name="attributes.basePath" type="string" default="/fckeditor/">
30 <cfparam name="attributes.checkBrowser" type="boolean" default="true">
31 <cfparam name="attributes.config" type="struct" default="#structNew()#">
32
33 <!--- ::
34 * check browser compatibility via HTTP_USER_AGENT, if checkBrowser is true
35 :: --->
36
37 <cfscript>
38 if( attributes.checkBrowser )
39 {
40 sAgent = lCase( cgi.HTTP_USER_AGENT );
41 isCompatibleBrowser = false;
42
43 // check for Internet Explorer ( >= 5.5 )
44 if( find( "msie", sAgent ) and not find( "mac", sAgent ) and not find( "opera", sAgent ) )
45 {
46 // try to extract IE version
47 stResult = reFind( "msie ([5-9]\.[0-9])", sAgent, 1, true );
48 if( arrayLen( stResult.pos ) eq 2 )
49 {
50 // get IE Version
51 sBrowserVersion = mid( sAgent, stResult.pos[2], stResult.len[2] );
52 if( sBrowserVersion GTE 5.5 )
53 isCompatibleBrowser = true;
54 }
55 }
56 // check for Gecko ( >= 20030210+ )
57 else if( find( "gecko/", sAgent ) )
58 {
59 // try to extract Gecko version date
60 stResult = reFind( "gecko/(200[3-9][0-1][0-9][0-3][0-9])", sAgent, 1, true );
61 if( arrayLen( stResult.pos ) eq 2 )
62 {
63 // get Gecko build (i18n date)
64 sBrowserVersion = mid( sAgent, stResult.pos[2], stResult.len[2] );
65 if( sBrowserVersion GTE 20030210 )
66 isCompatibleBrowser = true;
67 }
68 }
69 }
70 else
71 {
72 // If we should not check browser compatibility, assume true
73 isCompatibleBrowser = true;
74 }
75 </cfscript>
76
77 <cfif isCompatibleBrowser>
78
79 <!--- ::
80 * show html editor area for compatible browser
81 :: --->
82
83 <cfscript>
84 // try to fix the basePath, if ending slash is missing
85 if( len( attributes.basePath) and right( attributes.basePath, 1 ) is not "/" )
86 attributes.basePath = attributes.basePath & "/";
87
88 // construct the url
89 sURL = attributes.basePath & "editor/fckeditor.html?InstanceName=" & attributes.instanceName;
90
91 // append toolbarset name to the url
92 if( len( attributes.toolbarSet ) )
93 sURL = sURL & "&amp;Toolbar=" & attributes.toolbarSet;
94
95 // create configuration string: Key1=Value1&Key2=Value2&... (Key/Value:HTML encoded)
96
97 /**
98 * CFML doesn't store casesensitive names for structure keys, but the configuration names must be casesensitive for js.
99 * So we need to find out the correct case for the configuration keys.
100 * We "fix" this by comparing the caseless configuration keys to a list of all available configuration options in the correct case.
101 * changed 20041206 hk@lwd.de (improvements are welcome!)
102 */
103 lConfigKeys = "";
104 lConfigKeys = lConfigKeys & "CustomConfigurationsPath,EditorAreaCSS,DocType,BaseHref,FullPage,Debug,SkinPath,PluginsPath,AutoDetectLanguage,DefaultLanguage,ContentLangDirection,EnableXHTML,EnableSourceXHTML,ProcessHTMLEntities,IncludeLatinEntities,IncludeGreekEntities";
105 lConfigKeys = lConfigKeys & ",FillEmptyBlocks,FormatSource,FormatOutput,FormatIndentator,GeckoUseSPAN,StartupFocus,ForcePasteAsPlainText,ForceSimpleAmpersand,TabSpaces,ShowBorders,UseBROnCarriageReturn";
106 lConfigKeys = lConfigKeys & ",ToolbarStartExpanded,ToolbarCanCollapse,ToolbarSets,ContextMenu,FontColors,FontNames,FontSizes,FontFormats,StylesXmlPath,SpellChecker,IeSpellDownloadUrl,MaxUndoLevels";
107 lConfigKeys = lConfigKeys & ",LinkBrowser,LinkBrowserURL,LinkBrowserWindowWidth,LinkBrowserWindowHeight";
108 lConfigKeys = lConfigKeys & ",LinkUpload,LinkUploadURL,LinkUploadWindowWidth,LinkUploadWindowHeight,LinkUploadAllowedExtensions,LinkUploadDeniedExtensions";
109 lConfigKeys = lConfigKeys & ",ImageBrowser,ImageBrowserURL,ImageBrowserWindowWidth,ImageBrowserWindowHeight,SmileyPath,SmileyImages,SmileyColumns,SmileyWindowWidth,SmileyWindowHeight";
110
111 sConfig = "";
112
113 for( key in attributes.config )
114 {
115 iPos = listFindNoCase( lConfigKeys, key );
116 if( iPos GT 0 )
117 {
118 if( len( sConfig ) )
119 sConfig = sConfig & "&amp;";
120
121 fieldValue = attributes.config[key];
122 fieldName = listGetAt( lConfigKeys, iPos );
123
124 sConfig = sConfig & HTMLEditFormat( fieldName ) & '=' & HTMLEditFormat( fieldValue );
125 }
126 }
127 </cfscript>
128
129 <cfoutput>
130 <div>
131 <input type="hidden" id="#attributes.instanceName#" name="#attributes.instanceName#" value="#HTMLEditFormat(attributes.value)#" />
132 <input type="hidden" id="#attributes.instanceName#___Config" value="#sConfig#" />
133 <iframe id="#attributes.instanceName#___Frame" src="#sURL#" width="#attributes.width#" height="#attributes.height#" frameborder="no" scrolling="no"></iframe>
134 </div>
135 </cfoutput>
136
137 <cfelse>
138
139 <!--- ::
140 * show plain textarea for non compatible browser
141 :: --->
142
143 <cfscript>
144 // append unit "px" for numeric width and/or height values
145 if( isNumeric( attributes.width ) )
146 attributes.width = attributes.width & "px";
147 if( isNumeric( attributes.height ) )
148 attributes.height = attributes.height & "px";
149 </cfscript>
150
151 <!--- Fixed Bug ##1075166. hk@lwd.de 20041206 --->
152 <cfoutput>
153 <div>
154 <textarea name="#attributes.instanceName#" rows="4" cols="40" style="WIDTH: #attributes.width#; HEIGHT: #attributes.height#" wrap="virtual">#HTMLEditFormat(attributes.value)#</textarea>
155 </div>
156 </cfoutput>
157
158 </cfif>
159
160 <cfsetting enablecfoutputonly="No"><cfexit method="exittag">