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 * Cell properties dialog window.
23-->
24<html xmlns="http://www.w3.org/1999/xhtml">
25<head>
26	<title>Table Cell Properties</title>
27	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
28	<meta name="robots" content="noindex, nofollow" />
29	<script src="common/fck_dialog_common.js" type="text/javascript"></script>
30	<script type="text/javascript">
31
32var dialog	= window.parent ;
33var oEditor = dialog.InnerDialogLoaded() ;
34
35var FCKDomTools = oEditor.FCKDomTools ;
36
37// Array of selected Cells
38var aCells = oEditor.FCKTableHandler.GetSelectedCells() ;
39
40window.onload = function()
41{
42	// First of all, translate the dialog box texts
43	oEditor.FCKLanguageManager.TranslatePage( document ) ;
44
45	SetStartupValue() ;
46
47	dialog.SetOkButton( true ) ;
48	dialog.SetAutoSize( true ) ;
49
50}
51
52function SetStartupValue()
53{
54	if ( aCells.length > 0 )
55	{
56		var oCell = aCells[0] ;
57		GetE('selHAlign').value			= GetAttribute( oCell, 'align' ) ;
58		GetE('txtRowSpan').value		= GetAttribute( oCell, 'rowSpan' ) ;
59		GetE('txtCollSpan').value		= GetAttribute( oCell, 'colSpan' ) ;
60
61        if(oCell.className) {
62             var classValue = oCell.className;
63                  var elems = classValue.split(/\s+/);
64                  if(elems.length > 1) {
65        		    GetE('fckgTxtClass').value = elems[1];
66                  }
67                  else if(elems.length > 0 ) {
68                       if(!elems[0].match(/^col/)) {
69                            GetE('fckgTxtClass').value = elems[0];
70                       }
71                  }
72         }
73
74		GetE('selCellType').value     = oCell.nodeName.toLowerCase() ;
75
76	}
77}
78
79// Fired when the user press the OK button
80function Ok()
81{
82	oEditor.FCKUndo.SaveUndoStep() ;
83
84	for( i = 0 ; i < aCells.length ; i++ )
85	{
86
87
88		SetAttribute( aCells[i], 'align'		, GetE('selHAlign').value ) ;
89		SetAttribute( aCells[i], 'rowSpan'		, GetE('txtRowSpan').value ) ;
90		SetAttribute( aCells[i], 'colSpan'		, GetE('txtCollSpan').value ) ;
91        SetAttribute( aCells[i], 'class'		, GetE('fckgTxtClass').value ) ;
92		var cellType = GetE('selCellType').value ;
93		if ( aCells[i].nodeName.toLowerCase() != cellType )
94			aCells[i] = RenameNode( aCells[i], cellType ) ;
95	}
96
97	// The cells need to be reselected, otherwise the caret will appear inside the table borders (Gecko)
98	// or sent back to the beginning of the document (Opera and Safari).
99	// Strangely, IE works ok so no change is needed for IE.
100	if ( !oEditor.FCKBrowserInfo.IsIE )
101	{
102		var selection = oEditor.FCK.EditorWindow.getSelection() ;
103		selection.removeAllRanges() ;
104		for ( var i = 0 ; i < aCells.length ; i++ )
105		{
106			var range = oEditor.FCK.EditorDocument.createRange() ;
107			range.selectNode( aCells[i] ) ;
108			selection.addRange( range ) ;
109		}
110	}
111
112	return true ;
113}
114
115
116function reset_class(el) {
117  for(var i=0; i < el.options.length; i++) {
118        if(el.options[i].selected) {
119          if(el.options[i].value) {
120             GetE('fckgTxtClass').value = el.options[i].value + 'align';
121          }
122          else GetE('fckgTxtClass').value = "";
123          break;
124        }
125  }
126}
127
128function disabled_input(el) {
129   var text = el.value;
130   el.value = text;
131}
132	</script>
133
134<style type= 'text/css'>
135td, input,option { font-size: 8pt; }
136</style>
137
138</head>
139<body scroll="no" style="overflow: hidden">
140
141	<table cellspacing="0" cellpadding="0" border="0">
142		<tr>
143			<td nowrap="nowrap">
144				<span fcklang="DlgCellHorAlign">Horizontal Alignment</span>:</td>
145			<td>
146				&nbsp;<select id="selHAlign" onchange='reset_class(this)'>
147					<option fcklang="DlgCellHorAlignNotSet" value="" selected>&lt;Not set&gt;</option>
148					<option fcklang="DlgCellHorAlignLeft"  value="left">Left</option>
149					<option fcklang="DlgCellHorAlignCenter" value="center">Center</option>
150					<option fcklang="DlgCellHorAlignRight" value="right">Right</option>
151				</select></td>
152		</tr>
153     <tr>
154      <tr>
155       <td style='font-size: 6pt;'>&nbsp;</td>
156       <td style='font-size: 6pt;'>&nbsp;</td>
157       </tr>
158 	 <td align='center' valign='top'>
159				<span>Class: </span></td>
160     <td>
161        <form>
162        &nbsp;<input onkeypress= 'return disabled_input(this);'  style="background-color:#dddddd; color: black" type='text' id = "fckgTxtClass"></form>
163     </td>
164     </tr>
165	</table>
166
167	<table cellspacing="0" cellpadding="0" border="0">
168		<tr>
169			<td nowrap="nowrap">
170			 <span fcklang="DlgCellType">Cell Type</span>:</td>
171			<td colspan="2">
172				&nbsp; <select id="selCellType">
173					<option fcklang="DlgCellTypeData" value="td" />Data
174					<option fcklang="DlgCellTypeHeader" value="th" />Header
175				</select>
176		</tr>
177       <tr>
178          <td  style="font-size:6p;">
179            &nbsp;
180        </td>
181       </tr>
182		<tr>
183			<td nowrap="nowrap">
184				<span fcklang="DlgCellRowSpan">Rows Span</span>:</td>
185			<td>
186				&nbsp;
187				<input onkeypress="return IsDigit(event);" id="txtRowSpan" type="text" maxlength="3" size="2"
188					></td>
189			<td>
190			</td>
191		</tr>
192		<tr>
193			<td nowrap="nowrap">
194				<span fcklang="DlgCellCollSpan">Columns Span</span>:</td>
195			<td>
196				&nbsp;
197				<input onkeypress="return IsDigit(event);" id="txtCollSpan" type="text" maxlength="2"
198					size="2"></td>
199			<td>
200			</td>
201		</tr>
202	</table>
203
204</body>
205</html>
206