Merge pull request #21085 from totten/master-action-lang
[civicrm-core.git] / templates / CRM / Contact / Form / Task / Email.tpl
1 {*
2 +--------------------------------------------------------------------+
3 | Copyright CiviCRM LLC. All rights reserved. |
4 | |
5 | This work is published under the GNU AGPLv3 license with some |
6 | permitted exceptions and without any warranty. For full license |
7 | and copyright information, see https://civicrm.org/licensing |
8 +--------------------------------------------------------------------+
9 *}
10 <div class="crm-block crm-form-block crm-contactEmail-form-block">
11 <div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="top"}</div>
12 {if $suppressedEmails > 0}
13 <div class="status">
14 <p>{ts count=$suppressedEmails plural='Email will NOT be sent to %count contacts - (no email address on file, or communication preferences specify DO NOT EMAIL, or contact is deceased).'}Email will NOT be sent to %count contact - (no email address on file, or communication preferences specify DO NOT EMAIL, or contact is deceased).{/ts}</p>
15 </div>
16 {/if}
17 {crmSetting var="logged_in_email_setting" name="allow_mail_from_logged_in_contact"}
18 <table class="form-layout-compressed">
19 <tr id="selectEmailFrom" class="crm-contactEmail-form-block-fromEmailAddress crm-email-element">
20 <td class="label">{$form.from_email_address.label}</td>
21 <td>{$form.from_email_address.html} {help id="id-from_email" file="CRM/Contact/Form/Task/Email.hlp" isAdmin=$isAdmin logged_in_email_setting=$logged_in_email_setting}</td>
22 </tr>
23 <tr class="crm-contactEmail-form-block-recipient">
24 <td class="label">{if $single eq false}{ts}Recipient(s){/ts}{else}{$form.to.label}{/if}</td>
25 <td>
26 {$form.to.html} {help id="id-to_email" file="CRM/Contact/Form/Task/Email.hlp"}
27 </td>
28 </tr>
29 <tr class="crm-contactEmail-form-block-cc_id" {if !$form.cc_id.value}style="display:none;"{/if}>
30 <td class="label">{$form.cc_id.label}</td>
31 <td>
32 {$form.cc_id.html}
33 <a class="crm-hover-button clear-cc-link" rel="cc_id" title="{ts}Clear{/ts}" href="#"><i class="crm-i fa-times" aria-hidden="true"></i></a>
34 </td>
35 </tr>
36 <tr class="crm-contactEmail-form-block-bcc_id" {if !$form.bcc_id.value}style="display:none;"{/if}>
37 <td class="label">{$form.bcc_id.label}</td>
38 <td>
39 {$form.bcc_id.html}
40 <a class="crm-hover-button clear-cc-link" rel="bcc_id" title="{ts}Clear{/ts}" href="#"><i class="crm-i fa-times" aria-hidden="true"></i></a>
41 </td>
42 </tr>
43 <tr>
44 <td></td>
45 <td>
46 <div>
47 <a href="#" rel="cc_id" class="add-cc-link crm-hover-button" {if $form.cc_id.value}style="display:none;"{/if}>{ts}Add CC{/ts}</a>&nbsp;&nbsp;
48 <a href="#" rel="bcc_id" class="add-cc-link crm-hover-button" {if $form.bcc_id.value}style="display:none;"{/if}>{ts}Add BCC{/ts}</a>
49 </div>
50 </td>
51 </tr>
52
53 {if $emailTask}
54 <tr class="crm-contactEmail-form-block-template">
55 <td class="label">{$form.template.label}</td>
56 <td>{$form.template.html}</td>
57 </tr>
58 {/if}
59 <tr class="crm-contactEmail-form-block-subject">
60 <td class="label">{$form.subject.label}</td>
61 <td>
62 {$form.subject.html|crmAddClass:huge}&nbsp;
63 <input class="crm-token-selector big" data-field="subject" />
64 {help id="id-token-subject" tplFile=$tplFile isAdmin=$isAdmin file="CRM/Contact/Form/Task/Email.hlp"}
65 </td>
66 </tr>
67 {* CRM-15984 --add campaign to email activities *}
68 {include file="CRM/Campaign/Form/addCampaignToComponent.tpl" campaignTrClass="crm-contactEmail-form-block-campaign_id"}
69 </table>
70
71 {include file="CRM/Contact/Form/Task/EmailCommon.tpl"}
72 {include file="CRM/Activity/Form/FollowUp.tpl" type='email-'}
73
74 <div class="spacer"> </div>
75
76 {if $single eq false}
77 {include file="CRM/Contact/Form/Task.tpl"}
78 {/if}
79 {if $suppressedEmails > 0}
80 {ts count=$suppressedEmails plural='Email will NOT be sent to %count contacts.'}Email will NOT be sent to %count contact.{/ts}
81 {/if}
82 <div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="bottom"}</div>
83 </div>
84 <script type="text/javascript">
85
86 {literal}
87 CRM.$(function($) {
88 var $form = $("form.{/literal}{$form.formClass}{literal}");
89
90 $('.add-cc-link', $form).click(function(e) {
91 e.preventDefault();
92 var type = $(this).attr('rel');
93 $(this).hide();
94 $('.crm-contactEmail-form-block-'+type, $form).show();
95 });
96
97 $('.clear-cc-link', $form).click(function(e) {
98 e.preventDefault();
99 var type = $(this).attr('rel');
100 $('.add-cc-link[rel='+type+']', $form).show();
101 $('.crm-contactEmail-form-block-'+type, $form).hide().find('input.crm-ajax-select').select2('data', []);
102 });
103
104 var sourceDataUrl = "{/literal}{crmURL p='civicrm/ajax/checkemail' q='id=1' h=0 }{literal}";
105
106 function emailSelect(el, prepopulate) {
107 $(el, $form).data('api-entity', 'contact').css({width: '40em', 'max-width': '90%'}).crmSelect2({
108 minimumInputLength: 1,
109 multiple: true,
110 ajax: {
111 url: sourceDataUrl,
112 data: function(term) {
113 return {
114 name: term
115 };
116 },
117 results: function(response) {
118 return {
119 results: response
120 };
121 }
122 }
123 }).select2('data', prepopulate);
124 }
125
126 {/literal}
127 var toContact = {if $toContact}{$toContact}{else}''{/if};
128 {literal}
129 emailSelect('#to', toContact);
130 });
131
132
133 </script>
134 {/literal}