Subversion Repositories Applications.papyrus

Rev

Rev 1688 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1688 Rev 1921
Line 1... Line 1...
1
/*
1
/*
2
 * FCKeditor - The text editor for internet
2
 * FCKeditor - The text editor for Internet - http://www.fckeditor.net
3
 * Copyright (C) 2003-2006 Frederico Caldeira Knabben
3
 * Copyright (C) 2003-2008 Frederico Caldeira Knabben
-
 
4
 *
-
 
5
 * == BEGIN LICENSE ==
4
 * 
6
 *
5
 * Licensed under the terms of the GNU Lesser General Public License:
7
 * Licensed under the terms of any of the following licenses at your
6
 * 		http://www.opensource.org/licenses/lgpl-license.php
8
 * choice:
7
 * 
9
 *
8
 * For further information visit:
10
 *  - GNU General Public License Version 2 or later (the "GPL")
9
 * 		http://www.fckeditor.net/
11
 *    http://www.gnu.org/licenses/gpl.html
10
 * 
12
 *
11
 * "Support Open Source software. What about a donation today?"
13
 *  - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
-
 
14
 *    http://www.gnu.org/licenses/lgpl.html
12
 * 
15
 *
13
 * File Name: fck_select.js
16
 *  - Mozilla Public License Version 1.1 or later (the "MPL")
14
 * 	Scripts for the fck_select.html page.
17
 *    http://www.mozilla.org/MPL/MPL-1.1.html
15
 * 
18
 *
16
 * File Authors:
19
 * == END LICENSE ==
-
 
20
 *
17
 * 		Frederico Caldeira Knabben (fredck@fckeditor.net)
21
 * Scripts for the fck_select.html page.
18
 */
22
 */
Line 19... Line 23...
19
 
23
 
20
function Select( combo )
24
function Select( combo )
21
{
25
{
Line 55... Line 59...
55
	if ( iIndex < 0 ) return ;
59
	if ( iIndex < 0 ) return ;
Line 56... Line 60...
56
 
60
 
57
	var oTxtText	= document.getElementById( "txtText" ) ;
61
	var oTxtText	= document.getElementById( "txtText" ) ;
Line 58... Line 62...
58
	var oTxtValue	= document.getElementById( "txtValue" ) ;
62
	var oTxtValue	= document.getElementById( "txtValue" ) ;
59
 
63
 
Line 60... Line 64...
60
	oListText.options[ iIndex ].innerHTML	= oTxtText.value ;
64
	oListText.options[ iIndex ].innerHTML	= HTMLEncode( oTxtText.value ) ;
61
	oListText.options[ iIndex ].value		= oTxtText.value ;
65
	oListText.options[ iIndex ].value		= oTxtText.value ;
Line 62... Line 66...
62
 
66
 
63
	oListValue.options[ iIndex ].innerHTML	= oTxtValue.value ;
67
	oListValue.options[ iIndex ].innerHTML	= HTMLEncode( oTxtValue.value ) ;
Line 109... Line 113...
109
 
113
 
110
	if ( iActualIndex == iFinalIndex )
114
	if ( iActualIndex == iFinalIndex )
Line 111... Line 115...
111
		return ;
115
		return ;
112
 
116
 
113
	var oOption = combo.options[ iActualIndex ] ;
117
	var oOption = combo.options[ iActualIndex ] ;
Line 114... Line 118...
114
	var sText	= oOption.innerHTML ;
118
	var sText	= HTMLDecode( oOption.innerHTML ) ;
Line 115... Line 119...
115
	var sValue	= oOption.value ;
119
	var sValue	= oOption.value ;
Line 156... Line 160...
156
	if ( index != null )
160
	if ( index != null )
157
		combo.options.add( oOption, index ) ;
161
		combo.options.add( oOption, index ) ;
158
	else
162
	else
159
		combo.options.add( oOption ) ;
163
		combo.options.add( oOption ) ;
Line 160... Line 164...
160
 
164
 
161
	oOption.innerHTML = optionText.length > 0 ? optionText : '&nbsp;' ;
165
	oOption.innerHTML = optionText.length > 0 ? HTMLEncode( optionText ) : '&nbsp;' ;
Line 162... Line 166...
162
	oOption.value     = optionValue ;
166
	oOption.value     = optionValue ;
163
 
-
 
164
	return oOption ;
167
 
-
 
168
	return oOption ;
-
 
169
}
-
 
170
 
-
 
171
function HTMLEncode( text )
-
 
172
{
-
 
173
	if ( !text )
-
 
174
		return '' ;
-
 
175
 
-
 
176
	text = text.replace( /&/g, '&amp;' ) ;
-
 
177
	text = text.replace( /</g, '&lt;' ) ;
-
 
178
	text = text.replace( />/g, '&gt;' ) ;
-
 
179
 
-
 
180
	return text ;
-
 
181
}
-
 
182
 
-
 
183
 
-
 
184
function HTMLDecode( text )
-
 
185
{
-
 
186
	if ( !text )
-
 
187
		return '' ;
-
 
188
 
-
 
189
	text = text.replace( /&gt;/g, '>' ) ;
-
 
190
	text = text.replace( /&lt;/g, '<' ) ;
-
 
191
	text = text.replace( /&amp;/g, '&' ) ;
-
 
192
 
-
 
193
	return text ;