Table Properties
var oEditor = window.parent.InnerDialogLoaded() ;
// Gets the document DOM
var oDOM = oEditor.FCK.EditorDocument ;
// Gets the table if there is one selected.
var table ;
var e = oEditor.FCKSelection.GetSelectedElement() ;
if ( ( !e && document.location.search.substr(1) == 'Parent' ) || ( e && e.tagName != 'TABLE' ) )
e = oEditor.FCKSelection.MoveToAncestorNode( 'TABLE' ) ;
if ( e && e.tagName == "TABLE" )
table = e ;
// Fired when the window loading process is finished. It sets the fields with the
// actual values if a table is selected in the editor.
window.onload = function()
{
// First of all, translate the dialog box texts
oEditor.FCKLanguageManager.TranslatePage(document) ;
if (table)
{
document.getElementById('txtRows').value = table.rows.length ;
document.getElementById('txtColumns').value = table.rows[0].cells.length ;
// Gets the value from the Width or the Style attribute
var iWidth = (table.style.width ? table.style.width : table.width ) ;
var iHeight = (table.style.height ? table.style.height : table.height ) ;
if (iWidth.indexOf('%') >= 0) // Percentual = %
{
iWidth = parseInt( iWidth.substr(0,iWidth.length - 1), 10 ) ;
document.getElementById('selWidthType').value = "percent" ;
}
else if (iWidth.indexOf('px') >= 0) // Style Pixel = px
{ //
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 = 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 ;
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 ;
}
window.parent.SetOkButton( true ) ;
window.parent.SetAutoSize( true ) ;
}
// Fired when the user press the OK button
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") ;
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 ( !eCaption )
{
eCaption = oEditor.FCK.EditorDocument.createElement( 'CAPTION' ) ;
table.insertBefore( eCaption, table.firstChild ) ;
}
eCaption.innerHTML = document.getElementById('txtCaption').value ;
}
else if ( bExists && eCaption )
{
// TODO: It causes an IE internal error if using removeChild or
// table.deleteCaption() (see #505).
if ( oEditor.FCKBrowserInfo.IsIE )
eCaption.innerHTML = '' ;
else
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) ;
for ( var c = 0 ; c < iCols ; c++ )
{
var oCell = oRow.insertCell(-1) ;
if ( oEditor.FCKBrowserInfo.IsGeckoLike )
oEditor.FCKTools.AppendBogusBr( oCell ) ;
}
}
oEditor.FCKUndo.SaveUndoStep() ;
oEditor.FCK.InsertElement( table ) ;
}
return true ;
}
Rows:
Columns:
Border size:
Alignment:
<Not set>
Left
Center
Right
Width:
pixels
percent
Height:
pixels
Cell spacing:
Cell padding:
Caption:
Summary:
Wyszukiwarka
Podobne podstrony:
fck tablelanai dinning tablefck anchorThe Complete Pentium Instruction Set Table (32 Bit Addressing Mode Only)insert table buttoncurio tabletiled coffee tablefck pastewięcej podobnych podstron