1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
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 * Select dialog window.
23-->
24<html>
25	<head>
26		<title>Select Properties</title>
27		<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
28		<meta content="noindex, nofollow" name="robots">
29		<script src="common/fck_dialog_common.js" type="text/javascript"></script>
30		<script type="text/javascript" src="fck_select/fck_select.js"></script>
31		<script type="text/javascript">
32
33var dialog	= window.parent ;
34var oEditor = dialog.InnerDialogLoaded() ;
35
36// Gets the document DOM
37var oDOM = oEditor.FCK.EditorDocument ;
38
39var oActiveEl = dialog.Selection.GetSelectedElement() ;
40
41var oListText ;
42var oListValue ;
43
44window.onload = function()
45{
46	// First of all, translate the dialog box texts
47	oEditor.FCKLanguageManager.TranslatePage(document) ;
48
49	oListText	= document.getElementById( 'cmbText' ) ;
50	oListValue	= document.getElementById( 'cmbValue' ) ;
51
52	// Fix the lists widths. (Bug #970)
53	oListText.style.width = oListText.offsetWidth ;
54	oListValue.style.width = oListValue.offsetWidth ;
55
56	if ( oActiveEl && oActiveEl.tagName == 'SELECT' )
57	{
58		GetE('txtName').value		= oActiveEl.name ;
59		GetE('txtSelValue').value	= oActiveEl.value ;
60		GetE('txtLines').value		= GetAttribute( oActiveEl, 'size' ) ;
61		GetE('chkMultiple').checked	= oActiveEl.multiple ;
62
63		// Load the actual options
64		for ( var i = 0 ; i < oActiveEl.options.length ; i++ )
65		{
66			var sText	= HTMLDecode( oActiveEl.options[i].innerHTML ) ;
67			var sValue	= oActiveEl.options[i].value ;
68
69			AddComboOption( oListText, sText, sText ) ;
70			AddComboOption( oListValue, sValue, sValue ) ;
71		}
72	}
73	else
74		oActiveEl = null ;
75
76	dialog.SetOkButton( true ) ;
77	dialog.SetAutoSize( true ) ;
78	SelectField( 'txtName' ) ;
79}
80
81function Ok()
82{
83	oEditor.FCKUndo.SaveUndoStep() ;
84
85	var sSize = GetE('txtLines').value ;
86	if ( sSize == null || isNaN( sSize ) || sSize <= 1 )
87		sSize = '' ;
88
89	oActiveEl = CreateNamedElement( oEditor, oActiveEl, 'SELECT', {name: GetE('txtName').value} ) ;
90
91	SetAttribute( oActiveEl, 'size'	, sSize ) ;
92	oActiveEl.multiple = ( sSize.length > 0 && GetE('chkMultiple').checked ) ;
93
94	// Remove all options.
95	while ( oActiveEl.options.length > 0 )
96		oActiveEl.remove(0) ;
97
98	// Add all available options.
99	for ( var i = 0 ; i < oListText.options.length ; i++ )
100	{
101		var sText	= oListText.options[i].value ;
102		var sValue	= oListValue.options[i].value ;
103		if ( sValue.length == 0 ) sValue = sText ;
104
105		var oOption = AddComboOption( oActiveEl, sText, sValue, oDOM ) ;
106
107		if ( sValue == GetE('txtSelValue').value )
108		{
109			SetAttribute( oOption, 'selected', 'selected' ) ;
110			oOption.selected = true ;
111		}
112	}
113
114	return true ;
115}
116
117		</script>
118	</head>
119	<body style="overflow: hidden">
120		<table width="100%" height="100%">
121			<tr>
122				<td>
123					<table width="100%">
124						<tr>
125							<td nowrap><span fckLang="DlgSelectName">Name</span>&nbsp;</td>
126							<td width="100%" colSpan="2"><input id="txtName" style="WIDTH: 100%" type="text"></td>
127						</tr>
128						<tr>
129							<td nowrap><span fckLang="DlgSelectValue">Value</span>&nbsp;</td>
130							<td width="100%" colSpan="2"><input id="txtSelValue" style="WIDTH: 100%; BACKGROUND-COLOR: buttonface" type="text" readonly></td>
131						</tr>
132						<tr>
133							<td nowrap><span fckLang="DlgSelectSize">Size</span>&nbsp;</td>
134							<td nowrap><input id="txtLines" type="text" size="2" value="">&nbsp;<span fckLang="DlgSelectLines">lines</span></td>
135							<td nowrap align="right"><input id="chkMultiple" type="checkbox"><label for="chkMultiple" fckLang="DlgSelectChkMulti">Allow
136									multiple selections</label></td>
137						</tr>
138					</table>
139					<br>
140					<hr style="POSITION: absolute">
141					<span style="LEFT: 10px; POSITION: relative; TOP: -7px" class="BackColor">&nbsp;<span fckLang="DlgSelectOpAvail">Available
142							Options</span>&nbsp;</span>
143					<table width="100%">
144						<tr>
145							<td width="50%"><span fckLang="DlgSelectOpText">Text</span><br>
146								<input id="txtText" style="WIDTH: 100%" type="text">
147							</td>
148							<td width="50%"><span fckLang="DlgSelectOpValue">Value</span><br>
149								<input id="txtValue" style="WIDTH: 100%" type="text">
150							</td>
151							<td vAlign="bottom"><input onclick="Add();" type="button" fckLang="DlgSelectBtnAdd" value="Add"></td>
152							<td vAlign="bottom"><input onclick="Modify();" type="button" fckLang="DlgSelectBtnModify" value="Modify"></td>
153						</tr>
154						<tr>
155							<td rowSpan="2"><select id="cmbText" style="WIDTH: 100%" onchange="GetE('cmbValue').selectedIndex = this.selectedIndex;Select(this);"
156									size="5"></select>
157							</td>
158							<td rowSpan="2"><select id="cmbValue" style="WIDTH: 100%" onchange="GetE('cmbText').selectedIndex = this.selectedIndex;Select(this);"
159									size="5"></select>
160							</td>
161							<td vAlign="top" colSpan="2">
162							</td>
163						</tr>
164						<tr>
165							<td vAlign="bottom" colSpan="2"><input style="WIDTH: 100%" onclick="Move(-1);" type="button" fckLang="DlgSelectBtnUp" value="Up">
166								<br>
167								<input style="WIDTH: 100%" onclick="Move(1);" type="button" fckLang="DlgSelectBtnDown"
168									value="Down">
169							</td>
170						</tr>
171						<TR>
172							<TD vAlign="bottom" colSpan="4"><INPUT onclick="SetSelectedValue();" type="button" fckLang="DlgSelectBtnSetValue" value="Set as selected value">&nbsp;&nbsp;
173								<input onclick="Delete();" type="button" fckLang="DlgSelectBtnDelete" value="Delete"></TD>
174						</TR>
175					</table>
176				</td>
177			</tr>
178		</table>
179	</body>
180</html>
181