fck_tablecell.html 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298
  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-2010 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. * Cell properties dialog window.
  23. -->
  24. <html xmlns="http://www.w3.org/1999/xhtml">
  25. <head>
  26. <title>Table Cell 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. var dialog = window.parent ;
  32. var oEditor = dialog.InnerDialogLoaded() ;
  33. var FCKDomTools = oEditor.FCKDomTools ;
  34. // Array of selected Cells
  35. var aCells = oEditor.FCKTableHandler.GetSelectedCells() ;
  36. window.onload = function()
  37. {
  38. // First of all, translate the dialog box texts
  39. oEditor.FCKLanguageManager.TranslatePage( document ) ;
  40. SetStartupValue() ;
  41. dialog.SetOkButton( true ) ;
  42. dialog.SetAutoSize( true ) ;
  43. SelectField( 'txtWidth' ) ;
  44. }
  45. function SetStartupValue()
  46. {
  47. if ( aCells.length > 0 )
  48. {
  49. var oCell = aCells[0] ;
  50. var iWidth = GetAttribute( oCell, 'width' ) ;
  51. if ( iWidth.indexOf && iWidth.indexOf( '%' ) >= 0 )
  52. {
  53. iWidth = iWidth.substr( 0, iWidth.length - 1 ) ;
  54. GetE('selWidthType').value = 'percent' ;
  55. }
  56. if ( oCell.attributes['noWrap'] != null && oCell.attributes['noWrap'].specified )
  57. GetE('selWordWrap').value = !oCell.noWrap ;
  58. GetE('txtWidth').value = iWidth ;
  59. GetE('txtHeight').value = GetAttribute( oCell, 'height' ) ;
  60. GetE('selHAlign').value = GetAttribute( oCell, 'align' ) ;
  61. GetE('selVAlign').value = GetAttribute( oCell, 'vAlign' ) ;
  62. GetE('txtRowSpan').value = GetAttribute( oCell, 'rowSpan' ) ;
  63. GetE('txtCollSpan').value = GetAttribute( oCell, 'colSpan' ) ;
  64. GetE('txtBackColor').value = GetAttribute( oCell, 'bgColor' ) ;
  65. GetE('txtBorderColor').value = GetAttribute( oCell, 'borderColor' ) ;
  66. GetE('selCellType').value = oCell.nodeName.toLowerCase() ;
  67. }
  68. }
  69. // Fired when the user press the OK button
  70. function Ok()
  71. {
  72. oEditor.FCKUndo.SaveUndoStep() ;
  73. for( i = 0 ; i < aCells.length ; i++ )
  74. {
  75. if ( GetE('txtWidth').value.length > 0 )
  76. aCells[i].width = GetE('txtWidth').value + ( GetE('selWidthType').value == 'percent' ? '%' : '') ;
  77. else
  78. aCells[i].removeAttribute( 'width', 0 ) ;
  79. if ( GetE('selWordWrap').value == 'false' )
  80. SetAttribute( aCells[i], 'noWrap', 'nowrap' ) ;
  81. else
  82. aCells[i].removeAttribute( 'noWrap' ) ;
  83. SetAttribute( aCells[i], 'height' , GetE('txtHeight').value ) ;
  84. SetAttribute( aCells[i], 'align' , GetE('selHAlign').value ) ;
  85. SetAttribute( aCells[i], 'vAlign' , GetE('selVAlign').value ) ;
  86. SetAttribute( aCells[i], 'rowSpan' , GetE('txtRowSpan').value ) ;
  87. SetAttribute( aCells[i], 'colSpan' , GetE('txtCollSpan').value ) ;
  88. SetAttribute( aCells[i], 'bgColor' , GetE('txtBackColor').value ) ;
  89. SetAttribute( aCells[i], 'borderColor' , GetE('txtBorderColor').value ) ;
  90. var cellType = GetE('selCellType').value ;
  91. if ( aCells[i].nodeName.toLowerCase() != cellType )
  92. aCells[i] = RenameNode( aCells[i], cellType ) ;
  93. }
  94. // The cells need to be reselected, otherwise the caret will appear inside the table borders (Gecko)
  95. // or sent back to the beginning of the document (Opera and Safari).
  96. // Strangely, IE works ok so no change is needed for IE.
  97. if ( !oEditor.FCKBrowserInfo.IsIE )
  98. {
  99. var selection = oEditor.FCK.EditorWindow.getSelection() ;
  100. selection.removeAllRanges() ;
  101. for ( var i = 0 ; i < aCells.length ; i++ )
  102. {
  103. var range = oEditor.FCK.EditorDocument.createRange() ;
  104. range.selectNode( aCells[i] ) ;
  105. selection.addRange( range ) ;
  106. }
  107. }
  108. return true ;
  109. }
  110. function SelectBackColor( color )
  111. {
  112. if ( color && color.length > 0 )
  113. GetE('txtBackColor').value = color ;
  114. }
  115. function SelectBorderColor( color )
  116. {
  117. if ( color && color.length > 0 )
  118. GetE('txtBorderColor').value = color ;
  119. }
  120. function SelectColor( wich )
  121. {
  122. oEditor.FCKDialog.OpenDialog( 'FCKDialog_Color', oEditor.FCKLang.DlgColorTitle, 'dialog/fck_colorselector.html', 410, 320, wich == 'Back' ? SelectBackColor : SelectBorderColor ) ;
  123. }
  124. </script>
  125. <style type="text/css">
  126. body, td, input, textarea, select, label { font-family: Arial, Verdana, Geneva, helvetica, sans-serif; font-size: 11px; }
  127. </style>
  128. </head>
  129. <body scroll="no" style="overflow: hidden">
  130. <table cellspacing="0" cellpadding="0" width="100%" border="0" height="100%">
  131. <tr>
  132. <td>
  133. <table cellspacing="1" cellpadding="1" width="100%" border="0">
  134. <tr>
  135. <td>
  136. <table cellspacing="0" cellpadding="0" border="0">
  137. <tr>
  138. <td nowrap="nowrap">
  139. <span fcklang="DlgCellWidth">Width</span>:</td>
  140. <td>
  141. &nbsp;<input onkeypress="return IsDigit(event);" id="txtWidth" type="text" maxlength="4"
  142. size="3" />&nbsp;<select id="selWidthType">
  143. <option fcklang="DlgCellWidthPx" value="pixels" selected="selected">pixels</option>
  144. <option fcklang="DlgCellWidthPc" value="percent">percent</option>
  145. </select></td>
  146. </tr>
  147. <tr>
  148. <td nowrap="nowrap">
  149. <span fcklang="DlgCellHeight">Height</span>:</td>
  150. <td>
  151. &nbsp;<input id="txtHeight" type="text" maxlength="4" size="3" onkeypress="return IsDigit(event);" />&nbsp;<span
  152. fcklang="DlgCellWidthPx">pixels</span></td>
  153. </tr>
  154. <tr>
  155. <td>
  156. &nbsp;</td>
  157. <td>
  158. &nbsp;</td>
  159. </tr>
  160. <tr>
  161. <td nowrap="nowrap">
  162. <span fcklang="DlgCellWordWrap">Word Wrap</span>:</td>
  163. <td>
  164. &nbsp;<select id="selWordWrap">
  165. <option fcklang="DlgCellWordWrapYes" value="true" selected="selected">Yes</option>
  166. <option fcklang="DlgCellWordWrapNo" value="false">No</option>
  167. </select></td>
  168. </tr>
  169. <tr>
  170. <td>
  171. &nbsp;</td>
  172. <td>
  173. &nbsp;</td>
  174. </tr>
  175. <tr>
  176. <td nowrap="nowrap">
  177. <span fcklang="DlgCellHorAlign">Horizontal Alignment</span>:</td>
  178. <td>
  179. &nbsp;<select id="selHAlign">
  180. <option fcklang="DlgCellHorAlignNotSet" value="" selected>&lt;Not set&gt;</option>
  181. <option fcklang="DlgCellHorAlignLeft" value="left">Left</option>
  182. <option fcklang="DlgCellHorAlignCenter" value="center">Center</option>
  183. <option fcklang="DlgCellHorAlignRight" value="right">Right</option>
  184. </select></td>
  185. </tr>
  186. <tr>
  187. <td nowrap="nowrap">
  188. <span fcklang="DlgCellVerAlign">Vertical Alignment</span>:</td>
  189. <td>
  190. &nbsp;<select id="selVAlign">
  191. <option fcklang="DlgCellVerAlignNotSet" value="" selected>&lt;Not set&gt;</option>
  192. <option fcklang="DlgCellVerAlignTop" value="top">Top</option>
  193. <option fcklang="DlgCellVerAlignMiddle" value="middle">Middle</option>
  194. <option fcklang="DlgCellVerAlignBottom" value="bottom">Bottom</option>
  195. <option fcklang="DlgCellVerAlignBaseline" value="baseline">Baseline</option>
  196. </select></td>
  197. </tr>
  198. </table>
  199. </td>
  200. <td>
  201. &nbsp;&nbsp;&nbsp;</td>
  202. <td align="right">
  203. <table cellspacing="0" cellpadding="0" border="0">
  204. <tr>
  205. <td nowrap="nowrap">
  206. <span fcklang="DlgCellType">Cell Type</span>:</td>
  207. <td colspan="2">
  208. &nbsp; <select id="selCellType">
  209. <option fcklang="DlgCellTypeData" value="td">Data</option>
  210. <option fcklang="DlgCellTypeHeader" value="th">Header</option>
  211. </select>
  212. </tr>
  213. <tr>
  214. <td>
  215. &nbsp;</td>
  216. <td>
  217. &nbsp;</td>
  218. <td>
  219. &nbsp;</td>
  220. </tr>
  221. <tr>
  222. <td nowrap="nowrap">
  223. <span fcklang="DlgCellRowSpan">Rows Span</span>:</td>
  224. <td>
  225. &nbsp;
  226. <input onkeypress="return IsDigit(event);" id="txtRowSpan" type="text" maxlength="3" size="2"
  227. ></td>
  228. <td>
  229. </td>
  230. </tr>
  231. <tr>
  232. <td nowrap="nowrap">
  233. <span fcklang="DlgCellCollSpan">Columns Span</span>:</td>
  234. <td>
  235. &nbsp;
  236. <input onkeypress="return IsDigit(event);" id="txtCollSpan" type="text" maxlength="2"
  237. size="2"></td>
  238. <td>
  239. </td>
  240. </tr>
  241. <tr>
  242. <td>
  243. &nbsp;</td>
  244. <td>
  245. &nbsp;</td>
  246. <td>
  247. &nbsp;</td>
  248. </tr>
  249. <tr>
  250. <td nowrap="nowrap">
  251. <span fcklang="DlgCellBackColor">Background Color</span>:</td>
  252. <td>
  253. &nbsp;<input id="txtBackColor" type="text" size="8" /></td>
  254. <td>
  255. &nbsp;
  256. <input type="button" fcklang="DlgCellBtnSelect" value="Select..." onclick="SelectColor( 'Back' )"></td>
  257. </tr>
  258. <tr>
  259. <td nowrap="nowrap">
  260. <span fcklang="DlgCellBorderColor">Border Color</span>:</td>
  261. <td>
  262. &nbsp;<input id="txtBorderColor" type="text" size="8" /></td>
  263. <td>
  264. &nbsp;
  265. <input type="button" fcklang="DlgCellBtnSelect" value="Select..." onclick="SelectColor( 'Border' )" /></td>
  266. </tr>
  267. </table>
  268. </td>
  269. </tr>
  270. </table>
  271. </td>
  272. </tr>
  273. </table>
  274. </body>
  275. </html>