88
87
var eCaption = oEditor.FCKDomTools.GetFirstChild( table, 'CAPTION' ) ;
89
88
if ( eCaption ) document.getElementById('txtCaption').value = eCaption.innerHTML ;
90
hasColumnHeaders = true ;
91
// Check if all the first cells in every row are TH
92
for (var row=0; row<table.rows.length; row++)
94
// If just one cell isn't a TH then it isn't a header column
95
if ( table.rows[row].cells[0].nodeName != 'TH' )
97
hasColumnHeaders = false ;
103
// Check if the table contains <thead>
104
if ((table.tHead !== null) )
106
if (hasColumnHeaders)
107
GetE('selHeaders').value = 'both' ;
109
GetE('selHeaders').value = 'row' ;
113
if (hasColumnHeaders)
114
GetE('selHeaders').value = 'col' ;
116
GetE('selHeaders').value = '' ;
91
120
document.getElementById('txtRows').disabled = true ;
92
121
document.getElementById('txtColumns').disabled = true ;
93
122
SelectField( 'txtWidth' ) ;
145
177
eCaption.parentNode.removeChild( eCaption ) ;
180
var headers = GetE('selHeaders').value ;
183
// Should we make a <thead>?
184
if ( table.tHead==null && (headers=='row' || headers=='both') )
186
var oThead = table.createTHead() ;
187
var tbody = FCKDomTools.GetFirstChild( table, 'TBODY' ) ;
188
var theRow= FCKDomTools.GetFirstChild( tbody, 'TR' ) ;
190
//now change TD to TH:
191
for (var i = 0; i<theRow.childNodes.length ; i++)
193
var th = RenameNode(theRow.childNodes[i], 'TH') ;
197
oThead.appendChild( theRow ) ;
200
if ( table.tHead!==null && !(headers=='row' || headers=='both') )
202
// Move the row out of the THead and put it in the TBody:
203
var tHead = table.tHead ;
204
var tbody = FCKDomTools.GetFirstChild( table, 'TBODY' ) ;
206
var previousFirstRow = tbody.firstChild ;
207
while ( tHead.firstChild )
209
var theRow = tHead.firstChild ;
210
for (var i = 0; i < theRow.childNodes.length ; i++ )
212
var newCell = RenameNode( theRow.childNodes[i], 'TD' ) ;
213
if ( newCell != null )
214
newCell.removeAttribute( 'scope' ) ;
216
tbody.insertBefore( theRow, previousFirstRow ) ;
218
table.removeChild( tHead ) ;
221
// Should we make all first cells in a row TH?
222
if ( (!hasColumnHeaders) && (headers=='col' || headers=='both') )
224
for( var row=0 ; row < table.rows.length ; row++ )
226
var newCell = RenameNode(table.rows[row].cells[0], 'TH') ;
227
if ( newCell != null )
228
newCell.scope = 'row' ;
232
// Should we make all first TH-cells in a row make TD? If 'yes' we do it the other way round :-)
233
if ( (hasColumnHeaders) && !(headers=='col' || headers=='both') )
235
for( var row=0 ; row < table.rows.length ; row++ )
237
var oRow = table.rows[row] ;
238
if ( oRow.parentNode.nodeName == 'TBODY' )
240
var newCell = RenameNode(oRow.cells[0], 'TD') ;
242
newCell.removeAttribute( 'scope' ) ;
150
var iRows = document.getElementById('txtRows').value ;
151
var iCols = document.getElementById('txtColumns').value ;
250
var iRows = GetE('txtRows').value ;
251
var iCols = GetE('txtColumns').value ;
153
for ( var r = 0 ; r < iRows ; r++ )
254
// Should we make a <thead> ?
255
if (headers=='row' || headers=='both')
258
var oThead = table.createTHead() ;
155
259
var oRow = table.insertRow(-1) ;
260
oThead.appendChild(oRow);
156
262
for ( var c = 0 ; c < iCols ; c++ )
158
var oCell = oRow.insertCell(-1) ;
264
var oThcell = oDoc.createElement( 'TH' ) ;
265
oThcell.scope = 'col' ;
266
oRow.appendChild( oThcell ) ;
267
if ( oEditor.FCKBrowserInfo.IsGeckoLike )
268
oEditor.FCKTools.AppendBogusBr( oThcell ) ;
272
// Opera automatically creates a tbody when a thead has been added
273
var oTbody = FCKDomTools.GetFirstChild( table, 'TBODY' ) ;
276
// make TBODY if it doesn't exist
277
oTbody = oDoc.createElement( 'TBODY' ) ;
278
table.appendChild( oTbody ) ;
280
for ( var r = startRow ; r < iRows; r++ )
282
var oRow = oDoc.createElement( 'TR' ) ;
283
oTbody.appendChild(oRow) ;
286
// Is the first column a header?
287
if (headers=='col' || headers=='both')
289
var oThcell = oDoc.createElement( 'TH' ) ;
290
oThcell.scope = 'row' ;
291
oRow.appendChild( oThcell ) ;
292
if ( oEditor.FCKBrowserInfo.IsGeckoLike )
293
oEditor.FCKTools.AppendBogusBr( oThcell ) ;
297
for ( var c = startCol ; c < iCols ; c++ )
299
// IE will leave the TH at the end of the row if we use now oRow.insertCell(-1)
300
var oCell = oDoc.createElement( 'TD' ) ;
301
oRow.appendChild( oCell ) ;
159
302
if ( oEditor.FCKBrowserInfo.IsGeckoLike )
160
303
oEditor.FCKTools.AppendBogusBr( oCell ) ;
164
oEditor.FCKUndo.SaveUndoStep() ;
166
307
oEditor.FCK.InsertElement( table ) ;
178
319
<table cellspacing="1" cellpadding="1" width="100%" border="0">
180
321
<td valign="top">
181
<table cellspacing="0" cellpadding="0" border="0">
322
<table cellspacing="1" cellpadding="0" border="0">
184
325
<span fcklang="DlgTableRows">Rows</span>:</td>
186
<input id="txtRows" type="text" maxlength="3" size="2" value="3" name="txtRows"
327
<input id="txtRows" type="text" maxlength="3" size="2" value="3"
187
328
onkeypress="return IsDigit(event);" /></td>
191
332
<span fcklang="DlgTableColumns">Columns</span>:</td>
193
<input id="txtColumns" type="text" maxlength="2" size="2" value="2" name="txtColumns"
334
<input id="txtColumns" type="text" maxlength="2" size="2" value="2"
194
335
onkeypress="return IsDigit(event);" /></td>
338
<td><span fcklang="DlgTableHeaders">Headers</span>:</td>
340
<select id="selHeaders">
341
<option fcklang="DlgTableHeadersNone" value="">None</option>
342
<option fcklang="DlgTableHeadersRow" value="row">First row</option>
343
<option fcklang="DlgTableHeadersColumn" value="col">First column</option>
344
<option fcklang="DlgTableHeadersBoth" value="both">Both</option>
204
350
<span fcklang="DlgTableBorder">Border size</span>:</td>
206
<input id="txtBorder" type="text" maxlength="2" size="2" value="1" name="txtBorder"
352
<input id="txtBorder" type="text" maxlength="2" size="2" value="1"
207
353
onkeypress="return IsDigit(event);" /></td>
211
357
<span fcklang="DlgTableAlign">Alignment</span>:</td>
213
<select id="selAlignment" name="selAlignment">
359
<select id="selAlignment">
214
360
<option fcklang="DlgTableAlignNotSet" value="" selected="selected"><Not set></option>
215
361
<option fcklang="DlgTableAlignLeft" value="left">Left</option>
216
362
<option fcklang="DlgTableAlignCenter" value="center">Center</option>