removed not used non-php server-scripts

This commit is contained in:
Ralf Becker 2010-03-07 10:29:41 +00:00
parent 4306e0305b
commit 01c56eea9e
10 changed files with 0 additions and 1603 deletions

View File

@ -1,148 +0,0 @@
<cfsetting enablecfoutputonly="true">
<!---
This code uses a CF User Defined Function and should work in CF version 5.0
and up without alteration.
Also if you are hosting your site at an ISP, you will have to check with them
to see if the use of <CFEXECUTE> is allowed. In most cases ISP will not allow
the use of that tag for security reasons. Clients would be able to access each
others files in certain cases.
--->
<!--- The following variables values must reflect your installation. --->
<cfset aspell_dir = "C:\Program Files\Aspell\bin">
<cfset lang = "en_US">
<cfset aspell_opts = "-a --lang=#lang# --encoding=utf-8 -H --rem-sgml-check=alt">
<cfset tempfile_in = GetTempFile(GetTempDirectory(), "spell_")>
<cfset tempfile_out = GetTempFile(GetTempDirectory(), "spell_")>
<cfset spellercss = "../spellerStyle.css">
<cfset word_win_src = "../wordWindow.js">
<cfset form.checktext = form["textinputs[]"]>
<!--- make no difference between URL and FORM scopes --->
<cfparam name="url.checktext" default="">
<cfparam name="form.checktext" default="#url.checktext#">
<!--- Takes care of those pesky smart quotes from MS apps, replaces them with regular quotes --->
<cfset submitted_text = ReplaceList(form.checktext,"%u201C,%u201D","%22,%22")>
<!--- submitted_text now is ready for processing --->
<!--- use carat on each line to escape possible aspell commands --->
<cfset text = "">
<cfset CRLF = Chr(13) & Chr(10)>
<cfloop list="#submitted_text#" index="field" delimiters=",">
<cfset text = text & "%" & CRLF
& "^A" & CRLF
& "!" & CRLF>
<!--- Strip all tags for the text. (by FredCK - #339 / #681) --->
<cfset field = REReplace(URLDecode(field), "<[^>]+>", " ", "all")>
<cfloop list="#field#" index="line" delimiters="#CRLF#">
<cfset text = ListAppend(text, "^" & Trim(JSStringFormat(line)), CRLF)>
</cfloop>
</cfloop>
<!--- create temp file from the submitted text, this will be passed to aspell to be check for misspelled words --->
<cffile action="write" file="#tempfile_in#" output="#text#" charset="utf-8">
<!--- execute aspell in an UTF-8 console and redirect output to a file. UTF-8 encoding is lost if done differently --->
<cfexecute name="cmd.exe" arguments='/c type "#tempfile_in#" | "#aspell_dir#\aspell.exe" #aspell_opts# > "#tempfile_out#"' timeout="100"/>
<!--- read output file for further processing --->
<cffile action="read" file="#tempfile_out#" variable="food" charset="utf-8">
<!--- remove temp files --->
<cffile action="delete" file="#tempfile_in#">
<cffile action="delete" file="#tempfile_out#">
<cfset texts = StructNew()>
<cfset texts.textinputs = "">
<cfset texts.words = "">
<cfset texts.abort = "">
<!--- Generate Text Inputs --->
<cfset i = 0>
<cfloop list="#submitted_text#" index="textinput">
<cfset texts.textinputs = ListAppend(texts.textinputs, 'textinputs[#i#] = decodeURIComponent("#textinput#");', CRLF)>
<cfset i = i + 1>
</cfloop>
<!--- Generate Words Lists --->
<cfset word_cnt = 0>
<cfset input_cnt = -1>
<cfloop list="#food#" index="aspell_line" delimiters="#CRLF#">
<cfset leftChar = Left(aspell_line, 1)>
<cfif leftChar eq "*">
<cfset input_cnt = input_cnt + 1>
<cfset word_cnt = 0>
<cfset texts.words = ListAppend(texts.words, "words[#input_cnt#] = [];", CRLF)>
<cfset texts.words = ListAppend(texts.words, "suggs[#input_cnt#] = [];", CRLF)>
<cfelse>
<cfif leftChar eq "&" or leftChar eq "##">
<!--- word that misspelled --->
<cfset bad_word = Trim(ListGetAt(aspell_line, 2, " "))>
<cfset bad_word = Replace(bad_word, "'", "\'", "ALL")>
<!--- sugestions --->
<cfset sug_list = Trim(ListRest(aspell_line, ":"))>
<cfset sug_list = ListQualify(Replace(sug_list, "'", "\'", "ALL"), "'")>
<!--- javascript --->
<cfset texts.words = ListAppend(texts.words, "words[#input_cnt#][#word_cnt#] = '#bad_word#';", CRLF)>
<cfset texts.words = ListAppend(texts.words, "suggs[#input_cnt#][#word_cnt#] = [#sug_list#];", CRLF)>
<cfset word_cnt = word_cnt + 1>
</cfif>
</cfif>
</cfloop>
<cfif texts.words eq "">
<cfset texts.abort = "alert('Spell check complete.\n\nNo misspellings found.'); top.window.close();">
</cfif>
<cfcontent type="text/html; charset=utf-8">
<cfoutput><html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" type="text/css" href="#spellercss#" />
<script language="javascript" src="#word_win_src#"></script>
<script language="javascript">
var suggs = new Array();
var words = new Array();
var textinputs = new Array();
var error;
#texts.textinputs##CRLF#
#texts.words#
#texts.abort#
var wordWindowObj = new wordWindow();
wordWindowObj.originalSpellings = words;
wordWindowObj.suggestions = suggs;
wordWindowObj.textInputs = textinputs;
function init_spell() {
// check if any error occured during server-side processing
if( error ) {
alert( error );
} else {
// call the init_spell() function in the parent frameset
if (parent.frames.length) {
parent.init_spell( wordWindowObj );
} else {
alert('This page was loaded outside of a frameset. It might not display properly');
}
}
}
</script>
</head>
<body onLoad="init_spell();">
<script type="text/javascript">
wordWindowObj.writeBody();
</script>
</body>
</html></cfoutput>
<cfsetting enablecfoutputonly="false">

View File

@ -1,181 +0,0 @@
#!/usr/bin/perl
use CGI qw/ :standard /;
use File::Temp qw/ tempfile tempdir /;
# my $spellercss = '/speller/spellerStyle.css'; # by FredCK
my $spellercss = '../spellerStyle.css'; # by FredCK
# my $wordWindowSrc = '/speller/wordWindow.js'; # by FredCK
my $wordWindowSrc = '../wordWindow.js'; # by FredCK
my @textinputs = param( 'textinputs[]' ); # array
# my $aspell_cmd = 'aspell'; # by FredCK (for Linux)
my $aspell_cmd = '"C:\Program Files\Aspell\bin\aspell.exe"'; # by FredCK (for Windows)
my $lang = 'en_US';
# my $aspell_opts = "-a --lang=$lang --encoding=utf-8"; # by FredCK
my $aspell_opts = "-a --lang=$lang --encoding=utf-8 -H --rem-sgml-check=alt"; # by FredCK
my $input_separator = "A";
# set the 'wordtext' JavaScript variable to the submitted text.
sub printTextVar {
for( my $i = 0; $i <= $#textinputs; $i++ ) {
print "textinputs[$i] = decodeURIComponent('" . escapeQuote( $textinputs[$i] ) . "')\n";
}
}
sub printTextIdxDecl {
my $idx = shift;
print "words[$idx] = [];\n";
print "suggs[$idx] = [];\n";
}
sub printWordsElem {
my( $textIdx, $wordIdx, $word ) = @_;
print "words[$textIdx][$wordIdx] = '" . escapeQuote( $word ) . "';\n";
}
sub printSuggsElem {
my( $textIdx, $wordIdx, @suggs ) = @_;
print "suggs[$textIdx][$wordIdx] = [";
for my $i ( 0..$#suggs ) {
print "'" . escapeQuote( $suggs[$i] ) . "'";
if( $i < $#suggs ) {
print ", ";
}
}
print "];\n";
}
sub printCheckerResults {
my $textInputIdx = -1;
my $wordIdx = 0;
my $unhandledText;
# create temp file
my $dir = tempdir( CLEANUP => 1 );
my( $fh, $tmpfilename ) = tempfile( DIR => $dir );
# temp file was created properly?
# open temp file, add the submitted text.
for( my $i = 0; $i <= $#textinputs; $i++ ) {
$text = url_decode( $textinputs[$i] );
# Strip all tags for the text. (by FredCK - #339 / #681)
$text =~ s/<[^>]+>/ /g;
@lines = split( /\n/, $text );
print $fh "\%\n"; # exit terse mode
print $fh "^$input_separator\n";
print $fh "!\n"; # enter terse mode
for my $line ( @lines ) {
# use carat on each line to escape possible aspell commands
print $fh "^$line\n";
}
}
# exec aspell command
my $cmd = "$aspell_cmd $aspell_opts < $tmpfilename 2>&1";
open ASPELL, "$cmd |" or handleError( "Could not execute `$cmd`\\n$!" ) and return;
# parse each line of aspell return
for my $ret ( <ASPELL> ) {
chomp( $ret );
# if '&', then not in dictionary but has suggestions
# if '#', then not in dictionary and no suggestions
# if '*', then it is a delimiter between text inputs
if( $ret =~ /^\*/ ) {
$textInputIdx++;
printTextIdxDecl( $textInputIdx );
$wordIdx = 0;
} elsif( $ret =~ /^(&|#)/ ) {
my @tokens = split( " ", $ret, 5 );
printWordsElem( $textInputIdx, $wordIdx, $tokens[1] );
my @suggs = ();
if( $tokens[4] ) {
@suggs = split( ", ", $tokens[4] );
}
printSuggsElem( $textInputIdx, $wordIdx, @suggs );
$wordIdx++;
} else {
$unhandledText .= $ret;
}
}
close ASPELL or handleError( "Error executing `$cmd`\\n$unhandledText" ) and return;
}
sub escapeQuote {
my $str = shift;
$str =~ s/'/\\'/g;
return $str;
}
sub handleError {
my $err = shift;
print "error = '" . escapeQuote( $err ) . "';\n";
}
sub url_decode {
local $_ = @_ ? shift : $_;
defined or return;
# change + signs to spaces
tr/+/ /;
# change hex escapes to the proper characters
s/%([a-fA-F0-9]{2})/pack "H2", $1/eg;
return $_;
}
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# Display HTML
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
print <<EOF;
Content-type: text/html; charset=utf-8
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" type="text/css" href="$spellercss"/>
<script src="$wordWindowSrc"></script>
<script type="text/javascript">
var suggs = new Array();
var words = new Array();
var textinputs = new Array();
var error;
EOF
printTextVar();
printCheckerResults();
print <<EOF;
var wordWindowObj = new wordWindow();
wordWindowObj.originalSpellings = words;
wordWindowObj.suggestions = suggs;
wordWindowObj.textInputs = textinputs;
function init_spell() {
// check if any error occured during server-side processing
if( error ) {
alert( error );
} else {
// call the init_spell() function in the parent frameset
if (parent.frames.length) {
parent.init_spell( wordWindowObj );
} else {
error = "This page was loaded outside of a frameset. ";
error += "It might not display properly";
alert( error );
}
}
}
</script>
</head>
<body onLoad="init_spell();">
<script type="text/javascript">
wordWindowObj.writeBody();
</script>
</body>
</html>
EOF

View File

@ -1,159 +0,0 @@
<%
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
* Copyright (C) 2003-2008 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
%>

View File

@ -1,235 +0,0 @@
<!--
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
* Copyright (C) 2003-2008 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 + "&amp;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 & "&amp;"
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
%>

View File

@ -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-2008 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 & "&amp;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 & "&amp;";
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>

View File

@ -1,159 +0,0 @@
<cfsetting enablecfoutputonly="Yes">
<!---
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
* Copyright (C) 2003-2008 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 & "&amp;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 & "&amp;";
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">

View File

@ -1,108 +0,0 @@
[//lasso
/*
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
* Copyright (C) 2003-2008 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 += '&amp;';
#out += encode_html(#this->first) + '=' + encode_html(#this->second);
/iterate;
#out += '" style="display:none" />\n';
return(@#out);
/if;
/define_tag;
/define_type;
]

View File

@ -1,143 +0,0 @@
#####
# FCKeditor - The text editor for Internet - http://www.fckeditor.net
# Copyright (C) 2003-2008 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/&/&amp;/g; # &
$ch =~ s/\"/&quot;/g; #"
$ch =~ s/\'/&#39;/g; # '
$ch =~ s/</&lt;/g; # <
$ch =~ s/>/&gt;/g; # >
return($ch);
}
sub CreateHtml
{
$HtmlValue = &specialchar_cnv($Value);
$Html = '' ;
if(&IsCompatible()) {
$Link = $BasePath . "editor/fckeditor.html?InstanceName=$InstanceName";
if($ToolbarSet ne '') {
$Link .= "&amp;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 .= '&amp;';
} 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;

View File

@ -1,160 +0,0 @@
"""
FCKeditor - The text editor for Internet - http://www.fckeditor.net
Copyright (C) 2003-2008 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 &lt; &gt; and &amp; respectively. In Python
1.5 we use the new string.replace() function for speed.
"""
text = replace(text, '&', '&amp;') # must be done 1st
text = replace(text, '<', '&lt;')
text = replace(text, '>', '&gt;')
text = replace(text, '"', '&quot;')
text = replace(text, "'", '&#39;')
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 += "&amp;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 += "&amp;"
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

View File

@ -1,78 +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 ==
*
* ColdFusion integration.
* This function is used by FCKeditor module to check browser compatibility
--->
<cfscript>
function FCKeditor_IsCompatibleBrowser()
{
sAgent = lCase( cgi.HTTP_USER_AGENT );
isCompatibleBrowser = false;
// check for Internet Explorer ( >= 5.5 )
if( find( "msie", sAgent ) and not find( "mac", sAgent ) and not find( "opera", sAgent ) )
{
// try to extract IE version
stResult = reFind( "msie ([5-9]\.[0-9])", sAgent, 1, true );
if( arrayLen( stResult.pos ) eq 2 )
{
// get IE Version
sBrowserVersion = mid( sAgent, stResult.pos[2], stResult.len[2] );
if( sBrowserVersion GTE 5.5 )
isCompatibleBrowser = true;
}
}
// check for Gecko ( >= 20030210+ )
else if( find( "gecko/", sAgent ) )
{
// try to extract Gecko version date
stResult = reFind( "gecko/(200[3-9][0-1][0-9][0-3][0-9])", sAgent, 1, true );
if( arrayLen( stResult.pos ) eq 2 )
{
// get Gecko build (i18n date)
sBrowserVersion = mid( sAgent, stResult.pos[2], stResult.len[2] );
if( sBrowserVersion GTE 20030210 )
isCompatibleBrowser = true;
}
}
else if( find( "opera/", sAgent ) )
{
// try to extract Opera version
stResult = reFind( "opera/([0-9]+\.[0-9]+)", sAgent, 1, true );
if( arrayLen( stResult.pos ) eq 2 )
{
if ( mid( sAgent, stResult.pos[2], stResult.len[2] ) gte 9.5)
isCompatibleBrowser = true;
}
}
else if( find( "applewebkit", sAgent ) )
{
// try to extract Gecko version date
stResult = reFind( "applewebkit/([0-9]+)", sAgent, 1, true );
if( arrayLen( stResult.pos ) eq 2 )
{
if( mid( sAgent, stResult.pos[2], stResult.len[2] ) gte 522 )
isCompatibleBrowser = true;
}
}
return isCompatibleBrowser;
}
</cfscript>