1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
\r
3 * FCKeditor - The text editor for Internet - http://www.fckeditor.net
\r
4 * Copyright (C) 2003-2010 Frederico Caldeira Knabben
\r
6 * == BEGIN LICENSE ==
\r
8 * Licensed under the terms of any of the following licenses at your
\r
11 * - GNU General Public License Version 2 or later (the "GPL")
\r
12 * http://www.gnu.org/licenses/gpl.html
\r
14 * - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
\r
15 * http://www.gnu.org/licenses/lgpl.html
\r
17 * - Mozilla Public License Version 1.1 or later (the "MPL")
\r
18 * http://www.mozilla.org/MPL/MPL-1.1.html
\r
22 * Cell properties dialog window.
\r
24 <html xmlns="http://www.w3.org/1999/xhtml">
\r
26 <title>Table Cell Properties</title>
\r
27 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
\r
28 <meta name="robots" content="noindex, nofollow" />
\r
29 <script src="common/fck_dialog_common.js" type="text/javascript"></script>
\r
30 <script type="text/javascript">
\r
32 var dialog = window.parent ;
\r
33 var oEditor = dialog.InnerDialogLoaded() ;
\r
35 var FCKDomTools = oEditor.FCKDomTools ;
\r
37 // Array of selected Cells
\r
38 var aCells = oEditor.FCKTableHandler.GetSelectedCells() ;
\r
40 window.onload = function()
\r
42 // First of all, translate the dialog box texts
\r
43 oEditor.FCKLanguageManager.TranslatePage( document ) ;
\r
47 dialog.SetOkButton( true ) ;
\r
48 dialog.SetAutoSize( true ) ;
\r
49 SelectField( 'txtWidth' ) ;
\r
52 function SetStartupValue()
\r
54 if ( aCells.length > 0 )
\r
56 var oCell = aCells[0] ;
\r
57 var iWidth = GetAttribute( oCell, 'width' ) ;
\r
59 if ( iWidth.indexOf && iWidth.indexOf( '%' ) >= 0 )
\r
61 iWidth = iWidth.substr( 0, iWidth.length - 1 ) ;
\r
62 GetE('selWidthType').value = 'percent' ;
\r
65 if ( oCell.attributes['noWrap'] != null && oCell.attributes['noWrap'].specified )
\r
66 GetE('selWordWrap').value = !oCell.noWrap ;
\r
68 GetE('txtWidth').value = iWidth ;
\r
69 GetE('txtHeight').value = GetAttribute( oCell, 'height' ) ;
\r
70 GetE('selHAlign').value = GetAttribute( oCell, 'align' ) ;
\r
71 GetE('selVAlign').value = GetAttribute( oCell, 'vAlign' ) ;
\r
72 GetE('txtRowSpan').value = GetAttribute( oCell, 'rowSpan' ) ;
\r
73 GetE('txtCollSpan').value = GetAttribute( oCell, 'colSpan' ) ;
\r
74 GetE('txtBackColor').value = GetAttribute( oCell, 'bgColor' ) ;
\r
75 GetE('txtBorderColor').value = GetAttribute( oCell, 'borderColor' ) ;
\r
76 GetE('selCellType').value = oCell.nodeName.toLowerCase() ;
\r
80 // Fired when the user press the OK button
\r
83 oEditor.FCKUndo.SaveUndoStep() ;
\r
85 for( i = 0 ; i < aCells.length ; i++ )
\r
87 if ( GetE('txtWidth').value.length > 0 )
\r
88 aCells[i].width = GetE('txtWidth').value + ( GetE('selWidthType').value == 'percent' ? '%' : '') ;
\r
90 aCells[i].removeAttribute( 'width', 0 ) ;
\r
92 if ( GetE('selWordWrap').value == 'false' )
\r
93 SetAttribute( aCells[i], 'noWrap', 'nowrap' ) ;
\r
95 aCells[i].removeAttribute( 'noWrap' ) ;
\r
97 SetAttribute( aCells[i], 'height' , GetE('txtHeight').value ) ;
\r
98 SetAttribute( aCells[i], 'align' , GetE('selHAlign').value ) ;
\r
99 SetAttribute( aCells[i], 'vAlign' , GetE('selVAlign').value ) ;
\r
100 SetAttribute( aCells[i], 'rowSpan' , GetE('txtRowSpan').value ) ;
\r
101 SetAttribute( aCells[i], 'colSpan' , GetE('txtCollSpan').value ) ;
\r
102 SetAttribute( aCells[i], 'bgColor' , GetE('txtBackColor').value ) ;
\r
103 SetAttribute( aCells[i], 'borderColor' , GetE('txtBorderColor').value ) ;
\r
105 var cellType = GetE('selCellType').value ;
\r
106 if ( aCells[i].nodeName.toLowerCase() != cellType )
\r
107 aCells[i] = RenameNode( aCells[i], cellType ) ;
\r
110 // The cells need to be reselected, otherwise the caret will appear inside the table borders (Gecko)
\r
111 // or sent back to the beginning of the document (Opera and Safari).
\r
112 // Strangely, IE works ok so no change is needed for IE.
\r
113 if ( !oEditor.FCKBrowserInfo.IsIE )
\r
115 var selection = oEditor.FCK.EditorWindow.getSelection() ;
\r
116 selection.removeAllRanges() ;
\r
117 for ( var i = 0 ; i < aCells.length ; i++ )
\r
119 var range = oEditor.FCK.EditorDocument.createRange() ;
\r
120 range.selectNode( aCells[i] ) ;
\r
121 selection.addRange( range ) ;
\r
128 function SelectBackColor( color )
\r
130 if ( color && color.length > 0 )
\r
131 GetE('txtBackColor').value = color ;
\r
134 function SelectBorderColor( color )
\r
136 if ( color && color.length > 0 )
\r
137 GetE('txtBorderColor').value = color ;
\r
140 function SelectColor( wich )
\r
142 oEditor.FCKDialog.OpenDialog( 'FCKDialog_Color', oEditor.FCKLang.DlgColorTitle, 'dialog/fck_colorselector.html', 410, 320, wich == 'Back' ? SelectBackColor : SelectBorderColor ) ;
\r
147 <body scroll="no" style="overflow: hidden">
\r
148 <table cellspacing="0" cellpadding="0" width="100%" border="0" height="100%">
\r
151 <table cellspacing="1" cellpadding="1" width="100%" border="0">
\r
154 <table cellspacing="0" cellpadding="0" border="0">
\r
156 <td nowrap="nowrap">
\r
157 <span fcklang="DlgCellWidth">Width</span>:</td>
\r
159 <input onkeypress="return IsDigit(event);" id="txtWidth" type="text" maxlength="4"
\r
160 size="3" /> <select id="selWidthType">
\r
161 <option fcklang="DlgCellWidthPx" value="pixels" selected="selected">pixels</option>
\r
162 <option fcklang="DlgCellWidthPc" value="percent">percent</option>
\r
166 <td nowrap="nowrap">
\r
167 <span fcklang="DlgCellHeight">Height</span>:</td>
\r
169 <input id="txtHeight" type="text" maxlength="4" size="3" onkeypress="return IsDigit(event);" /> <span
\r
170 fcklang="DlgCellWidthPx">pixels</span></td>
\r
179 <td nowrap="nowrap">
\r
180 <span fcklang="DlgCellWordWrap">Word Wrap</span>:</td>
\r
182 <select id="selWordWrap">
\r
183 <option fcklang="DlgCellWordWrapYes" value="true" selected="selected">Yes</option>
\r
184 <option fcklang="DlgCellWordWrapNo" value="false">No</option>
\r
194 <td nowrap="nowrap">
\r
195 <span fcklang="DlgCellHorAlign">Horizontal Alignment</span>:</td>
\r
197 <select id="selHAlign">
\r
198 <option fcklang="DlgCellHorAlignNotSet" value="" selected><Not set></option>
\r
199 <option fcklang="DlgCellHorAlignLeft" value="left">Left</option>
\r
200 <option fcklang="DlgCellHorAlignCenter" value="center">Center</option>
\r
201 <option fcklang="DlgCellHorAlignRight" value="right">Right</option>
\r
205 <td nowrap="nowrap">
\r
206 <span fcklang="DlgCellVerAlign">Vertical Alignment</span>:</td>
\r
208 <select id="selVAlign">
\r
209 <option fcklang="DlgCellVerAlignNotSet" value="" selected><Not set></option>
\r
210 <option fcklang="DlgCellVerAlignTop" value="top">Top</option>
\r
211 <option fcklang="DlgCellVerAlignMiddle" value="middle">Middle</option>
\r
212 <option fcklang="DlgCellVerAlignBottom" value="bottom">Bottom</option>
\r
213 <option fcklang="DlgCellVerAlignBaseline" value="baseline">Baseline</option>
\r
219 </td>
\r
221 <table cellspacing="0" cellpadding="0" border="0">
\r
223 <td nowrap="nowrap">
\r
224 <span fcklang="DlgCellType">Cell Type</span>:</td>
\r
226 <select id="selCellType">
\r
227 <option fcklang="DlgCellTypeData" value="td">Data</option>
\r
228 <option fcklang="DlgCellTypeHeader" value="th">Header</option>
\r
240 <td nowrap="nowrap">
\r
241 <span fcklang="DlgCellRowSpan">Rows Span</span>:</td>
\r
244 <input onkeypress="return IsDigit(event);" id="txtRowSpan" type="text" maxlength="3" size="2"
\r
250 <td nowrap="nowrap">
\r
251 <span fcklang="DlgCellCollSpan">Columns Span</span>:</td>
\r
254 <input onkeypress="return IsDigit(event);" id="txtCollSpan" type="text" maxlength="2"
\r
268 <td nowrap="nowrap">
\r
269 <span fcklang="DlgCellBackColor">Background Color</span>:</td>
\r
271 <input id="txtBackColor" type="text" size="8" /></td>
\r
274 <input type="button" fcklang="DlgCellBtnSelect" value="Select..." onclick="SelectColor( 'Back' )"></td>
\r
277 <td nowrap="nowrap">
\r
278 <span fcklang="DlgCellBorderColor">Border Color</span>:</td>
\r
280 <input id="txtBorderColor" type="text" size="8" /></td>
\r
283 <input type="button" fcklang="DlgCellBtnSelect" value="Select..." onclick="SelectColor( 'Border' )" /></td>
\r