Ticket #2820: 2820_5.patch

File 2820_5.patch, 44.5 KB (added by Artur Formella, 15 years ago)
  • _source/core/config.js

     
    147147         * config.plugins = 'basicstyles,button,htmldataprocessor,toolbar,wysiwygarea';
    148148         */
    149149
    150         plugins : 'basicstyles,button,elementspath,horizontalrule,htmldataprocessor,keystrokes,newpage,pagebreak,preview,removeformat,smiley,indent,link,list,sourcearea,table,specialchar,tab,toolbar,wysiwygarea',
     150        plugins : 'basicstyles,button,elementspath,forms,horizontalrule,htmldataprocessor,keystrokes,newpage,pagebreak,preview,removeformat,smiley,indent,link,list,sourcearea,table,specialchar,tab,toolbar,wysiwygarea',
    151151
    152152        /**
    153153         * The theme to be used to build the UI.
  • _source/plugins/forms/dialogs/button.js

     
     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( 'button', function( editor )
     6{
     7        return {
     8                title : editor.lang.button.title,
     9                minWidth : 400,
     10                minHeight : 230,
     11                onShow : function()
     12                {
     13                        // IE BUG: Selection must be in the editor for getSelectedElement()
     14                        // to work.
     15                        this.restoreSelection();
     16
     17                        var element = this.getParentEditor().getSelection().getSelectedElement();
     18                        if ( element && element.getName() == "input" )
     19                        {
     20                                var type = element.getAttribute( 'type' );
     21                                if ( type == "button" || type == "reset" || type == "submit" )
     22                                {
     23                                        this._element = element;
     24                                        this.setupContent( element );
     25                                }
     26                        }
     27                },
     28                onOk : function()
     29                {
     30                        var editor,
     31                                element = this._element,
     32                                isInsertMode = !element;
     33
     34                        if ( isInsertMode )
     35                        {
     36                                editor = this.getParentEditor();
     37                                element = editor.document.createElement( 'input' );
     38                        }
     39                        this.commitContent( element );
     40
     41                        if ( isInsertMode )
     42                        {
     43                                this.restoreSelection();
     44                                this.clearSavedSelection();
     45                                editor.insertElement( element );
     46                        }
     47                },
     48                contents : [
     49                        {
     50                                id : 'info',
     51                                label : editor.lang.button.title,
     52                                title : editor.lang.button.title,
     53                                elements : [
     54                                        {
     55                                                id : 'txtName',
     56                                                type : 'text',
     57                                                label : editor.lang.common.name,
     58                                                'default' : '',
     59                                                setup : function( element )
     60                                                {
     61                                                        this.setValue( element.getAttribute( 'name' ) );
     62                                                        this.focus();
     63                                                },
     64                                                commit : function( element )
     65                                                {
     66                                                        if ( this.getValue() != '' || this.isChanged() )
     67                                                                element.setAttribute( 'name', this.getValue() );
     68                                                }
     69                                        },
     70                                        {
     71                                                id : 'txtValue',
     72                                                type : 'text',
     73                                                label : editor.lang.button.text,
     74                                                accessKey : 'V',
     75                                                'default' : '',
     76                                                setup : function( element )
     77                                                {
     78                                                        this.setValue( element.getAttribute( 'value' ) );
     79                                                },
     80                                                commit : function( element )
     81                                                {
     82                                                        if ( this.getValue() != '' || this.isChanged() )
     83                                                                element.setAttribute( 'value', this.getValue() );
     84                                                }
     85                                        },
     86                                        {
     87                                                id : 'txtType',
     88                                                type : 'select',
     89                                                label : editor.lang.button.type,
     90                                                'default' : 'button',
     91                                                accessKey : 'T',
     92                                                items :
     93                                                [
     94                                                        [ editor.lang.button.typeBtn, 'button' ],
     95                                                        [ editor.lang.button.typeSbm, 'submit' ],
     96                                                        [ editor.lang.button.typeRst, 'reset' ]
     97                                                ],
     98                                                setup : function( element )
     99                                                {
     100                                                        this.setValue( element.getAttribute( 'type' ) );
     101                                                },
     102                                                commit : function( element )
     103                                                {
     104                                                        element.setAttribute( 'type', this.getValue() );
     105                                                }
     106                                        }
     107                                ]
     108                        }
     109                ]
     110        };
     111});
  • _source/plugins/forms/dialogs/checkbox.js

     
     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( 'checkbox', function( editor )
     6{
     7        return {
     8                title : editor.lang.checkboxAndRadio.checkboxTitle,
     9                minWidth : 400,
     10                minHeight : 230,
     11                onShow : function()
     12                {
     13                        // IE BUG: Selection must be in the editor for getSelectedElement()
     14                        // to work.
     15                        this.restoreSelection();
     16
     17                        var element = this.getParentEditor().getSelection().getSelectedElement();
     18
     19                        if ( element && element.getAttribute( 'type' ) == "checkbox" )
     20                        {
     21                                this._element = element;
     22                                this.setupContent( element );
     23                        }
     24                },
     25                onOk : function()
     26                {
     27                        var editor,
     28                                element = this._element,
     29                                isInsertMode = !element;
     30                       
     31                        if ( isInsertMode )
     32                        {
     33                                editor = this.getParentEditor();
     34                                element = editor.document.createElement( 'input' );
     35                                element.setAttribute( 'type', 'checkbox' );
     36                        }
     37
     38                        this.commitContent( element );
     39
     40                        if ( isInsertMode )
     41                        {
     42                                this.restoreSelection();
     43                                this.clearSavedSelection();
     44                                editor.insertElement( element );
     45                        }
     46                },
     47                contents : [
     48                        {
     49                                id : 'info',
     50                                label : editor.lang.checkboxAndRadio.checkboxTitle,
     51                                title : editor.lang.checkboxAndRadio.checkboxTitle,
     52                                startupFocus : 'txtName',
     53                                elements : [
     54                                        {
     55                                                id : 'txtName',
     56                                                type : 'text',
     57                                                label : editor.lang.common.name,
     58                                                'default' : '',
     59                                                accessKey : 'N',
     60                                                setup : function( element )
     61                                                {
     62                                                        this.setValue( element.getAttribute( 'name' ) );
     63                                                        this.focus();
     64                                                },
     65                                                commit : function( element )
     66                                                {
     67                                                        if ( this.getValue() != '' || this.isChanged() )
     68                                                                element.setAttribute( 'name', this.getValue() );
     69                                                }
     70                                        },
     71                                        {
     72                                                id : 'txtValue',
     73                                                type : 'text',
     74                                                label : editor.lang.checkboxAndRadio.value,
     75                                                'default' : '',
     76                                                accessKey : 'V',
     77                                                setup : function( element )
     78                                                {
     79                                                        this.setValue( element.getAttribute( 'value' ) );
     80                                                },
     81                                                commit : function( element )
     82                                                {
     83                                                        if ( this.getValue() != '' || this.isChanged() )
     84                                                                element.setAttribute( 'value', this.getValue() );
     85                                                }
     86                                        },
     87                                        {
     88                                                id : 'cmbSelected',
     89                                                type : 'checkbox',
     90                                                label : editor.lang.checkboxAndRadio.selected,
     91                                                'default' : '',
     92                                                accessKey : 'S',
     93                                                value : "checked",
     94                                                setup : function( element )
     95                                                {
     96                                                        this.setValue( element.getAttribute( 'checked' ) );
     97                                                },
     98                                                commit : function( element )
     99                                                {
     100                                                        if ( this.getValue() == true || this.isChanged() )
     101                                                                element.setAttribute( 'checked', this.getValue() );
     102                                                }
     103                                        }
     104                                ]
     105                        }
     106                ]
     107        };
     108});
  • _source/plugins/forms/dialogs/form.js

     
     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        return {
     8                title : editor.lang.form.title,
     9                minWidth : 400,
     10                minHeight : 270,
     11                onShow : function()
     12                {
     13                        // IE BUG: Selection must be in the editor for getSelectedElement()
     14                        // to work.
     15                        this.restoreSelection();
     16
     17                        var element = this.getParentEditor().getSelection().getSelectedElement();
     18                        if ( element && element.getName() == "form" )
     19                        {
     20                                this._element = element;
     21                                this.setupContent( element );
     22                        }
     23                },
     24                onOk : function()
     25                {
     26                        var editor,
     27                                element = this._element,
     28                                isInsertMode = !element;
     29
     30                        if ( isInsertMode )
     31                        {
     32                                editor = this.getParentEditor();
     33                                element = editor.document.createElement( 'form' );
     34                        }
     35                        this.commitContent( element );
     36
     37                        if ( isInsertMode )
     38                        {
     39                                this.restoreSelection();
     40                                this.clearSavedSelection();
     41                                editor.insertElement( element );
     42                        }
     43                },
     44                contents : [
     45                        {
     46                                id : 'info',
     47                                label : editor.lang.form.title,
     48                                title : editor.lang.form.title,
     49                                elements : [
     50                                        {
     51                                                id : 'txtName',
     52                                                type : 'text',
     53                                                label : editor.lang.common.name,
     54                                                'default' : '',
     55                                                accessKey : 'N',
     56                                                setup : function( element )
     57                                                {
     58                                                        this.setValue( element.getAttribute( 'name' ) );
     59                                                        this.focus();
     60                                                },
     61                                                commit : function( element )
     62                                                {
     63                                                        if ( this.getValue() != '' || this.isChanged() )
     64                                                                element.setAttribute( 'name', this.getValue() );
     65                                                }
     66                                        },
     67                                        {
     68                                                id : 'txtAction',
     69                                                type : 'text',
     70                                                label : editor.lang.form.action,
     71                                                'default' : '',
     72                                                accessKey : 'A',
     73                                                setup : function( element )
     74                                                {
     75                                                        this.setValue( element.getAttribute( 'action' ) );
     76                                                },
     77                                                commit : function( element )
     78                                                {
     79                                                        if ( this.getValue() != '' || this.isChanged() )
     80                                                                element.setAttribute( 'action', this.getValue() );
     81                                                }
     82                                        },
     83                                        {
     84                                                type : 'hbox',
     85                                                widths : [ '45%', '55%' ],
     86                                                children :
     87                                                [
     88                                                        {
     89                                                                id : 'txtId',
     90                                                                type : 'text',
     91                                                                label : editor.lang.common.id,
     92                                                                'default' : '',
     93                                                                accessKey : 'I',
     94                                                                setup : function( element )
     95                                                                {
     96                                                                        this.setValue( element.getAttribute( 'id' ) );
     97                                                                },
     98                                                                commit : function( element )
     99                                                                {
     100                                                                        if ( this.getValue() != '' || this.isChanged() )
     101                                                                                element.setAttribute( 'id', this.getValue() );
     102                                                                }
     103                                                        },
     104                                                        {
     105                                                                id : 'cmbEncoding',
     106                                                                type : 'select',
     107                                                                label : editor.lang.form.encoding,
     108                                                                style : 'width:100%',
     109                                                                accessKey : 'E',
     110                                                                'default' : '',
     111                                                                items :
     112                                                                [
     113                                                                        [ '' ],
     114                                                                        [ 'text/plain' ],
     115                                                                        [ 'multipart/form-data' ],
     116                                                                        [ 'application/x-www-form-urlencoded' ]
     117                                                                ],
     118                                                                setup : function( element )
     119                                                                {
     120                                                                        this.setValue( element.getAttribute( 'encoding' ) );
     121                                                                },
     122                                                                commit : function( element )
     123                                                                {
     124                                                                        if ( this.getValue() != '' || this.isChanged() )
     125                                                                                element.setAttribute( 'encoding', this.getValue() );
     126                                                                }
     127                                                        }
     128                                                ]
     129                                        },
     130                                        {
     131                                                type : 'hbox',
     132                                                widths : [ '45%', '55%' ],
     133                                                children :
     134                                                [
     135                                                        {
     136                                                                id : 'cmbTarget',
     137                                                                type : 'select',
     138                                                                label : editor.lang.form.target,
     139                                                                style : 'width:100%',
     140                                                                accessKey : 'M',
     141                                                                'default' : '',
     142                                                                items :
     143                                                                [
     144                                                                        [ editor.lang.form.targetNotSet, '' ],
     145                                                                        [ editor.lang.form.targetNew, '_blank' ],
     146                                                                        [ editor.lang.form.targetTop, '_top' ],
     147                                                                        [ editor.lang.form.targetSelf, '_self' ],
     148                                                                        [ editor.lang.form.targetParent, '_parent' ]
     149                                                                ],
     150                                                                setup : function( element )
     151                                                                {
     152                                                                        this.setValue( element.getAttribute( 'target' ) );
     153                                                                },
     154                                                                commit : function( element )
     155                                                                {
     156                                                                        if ( this.getValue() != '' || this.isChanged() )
     157                                                                                element.setAttribute( 'target', this.getValue() );
     158                                                                }
     159                                                        },
     160                                                        {
     161                                                                id : 'cmbMethod',
     162                                                                type : 'select',
     163                                                                label : editor.lang.form.method,
     164                                                                accessKey : 'M',
     165                                                                'default' : 'GET',
     166                                                                items :
     167                                                                [
     168                                                                        [ 'GET', 'get' ],
     169                                                                        [ 'POST', 'post' ]
     170                                                                ],
     171                                                                setup : function( element )
     172                                                                {
     173                                                                        this.setValue( element.getAttribute( 'method' ) );
     174                                                                },
     175                                                                commit : function( element )
     176                                                                {
     177                                                                        element.setAttribute( 'method', this.getValue() );
     178                                                                }
     179                                                        }
     180                                                ]
     181                                        }
     182                                ]
     183                        }
     184                ]
     185        };
     186});
  • _source/plugins/forms/dialogs/hiddenfield.js

     
     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( 'hiddenfield', function( editor )
     6{
     7        return {
     8                title : editor.lang.hidden.title,
     9                minWidth : 400,
     10                minHeight : 200,
     11                onShow : function()
     12                {
     13                        // IE BUG: Selection must be in the editor for getSelectedElement()
     14                        // to work.
     15                        this.restoreSelection();
     16
     17                        var element = this.getParentEditor().getSelection().getSelectedElement();
     18                        if ( element && element.getName() == "input" && element.getAttribute( 'type' ) == "checkbox" )
     19                        {
     20                                this._element = element;
     21                                this.setupContent( element );
     22                        }
     23                },
     24                onOk : function()
     25                {
     26                        var editor,
     27                                element = this._element,
     28                                isInsertMode = !element;
     29
     30                        if ( isInsertMode )
     31                        {
     32                                editor = this.getParentEditor();
     33                                element = editor.document.createElement( 'input' );
     34                                element.setAttribute( 'type', 'hidden' );
     35                        }
     36                        this.commitContent( element );
     37
     38                        if ( isInsertMode )
     39                        {
     40                                this.restoreSelection();
     41                                this.clearSavedSelection();
     42                                editor.insertElement( element );
     43                        }
     44                },
     45                contents : [
     46                        {
     47                                id : 'info',
     48                                label : editor.lang.hidden.title,
     49                                title : editor.lang.hidden.title,
     50                                elements : [
     51                                        {
     52                                                id : 'txtName',
     53                                                type : 'text',
     54                                                label : editor.lang.hidden.name,
     55                                                'default' : '',
     56                                                accessKey : 'N',
     57                                                setup : function( element )
     58                                                {
     59                                                        this.setValue( element.getAttribute( 'name' ) );
     60                                                        this.focus();
     61                                                },
     62                                                commit : function( element )
     63                                                {
     64                                                        if ( this.getValue() != '' || this.isChanged() )
     65                                                                element.setAttribute( 'name', this.getValue() );
     66                                                }
     67                                        },
     68                                        {
     69                                                id : 'txtValue',
     70                                                type : 'text',
     71                                                label : editor.lang.hidden.value,
     72                                                'default' : '',
     73                                                accessKey : 'V',
     74                                                setup : function( element )
     75                                                {
     76                                                        this.setValue( element.getAttribute( 'value' ) );
     77                                                },
     78                                                commit : function( element )
     79                                                {
     80                                                        if ( this.getValue() != '' || this.isChanged() )
     81                                                                element.setAttribute( 'value', this.getValue() );
     82                                                }
     83                                        }
     84                                ]
     85                        }
     86                ]
     87        };
     88});
  • _source/plugins/forms/dialogs/radio.js

     
     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( 'radio', function( editor )
     6{
     7        return {
     8                title : editor.lang.checkboxAndRadio.radioTitle,
     9                minWidth : 400,
     10                minHeight : 200,
     11                onShow : function()
     12                {
     13                        // IE BUG: Selection must be in the editor for getSelectedElement()
     14                        // to work.
     15                        this.restoreSelection();
     16
     17                        var element = this.getParentEditor().getSelection().getSelectedElement();
     18                        if ( element && element.getName() == "input" && element.getAttribute( 'type' ) == "radio" )
     19                        {
     20                                this._element = element;
     21                                this.setupContent( element );
     22                        }
     23                },
     24                onOk : function()
     25                {
     26                        var editor,
     27                                element = this._element,
     28                                isInsertMode = !element;
     29
     30                        if ( isInsertMode )
     31                        {
     32                                editor = this.getParentEditor();
     33                                element = editor.document.createElement( 'input' );
     34                                element.setAttribute( 'type', 'radio' );
     35                        }
     36                        this.commitContent( element );
     37
     38                        if ( isInsertMode )
     39                        {
     40                                this.restoreSelection();
     41                                this.clearSavedSelection();
     42                                editor.insertElement( element );
     43                        }
     44                },
     45                contents : [
     46                        {
     47                                id : 'info',
     48                                label : editor.lang.checkboxAndRadio.radioTitle,
     49                                title : editor.lang.checkboxAndRadio.radioTitle,
     50                                elements : [
     51                                        {
     52                                                id : 'txtName',
     53                                                type : 'text',
     54                                                label : editor.lang.common.name,
     55                                                'default' : '',
     56                                                accessKey : 'N',
     57                                                setup : function( element )
     58                                                {
     59                                                        this.setValue( element.getAttribute( 'name' ) );
     60                                                        this.focus();
     61                                                },
     62                                                commit : function( element )
     63                                                {
     64                                                        if ( this.getValue() != '' || this.isChanged() )
     65                                                                element.setAttribute( 'name', this.getValue() );
     66                                                }
     67                                        },
     68                                        {
     69                                                id : 'txtValue',
     70                                                type : 'text',
     71                                                label : editor.lang.checkboxAndRadio.value,
     72                                                'default' : '',
     73                                                accessKey : 'V',
     74                                                setup : function( element )
     75                                                {
     76                                                        this.setValue( element.getAttribute( 'value' ) );
     77                                                },
     78                                                commit : function( element )
     79                                                {
     80                                                        if ( this.getValue() != '' || this.isChanged() )
     81                                                                element.setAttribute( 'value', this.getValue() );
     82                                                }
     83                                        },
     84                                        {
     85                                                id : 'cmbSelected',
     86                                                type : 'checkbox',
     87                                                label : editor.lang.checkboxAndRadio.selected,
     88                                                'default' : '',
     89                                                accessKey : 'S',
     90                                                value : "checked",
     91                                                setup : function( element )
     92                                                {
     93                                                        this.setValue( element.getAttribute( 'checked' ) );
     94                                                },
     95                                                commit : function( element )
     96                                                {
     97                                                        if ( this.getValue() == true || this.isChanged() )
     98                                                                element.setAttribute( 'checked', this.getValue() );
     99                                                }
     100                                        }
     101                                ]
     102                        }
     103                ]
     104        };
     105});
  • _source/plugins/forms/dialogs/select.js

     
     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( 'select', function( editor )
     6{
     7        // Add a new option to a SELECT object (combo or list).
     8        addOption = function( combo, optionText, optionValue, documentObject, index )
     9        {
     10                combo = getSelect( combo );
     11                var oOption;
     12                if ( documentObject )
     13                        oOption = documentObject.createElement( "OPTION" );
     14                else
     15                        oOption = document.createElement( "OPTION" );
     16
     17                if ( combo && oOption && oOption.getName() == 'option' )
     18                {
     19                        if ( CKEDITOR.env.ie ) {
     20                                if ( !isNaN( parseInt( index, 10) ) )
     21                                        combo.$.options.add( oOption.$, index );
     22                                else
     23                                        combo.$.options.add( oOption.$ );
     24
     25                                oOption.$.innerHTML = optionText.length > 0 ? optionText : '';
     26                                oOption.$.value     = optionValue;
     27                        }
     28                        else
     29                        {
     30                                if ( index != null && index < combo.getChildCount() )
     31                                        combo.getChild( index < 0 ? 0 : index ).insertBeforeMe( oOption );
     32                                else
     33                                        combo.append( oOption );
     34
     35                                oOption.setText( optionText.length > 0 ? optionText : '' );
     36                                oOption.setValue( optionValue );
     37                        }
     38                }
     39                else
     40                        return false;
     41
     42                return oOption;
     43        };
     44        // Remove all selected options from a SELECT object.
     45        removeSelectedOptions = function ( combo )
     46        {
     47                combo = getSelect( combo );
     48
     49                // Save the selected index
     50                var iSelectedIndex = getSelectedIndex( combo );
     51
     52                // Remove all selected options.
     53                for ( var i = combo.getChildren().count() - 1 ; i >= 0 ; i-- )
     54                {
     55                        if ( combo.getChild( i ).$.selected )
     56                                combo.getChild( i ).remove();
     57                }
     58
     59                // Reset the selection based on the original selected index.
     60                setSelectedIndex( combo, iSelectedIndex );
     61        };
     62        //Modify option  from a SELECT object.
     63        modifyOption = function( combo, index, title, value )
     64        {
     65                combo = getSelect( combo );
     66                if ( index < 0 )
     67                        return false;
     68                var child = combo.getChild( index );
     69                child.setText( title );
     70                child.setValue( value );
     71                return child;
     72        };
     73        removeAllOptions = function( combo )
     74        {
     75                combo = getSelect( combo );
     76                while( combo.getChild( 0 ) && combo.getChild( 0 ).remove() );
     77        };
     78        // Moves the selected option by a number of steps (also negative).
     79        changeOptionPosition = function ( combo, steps, documentObject )
     80        {
     81                combo = getSelect( combo );
     82                var iActualIndex = getSelectedIndex( combo );
     83                if ( iActualIndex < 0 )
     84                        return false;
     85
     86                var iFinalIndex = iActualIndex + steps;
     87                iFinalIndex = ( iFinalIndex < 0 ) ? 0 : iFinalIndex;
     88                iFinalIndex = ( iFinalIndex >= combo.getChildCount() ) ? combo.getChildCount() - 1 : iFinalIndex;
     89
     90                if ( iActualIndex == iFinalIndex )
     91                        return false;
     92
     93                var oOption = combo.getChild( iActualIndex ),
     94                        sText   = oOption.getText(),
     95                        sValue  = oOption.getValue();
     96
     97                oOption.remove();
     98
     99                oOption = addOption( combo, sText, sValue, ( !documentObject ) ? null : documentObject, iFinalIndex );
     100                setSelectedIndex( combo, iFinalIndex );
     101                return oOption;
     102        };
     103        getSelectedIndex = function( combo )
     104        {
     105                combo = getSelect( combo );
     106                return combo ? combo.$.selectedIndex : -1;
     107        };
     108        setSelectedIndex = function( combo, index )
     109        {
     110                combo = getSelect( combo );
     111                if ( index < 0 )
     112                        return ;
     113                var count = combo.getChildren().count();
     114                combo.$.selectedIndex = ( index >= count ) ? ( count - 1 ) : index;
     115                return combo;
     116        };
     117        getOptions = function ( combo )
     118        {
     119                combo = getSelect( combo );
     120                return combo ? combo.getChildren() : false;
     121        };
     122        getSelect = function ( obj )
     123        {
     124                if ( obj && obj.domId && obj.getInputElement().$ )                              // Dialog element.
     125                        return  obj.getInputElement();
     126                else if ( obj && obj.$ )
     127                        return obj;
     128                return false;
     129        };
     130        return {
     131                title : editor.lang.select.title,
     132                minWidth : 400,
     133                minHeight : 370,
     134                onShow : function()
     135                {
     136                        // IE BUG: Selection must be in the editor for getSelectedElement()
     137                        // to work.
     138                        this.restoreSelection();
     139
     140                        this.setupContent( 'clear' );
     141                        var element = this.getParentEditor().getSelection().getSelectedElement();
     142                        if ( element && element.getName() == "select" )
     143                        {
     144                                this._element = element;
     145                                this.setupContent( element.getName(), element );
     146
     147                                //Load Options into dialog.
     148                                var objOptions = getOptions( element );
     149                                for ( var i = 0 ; i < objOptions.count() ; i++ )
     150                                        this.setupContent( 'option', objOptions.getItem( i ) );
     151                        }
     152                },
     153                onOk : function()
     154                {
     155                        var editor = this.getParentEditor(),
     156                                element = this._element,
     157                                isInsertMode = !element;
     158
     159                        if ( isInsertMode )
     160                                element = editor.document.createElement( 'select' );
     161                        this.commitContent( element );
     162
     163                        if ( isInsertMode )
     164                        {
     165                                this.restoreSelection();
     166                                this.clearSavedSelection();
     167                                editor.insertElement( element );
     168                        }
     169                },
     170                contents : [
     171                        {
     172                                id : 'info',
     173                                label : editor.lang.select.selectInfo,
     174                                title : editor.lang.select.selectInfo,
     175                                accessKey : '',
     176                                elements : [
     177                                        {
     178                                                id : 'txtName',
     179                                                type : 'text',
     180                                                widths : [ '25%','75%' ],
     181                                                labelLayout : 'horizontal',
     182                                                label : editor.lang.common.name,
     183                                                'default' : '',
     184                                                accessKey : 'N',
     185                                                align : 'center',
     186                                                style : 'width:350px',
     187                                                setup : function( name, element )
     188                                                {
     189                                                        if ( name == 'select' )
     190                                                        {
     191                                                                this.setValue( element.getAttribute( 'name' ) );
     192                                                                this.focus();
     193                                                        }
     194                                                },
     195                                                commit : function( element )
     196                                                {
     197                                                        if ( this.getValue() != '' || this.isChanged() )
     198                                                                element.setAttribute( 'name', this.getValue() );
     199                                                }
     200                                        },
     201                                        {
     202                                                id : 'txtValue',
     203                                                type : 'text',
     204                                                widths : [ '25%','75%' ],
     205                                                labelLayout : 'horizontal',
     206                                                label : editor.lang.select.value,
     207                                                style : 'width:350px',
     208                                                'default' : '',
     209                                                readonly : true,                //TODO: make it readonly somehow.
     210                                                disabled : true
     211                                        },
     212                                        {
     213                                                type : 'hbox',
     214                                                widths : [ '175px', '170px' ],
     215                                                align : 'center',
     216                                                children :
     217                                                [
     218                                                        {
     219                                                                id : 'txtSize',
     220                                                                type : 'text',
     221                                                                align : 'center',
     222                                                                labelLayout : 'horizontal',
     223                                                                label : editor.lang.select.size,
     224                                                                'default' : '',
     225                                                                accessKey : 'S',
     226                                                                style : 'width:175px',
     227                                                                validate: function()
     228                                                                {
     229                                                                        var func = CKEDITOR.dialog.validate.integer( editor.lang.common.validateNumberFailed );
     230                                                                        return ( ( this.getValue() == '' ) || func.apply( this ) );
     231                                                                },
     232                                                                setup : function( name, element )
     233                                                                {
     234                                                                        if ( name == 'select' )
     235                                                                                this.setValue( element.getAttribute( 'size' ) );
     236                                                                },
     237                                                                commit : function( element )
     238                                                                {
     239                                                                        if ( this.getValue() != '' || this.isChanged() )
     240                                                                                element.setAttribute( 'size', this.getValue() );
     241                                                                }
     242                                                        },
     243                                                        {
     244                                                                type : 'html',
     245                                                                html : '<span>' + CKEDITOR.tools.htmlEncode( editor.lang.select.lines ) + '</span>'
     246                                                        }
     247                                                ]
     248                                        },
     249                                        {
     250                                                type : 'html',
     251                                                html : '<span>' + CKEDITOR.tools.htmlEncode( editor.lang.select.opAvail ) + '</span>'
     252                                        },
     253                                        {
     254                                                type : 'hbox',
     255                                                widths : [ '115px', '115px' ,'100px' ],
     256                                                align : 'top',
     257                                                children :
     258                                                [
     259                                                        {
     260                                                                type : 'vbox',
     261                                                                children :
     262                                                                [
     263                                                                        {
     264                                                                                id : 'txtOptName',
     265                                                                                type : 'text',
     266                                                                                label : editor.lang.select.opText,
     267                                                                                style : 'width:115px',
     268                                                                                setup : function( name, element )
     269                                                                                {
     270                                                                                        if ( name == 'clear' )
     271                                                                                                this.setValue( "" );
     272                                                                                }
     273                                                                        },
     274                                                                        {
     275                                                                                type : 'select',
     276                                                                                id : 'cmbName',
     277                                                                                label : '',
     278                                                                                title : '',
     279                                                                                size : 5,
     280                                                                                style : 'width:115px;height:75px',
     281                                                                                items : [],
     282                                                                                onChange : function()
     283                                                                                {
     284                                                                                        var dialog = this.getDialog(),
     285                                                                                                values = dialog.getContentElement( 'info', 'cmbValue' ),
     286                                                                                                optName = dialog.getContentElement( 'info', 'txtOptName' ),
     287                                                                                                optValue = dialog.getContentElement( 'info', 'txtOptValue' ),
     288                                                                                                iIndex = getSelectedIndex( this );
     289
     290                                                                                        setSelectedIndex( values, iIndex );
     291                                                                                        optName.setValue( this.getValue() );
     292                                                                                        optValue.setValue( values.getValue() );
     293                                                                                },
     294                                                                                setup : function( name, element )
     295                                                                                {
     296                                                                                        if ( name == 'clear' )
     297                                                                                                removeAllOptions( this );
     298                                                                                        else if ( name == 'option' )
     299                                                                                                addOption( this, element.getText(), element.getText(),
     300                                                                                                        this.getDialog().getParentEditor().document );
     301                                                                                },
     302                                                                                commit : function( element )
     303                                                                                {
     304                                                                                        var dialog = this.getDialog(),
     305                                                                                                optionsNames = getOptions( this ),
     306                                                                                                optionsValues = getOptions( dialog.getContentElement( 'info', 'cmbValue' ) ),
     307                                                                                                selectValue = dialog.getContentElement( 'info', 'txtValue' ).getValue();
     308
     309                                                                                        removeAllOptions( element );
     310
     311                                                                                        for ( var i = 0 ; i < optionsNames.count() ; i++ )
     312                                                                                        {
     313                                                                                                var oOption = addOption( element, optionsNames.getItem( i ).getValue(),
     314                                                                                                        optionsValues.getItem( i ).getValue(), dialog.getParentEditor().document );     
     315                                                                                                if ( optionsValues.getItem( i ).getValue() == selectValue )
     316                                                                                                {
     317                                                                                                        oOption.setAttribute( 'selected', 'selected' );
     318                                                                                                        oOption.selected = true;
     319                                                                                                }
     320                                                                                        }
     321                                                                                }
     322                                                                        }
     323                                                                ]
     324                                                        },
     325                                                        {
     326                                                                type : 'vbox',
     327                                                                children :
     328                                                                [
     329                                                                        {
     330                                                                                id : 'txtOptValue',
     331                                                                                type : 'text',
     332                                                                                label : editor.lang.select.opValue,
     333                                                                                style : 'width:115px',
     334                                                                                setup : function( name, element )
     335                                                                                {
     336                                                                                        if ( name == 'clear' )
     337                                                                                                this.setValue( "" );
     338                                                                                }
     339                                                                        },
     340                                                                        {
     341                                                                                type : 'select',
     342                                                                                id : 'cmbValue',
     343                                                                                label : '',
     344                                                                                size : 5,
     345                                                                                style : 'width:115px;height:75px',
     346                                                                                items : [],
     347                                                                                onChange : function()
     348                                                                                {
     349                                                                                        var dialog = this.getDialog(),
     350                                                                                                names = dialog.getContentElement( 'info', 'cmbName' ),
     351                                                                                                optName = dialog.getContentElement( 'info', 'txtOptName' ),
     352                                                                                                optValue = dialog.getContentElement( 'info', 'txtOptValue' ),
     353                                                                                                iIndex = getSelectedIndex( this );
     354                                                                                               
     355                                                                                        setSelectedIndex( names, iIndex );
     356                                                                                        optName.setValue( names.getValue() );
     357                                                                                        optValue.setValue( this.getValue() );
     358                                                                                },
     359                                                                                setup : function( name, element )
     360                                                                                {
     361                                                                                        if ( name == 'clear' )
     362                                                                                                removeAllOptions( this );
     363                                                                                        else if ( name == 'option' )
     364                                                                                        {
     365                                                                                                var oValue      = element.getValue();
     366                                                                                                addOption( this, oValue, oValue,
     367                                                                                                        this.getDialog().getParentEditor().document );
     368                                                                                                if ( element.getAttribute( 'selected' ) == 'selected' )
     369                                                                                                        this.getDialog().getContentElement( 'info', 'txtValue' ).setValue( oValue );
     370                                                                                        }
     371                                                                                }
     372                                                                        },
     373                                                                ]
     374                                                        },
     375                                                        {
     376                                                                type : 'vbox',
     377                                                                padding : 5,
     378                                                                children :
     379                                                                [
     380                                                                        {
     381                                                                                type : 'button',
     382                                                                                style : '',
     383                                                                                label : editor.lang.select.btnAdd,
     384                                                                                title : editor.lang.select.btnAdd,
     385                                                                                style : 'width:100%;',
     386                                                                                onClick : function()
     387                                                                                {
     388                                                                                        //Add new option.
     389                                                                                        var dialog = this.getDialog();
     390                                                                                                parentEditor = dialog.getParentEditor(),
     391                                                                                                optName = dialog.getContentElement( 'info', 'txtOptName' ),
     392                                                                                                optValue = dialog.getContentElement( 'info', 'txtOptValue' ),
     393                                                                                                names = dialog.getContentElement( 'info', 'cmbName' ),
     394                                                                                                values = dialog.getContentElement( 'info', 'cmbValue' );
     395
     396                                                                                        addOption(names, optName.getValue(), optName.getValue(), dialog.getParentEditor().document );
     397                                                                                        addOption(values, optValue.getValue(), optValue.getValue(), dialog.getParentEditor().document );
     398
     399                                                                                        optName.setValue( "" );
     400                                                                                        optValue.setValue( "" );
     401                                                                                }
     402                                                                        },
     403                                                                        {
     404                                                                                type : 'button',
     405                                                                                label : editor.lang.select.btnModify,
     406                                                                                title : editor.lang.select.btnModify,
     407                                                                                style : 'width:100%;',
     408                                                                                onClick : function()
     409                                                                                {
     410                                                                                        //Modify selected option.
     411                                                                                        var dialog = this.getDialog();
     412                                                                                                optName = dialog.getContentElement( 'info', 'txtOptName' ),
     413                                                                                                optValue = dialog.getContentElement( 'info', 'txtOptValue' ),
     414                                                                                                names = dialog.getContentElement( 'info', 'cmbName' ),
     415                                                                                                values = dialog.getContentElement( 'info', 'cmbValue' ),
     416                                                                                                iIndex = getSelectedIndex( names );
     417
     418                                                                                        if ( iIndex >= 0 )
     419                                                                                        {
     420                                                                                                modifyOption( names, iIndex, optName.getValue(), optName.getValue() );
     421                                                                                                modifyOption( values, iIndex, optValue.getValue(), optValue.getValue() );
     422                                                                                        }
     423                                                                                }
     424                                                                        },
     425                                                                        {
     426                                                                                type : 'button',
     427                                                                                style : 'width:100%;',
     428                                                                                label : editor.lang.select.btnUp,
     429                                                                                title : editor.lang.select.btnUp,
     430                                                                                onClick : function()
     431                                                                                {
     432                                                                                        //Move up.
     433                                                                                        var dialog = this.getDialog(),
     434                                                                                                names = dialog.getContentElement( 'info', 'cmbName' ),
     435                                                                                                values = dialog.getContentElement( 'info', 'cmbValue' );
     436
     437                                                                                        changeOptionPosition( names, -1, dialog.getParentEditor().document );
     438                                                                                        changeOptionPosition( values, -1, dialog.getParentEditor().document );
     439                                                                                }
     440                                                                        },
     441                                                                        {
     442                                                                                type : 'button',
     443                                                                                style : 'width:100%;',
     444                                                                                label : editor.lang.select.btnDown,
     445                                                                                title : editor.lang.select.btnDown,
     446                                                                                onClick : function()
     447                                                                                {
     448                                                                                        //Move down.
     449                                                                                        var dialog = this.getDialog(),
     450                                                                                        names = dialog.getContentElement( 'info', 'cmbName' ),
     451                                                                                        values = dialog.getContentElement( 'info', 'cmbValue' );
     452
     453                                                                                        changeOptionPosition( names, 1, dialog.getParentEditor().document );
     454                                                                                        changeOptionPosition( values, 1, dialog.getParentEditor().document );
     455                                                                                }
     456                                                                        }
     457                                                                ]
     458                                                        }
     459                                                ]
     460                                        },
     461                                        {
     462                                                type : 'hbox',
     463                                                widths : [ '40%', '20%', '40%' ],
     464                                                children :
     465                                                [
     466                                                        {
     467                                                                type : 'button',
     468                                                                label : editor.lang.select.btnSetValue,
     469                                                                title : editor.lang.select.btnSetValue,
     470                                                                onClick : function()
     471                                                                {
     472                                                                        //Set as default value.
     473                                                                        var dialog = this.getDialog(),
     474                                                                                values = dialog.getContentElement( 'info', 'cmbValue' ),
     475                                                                                txtValue = dialog.getContentElement( 'info', 'txtValue' );
     476                                                                        txtValue.setValue( values.getValue() );
     477                                                                }
     478                                                        },
     479                                                        {
     480                                                                type : 'button',
     481                                                                label : editor.lang.select.btnDelete,
     482                                                                title : editor.lang.select.btnDelete,
     483                                                                onClick : function()
     484                                                                {
     485                                                                        // Delete option.
     486                                                                        var dialog = this.getDialog(),
     487                                                                                names = dialog.getContentElement( 'info', 'cmbName' ),
     488                                                                                values = dialog.getContentElement( 'info', 'cmbValue' ),
     489                                                                                optName = dialog.getContentElement( 'info', 'txtOptName' ),
     490                                                                                optValue = dialog.getContentElement( 'info', 'txtOptValue' );
     491                                                                       
     492                                                                        removeSelectedOptions( names );
     493                                                                        removeSelectedOptions( values );
     494
     495                                                                        optName.setValue( "" );
     496                                                                        optValue.setValue( "" );
     497                                                                }
     498                                                        },
     499                                                        {
     500                                                                id : 'chkMulti',
     501                                                                type : 'checkbox',
     502                                                                label : editor.lang.select.chkMulti,
     503                                                                'default' : '',
     504                                                                accessKey : 'M',
     505                                                                value : "checked",
     506                                                                setup : function( name, element )
     507                                                                {
     508                                                                        if ( name == 'select' )
     509                                                                                this.setValue( element.getAttribute( 'multiple' ) );
     510                                                                },
     511                                                                commit : function( element )
     512                                                                {
     513                                                                        if ( this.getValue() == true || this.isChanged() )
     514                                                                                element.setAttribute( 'multiple', this.getValue() );
     515                                                                }
     516                                                        }
     517                                                ]
     518                                        }
     519                                ]
     520                        }
     521                ]
     522        };
     523});
  • _source/plugins/forms/dialogs/textarea.js

     
     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( 'textarea', function( editor )
     6{
     7        return {
     8                title : editor.lang.textarea.title,
     9                minWidth : 400,
     10                minHeight : 230,
     11                onShow : function()
     12                {
     13                        // IE BUG: Selection must be in the editor for getSelectedElement()
     14                        // to work.
     15                        this.restoreSelection();
     16
     17                        var element = this.getParentEditor().getSelection().getSelectedElement();
     18                        if ( element && element.getName() == "textarea" )
     19                        {
     20                                this._element = element;
     21                                this.setupContent( element );
     22                        }
     23                },
     24                onOk : function()
     25                {
     26                        var editor,
     27                                element = this._element,
     28                                isInsertMode = !element;
     29
     30                        if ( isInsertMode )
     31                        {
     32                                editor = this.getParentEditor();
     33                                element = editor.document.createElement( 'textarea' );
     34                        }
     35                        this.commitContent( element );
     36
     37                        if ( isInsertMode )
     38                        {
     39                                this.restoreSelection();
     40                                this.clearSavedSelection();
     41                                editor.insertElement( element );
     42                        }
     43                },
     44                contents : [
     45                        {
     46                                id : 'info',
     47                                label : editor.lang.textarea.title,
     48                                title : editor.lang.textarea.title,
     49                                elements : [
     50                                        {
     51                                                id : 'txtName',
     52                                                type : 'text',
     53                                                label : editor.lang.common.name,
     54                                                'default' : '',
     55                                                accessKey : 'N',
     56                                                setup : function( element )
     57                                                {
     58                                                        this.setValue( element.getAttribute( 'name' ) );
     59                                                        this.focus();
     60                                                },
     61                                                commit : function( element )
     62                                                {
     63                                                        if ( this.getValue() != '' || this.isChanged() )
     64                                                                element.setAttribute( 'name', this.getValue() );
     65                                                }
     66                                        },
     67                                        {
     68                                                id : 'txtColumns',
     69                                                type : 'text',
     70                                                label : editor.lang.textarea.cols,
     71                                                'default' : '',
     72                                                accessKey : 'C',
     73                                                style : 'width:50px',
     74                                                validate: function()
     75                                                {
     76                                                        var func = CKEDITOR.dialog.validate.integer( editor.lang.common.validateNumberFailed );
     77                                                        return func.apply( this );
     78                                                },
     79                                                setup : function( element )
     80                                                {
     81                                                        this.setValue( element.getAttribute( 'cols' ) );
     82                                                },
     83                                                commit : function( element )
     84                                                {
     85                                                        if ( this.getValue() != '' || this.isChanged() )
     86                                                                element.setAttribute( 'cols', this.getValue() );
     87                                                }
     88                                        },
     89                                        {
     90                                                id : 'txtRows',
     91                                                type : 'text',
     92                                                label : editor.lang.textarea.rows,
     93                                                'default' : '',
     94                                                accessKey : 'R',
     95                                                style : 'width:50px',
     96                                                validate: function()
     97                                                {
     98                                                        var func = CKEDITOR.dialog.validate.integer( editor.lang.common.validateNumberFailed );
     99                                                        return func.apply( this );
     100                                                },
     101                                                setup : function( element )
     102                                                {
     103                                                        this.setValue( element.getAttribute( 'rows' ) );
     104                                                },
     105                                                commit : function( element )
     106                                                {
     107                                                        if ( this.getValue() != '' || this.isChanged() )
     108                                                                element.setAttribute( 'rows', this.getValue() );
     109                                                }
     110                                        }
     111                                ]
     112                        }
     113                ]
     114        };
     115});
  • _source/plugins/forms/dialogs/textfield.js

     
     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( 'textfield', function( editor )
     6{
     7        return {
     8                title : editor.lang.textfield.title,
     9                minWidth : 400,
     10                minHeight : 230,
     11                onShow : function()
     12                {
     13                        // IE BUG: Selection must be in the editor for getSelectedElement()
     14                        // to work.
     15                        this.restoreSelection();
     16
     17                        var element = this.getParentEditor().getSelection().getSelectedElement();
     18                        if ( element && element.getName() == "input" && ( element.getAttribute( 'type' ) == "text" && !element.getAttribute( 'type' ) ) )
     19                        {
     20                                this._element = element;
     21                                this.setupContent( element );
     22                        }
     23                },
     24                onOk : function()
     25                {
     26                        var editor,
     27                                element = this._element,
     28                                isInsertMode = !element;
     29
     30                        if ( isInsertMode )
     31                        {
     32                                editor = this.getParentEditor();
     33                                element = editor.document.createElement( 'input' );
     34                                element.setAttribute( 'type', 'text' );
     35                        }
     36                        this.commitContent( element );
     37
     38                        if ( isInsertMode )
     39                        {
     40                                this.restoreSelection();
     41                                this.clearSavedSelection();
     42                                editor.insertElement( element );
     43                        }
     44                },
     45                contents : [
     46                        {
     47                                id : 'info',
     48                                label : editor.lang.textfield.title,
     49                                title : editor.lang.textfield.title,
     50                                elements : [
     51                                        {
     52                                                type : 'hbox',
     53                                                widths : [ '50%', '50%' ],
     54                                                children :
     55                                                [
     56                                                        {
     57                                                                id : 'txtName',
     58                                                                type : 'text',
     59                                                                label : editor.lang.textfield.name,
     60                                                                'default' : '',
     61                                                                accessKey : 'N',
     62                                                                setup : function( element )
     63                                                                {
     64                                                                        this.setValue( element.getAttribute( 'name' ) );
     65                                                                        this.focus();
     66                                                                },
     67                                                                commit : function( element )
     68                                                                {
     69                                                                        if ( this.getValue() != '' || this.isChanged() )
     70                                                                                element.setAttribute( 'name', this.getValue() );
     71                                                                }
     72                                                        },
     73                                                        {
     74                                                                id : 'txtValue',
     75                                                                type : 'text',
     76                                                                label : editor.lang.textfield.value,
     77                                                                'default' : '',
     78                                                                accessKey : 'V',
     79                                                                setup : function( element )
     80                                                                {
     81                                                                        this.setValue( element.getAttribute( 'value' ) );
     82                                                                },
     83                                                                commit : function( element )
     84                                                                {
     85                                                                        if ( this.getValue() != '' || this.isChanged() )
     86                                                                                element.setAttribute( 'value', this.getValue() );
     87                                                                }
     88                                                        }
     89                                                ]
     90                                        },
     91                                        {
     92                                                type : 'hbox',
     93                                                widths : [ '50%', '50%' ],
     94                                                children :
     95                                                [
     96                                                        {
     97                                                                id : 'txtTextCharWidth',
     98                                                                type : 'text',
     99                                                                label : editor.lang.textfield.charWidth,
     100                                                                'default' : '',
     101                                                                accessKey : 'C',
     102                                                                style : 'width:50px',
     103                                                                validate: function()
     104                                                                {
     105                                                                        var func = CKEDITOR.dialog.validate.integer( editor.lang.common.validateNumberFailed );
     106                                                                        return isValid = func.apply( this );
     107                                                                },
     108                                                                setup : function( element )
     109                                                                {
     110                                                                        this.setValue( element.getAttribute( 'size' ) );
     111                                                                },
     112                                                                commit : function( element )
     113                                                                {
     114                                                                        if ( this.getValue() != '' || this.isChanged() )
     115                                                                                element.setAttribute( 'size', this.getValue() );
     116                                                                }
     117                                                        },
     118                                                        {
     119                                                                id : 'txtMaxChars',
     120                                                                type : 'text',
     121                                                                label : editor.lang.textfield.maxChars,
     122                                                                'default' : '',
     123                                                                accessKey : 'M',
     124                                                                style : 'width:50px',
     125                                                                validate: function()
     126                                                                {
     127                                                                        var func = CKEDITOR.dialog.validate.integer( editor.lang.common.validateNumberFailed );
     128                                                                        return isValid = func.apply( this );
     129                                                                },
     130                                                                setup : function( element )
     131                                                                {
     132                                                                        this.setValue( element.getAttribute( 'maxlength' ) );
     133                                                                },
     134                                                                commit : function( element )
     135                                                                {
     136                                                                        if ( this.getValue() != '' || this.isChanged() )
     137                                                                                element.setAttribute( 'maxlength', this.getValue() );
     138                                                                }
     139                                                        }
     140                                                ]
     141                                        },
     142                                        {
     143                                                id : 'cmbType',
     144                                                type : 'select',
     145                                                label : editor.lang.textfield.type,
     146                                                'default' : 'text',
     147                                                accessKey : 'M',
     148                                                items :
     149                                                [
     150                                                        [ editor.lang.textfield.typeText, 'text' ],
     151                                                        [ editor.lang.textfield.typePass, 'pass' ],
     152                                                ],
     153                                                setup : function( element )
     154                                                {
     155                                                        this.setValue( element.getAttribute( 'type' ) );
     156                                                },
     157                                                commit : function( element )
     158                                                {
     159                                                        element.setAttribute( 'type', this.getValue() );
     160                                                }
     161                                        }
     162                                ]
     163                        }
     164                ]
     165        };
     166});
  • _source/plugins/forms/plugin.js

     
     1/*
     2Copyright (c) 2003-2009, CKSource - Frederico Knabben. All rights reserved.
     3For licensing, see LICENSE.html or http://ckeditor.com/license
     4*/
     5
     6/**
     7 * @file Forms Plugin
     8 */
     9
     10CKEDITOR.plugins.add( 'forms',
     11{
     12        init : function( editor )
     13        {
     14                // All buttons use the same code to register. So, to avoid
     15                // duplications, let's use this tool function.
     16                var addButtonCommand = function( buttonName, commandName, dialogFile )
     17                {
     18                        editor.addCommand( commandName, new CKEDITOR.dialogCommand( commandName ) );
     19
     20                        editor.ui.addButton( buttonName,
     21                                {
     22                                        label : editor.lang.common[ commandName ],
     23                                        command : commandName
     24                                });
     25                        CKEDITOR.dialog.add( commandName, dialogFile );
     26                };
     27
     28                var dialogPath = this.path + 'dialogs/';
     29                addButtonCommand( 'Form',                       'form',                 dialogPath + 'form.js' );
     30                addButtonCommand( 'Checkbox',           'checkbox',             dialogPath + 'checkbox.js' );
     31                addButtonCommand( 'Radio',                      'radio',                dialogPath + 'radio.js' );
     32                addButtonCommand( 'TextField',          'textfield',    dialogPath + 'textfield.js' );
     33                addButtonCommand( 'Textarea',           'textarea',             dialogPath + 'textarea.js' );
     34                addButtonCommand( 'Select',                     'select',               dialogPath + 'select.js' );
     35                addButtonCommand( 'Button',                     'button',               dialogPath + 'button.js' );
     36                addButtonCommand( 'ImageButton',        'imagebutton',  CKEDITOR.plugins.getPath('image') + 'dialogs/image.js' );
     37                addButtonCommand( 'HiddenField',        'hiddenfield',  dialogPath + 'hiddenfield.js' );
     38        },
     39        requires : [ 'image' ]
     40} );
  • _source/plugins/toolbar/plugin.js

     
    214214                'Subscript', 'Superscript', '-',
    215215                'SelectAll', 'RemoveFormat', '-',
    216216                'Link', 'Unlink', 'Anchor', '-',
    217                 'Table', 'Smiley', 'HorizontalRule', 'SpecialChar', 'PageBreak'
     217                'Table', 'Smiley', 'HorizontalRule', 'SpecialChar', 'PageBreak', '-',
     218                'Form', 'Checkbox', 'Radio', 'TextField', 'Textarea', 'Select', 'Button', 'ImageButton', 'HiddenField', '-',
    218219        ]
    219220];
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy