1,30 → 1,37 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" > |
<!-- |
* FCKeditor - The text editor for internet |
* Copyright (C) 2003-2006 Frederico Caldeira Knabben |
* |
* Licensed under the terms of the GNU Lesser General Public License: |
* http://www.opensource.org/licenses/lgpl-license.php |
* |
* For further information visit: |
* http://www.fckeditor.net/ |
* |
* "Support Open Source software. What about a donation today?" |
* |
* File Name: fck_table.html |
* Table dialog window. |
* |
* File Authors: |
* Frederico Caldeira Knabben (fredck@fckeditor.net) |
* FCKeditor - The text editor for Internet - http://www.fckeditor.net |
* Copyright (C) 2003-2008 Frederico Caldeira Knabben |
* |
* == BEGIN LICENSE == |
* |
* Licensed under the terms of any of the following licenses at your |
* choice: |
* |
* - GNU General Public License Version 2 or later (the "GPL") |
* http://www.gnu.org/licenses/gpl.html |
* |
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL") |
* http://www.gnu.org/licenses/lgpl.html |
* |
* - Mozilla Public License Version 1.1 or later (the "MPL") |
* http://www.mozilla.org/MPL/MPL-1.1.html |
* |
* == END LICENSE == |
* |
* Table dialog window. |
--> |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" > |
<html xmlns="http://www.w3.org/1999/xhtml"> |
<head> |
<title>Table Properties</title> |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> |
<meta name="robots" content="noindex, nofollow" /> |
<script src="common/fck_dialog_common.js" type="text/javascript"></script> |
<script type="text/javascript"> |
|
var oEditor = window.parent.InnerDialogLoaded() ; |
var dialog = window.parent ; |
var oEditor = dialog.InnerDialogLoaded() ; |
var dialogArguments = dialog.Args() ; |
|
// Gets the document DOM |
var oDOM = oEditor.FCK.EditorDocument ; |
31,7 → 38,7 |
|
// Gets the table if there is one selected. |
var table ; |
var e = oEditor.FCKSelection.GetSelectedElement() ; |
var e = dialog.Selection.GetSelectedElement() ; |
|
if ( ( !e && document.location.search.substr(1) == 'Parent' ) || ( e && e.tagName != 'TABLE' ) ) |
e = oEditor.FCKSelection.MoveToAncestorNode( 'TABLE' ) ; |
57,7 → 64,7 |
|
if (iWidth.indexOf('%') >= 0) // Percentual = % |
{ |
iWidth = parseInt( iWidth.substr(0,iWidth.length - 1) ) ; |
iWidth = parseInt( iWidth.substr(0,iWidth.length - 1), 10 ) ; |
document.getElementById('selWidthType').value = "percent" ; |
} |
else if (iWidth.indexOf('px') >= 0) // Style Pixel = px |
65,27 → 72,31 |
iWidth = iWidth.substr(0,iWidth.length - 2); |
document.getElementById('selWidthType').value = "pixels" ; |
} |
|
|
if (iHeight && iHeight.indexOf('px') >= 0) // Style Pixel = px |
iHeight = iHeight.substr(0,iHeight.length - 2); |
|
document.getElementById('txtWidth').value = iWidth ; |
document.getElementById('txtHeight').value = iHeight ; |
document.getElementById('txtBorder').value = table.border ; |
document.getElementById('selAlignment').value = table.align ; |
document.getElementById('txtCellPadding').value = table.cellPadding ; |
document.getElementById('txtCellSpacing').value = table.cellSpacing ; |
document.getElementById('txtSummary').value = table.summary; |
|
document.getElementById('txtWidth').value = iWidth || '' ; |
document.getElementById('txtHeight').value = iHeight || '' ; |
document.getElementById('txtBorder').value = GetAttribute( table, 'border', '' ) ; |
document.getElementById('selAlignment').value = GetAttribute( table, 'align', '' ) ; |
document.getElementById('txtCellPadding').value = GetAttribute( table, 'cellPadding', '' ) ; |
document.getElementById('txtCellSpacing').value = GetAttribute( table, 'cellSpacing', '' ) ; |
document.getElementById('txtSummary').value = GetAttribute( table, 'summary', '' ) ; |
// document.getElementById('cmbFontStyle').value = table.className ; |
|
if (table.caption) document.getElementById('txtCaption').value = table.caption.innerHTML ; |
|
var eCaption = oEditor.FCKDomTools.GetFirstChild( table, 'CAPTION' ) ; |
if ( eCaption ) document.getElementById('txtCaption').value = eCaption.innerHTML ; |
|
document.getElementById('txtRows').disabled = true ; |
document.getElementById('txtColumns').disabled = true ; |
SelectField( 'txtWidth' ) ; |
} |
|
window.parent.SetOkButton( true ) ; |
window.parent.SetAutoSize( true ) ; |
else |
SelectField( 'txtRows' ) ; |
|
dialog.SetOkButton( true ) ; |
dialog.SetAutoSize( true ) ; |
} |
|
// Fired when the user press the OK button |
92,43 → 103,53 |
function Ok() |
{ |
var bExists = ( table != null ) ; |
|
|
if ( ! bExists ) |
{ |
table = oEditor.FCK.EditorDocument.createElement( "TABLE" ) ; |
} |
|
// Removes the Width and Height styles |
if ( bExists && table.style.width ) table.style.width = null ; //.removeAttribute("width") ; |
if ( bExists && table.style.height ) table.style.height = null ; //.removeAttribute("height") ; |
|
table.width = document.getElementById('txtWidth').value + ( document.getElementById('selWidthType').value == "percent" ? "%" : "") ; |
table.height = document.getElementById('txtHeight').value ; |
table.border = document.getElementById('txtBorder').value ; |
table.align = document.getElementById('selAlignment').value ; |
table.cellPadding = document.getElementById('txtCellPadding').value ; |
table.cellSpacing = document.getElementById('txtCellSpacing').value ; |
table.summary = document.getElementById('txtSummary').value ; |
// table.className = cmbFontStyle.value ; |
|
|
var sWidth = GetE('txtWidth').value ; |
if ( sWidth.length > 0 && GetE('selWidthType').value == 'percent' ) |
sWidth += '%' ; |
|
SetAttribute( table, 'width' , sWidth ) ; |
SetAttribute( table, 'height' , GetE('txtHeight').value ) ; |
SetAttribute( table, 'border' , GetE('txtBorder').value ) ; |
SetAttribute( table, 'align' , GetE('selAlignment').value ) ; |
SetAttribute( table, 'cellPadding' , GetE('txtCellPadding').value ) ; |
SetAttribute( table, 'cellSpacing' , GetE('txtCellSpacing').value ) ; |
SetAttribute( table, 'summary' , GetE('txtSummary').value ) ; |
|
var eCaption = oEditor.FCKDomTools.GetFirstChild( table, 'CAPTION' ) ; |
|
if ( document.getElementById('txtCaption').value != '') |
{ |
if (! table.caption) table.createCaption() ; |
table.caption.innerHTML = document.getElementById('txtCaption').value ; |
if ( !eCaption ) |
{ |
eCaption = oEditor.FCK.EditorDocument.createElement( 'CAPTION' ) ; |
table.insertBefore( eCaption, table.firstChild ) ; |
} |
|
eCaption.innerHTML = document.getElementById('txtCaption').value ; |
} |
else if ( bExists && table.caption ) |
else if ( bExists && eCaption ) |
{ |
if ( document.all ) |
table.caption.innerHTML = '' ; // TODO: It causes an IE internal error if using removeChild. |
// TODO: It causes an IE internal error if using removeChild or |
// table.deleteCaption() (see #505). |
if ( oEditor.FCKBrowserInfo.IsIE ) |
eCaption.innerHTML = '' ; |
else |
table.caption.parentNode.removeChild( table.caption ) ; |
eCaption.parentNode.removeChild( eCaption ) ; |
} |
|
|
if (! bExists) |
{ |
var iRows = document.getElementById('txtRows').value ; |
var iCols = document.getElementById('txtColumns').value ; |
|
|
for ( var r = 0 ; r < iRows ; r++ ) |
{ |
var oRow = table.insertRow(-1) ; |
135,46 → 156,19 |
for ( var c = 0 ; c < iCols ; c++ ) |
{ |
var oCell = oRow.insertCell(-1) ; |
if ( oEditor.FCKBrowserInfo.IsGecko ) |
oCell.innerHTML = '<br _moz_editor_bogus_node="TRUE">' ; |
//oCell.innerHTML = " " ; |
if ( oEditor.FCKBrowserInfo.IsGeckoLike ) |
oEditor.FCKTools.AppendBogusBr( oCell ) ; |
} |
} |
|
|
oEditor.FCKUndo.SaveUndoStep() ; |
|
// START iCM MODIFICATIONS |
// Amended to ensure that newly inserted tables are not incorrectly nested in P tags, etc |
// We insert the table first and then rectify any nestings afterwards so we can re-use the |
// FCKTablesProcessor function that corrects tables on SetHTML() |
/* |
table = oEditor.FCK.InsertElementAndGetIt( table ) ; |
if ( !oEditor.FCKConfig.UseBROnCarriageReturn ) |
{ |
oEditor.FCKTablesProcessor.CheckTableNesting( table ) ; |
} |
*/ |
// END iCM MODIFICATIONS |
|
|
oEditor.FCK.InsertElement( table ) ; |
} |
|
|
return true ; |
} |
|
function IsDigit( e ) |
{ |
e = e || event ; |
var iCode = ( e.keyCode || e.charCode ) ; |
return |
( |
( iCode >= 48 && iCode <= 57 ) // Numbers |
|| (iCode >= 37 && iCode <= 40) // Arrows |
|| iCode == 8 // Backspace |
|| iCode == 46 // Delete |
) ; |
} |
|
</script> |
</head> |
<body style="overflow: hidden"> |
280,18 → 274,6 |
</tr> |
</table> |
<table cellspacing="0" cellpadding="0" width="100%" border="0"> |
<!-- |
<tr> |
<td nowrap> |
<span fcklang="DlgClassName">Class Name</span>:</td> |
<td> </td> |
<td> |
<script type="text/javascript"> |
// var tbstyles = new TBCombo( "FontStyle" , "null" , "", oEditor.config.StyleNames, oEditor.config.StyleValues, 'CheckStyle("cmbFontStyle")'); |
// document.write(tbstyles.GetHTML()); |
</script></td> |
</tr> |
--> |
<tr> |
<td nowrap="nowrap"> |
<span fcklang="DlgTableCaption">Caption</span>: </td> |