FCKeditor 2.6.6
[freeside.git] / httemplate / elements / fckeditor / editor / dialog / fck_tablecell.html
index b7c536b..a4d1c97 100644 (file)
@@ -1,7 +1,7 @@
 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >\r
 <!--\r
  * FCKeditor - The text editor for Internet - http://www.fckeditor.net\r
- * Copyright (C) 2003-2007 Frederico Caldeira Knabben\r
+ * Copyright (C) 2003-2010 Frederico Caldeira Knabben\r
  *\r
  * == BEGIN LICENSE ==\r
  *\r
        <script src="common/fck_dialog_common.js" type="text/javascript"></script>\r
        <script type="text/javascript">\r
 \r
-var oEditor = window.parent.InnerDialogLoaded() ;\r
+var dialog     = window.parent ;\r
+var oEditor = dialog.InnerDialogLoaded() ;\r
 \r
-// Gets the document DOM\r
-var oDOM = oEditor.FCK.EditorDocument ;\r
+var FCKDomTools = oEditor.FCKDomTools ;\r
 \r
 // Array of selected Cells\r
 var aCells = oEditor.FCKTableHandler.GetSelectedCells() ;\r
@@ -44,8 +44,9 @@ window.onload = function()
 \r
        SetStartupValue() ;\r
 \r
-       window.parent.SetOkButton( true ) ;\r
-       window.parent.SetAutoSize( true ) ;\r
+       dialog.SetOkButton( true ) ;\r
+       dialog.SetAutoSize( true ) ;\r
+       SelectField( 'txtWidth' ) ;\r
 }\r
 \r
 function SetStartupValue()\r
@@ -72,13 +73,15 @@ function SetStartupValue()
                GetE('txtCollSpan').value               = GetAttribute( oCell, 'colSpan' ) ;\r
                GetE('txtBackColor').value              = GetAttribute( oCell, 'bgColor' ) ;\r
                GetE('txtBorderColor').value    = GetAttribute( oCell, 'borderColor' ) ;\r
