forked from extern/egroupware
remove baseconfig for unneeded connectors
This commit is contained in:
parent
b09f75d839
commit
6570199588
@ -1,159 +0,0 @@
|
||||
<%
|
||||
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
|
||||
* Copyright (C) 2003-2009 Frederico Caldeira Knabben
|
||||
*
|
||||
* == BEGIN LICENSE ==
|
||||
*
|
||||
* Licensed under the terms of any of the following licenses at your
|
||||
* choice:
|
||||
*
|
||||
* - GNU General Public License Version 2 or later (the "GPL")
|
||||
* http://www.gnu.org/licenses/gpl.html
|
||||
*
|
||||
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
|
||||
* http://www.gnu.org/licenses/lgpl.html
|
||||
*
|
||||
* - Mozilla Public License Version 1.1 or later (the "MPL")
|
||||
* http://www.mozilla.org/MPL/MPL-1.1.html
|
||||
*
|
||||
* == END LICENSE ==
|
||||
*
|
||||
* This is the integration file for Active FoxPro Pages.
|
||||
*
|
||||
|
||||
DEFINE CLASS goFckeditor AS CONTAINER OLEPUBLIC
|
||||
|
||||
cInstanceName =""
|
||||
BasePath =""
|
||||
cWIDTH =""
|
||||
cHEIGHT =""
|
||||
ToolbarSet =""
|
||||
cValue=""
|
||||
DIMENSION aConfig(10,2)
|
||||
|
||||
&& -----------------------------------------------------------------------
|
||||
FUNCTION fckeditor( tcInstanceName )
|
||||
LOCAL lnLoop,lnLoop2
|
||||
THIS.cInstanceName = tcInstanceName
|
||||
THIS.BasePath = '/fckeditor/'
|
||||
THIS.cWIDTH = '100%'
|
||||
THIS.cHEIGHT = '200'
|
||||
THIS.ToolbarSet = 'Default'
|
||||
THIS.cValue = ''
|
||||
FOR lnLoop=1 TO 10
|
||||
FOR lnLoop2=1 TO 2
|
||||
THIS.aConfig(lnLoop,lnLoop2) = ""
|
||||
NEXT
|
||||
NEXT
|
||||
RETURN
|
||||
ENDFUNC
|
||||
|
||||
|
||||
&& -----------------------------------------------------------------------
|
||||
FUNCTION CREATE()
|
||||
? THIS.CreateHtml()
|
||||
RETURN
|
||||
ENDFUNC
|
||||
|
||||
&& -----------------------------------------------------------------------
|
||||
FUNCTION CreateHtml()
|
||||
LOCAL html
|
||||
LOCAL lcLink
|
||||
|
||||
HtmlValue = THIS.cValue && HTMLSPECIALCHARS()
|
||||
|
||||
html = []
|
||||
IF THIS.IsCompatible()
|
||||
lcLink = THIS.BasePath+[editor/fckeditor.html?InstanceName=]+THIS.cInstanceName
|
||||
|
||||
IF ( !THIS.ToolbarSet == '' )
|
||||
lcLink = lcLink + [&Toolbar=]+THIS.ToolbarSet
|
||||
ENDIF
|
||||
|
||||
&& Render the LINKED HIDDEN FIELD.
|
||||
html = html + [<input type="hidden" id="]+THIS.cInstanceName +[" name="]+THIS.cInstanceName +[" value="]+HtmlValue+[" style="display:none" />]
|
||||
|
||||
&& Render the configurations HIDDEN FIELD.
|
||||
html = html + [<input type="hidden" id="]+THIS.cInstanceName +[___Config" value="]+THIS.GetConfigFieldString() + [" style="display:none" />] +CHR(13)+CHR(10)
|
||||
|
||||
&& Render the EDITOR IFRAME.
|
||||
html = html + [<iframe id="]+THIS.cInstanceName +[___Frame" src="Link" width="]+THIS.cWIDTH+[" height="]+THIS.cHEIGHT+[" frameborder="0" scrolling="no"></iframe>]
|
||||
ELSE
|
||||
IF ( AT("%", THIS.cWIDTH)=0 )
|
||||
WidthCSS = THIS.cWIDTH + 'px'
|
||||
ELSE
|
||||
WidthCSS = THIS.cWIDTH
|
||||
ENDIF
|
||||
|
||||
IF ( AT("%",THIS.cHEIGHT)=0 )
|
||||
HeightCSS = THIS.cHEIGHT + 'px'
|
||||
ELSE
|
||||
HeightCSS = THIS.cHEIGHT
|
||||
ENDIF
|
||||
|
||||
html = html + [<textarea name="]+THIS.cInstanceName +[" rows="4" cols="40" style="width: ]+WidthCSS+[ height: ]+HeightCSS+[">]+HtmlValue+[</textarea>]
|
||||
ENDIF
|
||||
|
||||
RETURN (html)
|
||||
ENDFUNC
|
||||
|
||||
|
||||
&& -----------------------------------------------------------------------
|
||||
FUNCTION IsCompatible()
|
||||
LOCAL llRetval
|
||||
LOCAL sAgent
|
||||
|
||||
llRetval=.F.
|
||||
|
||||
SET POINT TO "."
|
||||
|
||||
sAgent = LOWER(ALLTRIM(request.servervariables("HTTP_USER_AGENT")))
|
||||
|
||||
IF AT("msie",sAgent) >0 .AND. AT("mac",sAgent)=0 .AND. AT("opera",sAgent)=0
|
||||
iVersion=VAL(SUBSTR(sAgent,AT("msie",sAgent)+5,3))
|
||||
llRetval= iVersion > 5.5
|
||||
ELSE
|
||||
IF AT("gecko/",sAgent)>0
|
||||
iVersion=VAL(SUBSTR(sAgent,AT("gecko/",sAgent)+6,8))
|
||||
llRetval =iVersion > 20030210
|
||||
ENDIF
|
||||
ELSE
|
||||
IF AT("opera/",sAgent)>0
|
||||
iVersion=VAL(SUBSTR(sAgent,AT("opera/",sAgent)+6,4))
|
||||
llRetval =iVersion >= 9.5
|
||||
ENDIF
|
||||
ELSE
|
||||
IF AT("applewebkit/",sAgent)>0
|
||||
iVersion=VAL(SUBSTR(sAgent,AT("applewebkit/",sAgent)+12,3))
|
||||
llRetval =iVersion >= 522
|
||||
ENDIF
|
||||
ENDIF
|
||||
|
||||
SET POINT TO
|
||||
|
||||
RETURN (llRetval)
|
||||
ENDFUNC
|
||||
|
||||
&& -----------------------------------------------------------------------
|
||||
FUNCTION GetConfigFieldString()
|
||||
LOCAL sParams
|
||||
LOCAL bFirst
|
||||
LOCAL sKey
|
||||
sParams = ""
|
||||
bFirst = .T.
|
||||
FOR lnLoop=1 TO 10 && ALEN(this.aconfig)
|
||||
IF !EMPTY(THIS.aConfig(lnLoop,1))
|
||||
IF bFirst = .F.
|
||||
sParams = sParams + "&"
|
||||
ELSE
|
||||
bFirst = .F.
|
||||
ENDIF
|
||||
sParams = sParams +THIS.aConfig(lnLoop,1)+[=]+THIS.aConfig(lnLoop,2)
|
||||
ELSE
|
||||
EXIT
|
||||
ENDIF
|
||||
NEXT
|
||||
RETURN(sParams)
|
||||
ENDFUNC
|
||||
ENDDEFINE
|
||||
%>
|
@ -1,235 +0,0 @@
|
||||
<!--
|
||||
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
|
||||
* Copyright (C) 2003-2009 Frederico Caldeira Knabben
|
||||
*
|
||||
* == BEGIN LICENSE ==
|
||||
*
|
||||
* Licensed under the terms of any of the following licenses at your
|
||||
* choice:
|
||||
*
|
||||
* - GNU General Public License Version 2 or later (the "GPL")
|
||||
* http://www.gnu.org/licenses/gpl.html
|
||||
*
|
||||
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
|
||||
* http://www.gnu.org/licenses/lgpl.html
|
||||
*
|
||||
* - Mozilla Public License Version 1.1 or later (the "MPL")
|
||||
* http://www.mozilla.org/MPL/MPL-1.1.html
|
||||
*
|
||||
* == END LICENSE ==
|
||||
*
|
||||
* This is the integration file for ASP.
|
||||
*
|
||||
* It defines the FCKeditor class that can be used to create editor
|
||||
* instances in ASP pages on server side.
|
||||
-->
|
||||
<%
|
||||
Class FCKeditor
|
||||
|
||||
private sBasePath
|
||||
private sInstanceName
|
||||
private sWidth
|
||||
private sHeight
|
||||
private sToolbarSet
|
||||
private sValue
|
||||
|
||||
private oConfig
|
||||
|
||||
Private Sub Class_Initialize()
|
||||
sBasePath = "/fckeditor/"
|
||||
sWidth = "100%"
|
||||
sHeight = "200"
|
||||
sToolbarSet = "Default"
|
||||
sValue = ""
|
||||
|
||||
Set oConfig = CreateObject("Scripting.Dictionary")
|
||||
End Sub
|
||||
|
||||
Public Property Let BasePath( basePathValue )
|
||||
sBasePath = basePathValue
|
||||
End Property
|
||||
|
||||
Public Property Let InstanceName( instanceNameValue )
|
||||
sInstanceName = instanceNameValue
|
||||
End Property
|
||||
|
||||
Public Property Let Width( widthValue )
|
||||
sWidth = widthValue
|
||||
End Property
|
||||
|
||||
Public Property Let Height( heightValue )
|
||||
sHeight = heightValue
|
||||
End Property
|
||||
|
||||
Public Property Let ToolbarSet( toolbarSetValue )
|
||||
sToolbarSet = toolbarSetValue
|
||||
End Property
|
||||
|
||||
Public Property Let Value( newValue )
|
||||
If ( IsNull( newValue ) OR IsEmpty( newValue ) ) Then
|
||||
sValue = ""
|
||||
Else
|
||||
sValue = newValue
|
||||
End If
|
||||
End Property
|
||||
|
||||
Public Property Let Config( configKey, configValue )
|
||||
oConfig.Add configKey, configValue
|
||||
End Property
|
||||
|
||||
' Generates the instace of the editor in the HTML output of the page.
|
||||
Public Sub Create( instanceName )
|
||||
response.write CreateHtml( instanceName )
|
||||
end Sub
|
||||
|
||||
' Returns the html code that must be used to generate an instance of FCKeditor.
|
||||
Public Function CreateHtml( instanceName )
|
||||
dim html
|
||||
|
||||
If IsCompatible() Then
|
||||
|
||||
Dim sFile, sLink
|
||||
If Request.QueryString( "fcksource" ) = "true" Then
|
||||
sFile = "fckeditor.original.html"
|
||||
Else
|
||||
sFile = "fckeditor.html"
|
||||
End If
|
||||
|
||||
sLink = sBasePath & "editor/" & sFile & "?InstanceName=" + instanceName
|
||||
|
||||
If (sToolbarSet & "") <> "" Then
|
||||
sLink = sLink + "&Toolbar=" & sToolbarSet
|
||||
End If
|
||||
|
||||
html = ""
|
||||
' Render the linked hidden field.
|
||||
html = html & "<input type=""hidden"" id=""" & instanceName & """ name=""" & instanceName & """ value=""" & Server.HTMLEncode( sValue ) & """ style=""display:none"" />"
|
||||
|
||||
' Render the configurations hidden field.
|
||||
html = html & "<input type=""hidden"" id=""" & instanceName & "___Config"" value=""" & GetConfigFieldString() & """ style=""display:none"" />"
|
||||
|
||||
' Render the editor IFRAME.
|
||||
html = html & "<iframe id=""" & instanceName & "___Frame"" src=""" & sLink & """ width=""" & sWidth & """ height=""" & sHeight & """ frameborder=""0"" scrolling=""no""></iframe>"
|
||||
|
||||
Else
|
||||
|
||||
Dim sWidthCSS, sHeightCSS
|
||||
|
||||
If InStr( sWidth, "%" ) > 0 Then
|
||||
sWidthCSS = sWidth
|
||||
Else
|
||||
sWidthCSS = sWidth & "px"
|
||||
End If
|
||||
|
||||
If InStr( sHeight, "%" ) > 0 Then
|
||||
sHeightCSS = sHeight
|
||||
Else
|
||||
sHeightCSS = sHeight & "px"
|
||||
End If
|
||||
|
||||
html = "<textarea name=""" & instanceName & """ rows=""4"" cols=""40"" style=""width: " & sWidthCSS & "; height: " & sHeightCSS & """>" & Server.HTMLEncode( sValue ) & "</textarea>"
|
||||
|
||||
End If
|
||||
|
||||
CreateHtml = html
|
||||
|
||||
End Function
|
||||
|
||||
Private Function IsCompatible()
|
||||
|
||||
IsCompatible = FCKeditor_IsCompatibleBrowser()
|
||||
|
||||
End Function
|
||||
|
||||
Private Function GetConfigFieldString()
|
||||
|
||||
Dim sParams
|
||||
|
||||
Dim bFirst
|
||||
bFirst = True
|
||||
|
||||
Dim sKey
|
||||
For Each sKey in oConfig
|
||||
|
||||
If bFirst = False Then
|
||||
sParams = sParams & "&"
|
||||
Else
|
||||
bFirst = False
|
||||
End If
|
||||
|
||||
sParams = sParams & EncodeConfig( sKey ) & "=" & EncodeConfig( oConfig(sKey) )
|
||||
|
||||
Next
|
||||
|
||||
GetConfigFieldString = sParams
|
||||
|
||||
End Function
|
||||
|
||||
Private Function EncodeConfig( valueToEncode )
|
||||
' The locale of the asp server makes the conversion of a boolean to string different to "true" or "false"
|
||||
' so we must do it manually
|
||||
If vartype(valueToEncode) = vbBoolean then
|
||||
If valueToEncode=True Then
|
||||
EncodeConfig="True"
|
||||
Else
|
||||
EncodeConfig="False"
|
||||
End If
|
||||
Else
|
||||
EncodeConfig = Replace( valueToEncode, "&", "%26" )
|
||||
EncodeConfig = Replace( EncodeConfig , "=", "%3D" )
|
||||
EncodeConfig = Replace( EncodeConfig , """", "%22" )
|
||||
End if
|
||||
|
||||
End Function
|
||||
|
||||
End Class
|
||||
|
||||
|
||||
' A function that can be used to check if the current browser is compatible with FCKeditor
|
||||
' without the need to create an instance of the class.
|
||||
Function FCKeditor_IsCompatibleBrowser()
|
||||
|
||||
|
||||
Dim sAgent
|
||||
sAgent = Request.ServerVariables("HTTP_USER_AGENT")
|
||||
|
||||
Dim iVersion
|
||||
Dim re, Matches
|
||||
|
||||
If InStr(sAgent, "MSIE") > 0 AND InStr(sAgent, "mac") <= 0 AND InStr(sAgent, "Opera") <= 0 Then
|
||||
iVersion = CInt( FCKeditor_ToNumericFormat( Mid(sAgent, InStr(sAgent, "MSIE") + 5, 3) ) )
|
||||
FCKeditor_IsCompatibleBrowser = ( iVersion >= 5.5 )
|
||||
ElseIf InStr(sAgent, "Gecko/") > 0 Then
|
||||
iVersion = CLng( Mid( sAgent, InStr( sAgent, "Gecko/" ) + 6, 8 ) )
|
||||
FCKeditor_IsCompatibleBrowser = ( iVersion >= 20030210 )
|
||||
ElseIf InStr(sAgent, "Opera/") > 0 Then
|
||||
iVersion = CSng( FCKeditor_ToNumericFormat( Mid( sAgent, InStr( sAgent, "Opera/" ) + 6, 4 ) ) )
|
||||
FCKeditor_IsCompatibleBrowser = ( iVersion >= 9.5 )
|
||||
ElseIf InStr(sAgent, "AppleWebKit/") > 0 Then
|
||||
Set re = new RegExp
|
||||
re.IgnoreCase = true
|
||||
re.global = false
|
||||
re.Pattern = "AppleWebKit/(\d+)"
|
||||
Set Matches = re.Execute(sAgent)
|
||||
FCKeditor_IsCompatibleBrowser = ( re.Replace(Matches.Item(0).Value, "$1") >= 522 )
|
||||
Else
|
||||
FCKeditor_IsCompatibleBrowser = False
|
||||
End If
|
||||
|
||||
End Function
|
||||
|
||||
|
||||
' By Agrotic
|
||||
' On ASP, when converting string to numbers, the number decimal separator is localized
|
||||
' so 5.5 will not work on systems were the separator is "," and vice versa.
|
||||
Private Function FCKeditor_ToNumericFormat( numberStr )
|
||||
|
||||
If IsNumeric( "5.5" ) Then
|
||||
FCKeditor_ToNumericFormat = Replace( numberStr, ",", ".")
|
||||
Else
|
||||
FCKeditor_ToNumericFormat = Replace( numberStr, ".", ",")
|
||||
End If
|
||||
|
||||
End Function
|
||||
|
||||
%>
|
@ -1,232 +0,0 @@
|
||||
<cfcomponent output="false" displayname="FCKeditor" hint="Create an instance of the FCKeditor.">
|
||||
|
||||
<!---
|
||||
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
|
||||
* Copyright (C) 2003-2009 Frederico Caldeira Knabben
|
||||
*
|
||||
* == BEGIN LICENSE ==
|
||||
*
|
||||
* Licensed under the terms of any of the following licenses at your
|
||||
* choice:
|
||||
*
|
||||
* - GNU General Public License Version 2 or later (the "GPL")
|
||||
* http://www.gnu.org/licenses/gpl.html
|
||||
*
|
||||
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
|
||||
* http://www.gnu.org/licenses/lgpl.html
|
||||
*
|
||||
* - Mozilla Public License Version 1.1 or later (the "MPL")
|
||||
* http://www.mozilla.org/MPL/MPL-1.1.html
|
||||
*
|
||||
* == END LICENSE ==
|
||||
*
|
||||
* ColdFusion MX integration.
|
||||
* Note this CFC is created for use only with Coldfusion MX and above.
|
||||
* For older version, check the fckeditor.cfm.
|
||||
*
|
||||
* Syntax:
|
||||
*
|
||||
* <cfscript>
|
||||
* fckEditor = createObject("component", "fckeditor.fckeditor");
|
||||
* fckEditor.instanceName="myEditor";
|
||||
* fckEditor.basePath="/fckeditor/";
|
||||
* fckEditor.value="<p>This is my <strong>initial</strong> html text.</p>";
|
||||
* fckEditor.width="100%";
|
||||
* fckEditor.height="200";
|
||||
* // ... additional parameters ...
|
||||
* fckEditor.create(); // create instance now.
|
||||
* </cfscript>
|
||||
*
|
||||
* See your macromedia coldfusion mx documentation for more info.
|
||||
*
|
||||
* *** Note:
|
||||
* Do not use path names with a "." (dot) in the name. This is a coldfusion
|
||||
* limitation with the cfc invocation.
|
||||
--->
|
||||
|
||||
<cfinclude template="fckutils.cfm">
|
||||
|
||||
<cffunction
|
||||
name="Create"
|
||||
access="public"
|
||||
output="true"
|
||||
returntype="void"
|
||||
hint="Outputs the editor HTML in the place where the function is called"
|
||||
>
|
||||
<cfoutput>#CreateHtml()#</cfoutput>
|
||||
</cffunction>
|
||||
|
||||
<cffunction
|
||||
name="CreateHtml"
|
||||
access="public"
|
||||
output="false"
|
||||
returntype="string"
|
||||
hint="Retrieves the editor HTML"
|
||||
>
|
||||
|
||||
<cfparam name="this.instanceName" type="string" />
|
||||
<cfparam name="this.width" type="string" default="100%" />
|
||||
<cfparam name="this.height" type="string" default="200" />
|
||||
<cfparam name="this.toolbarSet" type="string" default="Default" />
|
||||
<cfparam name="this.value" type="string" default="" />
|
||||
<cfparam name="this.basePath" type="string" default="/fckeditor/" />
|
||||
<cfparam name="this.checkBrowser" type="boolean" default="true" />
|
||||
<cfparam name="this.config" type="struct" default="#structNew()#" />
|
||||
|
||||
<cfscript>
|
||||
// display the html editor or a plain textarea?
|
||||
if( isCompatible() )
|
||||
return getHtmlEditor();
|
||||
else
|
||||
return getTextArea();
|
||||
</cfscript>
|
||||
|
||||
</cffunction>
|
||||
|
||||
<cffunction
|
||||
name="isCompatible"
|
||||
access="private"
|
||||
output="false"
|
||||
returnType="boolean"
|
||||
hint="Check browser compatibility via HTTP_USER_AGENT, if checkBrowser is true"
|
||||
>
|
||||
|
||||
<cfscript>
|
||||
var sAgent = lCase( cgi.HTTP_USER_AGENT );
|
||||
var stResult = "";
|
||||
var sBrowserVersion = "";
|
||||
|
||||
// do not check if argument "checkBrowser" is false
|
||||
if( not this.checkBrowser )
|
||||
return true;
|
||||
|
||||
return FCKeditor_IsCompatibleBrowser();
|
||||
</cfscript>
|
||||
</cffunction>
|
||||
|
||||
<cffunction
|
||||
name="getTextArea"
|
||||
access="private"
|
||||
output="false"
|
||||
returnType="string"
|
||||
hint="Create a textarea field for non-compatible browsers."
|
||||
>
|
||||
<cfset var result = "" />
|
||||
<cfset var sWidthCSS = "" />
|
||||
<cfset var sHeightCSS = "" />
|
||||
|
||||
<cfscript>
|
||||
if( Find( "%", this.width ) gt 0)
|
||||
sWidthCSS = this.width;
|
||||
else
|
||||
sWidthCSS = this.width & "px";
|
||||
|
||||
if( Find( "%", this.width ) gt 0)
|
||||
sHeightCSS = this.height;
|
||||
else
|
||||
sHeightCSS = this.height & "px";
|
||||
|
||||
result = "<textarea name=""#this.instanceName#"" rows=""4"" cols=""40"" style=""width: #sWidthCSS#; height: #sHeightCSS#"">#HTMLEditFormat(this.value)#</textarea>" & chr(13) & chr(10);
|
||||
</cfscript>
|
||||
<cfreturn result />
|
||||
</cffunction>
|
||||
|
||||
<cffunction
|
||||
name="getHtmlEditor"
|
||||
access="private"
|
||||
output="false"
|
||||
returnType="string"
|
||||
hint="Create the html editor instance for compatible browsers."
|
||||
>
|
||||
<cfset var sURL = "" />
|
||||
<cfset var result = "" />
|
||||
|
||||
<cfscript>
|
||||
// try to fix the basePath, if ending slash is missing
|
||||
if( len( this.basePath) and right( this.basePath, 1 ) is not "/" )
|
||||
this.basePath = this.basePath & "/";
|
||||
|
||||
// construct the url
|
||||
sURL = this.basePath & "editor/fckeditor.html?InstanceName=" & this.instanceName;
|
||||
|
||||
// append toolbarset name to the url
|
||||
if( len( this.toolbarSet ) )
|
||||
sURL = sURL & "&Toolbar=" & this.toolbarSet;
|
||||
</cfscript>
|
||||
|
||||
<cfscript>
|
||||
result = result & "<input type=""hidden"" id=""#this.instanceName#"" name=""#this.instanceName#"" value=""#HTMLEditFormat(this.value)#"" style=""display:none"" />" & chr(13) & chr(10);
|
||||
result = result & "<input type=""hidden"" id=""#this.instanceName#___Config"" value=""#GetConfigFieldString()#"" style=""display:none"" />" & chr(13) & chr(10);
|
||||
result = result & "<iframe id=""#this.instanceName#___Frame"" src=""#sURL#"" width=""#this.width#"" height=""#this.height#"" frameborder=""0"" scrolling=""no""></iframe>" & chr(13) & chr(10);
|
||||
</cfscript>
|
||||
<cfreturn result />
|
||||
</cffunction>
|
||||
|
||||
<cffunction
|
||||
name="GetConfigFieldString"
|
||||
access="private"
|
||||
output="false"
|
||||
returnType="string"
|
||||
hint="Create configuration string: Key1=Value1&Key2=Value2&... (Key/Value:HTML encoded)"
|
||||
>
|
||||
<cfset var sParams = "" />
|
||||
<cfset var key = "" />
|
||||
<cfset var fieldValue = "" />
|
||||
<cfset var fieldLabel = "" />
|
||||
<cfset var lConfigKeys = "" />
|
||||
<cfset var iPos = "" />
|
||||
|
||||
<cfscript>
|
||||
/**
|
||||
* CFML doesn't store casesensitive names for structure keys, but the configuration names must be casesensitive for js.
|
||||
* So we need to find out the correct case for the configuration keys.
|
||||
* We "fix" this by comparing the caseless configuration keys to a list of all available configuration options in the correct case.
|
||||
* changed 20041206 hk@lwd.de (improvements are welcome!)
|
||||
*/
|
||||
lConfigKeys = lConfigKeys & "CustomConfigurationsPath,EditorAreaCSS,ToolbarComboPreviewCSS,DocType";
|
||||
lConfigKeys = lConfigKeys & ",BaseHref,FullPage,Debug,AllowQueryStringDebug,SkinPath";
|
||||
lConfigKeys = lConfigKeys & ",PreloadImages,PluginsPath,AutoDetectLanguage,DefaultLanguage,ContentLangDirection";
|
||||
lConfigKeys = lConfigKeys & ",ProcessHTMLEntities,IncludeLatinEntities,IncludeGreekEntities,ProcessNumericEntities,AdditionalNumericEntities";
|
||||
lConfigKeys = lConfigKeys & ",FillEmptyBlocks,FormatSource,FormatOutput,FormatIndentator";
|
||||
lConfigKeys = lConfigKeys & ",StartupFocus,ForcePasteAsPlainText,AutoDetectPasteFromWord,ForceSimpleAmpersand";
|
||||
lConfigKeys = lConfigKeys & ",TabSpaces,ShowBorders,SourcePopup,ToolbarStartExpanded,ToolbarCanCollapse";
|
||||
lConfigKeys = lConfigKeys & ",IgnoreEmptyParagraphValue,FloatingPanelsZIndex,TemplateReplaceAll,TemplateReplaceCheckbox";
|
||||
lConfigKeys = lConfigKeys & ",ToolbarLocation,ToolbarSets,EnterMode,ShiftEnterMode,Keystrokes";
|
||||
lConfigKeys = lConfigKeys & ",ContextMenu,BrowserContextMenuOnCtrl,FontColors,FontNames,FontSizes";
|
||||
lConfigKeys = lConfigKeys & ",FontFormats,StylesXmlPath,TemplatesXmlPath,SpellChecker,IeSpellDownloadUrl";
|
||||
lConfigKeys = lConfigKeys & ",SpellerPagesServerScript,FirefoxSpellChecker,MaxUndoLevels,DisableObjectResizing,DisableFFTableHandles";
|
||||
lConfigKeys = lConfigKeys & ",LinkDlgHideTarget,LinkDlgHideAdvanced,ImageDlgHideLink,ImageDlgHideAdvanced,FlashDlgHideAdvanced";
|
||||
lConfigKeys = lConfigKeys & ",ProtectedTags,BodyId,BodyClass,DefaultLinkTarget,CleanWordKeepsStructure";
|
||||
lConfigKeys = lConfigKeys & ",LinkBrowser,LinkBrowserURL,LinkBrowserWindowWidth,LinkBrowserWindowHeight,ImageBrowser";
|
||||
lConfigKeys = lConfigKeys & ",ImageBrowserURL,ImageBrowserWindowWidth,ImageBrowserWindowHeight,FlashBrowser,FlashBrowserURL";
|
||||
lConfigKeys = lConfigKeys & ",FlashBrowserWindowWidth,FlashBrowserWindowHeight,LinkUpload,LinkUploadURL,LinkUploadWindowWidth";
|
||||
lConfigKeys = lConfigKeys & ",LinkUploadWindowHeight,LinkUploadAllowedExtensions,LinkUploadDeniedExtensions,ImageUpload,ImageUploadURL";
|
||||
lConfigKeys = lConfigKeys & ",ImageUploadAllowedExtensions,ImageUploadDeniedExtensions,FlashUpload,FlashUploadURL,FlashUploadAllowedExtensions";
|
||||
lConfigKeys = lConfigKeys & ",FlashUploadDeniedExtensions,SmileyPath,SmileyImages,SmileyColumns,SmileyWindowWidth,SmileyWindowHeight";
|
||||
|
||||
for( key in this.config )
|
||||
{
|
||||
iPos = listFindNoCase( lConfigKeys, key );
|
||||
if( iPos GT 0 )
|
||||
{
|
||||
if( len( sParams ) )
|
||||
sParams = sParams & "&";
|
||||
|
||||
fieldValue = this.config[key];
|
||||
fieldName = listGetAt( lConfigKeys, iPos );
|
||||
|
||||
// set all boolean possibilities in CFML to true/false values
|
||||
if( isBoolean( fieldValue) and fieldValue )
|
||||
fieldValue = "true";
|
||||
else if( isBoolean( fieldValue) )
|
||||
fieldValue = "false";
|
||||
|
||||
sParams = sParams & HTMLEditFormat( fieldName ) & '=' & HTMLEditFormat( fieldValue );
|
||||
}
|
||||
}
|
||||
return sParams;
|
||||
</cfscript>
|
||||
|
||||
</cffunction>
|
||||
|
||||
</cfcomponent>
|
@ -1,159 +0,0 @@
|
||||
<cfsetting enablecfoutputonly="Yes">
|
||||
<!---
|
||||
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
|
||||
* Copyright (C) 2003-2009 Frederico Caldeira Knabben
|
||||
*
|
||||
* == BEGIN LICENSE ==
|
||||
*
|
||||
* Licensed under the terms of any of the following licenses at your
|
||||
* choice:
|
||||
*
|
||||
* - GNU General Public License Version 2 or later (the "GPL")
|
||||
* http://www.gnu.org/licenses/gpl.html
|
||||
*
|
||||
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
|
||||
* http://www.gnu.org/licenses/lgpl.html
|
||||
*
|
||||
* - Mozilla Public License Version 1.1 or later (the "MPL")
|
||||
* http://www.mozilla.org/MPL/MPL-1.1.html
|
||||
*
|
||||
* == END LICENSE ==
|
||||
*
|
||||
* ColdFusion integration.
|
||||
* Note this module is created for use with Coldfusion 4.52 and above.
|
||||
* For a cfc version for coldfusion mx check the fckeditor.cfc.
|
||||
*
|
||||
* Syntax:
|
||||
*
|
||||
* <cfmodule name="path/to/cfc/fckeditor"
|
||||
* instanceName="myEditor"
|
||||
* toolbarSet="..."
|
||||
* width="..."
|
||||
* height="..:"
|
||||
* value="..."
|
||||
* config="..."
|
||||
* >
|
||||
--->
|
||||
<!--- ::
|
||||
* Attribute validation
|
||||
:: --->
|
||||
<cfparam name="attributes.instanceName" type="string">
|
||||
<cfparam name="attributes.width" type="string" default="100%">
|
||||
<cfparam name="attributes.height" type="string" default="200">
|
||||
<cfparam name="attributes.toolbarSet" type="string" default="Default">
|
||||
<cfparam name="attributes.value" type="string" default="">
|
||||
<cfparam name="attributes.basePath" type="string" default="/fckeditor/">
|
||||
<cfparam name="attributes.checkBrowser" type="boolean" default="true">
|
||||
<cfparam name="attributes.config" type="struct" default="#structNew()#">
|
||||
<cfinclude template="fckutils.cfm">
|
||||
|
||||
<!--- ::
|
||||
* check browser compatibility via HTTP_USER_AGENT, if checkBrowser is true
|
||||
:: --->
|
||||
|
||||
<cfscript>
|
||||
if( attributes.checkBrowser )
|
||||
{
|
||||
isCompatibleBrowser = FCKeditor_IsCompatibleBrowser();
|
||||
}
|
||||
else
|
||||
{
|
||||
// If we should not check browser compatibility, assume true
|
||||
isCompatibleBrowser = true;
|
||||
}
|
||||
</cfscript>
|
||||
|
||||
<cfif isCompatibleBrowser>
|
||||
|
||||
<!--- ::
|
||||
* show html editor area for compatible browser
|
||||
:: --->
|
||||
|
||||
<cfscript>
|
||||
// try to fix the basePath, if ending slash is missing
|
||||
if( len( attributes.basePath) and right( attributes.basePath, 1 ) is not "/" )
|
||||
attributes.basePath = attributes.basePath & "/";
|
||||
|
||||
// construct the url
|
||||
sURL = attributes.basePath & "editor/fckeditor.html?InstanceName=" & attributes.instanceName;
|
||||
|
||||
// append toolbarset name to the url
|
||||
if( len( attributes.toolbarSet ) )
|
||||
sURL = sURL & "&Toolbar=" & attributes.toolbarSet;
|
||||
|
||||
// create configuration string: Key1=Value1&Key2=Value2&... (Key/Value:HTML encoded)
|
||||
|
||||
/**
|
||||
* CFML doesn't store casesensitive names for structure keys, but the configuration names must be casesensitive for js.
|
||||
* So we need to find out the correct case for the configuration keys.
|
||||
* We "fix" this by comparing the caseless configuration keys to a list of all available configuration options in the correct case.
|
||||
* changed 20041206 hk@lwd.de (improvements are welcome!)
|
||||
*/
|
||||
lConfigKeys = "";
|
||||
lConfigKeys = lConfigKeys & "CustomConfigurationsPath,EditorAreaCSS,ToolbarComboPreviewCSS,DocType";
|
||||
lConfigKeys = lConfigKeys & ",BaseHref,FullPage,Debug,AllowQueryStringDebug,SkinPath";
|
||||
lConfigKeys = lConfigKeys & ",PreloadImages,PluginsPath,AutoDetectLanguage,DefaultLanguage,ContentLangDirection";
|
||||
lConfigKeys = lConfigKeys & ",ProcessHTMLEntities,IncludeLatinEntities,IncludeGreekEntities,ProcessNumericEntities,AdditionalNumericEntities";
|
||||
lConfigKeys = lConfigKeys & ",FillEmptyBlocks,FormatSource,FormatOutput,FormatIndentator";
|
||||
lConfigKeys = lConfigKeys & ",StartupFocus,ForcePasteAsPlainText,AutoDetectPasteFromWord,ForceSimpleAmpersand";
|
||||
lConfigKeys = lConfigKeys & ",TabSpaces,ShowBorders,SourcePopup,ToolbarStartExpanded,ToolbarCanCollapse";
|
||||
lConfigKeys = lConfigKeys & ",IgnoreEmptyParagraphValue,FloatingPanelsZIndex,TemplateReplaceAll,TemplateReplaceCheckbox";
|
||||
lConfigKeys = lConfigKeys & ",ToolbarLocation,ToolbarSets,EnterMode,ShiftEnterMode,Keystrokes";
|
||||
lConfigKeys = lConfigKeys & ",ContextMenu,BrowserContextMenuOnCtrl,FontColors,FontNames,FontSizes";
|
||||
lConfigKeys = lConfigKeys & ",FontFormats,StylesXmlPath,TemplatesXmlPath,SpellChecker,IeSpellDownloadUrl";
|
||||
lConfigKeys = lConfigKeys & ",SpellerPagesServerScript,FirefoxSpellChecker,MaxUndoLevels,DisableObjectResizing,DisableFFTableHandles";
|
||||
lConfigKeys = lConfigKeys & ",LinkDlgHideTarget ,LinkDlgHideAdvanced,ImageDlgHideLink ,ImageDlgHideAdvanced,FlashDlgHideAdvanced";
|
||||
lConfigKeys = lConfigKeys & ",ProtectedTags,BodyId,BodyClass,DefaultLinkTarget,CleanWordKeepsStructure";
|
||||
lConfigKeys = lConfigKeys & ",LinkBrowser,LinkBrowserURL,LinkBrowserWindowWidth,LinkBrowserWindowHeight,ImageBrowser";
|
||||
lConfigKeys = lConfigKeys & ",ImageBrowserURL,ImageBrowserWindowWidth,ImageBrowserWindowHeight,FlashBrowser,FlashBrowserURL";
|
||||
lConfigKeys = lConfigKeys & ",FlashBrowserWindowWidth ,FlashBrowserWindowHeight,LinkUpload,LinkUploadURL,LinkUploadWindowWidth";
|
||||
lConfigKeys = lConfigKeys & ",LinkUploadWindowHeight,LinkUploadAllowedExtensions,LinkUploadDeniedExtensions,ImageUpload,ImageUploadURL";
|
||||
lConfigKeys = lConfigKeys & ",ImageUploadAllowedExtensions,ImageUploadDeniedExtensions,FlashUpload,FlashUploadURL,FlashUploadAllowedExtensions";
|
||||
lConfigKeys = lConfigKeys & ",FlashUploadDeniedExtensions,SmileyPath,SmileyImages,SmileyColumns,SmileyWindowWidth,SmileyWindowHeight";
|
||||
|
||||
sConfig = "";
|
||||
|
||||
for( key in attributes.config )
|
||||
{
|
||||
iPos = listFindNoCase( lConfigKeys, key );
|
||||
if( iPos GT 0 )
|
||||
{
|
||||
if( len( sConfig ) )
|
||||
sConfig = sConfig & "&";
|
||||
|
||||
fieldValue = attributes.config[key];
|
||||
fieldName = listGetAt( lConfigKeys, iPos );
|
||||
|
||||
sConfig = sConfig & urlEncodedFormat( fieldName ) & '=' & urlEncodedFormat( fieldValue );
|
||||
}
|
||||
}
|
||||
</cfscript>
|
||||
|
||||
<cfoutput>
|
||||
<input type="hidden" id="#attributes.instanceName#" name="#attributes.instanceName#" value="#HTMLEditFormat(attributes.value)#" style="display:none" />
|
||||
<input type="hidden" id="#attributes.instanceName#___Config" value="#sConfig#" style="display:none" />
|
||||
<iframe id="#attributes.instanceName#___Frame" src="#sURL#" width="#attributes.width#" height="#attributes.height#" frameborder="0" scrolling="no"></iframe>
|
||||
</cfoutput>
|
||||
|
||||
<cfelse>
|
||||
|
||||
<!--- ::
|
||||
* show plain textarea for non compatible browser
|
||||
:: --->
|
||||
|
||||
<cfscript>
|
||||
// append unit "px" for numeric width and/or height values
|
||||
if( isNumeric( attributes.width ) )
|
||||
attributes.width = attributes.width & "px";
|
||||
if( isNumeric( attributes.height ) )
|
||||
attributes.height = attributes.height & "px";
|
||||
</cfscript>
|
||||
|
||||
<!--- Fixed Bug ##1075166. hk@lwd.de 20041206 --->
|
||||
<cfoutput>
|
||||
<textarea name="#attributes.instanceName#" rows="4" cols="40" style="WIDTH: #attributes.width#; HEIGHT: #attributes.height#">#HTMLEditFormat(attributes.value)#</textarea>
|
||||
</cfoutput>
|
||||
|
||||
</cfif>
|
||||
|
||||
<cfsetting enablecfoutputonly="No"><cfexit method="exittag">
|
@ -1,108 +0,0 @@
|
||||
[//lasso
|
||||
/*
|
||||
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
|
||||
* Copyright (C) 2003-2009 Frederico Caldeira Knabben
|
||||
*
|
||||
* == BEGIN LICENSE ==
|
||||
*
|
||||
* Licensed under the terms of any of the following licenses at your
|
||||
* choice:
|
||||
*
|
||||
* - GNU General Public License Version 2 or later (the "GPL")
|
||||
* http://www.gnu.org/licenses/gpl.html
|
||||
*
|
||||
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
|
||||
* http://www.gnu.org/licenses/lgpl.html
|
||||
*
|
||||
* - Mozilla Public License Version 1.1 or later (the "MPL")
|
||||
* http://www.mozilla.org/MPL/MPL-1.1.html
|
||||
*
|
||||
* == END LICENSE ==
|
||||
*
|
||||
* This is the integration file for Lasso.
|
||||
*
|
||||
* It defines the FCKeditor class ("custom type" in Lasso terms) that can
|
||||
* be used to create editor instances in Lasso pages on server side.
|
||||
*/
|
||||
|
||||
define_type(
|
||||
'editor',
|
||||
-namespace='fck_',
|
||||
-description='Creates an instance of FCKEditor.'
|
||||
);
|
||||
local(
|
||||
'instancename' = 'FCKEditor1',
|
||||
'width' = '100%',
|
||||
'height' = '200',
|
||||
'toolbarset' = 'Default',
|
||||
'initialvalue' = string,
|
||||
'basepath' = '/fckeditor/',
|
||||
'config' = array,
|
||||
'checkbrowser' = true,
|
||||
'displayerrors' = false
|
||||
);
|
||||
|
||||
define_tag(
|
||||
'onCreate',
|
||||
-required='instancename', -type='string',
|
||||
-optional='width', -type='string',
|
||||
-optional='height', -type='string',
|
||||
-optional='toolbarset', -type='string',
|
||||
-optional='initialvalue', -type='string',
|
||||
-optional='basepath', -type='string',
|
||||
-optional='config', -type='array'
|
||||
);
|
||||
self->instancename = #instancename;
|
||||
local_defined('width') ? self->width = #width;
|
||||
local_defined('height') ? self->height = #height;
|
||||
local_defined('toolbarset') ? self->toolbarset = #toolbarset;
|
||||
local_defined('initialvalue') ? self->initialvalue = #initialvalue;
|
||||
local_defined('basepath') ? self->basepath = #basepath;
|
||||
local_defined('config') ? self->config = #config;
|
||||
/define_tag;
|
||||
|
||||
define_tag('create');
|
||||
if(self->isCompatibleBrowser);
|
||||
local('out' = '
|
||||
<input type="hidden" id="' + self->instancename + '" name="' + self->instancename + '" value="' + encode_html(self->initialvalue) + '" style="display:none" />
|
||||
' + self->parseConfig + '
|
||||
<iframe id="' + self->instancename + '___Frame" src="' + self->basepath + 'editor/fckeditor.html?InstanceName=' + self->instancename + '&Toolbar=' + self->toolbarset + '" width="' + self->width + '" height="' + self->height + '" frameborder="0" scrolling="no"></iframe>
|
||||
');
|
||||
else;
|
||||
local('out' = '
|
||||
<textarea name="' + self->instancename + '" rows="4" cols="40" style="width: ' + self->width + '; height: ' + self->height + '">' + encode_html(self->initialvalue) + '</textarea>
|
||||
');
|
||||
/if;
|
||||
return(@#out);
|
||||
/define_tag;
|
||||
|
||||
define_tag('isCompatibleBrowser');
|
||||
local('result' = false);
|
||||
if (client_browser->Find("MSIE") && !client_browser->Find("mac") && !client_browser->Find("Opera"));
|
||||
#result = client_browser->Substring(client_browser->Find("MSIE")+5,3)>=5.5;
|
||||
/if;
|
||||
if (client_browser->Find("Gecko/"));
|
||||
#result = client_browser->Substring(client_browser->Find("Gecko/")+6,8)>=20030210;
|
||||
/if;
|
||||
if (client_browser->Find("Opera/"));
|
||||
#result = client_browser->Substring(client_browser->Find("Opera/")+6,4)>=9.5;
|
||||
/if;
|
||||
if (client_browser->Find("AppleWebKit/"));
|
||||
#result = client_browser->Substring(client_browser->Find("AppleWebKit/")+12,3)>=522;
|
||||
/if;
|
||||
return(#result);
|
||||
/define_tag;
|
||||
|
||||
define_tag('parseConfig');
|
||||
if(self->config->size);
|
||||
local('out' = '<input type="hidden" id="' + self->instancename + '___Config" value="');
|
||||
iterate(self->config, local('this'));
|
||||
loop_count > 1 ? #out += '&';
|
||||
#out += encode_html(#this->first) + '=' + encode_html(#this->second);
|
||||
/iterate;
|
||||
#out += '" style="display:none" />\n';
|
||||
return(@#out);
|
||||
/if;
|
||||
/define_tag;
|
||||
/define_type;
|
||||
]
|
@ -1,143 +0,0 @@
|
||||
#####
|
||||
# FCKeditor - The text editor for Internet - http://www.fckeditor.net
|
||||
# Copyright (C) 2003-2009 Frederico Caldeira Knabben
|
||||
#
|
||||
# == BEGIN LICENSE ==
|
||||
#
|
||||
# Licensed under the terms of any of the following licenses at your
|
||||
# choice:
|
||||
#
|
||||
# - GNU General Public License Version 2 or later (the "GPL")
|
||||
# http://www.gnu.org/licenses/gpl.html
|
||||
#
|
||||
# - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
|
||||
# http://www.gnu.org/licenses/lgpl.html
|
||||
#
|
||||
# - Mozilla Public License Version 1.1 or later (the "MPL")
|
||||
# http://www.mozilla.org/MPL/MPL-1.1.html
|
||||
#
|
||||
# == END LICENSE ==
|
||||
#
|
||||
# This is the integration file for Perl.
|
||||
#####
|
||||
|
||||
#my $InstanceName;
|
||||
#my $BasePath;
|
||||
#my $Width;
|
||||
#my $Height;
|
||||
#my $ToolbarSet;
|
||||
#my $Value;
|
||||
#my %Config;
|
||||
|
||||
sub FCKeditor
|
||||
{
|
||||
|
||||
local($instanceName) = @_;
|
||||
$InstanceName = $instanceName;
|
||||
$BasePath = '/fckeditor/';
|
||||
$Width = '100%';
|
||||
$Height = '200';
|
||||
$ToolbarSet = 'Default';
|
||||
$Value = '';
|
||||
}
|
||||
|
||||
sub Create
|
||||
{
|
||||
print &CreateHtml();
|
||||
}
|
||||
|
||||
sub specialchar_cnv
|
||||
{
|
||||
|
||||
local($ch) = @_;
|
||||
|
||||
$ch =~ s/&/&/g; # &
|
||||
$ch =~ s/\"/"/g; #"
|
||||
$ch =~ s/\'/'/g; # '
|
||||
$ch =~ s/</</g; # <
|
||||
$ch =~ s/>/>/g; # >
|
||||
return($ch);
|
||||
}
|
||||
|
||||
sub CreateHtml
|
||||
{
|
||||
|
||||
$HtmlValue = &specialchar_cnv($Value);
|
||||
$Html = '' ;
|
||||
if(&IsCompatible()) {
|
||||
$Link = $BasePath . "editor/fckeditor.html?InstanceName=$InstanceName";
|
||||
if($ToolbarSet ne '') {
|
||||
$Link .= "&Toolbar=$ToolbarSet";
|
||||
}
|
||||
#// Render the linked hidden field.
|
||||
$Html .= "<input type=\"hidden\" id=\"$InstanceName\" name=\"$InstanceName\" value=\"$HtmlValue\" style=\"display:none\" />" ;
|
||||
|
||||
#// Render the configurations hidden field.
|
||||
$cfgstr = &GetConfigFieldString();
|
||||
$wk = $InstanceName."___Config";
|
||||
$Html .= "<input type=\"hidden\" id=\"$wk\" value=\"$cfgstr\" style=\"display:none\" />" ;
|
||||
|
||||
#// Render the editor IFRAME.
|
||||
$wk = $InstanceName."___Frame";
|
||||
$Html .= "<iframe id=\"$wk\" src=\"$Link\" width=\"$Width\" height=\"$Height\" frameborder=\"0\" scrolling=\"no\"></iframe>";
|
||||
} else {
|
||||
if($Width =~ /\%/g){
|
||||
$WidthCSS = $Width;
|
||||
} else {
|
||||
$WidthCSS = $Width . 'px';
|
||||
}
|
||||
if($Height =~ /\%/g){
|
||||
$HeightCSS = $Height;
|
||||
} else {
|
||||
$HeightCSS = $Height . 'px';
|
||||
}
|
||||
$Html .= "<textarea name=\"$InstanceName\" rows=\"4\" cols=\"40\" style=\"width: $WidthCSS; height: $HeightCSS\">$HtmlValue</textarea>";
|
||||
}
|
||||
return($Html);
|
||||
}
|
||||
|
||||
sub IsCompatible
|
||||
{
|
||||
|
||||
$sAgent = $ENV{'HTTP_USER_AGENT'};
|
||||
if(($sAgent =~ /MSIE/i) && !($sAgent =~ /mac/i) && !($sAgent =~ /Opera/i)) {
|
||||
$iVersion = substr($sAgent,index($sAgent,'MSIE') + 5,3);
|
||||
return($iVersion >= 5.5) ;
|
||||
} elsif($sAgent =~ /Gecko\//i) {
|
||||
$iVersion = substr($sAgent,index($sAgent,'Gecko/') + 6,8);
|
||||
return($iVersion >= 20030210) ;
|
||||
} elsif($sAgent =~ /Opera\//i) {
|
||||
$iVersion = substr($sAgent,index($sAgent,'Opera/') + 6,4);
|
||||
return($iVersion >= 9.5) ;
|
||||
} elsif($sAgent =~ /AppleWebKit\/(\d+)/i) {
|
||||
return($1 >= 522) ;
|
||||
} else {
|
||||
return(0); # 2.0 PR fix
|
||||
}
|
||||
}
|
||||
|
||||
sub GetConfigFieldString
|
||||
{
|
||||
$sParams = '';
|
||||
$bFirst = 0;
|
||||
foreach $sKey (keys %Config) {
|
||||
$sValue = $Config{$sKey};
|
||||
if($bFirst == 1) {
|
||||
$sParams .= '&';
|
||||
} else {
|
||||
$bFirst = 1;
|
||||
}
|
||||
$k = &specialchar_cnv($sKey);
|
||||
$v = &specialchar_cnv($sValue);
|
||||
if($sValue eq "true") {
|
||||
$sParams .= "$k=true";
|
||||
} elsif($sValue eq "false") {
|
||||
$sParams .= "$k=false";
|
||||
} else {
|
||||
$sParams .= "$k=$v";
|
||||
}
|
||||
}
|
||||
return($sParams);
|
||||
}
|
||||
|
||||
1;
|
@ -1,160 +0,0 @@
|
||||
"""
|
||||
FCKeditor - The text editor for Internet - http://www.fckeditor.net
|
||||
Copyright (C) 2003-2009 Frederico Caldeira Knabben
|
||||
|
||||
== BEGIN LICENSE ==
|
||||
|
||||
Licensed under the terms of any of the following licenses at your
|
||||
choice:
|
||||
|
||||
- GNU General Public License Version 2 or later (the "GPL")
|
||||
http://www.gnu.org/licenses/gpl.html
|
||||
|
||||
- GNU Lesser General Public License Version 2.1 or later (the "LGPL")
|
||||
http://www.gnu.org/licenses/lgpl.html
|
||||
|
||||
- Mozilla Public License Version 1.1 or later (the "MPL")
|
||||
http://www.mozilla.org/MPL/MPL-1.1.html
|
||||
|
||||
== END LICENSE ==
|
||||
|
||||
This is the integration file for Python.
|
||||
"""
|
||||
|
||||
import cgi
|
||||
import os
|
||||
import re
|
||||
import string
|
||||
|
||||
def escape(text, replace=string.replace):
|
||||
"""Converts the special characters '<', '>', and '&'.
|
||||
|
||||
RFC 1866 specifies that these characters be represented
|
||||
in HTML as < > and & respectively. In Python
|
||||
1.5 we use the new string.replace() function for speed.
|
||||
"""
|
||||
text = replace(text, '&', '&') # must be done 1st
|
||||
text = replace(text, '<', '<')
|
||||
text = replace(text, '>', '>')
|
||||
text = replace(text, '"', '"')
|
||||
text = replace(text, "'", ''')
|
||||
return text
|
||||
|
||||
# The FCKeditor class
|
||||
class FCKeditor(object):
|
||||
def __init__(self, instanceName):
|
||||
self.InstanceName = instanceName
|
||||
self.BasePath = '/fckeditor/'
|
||||
self.Width = '100%'
|
||||
self.Height = '200'
|
||||
self.ToolbarSet = 'Default'
|
||||
self.Value = '';
|
||||
|
||||
self.Config = {}
|
||||
|
||||
def Create(self):
|
||||
return self.CreateHtml()
|
||||
|
||||
def CreateHtml(self):
|
||||
HtmlValue = escape(self.Value)
|
||||
Html = ""
|
||||
|
||||
if (self.IsCompatible()):
|
||||
File = "fckeditor.html"
|
||||
Link = "%seditor/%s?InstanceName=%s" % (
|
||||
self.BasePath,
|
||||
File,
|
||||
self.InstanceName
|
||||
)
|
||||
if (self.ToolbarSet is not None):
|
||||
Link += "&Toolbar=%s" % self.ToolbarSet
|
||||
|
||||
# Render the linked hidden field
|
||||
Html += "<input type=\"hidden\" id=\"%s\" name=\"%s\" value=\"%s\" style=\"display:none\" />" % (
|
||||
self.InstanceName,
|
||||
self.InstanceName,
|
||||
HtmlValue
|
||||
)
|
||||
|
||||
# Render the configurations hidden field
|
||||
Html += "<input type=\"hidden\" id=\"%s___Config\" value=\"%s\" style=\"display:none\" />" % (
|
||||
self.InstanceName,
|
||||
self.GetConfigFieldString()
|
||||
)
|
||||
|
||||
# Render the editor iframe
|
||||
Html += "<iframe id=\"%s\__Frame\" src=\"%s\" width=\"%s\" height=\"%s\" frameborder=\"0\" scrolling=\"no\"></iframe>" % (
|
||||
self.InstanceName,
|
||||
Link,
|
||||
self.Width,
|
||||
self.Height
|
||||
)
|
||||
else:
|
||||
if (self.Width.find("%%") < 0):
|
||||
WidthCSS = "%spx" % self.Width
|
||||
else:
|
||||
WidthCSS = self.Width
|
||||
if (self.Height.find("%%") < 0):
|
||||
HeightCSS = "%spx" % self.Height
|
||||
else:
|
||||
HeightCSS = self.Height
|
||||
|
||||
Html += "<textarea name=\"%s\" rows=\"4\" cols=\"40\" style=\"width: %s; height: %s;\" wrap=\"virtual\">%s</textarea>" % (
|
||||
self.InstanceName,
|
||||
WidthCSS,
|
||||
HeightCSS,
|
||||
HtmlValue
|
||||
)
|
||||
return Html
|
||||
|
||||
def IsCompatible(self):
|
||||
if (os.environ.has_key("HTTP_USER_AGENT")):
|
||||
sAgent = os.environ.get("HTTP_USER_AGENT", "")
|
||||
else:
|
||||
sAgent = ""
|
||||
if (sAgent.find("MSIE") >= 0) and (sAgent.find("mac") < 0) and (sAgent.find("Opera") < 0):
|
||||
i = sAgent.find("MSIE")
|
||||
iVersion = float(sAgent[i+5:i+5+3])
|
||||
if (iVersion >= 5.5):
|
||||
return True
|
||||
return False
|
||||
elif (sAgent.find("Gecko/") >= 0):
|
||||
i = sAgent.find("Gecko/")
|
||||
iVersion = int(sAgent[i+6:i+6+8])
|
||||
if (iVersion >= 20030210):
|
||||
return True
|
||||
return False
|
||||
elif (sAgent.find("Opera/") >= 0):
|
||||
i = sAgent.find("Opera/")
|
||||
iVersion = float(sAgent[i+6:i+6+4])
|
||||
if (iVersion >= 9.5):
|
||||
return True
|
||||
return False
|
||||
elif (sAgent.find("AppleWebKit/") >= 0):
|
||||
p = re.compile('AppleWebKit\/(\d+)', re.IGNORECASE)
|
||||
m = p.search(sAgent)
|
||||
if (m.group(1) >= 522):
|
||||
return True
|
||||
return False
|
||||
else:
|
||||
return False
|
||||
|
||||
def GetConfigFieldString(self):
|
||||
sParams = ""
|
||||
bFirst = True
|
||||
for sKey in self.Config.keys():
|
||||
sValue = self.Config[sKey]
|
||||
if (not bFirst):
|
||||
sParams += "&"
|
||||
else:
|
||||
bFirst = False
|
||||
if (sValue):
|
||||
k = escape(sKey)
|
||||
v = escape(sValue)
|
||||
if (sValue == "true"):
|
||||
sParams += "%s=true" % k
|
||||
elif (sValue == "false"):
|
||||
sParams += "%s=false" % k
|
||||
else:
|
||||
sParams += "%s=%s" % (k, v)
|
||||
return sParams
|
Loading…
Reference in New Issue
Block a user