~mortenoh/+junk/dhis2-detailed-import-export

« back to all changes in this revision

Viewing changes to dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/javascript/FCK/fckeditor.cfm

  • Committer: larshelge at gmail
  • Date: 2009-03-03 16:46:36 UTC
  • Revision ID: larshelge@gmail.com-20090303164636-2sjlrquo7ib1gf7r
Initial check-in

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<cfsetting enablecfoutputonly="Yes">
 
2
<!---
 
3
 * FCKeditor - The text editor for Internet - http://www.fckeditor.net
 
4
 * Copyright (C) 2003-2007 Frederico Caldeira Knabben
 
5
 *
 
6
 * == BEGIN LICENSE ==
 
7
 *
 
8
 * Licensed under the terms of any of the following licenses at your
 
9
 * choice:
 
10
 *
 
11
 *  - GNU General Public License Version 2 or later (the "GPL")
 
12
 *    http://www.gnu.org/licenses/gpl.html
 
13
 *
 
14
 *  - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
 
15
 *    http://www.gnu.org/licenses/lgpl.html
 
16
 *
 
17
 *  - Mozilla Public License Version 1.1 or later (the "MPL")
 
18
 *    http://www.mozilla.org/MPL/MPL-1.1.html
 
19
 *
 
20
 * == END LICENSE ==
 
21
 *
 
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.
 
25
 *
 
26
 * Syntax:
 
27
 *
 
28
 * <cfmodule name="path/to/cfc/fckeditor"
 
29
 *      instanceName="myEditor"
 
30
 *      toolbarSet="..."
 
31
 *      width="..."
 
32
 *      height="..:"
 
33
 *      value="..."
 
34
 *      config="..."
 
35
 * >
 
36
--->
 
37
<!--- ::
 
38
         *      Attribute validation
 
39
        :: --->
 
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()#">
 
48
 
 
49
<!--- ::
 
50
         * check browser compatibility via HTTP_USER_AGENT, if checkBrowser is true
 
51
        :: --->
 
52
 
 
53
<cfscript>
 
54
if( attributes.checkBrowser )
 
55
{
 
56
        sAgent = lCase( cgi.HTTP_USER_AGENT );
 
57
        isCompatibleBrowser = false;
 
58
 
 
59
        // check for Internet Explorer ( >= 5.5 )
 
60
        if( find( "msie", sAgent ) and not find( "mac", sAgent ) and not find( "opera", sAgent ) )
 
61
        {
 
62
                // try to extract IE version
 
63
                stResult = reFind( "msie ([5-9]\.[0-9])", sAgent, 1, true );
 
64
                if( arrayLen( stResult.pos ) eq 2 )
 
65
                {
 
66
                        // get IE Version
 
67
                        sBrowserVersion = mid( sAgent, stResult.pos[2], stResult.len[2] );
 
68
                        if( sBrowserVersion GTE 5.5 )
 
69
                                isCompatibleBrowser = true;
 
70
                }
 
71
        }
 
72
        // check for Gecko ( >= 20030210+ )
 
73
        else if( find( "gecko/", sAgent ) )
 
74
        {
 
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 )
 
78
                {
 
79
                        // get Gecko build (i18n date)
 
80
                        sBrowserVersion = mid( sAgent, stResult.pos[2], stResult.len[2] );
 
81
                        if( sBrowserVersion GTE 20030210 )
 
82
                                isCompatibleBrowser = true;
 
83
                }
 
84
        }
 
85
}
 
86
else
 
87
{
 
88
        // If we should not check browser compatibility, assume true
 
89
        isCompatibleBrowser = true;
 
90
}
 
91
</cfscript>
 
92
 
 
93
<cfif isCompatibleBrowser>
 
94
 
 
95
        <!--- ::
 
96
                 * show html editor area for compatible browser
 
97
                :: --->
 
98
 
 
99
        <cfscript>
 
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 & "/";
 
103
 
 
104
                // construct the url
 
105
                sURL = attributes.basePath & "editor/fckeditor.html?InstanceName=" & attributes.instanceName;
 
106
 
 
107
                // append toolbarset name to the url
 
108
                if( len( attributes.toolbarSet ) )
 
109
                        sURL = sURL & "&amp;Toolbar=" & attributes.toolbarSet;
 
110
 
 
111
                // create configuration string: Key1=Value1&Key2=Value2&... (Key/Value:HTML encoded)
 
112
 
 
113
                /**
 
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!)
 
118
                 */
 
119
                lConfigKeys = "";
 
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";
 
140
 
 
141
                sConfig = "";
 
142
 
 
143
                for( key in attributes.config )
 
144
                {
 
145
                        iPos = listFindNoCase( lConfigKeys, key );
 
146
                        if( iPos GT 0 )
 
147
                        {
 
148
                                if( len( sConfig ) )
 
149
                                        sConfig = sConfig & "&amp;";
 
150
 
 
151
                                fieldValue = attributes.config[key];
 
152
                                fieldName = listGetAt( lConfigKeys, iPos );
 
153
 
 
154
                                sConfig = sConfig & urlEncodedFormat( fieldName ) & '=' & urlEncodedFormat( fieldValue );
 
155
                        }
 
156
                }
 
157
        </cfscript>
 
158
 
 
159
        <cfoutput>
 
160
        <div>
 
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>
 
164
        </div>
 
165
        </cfoutput>
 
166
 
 
167
<cfelse>
 
168
 
 
169
        <!--- ::
 
170
                 * show plain textarea for non compatible browser
 
171
                :: --->
 
172
 
 
173
        <cfscript>
 
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";
 
179
        </cfscript>
 
180
 
 
181
        <!--- Fixed Bug ##1075166. hk@lwd.de 20041206 --->
 
182
        <cfoutput>
 
183
        <div>
 
184
        <textarea name="#attributes.instanceName#" rows="4" cols="40" style="WIDTH: #attributes.width#; HEIGHT: #attributes.height#">#HTMLEditFormat(attributes.value)#</textarea>
 
185
        </div>
 
186
        </cfoutput>
 
187
 
 
188
</cfif>
 
189
 
 
190
<cfsetting enablecfoutputonly="No"><cfexit method="exittag">
 
 
b'\\ No newline at end of file'