[freeside-commits] freeside/httemplate/elements/fckeditor fckconfig.js, NONE, 1.1.2.2 fckeditor.js, NONE, 1.1.2.2 fckeditor.pl, NONE, 1.1.2.1 fckpackager.xml, NONE, 1.1.2.2 fckstyles.xml, NONE, 1.1.2.2 fcktemplates.xml, NONE, 1.1.2.2

Ivan,,, ivan at wavetail.420.am
Mon Jun 16 20:57:47 PDT 2008


Update of /home/cvs/cvsroot/freeside/httemplate/elements/fckeditor
In directory wavetail.420.am:/tmp/cvs-serv697/fckeditor

Added Files:
      Tag: FREESIDE_1_7_BRANCH
	fckconfig.js fckeditor.js fckeditor.pl fckpackager.xml 
	fckstyles.xml fcktemplates.xml 
Log Message:
adding fckeditor on _17_BRANCH, for customer notices

--- NEW FILE: fckstyles.xml ---
<?xml version="1.0" encoding="utf-8" ?>
<!--
 * FCKeditor - The text editor for Internet - http://www.fckeditor.net
 * Copyright (C) 2003-2007 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 sample style definitions file. It makes the styles combo
 * completely customizable.
 *
 * See FCKConfig.StylesXmlPath in the configuration file.
-->
<Styles>
	<Style name="Image on Left" element="img">
		<Attribute name="style" value="padding: 5px; margin-right: 5px" />
		<Attribute name="border" value="2" />
		<Attribute name="align" value="left" />
	</Style>
	<Style name="Image on Right" element="img">
		<Attribute name="style" value="padding: 5px; margin-left: 5px" />
		<Attribute name="border" value="2" />
		<Attribute name="align" value="right" />
	</Style>
	<Style name="Custom Bold" element="span">
		<Attribute name="style" value="font-weight: bold;" />
	</Style>
	<Style name="Custom Italic" element="em" />
	<Style name="Title" element="span">
		<Attribute name="class" value="Title" />
	</Style>
	<Style name="Code" element="span">
		<Attribute name="class" value="Code" />
	</Style>
	<Style name="Title H3" element="h3" />
	<Style name="Custom Ruler" element="hr">
		<Attribute name="size" value="1" />
		<Attribute name="color" value="#ff0000" />
	</Style>
</Styles>
--- NEW FILE: fckconfig.js ---
(This appears to be a binary file; contents omitted.)

--- NEW FILE: fckeditor.js ---
/*
 * FCKeditor - The text editor for Internet - http://www.fckeditor.net
 * Copyright (C) 2003-2007 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 JavaScript.
 *
 * It defines the FCKeditor class that can be used to create editor
 * instances in a HTML page in the client side. For server side
 * operations, use the specific integration system.
 */

// FCKeditor Class
var FCKeditor = function( instanceName, width, height, toolbarSet, value )
{
	// Properties
	this.InstanceName	= instanceName ;
	this.Width			= width			|| '100%' ;
	this.Height			= height		|| '200' ;
	this.ToolbarSet		= toolbarSet	|| 'Default' ;
	this.Value			= value			|| '' ;
	this.BasePath		= '/fckeditor/' ;
	this.CheckBrowser	= true ;
	this.DisplayErrors	= true ;
	this.EnableSafari	= false ;		// This is a temporary property, while Safari support is under development.
	this.EnableOpera	= false ;		// This is a temporary property, while Opera support is under development.

	this.Config			= new Object() ;

	// Events
	this.OnError		= null ;	// function( source, errorNumber, errorDescription )
}

FCKeditor.prototype.Version			= '2.4.3' ;
FCKeditor.prototype.VersionBuild	= '15657' ;

FCKeditor.prototype.Create = function()
{
	document.write( this.CreateHtml() ) ;
}

