Subversion Repositories Applications.papyrus

Rev

Rev 1925 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1925 Rev 2048
Line 1... Line 1...
1
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
1
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
2
<!--
2
<!--
3
 * FCKeditor - The text editor for Internet - http://www.fckeditor.net
3
 * FCKeditor - The text editor for Internet - http://www.fckeditor.net
4
 * Copyright (C) 2003-2008 Frederico Caldeira Knabben
4
 * Copyright (C) 2003-2009 Frederico Caldeira Knabben
5
 *
5
 *
6
 * == BEGIN LICENSE ==
6
 * == BEGIN LICENSE ==
7
 *
7
 *
8
 * Licensed under the terms of any of the following licenses at your
8
 * Licensed under the terms of any of the following licenses at your
9
 * choice:
9
 * choice:
Line 29... Line 29...
29
	<script src="common/fck_dialog_common.js" type="text/javascript"></script>
29
	<script src="common/fck_dialog_common.js" type="text/javascript"></script>
30
	<script type="text/javascript">
30
	<script type="text/javascript">
Line 31... Line 31...
31
 
31
 
32
var dialog	= window.parent ;
32
var dialog	= window.parent ;
33
var oEditor = dialog.InnerDialogLoaded() ;
-
 
Line 34... Line -...
34
var dialogArguments = dialog.Args() ;
-
 
35
 
33
var oEditor = dialog.InnerDialogLoaded() ;
Line 36... Line 34...
36
// Gets the document DOM
34
 
37
var oDOM = oEditor.FCK.EditorDocument ;
35
var FCKDomTools = oEditor.FCKDomTools ;
38
 
36
 
-
 
37
// Gets the table if there is one selected.
Line 39... Line 38...
39
// Gets the table if there is one selected.
38
var table ;
40
var table ;
39
var e = dialog.Selection.GetSelectedElement() ;
Line 41... Line 40...
41
var e = dialog.Selection.GetSelectedElement() ;
40
var hasColumnHeaders ;
Line 86... Line 85...
86
//		document.getElementById('cmbFontStyle').value	= table.className ;
85
//		document.getElementById('cmbFontStyle').value	= table.className ;
Line 87... Line 86...
87
 
86
 
88
		var eCaption = oEditor.FCKDomTools.GetFirstChild( table, 'CAPTION' ) ;
87
		var eCaption = oEditor.FCKDomTools.GetFirstChild( table, 'CAPTION' ) ;
Line -... Line 88...
-
 
88
		if ( eCaption ) document.getElementById('txtCaption').value = eCaption.innerHTML ;
-
 
89
 
-
 
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++)
-
 
93
		{
-
 
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' )
-
 
96
			{
-
 
97
				hasColumnHeaders = false ;
-
 
98
 
-
 
99
				break;
-
 
100
			}
-
 
101
		}
-
 
102
 
-
 
103
		// Check if the table contains <thead>
-
 
104
		if ((table.tHead !== null) )
-
 
105
		{
-
 
106
			if (hasColumnHeaders)
-
 
107
				GetE('selHeaders').value = 'both' ;
-
 
108
			else
-
 
109
				GetE('selHeaders').value = 'row' ;
-
 
110
		}
-
 
111
		else
-
 
112
		{
-
 
113
			if (hasColumnHeaders)
-
 
114
				GetE('selHeaders').value = 'col' ;
-
 
115
			else
-
 
116
				GetE('selHeaders').value = '' ;
-
 
117
		}
89
		if ( eCaption ) document.getElementById('txtCaption').value = eCaption.innerHTML ;
118
 
90
 
119
 
91
		document.getElementById('txtRows').disabled    = true ;
120
		document.getElementById('txtRows').disabled    = true ;
92
		document.getElementById('txtColumns').disabled = true ;
121
		document.getElementById('txtColumns').disabled = true ;
93
		SelectField( 'txtWidth' ) ;
122
		SelectField( 'txtWidth' ) ;
