liuxiaolong
2019-05-09 0d1d88cdb668e75ea8609417ac18ae19947e9525
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
/**
 * Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
 * For licensing, see LICENSE.html or http://ckeditor.com/license
 *
 * CKFinder 2.x - sample "dummy" plugin.
 *
 * To enable it, add the following line to config.js:
 *     config.extraPlugins = 'dummy';
 */
 
/**
 * See http://docs.cksource.com/ckfinder_2.x_api/symbols/CKFinder.html#.addPlugin
 */
CKFinder.addPlugin( 'dummy', {
 
    lang : [ 'en', 'pl' ],
 
    appReady : function( api ) {
        CKFinder.dialog.add( 'dummydialog', function( api )
            {
                // CKFinder.dialog.definition
                var dialogDefinition =
                {
                    title : api.lang.dummy.title,
                    minWidth : 390,
                    minHeight : 230,
                    onOk : function() {
                        // "this" is now a CKFinder.dialog object.
                        var value = this.getValueOf( 'tab1', 'textareaId' );
                        if ( !value ) {
                            api.openMsgDialog( '', api.lang.dummy.typeText );
                            return false;
                        }
                        else {
                            alert( "You have entered: " + value );
                            return true;
                        }
                    },
                    contents : [
                        {
                            id : 'tab1',
                            label : '',
                            title : '',
                            expand : true,
                            padding : 0,
                            elements :
                            [
                                {
                                    type : 'html',
                                    html : '<h3>' +  api.lang.dummy.typeText + '</h3>'
                                },
                                {
                                    type : 'textarea',
                                    id : 'textareaId',
                                    rows : 10,
                                    cols : 40
                                }
                            ]
                        }
                    ],
                    buttons : [ CKFinder.dialog.cancelButton, CKFinder.dialog.okButton ]
                };
 
                return dialogDefinition;
            } );
 
        api.addFileContextMenuOption( { label : api.lang.dummy.menuItem, command : "dummycommand" } , function( api, file )
        {
            api.openDialog('dummydialog');
        });
    }
});