FCKeditor.prototype.CreateHtml = function()
{
	// Check for errors
	if ( !this.InstanceName || this.InstanceName.length == 0 )
	{
		this._ThrowError( 701, 'You must specify an instance name.' ) ;
		return '' ;
	}

	var sHtml = '<div>' ;

	if ( !this.CheckBrowser || this._IsCompatibleBrowser() )
	{
		sHtml += '<input type="hidden" id="' + this.InstanceName + '" name="' + this.InstanceName + '" value="' + this._HTMLEncode( this.Value ) + '" style="display:none" />' ;
		sHtml += this._GetConfigHtml() ;
		sHtml += this._GetIFrameHtml() ;
	}
	else
	{
		var sWidth  = this.Width.toString().indexOf('%')  > 0 ? this.Width  : this.Width  + 'px' ;
		var sHeight = this.Height.toString().indexOf('%') > 0 ? this.Height : this.Height + 'px' ;
		sHtml += '<textarea name="' + this.InstanceName + '" rows="4" cols="40" style="width:' + sWidth + ';height:' + sHeight + '">' + this._HTMLEncode( this.Value ) + '<\/textarea>' ;
	}

	sHtml += '</div>' ;

	return sHtml ;
}

FCKeditor.prototype.ReplaceTextarea = function()
{
	if ( !this.CheckBrowser || this._IsCompatibleBrowser() )
	{
		// We must check the elements firstly using the Id and then the name.
		var oTextarea = document.getElementById( this.InstanceName ) ;
		var colElementsByName = document.getElementsByName( this.InstanceName ) ;
		var i = 0;
		while ( oTextarea || i == 0 )
		{
			if ( oTextarea && oTextarea.tagName.toLowerCase() == 'textarea' )
				break ;
			oTextarea = colElementsByName[i++] ;
		}

		if ( !oTextarea )
		{
			alert( 'Error: The TEXTAREA with id or name set to "' + this.InstanceName + '" was not found' ) ;
			return ;
		}

		oTextarea.style.display = 'none' ;
		this._InsertHtmlBefore( this._GetConfigHtml(), oTextarea ) ;
		this._InsertHtmlBefore( this._GetIFrameHtml(), oTextarea ) ;
	}
}

FCKeditor.prototype._InsertHtmlBefore = function( html, element )
{
	if ( element.insertAdjacentHTML )	// IE
		element.insertAdjacentHTML( 'beforeBegin', html ) ;
	else								// Gecko
	{
		var oRange = document.createRange() ;
		oRange.setStartBefore( element ) ;
		var oFragment = oRange.createContextualFragment( html );
		element.parentNode.insertBefore( oFragment, element ) ;
	}
}

FCKeditor.prototype._GetConfigHtml = function()
{
	var sConfig = '' ;
	for ( var o in this.Config )
	{
		if ( sConfig.length > 0 ) sConfig += '&amp;' ;
		sConfig += encodeURIComponent( o ) + '=' + encodeURIComponent( this.Config[o] ) ;
	}

	return '<input type="hidden" id="' + this.InstanceName + '___Config" value="' + sConfig + '" style="display:none" />' ;
}

FCKeditor.prototype._GetIFrameHtml = function()
{
	var sFile = 'fckeditor.html' ;

	try
	{
		if ( (/fcksource=true/i).test( window.top.location.search ) )
			sFile = 'fckeditor.original.html' ;
	}
	catch (e) { /* Ignore it. Much probably we are inside a FRAME where the "top" is in another domain (security error). */ }

	var sLink = this.BasePath + 'editor/' + sFile + '?InstanceName=' + encodeURIComponent( this.InstanceName ) ;
	if (this.ToolbarSet) sLink += '&amp;Toolbar=' + this.ToolbarSet ;

	return '<iframe id="' + this.InstanceName + '___Frame" src="' + sLink + '" width="' + this.Width + '" height="' + this.Height + '" frameborder="0" scrolling="no"></iframe>' ;
}

FCKeditor.prototype._IsCompatibleBrowser = function()
{
	return FCKeditor_IsCompatibleBrowser( this.EnableSafari, this.EnableOpera ) ;
}

FCKeditor.prototype._ThrowError = function( errorNumber, errorDescription )
{
	this.ErrorNumber		= errorNumber ;
	this.ErrorDescription	= errorDescription ;

	if ( this.DisplayErrors )
	{
		document.write( '<div style="COLOR: #ff0000">' ) ;
		document.write( '[ FCKeditor Error ' + this.ErrorNumber + ': ' + this.ErrorDescription + ' ]' ) ;
		document.write( '</div>' ) ;
	}

	if ( typeof( this.OnError ) == 'function' )
		this.OnError( this, errorNumber, errorDescription ) ;
}

