Example #1
0
                    require(['modalhelper'], function (ModalHelper)
                    {
                        new ModalHelper().confirm({
                            title: T.t('marketplace.authorize_title'), text: T.t('marketplace.authorize_page'),
                            onButton: function (text)
                            {
                                if (text == 'Yes')
                                {
                                    var path = settingsManager.get('marketplace.url') + '/oauth/authorize?client_id=' + settingsManager.get('marketplace.client_id')
                                        + '&redirect_uri=' + encodeURIComponent(location.protocol + '//' + location.host + '/marketplace/auth?install=1');

                                    window.marketplaceAuthDone = function (accessToken)
                                    {
                                        if (!_.isEmpty(accessToken))
                                        {
                                            settingsManager.loadSettings(function ()
                                            {
                                                callback && callback(true);
                                            });
                                        }
                                        else
                                            callback && callback(false);

                                    }
                                    window.open(path, 'nsmarketplaceauth', 'location=0,status=0,width=800,height=400');
                                }
                                else
                                    callback && callback(false)

                            }
                        })
                    });
Example #2
0
                getItemInfo: function (idType,id, options,callback)
                {
                    if (_.isEmpty(id))
                        return callback && callback(T.t('system.invalid_data'));

                    _.isFunction(options) && (callback = options, options = {});
                    _.isObject(options) || (options = {});

                    var qsOptions = { c: options.complete };
                    qsOptions[ID_TYPE_SHORT_CODES[idType]] = 1;

                    var command = 'marketplace/item/' + encodeURIComponent(id) + '/info?' +
                        QueryString.stringify(qsOptions);
                    return App.serverCommand(command, callback);

                },