diff --git a/SugarModules/custom/clients/base/views/ibm-connections/ibm-connections-need-configure.hbs b/SugarModules/custom/clients/base/views/ibm-connections/ibm-connections-need-configure.hbs new file mode 100644 index 0000000..1857040 --- /dev/null +++ b/SugarModules/custom/clients/base/views/ibm-connections/ibm-connections-need-configure.hbs @@ -0,0 +1,20 @@ +{{! +/********************************************************************************* + * By installing or using this file, you are confirming on behalf of the entity + * subscribed to the SugarCRM Inc. product ("Company") that Company is bound by + * the SugarCRM Inc. Master Subscription Agreement (“MSA”), which is viewable at: + * http://www.sugarcrm.com/master-subscription-agreement + * + * If Company is not bound by the MSA, then by installing or using this file + * you are agreeing unconditionally that Company will be bound by the MSA and + * certifying that you have authority to bind Company accordingly. + * + * Copyright (C) 2004-2014 SugarCRM Inc. All rights reserved. + ********************************************************************************/ + +}} + diff --git a/SugarModules/custom/clients/base/views/ibm-connections/ibm-connections.js b/SugarModules/custom/clients/base/views/ibm-connections/ibm-connections.js index 504ffae..3ae8b24 100644 --- a/SugarModules/custom/clients/base/views/ibm-connections/ibm-connections.js +++ b/SugarModules/custom/clients/base/views/ibm-connections/ibm-connections.js @@ -130,11 +130,6 @@ initDashlet: function () { var self = this; this._super('initDashlet', []); - if (this.meta.config) { - var communityCollect = app.data.createBeanCollection("ibm_connectionsCommunity", null, {}); - communityCollect.on('reset', this.fillCommunities, this); - communityCollect.fetch({fields: ['id', 'name']}); - } this.$el.on('dragenter', function (event) { // self.$(event.currentTarget).addClass("dragdrop"); @@ -157,6 +152,7 @@ }, fillCommunities: function (communityCollect) { + debugger; this.communityOptions = {}; var communityField = _.find(this.fields, function (field) { return field.name == 'community_id'; @@ -473,5 +469,21 @@ } } }); + }, + + loadData: function (options) { + this._super('loadData', [options]); + if (this.meta.config) { + var communityCollect = app.data.createBeanCollection("ibm_connectionsCommunity", null, {}); + var collectOpts = { + fields: ['id', 'name'], + success: _.bind(this.fillCommunities, this), + error: _.bind(function(){ + this.template = app.template.get(this.name + '.ibm-connections-need-configure'); + this._render(); + }, this), + }; + communityCollect.fetch(collectOpts); + } } }) diff --git a/SugarModules/language/application/en_us.lang.php b/SugarModules/language/application/en_us.lang.php index aa267bc..66499d9 100755 --- a/SugarModules/language/application/en_us.lang.php +++ b/SugarModules/language/application/en_us.lang.php @@ -69,3 +69,6 @@ $app_strings['LBL_IBM-CONNECTIONS_LIST_VERSION'] = 'Version'; $app_strings['LBL_IBM-CONNECTIONS_SELECT_FILE_LABEL'] = 'Select File'; + + +$app_strings['LBL_IBM-CONNECTIONS_CONNECT'] = 'Connect to IBM connections'; diff --git a/SugarModules/modules/ibm_connectionsCommunity/clients/base/api/ibm_connectionsCommunityFilterApi.php b/SugarModules/modules/ibm_connectionsCommunity/clients/base/api/ibm_connectionsCommunityFilterApi.php index 7e1ce02..b758dbe 100644 --- a/SugarModules/modules/ibm_connectionsCommunity/clients/base/api/ibm_connectionsCommunityFilterApi.php +++ b/SugarModules/modules/ibm_connectionsCommunity/clients/base/api/ibm_connectionsCommunityFilterApi.php @@ -60,7 +60,14 @@ public function registerApiRest() public function filterList(ServiceBase $api, array $args) { $helper = new ConnectionsHelper(); + $res = $helper->apiClass->checkLogin(); + if (!$res['success']) { + throw new SugarApiExceptionRequestMethodFailure('ERROR_NEED_AUTHORIZE'); + } + $entries = $helper->getCommunityList('MyCommunities', 1, ''); - return $this->formatResult($api, $args, array('entries' => $entries ), new ibm_connectionsCommunity()); + + return $this->formatResult($api, $args, array('entries' => $entries), new ibm_connectionsCommunity()); } + }