FCKeditor.prototype._HTMLEncode = function( text )
{
	if ( typeof( text ) != "string" )
		text = text.toString() ;

	text = text.replace(
		/&/g, "&amp;").replace(
		/"/g, "&quot;").replace(
		/</g, "&lt;").replace(
		/>/g, "&gt;") ;

	return text ;
}

function FCKeditor_IsCompatibleBrowser( enableSafari, enableOpera )
{
	var sAgent = navigator.userAgent.toLowerCase() ;

	// Internet Explorer
	if ( sAgent.indexOf("msie") != -1 && sAgent.indexOf("mac") == -1 && sAgent.indexOf("opera") == -1 )
	{
		var sBrowserVersion = navigator.appVersion.match(/MSIE (.\..)/)[1] ;
		return ( sBrowserVersion >= 5.5 ) ;
	}

	// Gecko (Opera 9 tries to behave like Gecko at this point).
	if ( navigator.product == "Gecko" && navigator.productSub >= 20030210 && !( typeof(opera) == 'object' && opera.postError ) )
		return true ;

	// Opera
	if ( enableOpera && sAgent.indexOf( 'opera' ) == 0 && parseInt( navigator.appVersion, 10 ) >= 9 )
			return true ;

	// Safari
	if ( enableSafari && sAgent.indexOf( 'safari' ) != -1 )
		return ( sAgent.match( /safari\/(\d+)/ )[1] >= 312 ) ;	// Build must be at least 312 (1.3)

	return false ;
}
--- NEW FILE: fckpackager.xml ---
<?xml version="1.0" encoding="utf-8" ?>
<!--
 * FCKeditor - The text editor for Internet - http://www.fckeditor.net
 * Copyright (C) 2003-2007 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 configuration file to be used with FCKpackager to generate the
 * compressed code files in the "js" folder.
 *
 * Please check http://www.fckeditor.net for more info.
