View difference between Paste ID: CMMEqAQN and JU0j2tB5
SHOW: | | - or go back to the newest paste.
1-
/* This is my plugin.js code */
1+
/* This is my paypal.js code */
2-
(function() 
2+
(function()
3
{
4
    var paypalButtonData = {};
5-
    CKEDITOR.plugins.add( 'paypal',
5+
6-
    {   
6+
    CKEDITOR.dialog.add( 'paypalChooseButton', function( editor ) 
7-
        requires: 'dialog',
7+
    {
8-
        lang: ['en'],
8+
        var lang = editor.lang.paypal;
9-
        init: function( editor )
9+
10-
        {
10+
        return {
11-
            CKEDITOR.dialog.add( 'paypalChooseButton', CKEDITOR.getUrl( this.path + 'dialog/paypal.js' ) );
11+
            title     : CKEDITOR.env.ie ? lang.dlgTitle : lang.title,
12-
            CKEDITOR.dialog.add( 'paypalCreateSingleButton', CKEDITOR.getUrl( this.path + 'dialog/paypalSingleButton.js' ) );
12+
            minWidth  : 300,
13-
            CKEDITOR.dialog.add( 'paypalCreateMultiButton', CKEDITOR.getUrl( this.path + 'dialog/paypalMultiButton.js' ) );
13+
            minHeight : 250,
14
            contents  : [
15-
            editor.addCommand( 'paypalChooseButton', 
15+
16
                    id: 'paypal1',
17-
                exec: function( editor )
17+
                    label: '',
18
                    title: '',
19-
                    editor.openDialog( 'paypalChooseButton' );
19+
                    expand: false,
20-
                    return;
20+
                    padding: 0,
21
                    elements: [
22-
            });
22+
                        {
23
                            type: 'select',
24-
            editor.ui.addButton( 'paypal',
24+
                            id: 'CKpaypal-currency',
25
                            label: lang.labelButtontype + ' *',
26-
                label: 'Insert PayPal Button',
26+
                            items: [ ['Please select one:', ''],['Single Item', 'paypalCreateSingleButton'],['Multi Choice Button', 'paypalCreateMultiButton']],
27-
                command:'paypalChooseButton',
27+
                            validate: function()
28-
                icon: this.path + 'img/paypal.png'
28+
                            {
29-
            });
29+
                                if( this.getValue() === '' )
30-
            
30+
                                {
31-
        }
31+
                                    document.getElementById( 'CKpaypal-validationMessages' ).innerHTML = lang.validatecurrency;
32
                                    return false;
33
                                };
34
                            },
35
                            commit: function()
36
                            {
37
                                paypalButtonData.buttonType = this.getValue();
38
                            }
39
                        },
40
                        {
41
                            type: 'html',
42
                            html: '<div id="CKpaypal-validationMessages" style="color:red;font-weight:bold;margin-top:20px;"></div>'
43
                        }
44
                    ]
45
                }
46
            ],
47
            onOk: function()
48
            {
49
                this.commitContent();
50
51
                console.log( paypalButtonData );
52
                editor.openDialog( paypalButtonData.buttonType );
53
                return;
54
            },
55
            onShow: function()
56
            {
57
                paypalButtonData = {};
58
                document.getElementById( 'CKpaypal-validationMessages' ).innerHTML = '';
59
                return;
60
            }
61
        };
62
63
    });
64
65
})();