import torrus 1.0.9
[freeside.git] / httemplate / elements / fckeditor / editor / dialog / fck_tablecell.html
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >\r
2 <!--\r
3  * FCKeditor - The text editor for Internet - http://www.fckeditor.net\r
4  * Copyright (C) 2003-2010 Frederico Caldeira Knabben\r
5  *\r
6  * == BEGIN LICENSE ==\r
7  *\r
8  * Licensed under the terms of any of the following licenses at your\r
9  * choice:\r
10  *\r
11  *  - GNU General Public License Version 2 or later (the "GPL")\r
12  *    http://www.gnu.org/licenses/gpl.html\r
13  *\r
14  *  - GNU Lesser General Public License Version 2.1 or later (the "LGPL")\r
15  *    http://www.gnu.org/licenses/lgpl.html\r
16  *\r
17  *  - Mozilla Public License Version 1.1 or later (the "MPL")\r
18  *    http://www.mozilla.org/MPL/MPL-1.1.html\r
19  *\r
20  * == END LICENSE ==\r
21  *\r
22  * Cell properties dialog window.\r
23 -->\r
24 <html xmlns="http://www.w3.org/1999/xhtml">\r
25 <head>\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
31 \r
32 var dialog      = window.parent ;\r
33 var oEditor = dialog.InnerDialogLoaded() ;\r
34 \r
35 var FCKDomTools = oEditor.FCKDomTools ;\r
36 \r
37 // Array of selected Cells\r
38 var aCells = oEditor.FCKTableHandler.GetSelectedCells() ;\r
39 \r
40 window.onload = function()\r
41 {\r
42         // First of all, translate the dialog box texts\r
43         oEditor.FCKLanguageManager.TranslatePage( document ) ;\r
44 \r
45         SetStartupValue() ;\r
46 \r
47         dialog.SetOkButton( true ) ;\r
48         dialog.SetAutoSize( true ) ;\r
49         SelectField( 'txtWidth' ) ;\r
50 }\r
51 \r
52 function SetStartupValue()\r
53 {\r
54         if ( aCells.length > 0 )\r
55         {\r
56                 var oCell = aCells[0] ;\r
57                 var iWidth = GetAttribute( oCell, 'width' ) ;\r
58 \r
59                 if ( iWidth.indexOf && iWidth.indexOf( '%' ) >= 0 )\r
60                 {\r
61                         iWidth = iWidth.substr( 0, iWidth.length - 1 ) ;\r
62                         GetE('selWidthType').value = 'percent' ;\r
63                 }\r
64 \r
65                 if ( oCell.attributes['noWrap'] != null && oCell.attributes['noWrap'].specified )\r
66                         GetE('selWordWrap').value = !oCell.noWrap ;\r
67 \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
77         }\r
78 }\r
79 \r
80 // Fired when the user press the OK button\r
81 function Ok()\r
82 {\r
83         oEditor.FCKUndo.SaveUndoStep() ;\r
84 \r
85         for( i = 0 ; i < aCells.length ; i++ )\r
86         {\r
87                 if ( GetE('txtWidth').value.length > 0 )\r
88                         aCells[i].width = GetE('txtWidth').value + ( GetE('selWidthType').value == 'percent' ? '%' : '') ;\r
89                 else\r
90                         aCells[i].removeAttribute( 'width', 0 ) ;\r
91 \r
92                 if ( GetE('selWordWrap').value == 'false' )\r
93                         SetAttribute( aCells[i], 'noWrap', 'nowrap' ) ;\r
94                 else\r
95                         aCells[i].removeAttribute( 'noWrap' ) ;\r
96 \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
104 \r
105                 var cellType = GetE('selCellType').value ;\r
106                 if ( aCells[i].nodeName.toLowerCase() != cellType )\r
107                         aCells[i] = RenameNode( aCells[i], cellType ) ;\r
108         }\r
109 \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
114         {\r
115                 var selection = oEditor.FCK.EditorWindow.getSelection() ;\r
116                 selection.removeAllRanges() ;\r
117                 for ( var i = 0 ; i < aCells.length ; i++ )\r
118                 {\r
119                         var range = oEditor.FCK.EditorDocument.createRange() ;\r
120                         range.selectNode( aCells[i] ) ;\r
121                         selection.addRange( range ) ;\r
122                 }\r
123         }\r
124 \r
125         return true ;\r
126 }\r
127 \r
128 function SelectBackColor( color )\r
129 {\r
130         if ( color && color.length > 0 )\r
131                 GetE('txtBackColor').value = color ;\r
132 }\r
133 \r
134 function SelectBorderColor( color )\r
135 {\r
136         if ( color && color.length > 0 )\r
137                 GetE('txtBorderColor').value = color ;\r
138 }\r
139 \r
140 function SelectColor( wich )\r
141 {\r
142         oEditor.FCKDialog.OpenDialog( 'FCKDialog_Color', oEditor.FCKLang.DlgColorTitle, 'dialog/fck_colorselector.html', 410, 320, wich == 'Back' ? SelectBackColor : SelectBorderColor ) ;\r
143 }\r
144 \r
145         </script>\r
146 </head>\r
147 <body scroll="no" style="overflow: hidden">\r
148         <table cellspacing="0" cellpadding="0" width="100%" border="0" height="100%">\r
149                 <tr>\r
150                         <td>\r
151                                 <table cellspacing="1" cellpadding="1" width="100%" border="0">\r
152                                         <tr>\r
153                                                 <td>\r
154                                                         <table cellspacing="0" cellpadding="0" border="0">\r
155                                                                 <tr>\r
156                                                                         <td nowrap="nowrap">\r
157                                                                                 <span fcklang="DlgCellWidth">Width</span>:</td>\r
158                                                                         <td>\r
159                                                                                 &nbsp;<input onkeypress="return IsDigit(event);" id="txtWidth" type="text" maxlength="4"\r
160                                                                                         size="3" />&nbsp;<select id="selWidthType">\r
161                                                                                                 <option fcklang="DlgCellWidthPx" value="pixels" selected="selected">pixels</option>\r
162                                                                                                 <option fcklang="DlgCellWidthPc" value="percent">percent</option>\r
163                                                                                         </select></td>\r
164                                                                 </tr>\r
165                                                                 <tr>\r
166                                                                         <td nowrap="nowrap">\r
167                                                                                 <span fcklang="DlgCellHeight">Height</span>:</td>\r
168                                                                         <td>\r
169                                                                                 &nbsp;<input id="txtHeight" type="text" maxlength="4" size="3" onkeypress="return IsDigit(event);" />&nbsp;<span\r
170                                                                                         fcklang="DlgCellWidthPx">pixels</span></td>\r
171                                                                 </tr>\r
172                                                                 <tr>\r
173                                                                         <td>\r
174                                                                                 &nbsp;</td>\r
175                                                                         <td>\r
176                                                                                 &nbsp;</td>\r
177                                                                 </tr>\r
178                                                                 <tr>\r
179                                                                         <td nowrap="nowrap">\r
180                                                                                 <span fcklang="DlgCellWordWrap">Word Wrap</span>:</td>\r
181                                                                         <td>\r
182                                                                                 &nbsp;<select id="selWordWrap">\r
183                                                                                         <option fcklang="DlgCellWordWrapYes" value="true" selected="selected">Yes</option>\r
184                                                                                         <option fcklang="DlgCellWordWrapNo" value="false">No</option>\r
185                                                                                 </select></td>\r
186                                                                 </tr>\r
187                                                                 <tr>\r
188                                                                         <td>\r
189                                                                                 &nbsp;</td>\r
190                                                                         <td>\r
191                                                                                 &nbsp;</td>\r
192                                                                 </tr>\r
193                                                                 <tr>\r
194                                                                         <td nowrap="nowrap">\r
195                                                                                 <span fcklang="DlgCellHorAlign">Horizontal Alignment</span>:</td>\r
196                                                                         <td>\r
197                                                                                 &nbsp;<select id="selHAlign">\r
198                                                                                         <option fcklang="DlgCellHorAlignNotSet" value="" selected>&lt;Not set&gt;</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
202                                                                                 </select></td>\r
203                                                                 </tr>\r
204                                                                 <tr>\r
205                                                                         <td nowrap="nowrap">\r
206                                                                                 <span fcklang="DlgCellVerAlign">Vertical Alignment</span>:</td>\r
207                                                                         <td>\r
208                                                                                 &nbsp;<select id="selVAlign">\r
209                                                                                         <option fcklang="DlgCellVerAlignNotSet" value="" selected>&lt;Not set&gt;</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
214                                                                                 </select></td>\r
215                                                                 </tr>\r
216                                                         </table>\r
217                                                 </td>\r
218                                                 <td>\r
219                                                         &nbsp;&nbsp;&nbsp;</td>\r
220                                                 <td align="right">\r
221                                                         <table cellspacing="0" cellpadding="0" border="0">\r
222                                                                 <tr>\r
223                                                                         <td nowrap="nowrap">\r
224                                                                          <span fcklang="DlgCellType">Cell Type</span>:</td>\r
225                                                                         <td colspan="2">\r
226                                                                                 &nbsp; <select id="selCellType">\r
227                                                                                         <option fcklang="DlgCellTypeData" value="td">Data</option>\r
228                                                                                         <option fcklang="DlgCellTypeHeader" value="th">Header</option>\r
229                                                                                 </select>\r
230                                                                 </tr>\r
231                                                                 <tr>\r
232                                                                         <td>\r
233                                                                                 &nbsp;</td>\r
234                                                                         <td>\r
235                                                                                 &nbsp;</td>\r
236                                                                         <td>\r
237                                                                                 &nbsp;</td>\r
238                                                                 </tr>\r
239                                                                 <tr>\r
240                                                                         <td nowrap="nowrap">\r
241                                                                                 <span fcklang="DlgCellRowSpan">Rows Span</span>:</td>\r
242                                                                         <td>\r
243                                                                                 &nbsp;\r
244                                                                                 <input onkeypress="return IsDigit(event);" id="txtRowSpan" type="text" maxlength="3" size="2"\r
245                                                                                         ></td>\r
246                                                                         <td>\r
247                                                                         </td>\r
248                                                                 </tr>\r
249                                                                 <tr>\r
250                                                                         <td nowrap="nowrap">\r
251                                                                                 <span fcklang="DlgCellCollSpan">Columns Span</span>:</td>\r
252                                                                         <td>\r
253                                                                                 &nbsp;\r
254                                                                                 <input onkeypress="return IsDigit(event);" id="txtCollSpan" type="text" maxlength="2"\r
255                                                                                         size="2"></td>\r
256                                                                         <td>\r
257                                                                         </td>\r
258                                                                 </tr>\r
259                                                                 <tr>\r
260                                                                         <td>\r
261                                                                                 &nbsp;</td>\r
262                                                                         <td>\r
263                                                                                 &nbsp;</td>\r
264                                                                         <td>\r
265                                                                                 &nbsp;</td>\r
266                                                                 </tr>\r
267                                                                 <tr>\r
268                                                                         <td nowrap="nowrap">\r
269                                                                                 <span fcklang="DlgCellBackColor">Background Color</span>:</td>\r
270                                                                         <td>\r
271                                                                                 &nbsp;<input id="txtBackColor" type="text" size="8" /></td>\r
272                                                                         <td>\r
273                                                                                 &nbsp;\r
274                                                                                 <input type="button" fcklang="DlgCellBtnSelect" value="Select..." onclick="SelectColor( 'Back' )"></td>\r
275                                                                 </tr>\r
276                                                                 <tr>\r
277                                                                         <td nowrap="nowrap">\r
278                                                                                 <span fcklang="DlgCellBorderColor">Border Color</span>:</td>\r
279                                                                         <td>\r
280                                                                                 &nbsp;<input id="txtBorderColor" type="text" size="8" /></td>\r
281                                                                         <td>\r
282                                                                                 &nbsp;\r
283                                                                                 <input type="button" fcklang="DlgCellBtnSelect" value="Select..." onclick="SelectColor( 'Border' )" /></td>\r
284                                                                 </tr>\r
285                                                         </table>\r
286                                                 </td>\r
287                                         </tr>\r
288                                 </table>\r
289                         </td>\r
290                 </tr>\r
291         </table>\r
292 </body>\r
293 </html>\r