-->
<Package>
	<Header><![CDATA[/*
 * FCKeditor - The text editor for Internet - http://www.fckeditor.net
 * Copyright (C) 2003-2007 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 file has been compressed for better performance. The original source
 * can be found at "editor/_source".
 */
]]></Header>
	<Constants removeDeclaration="false">
		<Constant name="FCK_STATUS_NOTLOADED" value="0" />
		<Constant name="FCK_STATUS_ACTIVE" value="1" />
		<Constant name="FCK_STATUS_COMPLETE" value="2" />
		<Constant name="FCK_TRISTATE_OFF" value="0" />
		<Constant name="FCK_TRISTATE_ON" value="1" />
		<Constant name="FCK_TRISTATE_DISABLED" value="-1" />
		<Constant name="FCK_UNKNOWN" value="-9" />
		<Constant name="FCK_TOOLBARITEM_ONLYICON" value="0" />
		<Constant name="FCK_TOOLBARITEM_ONLYTEXT" value="1" />
		<Constant name="FCK_TOOLBARITEM_ICONTEXT" value="2" />
		<Constant name="FCK_EDITMODE_WYSIWYG" value="0" />
		<Constant name="FCK_EDITMODE_SOURCE" value="1" />
	</Constants>
	<PackageFile path="editor/js/fckeditorcode_ie.js">
		<File path="editor/_source/fckconstants.js" />
		<File path="editor/_source/fckjscoreextensions.js" />
		<File path="editor/_source/classes/fckiecleanup.js" />
		<File path="editor/_source/internals/fckbrowserinfo.js" />
		<File path="editor/_source/internals/fckurlparams.js" />
		<File path="editor/_source/classes/fckevents.js" />
		<File path="editor/_source/internals/fck.js" />
		<File path="editor/_source/internals/fck_ie.js" />
		<File path="editor/_source/internals/fckconfig.js" />
		<File path="editor/_source/internals/fckdebug.js" />
		<File path="editor/_source/internals/fckdomtools.js" />
		<File path="editor/_source/internals/fcktools.js" />
		<File path="editor/_source/internals/fcktools_ie.js" />
		<File path="editor/_source/fckeditorapi.js" />
		<File path="editor/_source/classes/fckimagepreloader.js" />

		<File path="editor/_source/internals/fckregexlib.js" />
		<File path="editor/_source/internals/fcklistslib.js" />
		<File path="editor/_source/internals/fcklanguagemanager.js" />
		<File path="editor/_source/internals/fckxhtmlentities.js" />
		<File path="editor/_source/internals/fckxhtml.js" />
		<File path="editor/_source/internals/fckxhtml_ie.js" />
		<File path="editor/_source/internals/fckcodeformatter.js" />
		<File path="editor/_source/internals/fckundo_ie.js" />
		<File path="editor/_source/classes/fckeditingarea.js" />
		<File path="editor/_source/classes/fckkeystrokehandler.js" />

		<File path="editor/_source/internals/fcklisthandler.js" />
		<File path="editor/_source/classes/fckelementpath.js" />
		<File path="editor/_source/classes/fckdomrange.js" />
		<File path="editor/_source/classes/fckdomrange_ie.js" />
		<File path="editor/_source/classes/fckdocumentfragment_ie.js" />
		<File path="editor/_source/classes/fckw3crange.js" />
		<File path="editor/_source/classes/fckenterkey.js" />

		<File path="editor/_source/internals/fckdocumentprocessor.js" />
		<File path="editor/_source/internals/fckselection.js" />
		<File path="editor/_source/internals/fckselection_ie.js" />

		<File path="editor/_source/internals/fcktablehandler.js" />
		<File path="editor/_source/internals/fcktablehandler_ie.js" />
		<File path="editor/_source/classes/fckxml_ie.js" />
		<File path="editor/_source/classes/fckstyledef.js" />
		<File path="editor/_source/classes/fckstyledef_ie.js" />
		<File path="editor/_source/classes/fckstylesloader.js" />

		<File path="editor/_source/commandclasses/fcknamedcommand.js" />
		<File path="editor/_source/commandclasses/fck_othercommands.js" />
		<File path="editor/_source/commandclasses/fckspellcheckcommand_ie.js" />
		<File path="editor/_source/commandclasses/fcktextcolorcommand.js" />
		<File path="editor/_source/commandclasses/fckpasteplaintextcommand.js" />
		<File path="editor/_source/commandclasses/fckpastewordcommand.js" />
		<File path="editor/_source/commandclasses/fcktablecommand.js" />
		<File path="editor/_source/commandclasses/fckstylecommand.js" />
		<File path="editor/_source/commandclasses/fckfitwindow.js" />
		<File path="editor/_source/internals/fckcommands.js" />

		<File path="editor/_source/classes/fckpanel.js" />
		<File path="editor/_source/classes/fckicon.js" />
		<File path="editor/_source/classes/fcktoolbarbuttonui.js" />
		<File path="editor/_source/classes/fcktoolbarbutton.js" />
		<File path="editor/_source/classes/fckspecialcombo.js" />
		<File path="editor/_source/classes/fcktoolbarspecialcombo.js" />
		<File path="editor/_source/classes/fcktoolbarfontscombo.js" />
		<File path="editor/_source/classes/fcktoolbarfontsizecombo.js" />
		<File path="editor/_source/classes/fcktoolbarfontformatcombo.js" />
		<File path="editor/_source/classes/fcktoolbarstylecombo.js" />
		<File path="editor/_source/classes/fcktoolbarpanelbutton.js" />
		<File path="editor/_source/internals/fcktoolbaritems.js" />
		<File path="editor/_source/classes/fcktoolbar.js" />
		<File path="editor/_source/classes/fcktoolbarbreak_ie.js" />
		<File path="editor/_source/internals/fcktoolbarset.js" />
		<File path="editor/_source/internals/fckdialog.js" />
		<File path="editor/_source/internals/fckdialog_ie.js" />

		<File path="editor/_source/classes/fckmenuitem.js" />
		<File path="editor/_source/classes/fckmenublock.js" />
		<File path="editor/_source/classes/fckmenublockpanel.js" />
		<File path="editor/_source/classes/fckcontextmenu.js" />
		<File path="editor/_source/internals/fck_contextmenu.js" />

		<File path="editor/_source/classes/fckplugin.js" />
		<File path="editor/_source/internals/fckplugins.js" />
	</PackageFile>

	<PackageFile path="editor/js/fckeditorcode_gecko.js">
		<File path="editor/_source/fckconstants.js" />
		<File path="editor/_source/fckjscoreextensions.js" />
		<File path="editor/_source/internals/fckbrowserinfo.js" />
		<File path="editor/_source/internals/fckurlparams.js" />
		<File path="editor/_source/classes/fckevents.js" />
		<File path="editor/_source/internals/fck.js" />
		<File path="editor/_source/internals/fck_gecko.js" />
		<File path="editor/_source/internals/fckconfig.js" />
		<File path="editor/_source/internals/fckdebug.js" />
		<File path="editor/_source/internals/fckdomtools.js" />
		<File path="editor/_source/internals/fcktools.js" />
		<File path="editor/_source/internals/fcktools_gecko.js" />
		<File path="editor/_source/fckeditorapi.js" />
		<File path="editor/_source/classes/fckimagepreloader.js" />

		<File path="editor/_source/internals/fckregexlib.js" />
		<File path="editor/_source/internals/fcklistslib.js" />
		<File path="editor/_source/internals/fcklanguagemanager.js" />
		<File path="editor/_source/internals/fckxhtmlentities.js" />
		<File path="editor/_source/internals/fckxhtml.js" />
		<File path="editor/_source/internals/fckxhtml_gecko.js" />
		<File path="editor/_source/internals/fckcodeformatter.js" />
		<File path="editor/_source/internals/fckundo_gecko.js" />
		<File path="editor/_source/classes/fckeditingarea.js" />
		<File path="editor/_source/classes/fckkeystrokehandler.js" />

		<File path="editor/_source/internals/fcklisthandler.js" />
		<File path="editor/_source/classes/fckelementpath.js" />
		<File path="editor/_source/classes/fckdomrange.js" />
		<File path="editor/_source/classes/fckdomrange_gecko.js" />
		<File path="editor/_source/classes/fckdocumentfragment_gecko.js" />
		<File path="editor/_source/classes/fckw3crange.js" />
		<File path="editor/_source/classes/fckenterkey.js" />

		<File path="editor/_source/internals/fckdocumentprocessor.js" />
		<File path="editor/_source/internals/fckselection.js" />
		<File path="editor/_source/internals/fckselection_gecko.js" />

		<File path="editor/_source/internals/fcktablehandler.js" />
		<File path="editor/_source/internals/fcktablehandler_gecko.js" />
		<File path="editor/_source/classes/fckxml_gecko.js" />
		<File path="editor/_source/classes/fckstyledef.js" />
		<File path="editor/_source/classes/fckstyledef_gecko.js" />
		<File path="editor/_source/classes/fckstylesloader.js" />

		<File path="editor/_source/commandclasses/fcknamedcommand.js" />
		<File path="editor/_source/commandclasses/fck_othercommands.js" />
		<File path="editor/_source/commandclasses/fckspellcheckcommand_gecko.js" />
		<File path="editor/_source/commandclasses/fcktextcolorcommand.js" />
		<File path="editor/_source/commandclasses/fckpasteplaintextcommand.js" />
		<File path="editor/_source/commandclasses/fckpastewordcommand.js" />
		<File path="editor/_source/commandclasses/fcktablecommand.js" />
		<File path="editor/_source/commandclasses/fckstylecommand.js" />
		<File path="editor/_source/commandclasses/fckfitwindow.js" />
		<File path="editor/_source/internals/fckcommands.js" />

		<File path="editor/_source/classes/fckpanel.js" />
		<File path="editor/_source/classes/fckicon.js" />
		<File path="editor/_source/classes/fcktoolbarbuttonui.js" />
		<File path="editor/_source/classes/fcktoolbarbutton.js" />
		<File path="editor/_source/classes/fckspecialcombo.js" />
		<File path="editor/_source/classes/fcktoolbarspecialcombo.js" />
		<File path="editor/_source/classes/fcktoolbarfontscombo.js" />
		<File path="editor/_source/classes/fcktoolbarfontsizecombo.js" />
		<File path="editor/_source/classes/fcktoolbarfontformatcombo.js" />
		<File path="editor/_source/classes/fcktoolbarstylecombo.js" />
		<File path="editor/_source/classes/fcktoolbarpanelbutton.js" />
		<File path="editor/_source/internals/fcktoolbaritems.js" />
		<File path="editor/_source/classes/fcktoolbar.js" />
		<File path="editor/_source/classes/fcktoolbarbreak_gecko.js" />
		<File path="editor/_source/internals/fcktoolbarset.js" />
		<File path="editor/_source/internals/fckdialog.js" />
		<File path="editor/_source/internals/fckdialog_gecko.js" />

		<File path="editor/_source/classes/fckmenuitem.js" />
		<File path="editor/_source/classes/fckmenublock.js" />
		<File path="editor/_source/classes/fckmenublockpanel.js" />
		<File path="editor/_source/classes/fckcontextmenu.js" />
		<File path="editor/_source/internals/fck_contextmenu.js" />

		<File path="editor/_source/classes/fckplugin.js" />
		<File path="editor/_source/internals/fckplugins.js" />
	</PackageFile>

