comparison wiki/htdocs/applets/FCKeditor/fckeditor.cfm @ 4326:07862b0663fd

merge moin/1.8 repo
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Fri, 22 Aug 2008 22:58:18 +0200
parents 79dbcefdff31 6089ade226fb
children 173c67aff3d6
comparison
equal deleted inserted replaced
4325:b6b6979b4813 4326:07862b0663fd
1 <cfsetting enablecfoutputonly="Yes"> 1 <cfsetting enablecfoutputonly="Yes">
2 <!--- 2 <!---
3 * FCKeditor - The text editor for internet 3 * FCKeditor - The text editor for Internet - http://www.fckeditor.net
4 * Copyright (C) 2003-2005 Frederico Caldeira Knabben 4 * Copyright (C) 2003-2008 Frederico Caldeira Knabben
5 * 5 *
6 * Licensed under the terms of the GNU Lesser General Public License: 6 * == BEGIN LICENSE ==
7 * http://www.opensource.org/licenses/lgpl-license.php 7 *
8 * 8 * Licensed under the terms of any of the following licenses at your
9 * For further information visit: 9 * choice:
10 * http://www.fckeditor.net/ 10 *
11 * 11 * - GNU General Public License Version 2 or later (the "GPL")
12 * "Support Open Source software. What about a donation today?" 12 * http://www.gnu.org/licenses/gpl.html
13 * 13 *
14 * File Name: fckeditor.cfm 14 * - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
15 * ColdFusion integration. 15 * http://www.gnu.org/licenses/lgpl.html
16 * Note this module is created for use with Coldfusion 4.52 and above. 16 *
17 * For a cfc version for coldfusion mx check the fckeditor.cfc. 17 * - Mozilla Public License Version 1.1 or later (the "MPL")
18 * 18 * http://www.mozilla.org/MPL/MPL-1.1.html
19 * Syntax: 19 *
20 * 20 * == END LICENSE ==
21 * <cfmodule name="path/to/cfc/fckeditor" 21 *
22 * instanceName="myEditor" 22 * ColdFusion integration.
23 * toolbarSet="..." 23 * Note this module is created for use with Coldfusion 4.52 and above.
24 * width="..." 24 * For a cfc version for coldfusion mx check the fckeditor.cfc.
25 * height="..:" 25 *
26 * value="..." 26 * Syntax:
27 * config="..." 27 *
28 * > 28 * <cfmodule name="path/to/cfc/fckeditor"
29 * 29 * instanceName="myEditor"
30 * File Authors: 30 * toolbarSet="..."
31 * Hendrik Kramer (hk@lwd.de) 31 * width="..."
32 * Mark Woods (mark@thickpaddy.com) 32 * height="..:"
33 * value="..."
34 * config="..."
35 * >
33 ---> 36 --->
34 <!--- :: 37 <!--- ::
35 * Attribute validation 38 * Attribute validation
36 :: ---> 39 :: --->
37 <cfparam name="attributes.instanceName" type="string"> 40 <cfparam name="attributes.instanceName" type="string">
40 <cfparam name="attributes.toolbarSet" type="string" default="Default"> 43 <cfparam name="attributes.toolbarSet" type="string" default="Default">
41 <cfparam name="attributes.value" type="string" default=""> 44 <cfparam name="attributes.value" type="string" default="">
42 <cfparam name="attributes.basePath" type="string" default="/fckeditor/"> 45 <cfparam name="attributes.basePath" type="string" default="/fckeditor/">
43 <cfparam name="attributes.checkBrowser" type="boolean" default="true"> 46 <cfparam name="attributes.checkBrowser" type="boolean" default="true">
44 <cfparam name="attributes.config" type="struct" default="#structNew()#"> 47 <cfparam name="attributes.config" type="struct" default="#structNew()#">
48 <cfinclude template="fckutils.cfm">
45 49
46 <!--- :: 50 <!--- ::
47 * check browser compatibility via HTTP_USER_AGENT, if checkBrowser is true 51 * check browser compatibility via HTTP_USER_AGENT, if checkBrowser is true
48 :: ---> 52 :: --->
49 53
50 <cfscript> 54 <cfscript>
51 if( attributes.checkBrowser ) 55 if( attributes.checkBrowser )
52 { 56 {
53 sAgent = lCase( cgi.HTTP_USER_AGENT ); 57 isCompatibleBrowser = FCKeditor_IsCompatibleBrowser();
54 isCompatibleBrowser = false;
55
56 // check for Internet Explorer ( >= 5.5 )
57 if( find( "msie", sAgent ) and not find( "mac", sAgent ) and not find( "opera", sAgent ) )
58 {
59 // try to extract IE version
60 stResult = reFind( "msie ([5-9]\.[0-9])", sAgent, 1, true );
61 if( arrayLen( stResult.pos ) eq 2 )
62 {
63 // get IE Version
64 sBrowserVersion = mid( sAgent, stResult.pos[2], stResult.len[2] );
65 if( sBrowserVersion GTE 5.5 )
66 isCompatibleBrowser = true;
67 }
68 }
69 // check for Gecko ( >= 20030210+ )
70 else if( find( "gecko/", sAgent ) )
71 {
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 )
75 {
76 // get Gecko build (i18n date)
77 sBrowserVersion = mid( sAgent, stResult.pos[2], stResult.len[2] );
78 if( sBrowserVersion GTE 20030210 )
79 isCompatibleBrowser = true;
80 }
81 }
82 } 58 }
83 else 59 else
84 { 60 {
85 // If we should not check browser compatibility, assume true 61 // If we should not check browser compatibility, assume true
86 isCompatibleBrowser = true; 62 isCompatibleBrowser = true;
106 sURL = sURL & "&amp;Toolbar=" & attributes.toolbarSet; 82 sURL = sURL & "&amp;Toolbar=" & attributes.toolbarSet;
107 83
108 // create configuration string: Key1=Value1&Key2=Value2&... (Key/Value:HTML encoded) 84 // create configuration string: Key1=Value1&Key2=Value2&... (Key/Value:HTML encoded)
109 85
110 /** 86 /**
111 * CFML doesn't store casesensitive names for structure keys, but the configuration names must be casesensitive for js. 87 * 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. 88 * 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. 89 * 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!) 90 * changed 20041206 hk@lwd.de (improvements are welcome!)
115 */ 91 */
116 lConfigKeys = ""; 92 lConfigKeys = "";
117 lConfigKeys = lConfigKeys & "CustomConfigurationsPath,EditorAreaCSS,DocType,BaseHref,FullPage,Debug,SkinPath,PluginsPath,AutoDetectLanguage,DefaultLanguage,ContentLangDirection,EnableXHTML,EnableSourceXHTML,ProcessHTMLEntities,IncludeLatinEntities,IncludeGreekEntities"; 93 lConfigKeys = lConfigKeys & "CustomConfigurationsPath,EditorAreaCSS,ToolbarComboPreviewCSS,DocType";
118 lConfigKeys = lConfigKeys & ",FillEmptyBlocks,FormatSource,FormatOutput,FormatIndentator,GeckoUseSPAN,StartupFocus,ForcePasteAsPlainText,ForceSimpleAmpersand,TabSpaces,ShowBorders,UseBROnCarriageReturn"; 94 lConfigKeys = lConfigKeys & ",BaseHref,FullPage,Debug,AllowQueryStringDebug,SkinPath";
119 lConfigKeys = lConfigKeys & ",ToolbarStartExpanded,ToolbarCanCollapse,ToolbarSets,ContextMenu,FontColors,FontNames,FontSizes,FontFormats,StylesXmlPath,SpellChecker,IeSpellDownloadUrl,MaxUndoLevels"; 95 lConfigKeys = lConfigKeys & ",PreloadImages,PluginsPath,AutoDetectLanguage,DefaultLanguage,ContentLangDirection";
120 lConfigKeys = lConfigKeys & ",LinkBrowser,LinkBrowserURL,LinkBrowserWindowWidth,LinkBrowserWindowHeight"; 96 lConfigKeys = lConfigKeys & ",ProcessHTMLEntities,IncludeLatinEntities,IncludeGreekEntities,ProcessNumericEntities,AdditionalNumericEntities";
121 lConfigKeys = lConfigKeys & ",LinkUpload,LinkUploadURL,LinkUploadWindowWidth,LinkUploadWindowHeight,LinkUploadAllowedExtensions,LinkUploadDeniedExtensions"; 97 lConfigKeys = lConfigKeys & ",FillEmptyBlocks,FormatSource,FormatOutput,FormatIndentator";
122 lConfigKeys = lConfigKeys & ",ImageBrowser,ImageBrowserURL,ImageBrowserWindowWidth,ImageBrowserWindowHeight,SmileyPath,SmileyImages,SmileyColumns,SmileyWindowWidth,SmileyWindowHeight"; 98 lConfigKeys = lConfigKeys & ",StartupFocus,ForcePasteAsPlainText,AutoDetectPasteFromWord,ForceSimpleAmpersand";
123 99 lConfigKeys = lConfigKeys & ",TabSpaces,ShowBorders,SourcePopup,ToolbarStartExpanded,ToolbarCanCollapse";
100 lConfigKeys = lConfigKeys & ",IgnoreEmptyParagraphValue,FloatingPanelsZIndex,TemplateReplaceAll,TemplateReplaceCheckbox";
101 lConfigKeys = lConfigKeys & ",ToolbarLocation,ToolbarSets,EnterMode,ShiftEnterMode,Keystrokes";
102 lConfigKeys = lConfigKeys & ",ContextMenu,BrowserContextMenuOnCtrl,FontColors,FontNames,FontSizes";
103 lConfigKeys = lConfigKeys & ",FontFormats,StylesXmlPath,TemplatesXmlPath,SpellChecker,IeSpellDownloadUrl";
104 lConfigKeys = lConfigKeys & ",SpellerPagesServerScript,FirefoxSpellChecker,MaxUndoLevels,DisableObjectResizing,DisableFFTableHandles";
105 lConfigKeys = lConfigKeys & ",LinkDlgHideTarget ,LinkDlgHideAdvanced,ImageDlgHideLink ,ImageDlgHideAdvanced,FlashDlgHideAdvanced";
106 lConfigKeys = lConfigKeys & ",ProtectedTags,BodyId,BodyClass,DefaultLinkTarget,CleanWordKeepsStructure";
107 lConfigKeys = lConfigKeys & ",LinkBrowser,LinkBrowserURL,LinkBrowserWindowWidth,LinkBrowserWindowHeight,ImageBrowser";
108 lConfigKeys = lConfigKeys & ",ImageBrowserURL,ImageBrowserWindowWidth,ImageBrowserWindowHeight,FlashBrowser,FlashBrowserURL";
109 lConfigKeys = lConfigKeys & ",FlashBrowserWindowWidth ,FlashBrowserWindowHeight,LinkUpload,LinkUploadURL,LinkUploadWindowWidth";
110 lConfigKeys = lConfigKeys & ",LinkUploadWindowHeight,LinkUploadAllowedExtensions,LinkUploadDeniedExtensions,ImageUpload,ImageUploadURL";
111 lConfigKeys = lConfigKeys & ",ImageUploadAllowedExtensions,ImageUploadDeniedExtensions,FlashUpload,FlashUploadURL,FlashUploadAllowedExtensions";
112 lConfigKeys = lConfigKeys & ",FlashUploadDeniedExtensions,SmileyPath,SmileyImages,SmileyColumns,SmileyWindowWidth,SmileyWindowHeight";
113
124 sConfig = ""; 114 sConfig = "";
125 115
126 for( key in attributes.config ) 116 for( key in attributes.config )
127 { 117 {
128 iPos = listFindNoCase( lConfigKeys, key ); 118 iPos = listFindNoCase( lConfigKeys, key );
129 if( iPos GT 0 ) 119 if( iPos GT 0 )
130 { 120 {
131 if( len( sConfig ) ) 121 if( len( sConfig ) )
132 sConfig = sConfig & "&amp;"; 122 sConfig = sConfig & "&amp;";
133 123
134 fieldValue = attributes.config[key]; 124 fieldValue = attributes.config[key];
135 fieldName = listGetAt( lConfigKeys, iPos ); 125 fieldName = listGetAt( lConfigKeys, iPos );
136 126
137 sConfig = sConfig & urlEncodedFormat( fieldName ) & '=' & urlEncodedFormat( fieldValue ); 127 sConfig = sConfig & urlEncodedFormat( fieldName ) & '=' & urlEncodedFormat( fieldValue );
138 } 128 }
139 } 129 }
140 </cfscript> 130 </cfscript>
141 131
142 <cfoutput> 132 <cfoutput>
143 <div>
144 <input type="hidden" id="#attributes.instanceName#" name="#attributes.instanceName#" value="#HTMLEditFormat(attributes.value)#" style="display:none" /> 133 <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" /> 134 <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> 135 <iframe id="#attributes.instanceName#___Frame" src="#sURL#" width="#attributes.width#" height="#attributes.height#" frameborder="0" scrolling="no"></iframe>
147 </div>
148 </cfoutput> 136 </cfoutput>
149 137
150 <cfelse> 138 <cfelse>
151 139
152 <!--- :: 140 <!--- ::
161 attributes.height = attributes.height & "px"; 149 attributes.height = attributes.height & "px";
162 </cfscript> 150 </cfscript>
163 151
164 <!--- Fixed Bug ##1075166. hk@lwd.de 20041206 ---> 152 <!--- Fixed Bug ##1075166. hk@lwd.de 20041206 --->
165 <cfoutput> 153 <cfoutput>
166 <div>
167 <textarea name="#attributes.instanceName#" rows="4" cols="40" style="WIDTH: #attributes.width#; HEIGHT: #attributes.height#">#HTMLEditFormat(attributes.value)#</textarea> 154 <textarea name="#attributes.instanceName#" rows="4" cols="40" style="WIDTH: #attributes.width#; HEIGHT: #attributes.height#">#HTMLEditFormat(attributes.value)#</textarea>
168 </div> 155 </cfoutput>
169 </cfoutput>
170 156
171 </cfif> 157 </cfif>
172 158
173 <cfsetting enablecfoutputonly="No"><cfexit method="exittag"> 159 <cfsetting enablecfoutputonly="No"><cfexit method="exittag">