Commit | Line | Data |
---|---|---|
6a488035 TO |
1 | {* |
2 | +--------------------------------------------------------------------+ | |
819d0d41 | 3 | | CiviCRM version 4.5 | |
6a488035 | 4 | +--------------------------------------------------------------------+ |
819d0d41 | 5 | | Copyright CiviCRM LLC (c) 2004-2014 | |
6a488035 TO |
6 | +--------------------------------------------------------------------+ |
7 | | This file is a part of CiviCRM. | | |
8 | | | | |
9 | | CiviCRM is free software; you can copy, modify, and distribute it | | |
10 | | under the terms of the GNU Affero General Public License | | |
11 | | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. | | |
12 | | | | |
13 | | CiviCRM is distributed in the hope that it will be useful, but | | |
14 | | WITHOUT ANY WARRANTY; without even the implied warranty of | | |
15 | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | | |
16 | | See the GNU Affero General Public License for more details. | | |
17 | | | | |
18 | | You should have received a copy of the GNU Affero General Public | | |
19 | | License and the CiviCRM Licensing Exception along | | |
20 | | with this program; if not, contact CiviCRM LLC | | |
21 | | at info[AT]civicrm[DOT]org. If you have questions about the | | |
22 | | GNU Affero General Public License or the licensing of CiviCRM, | | |
23 | | see the CiviCRM license FAQ at http://civicrm.org/licensing | | |
24 | +--------------------------------------------------------------------+ | |
25 | *} | |
26 | <div class="crm-block crm-form-block crm-contactEmail-form-block"> | |
27 | <div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="top"}</div> | |
28 | {if $suppressedEmails > 0} | |
29 | <div class="status"> | |
30 | <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> | |
31 | </div> | |
32 | {/if} | |
33 | <table class="form-layout-compressed"> | |
34 | <tr class="crm-contactEmail-form-block-fromEmailAddress"> | |
35 | <td class="label">{$form.fromEmailAddress.label}</td> | |
36 | <td>{$form.fromEmailAddress.html} {help id="id-from_email" file="CRM/Contact/Form/Task/Email.hlp" isAdmin=$isAdmin}</td> | |
37 | </tr> | |
38 | <tr class="crm-contactEmail-form-block-recipient"> | |
39 | <td class="label">{if $single eq false}{ts}Recipient(s){/ts}{else}{$form.to.label}{/if}</td> | |
6a7a32b9 CW |
40 | <td> |
41 | {$form.to.html}{if $noEmails eq true} {$form.emailAddress.html}{/if} | |
6a488035 TO |
42 | </td> |
43 | </tr> | |
6a7a32b9 CW |
44 | <tr class="crm-contactEmail-form-block-cc_id" {if !$form.cc_id.value}style="display:none;"{/if}> |
45 | <td class="label">{$form.cc_id.label}</td> | |
46 | <td> | |
47 | {$form.cc_id.html} | |
48 | <a class="crm-hover-button clear-cc-link" rel="cc_id" title="{ts}Clear{/ts}" href="#"><span class="icon close-icon"></span></a> | |
49 | </td> | |
6a488035 | 50 | </tr> |
6a7a32b9 CW |
51 | <tr class="crm-contactEmail-form-block-bcc_id" {if !$form.bcc_id.value}style="display:none;"{/if}> |
52 | <td class="label">{$form.bcc_id.label}</td> | |
53 | <td> | |
54 | {$form.bcc_id.html} | |
55 | <a class="crm-hover-button clear-cc-link" rel="bcc_id" title="{ts}Clear{/ts}" href="#"><span class="icon close-icon"></span></a> | |
56 | </td> | |
6a488035 | 57 | </tr> |
707d14a9 CW |
58 | <tr> |
59 | <td></td> | |
60 | <td> | |
61 | <div> | |
62 | <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> | |
63 | <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> | |
64 | </div> | |
65 | </td> | |
66 | </tr> | |
6a488035 TO |
67 | |
68 | {if $emailTask} | |
69 | <tr class="crm-contactEmail-form-block-template"> | |
70 | <td class="label">{$form.template.label}</td> | |
71 | <td>{$form.template.html}</td> | |
72 | </tr> | |
73 | {/if} | |
74 | <tr class="crm-contactEmail-form-block-subject"> | |
75 | <td class="label">{$form.subject.label}</td> | |
ac0a3db5 CW |
76 | <td> |
77 | {$form.subject.html|crmAddClass:huge} | |
78 | <input class="crm-token-selector big" data-field="subject" /> | |
79 | {help id="id-token-subject" tplFile=$tplFile isAdmin=$isAdmin file="CRM/Contact/Form/Task/Email.hlp"} | |
6a488035 TO |
80 | </td> |
81 | </tr> | |
82 | </table> | |
83 | ||
84 | {include file="CRM/Contact/Form/Task/EmailCommon.tpl"} | |
85 | ||
86 | <div class="spacer"> </div> | |
87 | ||
88 | {if $single eq false} | |
89 | {include file="CRM/Contact/Form/Task.tpl"} | |
90 | {/if} | |
91 | {if $suppressedEmails > 0} | |
92 | {ts count=$suppressedEmails plural='Email will NOT be sent to %count contacts.'}Email will NOT be sent to %count contact.{/ts} | |
93 | {/if} | |
94 | <div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="bottom"}</div> | |
95 | </div> | |
96 | <script type="text/javascript"> | |
6a488035 | 97 | |
6a7a32b9 CW |
98 | {literal} |
99 | CRM.$(function($) { | |
b50fdacc | 100 | var $form = $("form.{/literal}{$form.formClass}{literal}"); |
6a488035 | 101 | |
6a7a32b9 CW |
102 | $('.add-cc-link', $form).click(function(e) { |
103 | e.preventDefault(); | |
104 | var type = $(this).attr('rel'); | |
105 | $(this).hide(); | |
106 | $('.crm-contactEmail-form-block-'+type, $form).show(); | |
107 | }); | |
6a488035 | 108 | |
6a7a32b9 CW |
109 | $('.clear-cc-link', $form).click(function(e) { |
110 | e.preventDefault(); | |
111 | var type = $(this).attr('rel'); | |
112 | $('.add-cc-link[rel='+type+']', $form).show(); | |
113 | $('.crm-contactEmail-form-block-'+type, $form).hide().find('input.crm-ajax-select').select2('data', []); | |
114 | }); | |
6a488035 | 115 | |
cac1236c M |
116 | var sourceDataUrl = "{/literal}{crmURL p='civicrm/ajax/checkemail' q='id=1' h=0 }{literal}"; |
117 | ||
6a7a32b9 CW |
118 | function emailSelect(el, prepopulate) { |
119 | $(el, $form).data('api-entity', 'contact').css({width: '40em', 'max-width': '90%'}).crmSelect2({ | |
cac1236c M |
120 | minimumInputLength: 1, |
121 | multiple: true, | |
122 | ajax: { | |
123 | url: sourceDataUrl, | |
124 | data: function(term) { | |
125 | return { | |
6a7a32b9 | 126 | name: term |
cac1236c M |
127 | }; |
128 | }, | |
129 | results: function(response) { | |
130 | return { | |
6a7a32b9 | 131 | results: response |
cac1236c M |
132 | }; |
133 | } | |
134 | } | |
a03d5ab9 | 135 | }).select2('data', prepopulate); |
cac1236c | 136 | } |
6a7a32b9 CW |
137 | |
138 | {/literal} | |
139 | var toContact = {if $toContact}{$toContact}{else}''{/if}, | |
140 | ccContact = {if $ccContact}{$ccContact}{else}''{/if}, | |
141 | bccContact = {if $bccContact}{$bccContact}{else}''{/if}; | |
142 | {literal} | |
a03d5ab9 M |
143 | emailSelect('#to', toContact); |
144 | emailSelect('#cc_id', ccContact); | |
145 | emailSelect('#bcc_id', bccContact); | |
cac1236c M |
146 | }); |
147 | ||
6a488035 | 148 | |
6a488035 TO |
149 | </script> |
150 | {/literal} |