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> | |
40 | <td>{$form.to.html}{if $noEmails eq true} {$form.emailAddress.html}{/if} | |
41 | <div class="spacer"></div> | |
42 | <span class="bold"><a href="#" id="addcc">{ts}Add CC{/ts}</a> | <a href="#" id="addbcc">{ts}Add BCC{/ts}</a></span> | |
43 | </td> | |
44 | </tr> | |
45 | <tr class="crm-contactEmail-form-block-cc_id" id="cc" {if ! $form.cc_id.value}style="display:none;"{/if}> | |
46 | <td class="label">{$form.cc_id.label}</td><td>{$form.cc_id.html}</td> | |
47 | </tr> | |
48 | <tr class="crm-contactEmail-form-block-bcc_id" id="bcc" {if ! $form.bcc_id.value}style="display:none;"{/if}> | |
49 | <td class="label">{$form.bcc_id.label}</td><td>{$form.bcc_id.html}</td> | |
50 | </tr> | |
51 | ||
52 | {if $emailTask} | |
53 | <tr class="crm-contactEmail-form-block-template"> | |
54 | <td class="label">{$form.template.label}</td> | |
55 | <td>{$form.template.html}</td> | |
56 | </tr> | |
57 | {/if} | |
58 | <tr class="crm-contactEmail-form-block-subject"> | |
59 | <td class="label">{$form.subject.label}</td> | |
ac0a3db5 CW |
60 | <td> |
61 | {$form.subject.html|crmAddClass:huge} | |
62 | <input class="crm-token-selector big" data-field="subject" /> | |
63 | {help id="id-token-subject" tplFile=$tplFile isAdmin=$isAdmin file="CRM/Contact/Form/Task/Email.hlp"} | |
6a488035 TO |
64 | </td> |
65 | </tr> | |
66 | </table> | |
67 | ||
68 | {include file="CRM/Contact/Form/Task/EmailCommon.tpl"} | |
69 | ||
70 | <div class="spacer"> </div> | |
71 | ||
72 | {if $single eq false} | |
73 | {include file="CRM/Contact/Form/Task.tpl"} | |
74 | {/if} | |
75 | {if $suppressedEmails > 0} | |
76 | {ts count=$suppressedEmails plural='Email will NOT be sent to %count contacts.'}Email will NOT be sent to %count contact.{/ts} | |
77 | {/if} | |
78 | <div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="bottom"}</div> | |
79 | </div> | |
80 | <script type="text/javascript"> | |
81 | var toContact = ccContact = bccContact = ''; | |
82 | ||
83 | {if $toContact} | |
84 | toContact = {$toContact}; | |
85 | {/if} | |
86 | ||
87 | {if $ccContact} | |
88 | ccContact = {$ccContact}; | |
89 | {/if} | |
90 | ||
91 | {if $bccContact} | |
92 | bccContact = {$bccContact}; | |
93 | {/if} | |
94 | ||
95 | {literal} | |
cac1236c | 96 | CRM.$(function($){ |
7ba7f3a0 | 97 | cj('#addcc').toggleClick( function() { cj(this).text('Remove CC'); |
6a488035 TO |
98 | cj('tr#cc').show().find('ul').find('input').focus(); |
99 | },function() { cj(this).text('Add CC');cj('#cc_id').val(''); | |
100 | cj('tr#cc ul li:not(:last)').remove();cj('#cc').hide(); | |
101 | }); | |
7ba7f3a0 | 102 | cj('#addbcc').toggleClick( function() { cj(this).text('Remove BCC'); |
6a488035 TO |
103 | cj('tr#bcc').show().find('ul').find('input').focus(); |
104 | },function() { cj(this).text('Add BCC');cj('#bcc_id').val(''); | |
105 | cj('tr#bcc ul li:not(:last)').remove();cj('#bcc').hide(); | |
106 | }); | |
107 | ||
cac1236c M |
108 | var sourceDataUrl = "{/literal}{crmURL p='civicrm/ajax/checkemail' q='id=1' h=0 }{literal}"; |
109 | ||
a03d5ab9 | 110 | function emailSelect(el, prepopulate){ |
cac1236c M |
111 | $(el).data('api-entity', 'contact').crmSelect2({ |
112 | minimumInputLength: 1, | |
113 | multiple: true, | |
114 | ajax: { | |
115 | url: sourceDataUrl, | |
116 | data: function(term) { | |
117 | return { | |
118 | name: term, | |
119 | }; | |
120 | }, | |
121 | results: function(response) { | |
122 | return { | |
123 | results: response, | |
124 | }; | |
125 | } | |
126 | } | |
a03d5ab9 | 127 | }).select2('data', prepopulate); |
cac1236c | 128 | } |
a03d5ab9 M |
129 | emailSelect('#to', toContact); |
130 | emailSelect('#cc_id', ccContact); | |
131 | emailSelect('#bcc_id', bccContact); | |
cac1236c M |
132 | }); |
133 | ||
6a488035 | 134 | |
6a488035 TO |
135 | </script> |
136 | {/literal} |