Commit | Line | Data |
---|---|---|
6a488035 TO |
1 | {* |
2 | +--------------------------------------------------------------------+ | |
39de6fd5 | 3 | | CiviCRM version 4.6 | |
6a488035 TO |
4 | +--------------------------------------------------------------------+ |
5 | | Copyright (C) 2011 Marty Wright | | |
6 | | Licensed to CiviCRM under the Academic Free License version 3.0. | | |
7 | +--------------------------------------------------------------------+ | |
8 | | This file is a part of CiviCRM. | | |
9 | | | | |
10 | | CiviCRM is free software; you can copy, modify, and distribute it | | |
11 | | under the terms of the GNU Affero General Public License | | |
12 | | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. | | |
13 | | | | |
14 | | CiviCRM is distributed in the hope that it will be useful, but | | |
15 | | WITHOUT ANY WARRANTY; without even the implied warranty of | | |
16 | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | | |
17 | | See the GNU Affero General Public License for more details. | | |
18 | | | | |
19 | | You should have received a copy of the GNU Affero General Public | | |
20 | | License and the CiviCRM Licensing Exception along | | |
21 | | with this program; if not, contact CiviCRM LLC | | |
22 | | at info[AT]civicrm[DOT]org. If you have questions about the | | |
23 | | GNU Affero General Public License or the licensing of CiviCRM, | | |
24 | | see the CiviCRM license FAQ at http://civicrm.org/licensing | | |
25 | +--------------------------------------------------------------------+ | |
26 | *} | |
27 | {* This template is used for adding/scheduling reminders. *} | |
28 | <div class="crm-block crm-form-block crm-scheduleReminder-form-block"> | |
29 | <div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="top"}</div> | |
30 | ||
31 | {if $action eq 8} | |
32 | <div class="messages status no-popup"> | |
33 | <div class="icon inform-icon"></div> | |
34 | {ts 1=$reminderName}WARNING: You are about to delete the Reminder titled <strong>%1</strong>.{/ts} {ts}Do you want to continue?{/ts} | |
35 | </div> | |
36 | {else} | |
6a488035 TO |
37 | <table class="form-layout-compressed"> |
38 | <tr class="crm-scheduleReminder-form-block-title"> | |
39 | <td class="right">{$form.title.label}</td><td colspan="3">{$form.title.html}</td> | |
40 | </tr> | |
41 | <tr> | |
42 | <td class="label">{$form.entity.label}</td> | |
43 | <td>{$form.entity.html}</td> | |
44 | </tr> | |
45 | ||
46 | <tr class="crm-scheduleReminder-form-block-when"> | |
47 | <td class="right">{$form.start_action_offset.label}</td> | |
49d61c3a | 48 | <td colspan="3">{include file="CRM/common/jcalendar.tpl" elementName=absolute_date} <strong id='OR'>OR</strong><br /></td> |
6a488035 TO |
49 | </tr> |
50 | ||
51 | <tr id="relativeDate" class="crm-scheduleReminder-form-block-description"> | |
52 | <td class="right"></td> | |
53 | <td colspan="3">{$form.start_action_offset.html} {$form.start_action_unit.html} {$form.start_action_condition.html} {$form.start_action_date.html}</td> | |
54 | </tr> | |
1e035d58 | 55 | <tr id="recordActivity" class="crm-scheduleReminder-form-block-record_activity"><td class="label" width="20%">{$form.record_activity.label}</td> |
56 | <td>{$form.record_activity.html}</td> | |
57 | </tr> | |
6a488035 TO |
58 | <tr id="relativeDateRepeat" class="crm-scheduleReminder-form-block-is_repeat"><td class="label" width="20%">{$form.is_repeat.label}</td> |
59 | <td>{$form.is_repeat.html} <span class="description">{ts}Enable repetition.{/ts}</span></td> | |
60 | </tr> | |
61 | <tr id="repeatFields" class="crm-scheduleReminder-form-block-repeatFields"><td></td><td> | |
62 | <table class="form-layout-compressed"> | |
63 | <tr class="crm-scheduleReminder-form-block-repetition_frequency_interval"> | |
64 | <td class="label">{$form.repetition_frequency_interval.label} {$form.repetition_frequency_interval.html}</td> | |
edc51caa | 65 | <td>{$form.repetition_frequency_unit.html}</td> |
6a488035 TO |
66 | </tr> |
67 | <tr class="crm-scheduleReminder-form-block-repetition_frequency_interval"> | |
68 | <td class="label">{$form.end_frequency_interval.label} {$form.end_frequency_interval.html} | |
edc51caa | 69 | <td>{$form.end_frequency_unit.html} {$form.end_action.html} {$form.end_date.html}</td> |
6a488035 TO |
70 | </tr> |
71 | </table> | |
72 | </td> | |
73 | </tr> | |
1991bba1 DG |
74 | <tr> |
75 | <td class="label" width="20%">{$form.from_name.label}</td> | |
76 | <td>{$form.from_name.html} {help id="id-from_name_email"}</td> | |
77 | </tr> | |
78 | <tr> | |
79 | <td class="label" width="20%">{$form.from_email.label}</td> | |
80 | <td>{$form.from_email.html} </td> | |
81 | </tr> | |
6a488035 | 82 | <tr class="crm-scheduleReminder-form-block-recipient"> |
1bf65b67 | 83 | <td id="recipientLabel" class="right">{$form.recipient.label}</td><td colspan="3">{$form.limit_to.html} {help id="limit_to" class="limit_to" title=$form.recipient.label}{$form.recipient.html} {help id="recipient" class="recipient" title=$recipientLabels.activity}</td> |
6a488035 | 84 | </tr> |
84a3e359 | 85 | <tr id="recipientList" class="crm-scheduleReminder-form-block-recipientListing recipient"> |
6a488035 TO |
86 | <td class="right">{$form.recipient_listing.label}</td><td colspan="3">{$form.recipient_listing.html}</td> |
87 | </tr> | |
84a3e359 | 88 | <tr id="recipientManual" class="crm-scheduleReminder-form-block-recipient_manual_id recipient"> |
6a488035 | 89 | <td class="label">{$form.recipient_manual_id.label}</td> |
92f4a0b1 | 90 | <td>{$form.recipient_manual_id.html}{edit}<div class="description">{ts}You can manually send out the reminders to these recipients.{/ts}</div>{/edit}</td> |
6a488035 TO |
91 | </tr> |
92 | ||
84a3e359 | 93 | <tr id="recipientGroup" class="crm-scheduleReminder-form-block-recipient_group_id recipient"> |
6a488035 TO |
94 | <td class="label">{$form.group_id.label}</td> |
95 | <td>{$form.group_id.html}</td> | |
96 | </tr> | |
a3e3eea1 | 97 | <tr id="msgMode" class="crm-scheduleReminder-form-block-mode"> |
98 | <td class="label">{$form.mode.label}</td> | |
99 | <td>{$form.mode.html}</td> | |
100 | </tr> | |
1e035d58 | 101 | <tr class="crm-scheduleReminder-form-block-active"> |
102 | <td class="label"></td> | |
103 | <td>{$form.is_active.html} {$form.is_active.label}</td> | |
a3e3eea1 | 104 | </tr> |
6a488035 | 105 | </table> |
1e035d58 | 106 | <fieldset id="email" class="crm-collapsible" style="display: block;"> |
107 | <legend class="collapsible-title">{ts}Email Screen{/ts}</legend> | |
108 | <div> | |
109 | <table id="email-field-table" class="form-layout-compressed"> | |
110 | <tr class="crm-scheduleReminder-form-block-template"> | |
6a488035 TO |
111 | <td class="label">{$form.template.label}</td> |
112 | <td>{$form.template.html}</td> | |
1e035d58 | 113 | </tr> |
114 | <tr class="crm-scheduleReminder-form-block-subject"> | |
6a488035 TO |
115 | <td class="label">{$form.subject.label}</td> |
116 | <td>{$form.subject.html}</td> | |
1e035d58 | 117 | </tr> |
118 | </table> | |
119 | {include file="CRM/Contact/Form/Task/EmailCommon.tpl" upload=1 noAttach=1} | |
120 | </div> | |
121 | </fieldset> | |
122 | {if $sms} | |
123 | <fieldset id="sms" class="crm-collapsible"><legend class="collapsible-title">{ts}SMS Screen{/ts}</legend> | |
124 | <div> | |
125 | <table id="sms-field-table" class="form-layout-compressed"> | |
126 | <tr id="smsProvider" class="crm-scheduleReminder-form-block-sms_provider_id"> | |
127 | <td class="label">{$form.sms_provider_id.label}</td> | |
128 | <td>{$form.sms_provider_id.html}</td> | |
129 | </tr> | |
130 | <tr class="crm-scheduleReminder-form-block-sms-template"> | |
131 | <td class="label">{$form.SMStemplate.label}</td> | |
132 | <td>{$form.SMStemplate.html}</td> | |
133 | </tr> | |
134 | </table> | |
135 | {include file="CRM/Contact/Form/Task/SMSCommon.tpl" upload=1 noAttach=1} | |
136 | <div> | |
6a488035 | 137 | </fieldset> |
1e035d58 | 138 | {/if} |
6a488035 | 139 | |
6a488035 TO |
140 | {include file="CRM/common/showHideByFieldValue.tpl" |
141 | trigger_field_id = "is_repeat" | |
142 | trigger_value = "true" | |
143 | target_element_id = "repeatFields" | |
144 | target_element_type = "table-row" | |
145 | field_type = "radio" | |
146 | invert = "false" | |
147 | } | |
148 | ||
149 | {include file="CRM/common/showHideByFieldValue.tpl" | |
150 | trigger_field_id ="recipient" | |
151 | trigger_value = 'manual' | |
152 | target_element_id ="recipientManual" | |
153 | target_element_type ="table-row" | |
154 | field_type ="select" | |
155 | invert = 0 | |
156 | } | |
157 | ||
158 | {include file="CRM/common/showHideByFieldValue.tpl" | |
159 | trigger_field_id ="recipient" | |
160 | trigger_value = 'group' | |
161 | target_element_id ="recipientGroup" | |
162 | target_element_type ="table-row" | |
163 | field_type ="select" | |
164 | invert = 0 | |
165 | } | |
166 | ||
167 | {literal} | |
4d3e4dbe | 168 | <script type='text/javascript'> |
ae8f569f | 169 | CRM.$(function($) { |
581c7be2 CW |
170 | var $form = $('form.{/literal}{$form.formClass}{literal}'), |
171 | recipientMapping = eval({/literal}{$recipientMapping}{literal}); | |
172 | ||
173 | $('#absolute_date_display', $form).change(function() { | |
174 | if($(this).val()) { | |
49d61c3a | 175 | $('#relativeDate, #relativeDateRepeat, #repeatFields, #OR', $form).hide(); |
6a488035 | 176 | } else { |
49d61c3a | 177 | $('#relativeDate, #relativeDateRepeat, #OR', $form).show(); |
6a488035 | 178 | } |
ae8f569f | 179 | }); |
581c7be2 | 180 | if ($('#absolute_date_display', $form).val()) { |
1bf65b67 | 181 | $('#relativeDate, #relativeDateRepeat, #repeatFields, #OR', $form).hide(); |
ae8f569f | 182 | } |
6a488035 | 183 | |
a3e3eea1 | 184 | loadMsgBox(); |
581c7be2 | 185 | $('#mode', $form).change(loadMsgBox); |
b439474a | 186 | |
581c7be2 CW |
187 | function populateRecipient() { |
188 | var recipient = $("#recipient", $form).val(); | |
84a3e359 | 189 | if ((recipientMapping[recipient] == 'Participant Status' || recipientMapping[recipient] == 'participant_role') && $('#limit_to').val() != '') { |
bcec4b42 CW |
190 | CRM.api3('participant', 'getoptions', {field: recipientMapping[recipient] == 'participant_role' ? 'role_id' : 'status_id', sequential: 1}) |
191 | .done(function(result) { | |
192 | CRM.utils.setOptions($('#recipient_listing', $form), result.values); | |
193 | }); | |
264ebe5d | 194 | $("#recipientList", $form).show(); |
581c7be2 | 195 | } |
4d3e4dbe | 196 | else { |
197 | $("#recipientList", $form).hide(); | |
198 | } | |
76a8cd55 | 199 | |
76a8cd55 | 200 | showHideLimitTo(); |
ae8f569f | 201 | } |
4d3e4dbe | 202 | |
fd4d98b5 CW |
203 | // CRM-14070 Hide limit-to when entity is activity |
204 | function showHideLimitTo() { | |
205 | $('#limit_to', $form).toggle(!($('#entity_0', $form).val() == '1')); | |
4d3e4dbe | 206 | if ($('#entity_0', $form).val() != '1' || !($('#entity_0').length)) { |
84a3e359 | 207 | if ($('#limit_to', $form).val() == '') { |
76a8cd55 | 208 | $('tr.recipient:visible, #recipientList, #recipient, a.recipient').hide(); |
209 | $('a.limit_to').show(); | |
1bf65b67 | 210 | } |
211 | else { | |
264ebe5d | 212 | $('a.limit_to, a.recipient').show(); |
76a8cd55 | 213 | $('#recipient').css("margin-left", "12px"); |
84a3e359 | 214 | } |
215 | $("label[for='recipient']").text('{/literal}{$recipientLabels.other}{literal}'); | |
216 | } | |
217 | else { | |
76a8cd55 | 218 | $('#recipient, a.recipient').show() |
7abf9f18 | 219 | $('#recipient').css("margin-left", "-2px"); |
1bf65b67 | 220 | $('a.limit_to').hide(); |
84a3e359 | 221 | $("label[for='recipient']").text('{/literal}{$recipientLabels.activity}{literal}'); |
222 | } | |
fd4d98b5 | 223 | } |
a3e3eea1 | 224 | |
4d3e4dbe | 225 | $('#recipient', $form).change(populateRecipient); |
226 | ||
227 | {/literal}{if !$context}{literal} | |
228 | var entity = $('#entity_0', $form).val(); | |
229 | if (!(entity === '2' || entity === '3')) { | |
230 | $('#recipientList', $form).hide(); | |
231 | } | |
232 | ||
233 | $('#entity_0, #limit_to', $form).change(buildSelects); | |
234 | ||
235 | buildSelects(); | |
236 | ||
237 | function buildSelects() { | |
238 | var mappingID = $('#entity_0', $form).val(); | |
dc3c81b1 | 239 | var isLimit = $('#limit_to', $form).val(); |
4d3e4dbe | 240 | |
dc3c81b1 | 241 | $.getJSON(CRM.url('civicrm/ajax/mapping'), {mappingID: mappingID, isLimit: isLimit}, |
4d3e4dbe | 242 | function (result) { |
243 | CRM.utils.setOptions($('#start_action_date', $form), result.sel4); | |
244 | CRM.utils.setOptions($('#end_date', $form), result.sel4); | |
245 | CRM.utils.setOptions($('#recipient', $form), result.sel5); | |
246 | recipientMapping = result.recipientMapping; | |
247 | populateRecipient(); | |
248 | } | |
249 | ); | |
250 | } | |
251 | {/literal}{else}{literal} | |
252 | populateRecipient(); | |
253 | $('#limit_to', $form).change(populateRecipient); | |
254 | {/literal}{/if}{literal} | |
255 | ||
256 | function loadMsgBox() { | |
257 | if (cj('#mode').val() == 'Email' || cj('#mode').val() == 0){ | |
258 | cj('#sms').hide(); | |
259 | cj('#email').show(); | |
260 | } | |
261 | else if (cj('#mode').val() == 'SMS'){ | |
262 | cj('#email').hide(); | |
263 | cj('#sms').show(); | |
264 | showSaveUpdateChkBox('SMS'); | |
265 | } | |
266 | else if (cj('#mode').val() == 'User_Preference'){ | |
267 | cj('#email').show(); | |
268 | cj('#sms').show(); | |
269 | showSaveUpdateChkBox('SMS'); | |
270 | } | |
a3e3eea1 | 271 | } |
a3e3eea1 | 272 | |
4d3e4dbe | 273 | }); |
274 | </script> | |
275 | {/literal} | |
4b628e67 CW |
276 | |
277 | {/if} | |
278 | ||
279 | <div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="bottom"}</div> | |
280 | </div> |