[795] | 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 | if (table.caption) document.getElementById('txtCaption').value = table.caption.innerHTML ; |
---|
| 87 | |
---|
| 88 | document.getElementById('txtRows').disabled = true ; |
---|
| 89 | document.getElementById('txtColumns').disabled = true ; |
---|
| 90 | } |
---|
| 91 | |
---|
| 92 | window.parent.SetOkButton( true ) ; |
---|
| 93 | window.parent.SetAutoSize( true ) ; |
---|
| 94 | } |
---|
| 95 | |
---|
| 96 | // Fired when the user press the OK button |
---|
| 97 | function Ok() |
---|
| 98 | { |
---|
| 99 | var bExists = ( table != null ) ; |
---|
| 100 | |
---|
| 101 | if ( ! bExists ) |
---|
| 102 | table = oEditor.FCK.EditorDocument.createElement( "TABLE" ) ; |
---|
| 103 | |
---|
| 104 | // Removes the Width and Height styles |
---|
| 105 | if ( bExists && table.style.width ) table.style.width = null ; //.removeAttribute("width") ; |
---|
| 106 | if ( bExists && table.style.height ) table.style.height = null ; //.removeAttribute("height") ; |
---|
| 107 | |
---|
| 108 | var sWidth = GetE('txtWidth').value ; |
---|
| 109 | if ( sWidth.length > 0 && GetE('selWidthType').value == 'percent' ) |
---|
| 110 | sWidth += '%' ; |
---|
| 111 | |
---|
| 112 | SetAttribute( table, 'width' , sWidth ) ; |
---|
| 113 | SetAttribute( table, 'height' , GetE('txtHeight').value ) ; |
---|
| 114 | SetAttribute( table, 'border' , GetE('txtBorder').value ) ; |
---|
| 115 | SetAttribute( table, 'align' , GetE('selAlignment').value ) ; |
---|
| 116 | SetAttribute( table, 'cellPadding' , GetE('txtCellPadding').value ) ; |
---|
| 117 | SetAttribute( table, 'cellSpacing' , GetE('txtCellSpacing').value ) ; |
---|
| 118 | SetAttribute( table, 'summary' , GetE('txtSummary').value ) ; |
---|
| 119 | |
---|
| 120 | var eCaption = oEditor.FCKDomTools.GetFirstChild( table, 'CAPTION' ) ; |
---|
| 121 | |
---|
| 122 | if ( document.getElementById('txtCaption').value != '') |
---|
| 123 | { |
---|
| 124 | if ( !eCaption ) |
---|
| 125 | { |
---|
| 126 | eCaption = oEditor.FCK.EditorDocument.createElement( 'CAPTION' ) ; |
---|
| 127 | table.insertBefore( eCaption, table.firstChild ) ; |
---|
| 128 | } |
---|
| 129 | |
---|
| 130 | eCaption.innerHTML = document.getElementById('txtCaption').value ; |
---|
| 131 | } |
---|
| 132 | else if ( bExists && eCaption ) |
---|
| 133 | eCaption.parentNode.removeChild( eCaption ) ; |
---|
| 134 | |
---|
| 135 | if (! bExists) |
---|
| 136 | { |
---|
| 137 | var iRows = document.getElementById('txtRows').value ; |
---|
| 138 | var iCols = document.getElementById('txtColumns').value ; |
---|
| 139 | |
---|
| 140 | for ( var r = 0 ; r < iRows ; r++ ) |
---|
| 141 | { |
---|
| 142 | var oRow = table.insertRow(-1) ; |
---|
| 143 | for ( var c = 0 ; c < iCols ; c++ ) |
---|
| 144 | { |
---|
| 145 | var oCell = oRow.insertCell(-1) ; |
---|
| 146 | if ( oEditor.FCKBrowserInfo.IsGeckoLike ) |
---|
| 147 | oCell.innerHTML = GECKO_BOGUS ; |
---|
| 148 | //oCell.innerHTML = " " ; |
---|
| 149 | } |
---|
| 150 | } |
---|
| 151 | |
---|
| 152 | oEditor.FCKUndo.SaveUndoStep() ; |
---|
| 153 | |
---|
| 154 | oEditor.FCK.InsertElement( table ) ; |
---|
| 155 | } |
---|
| 156 | |
---|
| 157 | return true ; |
---|
| 158 | } |
---|
| 159 | |
---|
| 160 | </script> |
---|
| 161 | </head> |
---|
| 162 | <body style="overflow: hidden"> |
---|
| 163 | <table id="otable" cellspacing="0" cellpadding="0" width="100%" border="0" style="height: 100%"> |
---|
| 164 | <tr> |
---|
| 165 | <td> |
---|
| 166 | <table cellspacing="1" cellpadding="1" width="100%" border="0"> |
---|
| 167 | <tr> |
---|
| 168 | <td valign="top"> |
---|
| 169 | <table cellspacing="0" cellpadding="0" border="0"> |
---|
| 170 | <tr> |
---|
| 171 | <td> |
---|
| 172 | <span fcklang="DlgTableRows">Rows</span>:</td> |
---|
| 173 | <td> |
---|
| 174 | <input id="txtRows" type="text" maxlength="3" size="2" value="3" name="txtRows" |
---|
| 175 | onkeypress="return IsDigit(event);" /></td> |
---|
| 176 | </tr> |
---|
| 177 | <tr> |
---|
| 178 | <td> |
---|
| 179 | <span fcklang="DlgTableColumns">Columns</span>:</td> |
---|
| 180 | <td> |
---|
| 181 | <input id="txtColumns" type="text" maxlength="2" size="2" value="2" name="txtColumns" |
---|
| 182 | onkeypress="return IsDigit(event);" /></td> |
---|
| 183 | </tr> |
---|
| 184 | <tr> |
---|
| 185 | <td> |
---|
| 186 | </td> |
---|
| 187 | <td> |
---|
| 188 | </td> |
---|
| 189 | </tr> |
---|
| 190 | <tr> |
---|
| 191 | <td> |
---|
| 192 | <span fcklang="DlgTableBorder">Border size</span>:</td> |
---|
| 193 | <td> |
---|
| 194 | <input id="txtBorder" type="text" maxlength="2" size="2" value="1" name="txtBorder" |
---|
| 195 | onkeypress="return IsDigit(event);" /></td> |
---|
| 196 | </tr> |
---|
| 197 | <tr> |
---|
| 198 | <td> |
---|
| 199 | <span fcklang="DlgTableAlign">Alignment</span>:</td> |
---|
| 200 | <td> |
---|
| 201 | <select id="selAlignment" name="selAlignment"> |
---|
| 202 | <option fcklang="DlgTableAlignNotSet" value="" selected="selected"><Not set></option> |
---|
| 203 | <option fcklang="DlgTableAlignLeft" value="left">Left</option> |
---|
| 204 | <option fcklang="DlgTableAlignCenter" value="center">Center</option> |
---|
| 205 | <option fcklang="DlgTableAlignRight" value="right">Right</option> |
---|
| 206 | </select></td> |
---|
| 207 | </tr> |
---|
| 208 | </table> |
---|
| 209 | </td> |
---|
| 210 | <td> |
---|
| 211 | </td> |
---|
| 212 | <td align="right" valign="top"> |
---|
| 213 | <table cellspacing="0" cellpadding="0" border="0"> |
---|
| 214 | <tr> |
---|
| 215 | <td> |
---|
| 216 | <span fcklang="DlgTableWidth">Width</span>:</td> |
---|
| 217 | <td> |
---|
| 218 | <input id="txtWidth" type="text" maxlength="4" size="3" value="200" name="txtWidth" |
---|
| 219 | onkeypress="return IsDigit(event);" /></td> |
---|
| 220 | <td> |
---|
| 221 | <select id="selWidthType" name="selWidthType"> |
---|
| 222 | <option fcklang="DlgTableWidthPx" value="pixels" selected="selected">pixels</option> |
---|
| 223 | <option fcklang="DlgTableWidthPc" value="percent">percent</option> |
---|
| 224 | </select></td> |
---|
| 225 | </tr> |
---|
| 226 | <tr> |
---|
| 227 | <td> |
---|
| 228 | <span fcklang="DlgTableHeight">Height</span>:</td> |
---|
| 229 | <td> |
---|
| 230 | <input id="txtHeight" type="text" maxlength="4" size="3" name="txtHeight" onkeypress="return IsDigit(event);" /></td> |
---|
| 231 | <td> |
---|
| 232 | <span fcklang="DlgTableWidthPx">pixels</span></td> |
---|
| 233 | </tr> |
---|
| 234 | <tr> |
---|
| 235 | <td> |
---|
| 236 | </td> |
---|
| 237 | <td> |
---|
| 238 | </td> |
---|
| 239 | <td> |
---|
| 240 | </td> |
---|
| 241 | </tr> |
---|
| 242 | <tr> |
---|
| 243 | <td nowrap="nowrap"> |
---|
| 244 | <span fcklang="DlgTableCellSpace">Cell spacing</span>:</td> |
---|
| 245 | <td> |
---|
| 246 | <input id="txtCellSpacing" type="text" maxlength="2" size="2" value="1" name="txtCellSpacing" |
---|
| 247 | onkeypress="return IsDigit(event);" /></td> |
---|
| 248 | <td> |
---|
| 249 | </td> |
---|
| 250 | </tr> |
---|
| 251 | <tr> |
---|
| 252 | <td nowrap="nowrap"> |
---|
| 253 | <span fcklang="DlgTableCellPad">Cell padding</span>:</td> |
---|
| 254 | <td> |
---|
| 255 | <input id="txtCellPadding" type="text" maxlength="2" size="2" value="1" name="txtCellPadding" |
---|
| 256 | onkeypress="return IsDigit(event);" /></td> |
---|
| 257 | <td> |
---|
| 258 | </td> |
---|
| 259 | </tr> |
---|
| 260 | </table> |
---|
| 261 | </td> |
---|
| 262 | </tr> |
---|
| 263 | </table> |
---|
| 264 | <table cellspacing="0" cellpadding="0" width="100%" border="0"> |
---|
| 265 | <tr> |
---|
| 266 | <td nowrap="nowrap"> |
---|
| 267 | <span fcklang="DlgTableCaption">Caption</span>: </td> |
---|
| 268 | <td> |
---|
| 269 | </td> |
---|
| 270 | <td width="100%" nowrap="nowrap"> |
---|
| 271 | <input id="txtCaption" type="text" style="width: 100%" /></td> |
---|
| 272 | </tr> |
---|
| 273 | <tr> |
---|
| 274 | <td nowrap="nowrap"> |
---|
| 275 | <span fcklang="DlgTableSummary">Summary</span>: </td> |
---|
| 276 | <td> |
---|
| 277 | </td> |
---|
| 278 | <td width="100%" nowrap="nowrap"> |
---|
| 279 | <input id="txtSummary" type="text" style="width: 100%" /></td> |
---|
| 280 | </tr> |
---|
| 281 | </table> |
---|
| 282 | </td> |
---|
| 283 | </tr> |
---|
| 284 | </table> |
---|
| 285 | </body> |
---|
| 286 | </html> |
---|