setTimeout(scopeApply(init), 0);
});
- angular.module('crmMailing').controller('EmailAddrCtrl', function EmailAddrCtrl($scope, crmFromAddresses) {
+ angular.module('crmMailing').controller('EmailAddrCtrl', function EmailAddrCtrl($scope, crmFromAddresses, crmUiAlert) {
+ var ts = CRM.ts(null);
+ function changeAlert(winnerField, loserField) {
+ crmUiAlert({
+ title: ts('Conflict'),
+ text: ts('The "%1" option conflicts with the "%2" option. The "%2" option has been disabled.', {
+ 1: winnerField,
+ 2: loserField
+ })
+ });
+ }
+
$scope.crmFromAddresses = crmFromAddresses;
+ $scope.checkReplyToChange = function checkReplyToChange(mailing) {
+ if (!_.isEmpty(mailing.replyto_email) && mailing.override_verp == '0') {
+ mailing.override_verp = '1';
+ changeAlert(ts('Reply-To'), ts('Track Replies'))
+ }
+ };
+ $scope.checkVerpChange = function checkVerpChange(mailing) {
+ if (!_.isEmpty(mailing.replyto_email) && mailing.override_verp == '0') {
+ mailing.replyto_email = '';
+ changeAlert(ts('Track Replies'), ts('Reply-To'));
+ }
+ };
});
var lastEmailTokenAlert = null;
<div ng-controller="EmailAddrCtrl" crm-mailing-from-address="fromPlaceholder" crm-mailing="mailing">
<select
crm-ui-id="subform.fromAddress"
+ crm-ui-select="{dropdownAutoWidth : true, allowClear: false, placeholder: ts('Email address')}"
name="fromAddress"
- ui-jq="select2"
- ui-options="{dropdownAutoWidth : true, allowClear: false, placeholder: ts('Email address')}"
ng-model="fromPlaceholder.label"
- ng-options="frm.label as frm.label for frm in crmFromAddresses.getAll() | filter:{is_active:1} | orderBy:'weight'"
required>
<option value=""></option>
+ <option ng-repeat="frm in crmFromAddresses.getAll() | filter:{is_active:1} | orderBy:'weight'" value="{{frm.label}}">{{frm.label}}</option>
</select>
</div>
</div>
<div ng-controller="EmailAddrCtrl">
<select
crm-ui-id="subform.replyTo"
+ crm-ui-select="{dropdownAutoWidth : true, allowClear: true, placeholder: ts('Email address')}"
name="replyTo"
- ui-jq="select2"
- ui-options="{dropdownAutoWidth : true, allowClear: true, placeholder: ts('Email address')}"
+ ng-change="checkReplyToChange(mailing)"
ng-model="mailing.replyto_email"
- ng-options="frm.label as frm.label for frm in crmFromAddresses.getAll() | filter:{is_active:1} | orderBy:'weight'"
>
<option value=""></option>
+ <option ng-repeat="frm in crmFromAddresses.getAll() | filter:{is_active:1} | orderBy:'weight'" value="{{frm.label}}">{{frm.label}}</option>
</select>
</div>
</div>
<div class="crm-group">
<div crm-ui-field crm-title="ts('Track Replies')" crm-layout="checkbox">
<!-- Comparing data-model and UI of "override_verp", note that true/false are inverted (enabled==0,disabled==1) -->
- <input name="override_verp" type="checkbox" ng-model="mailing.override_verp" ng-true-value="'0'" ng-false-value="'1'" />
+ <span ng-controller="EmailAddrCtrl">
+ <input
+ name="override_verp"
+ type="checkbox"
+ ng-change="checkVerpChange(mailing)"
+ ng-model="mailing.override_verp"
+ ng-true-value="'0'"
+ ng-false-value="'1'"
+ />
+ </span>
</div>
<div class="crm-section" id="help">
{{ts('Recipients\' replies are sent to a CiviMail specific address instead of the sender\'s address so they can be stored within CiviCRM.')}}