Subversion Repositories Applications.papyrus

Rev

Rev 1688 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1921 jp_milcent 1
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
1075 ddelon 2
<!--
1921 jp_milcent 3
 * FCKeditor - The text editor for Internet - http://www.fckeditor.net
4
 * Copyright (C) 2003-2008 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
 * Table dialog window.
1075 ddelon 23
-->
24
<html xmlns="http://www.w3.org/1999/xhtml">
25
<head>
26
	<title>Table Properties</title>
27
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
28
	<meta name="robots" content="noindex, nofollow" />
1921 jp_milcent 29
	<script src="common/fck_dialog_common.js" type="text/javascript"></script>
1075 ddelon 30
	<script type="text/javascript">
31
 
1921 jp_milcent 32
var dialog	= window.parent ;
33
var oEditor = dialog.InnerDialogLoaded() ;
34
var dialogArguments = dialog.Args() ;
1075 ddelon 35
 
36
// Gets the document DOM
37
var oDOM = oEditor.FCK.EditorDocument ;
38
 
39
// Gets the table if there is one selected.
40
var table ;
1921 jp_milcent 41
var e = dialog.Selection.GetSelectedElement() ;
1075 ddelon 42
 
43
if ( ( !e && document.location.search.substr(1) == 'Parent' ) || ( e && e.tagName != 'TABLE' ) )
44
	e = oEditor.FCKSelection.MoveToAncestorNode( 'TABLE' ) ;
45
 
46
if ( e && e.tagName == "TABLE" )
47
	table = e ;
48
 
49
// Fired when the window loading process is finished. It sets the fields with the
50
// actual values if a table is selected in the editor.
51
window.onload = function()
52
{
53
	// First of all, translate the dialog box texts
54
	oEditor.FCKLanguageManager.TranslatePage(document) ;
55
 
56
	if (table)
57
	{
58
		document.getElementById('txtRows').value    = table.rows.length ;
59
		document.getElementById('txtColumns').value = table.rows[0].cells.length ;
60
 
61
		// Gets the value from the Width or the Style attribute
62
		var iWidth  = (table.style.width  ? table.style.width  : table.width ) ;
63
		var iHeight = (table.style.height ? table.style.height : table.height ) ;
64
 
65
		if (iWidth.indexOf('%') >= 0)			// Percentual = %
66
		{
1921 jp_milcent 67
			iWidth = parseInt( iWidth.substr(0,iWidth.length - 1), 10 ) ;
1075 ddelon 68
			document.getElementById('selWidthType').value = "percent" ;
69
		}
70
		else if (iWidth.indexOf('px') >= 0)		// Style Pixel = px
71
		{																										  //
72
			iWidth = iWidth.substr(0,iWidth.length - 2);
73
			document.getElementById('selWidthType').value = "pixels" ;
74
		}
1921 jp_milcent 75
 
1075 ddelon 76
		if (iHeight && iHeight.indexOf('px') >= 0)		// Style Pixel = px
77
			iHeight = iHeight.substr(0,iHeight.length - 2);
1921 jp_milcent 78
 
79
		document.getElementById('txtWidth').value		= iWidth || '' ;
80
		document.getElementById('txtHeight').value		= iHeight || '' ;
81
		document.getElementById('txtBorder').value		= GetAttribute( table, 'border', '' ) ;
82
		document.getElementById('selAlignment').value	= GetAttribute( table, 'align', '' ) ;
83
		document.getElementById('txtCellPadding').value	= GetAttribute( table, 'cellPadding', '' ) ;
84
		document.getElementById('txtCellSpacing').value	= GetAttribute( table, 'cellSpacing', '' ) ;
85
		document.getElementById('txtSummary').value     = GetAttribute( table, 'summary', '' ) ;
1075 ddelon 86
//		document.getElementById('cmbFontStyle').value	= table.className ;
87
 
1921 jp_milcent 88
		var eCaption = oEditor.FCKDomTools.GetFirstChild( table, 'CAPTION' ) ;
89
		if ( eCaption ) document.getElementById('txtCaption').value = eCaption.innerHTML ;
90
 
1075 ddelon 91
		document.getElementById('txtRows').disabled    = true ;
92
		document.getElementById('txtColumns').disabled = true ;
1921 jp_milcent 93
		SelectField( 'txtWidth' ) ;
1075 ddelon 94
	}
1921 jp_milcent 95
	else
96
		SelectField( 'txtRows' ) ;
97
 
98
	dialog.SetOkButton( true ) ;
99
	dialog.SetAutoSize( true ) ;
1075 ddelon 100
}
101
 
