source: branches/2.2/filemanager/tp/ckeditor/_source/plugins/forms/dialogs/form.js @ 3019

Revision 3019, 3.9 KB checked in by amuller, 14 years ago (diff)

Ticket #1135 - Corrigindo CSS e adicionando filemanager

Line 
1/*
2Copyright (c) 2003-2009, CKSource - Frederico Knabben. All rights reserved.
3For licensing, see LICENSE.html or http://ckeditor.com/license
4*/
5CKEDITOR.dialog.add( 'form', function( editor )
6{
7        var autoAttributes =
8        {
9                action : 1,
10                id : 1,
11                method : 1,
12                enctype : 1,
13                target : 1
14        };
15
16        return {
17                title : editor.lang.form.title,
18                minWidth : 350,
19                minHeight : 200,
20                onShow : function()
21                {
22                        delete this.form;
23
24                        var element = this.getParentEditor().getSelection().getStartElement();
25                        var form = element && element.getAscendant( 'form', true );
26                        if ( form )
27                        {
28                                this.form = form;
29                                this.setupContent( form );
30                        }
31                },
32                onOk : function()
33                {
34                        var editor,
35                                element = this.form,
36                                isInsertMode = !element;
37
38                        if ( isInsertMode )
39                        {
40                                editor = this.getParentEditor();
41                                element = editor.document.createElement( 'form' );
42                                element.append( editor.document.createElement( 'br' ) );
43                        }
44
45                        if ( isInsertMode )
46                                editor.insertElement( element );
47                        this.commitContent( element );
48                },
49                onLoad : function()
50                {
51                        function autoSetup( element )
52                        {
53                                this.setValue( element.getAttribute( this.id ) || '' );
54                        }
55
56                        function autoCommit( element )
57                        {
58                                if ( this.getValue() )
59                                        element.setAttribute( this.id, this.getValue() );
60                                else
61                                        element.removeAttribute( this.id );
62                        }
63
64                        this.foreach( function( contentObj )
65                                {
66                                        if ( autoAttributes[ contentObj.id ] )
67                                        {
68                                                contentObj.setup = autoSetup;
69                                                contentObj.commit = autoCommit;
70                                        }
71                                } );
72                },
73                contents : [
74                        {
75                                id : 'info',
76                                label : editor.lang.form.title,
77                                title : editor.lang.form.title,
78                                elements : [
79                                        {
80                                                id : 'txtName',
81                                                type : 'text',
82                                                label : editor.lang.common.name,
83                                                'default' : '',
84                                                accessKey : 'N',
85                                                setup : function( element )
86                                                {
87                                                        this.setValue( element.getAttribute( '_cke_saved_name' ) ||
88                                                                        element.getAttribute( 'name' ) ||
89                                                                        '' );
90                                                },
91                                                commit : function( element )
92                                                {
93                                                        if ( this.getValue() )
94                                                                element.setAttribute( '_cke_saved_name', this.getValue() );
95                                                        else
96                                                        {
97                                                                element.removeAttribute( '_cke_saved_name' );
98                                                                element.removeAttribute( 'name' );
99                                                        }
100                                                }
101                                        },
102                                        {
103                                                id : 'action',
104                                                type : 'text',
105                                                label : editor.lang.form.action,
106                                                'default' : '',
107                                                accessKey : 'A'
108                                        },
109                                        {
110                                                type : 'hbox',
111                                                widths : [ '45%', '55%' ],
112                                                children :
113                                                [
114                                                        {
115                                                                id : 'id',
116                                                                type : 'text',
117                                                                label : editor.lang.common.id,
118                                                                'default' : '',
119                                                                accessKey : 'I'
120                                                        },
121                                                        {
122                                                                id : 'enctype',
123                                                                type : 'select',
124                                                                label : editor.lang.form.encoding,
125                                                                style : 'width:100%',
126                                                                accessKey : 'E',
127                                                                'default' : '',
128                                                                items :
129                                                                [
130                                                                        [ '' ],
131                                                                        [ 'text/plain' ],
132                                                                        [ 'multipart/form-data' ],
133                                                                        [ 'application/x-www-form-urlencoded' ]
134                                                                ]
135                                                        }
136                                                ]
137                                        },
138                                        {
139                                                type : 'hbox',
140                                                widths : [ '45%', '55%' ],
141                                                children :
142                                                [
143                                                        {
144                                                                id : 'target',
145                                                                type : 'select',
146                                                                label : editor.lang.form.target,
147                                                                style : 'width:100%',
148                                                                accessKey : 'M',
149                                                                'default' : '',
150                                                                items :
151                                                                [
152                                                                        [ editor.lang.form.targetNotSet, '' ],
153                                                                        [ editor.lang.form.targetNew, '_blank' ],
154                                                                        [ editor.lang.form.targetTop, '_top' ],
155                                                                        [ editor.lang.form.targetSelf, '_self' ],
156                                                                        [ editor.lang.form.targetParent, '_parent' ]
157                                                                ]
158                                                        },
159                                                        {
160                                                                id : 'method',
161                                                                type : 'select',
162                                                                label : editor.lang.form.method,
163                                                                accessKey : 'M',
164                                                                'default' : 'GET',
165                                                                items :
166                                                                [
167                                                                        [ 'GET', 'get' ],
168                                                                        [ 'POST', 'post' ]
169                                                                ]
170                                                        }
171                                                ]
172                                        }
173                                ]
174                        }
175                ]
176        };
177});
Note: See TracBrowser for help on using the repository browser.