}
.crm-mailing-ab-col {
- width: 12em;
+ width: 18em;
}
$scope.$on('$destroy', myAutosave.stop);
});
- // Controller for the edit-recipients fields (
- // WISHLIST: Move most of this to a (cache-enabled) service
- // Scope members:
- // - [input] mailing: object
- // - [output] recipients: array of recipient records
- angular.module('crmMailing').controller('EditRecipCtrl', function EditRecipCtrl($scope, dialogService, crmApi, crmMailingMgr, $q, crmMetadata) {
- var ts = $scope.ts = CRM.ts(null);
- $scope.recipients = null;
- $scope.getRecipientsEstimate = function () {
- var ts = $scope.ts;
- if ($scope.recipients === null) {
- return ts('(Estimating)');
- }
- if ($scope.recipients.length === 0) {
- return ts('No recipients');
- }
- if ($scope.recipients.length === 1) {
- return ts('~1 recipient');
- }
- if (RECIPIENTS_PREVIEW_LIMIT > 0 && $scope.recipients.length >= RECIPIENTS_PREVIEW_LIMIT) {
- return ts('>%1 recipients', {1: RECIPIENTS_PREVIEW_LIMIT});
- }
- return ts('~%1 recipients', {1: $scope.recipients.length});
- };
- $scope.getIncludesAsString = function () {
+ angular.module('crmMailing').controller('ViewRecipCtrl', function EditRecipCtrl($scope) {
+ $scope.getIncludesAsString = function(mailing) {
var first = true;
var names = '';
- _.each($scope.mailing.recipients.groups.include, function (id) {
+ _.each(mailing.recipients.groups.include, function (id) {
if (!first) {
names = names + ', ';
}
names = names + group[0].title;
first = false;
});
- _.each($scope.mailing.recipients.mailings.include, function (id) {
+ _.each(mailing.recipients.mailings.include, function (id) {
if (!first) {
names = names + ', ';
}
});
return names;
};
- $scope.getExcludesAsString = function () {
+ $scope.getExcludesAsString = function (mailing) {
var first = true;
var names = '';
- _.each($scope.mailing.recipients.groups.exclude, function (id) {
+ _.each(mailing.recipients.groups.exclude, function (id) {
if (!first) {
names = names + ', ';
}
names = names + group[0].title;
first = false;
});
- _.each($scope.mailing.recipients.mailings.exclude, function (id) {
+ _.each(mailing.recipients.mailings.exclude, function (id) {
if (!first) {
names = names + ', ';
}
});
return names;
};
+ });
+
+ // Controller for the edit-recipients fields (
+ // WISHLIST: Move most of this to a (cache-enabled) service
+ // Scope members:
+ // - [input] mailing: object
+ // - [output] recipients: array of recipient records
+ angular.module('crmMailing').controller('EditRecipCtrl', function EditRecipCtrl($scope, dialogService, crmApi, crmMailingMgr, $q, crmMetadata) {
+ var ts = $scope.ts = CRM.ts(null);
+ $scope.recipients = null;
+ $scope.getRecipientsEstimate = function () {
+ var ts = $scope.ts;
+ if ($scope.recipients === null) {
+ return ts('(Estimating)');
+ }
+ if ($scope.recipients.length === 0) {
+ return ts('No recipients');
+ }
+ if ($scope.recipients.length === 1) {
+ return ts('~1 recipient');
+ }
+ if (RECIPIENTS_PREVIEW_LIMIT > 0 && $scope.recipients.length >= RECIPIENTS_PREVIEW_LIMIT) {
+ return ts('>%1 recipients', {1: RECIPIENTS_PREVIEW_LIMIT});
+ }
+ return ts('~%1 recipients', {1: $scope.recipients.length});
+ };
// We monitor four fields -- use debounce so that changes across the
// four fields can settle-down before AJAX.
crmOn: '@',
crmTitle: '@'
},
- template: '<span ng-class="spanClasses"><span class="icon" ng-class="iconClasses"></span>{{crmTitle}} </span>',
+ template: '<span ng-class="spanClasses"><span class="icon" ng-class="iconClasses"></span>{{evalTitle}} </span>',
link: function (scope, element, attrs) {
function refresh() {
if (scope.$parent.$eval(attrs.crmOn)) {
scope.spanClasses = {'crmMailing-inactive': true};
scope.iconClasses = {'ui-icon-close': true};
}
- scope.crmTitle = scope.$parent.$eval(attrs.crmTitle);
+ scope.evalTitle = scope.$parent.$eval(attrs.crmTitle);
}
refresh();
if ($scope.abtest.ab.status != activeMailingStatus) {
activeMailingStatus = $scope.abtest.ab.status;
activeMailings = [
- {name: 'a', title: ts('Mailing A'), mailing: $scope.abtest.mailings.a},
- {name: 'b', title: ts('Mailing B'), mailing: $scope.abtest.mailings.b}
+ {name: 'a', title: ts('Mailing A'), mailing: $scope.abtest.mailings.a, attachments: $scope.abtest.attachments.a},
+ {name: 'b', title: ts('Mailing B'), mailing: $scope.abtest.mailings.b, attachments: $scope.abtest.attachments.b}
];
if ($scope.abtest.ab.status == 'Final') {
- activeMailings.push({name: 'c', title: ts('Final'), mailing: $scope.abtest.mailings.c});
+ activeMailings.push({name: 'c', title: ts('Final'), mailing: $scope.abtest.mailings.c, attachments: $scope.abtest.attachments.c});
}
}
return activeMailings;
{{mailing.name}}
</div>
<div crm-ui-field crm-title="ts('Recipients')">
- <div ng-controller="EditRecipCtrl">
- <div><a crm-icon="newwin" class="crm-hover-button action-item" ng-click="previewRecipients()">{{getRecipientsEstimate()}}</a></div>
- <div ng-show="getIncludesAsString()">
- (<strong>{{ts('Include:')}}</strong> {{getIncludesAsString()}})
- </div>
- <div ng-show="getExcludesAsString()">
- (<strong>{{ts('Exclude:')}}</strong> <s>{{getExcludesAsString()}}</s>)
+ <div ng-controller="ViewRecipCtrl">
+ <div ng-controller="EditRecipCtrl">
+ <div><a crm-icon="newwin" class="crm-hover-button action-item" ng-click="previewRecipients()">{{getRecipientsEstimate()}}</a></div>
+ <div ng-show="getIncludesAsString(mailing)">
+ (<strong>{{ts('Include:')}}</strong> {{getIncludesAsString(mailing)}})
+ </div>
+ <div ng-show="getExcludesAsString(mailing)">
+ (<strong>{{ts('Exclude:')}}</strong> <s>{{getExcludesAsString(mailing)}}</s>)
+ </div>
</div>
</div>
</div>
<div ng-controller="CrmMailingABReportCtrl">
<table>
+ <thead>
+ <tr ng-show="abtest.ab.status == 'Testing'">
+ <td></td>
+ <td ng-repeat="am in getActiveMailings()">
+ <button ng-click="selectWinner(am.name)">{{ts('Select as Winner')}}</button>
+ </td>
+ </tr>
+ </thead>
+
+ <thead>
+ <tr>
+ <th>{{ts('Delivery Summary')}}</th>
+ <th ng-repeat="am in getActiveMailings()" class="crm-mailing-ab-col">{{am.title}}</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr ng-repeat="statType in statTypes">
+ <td>{{statType.title}}</td>
+ <td ng-repeat="am in getActiveMailings()">
+ <a class="crm-hover-button action-item" ng-href="{{statUrl(am.mailing, statType, 'search')}}" title="{{ts('Search for contacts using \'%1\'', {1: statType.title})}}" crm-icon="search"></a>
+ <a class="crm-hover-button action-item" ng-href="{{statUrl(am.mailing, statType, 'events')}}" title="{{ts('Browse events of type \'%1\'', {1: statType.title})}}">{{stats[am.name][statType.name] || ts('n/a')}}</a>
+ </td>
+ </tr>
+ </tbody>
+
<thead>
<tr>
<th>{{ts('Details')}}</th>
<th ng-repeat="am in getActiveMailings()" class="crm-mailing-ab-col">{{am.title}}</th>
</tr>
</thead>
+
<tbody>
- <tr ng-show="abtest.mailings.a.body_html || abtest.mailings.b.body_html">
- <td>{{ts('HTML')}}</td>
+ <tr>
+ <td>{{ts('Mailing Name')}}</td>
<td ng-repeat="am in getActiveMailings()">
- <a class="crm-hover-button" ng-click="previewMailing(am.name,'html')" ng-show="am.mailing.body_html">{{ts('View')}}</a>
+ {{am.mailing.name}}
</td>
</tr>
- <tr ng-show="abtest.mailings.a.body_text || abtest.mailings.b.body_text">
- <td>{{ts('Text')}}</td>
+ <tr>
+ <td>{{ts('From')}}</td>
<td ng-repeat="am in getActiveMailings()">
- <a class="crm-hover-button" ng-click="previewMailing(am.name,'text')" ng-show="am.mailing.body_text">{{ts('View')}}</a>
+ "{{am.mailing.from_name}}" <{{am.mailing.from_email}}>
</td>
</tr>
- <tr ng-repeat="statType in statTypes">
- <td>{{statType.title}}</td>
+ <tr>
+ <td>{{ts('Subject')}}</td>
<td ng-repeat="am in getActiveMailings()">
- <a class="crm-hover-button" ng-href="{{statUrl(am.mailing, statType, 'events')}}" title="{{statType.title}}">{{stats[am.name][statType.name] || ts('n/a')}}</a>
- <a class="crm-hover-button" ng-href="{{statUrl(am.mailing, statType, 'search')}}" title="{{ts('Search for contacts')}}" crm-icon="search"></a>
+ {{am.mailing.subject}}
</td>
</tr>
- <tr ng-show="abtest.ab.status == 'Testing'">
- <td></td>
+ <tr ng-controller="ViewRecipCtrl">
+ <td>{{ts('Recipients')}}</td>
<td ng-repeat="am in getActiveMailings()">
- <button ng-click="selectWinner(am.name)">{{ts('Select as Winner')}}</button>
+ <div ng-show="getIncludesAsString(am.mailing)">
+ <strong>{{ts('Include:')}}</strong> {{getIncludesAsString(am.mailing)}}
+ </div>
+ <div ng-show="getExcludesAsString(am.mailing)">
+ <strong>{{ts('Exclude:')}}</strong> <s>{{getExcludesAsString(am.mailing)}}</s>
+ </div>
+ </td>
+ </tr>
+ <tr>
+ <td>{{ts('Content')}}</td>
+ <td ng-repeat="am in getActiveMailings()">
+ <a crm-icon="newwin" class="crm-hover-button action-item" ng-click="previewMailing(am.name,'html')" ng-show="am.mailing.body_html">{{ts('HTML')}}</a>
+ <a crm-icon="newwin" class="crm-hover-button action-item" ng-click="previewMailing(am.name,'text')" ng-show="am.mailing.body_text">{{ts('Text')}}</a>
+ </td>
+ </tr>
+ <tr>
+ <td>{{ts('Attachments')}}</td>
+ <td ng-repeat="am in getActiveMailings()">
+ <div ng-repeat="file in am.attachments.files"><a ng-href="{{file.url}}" target="_blank">{{file.name}}</a></div>
+ </td>
+ </tr>
+ <tr>
+ <td>{{ts('Tracking')}}</td>
+ <td ng-repeat="am in getActiveMailings()">
+ <div crm-mailing-review-bool crm-on="am.mailing.url_tracking=='1'" crm-title="ts('Click Throughs')"></div>
+ <div crm-mailing-review-bool crm-on="am.mailing.open_tracking=='1'" crm-title="ts('Opens')"></div>
+ </td>
+ </tr>
+ <tr>
+ <td>{{ts('Responding')}}</td>
+ <td ng-repeat="am in getActiveMailings()">
+ <div crm-mailing-review-bool crm-on="am.mailing.override_verp=='0'" crm-title="ts('Track Replies')"></div>
+ <div crm-mailing-review-bool crm-on="am.mailing.override_verp=='0' && mailing.forward_replies=='1'" crm-title="ts('Forward Replies')"></div>
+ <div ng-controller="PreviewComponentCtrl">
+ <div ng-show="am.mailing.override_verp == '0' && mailing.auto_responder"><a crm-icon="newwin" class="crm-hover-button action-item" ng-click="previewComponent(ts('Auto-Respond'), am.mailing.reply_id)">{{ts('Auto-Respond')}}</a></div>
+ <div><a crm-icon="newwin" class="crm-hover-button action-item" ng-click="previewComponent(ts('Opt-out'), am.mailing.optout_id)">{{ts('Opt-out')}}</a></div>
+ <div><a crm-icon="newwin" class="crm-hover-button action-item" ng-click="previewComponent(ts('Resubscribe'), am.mailing.resubscribe_id)">{{ts('Resubscribe')}}</a></div>
+ <div><a crm-icon="newwin" class="crm-hover-button action-item" ng-click="previewComponent(ts('Unsubscribe'), am.mailing.unsubscribe_id)">{{ts('Unsubscribe')}}</a></div>
+ </div>
+ </td>
+ </tr>
+ <tr>
+ <td>{{ts('Publication')}}</td>
+ <td ng-repeat="am in getActiveMailings()">
+ {{am.mailing.visibility}}
</td>
</tr>
</tbody>
+
</table>
<div crm-ui-tab-set>