</Package>
--- NEW FILE: fckeditor.pl ---
#####
#  FCKeditor - The text editor for Internet - http://www.fckeditor.net
#  Copyright (C) 2003-2007 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 = '<div>' ;
	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>";
	}
	$Html .= '</div>';
	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) ;
	} 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;

--- NEW FILE: fcktemplates.xml ---
<?xml version="1.0" encoding="utf-8" ?>
<!--
 * FCKeditor - The text editor for Internet - http://www.fckeditor.net
 * Copyright (C) 2003-2007 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 sample templates definitions file. It makes the "templates"
 * command completely customizable.
 *
 * See FCKConfig.TemplatesXmlPath in the configuration file.
-->
<Templates imagesBasePath="fck_template/images/">
	<Template title="Image and Title" image="template1.gif">
		<Description>One main image with a title and text that surround the image.</Description>
		<Html>
			<![CDATA[
				<img style="MARGIN-RIGHT: 10px" height="100" alt="" width="100" align="left"/>
				<h3>Type the title here</h3>
				Type the text here
			]]>
		</Html>
	</Template>
	<Template title="Strange Template" image="template2.gif">
		<Description>A template that defines two colums, each one with a title, and some text.</Description>
		<Html>
			<![CDATA[
				<table cellspacing="0" cellpadding="0" width="100%" border="0">
					<tbody>
						<tr>
							<td width="50%">
							<h3>Title 1</h3>
							</td>
							<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </td>
							<td width="50%">
							<h3>Title 2</h3>
							</td>
						</tr>
						<tr>
							<td>Text 1</td>
							<td>&nbsp;</td>
							<td>Text 2</td>
						</tr>
					</tbody>
				</table>
				More text goes here.
			]]>
		</Html>
	</Template>
	<Template title="Text and Table" image="template3.gif">
		<Description>A title with some text and a table.</Description>
		<Html>
			<![CDATA[
				<table align="left" width="80%" border="0" cellspacing="0" cellpadding="0"><tr><td>
					<h3>Title goes here</h3>
					<p>
					<table style="FLOAT: right" cellspacing="0" cellpadding="0" width="150" border="1">
						<tbody>
							<tr>
								<td align="center" colspan="3"><strong>Table title</strong></td>
							</tr>
							<tr>
								<td>&nbsp;</td>
								<td>&nbsp;</td>
								<td>&nbsp;</td>
							</tr>
							<tr>
								<td>&nbsp;</td>
								<td>&nbsp;</td>
								<td>&nbsp;</td>
							</tr>
							<tr>
								<td>&nbsp;</td>
								<td>&nbsp;</td>
								<td>&nbsp;</td>
							</tr>
							<tr>
								<td>&nbsp;</td>
								<td>&nbsp;</td>
								<td>&nbsp;</td>
							</tr>
						</tbody>
					</table>
					Type the text here</p>
				</td></tr></table>
			]]>
		</Html>
	</Template>
</Templates>



More information about the freeside-commits mailing list