Line 102... Line 131...
102
// Fired when the user press the OK button
131
// Fired when the user press the OK button
103
function Ok()
132
function Ok()
104
{
133
{
105
	var bExists = ( table != null ) ;
134
	var bExists = ( table != null ) ;
Line -... Line 135...
-
 
135
 
-
 
136
	var oDoc = oEditor.FCK.EditorDocument ;
-
 
137
	oEditor.FCKUndo.SaveUndoStep() ;
106
 
138
 
107
	if ( ! bExists )
139
	if ( ! bExists )
Line 108... Line 140...
108
		table = oEditor.FCK.EditorDocument.createElement( "TABLE" ) ;
140
		table = oDoc.createElement( "TABLE" ) ;
109
 
141
 
110
	// Removes the Width and Height styles
142
	// Removes the Width and Height styles
Line 127... Line 159...
127
 
159
 
128
	if ( document.getElementById('txtCaption').value != '')
160
	if ( document.getElementById('txtCaption').value != '')
129
	{
161
	{
130
		if ( !eCaption )
162
		if ( !eCaption )
131
		{
163
		{
132
			eCaption = oEditor.FCK.EditorDocument.createElement( 'CAPTION' ) ;
164
			eCaption = oDoc.createElement( 'CAPTION' ) ;
133
			table.insertBefore( eCaption, table.firstChild ) ;
165
			table.insertBefore( eCaption, table.firstChild ) ;
Line 134... Line 166...
134
		}
166
		}
135
 
167
 
Line 143... Line 175...
143
			eCaption.innerHTML = '' ;
175
			eCaption.innerHTML = '' ;
144
		else
176
		else
145
			eCaption.parentNode.removeChild( eCaption ) ;
177
			eCaption.parentNode.removeChild( eCaption ) ;
146
	}
178
	}
Line -... Line 179...
-
 
179
 
-
 
180
	var headers = GetE('selHeaders').value ;
-
 
181
	if ( bExists )
-
 
182
	{
-
 
183
		// Should we make a <thead>?
-
 
184
		if ( table.tHead==null && (headers=='row' || headers=='both') )
-
 
185
		{
-
 
186
			var oThead = table.createTHead() ;
-
 
187
			var tbody = FCKDomTools.GetFirstChild( table, 'TBODY' ) ;
-
 
188
			var theRow= FCKDomTools.GetFirstChild( tbody, 'TR' ) ;
-
 
189
 
-
 
190
			//now change TD to TH:
-
 
191
			for (var i = 0; i<theRow.childNodes.length ; i++)
-
 
192
			{
-
 
193
				var th = RenameNode(theRow.childNodes[i], 'TH') ;
-
 
194
				if (th != null)
-
 
195
					th.scope='col' ;
-
 
196
			}
-
 
197
			oThead.appendChild( theRow ) ;
-
 
198
		}
-
 
199
 
-
 
200
		if ( table.tHead!==null && !(headers=='row' || headers=='both') )
-
 
201
		{
-
 
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' ) ;
-
 
205
 
-
 
206
			var previousFirstRow = tbody.firstChild ;
-
 
207
			while ( tHead.firstChild )
-
 
208
			{
-
 
209
				var theRow = tHead.firstChild ;
-
 
210
				for (var i = 0; i < theRow.childNodes.length ; i++ )
-
 
211
				{
-
 
212
					var newCell = RenameNode( theRow.childNodes[i], 'TD' ) ;
-
 
213
					if ( newCell != null )
-
 
214
						newCell.removeAttribute( 'scope' ) ;
-
 
215
				}
-
 
216
				tbody.insertBefore( theRow, previousFirstRow ) ;
-
 
217
			}
-
 
218
			table.removeChild( tHead ) ;
-
 
219
		}
-
 
220
 
-
 
221
		// Should we make all first cells in a row TH?
-
 
222
		if ( (!hasColumnHeaders)  && (headers=='col' || headers=='both') )
-
 
223
		{
-
 
224
			for( var row=0 ; row < table.rows.length ; row++ )
-
 
225
			{
-
 
226
				var newCell = RenameNode(table.rows[row].cells[0], 'TH') ;
-
 
227
				if ( newCell != null )
-
 
228
					newCell.scope = 'row' ;
-
 
229
			}
-
 
230
		}
-
 
231
 
-
 
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') )
-
 
234
		{
-
 
235
			for( var row=0 ; row < table.rows.length ; row++ )
-
 
236
			{
-
 
237
				var oRow = table.rows[row] ;
-
 
238
				if ( oRow.parentNode.nodeName == 'TBODY' )
-
 
239
				{
-
 
240
					var newCell = RenameNode(oRow.cells[0], 'TD') ;
-
 
241
					if (newCell != null)
-
 
242
						newCell.removeAttribute( 'scope' ) ;
-
 
243
				}
-
 
244
			}
-
 
245
		}
-
 
246
	}
147
 
247
 
148
	if (! bExists)
248
	if (! bExists)
149
	{
249
	{
150
		var iRows = document.getElementById('txtRows').value ;
250
		var iRows = GetE('txtRows').value ;
Line -... Line 251...
-
 
251
		var iCols = GetE('txtColumns').value ;
-
 
252
 
151
		var iCols = document.getElementById('txtColumns').value ;
253
		var startRow = 0 ;
152
 
254
		// Should we make a <thead> ?
-
 
255
		if (headers=='row' || headers=='both')
-
 
256
		{
153
		for ( var r = 0 ; r < iRows ; r++ )
257
			startRow++ ;
-
 
258
			var oThead = table.createTHead() ;
-
 
259
			var oRow = table.insertRow(-1) ;
154
		{
260
			oThead.appendChild(oRow);
155
			var oRow = table.insertRow(-1) ;
261
 
156
			for ( var c = 0 ; c < iCols ; c++ )
262
			for ( var c = 0 ; c < iCols ; c++ )
-
 
263
			{
-
 
264
				var oThcell = oDoc.createElement( 'TH' ) ;
157
			{
265
				oThcell.scope = 'col' ;
158
				var oCell = oRow.insertCell(-1) ;
266
				oRow.appendChild( oThcell ) ;
159
				if ( oEditor.FCKBrowserInfo.IsGeckoLike )
267
				if ( oEditor.FCKBrowserInfo.IsGeckoLike )
160
					oEditor.FCKTools.AppendBogusBr( oCell ) ;
268
					oEditor.FCKTools.AppendBogusBr( oThcell ) ;
Line -... Line 269...
-
 
269
			}
-
 
270
		}
-
 
271
 
-
 
272
		// Opera automatically creates a tbody when a thead has been added
-
 
273
		var oTbody = FCKDomTools.GetFirstChild( table, 'TBODY' ) ;
-
 
274
		if ( !oTbody )
-
 
275
		{
-
 
276
			// make TBODY if it doesn't exist
-
 
277
			oTbody = oDoc.createElement( 'TBODY' ) ;
-
 
278
			table.appendChild( oTbody ) ;
-
 
279
		}
-
 
280
		for ( var r = startRow ; r < iRows; r++ )
-
 
281
		{
-
 
282
			var oRow = oDoc.createElement( 'TR' ) ;
-
 
283
			oTbody.appendChild(oRow) ;
-
 
284
 
-
 
285
			var startCol = 0 ;
-
 
286
			// Is the first column a header?
-
 
287
			if (headers=='col' || headers=='both')
-
 
288
			{
-
 
289
				var oThcell = oDoc.createElement( 'TH' ) ;
-
 
290
				oThcell.scope = 'row' ;
-
 
291
				oRow.appendChild( oThcell ) ;
-
 
292
				if ( oEditor.FCKBrowserInfo.IsGeckoLike )
-
 
293
					oEditor.FCKTools.AppendBogusBr( oThcell ) ;
-
 
294
 
-
 
295
				startCol++ ;
-
 
296
			}
-
 
297
			for ( var c = startCol ; c < iCols ; c++ )
-
 
298
			{
-
 
299
				// IE will leave the TH at the end of the row if we use now oRow.insertCell(-1)
161
			}
300
				var oCell = oDoc.createElement( 'TD' ) ;
-
 
301
				oRow.appendChild( oCell ) ;
-
 
302
				if ( oEditor.FCKBrowserInfo.IsGeckoLike )
Line 162... Line 303...
162
		}
303
					oEditor.FCKTools.AppendBogusBr( oCell ) ;
163
 
304
			}
Line 164... Line 305...
164
		oEditor.FCKUndo.SaveUndoStep() ;
305
		}
Line 176... Line 317...
176
		<tr>
317
		<tr>
177
			<td>
318
			<td>
178
				<table cellspacing="1" cellpadding="1" width="100%" border="0">
319
				<table cellspacing="1" cellpadding="1" width="100%" border="0">
179
					<tr>
320
					<tr>
180
						<td valign="top">
321
						<td valign="top">
181
							<table cellspacing="0" cellpadding="0" border="0">
322
							<table cellspacing="1" cellpadding="0" border="0">
182
								<tr>
323
								<tr>
183
									<td>
324
									<td>
184
										<span fcklang="DlgTableRows">Rows</span>:</td>
325
										<span fcklang="DlgTableRows">Rows</span>:</td>
185
									<td>
326
									<td>
186
										&nbsp;<input id="txtRows" type="text" maxlength="3" size="2" value="3" name="txtRows"
327
										&nbsp;<input id="txtRows" type="text" maxlength="3" size="2" value="3"
187
											onkeypress="return IsDigit(event);" /></td>
328
											onkeypress="return IsDigit(event);" /></td>
188
								</tr>
329
								</tr>
189
								<tr>
330
								<tr>
190
									<td>
331
									<td>
191
										<span fcklang="DlgTableColumns">Columns</span>:</td>
332
										<span fcklang="DlgTableColumns">Columns</span>:</td>
192
									<td>
333
									<td>
193
										&nbsp;<input id="txtColumns" type="text" maxlength="2" size="2" value="2" name="txtColumns"
334
										&nbsp;<input id="txtColumns" type="text" maxlength="2" size="2" value="2"
194
											onkeypress="return IsDigit(event);" /></td>
335
											onkeypress="return IsDigit(event);" /></td>
195
								</tr>
336
								</tr>
196
								<tr>
337
								<tr>
-
 
338
									<td><span fcklang="DlgTableHeaders">Headers</span>:</td>
197
									<td>
339
									<td>
198
										&nbsp;</td>
340
										&nbsp;<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>
199
									<td>
345
										</select>
200
										&nbsp;</td>
346
									</td>
201
								</tr>
347
								</tr>
202
								<tr>
348
								<tr>
203
									<td>
349
									<td>
204
										<span fcklang="DlgTableBorder">Border size</span>:</td>
350
										<span fcklang="DlgTableBorder">Border size</span>:</td>
205
									<td>
351
									<td>
206
										&nbsp;<input id="txtBorder" type="text" maxlength="2" size="2" value="1" name="txtBorder"
352
										&nbsp;<input id="txtBorder" type="text" maxlength="2" size="2" value="1"
207
											onkeypress="return IsDigit(event);" /></td>
353
											onkeypress="return IsDigit(event);" /></td>
208
								</tr>
354
								</tr>
209
								<tr>
355
								<tr>
210
									<td>
356
									<td>
211
										<span fcklang="DlgTableAlign">Alignment</span>:</td>
357
										<span fcklang="DlgTableAlign">Alignment</span>:</td>
212
									<td>
358
									<td>
213
										&nbsp;<select id="selAlignment" name="selAlignment">
359
										&nbsp;<select id="selAlignment">
214
											<option fcklang="DlgTableAlignNotSet" value="" selected="selected">&lt;Not set&gt;</option>
360
											<option fcklang="DlgTableAlignNotSet" value="" selected="selected">&lt;Not set&gt;</option>
215
											<option fcklang="DlgTableAlignLeft" value="left">Left</option>
361
											<option fcklang="DlgTableAlignLeft" value="left">Left</option>
216
											<option fcklang="DlgTableAlignCenter" value="center">Center</option>
362
											<option fcklang="DlgTableAlignCenter" value="center">Center</option>
217
											<option fcklang="DlgTableAlignRight" value="right">Right</option>
363
											<option fcklang="DlgTableAlignRight" value="right">Right</option>
218
										</select></td>
364
										</select></td>
Line 225... Line 371...
225
							<table cellspacing="0" cellpadding="0" border="0">
371
							<table cellspacing="0" cellpadding="0" border="0">
226
								<tr>
372
								<tr>
227
									<td>
373
									<td>
228
										<span fcklang="DlgTableWidth">Width</span>:</td>
374
										<span fcklang="DlgTableWidth">Width</span>:</td>
229
									<td>
375
									<td>
230
										&nbsp;<input id="txtWidth" type="text" maxlength="4" size="3" value="200" name="txtWidth"
376
										&nbsp;<input id="txtWidth" type="text" maxlength="4" size="3" value="200"
231
											onkeypress="return IsDigit(event);" /></td>
377
											onkeypress="return IsDigit(event);" /></td>
232
									<td>
378
									<td>
233
										&nbsp;<select id="selWidthType" name="selWidthType">
379
										&nbsp;<select id="selWidthType">
234
											<option fcklang="DlgTableWidthPx" value="pixels" selected="selected">pixels</option>
380
											<option fcklang="DlgTableWidthPx" value="pixels" selected="selected">pixels</option>
235
											<option fcklang="DlgTableWidthPc" value="percent">percent</option>
381
											<option fcklang="DlgTableWidthPc" value="percent">percent</option>
236
										</select></td>
382
										</select></td>
237
								</tr>
383
								</tr>
238
								<tr>
384
								<tr>
239
									<td>
385
									<td>
240
										<span fcklang="DlgTableHeight">Height</span>:</td>
386
										<span fcklang="DlgTableHeight">Height</span>:</td>
241
									<td>
387
									<td>
242
										&nbsp;<input id="txtHeight" type="text" maxlength="4" size="3" name="txtHeight" onkeypress="return IsDigit(event);" /></td>
388
										&nbsp;<input id="txtHeight" type="text" maxlength="4" size="3" onkeypress="return IsDigit(event);" /></td>
243
									<td>
389
									<td>
244
										&nbsp;<span fcklang="DlgTableWidthPx">pixels</span></td>
390
										&nbsp;<span fcklang="DlgTableWidthPx">pixels</span></td>
245
								</tr>
391
								</tr>
246
								<tr>
392
								<tr>
247
									<td>
-
 
248
										&nbsp;</td>
-
 
249
									<td>
-
 
250
										&nbsp;</td>
393
									<td colspan="3">&nbsp;</td>
251
									<td>
-
 
252
										&nbsp;</td>
-
 
253
								</tr>
394
								</tr>
254
								<tr>
395
								<tr>
255
									<td nowrap="nowrap">
396
									<td nowrap="nowrap">
256
										<span fcklang="DlgTableCellSpace">Cell spacing</span>:</td>
397
										<span fcklang="DlgTableCellSpace">Cell spacing</span>:</td>
257
									<td>
398
									<td>
258
										&nbsp;<input id="txtCellSpacing" type="text" maxlength="2" size="2" value="1" name="txtCellSpacing"
399
										&nbsp;<input id="txtCellSpacing" type="text" maxlength="2" size="2" value="1"
259
											onkeypress="return IsDigit(event);" /></td>
400
											onkeypress="return IsDigit(event);" /></td>
260
									<td>
401
									<td>
261
										&nbsp;</td>
402
										&nbsp;</td>
262
								</tr>
403
								</tr>
263
								<tr>
404
								<tr>
264
									<td nowrap="nowrap">
405
									<td nowrap="nowrap">
265
										<span fcklang="DlgTableCellPad">Cell padding</span>:</td>
406
										<span fcklang="DlgTableCellPad">Cell padding</span>:</td>
266
									<td>
407
									<td>
267
										&nbsp;<input id="txtCellPadding" type="text" maxlength="2" size="2" value="1" name="txtCellPadding"
408
										&nbsp;<input id="txtCellPadding" type="text" maxlength="2" size="2" value="1"
268
											onkeypress="return IsDigit(event);" /></td>
409
											onkeypress="return IsDigit(event);" /></td>
269
									<td>
410
									<td>
270
										&nbsp;</td>
411
										&nbsp;</td>
271
								</tr>
412
								</tr>
272
							</table>
413
							</table>