102
// Fired when the user press the OK button
103
function Ok()
104
{
105
	var bExists = ( table != null ) ;
1921 jp_milcent 106
 
1075 ddelon 107
	if ( ! bExists )
108
		table = oEditor.FCK.EditorDocument.createElement( "TABLE" ) ;
109
 
110
	// Removes the Width and Height styles
111
	if ( bExists && table.style.width )		table.style.width = null ; //.removeAttribute("width") ;
112
	if ( bExists && table.style.height )	table.style.height = null ; //.removeAttribute("height") ;
1921 jp_milcent 113
 
114
	var sWidth = GetE('txtWidth').value ;
115
	if ( sWidth.length > 0 && GetE('selWidthType').value == 'percent' )
116
		sWidth += '%' ;
117
 
118
	SetAttribute( table, 'width'		, sWidth ) ;
119
	SetAttribute( table, 'height'		, GetE('txtHeight').value ) ;
120
	SetAttribute( table, 'border'		, GetE('txtBorder').value ) ;
121
	SetAttribute( table, 'align'		, GetE('selAlignment').value ) ;
122
	SetAttribute( table, 'cellPadding'	, GetE('txtCellPadding').value ) ;
123
	SetAttribute( table, 'cellSpacing'	, GetE('txtCellSpacing').value ) ;
124
	SetAttribute( table, 'summary'		, GetE('txtSummary').value ) ;
125
 
126
	var eCaption = oEditor.FCKDomTools.GetFirstChild( table, 'CAPTION' ) ;
127
 
1075 ddelon 128
	if ( document.getElementById('txtCaption').value != '')
129
	{
1921 jp_milcent 130
		if ( !eCaption )
131
		{
132
			eCaption = oEditor.FCK.EditorDocument.createElement( 'CAPTION' ) ;
133
			table.insertBefore( eCaption, table.firstChild ) ;
134
		}
135
 
136
		eCaption.innerHTML = document.getElementById('txtCaption').value ;
1075 ddelon 137
	}
1921 jp_milcent 138
	else if ( bExists && eCaption )
1075 ddelon 139
	{
1921 jp_milcent 140
		// TODO: It causes an IE internal error if using removeChild or
141
		// table.deleteCaption() (see #505).
142
		if ( oEditor.FCKBrowserInfo.IsIE )
143
			eCaption.innerHTML = '' ;
1075 ddelon 144
		else
1921 jp_milcent 145
			eCaption.parentNode.removeChild( eCaption ) ;
1075 ddelon 146
	}
1921 jp_milcent 147
 
1075 ddelon 148
	if (! bExists)
149
	{
150
		var iRows = document.getElementById('txtRows').value ;
151
		var iCols = document.getElementById('txtColumns').value ;
1921 jp_milcent 152
 
1075 ddelon 153
		for ( var r = 0 ; r < iRows ; r++ )
154
		{
155
			var oRow = table.insertRow(-1) ;
156
			for ( var c = 0 ; c < iCols ; c++ )
157
			{
158
				var oCell = oRow.insertCell(-1) ;
1921 jp_milcent 159
				if ( oEditor.FCKBrowserInfo.IsGeckoLike )
160
					oEditor.FCKTools.AppendBogusBr( oCell ) ;
1075 ddelon 161
			}
162
		}
1921 jp_milcent 163
 
1075 ddelon 164
		oEditor.FCKUndo.SaveUndoStep() ;
1921 jp_milcent 165
 
1075 ddelon 166
		oEditor.FCK.InsertElement( table ) ;
167
	}
1921 jp_milcent 168
 
1075 ddelon 169
	return true ;
170
}
171
 
172
	</script>
173
</head>
174
<body style="overflow: hidden">
175
	<table id="otable" cellspacing="0" cellpadding="0" width="100%" border="0" style="height: 100%">
176
		<tr>
177
			<td>
178
				<table cellspacing="1" cellpadding="1" width="100%" border="0">
179
					<tr>
180
						<td valign="top">
181
							<table cellspacing="0" cellpadding="0" border="0">
182
								<tr>
183
									<td>
184
										<span fcklang="DlgTableRows">Rows</span>:</td>
185
									<td>
186
										&nbsp;<input id="txtRows" type="text" maxlength="3" size="2" value="3" name="txtRows"
187
											onkeypress="return IsDigit(event);" /></td>
188
								</tr>
189
								<tr>
190
									<td>
191
										<span fcklang="DlgTableColumns">Columns</span>:</td>
