~mortenoh/+junk/dhis2-detailed-import-export

« back to all changes in this revision

Viewing changes to dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/javascript/FCK/editor/dialog/fck_table.html

  • Committer: larshelge at gmail
  • Date: 2009-03-03 16:46:36 UTC
  • Revision ID: larshelge@gmail.com-20090303164636-2sjlrquo7ib1gf7r
Initial check-in

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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-2007 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
 * Table dialog window.
 
23
-->
 
24
<html xmlns="http://www.w3.org/1999/xhtml">
 
25
<head>
 
26
        <title>Table 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
 
 
32
var oEditor = window.parent.InnerDialogLoaded() ;
 
33
 
 
34
// Gets the document DOM
 
35
var oDOM = oEditor.FCK.EditorDocument ;
 
36
 
 
37
// Gets the table if there is one selected.
 
38
var table ;
 
39
var e = oEditor.FCKSelection.GetSelectedElement() ;
 
40
 
 
41
if ( ( !e && document.location.search.substr(1) == 'Parent' ) || ( e && e.tagName != 'TABLE' ) )
 
42
        e = oEditor.FCKSelection.MoveToAncestorNode( 'TABLE' ) ;
 
43
 
 
44
if ( e && e.tagName == "TABLE" )
 
45
        table = e ;
 
46
 
 
47
// Fired when the window loading process is finished. It sets the fields with the
 
48
// actual values if a table is selected in the editor.
 
49
window.onload = function()
 
50
{
 
51
        // First of all, translate the dialog box texts
 
52
        oEditor.FCKLanguageManager.TranslatePage(document) ;
 
53
 
 
54
        if (table)
 
55
        {
 
56
                document.getElementById('txtRows').value    = table.rows.length ;
 
57
                document.getElementById('txtColumns').value = table.rows[0].cells.length ;
 
58
 
 
59
                // Gets the value from the Width or the Style attribute
 
60
                var iWidth  = (table.style.width  ? table.style.width  : table.width ) ;
 
61
                var iHeight = (table.style.height ? table.style.height : table.height ) ;
 
62
 
 
63
                if (iWidth.indexOf('%') >= 0)                   // Percentual = %
 
64
                {
 
65
                        iWidth = parseInt( iWidth.substr(0,iWidth.length - 1), 10 ) ;
 
66
                        document.getElementById('selWidthType').value = "percent" ;
 
67
                }
 
68
                else if (iWidth.indexOf('px') >= 0)             // Style Pixel = px
 
69
                {                                                                                                                                                                                                                 //
 
70
                        iWidth = iWidth.substr(0,iWidth.length - 2);
 
71
                        document.getElementById('selWidthType').value = "pixels" ;
 
72
                }
 
73
 
 
74
                if (iHeight && iHeight.indexOf('px') >= 0)              // Style Pixel = px
 
75
                        iHeight = iHeight.substr(0,iHeight.length - 2);
 
76
 
 
77
                document.getElementById('txtWidth').value               = iWidth || '' ;
 
78
                document.getElementById('txtHeight').value              = iHeight || '' ;
 
79
                document.getElementById('txtBorder').value              = GetAttribute( table, 'border', '' ) ;
 
80
                document.getElementById('selAlignment').value   = GetAttribute( table, 'align', '' ) ;
 
81
                document.getElementById('txtCellPadding').value = GetAttribute( table, 'cellPadding', '' ) ;
 
82
                document.getElementById('txtCellSpacing').value = GetAttribute( table, 'cellSpacing', '' ) ;
 
83
                document.getElementById('txtSummary').value     = GetAttribute( table, 'summary', '' ) ;
 
84
//              document.getElementById('cmbFontStyle').value   = table.className ;
 
85
 
 
86
                if (table.caption) document.getElementById('txtCaption').value = table.caption.innerHTML ;
 
87
 
 
88
                document.getElementById('txtRows').disabled    = true ;
 
89
                document.getElementById('txtColumns').disabled = true ;
 
90
        }
 
91
 
 
92
        window.parent.SetOkButton( true ) ;
 
93
        window.parent.SetAutoSize( true ) ;
 
94
}
 
95
 
 
96
// Fired when the user press the OK button
 
97
function Ok()
 
