1<cfsetting enablecfoutputonly="true">
2<!---
3 * FCKeditor - The text editor for Internet - http://www.fckeditor.net
4 * Copyright (C) 2003-2007 Frederico Caldeira Knabben
5 *
6 * == BEGIN LICENSE ==
7 *
8 * Licensed under the terms of any of the following licenses at your
9 * choice:
10 *
11 *  - GNU General Public License Version 2 or later (the "GPL")
12 *    http://www.gnu.org/licenses/gpl.html
13 *
14 *  - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
15 *    http://www.gnu.org/licenses/lgpl.html
16 *
17 *  - Mozilla Public License Version 1.1 or later (the "MPL")
18 *    http://www.mozilla.org/MPL/MPL-1.1.html
19 *
20 * == END LICENSE ==
21 *
22 * Sample page for ColdFusion MX 6.0 and above.
23--->
24
25<cfoutput>
26<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
27<html>
28<head>
29	<title>FCKeditor - Sample</title>
30	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
31	<meta name="robots" content="noindex, nofollow">
32	<link href="../sample.css" rel="stylesheet" type="text/css" />
33		<script type="text/javascript">
34
35function FCKeditor_OnComplete( editorInstance )
36{
37	var oCombo = document.getElementById( 'cmbLanguages' ) ;
38	for ( code in editorInstance.Language.AvailableLanguages )
39	{
40		AddComboOption( oCombo, editorInstance.Language.AvailableLanguages[code] + ' (' + code + ')', code ) ;
41	}
42	oCombo.value = editorInstance.Language.ActiveLanguage.Code ;
43}
44
45function AddComboOption(combo, optionText, optionValue)
46{
47	var oOption = document.createElement("OPTION") ;
48
49	combo.options.add(oOption) ;
50
51	oOption.innerHTML = optionText ;
52	oOption.value     = optionValue ;
53
54	return oOption ;
55}
56
57function ChangeLanguage( languageCode )
58{
59	window.location.href = window.location.pathname + "?Lang=" + languageCode ;
60}
61		</script>
62</head>
63<body>
64<h1>FCKeditor - ColdFusion Component (CFC) - Sample 2</h1>
65This sample shows the editor in all its available languages.
66<hr>
67</cfoutput>
68<cfif listFirst( server.coldFusion.productVersion ) LT 6>
69	<cfoutput><br><em style="color: red;">This sample works only with a ColdFusion MX server and higher, because it uses some advantages of this version.</em></cfoutput>
70	<cfabort>
71</cfif>
72<cfoutput>
73<table cellpadding="0" cellspacing="0" border="0">
74	<tr>
75		<td>
76			Select a language:&nbsp;
77		</td>
78		<td>
79			<select id="cmbLanguages" onchange="ChangeLanguage(this.value);">
80			</select>
81		</td>
82	</tr>
83</table>
84<br>
85<form action="sampleposteddata.cfm" method="post" target="_blank">
86</cfoutput>
87	<cfscript>
88		// Calculate basepath for FCKeditor. It's in the folder right above _samples
89		basePath = Left( cgi.script_name, FindNoCase( '_samples', cgi.script_name ) - 1 ) ;
90
91		fckEditor = createObject( "component", "#basePath#fckeditor" ) ;
92		fckEditor.instanceName	= "myEditor" ;
93		fckEditor.value			= '<p>This is some <strong>sample text</strong>. You are using <a href="http://www.fckeditor.net/">FCKeditor</a>.</p>' ;
94		fckEditor.basePath		= basePath ;
95		if ( isDefined( "URL.Lang" ) )
96		{
97			fckEditor.config["AutoDetectLanguage"]		= false ;
98			fckEditor.config["DefaultLanguage"]			= HTMLEditFormat( URL.Lang ) ;
99		}
100		else
101		{
102			fckEeditor.config["AutoDetectLanguage"]		= true ;
103			fckEeditor.config["DefaultLanguage"]		= 'en' ;
104		}
105		fckEditor.create() ; // create the editor.
106	</cfscript>
107<cfoutput>
108	<br>
109	<input type="submit" value="Submit">
110	</form>
111</body>
112</html>
113</cfoutput>
114<cfsetting enablecfoutputonly="false">