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-2007 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. |
---|
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" /> |
---|
29 | <script src="common/fck_dialog_common.js" type="text/javascript"></script> |
---|
30 | <script type="text/javascript"> |
---|
31 | |
---|
32 | var oEditor = window.parent.InnerDialogLoaded() ; |
---|
33 | |
---|
34 | // Gets the document DOM |
---|
35 | var oDOM = oEditor.FCK.EditorDocument ; |
---|
36 | |
---|
37 | // Gets the table if there is one selected. |
---|
38 | var table ; |
---|
39 | var e = oEditor.FCKSelection.GetSelectedElement() ; |
---|
40 | |
---|
41 | if ( ( !e && document.location.search.substr(1) == 'Parent' ) || ( e && e.tagName != 'TABLE' ) ) |
---|
42 | e = oEditor.FCKSelection.MoveToAncestorNode( 'TABLE' ) ; |
---|
43 | |
---|
44 | if ( e && e.tagName == "TABLE" ) |
---|
45 | table = e ; |
---|
46 | |
---|
47 | // Fired when the window loading process is finished. It sets the fields with the |
---|
48 | // actual values if a table is selected in the editor. |
---|
49 | window.onload = function() |
---|
50 | { |
---|
51 | // First of all, translate the dialog box texts |
---|
52 | oEditor.FCKLanguageManager.TranslatePage(document) ; |
---|
53 | |
---|
54 | if (table) |
---|
55 | { |
---|
56 | document.getElementById('txtRows').value = table.rows.length ; |
---|
57 | document.getElementById('txtColumns').value = table.rows[0].cells.length ; |
---|
58 | |
---|
59 | // Gets the value from the Width or the Style attribute |
---|
60 | var iWidth = (table.style.width ? table.style.width : table.width ) ; |
---|
61 | var iHeight = (table.style.height ? table.style.height : table.height ) ; |
---|
62 | |
---|
63 | if (iWidth.indexOf('%') >= 0) // Percentual = % |
---|
64 | { |
---|
65 | iWidth = parseInt( iWidth.substr(0,iWidth.length - 1), 10 ) ; |
---|
66 | document.getElementById('selWidthType').value = "percent" ; |
---|
67 | } |
---|
68 | else if (iWidth.indexOf('px') >= 0) // Style Pixel = px |
---|
69 | { |
---|
70 | iWidth = iWidth.substr(0,iWidth.length - 2); |
---|
71 | document.getElementById('selWidthType').value = "pixels" ; |
---|
72 | } |
---|
73 | |
---|
74 | if (iHeight && iHeight.indexOf('px') >= 0) // Style Pixel = px |
---|
75 | iHeight = iHeight.substr(0,iHeight.length - 2); |
---|
76 | |
---|
77 | document.getElementById('txtWidth').value = iWidth || '' ; |
---|
78 | document.getElementById('txtHeight').value = iHeight || '' ; |
---|
79 | // document.getElementById('txtBorder').value = GetAttribute( table, 'border', '' ) ; |
---|
80 | document.getElementById('selAlignment').value = GetAttribute( table, 'align', '' ) ; |
---|
81 | document.getElementById('txtCellPadding').value = GetAttribute( table, 'cellPadding', '' ) ; |
---|
82 | document.getElementById('txtCellSpacing').value = GetAttribute( table, 'cellSpacing', '' ) ; |
---|
83 | document.getElementById('txtSummary').value = GetAttribute( table, 'summary', '' ) ; |
---|
84 | // document.getElementById('cmbFontStyle').value = table.className ; |
---|
85 | |
---|
86 | var eCaption = oEditor.FCKDomTools.GetFirstChild( table, 'CAPTION' ) ; |
---|
87 | if ( eCaption ) document.getElementById('txtCaption').value = eCaption.innerHTML ; |
---|
88 | |
---|
89 | document.getElementById('txtRows').disabled = true ; |
---|
90 | document.getElementById('txtColumns').disabled = true ; |
---|
91 | |
---|
92 | // Styles added by ESTAN |
---|
93 | document.getElementById('txtBorder').value = table.style.borderWidth.substr(0,table.style.borderWidth.length - 2) ; |
---|
94 | document.getElementById('txtBorderColor').value = table.style.borderColor ; |
---|
95 | document.getElementById('selBorderStyle').value = table.style.borderStyle ; |
---|
96 | document.getElementById('txtBackColor').value = table.style.backgroundColor ; |
---|
97 | } |
---|
98 | |
---|
99 | window.parent.SetOkButton( true ) ; |
---|
100 | window.parent.SetAutoSize( true ) ; |
---|
101 | } |
---|
102 | |
---|
103 | // Fired when the user press the OK button |
---|
104 | function Ok() |
---|
105 | { |
---|
106 | var bExists = ( table != null ) ; |
---|
107 | |
---|
108 | if ( ! bExists ) |
---|
109 | table = oEditor.FCK.EditorDocument.createElement( "TABLE" ) ; |
---|
110 | |
---|
111 | // Removes the Width and Height styles |
---|
112 | if ( bExists && table.style.width ) table.style.width = null ; //.removeAttribute("width") ; |
---|
113 | if ( bExists && table.style.height ) table.style.height = null ; //.removeAttribute("height") ; |
---|
114 | |
---|
115 | var sWidth = GetE('txtWidth').value ; |
---|
116 | if ( sWidth.length > 0 && GetE('selWidthType').value == 'percent' ) |
---|
117 | sWidth += '%' ; |
---|
118 | |
---|
119 | SetAttribute( table, 'width' , sWidth ) ; |
---|
120 | SetAttribute( table, 'height' , GetE('txtHeight').value ) ; |
---|
121 | // SetAttribute( table, 'border' , GetE('txtBorder').value ) ; |
---|
122 | SetAttribute( table, 'align' , GetE('selAlignment').value ) ; |
---|
123 | SetAttribute( table, 'cellPadding' , GetE('txtCellPadding').value ) ; |
---|
124 | SetAttribute( table, 'cellSpacing' , GetE('txtCellSpacing').value ) ; |
---|
125 | SetAttribute( table, 'summary' , GetE('txtSummary').value ) ; |
---|
126 | |
---|
127 | // Styles added by ESTAN |
---|
128 | if ( GetE('txtBackColor').value.length > 0 ) |
---|
129 | table.style.backgroundColor = GetE('txtBackColor').value ; |
---|
130 | else |
---|
131 | table.style.backgroundColor = null ; |
---|
132 | |
---|
133 | table.style.borderStyle = GetE('selBorderStyle').value ; |
---|
134 | |
---|
135 | if ( GetE('txtBorder').value.length > 0 ) |
---|
136 | table.style.borderWidth = GetE('txtBorder').value + "px" ; |
---|
137 | else |
---|
138 | table.style.borderWidth = null ; |
---|
139 | |
---|
140 | if ( GetE('txtBorderColor').value.length > 0 ) |
---|
141 | table.style.borderColor = GetE('txtBorderColor').value ; |
---|
142 | else |
---|
143 | table.style.borderColor = null ; |
---|
144 | |
---|
145 | var eCaption = oEditor.FCKDomTools.GetFirstChild( table, 'CAPTION' ) ; |
---|
146 | |
---|
147 | if ( document.getElementById('txtCaption').value != '') |
---|
148 | { |
---|
149 | if ( !eCaption ) |
---|
150 | { |
---|
151 | eCaption = oEditor.FCK.EditorDocument.createElement( 'CAPTION' ) ; |
---|
152 | table.insertBefore( eCaption, table.firstChild ) ; |
---|
153 | } |
---|
154 | |
---|
155 | eCaption.innerHTML = document.getElementById('txtCaption').value ; |
---|
156 | } |
---|
157 | else if ( bExists && eCaption ) |
---|
158 | { |
---|
159 | // TODO: It causes an IE internal error if using removeChild or |
---|
160 | // table.deleteCaption() (see #505). |
---|
161 | if ( oEditor.FCKBrowserInfo.IsIE ) |
---|
162 | eCaption.innerHTML = '' ; |
---|
163 | else |
---|
164 | eCaption.parentNode.removeChild( eCaption ) ; |
---|
165 | } |
---|
166 | |
---|
167 | if (! bExists) |
---|
168 | { |
---|
169 | var iRows = document.getElementById('txtRows').value ; |
---|
170 | var iCols = document.getElementById('txtColumns').value ; |
---|
171 | |
---|
172 | for ( var r = 0 ; r < iRows ; r++ ) |
---|
173 | { |
---|
174 | var oRow = table.insertRow(-1) ; |
---|
175 | for ( var c = 0 ; c < iCols ; c++ ) |
---|
176 | { |
---|
177 | var oCell = oRow.insertCell(-1) ; |
---|
178 | if ( oEditor.FCKBrowserInfo.IsGeckoLike ) |
---|
179 | oEditor.FCKTools.AppendBogusBr( oCell ) ; |
---|
180 | } |
---|
181 | } |
---|
182 | |
---|
183 | oEditor.FCKUndo.SaveUndoStep() ; |
---|
184 | |
---|
185 | oEditor.FCK.InsertElement( table ) ; |
---|
186 | } |
---|
187 | |
---|
188 | return true ; |
---|
189 | } |
---|
190 | |
---|
191 | function SelectBackColor( color ) |
---|
192 | { |
---|
193 | if ( color && color.length > 0 ) |
---|
194 | GetE('txtBackColor').value = color ; |
---|
195 | } |
---|
196 | |
---|
197 | function SelectBorderColor( color ) |
---|
198 | { |
---|
199 | if ( color && color.length > 0 ) |
---|
200 | GetE('txtBorderColor').value = color ; |
---|
201 | } |
---|
202 | |
---|
203 | function SelectColor( wich ) |
---|
204 | { |
---|
205 | oEditor.FCKDialog.OpenDialog( 'FCKDialog_Color', oEditor.FCKLang.DlgColorTitle, 'dialog/fck_colorselector.html', 400, 330, wich == 'Back' ? SelectBackColor : SelectBorderColor, window ) ; |
---|
206 | } |
---|
207 | |
---|
208 | </script> |
---|
209 | </head> |
---|
210 | <body style="overflow: hidden"> |
---|
211 | <table id="otable" cellspacing="0" cellpadding="0" width="100%" border="0" style="height: 100%"> |
---|
212 | <tr> |
---|
213 | <td> |
---|
214 | <table cellspacing="1" cellpadding="1" width="100%" border="0"> |
---|
215 | <tr> |
---|
216 | <td valign="top"> |
---|
217 | <table cellspacing="0" cellpadding="0" border="0"> |
---|
218 | <tr> |
---|
219 | <td> |
---|
220 | <span fcklang="DlgTableRows">Rows</span>:</td> |
---|
221 | <td colspan="2"> |
---|
222 | <input id="txtRows" type="text" maxlength="3" size="2" value="3" name="txtRows" |
---|
223 | onkeypress="return IsDigit(event);" /></td> |
---|
224 | </tr> |
---|
225 | <tr> |
---|
226 | <td> |
---|
227 | <span fcklang="DlgTableColumns">Columns</span>:</td> |
---|
228 | <td colspan="2"> |
---|
229 | <input id="txtColumns" type="text" maxlength="2" size="2" value="2" name="txtColumns" |
---|
230 | onkeypress="return IsDigit(event);" /></td> |
---|
231 | </tr> |
---|
232 | <tr> |
---|
233 | <td> |
---|
234 | </td> |
---|
235 | <td colspan="2"> |
---|
236 | </td> |
---|
237 | </tr> |
---|
238 | <tr> |
---|
239 | <td> |
---|
240 | <span fcklang="DlgTableBorder">Border size</span>:</td> |
---|
241 | <td colspan="2"> |
---|
242 | <input id="txtBorder" type="text" maxlength="2" size="2" value="1" name="txtBorder" |
---|
243 | onkeypress="return IsDigit(event);" /> <span fcklang="DlgTableWidthPx">pixels</span></td> |
---|
244 | </tr> |
---|
245 | <tr> |
---|
246 | <td nowrap="nowrap"> |
---|
247 | <span fcklang="DlgCellBorderColor">Border Color</span>:</td> |
---|
248 | <td> |
---|
249 | <input id="txtBorderColor" type="text" size="8" name="txtBorderColor" /></td> |
---|
250 | <td> |
---|
251 | |
---|
252 | <input type="button" fcklang="DlgCellBtnSelect" value="Select..." onclick="SelectColor( 'Border' )" /></td> |
---|
253 | </tr> |
---|
254 | <tr> |
---|
255 | <td nowrap="nowrap"> |
---|
256 | <span fcklang="DlgTableBorderStyle">Border Style</span>:</td> |
---|
257 | <td colspan="2"> |
---|
258 | <select id="selBorderStyle" name="selBorderStyle"> |
---|
259 | <option value="none" selected="selected">None</option> |
---|
260 | <option value="hidden">Hidden</option> |
---|
261 | <option value="dotted">Dotted</option> |
---|
262 | <option value="dashed">Dashed</option> |
---|
263 | <option value="solid">Solid</option> |
---|
264 | <option value="double">Double</option> |
---|
265 | <option value="groove">Groove</option> |
---|
266 | <option value="ridge">Ridge</option> |
---|
267 | <option value="inset">Inset</option> |
---|
268 | <option value="outset">Outset</option> |
---|
269 | </select></td> |
---|
270 | |
---|
271 | </tr> |
---|
272 | <tr> |
---|
273 | <td nowrap="nowrap"> |
---|
274 | <span fcklang="DlgCellBackColor">Background Color</span>:</td> |
---|
275 | <td> |
---|
276 | <input id="txtBackColor" type="text" size="8" name="txtBackColor"></td> |
---|
277 | <td> |
---|
278 | |
---|
279 | <input type="button" fcklang="DlgCellBtnSelect" value="Select..." onclick="SelectColor( 'Back' )"></td> |
---|
280 | </tr> |
---|
281 | <tr> |
---|
282 | <td> |
---|
283 | <span fcklang="DlgTableAlign">Alignment</span>:</td> |
---|
284 | <td> |
---|
285 | <select id="selAlignment" name="selAlignment"> |
---|
286 | <option fcklang="DlgTableAlignNotSet" value="" selected="selected"><Not set></option> |
---|
287 | <option fcklang="DlgTableAlignLeft" value="left">Left</option> |
---|
288 | <option fcklang="DlgTableAlignCenter" value="center">Center</option> |
---|
289 | <option fcklang="DlgTableAlignRight" value="right">Right</option> |
---|
290 | </select></td> |
---|
291 | </tr> |
---|
292 | </table> |
---|
293 | </td> |
---|
294 | <td> |
---|
295 | </td> |
---|
296 | <td align="right" valign="top"> |
---|
297 | <table cellspacing="0" cellpadding="0" border="0"> |
---|
298 | <tr> |
---|
299 | <td> |
---|
300 | <span fcklang="DlgTableWidth">Width</span>:</td> |
---|
301 | <td> |
---|
302 | <input id="txtWidth" type="text" maxlength="4" size="3" value="200" name="txtWidth" |
---|
303 | onkeypress="return IsDigit(event);" /></td> |
---|
304 | <td> |
---|
305 | <select id="selWidthType" name="selWidthType"> |
---|
306 | <option fcklang="DlgTableWidthPx" value="pixels" selected="selected">pixels</option> |
---|
307 | <option fcklang="DlgTableWidthPc" value="percent">percent</option> |
---|
308 | </select></td> |
---|
309 | </tr> |
---|
310 | <tr> |
---|
311 | <td> |
---|
312 | <span fcklang="DlgTableHeight">Height</span>:</td> |
---|
313 | <td> |
---|
314 | <input id="txtHeight" type="text" maxlength="4" size="3" name="txtHeight" onkeypress="return IsDigit(event);" /></td> |
---|
315 | <td> |
---|
316 | <span fcklang="DlgTableWidthPx">pixels</span></td> |
---|
317 | </tr> |
---|
318 | <tr> |
---|
319 | <td> |
---|
320 | </td> |
---|
321 | <td> |
---|
322 | </td> |
---|
323 | <td> |
---|
324 | </td> |
---|
325 | </tr> |
---|
326 | <tr> |
---|
327 | <td nowrap="nowrap"> |
---|
328 | <span fcklang="DlgTableCellSpace">Cell spacing</span>:</td> |
---|
329 | <td> |
---|
330 | <input id="txtCellSpacing" type="text" maxlength="2" size="2" value="1" name="txtCellSpacing" |
---|
331 | onkeypress="return IsDigit(event);" /></td> |
---|
332 | <td> |
---|
333 | </td> |
---|
334 | </tr> |
---|
335 | <tr> |
---|
336 | <td nowrap="nowrap"> |
---|
337 | <span fcklang="DlgTableCellPad">Cell padding</span>:</td> |
---|
338 | <td> |
---|
339 | <input id="txtCellPadding" type="text" maxlength="2" size="2" value="1" name="txtCellPadding" |
---|
340 | onkeypress="return IsDigit(event);" /></td> |
---|
341 | <td> |
---|
342 | </td> |
---|
343 | </tr> |
---|
344 | </table> |
---|
345 | </td> |
---|
346 | </tr> |
---|
347 | </table> |
---|
348 | <table cellspacing="0" cellpadding="0" width="100%" border="0"> |
---|
349 | <tr> |
---|
350 | <td nowrap="nowrap"> |
---|
351 | <span fcklang="DlgTableCaption">Caption</span>: </td> |
---|
352 | <td> |
---|
353 | </td> |
---|
354 | <td width="100%" nowrap="nowrap"> |
---|
355 | <input id="txtCaption" type="text" style="width: 100%" /></td> |
---|
356 | </tr> |
---|
357 | <tr> |
---|
358 | <td nowrap="nowrap"> |
---|
359 | <span fcklang="DlgTableSummary">Summary</span>: </td> |
---|
360 | <td> |
---|
361 | </td> |
---|
362 | <td width="100%" nowrap="nowrap"> |
---|
363 | <input id="txtSummary" type="text" style="width: 100%" /></td> |
---|
364 | </tr> |
---|
365 | </table> |
---|
366 | </td> |
---|
367 | </tr> |
---|
368 | </table> |
---|
369 | </body> |
---|
370 | </html> |
---|