source: trunk/admin/inc/FCKeditor/editor/dialog/fck_table.html@ 22

Last change on this file since 22 was 2, checked in by root, 15 years ago

importo il progetto

File size: 10.4 KB
Line 
1<!--
2 * FCKeditor - The text editor for internet
3 * Copyright (C) 2003-2006 Frederico Caldeira Knabben
4 *
5 * Licensed under the terms of the GNU Lesser General Public License:
6 * http://www.opensource.org/licenses/lgpl-license.php
7 *
8 * For further information visit:
9 * http://www.fckeditor.net/
10 *
11 * "Support Open Source software. What about a donation today?"
12 *
13 * File Name: fck_table.html
14 * Table dialog window.
15 *
16 * File Authors:
17 * Frederico Caldeira Knabben (fredck@fckeditor.net)
18-->
19<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
20<html xmlns="http://www.w3.org/1999/xhtml">
21<head>
22 <title>Table Properties</title>
23 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
24 <meta name="robots" content="noindex, nofollow" />
25 <script type="text/javascript">
26
27var oEditor = window.parent.InnerDialogLoaded() ;
28
29// Gets the document DOM
30var oDOM = oEditor.FCK.EditorDocument ;
31
32// Gets the table if there is one selected.
33var table ;
34var e = oEditor.FCKSelection.GetSelectedElement() ;
35
36if ( ( !e && document.location.search.substr(1) == 'Parent' ) || ( e && e.tagName != 'TABLE' ) )
37 e = oEditor.FCKSelection.MoveToAncestorNode( 'TABLE' ) ;
38
39if ( e && e.tagName == "TABLE" )
40 table = e ;
41
42// Fired when the window loading process is finished. It sets the fields with the
43// actual values if a table is selected in the editor.
44window.onload = function()
45{
46 // First of all, translate the dialog box texts
47 oEditor.FCKLanguageManager.TranslatePage(document) ;
48
49 if (table)
50 {
51 document.getElementById('txtRows').value = table.rows.length ;
52 document.getElementById('txtColumns').value = table.rows[0].cells.length ;
53
54 // Gets the value from the Width or the Style attribute
55 var iWidth = (table.style.width ? table.style.width : table.width ) ;
56 var iHeight = (table.style.height ? table.style.height : table.height ) ;
57
58 if (iWidth.indexOf('%') >= 0) // Percentual = %
59 {
60 iWidth = parseInt( iWidth.substr(0,iWidth.length - 1) ) ;
61 document.getElementById('selWidthType').value = "percent" ;
62 }
63 else if (iWidth.indexOf('px') >= 0) // Style Pixel = px
64 { //
65 iWidth = iWidth.substr(0,iWidth.length - 2);
66 document.getElementById('selWidthType').value = "pixels" ;
67 }
68
69 if (iHeight && iHeight.indexOf('px') >= 0) // Style Pixel = px
70 iHeight = iHeight.substr(0,iHeight.length - 2);
71
72 document.getElementById('txtWidth').value = iWidth ;
73 document.getElementById('txtHeight').value = iHeight ;
74 document.getElementById('txtBorder').value = table.border ;
75 document.getElementById('selAlignment').value = table.align ;
76 document.getElementById('txtCellPadding').value = table.cellPadding ;
77 document.getElementById('txtCellSpacing').value = table.cellSpacing ;
78 document.getElementById('txtSummary').value = table.summary;
79// document.getElementById('cmbFontStyle').value = table.className ;
80
81 if (table.caption) document.getElementById('txtCaption').value = table.caption.innerHTML ;
82
83 document.getElementById('txtRows').disabled = true ;
84 document.getElementById('txtColumns').disabled = true ;
85 }
86
87 window.parent.SetOkButton( true ) ;
88 window.parent.SetAutoSize( true ) ;
89}
90
91// Fired when the user press the OK button
92function Ok()
93{
94 var bExists = ( table != null ) ;
95
96 if ( ! bExists )
97 {
98 table = oEditor.FCK.EditorDocument.createElement( "TABLE" ) ;
99 }
100
101 // Removes the Width and Height styles
102 if ( bExists && table.style.width ) table.style.width = null ; //.removeAttribute("width") ;
103 if ( bExists && table.style.height ) table.style.height = null ; //.removeAttribute("height") ;
104
105 table.width = document.getElementById('txtWidth').value + ( document.getElementById('selWidthType').value == "percent" ? "%" : "") ;
106 table.height = document.getElementById('txtHeight').value ;
107 table.border = document.getElementById('txtBorder').value ;
108 table.align = document.getElementById('selAlignment').value ;
109 table.cellPadding = document.getElementById('txtCellPadding').value ;
110 table.cellSpacing = document.getElementById('txtCellSpacing').value ;
111 table.summary = document.getElementById('txtSummary').value ;
112// table.className = cmbFontStyle.value ;
113
114 if ( document.getElementById('txtCaption').value != '')
115 {
116 if (! table.caption) table.createCaption() ;
117 table.caption.innerHTML = document.getElementById('txtCaption').value ;
118 }
119 else if ( bExists && table.caption )
120 {
121 if ( document.all )
122 table.caption.innerHTML = '' ; // TODO: It causes an IE internal error if using removeChild.
123 else
124 table.caption.parentNode.removeChild( table.caption ) ;
125 }
126
127 if (! bExists)
128 {
129 var iRows = document.getElementById('txtRows').value ;
130 var iCols = document.getElementById('txtColumns').value ;
131
132 for ( var r = 0 ; r < iRows ; r++ )
133 {
134 var oRow = table.insertRow(-1) ;
135 for ( var c = 0 ; c < iCols ; c++ )
136 {
137 var oCell = oRow.insertCell(-1) ;
138 if ( oEditor.FCKBrowserInfo.IsGecko )
139 oCell.innerHTML = '<br _moz_editor_bogus_node="TRUE">' ;
140 //oCell.innerHTML = "&nbsp;" ;
141 }
142 }
143
144 oEditor.FCKUndo.SaveUndoStep() ;
145
146 // START iCM MODIFICATIONS
147 // Amended to ensure that newly inserted tables are not incorrectly nested in P tags, etc
148 // We insert the table first and then rectify any nestings afterwards so we can re-use the
149 // FCKTablesProcessor function that corrects tables on SetHTML()
150 /*
151 table = oEditor.FCK.InsertElementAndGetIt( table ) ;
152 if ( !oEditor.FCKConfig.UseBROnCarriageReturn )
153 {
154 oEditor.FCKTablesProcessor.CheckTableNesting( table ) ;
155 }
156 */
157 // END iCM MODIFICATIONS
158
159 oEditor.FCK.InsertElement( table ) ;
160 }
161
162 return true ;
163}
164
165function IsDigit( e )
166{
167 e = e || event ;
168 var iCode = ( e.keyCode || e.charCode ) ;
169 return
170 (
171 ( iCode >= 48 && iCode <= 57 ) // Numbers
172 || (iCode >= 37 && iCode <= 40) // Arrows
173 || iCode == 8 // Backspace
174 || iCode == 46 // Delete
175 ) ;
176}
177
178 </script>
179</head>
180<body style="overflow: hidden">
181 <table id="otable" cellspacing="0" cellpadding="0" width="100%" border="0" style="height: 100%">
182 <tr>
183 <td>
184 <table cellspacing="1" cellpadding="1" width="100%" border="0">
185 <tr>
186 <td valign="top">
187 <table cellspacing="0" cellpadding="0" border="0">
188 <tr>
189 <td>
190 <span fcklang="DlgTableRows">Rows</span>:</td>
191 <td>
192 &nbsp;<input id="txtRows" type="text" maxlength="3" size="2" value="3" name="txtRows"
193 onkeypress="return IsDigit(event);" /></td>
194 </tr>
195 <tr>
196 <td>
197 <span fcklang="DlgTableColumns">Columns</span>:</td>
198 <td>
199 &nbsp;<input id="txtColumns" type="text" maxlength="2" size="2" value="2" name="txtColumns"
200 onkeypress="return IsDigit(event);" /></td>
201 </tr>
202 <tr>
203 <td>
204 &nbsp;</td>
205 <td>
206 &nbsp;</td>
207 </tr>
208 <tr>
209 <td>
210 <span fcklang="DlgTableBorder">Border size</span>:</td>
211 <td>
212 &nbsp;<input id="txtBorder" type="text" maxlength="2" size="2" value="1" name="txtBorder"
213 onkeypress="return IsDigit(event);" /></td>
214 </tr>
215 <tr>
216 <td>
217 <span fcklang="DlgTableAlign">Alignment</span>:</td>
218 <td>
219 &nbsp;<select id="selAlignment" name="selAlignment">
220 <option fcklang="DlgTableAlignNotSet" value="" selected="selected">&lt;Not set&gt;</option>
221 <option fcklang="DlgTableAlignLeft" value="left">Left</option>
222 <option fcklang="DlgTableAlignCenter" value="center">Center</option>
223 <option fcklang="DlgTableAlignRight" value="right">Right</option>
224 </select></td>
225 </tr>
226 </table>
227 </td>
228 <td>
229 &nbsp;&nbsp;&nbsp;</td>
230 <td align="right" valign="top">
231 <table cellspacing="0" cellpadding="0" border="0">
232 <tr>
233 <td>
234 <span fcklang="DlgTableWidth">Width</span>:</td>
235 <td>
236 &nbsp;<input id="txtWidth" type="text" maxlength="4" size="3" value="200" name="txtWidth"
237 onkeypress="return IsDigit(event);" /></td>
238 <td>
239 &nbsp;<select id="selWidthType" name="selWidthType">
240 <option fcklang="DlgTableWidthPx" value="pixels" selected="selected">pixels</option>
241 <option fcklang="DlgTableWidthPc" value="percent">percent</option>
242 </select></td>
243 </tr>
244 <tr>
245 <td>
246 <span fcklang="DlgTableHeight">Height</span>:</td>
247 <td>
248 &nbsp;<input id="txtHeight" type="text" maxlength="4" size="3" name="txtHeight" onkeypress="return IsDigit(event);" /></td>
249 <td>
250 &nbsp;<span fcklang="DlgTableWidthPx">pixels</span></td>
251 </tr>
252 <tr>
253 <td>
254 &nbsp;</td>
255 <td>
256 &nbsp;</td>
257 <td>
258 &nbsp;</td>
259 </tr>
260 <tr>
261 <td nowrap="nowrap">
262 <span fcklang="DlgTableCellSpace">Cell spacing</span>:</td>
263 <td>
264 &nbsp;<input id="txtCellSpacing" type="text" maxlength="2" size="2" value="1" name="txtCellSpacing"
265 onkeypress="return IsDigit(event);" /></td>
266 <td>
267 &nbsp;</td>
268 </tr>
269 <tr>
270 <td nowrap="nowrap">
271 <span fcklang="DlgTableCellPad">Cell padding</span>:</td>
272 <td>
273 &nbsp;<input id="txtCellPadding" type="text" maxlength="2" size="2" value="1" name="txtCellPadding"
274 onkeypress="return IsDigit(event);" /></td>
275 <td>
276 &nbsp;</td>
277 </tr>
278 </table>
279 </td>
280 </tr>
281 </table>
282 <table cellspacing="0" cellpadding="0" width="100%" border="0">
283 <!--
284 <tr>
285 <td nowrap>
286 <span fcklang="DlgClassName">Class Name</span>:</td>
287 <td>&nbsp;</td>
288 <td>
289 <script type="text/javascript">
290// var tbstyles = new TBCombo( "FontStyle" , "null" , "", oEditor.config.StyleNames, oEditor.config.StyleValues, 'CheckStyle("cmbFontStyle")');
291// document.write(tbstyles.GetHTML());
292 </script></td>
293 </tr>
294 -->
295 <tr>
296 <td nowrap="nowrap">
297 <span fcklang="DlgTableCaption">Caption</span>:&nbsp;</td>
298 <td>
299 &nbsp;</td>
300 <td width="100%" nowrap="nowrap">
301 <input id="txtCaption" type="text" style="width: 100%" /></td>
302 </tr>
303 <tr>
304 <td nowrap="nowrap">
305 <span fcklang="DlgTableSummary">Summary</span>:&nbsp;</td>
306 <td>
307 &nbsp;</td>
308 <td width="100%" nowrap="nowrap">
309 <input id="txtSummary" type="text" style="width: 100%" /></td>
310 </tr>
311 </table>
312 </td>
313 </tr>
314 </table>
315</body>
316</html>
Note: See TracBrowser for help on using the repository browser.