-//             GetE('cmbFontStyle').value              = oCell.className ;\r
+               GetE('selCellType').value     = oCell.nodeName.toLowerCase() ;\r
        }\r
 }\r
 \r
 // Fired when the user press the OK button\r
 function Ok()\r
 {\r
+       oEditor.FCKUndo.SaveUndoStep() ;\r
+\r
        for( i = 0 ; i < aCells.length ; i++ )\r
        {\r
                if ( GetE('txtWidth').value.length > 0 )\r
@@ -87,7 +90,7 @@ function Ok()
                        aCells[i].removeAttribute( 'width', 0 ) ;\r
 \r
                if ( GetE('selWordWrap').value == 'false' )\r
-                       aCells[i].noWrap = true ;\r
+                       SetAttribute( aCells[i], 'noWrap', 'nowrap' ) ;\r
                else\r
                        aCells[i].removeAttribute( 'noWrap' ) ;\r
 \r
@@ -98,7 +101,25 @@ function Ok()
                SetAttribute( aCells[i], 'colSpan'              , GetE('txtCollSpan').value ) ;\r
                SetAttribute( aCells[i], 'bgColor'              , GetE('txtBackColor').value ) ;\r
                SetAttribute( aCells[i], 'borderColor'  , GetE('txtBorderColor').value ) ;\r
-//             SetAttribute( aCells[i], 'className'    , GetE('cmbFontStyle').value ) ;\r
+\r
+               var cellType = GetE('selCellType').value ;\r
+               if ( aCells[i].nodeName.toLowerCase() != cellType )\r
+                       aCells[i] = RenameNode( aCells[i], cellType ) ;\r
+       }\r
+\r
+       // The cells need to be reselected, otherwise the caret will appear inside the table borders (Gecko)\r
+       // or sent back to the beginning of the document (Opera and Safari).\r
+       // Strangely, IE works ok so no change is needed for IE.\r
+       if ( !oEditor.FCKBrowserInfo.IsIE )\r
+       {\r
+               var selection = oEditor.FCK.EditorWindow.getSelection() ;\r
+               selection.removeAllRanges() ;\r
+               for ( var i = 0 ; i < aCells.length ; i++ )\r
+               {\r
+                       var range = oEditor.FCK.EditorDocument.createRange() ;\r
+                       range.selectNode( aCells[i] ) ;\r
+                       selection.addRange( range ) ;\r
+               }\r
        }\r
 \r
        return true ;\r
@@ -118,7 +139,7 @@ function SelectBorderColor( color )
 \r
 function SelectColor( wich )\r
 {\r
-       oEditor.FCKDialog.OpenDialog( 'FCKDialog_Color', oEditor.FCKLang.DlgColorTitle, 'dialog/fck_colorselector.html', 400, 330, wich == 'Back' ? SelectBackColor : SelectBorderColor, window ) ;\r
+       oEditor.FCKDialog.OpenDialog( 'FCKDialog_Color', oEditor.FCKLang.DlgColorTitle, 'dialog/fck_colorselector.html', 410, 320, wich == 'Back' ? SelectBackColor : SelectBorderColor ) ;\r
 }\r
 \r
        </script>\r
@@ -136,7 +157,7 @@ function SelectColor( wich )
                                                                                <span fcklang="DlgCellWidth">Width</span>:</td>\r
                                                                        <td>\r
                                                                                &nbsp;<input onkeypress="return IsDigit(event);" id="txtWidth" type="text" maxlength="4"\r
-                                                                                       size="3" name="txtWidth" />&nbsp;<select id="selWidthType" name="selWidthType">\r
+                                                                                       size="3" />&nbsp;<select id="selWidthType">\r
                                                                                                <option fcklang="DlgCellWidthPx" value="pixels" selected="selected">pixels</option>\r
                                                                                                <option fcklang="DlgCellWidthPc" value="percent">percent</option>\r
                                                                                        </select></td>\r
@@ -145,7 +166,7 @@ function SelectColor( wich )
                                                                        <td nowrap="nowrap">\r
                                                                                <span fcklang="DlgCellHeight">Height</span>:</td>\r
                                                                        <td>\r
-                                                                               &nbsp;<input id="txtHeight" type="text" maxlength="4" size="3" name="txtHeight" onkeypress="return IsDigit(event);" />&nbsp;<span\r
+                                                                               &nbsp;<input id="txtHeight" type="text" maxlength="4" size="3" onkeypress="return IsDigit(event);" />&nbsp;<span\r
                                                                                        fcklang="DlgCellWidthPx">pixels</span></td>\r
                                                                </tr>\r
                                                                <tr>\r
@@ -158,7 +179,7 @@ function SelectColor( wich )
                                                                        <td nowrap="nowrap">\r
                                                                                <span fcklang="DlgCellWordWrap">Word Wrap</span>:</td>\r
                                                                        <td>\r
-                                                                               &nbsp;<select id="selWordWrap" name="selAlignment">\r
+                                                                               &nbsp;<select id="selWordWrap">\r
                                                                                        <option fcklang="DlgCellWordWrapYes" value="true" selected="selected">Yes</option>\r
                                                                                        <option fcklang="DlgCellWordWrapNo" value="false">No</option>\r
                                                                                </select></td>\r
@@ -173,7 +194,7 @@ function SelectColor( wich )
                                                                        <td nowrap="nowrap">\r
                                                                                <span fcklang="DlgCellHorAlign">Horizontal Alignment</span>:</td>\r
                                                                        <td>\r
-                                                                               &nbsp;<select id="selHAlign" name="selAlignment">\r
+                                                                               &nbsp;<select id="selHAlign">\r
                                                                                        <option fcklang="DlgCellHorAlignNotSet" value="" selected>&lt;Not set&gt;</option>\r
                                                                                        <option fcklang="DlgCellHorAlignLeft" value="left">Left</option>\r
                                                                                        <option fcklang="DlgCellHorAlignCenter" value="center">Center</option>\r
@@ -184,7 +205,7 @@ function SelectColor( wich )
                                                                        <td nowrap="nowrap">\r
                                                                                <span fcklang="DlgCellVerAlign">Vertical Alignment</span>:</td>\r
                                                                        <td>\r
-                                                                               &nbsp;<select id="selVAlign" name="selAlignment">\r
+                                                                               &nbsp;<select id="selVAlign">\r
                                                                                        <option fcklang="DlgCellVerAlignNotSet" value="" selected>&lt;Not set&gt;</option>\r
                                                                                        <option fcklang="DlgCellVerAlignTop" value="top">Top</option>\r
                                                                                        <option fcklang="DlgCellVerAlignMiddle" value="middle">Middle</option>\r
@@ -200,11 +221,28 @@ function SelectColor( wich )
                                                        <table cellspacing="0" cellpadding="0" border="0">\r
                                                                <tr>\r
                                                                        <td nowrap="nowrap">\r
+                                                                        <span fcklang="DlgCellType">Cell Type</span>:</td>\r
+                                                                       <td colspan="2">\r
+                                                                               &nbsp; <select id="selCellType">\r
+                                                                                       <option fcklang="DlgCellTypeData" value="td">Data</option>\r
+                                                                                       <option fcklang="DlgCellTypeHeader" value="th">Header</option>\r
+                                                                               </select>\r
+                                                               </tr>\r
+                                                               <tr>\r
+                                                                       <td>\r
+                                                                               &nbsp;</td>\r
+                                                                       <td>\r
+                                                                               &nbsp;</td>\r
+                                                                       <td>\r
+                                                                               &nbsp;</td>\r
+                                                               </tr>\r
+                                                               <tr>\r
+                                                                       <td nowrap="nowrap">\r
                                                                                <span fcklang="DlgCellRowSpan">Rows Span</span>:</td>\r
                                                                        <td>\r
                                                                                &nbsp;\r
                                                                                <input onkeypress="return IsDigit(event);" id="txtRowSpan" type="text" maxlength="3" size="2"\r
-                                                                                       name="txtRows"></td>\r
+                                                                                       ></td>\r
                                                                        <td>\r
                                                                        </td>\r
                                                                </tr>\r
@@ -214,7 +252,7 @@ function SelectColor( wich )
                                                                        <td>\r
                                                                                &nbsp;\r
                                                                                <input onkeypress="return IsDigit(event);" id="txtCollSpan" type="text" maxlength="2"\r
-                                                                                       size="2" name="txtColumns"></td>\r
+                                                                                       size="2"></td>\r
                                                                        <td>\r
                                                                        </td>\r
                                                                </tr>\r
@@ -230,7 +268,7 @@ function SelectColor( wich )
                                                                        <td nowrap="nowrap">\r
                                                                                <span fcklang="DlgCellBackColor">Background Color</span>:</td>\r
                                                                        <td>\r
-                                                                               &nbsp;<input id="txtBackColor" type="text" size="8" name="txtCellSpacing"></td>\r
+                                                                               &nbsp;<input id="txtBackColor" type="text" size="8" /></td>\r
                                                                        <td>\r
                                                                                &nbsp;\r
                                                                                <input type="button" fcklang="DlgCellBtnSelect" value="Select..." onclick="SelectColor( 'Back' )"></td>\r
@@ -239,7 +277,7 @@ function SelectColor( wich )
                                                                        <td nowrap="nowrap">\r
                                                                                <span fcklang="DlgCellBorderColor">Border Color</span>:</td>\r
                                                                        <td>\r
-                                                                               &nbsp;<input id="txtBorderColor" type="text" size="8" name="txtCellPadding" /></td>\r
+                                                                               &nbsp;<input id="txtBorderColor" type="text" size="8" /></td>\r
                                                                        <td>\r
                                                                                &nbsp;\r
                                                                                <input type="button" fcklang="DlgCellBtnSelect" value="Select..." onclick="SelectColor( 'Border' )" /></td>\r