98
{
 
99
        var bExists = ( table != null ) ;
 
100
 
 
101
        if ( ! bExists )
 
102
                table = oEditor.FCK.EditorDocument.createElement( "TABLE" ) ;
 
103
 
 
104
        // Removes the Width and Height styles
 
105
        if ( bExists && table.style.width )             table.style.width = null ; //.removeAttribute("width") ;
 
106
        if ( bExists && table.style.height )    table.style.height = null ; //.removeAttribute("height") ;
 
107
 
 
108
        var sWidth = GetE('txtWidth').value ;
 
109
        if ( sWidth.length > 0 && GetE('selWidthType').value == 'percent' )
 
110
                sWidth += '%' ;
 
111
 
 
112
        SetAttribute( table, 'width'            , sWidth ) ;
 
113
        SetAttribute( table, 'height'           , GetE('txtHeight').value ) ;
 
114
        SetAttribute( table, 'border'           , GetE('txtBorder').value ) ;
 
115
        SetAttribute( table, 'align'            , GetE('selAlignment').value ) ;
 
116
        SetAttribute( table, 'cellPadding'      , GetE('txtCellPadding').value ) ;
 
117
        SetAttribute( table, 'cellSpacing'      , GetE('txtCellSpacing').value ) ;
 
118
        SetAttribute( table, 'summary'          , GetE('txtSummary').value ) ;
 
119
 
 
120
        var eCaption = oEditor.FCKDomTools.GetFirstChild( table, 'CAPTION' ) ;
 
121
 
 
122
        if ( document.getElementById('txtCaption').value != '')
 
123
        {
 
124
                if ( !eCaption )
 
125
                {
 
126
                        eCaption = oEditor.FCK.EditorDocument.createElement( 'CAPTION' ) ;
 
127
                        table.insertBefore( eCaption, table.firstChild ) ;
 
128
                }
 
129
 
 
130
                eCaption.innerHTML = document.getElementById('txtCaption').value ;
 
131
        }
 
132
        else if ( bExists && eCaption )
 
133
        {
 
134
                if ( oEditor.FCKBrowserInfo.IsIE )
 
135
                        eCaption.innerHTML = '' ;       // TODO: It causes an IE internal error if using removeChild or table.deleteCaption().
 
136
                else
 
137
                        eCaption.parentNode.removeChild( eCaption ) ;
 
138
        }
 
139
 
 
140
        if (! bExists)
 
141
        {
 
142
                var iRows = document.getElementById('txtRows').value ;
 
143
                var iCols = document.getElementById('txtColumns').value ;
 
144
 
 
145
                for ( var r = 0 ; r < iRows ; r++ )
 
146
                {
 
147
                        var oRow = table.insertRow(-1) ;
 
148
                        for ( var c = 0 ; c < iCols ; c++ )
 
149
                        {
 
150
                                var oCell = oRow.insertCell(-1) ;
 
151
                                if ( oEditor.FCKBrowserInfo.IsGeckoLike )
 
152
                                        oCell.innerHTML = GECKO_BOGUS ;
 
153
                                //oCell.innerHTML = "&nbsp;" ;
 
154
                        }
 
155
                }
 
156
 
 
157
                oEditor.FCKUndo.SaveUndoStep() ;
 
158
 
 
159
                oEditor.FCK.InsertElement( table ) ;
 
160
        }
 
161
 
 
162
        return true ;
 
163
}
 
164
 
 
165
        </script>
 
166
</head>
 
167
<body style="overflow: hidden">
 
168
        <table id="otable" cellspacing="0" cellpadding="0" width="100%" border="0" style="height: 100%">
 
169
                <tr>
 
170
                        <td>
 
171
                                <table cellspacing="1" cellpadding="1" width="100%" border="0">
 
172
                                        <tr>
 
173
                                                <td valign="top">
 
174
                                                        <table cellspacing="0" cellpadding="0" border="0">
 
175
                                                                <tr>
 
176
                                                                        <td>
 
177
                                                                                <span fcklang="DlgTableRows">Rows</span>:</td>
 
178
                                                                        <td>
 
179
                                                                                &nbsp;<input id="txtRows" type="text" maxlength="3" size="2" value="3" name="txtRows"
 
180
                                                                                        onkeypress="return IsDigit(event);" /></td>
 
181
                                                                </tr>
 
182
                                                                <tr>
 
183
                                                                        <td>
 
184
                                                                                <span fcklang="DlgTableColumns">Columns</span>:</td>
 
185
                                                                        <td>
 
186
                                                                                &nbsp;<input id="txtColumns" type="text" maxlength="2" size="2" value="2" name="txtColumns"
 
187
                                                                                        onkeypress="return IsDigit(event);" /></td>
 
188
                                                                </tr>
 
189
                                                                <tr>
 
190
                                                                        <td>
 
191
                                                                                &nbsp;</td>
 
192
                                                                        <td>
 
193
                                                                                &nbsp;</td>
 
194
                                                                </tr>
 
195
                                                                <tr>
 
196
                                                                        <td>
 
197
                                                                                <span fcklang="DlgTableBorder">Border size</span>:</td>
 
198
                                                                        <td>
 
199
                                                                                &nbsp;<input id="txtBorder" type="text" maxlength="2" size="2" value="1" name="txtBorder"
 
200
                                                                                        onkeypress="return IsDigit(event);" /></td>
 
201
                                                                </tr>
 
202
                                                                <tr>
 
203
                                                                        <td>
 
204
                                                                                <span fcklang="DlgTableAlign">Alignment</span>:</td>
 
