[1575] | 1 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
---|
| 2 | <!--
|
---|
| 3 | * FCKeditor - The text editor for Internet - http://www.fckeditor.net
|
---|
| 4 | * Copyright (C) 2003-2009 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.
|
---|
| 23 | -->
|
---|
| 24 | <html xmlns="http://www.w3.org/1999/xhtml">
|
---|
| 25 | <head>
|
---|
| 26 | <title>FCKeditor - Sample</title>
|
---|
| 27 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
---|
| 28 | <meta name="robots" content="noindex, nofollow" />
|
---|
| 29 | <link href="../sample.css" rel="stylesheet" type="text/css" />
|
---|
| 30 | <script type="text/javascript" src="../../fckeditor.js"></script>
|
---|
| 31 | <script type="text/javascript">
|
---|
| 32 |
|
---|
| 33 | var bIsLoaded = false ;
|
---|
| 34 |
|
---|
| 35 | function FCKeditor_OnComplete( editorInstance )
|
---|
| 36 | {
|
---|
| 37 | if ( bIsLoaded )
|
---|
| 38 | return ;
|
---|
| 39 |
|
---|
| 40 | var oCombo = document.getElementById( 'cmbLanguages' ) ;
|
---|
| 41 |
|
---|
| 42 | // Remove all options. (#1399)
|
---|
| 43 | oCombo.innerHTML = '' ;
|
---|
| 44 |
|
---|
| 45 | var aLanguages = new Array() ;
|
---|
| 46 |
|
---|
| 47 | for ( code in editorInstance.Language.AvailableLanguages )
|
---|
| 48 | aLanguages.push( { Code : code, Name : editorInstance.Language.AvailableLanguages[code] } ) ;
|
---|
| 49 |
|
---|
| 50 | aLanguages.sort( SortLanguage ) ;
|
---|
| 51 |
|
---|
| 52 | for ( var i = 0 ; i < aLanguages.length ; i++ )
|
---|
| 53 | AddComboOption( oCombo, aLanguages[i].Name + ' (' + aLanguages[i].Code + ')', aLanguages[i].Code ) ;
|
---|
| 54 |
|
---|
| 55 | oCombo.value = editorInstance.Language.ActiveLanguage.Code ;
|
---|
| 56 |
|
---|
| 57 | document.getElementById('eNumLangs').innerHTML = '(' + aLanguages.length + ' languages available!)' ;
|
---|
| 58 |
|
---|
| 59 | bIsLoaded = true ;
|
---|
| 60 | }
|
---|
| 61 |
|
---|
| 62 | function SortLanguage( langA, langB )
|
---|
| 63 | {
|
---|
| 64 | return ( langA.Name < langB.Name ? -1 : langA.Name > langB.Name ? 1 : 0 ) ;
|
---|
| 65 | }
|
---|
| 66 |
|
---|
| 67 | function AddComboOption(combo, optionText, optionValue)
|
---|
| 68 | {
|
---|
| 69 | var oOption = document.createElement("OPTION") ;
|
---|
| 70 |
|
---|
| 71 | combo.options.add(oOption) ;
|
---|
| 72 |
|
---|
| 73 | oOption.innerHTML = optionText ;
|
---|
| 74 | oOption.value = optionValue ;
|
---|
| 75 |
|
---|
| 76 | return oOption ;
|
---|
| 77 | }
|
---|
| 78 |
|
---|
| 79 | function ChangeLanguage( languageCode )
|
---|
| 80 | {
|
---|
| 81 | document.location.href = document.location.href.replace( /\?.*$/, '' ) + "?" + languageCode ;
|
---|
| 82 | }
|
---|
| 83 | </script>
|
---|
| 84 | </head>
|
---|
| 85 | <body>
|
---|
| 86 | <h1>
|
---|
| 87 | FCKeditor - JavaScript - Sample 3</h1>
|
---|
| 88 | <div>
|
---|
| 89 | This sample shows the editor in all its available languages.
|
---|
| 90 | </div>
|
---|
| 91 | <hr />
|
---|
| 92 | <table cellpadding="0" cellspacing="0" border="0">
|
---|
| 93 | <tr>
|
---|
| 94 | <td>
|
---|
| 95 | Select a language:
|
---|
| 96 | </td>
|
---|
| 97 | <td>
|
---|
| 98 | <select id="cmbLanguages" onchange="ChangeLanguage(this.value);">
|
---|
| 99 | <option> </option>
|
---|
| 100 | </select>
|
---|
| 101 | </td>
|
---|
| 102 | <td>
|
---|
| 103 | <span id="eNumLangs"></span>
|
---|
| 104 | </td>
|
---|
| 105 | </tr>
|
---|
| 106 | </table>
|
---|
| 107 | <br />
|
---|
| 108 | <form action="../php/sampleposteddata.php" method="post" target="_blank">
|
---|
| 109 | <script type="text/javascript">
|
---|
| 110 | <!--
|
---|
| 111 | // Automatically calculates the editor base path based on the _samples directory.
|
---|
| 112 | // This is usefull only for these samples. A real application should use something like this:
|
---|
| 113 | // oFCKeditor.BasePath = '/fckeditor/' ; // '/fckeditor/' is the default value.
|
---|
| 114 | var sBasePath = document.location.href.substring(0,document.location.href.lastIndexOf('_samples')) ;
|
---|
| 115 |
|
---|
| 116 | var sLang ;
|
---|
| 117 | if ( document.location.search.length > 1 )
|
---|
| 118 | sLang = document.location.search.substr(1) ;
|
---|
| 119 |
|
---|
| 120 | var oFCKeditor = new FCKeditor( 'FCKeditor1' ) ;
|
---|
| 121 | oFCKeditor.BasePath = sBasePath ;
|
---|
| 122 | if ( sLang == null )
|
---|
| 123 | {
|
---|
| 124 | oFCKeditor.Config["AutoDetectLanguage"] = true ;
|
---|
| 125 | oFCKeditor.Config["DefaultLanguage"] = "en" ;
|
---|
| 126 | }
|
---|
| 127 | else
|
---|
| 128 | {
|
---|
| 129 | oFCKeditor.Config["AutoDetectLanguage"] = false ;
|
---|
| 130 | oFCKeditor.Config["DefaultLanguage"] = sLang ;
|
---|
| 131 | }
|
---|
| 132 | oFCKeditor.Value = '<p>This is some <strong>sample text<\/strong>. You are using <a href="http://www.fckeditor.net/">FCKeditor<\/a>.<\/p>' ;
|
---|
| 133 | oFCKeditor.Create() ;
|
---|
| 134 | //-->
|
---|
| 135 | </script>
|
---|
| 136 | <br />
|
---|
| 137 | <input type="submit" value="Submit" />
|
---|
| 138 | </form>
|
---|
| 139 | </body>
|
---|
| 140 | </html>
|
---|