<!--
<a class="action-item crm-hover-button" ng-click="toggleCxn(cxn)">{{cxn.is_active ? ts('Disable') : ts('Enable') }}</a>
-->
+ <a class="action-item crm-hover-button" ng-click="openLink(cxn.app_meta, 'settings', {title: ts('%1: Settings (External)', {1: cxn.app_meta.title})})" ng-show="cxn.app_meta.links.settings">{{ts('Settings')}}</a>
+ <a class="action-item crm-hover-button" ng-click="openLink(cxn.app_meta, 'logs', {title: ts('%1: Logs (External)', {1: cxn.app_meta.title})})" ng-show="cxn.app_meta.links.logs">{{ts('Logs')}}</a>
+ <a class="action-item crm-hover-button" ng-click="openLink(cxn.app_meta, 'docs', {title: ts('%1: Documentation (External)', {1: cxn.app_meta.title})})" ng-show="cxn.app_meta.links.docs">{{ts('Docs')}}</a>
+ <a class="action-item crm-hover-button" ng-click="openLink(cxn.app_meta, 'support', {title: ts('%1: Support (External)', {1: cxn.app_meta.title})})" ng-show="cxn.app_meta.links.support">{{ts('Support')}}</a>
<a class="action-item crm-hover-button"
crm-confirm='{width: "65%", resizable: true, title: ts("Disconnect"), message: ts("Are you sure you want to disconnect \"%1?\". Doing so may permanently destroy data linkage.", {1: cxn.app_meta.title})}'
on-yes="unregister(cxn.app_meta)"
(function(angular, $, _) {
- angular.module('crmCxn').controller('CrmCxnManageCtrl', function CrmCxnManageCtrl($scope, apiCalls, crmApi, crmUiAlert, crmBlocker, crmStatus, $timeout) {
+ angular.module('crmCxn').controller('CrmCxnManageCtrl', function CrmCxnManageCtrl($scope, apiCalls, crmApi, crmUiAlert, crmBlocker, crmStatus, $timeout, dialogService) {
var ts = $scope.ts = CRM.ts(null);
$scope.appMetas = apiCalls.appMetas.values;
$scope.cxns = apiCalls.cxns.values;
});
return block(crmStatus({start: ts('Saving...'), success: ts('Saved')}, reg));
};
+
+ $scope.openLink = function openLink(appMeta, page, options) {
+ var promise = crmApi('Cxn', 'getlink', {app_guid: appMeta.appId, page: page}).then(function(result) {
+ var mode = result.values.mode ? result.values.mode : 'popup';
+ switch (result.values.mode) {
+ case 'iframe':
+ var passThrus = ['height', 'width']; // Options influenced by remote server.
+ options = angular.extend(_.pick(result.values, passThrus), options);
+ $scope.openIframe(result.values.url, options);
+ break;
+ case 'popup':
+ CRM.alert(ts('The page "%1" will open in a popup. If it does not appear automatically, check your browser for notifications.', {1: options.title}), '', 'info');
+ window.open(result.values.url, 'cxnSettings', 'resizable,scrollbars,status');
+ break;
+ case 'redirect':
+ window.location = result.values.url;
+ break;
+ default:
+ CRM.alert(ts('Cannot open link. Unrecognized mode.'), '', 'error');
+ }
+ });
+ return block(crmStatus({start: ts('Opening...'), success: ''}, promise));
+ };
+
+ // @param Object options -- see dialogService.open
+ $scope.openIframe = function openIframe(url, options) {
+ var model = {
+ url: url
+ };
+ options = CRM.utils.adjustDialogDefaults(angular.extend(
+ {
+ autoOpen: false,
+ height: 'auto',
+ width: '40%',
+ title: ts('External Link')
+ },
+ options
+ ));
+ return dialogService.open('cxnLinkDialog', '~/crmCxn/LinkDialogCtrl.html', model, options)
+ .then(function(item) {
+ mailing.msg_template_id = item.id;
+ return item;
+ });
+ };
});
})(angular, CRM.$, CRM._);