205
                                                                        <td>
 
206
                                                                                &nbsp;<select id="selAlignment" name="selAlignment">
 
207
                                                                                        <option fcklang="DlgTableAlignNotSet" value="" selected="selected">&lt;Not set&gt;</option>
 
208
                                                                                        <option fcklang="DlgTableAlignLeft" value="left">Left</option>
 
209
                                                                                        <option fcklang="DlgTableAlignCenter" value="center">Center</option>
 
210
                                                                                        <option fcklang="DlgTableAlignRight" value="right">Right</option>
 
211
                                                                                </select></td>
 
212
                                                                </tr>
 
213
                                                        </table>
 
214
                                                </td>
 
215
                                                <td>
 
216
                                                        &nbsp;&nbsp;&nbsp;</td>
 
217
                                                <td align="right" valign="top">
 
218
                                                        <table cellspacing="0" cellpadding="0" border="0">
 
219
                                                                <tr>
 
220
                                                                        <td>
 
221
                                                                                <span fcklang="DlgTableWidth">Width</span>:</td>
 
222
                                                                        <td>
 
223
                                                                                &nbsp;<input id="txtWidth" type="text" maxlength="4" size="3" value="200" name="txtWidth"
 
224
                                                                                        onkeypress="return IsDigit(event);" /></td>
 
225
                                                                        <td>
 
226
                                                                                &nbsp;<select id="selWidthType" name="selWidthType">
 
227
                                                                                        <option fcklang="DlgTableWidthPx" value="pixels" selected="selected">pixels</option>
 
228
                                                                                        <option fcklang="DlgTableWidthPc" value="percent">percent</option>
 
229
                                                                                </select></td>
 
230
                                                                </tr>
 
231
                                                                <tr>
 
232
                                                                        <td>
 
233
                                                                                <span fcklang="DlgTableHeight">Height</span>:</td>
 
234
                                                                        <td>
 
235
                                                                                &nbsp;<input id="txtHeight" type="text" maxlength="4" size="3" name="txtHeight" onkeypress="return IsDigit(event);" /></td>
 
236
                                                                        <td>
 
237
                                                                                &nbsp;<span fcklang="DlgTableWidthPx">pixels</span></td>
 
238
                                                                </tr>
 
239
                                                                <tr>
 
240
                                                                        <td>
 
241
                                                                                &nbsp;</td>
 
242
                                                                        <td>
 
243
                                                                                &nbsp;</td>
 
244
                                                                        <td>
 
245
                                                                                &nbsp;</td>
 
246
                                                                </tr>
 
247
                                                                <tr>
 
248
                                                                        <td nowrap="nowrap">
 
249
                                                                                <span fcklang="DlgTableCellSpace">Cell spacing</span>:</td>
 
250
                                                                        <td>
 
251
                                                                                &nbsp;<input id="txtCellSpacing" type="text" maxlength="2" size="2" value="1" name="txtCellSpacing"
 
252
                                                                                        onkeypress="return IsDigit(event);" /></td>
 
253
                                                                        <td>
 
254
                                                                                &nbsp;</td>
 
255
                                                                </tr>
 
256
                                                                <tr>
 
257
                                                                        <td nowrap="nowrap">
 
258
                                                                                <span fcklang="DlgTableCellPad">Cell padding</span>:</td>
 
259
                                                                        <td>
 
260
                                                                                &nbsp;<input id="txtCellPadding" type="text" maxlength="2" size="2" value="1" name="txtCellPadding"
 
261
                                                                                        onkeypress="return IsDigit(event);" /></td>
 
262
                                                                        <td>
 
263
                                                                                &nbsp;</td>
 
264
                                                                </tr>
 
265
                                                        </table>
 
266
                                                </td>
 
267
                                        </tr>
 
268
                                </table>
 
269
                                <table cellspacing="0" cellpadding="0" width="100%" border="0">
 
270
                                        <tr>
 
271
                                                <td nowrap="nowrap">
 
272
                                                        <span fcklang="DlgTableCaption">Caption</span>:&nbsp;</td>
 
273
                                                <td>
 
274
                                                        &nbsp;</td>
 
275
                                                <td width="100%" nowrap="nowrap">
 
276
                                                        <input id="txtCaption" type="text" style="width: 100%" /></td>
 
277
                                        </tr>
 
278
                                        <tr>
 
279
                                                <td nowrap="nowrap">
 
280
                                                        <span fcklang="DlgTableSummary">Summary</span>:&nbsp;</td>
 
281
                                                <td>
 
282
                                                        &nbsp;</td>
 
283
                                                <td width="100%" nowrap="nowrap">
 
284
                                                        <input id="txtSummary" type="text" style="width: 100%" /></td>
 
285
                                        </tr>
 
286
                                </table>
 
287
                        </td>
 
288
                </tr>
 
289
        </table>
 
290
</body>
 
291
</html>