192
									<td>
193
										&nbsp;<input id="txtColumns" type="text" maxlength="2" size="2" value="2" name="txtColumns"
194
											onkeypress="return IsDigit(event);" /></td>
195
								</tr>
196
								<tr>
197
									<td>
198
										&nbsp;</td>
199
									<td>
200
										&nbsp;</td>
201
								</tr>
202
								<tr>
203
									<td>
204
										<span fcklang="DlgTableBorder">Border size</span>:</td>
205
									<td>
206
										&nbsp;<input id="txtBorder" type="text" maxlength="2" size="2" value="1" name="txtBorder"
207
											onkeypress="return IsDigit(event);" /></td>
208
								</tr>
209
								<tr>
210
									<td>
211
										<span fcklang="DlgTableAlign">Alignment</span>:</td>
212
									<td>
213
										&nbsp;<select id="selAlignment" name="selAlignment">
214
											<option fcklang="DlgTableAlignNotSet" value="" selected="selected">&lt;Not set&gt;</option>
215
											<option fcklang="DlgTableAlignLeft" value="left">Left</option>
216
											<option fcklang="DlgTableAlignCenter" value="center">Center</option>
217
											<option fcklang="DlgTableAlignRight" value="right">Right</option>
218
										</select></td>
219
								</tr>
220
							</table>
221
						</td>
222
						<td>
223
							&nbsp;&nbsp;&nbsp;</td>
224
						<td align="right" valign="top">
225
							<table cellspacing="0" cellpadding="0" border="0">
226
								<tr>
227
									<td>
228
										<span fcklang="DlgTableWidth">Width</span>:</td>
229
									<td>
230
										&nbsp;<input id="txtWidth" type="text" maxlength="4" size="3" value="200" name="txtWidth"
231
											onkeypress="return IsDigit(event);" /></td>
232
									<td>
233
										&nbsp;<select id="selWidthType" name="selWidthType">
234
											<option fcklang="DlgTableWidthPx" value="pixels" selected="selected">pixels</option>
235
											<option fcklang="DlgTableWidthPc" value="percent">percent</option>
236
										</select></td>
237
								</tr>
238
								<tr>
239
									<td>
240
										<span fcklang="DlgTableHeight">Height</span>:</td>
241
									<td>
242
										&nbsp;<input id="txtHeight" type="text" maxlength="4" size="3" name="txtHeight" onkeypress="return IsDigit(event);" /></td>
243
									<td>
244
										&nbsp;<span fcklang="DlgTableWidthPx">pixels</span></td>
245
								</tr>
246
								<tr>
247
									<td>
248
										&nbsp;</td>
249
									<td>
250
										&nbsp;</td>
251
									<td>
252
										&nbsp;</td>
253
								</tr>
254
								<tr>
255
									<td nowrap="nowrap">
256
										<span fcklang="DlgTableCellSpace">Cell spacing</span>:</td>
257
									<td>
258
										&nbsp;<input id="txtCellSpacing" type="text" maxlength="2" size="2" value="1" name="txtCellSpacing"
259
											onkeypress="return IsDigit(event);" /></td>
260
									<td>
261
										&nbsp;</td>
262
								</tr>
263
								<tr>
264
									<td nowrap="nowrap">
265
										<span fcklang="DlgTableCellPad">Cell padding</span>:</td>
266
									<td>
267
										&nbsp;<input id="txtCellPadding" type="text" maxlength="2" size="2" value="1" name="txtCellPadding"
268
											onkeypress="return IsDigit(event);" /></td>
269
									<td>
270
										&nbsp;</td>
271
								</tr>
272
							</table>
273
						</td>
274
					</tr>
275
				</table>
276
				<table cellspacing="0" cellpadding="0" width="100%" border="0">
277
					<tr>
278
						<td nowrap="nowrap">
279
							<span fcklang="DlgTableCaption">Caption</span>:&nbsp;</td>
280
						<td>
281
							&nbsp;</td>
282
						<td width="100%" nowrap="nowrap">
283
							<input id="txtCaption" type="text" style="width: 100%" /></td>
284
					</tr>
285
					<tr>
286
						<td nowrap="nowrap">
287
							<span fcklang="DlgTableSummary">Summary</span>:&nbsp;</td>
288
						<td>
289
							&nbsp;</td>
290
						<td width="100%" nowrap="nowrap">
291
							<input id="txtSummary" type="text" style="width: 100%" /></td>
292
					</tr>
293
				</table>
294
			</td>
295
		</tr>
296
	</table>
297
</body>
298
</html>