| 1 | {* |
| 2 | +--------------------------------------------------------------------+ |
| 3 | | CiviCRM version 4.7 | |
| 4 | +--------------------------------------------------------------------+ |
| 5 | | Copyright CiviCRM LLC (c) 2004-2015 | |
| 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> |
| 41 | {$form.to.html}{if $noEmails eq true} {$form.emailAddress.html}{/if} |
| 42 | </td> |
| 43 | </tr> |
| 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 ui-icon-close"></span></a> |
| 49 | </td> |
| 50 | </tr> |
| 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 ui-icon-close"></span></a> |
| 56 | </td> |
| 57 | </tr> |
| 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> |
| 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> |
| 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"} |
| 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"> |
| 97 | |
| 98 | {literal} |
| 99 | CRM.$(function($) { |
| 100 | var $form = $("form.{/literal}{$form.formClass}{literal}"); |
| 101 | |
| 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 | }); |
| 108 | |
| 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 | }); |
| 115 | |
| 116 | var sourceDataUrl = "{/literal}{crmURL p='civicrm/ajax/checkemail' q='id=1' h=0 }{literal}"; |
| 117 | |
| 118 | function emailSelect(el, prepopulate) { |
| 119 | $(el, $form).data('api-entity', 'contact').css({width: '40em', 'max-width': '90%'}).crmSelect2({ |
| 120 | minimumInputLength: 1, |
| 121 | multiple: true, |
| 122 | ajax: { |
| 123 | url: sourceDataUrl, |
| 124 | data: function(term) { |
| 125 | return { |
| 126 | name: term |
| 127 | }; |
| 128 | }, |
| 129 | results: function(response) { |
| 130 | return { |
| 131 | results: response |
| 132 | }; |
| 133 | } |
| 134 | } |
| 135 | }).select2('data', prepopulate); |
| 136 | } |
| 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} |
| 143 | emailSelect('#to', toContact); |
| 144 | emailSelect('#cc_id', ccContact); |
| 145 | emailSelect('#bcc_id', bccContact); |
| 146 | }); |
| 147 | |
| 148 | |
| 149 | </script> |
| 150 | {/literal} |