    /*

    Siesta 5.3.0
    Copyright(c) 2009-2019 Bryntum AB
    https://bryntum.com/contact
    https://bryntum.com/products/siesta/license

    */
    Ext.define('Siesta.Project.Browser.UI.VersionUpdateButton', {
        extend        : 'Ext.Button',
        xtype         : 'versionupdatebutton',

        text          : Siesta.Resource('Siesta.Project.Browser.UI.VersionUpdateButton', 'newUpdateText'),
        action        : 'upgrade-siesta',
        hidden        : true,
        latestVersion : null,
        scale         : 'medium',

        constructor : function () {
            this.callParent(arguments);
            this.scope = this;

            if (Siesta.meta.VERSION && !window.location.href.match('^https')) {
                this.fetchVersionInfo();
            }
        },

        fetchVersionInfo : function () {

            Ext.data.JsonP.request({
                url      : 'https://bryntum.com/siesta_version',
                params   : { v : Siesta.meta.VERSION },
                scope    : this,
                callback : this.onRequestCompleted
            });
        },

        onRequestCompleted : function (success, data) {
            if (success &&
                data &&
                data.name &&
                new Ext.Version(data.name).isGreaterThan(Siesta.meta.VERSION || '1.0.0')) {

                this.latestVersion = data.name;

                this.show();
            }
        },

        handler : function () {
            var me = this;
            var R = Siesta.Resource('Siesta.Project.Browser.UI.VersionUpdateButton');

            var win = new Ext.Window({
                cls         : 'changelog-window',
                title       : R.get('updateWindowTitleText') + (Siesta.meta.VERSION || '1.0.0'),
                modal       : true,
                width       : 500,
                height      : 380,
                closeAction : 'destroy',
                plain       : true,
                autoScroll  : true,
                buttons     : {
                    padding : '10 13',
                    style   : 'background: transparent',

                    items : [
                        {
                            cls        : 'light-button',
                            href       : 'https://www.bryntum.com/products/siesta/download-lite',
                            hrefTarget : '_blank',
                            scale      : 'medium',
                            text       : R.get('downloadText') + this.latestVersion + R.get('liteText')
                        },
                        {
                            cls        : 'light-button',
                            href       : 'https://bryntum.com/customerzone',
                            hrefTarget : '_blank',
                            scale      : 'medium',
                            text       : R.get('downloadText') + this.latestVersion + R.get('standardText')
                        },
                        {
                            text    : R.get('cancelText'),
                            scale   : 'medium',
                            handler : function () {
                                win.close();
                            }
                        }
                    ]
                }
            })

            win.show();
            win.body.mask(R.get('loadingChangelogText'));

            Ext.Ajax.request({
                useDefaultXhrHeader : false,
                url                 : 'https://bryntum.com/changelogs/_siesta.php',
                callback            : function (o, success, response) {
                    win.body.unmask();

                    if (success && response && response.responseText) {
                        win.update(response.responseText);
                    } else {
                        win.update(Siesta.Resource('Siesta.Project.Browser.UI.VersionUpdateButton', 'changelogLoadFailedText'));
                    }
                }
            })
        }
    });