ScheduledReminder, Extensions, Cxn - Fix copy-pasted header
[civicrm-core.git] / templates / CRM / Admin / Form / ScheduleReminders.tpl
1 {*
2 +--------------------------------------------------------------------+
3 | CiviCRM version 4.6 |
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 {* This template is used for adding/scheduling reminders. *}
27 <div class="crm-block crm-form-block crm-scheduleReminder-form-block">
28 <div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="top"}</div>
29
30 {if $action eq 8}
31 <div class="messages status no-popup">
32 <div class="icon inform-icon"></div>
33 {ts 1=$reminderName}WARNING: You are about to delete the Reminder titled <strong>%1</strong>.{/ts} {ts}Do you want to continue?{/ts}
34 </div>
35 {else}
36 <table class="form-layout-compressed">
37 <tr class="crm-scheduleReminder-form-block-title">
38 <td class="right">{$form.title.label}</td><td colspan="3">{$form.title.html}</td>
39 </tr>
40 <tr>
41 <td class="label">{$form.entity.label}</td>
42 <td>{$form.entity.html}</td>
43 </tr>
44
45 <tr class="crm-scheduleReminder-form-block-when">
46 <td class="right">{$form.start_action_offset.label}</td>
47 <td colspan="3">{include file="CRM/common/jcalendar.tpl" elementName=absolute_date} <strong id='OR'>OR</strong><br /></td>
48 </tr>
49
50 <tr id="relativeDate" class="crm-scheduleReminder-form-block-description">
51 <td class="right"></td>
52 <td colspan="3">{$form.start_action_offset.html}&nbsp;&nbsp;&nbsp;{$form.start_action_unit.html}&nbsp;&nbsp;&nbsp;{$form.start_action_condition.html}&nbsp;&nbsp;&nbsp;{$form.start_action_date.html}</td>
53 </tr>
54 <tr id="recordActivity" class="crm-scheduleReminder-form-block-record_activity"><td class="label" width="20%">{$form.record_activity.label}</td>
55 <td>{$form.record_activity.html}</td>
56 </tr>
57 <tr id="relativeDateRepeat" class="crm-scheduleReminder-form-block-is_repeat"><td class="label" width="20%">{$form.is_repeat.label}</td>
58 <td>{$form.is_repeat.html}&nbsp;&nbsp;<span class="description">{ts}Enable repetition.{/ts}</span></td>
59 </tr>
60 <tr id="repeatFields" class="crm-scheduleReminder-form-block-repeatFields"><td></td><td>
61 <table class="form-layout-compressed">
62 <tr class="crm-scheduleReminder-form-block-repetition_frequency_interval">
63 <td class="label">{$form.repetition_frequency_interval.label}&nbsp;&nbsp;&nbsp;{$form.repetition_frequency_interval.html}</td>
64 <td>{$form.repetition_frequency_unit.html}</td>
65 </tr>
66 <tr class="crm-scheduleReminder-form-block-repetition_frequency_interval">
67 <td class="label">{$form.end_frequency_interval.label}&nbsp;&nbsp;&nbsp;{$form.end_frequency_interval.html}
68 <td>{$form.end_frequency_unit.html}&nbsp;&nbsp;&nbsp;{$form.end_action.html}&nbsp;&nbsp;&nbsp;{$form.end_date.html}</td>
69 </tr>
70 </table>
71 </td>
72 </tr>
73 <tr>
74 <td class="label" width="20%">{$form.from_name.label}</td>
75 <td>{$form.from_name.html}&nbsp;&nbsp;{help id="id-from_name_email"}</td>
76 </tr>
77 <tr>
78 <td class="label" width="20%">{$form.from_email.label}</td>
79 <td>{$form.from_email.html}&nbsp;&nbsp;</td>
80 </tr>
81 <tr class="crm-scheduleReminder-form-block-recipient">
82 <td id="recipientLabel" class="right">{$form.recipient.label}</td><td colspan="3">{$form.limit_to.html}&nbsp;{help id="limit_to" class="limit_to" title=$form.recipient.label}{$form.recipient.html}&nbsp;{help id="recipient" class="recipient" title=$recipientLabels.activity}</td>
83 </tr>
84 <tr id="recipientList" class="crm-scheduleReminder-form-block-recipientListing recipient">
85 <td class="right">{$form.recipient_listing.label}</td><td colspan="3">{$form.recipient_listing.html}</td>
86 </tr>
87 <tr id="recipientManual" class="crm-scheduleReminder-form-block-recipient_manual_id recipient">
88 <td class="label">{$form.recipient_manual_id.label}</td>
89 <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>
90 </tr>
91
92 <tr id="recipientGroup" class="crm-scheduleReminder-form-block-recipient_group_id recipient">
93 <td class="label">{$form.group_id.label}</td>
94 <td>{$form.group_id.html}</td>
95 </tr>
96 <tr id="msgMode" class="crm-scheduleReminder-form-block-mode">
97 <td class="label">{$form.mode.label}</td>
98 <td>{$form.mode.html}</td>
99 </tr>
100 <tr class="crm-scheduleReminder-form-block-active">
101 <td class="label"></td>
102 <td>{$form.is_active.html}&nbsp;{$form.is_active.label}</td>
103 </tr>
104 </table>
105 <fieldset id="email" class="crm-collapsible" style="display: block;">
106 <legend class="collapsible-title">{ts}Email Screen{/ts}</legend>
107 <div>
108 <table id="email-field-table" class="form-layout-compressed">
109 <tr class="crm-scheduleReminder-form-block-template">
110 <td class="label">{$form.template.label}</td>
111 <td>{$form.template.html}</td>
112 </tr>
113 <tr class="crm-scheduleReminder-form-block-subject">
114 <td class="label">{$form.subject.label}</td>
115 <td>{$form.subject.html}</td>
116 </tr>
117 </table>
118 {include file="CRM/Contact/Form/Task/EmailCommon.tpl" upload=1 noAttach=1}
119 </div>
120 </fieldset>
121 {if $sms}
122 <fieldset id="sms" class="crm-collapsible"><legend class="collapsible-title">{ts}SMS Screen{/ts}</legend>
123 <div>
124 <table id="sms-field-table" class="form-layout-compressed">
125 <tr id="smsProvider" class="crm-scheduleReminder-form-block-sms_provider_id">
126 <td class="label">{$form.sms_provider_id.label}</td>
127 <td>{$form.sms_provider_id.html}</td>
128 </tr>
129 <tr class="crm-scheduleReminder-form-block-sms-template">
130 <td class="label">{$form.SMStemplate.label}</td>
131 <td>{$form.SMStemplate.html}</td>
132 </tr>
133 </table>
134 {include file="CRM/Contact/Form/Task/SMSCommon.tpl" upload=1 noAttach=1}
135 <div>
136 </fieldset>
137 {/if}
138
139 {include file="CRM/common/showHideByFieldValue.tpl"
140 trigger_field_id = "is_repeat"
141 trigger_value = "true"
142 target_element_id = "repeatFields"
143 target_element_type = "table-row"
144 field_type = "radio"
145 invert = "false"
146 }
147
148 {include file="CRM/common/showHideByFieldValue.tpl"
149 trigger_field_id ="recipient"
150 trigger_value = 'manual'
151 target_element_id ="recipientManual"
152 target_element_type ="table-row"
153 field_type ="select"
154 invert = 0
155 }
156
157 {include file="CRM/common/showHideByFieldValue.tpl"
158 trigger_field_id ="recipient"
159 trigger_value = 'group'
160 target_element_id ="recipientGroup"
161 target_element_type ="table-row"
162 field_type ="select"
163 invert = 0
164 }
165
166 {literal}
167 <script type='text/javascript'>
168 CRM.$(function($) {
169 var $form = $('form.{/literal}{$form.formClass}{literal}'),
170 recipientMapping = eval({/literal}{$recipientMapping}{literal});
171
172 $('#absolute_date_display', $form).change(function() {
173 if($(this).val()) {
174 $('#relativeDate, #relativeDateRepeat, #repeatFields, #OR', $form).hide();
175 } else {
176 $('#relativeDate, #relativeDateRepeat, #OR', $form).show();
177 }
178 });
179 if ($('#absolute_date_display', $form).val()) {
180 $('#relativeDate, #relativeDateRepeat, #repeatFields, #OR', $form).hide();
181 }
182
183 loadMsgBox();
184 $('#mode', $form).change(loadMsgBox);
185
186 function populateRecipient() {
187 var recipient = $("#recipient", $form).val();
188 if ((recipientMapping[recipient] == 'Participant Status' || recipientMapping[recipient] == 'participant_role') && $('#limit_to').val() != '') {
189 CRM.api3('participant', 'getoptions', {field: recipientMapping[recipient] == 'participant_role' ? 'role_id' : 'status_id', sequential: 1})
190 .done(function(result) {
191 CRM.utils.setOptions($('#recipient_listing', $form), result.values);
192 });
193 $("#recipientList", $form).show();
194 }
195 else {
196 $("#recipientList", $form).hide();
197 }
198
199 showHideLimitTo();
200 }
201
202 // CRM-14070 Hide limit-to when entity is activity
203 function showHideLimitTo() {
204 $('#limit_to', $form).toggle(!($('#entity_0', $form).val() == '1'));
205 if ($('#entity_0', $form).val() != '1' || !($('#entity_0').length)) {
206 if ($('#limit_to', $form).val() == '') {
207 $('tr.recipient:visible, #recipientList, #recipient, a.recipient').hide();
208 $('a.limit_to').show();
209 }
210 else {
211 $('a.limit_to, a.recipient').show();
212 $('#recipient').css("margin-left", "12px");
213 }
214 $("label[for='recipient']").text('{/literal}{$recipientLabels.other}{literal}');
215 }
216 else {
217 $('#recipient, a.recipient').show()
218 $('#recipient').css("margin-left", "-2px");
219 $('a.limit_to').hide();
220 $("label[for='recipient']").text('{/literal}{$recipientLabels.activity}{literal}');
221 }
222 }
223
224 $('#recipient', $form).change(populateRecipient);
225
226 {/literal}{if !$context}{literal}
227 var entity = $('#entity_0', $form).val();
228 if (!(entity === '2' || entity === '3')) {
229 $('#recipientList', $form).hide();
230 }
231
232 $('#entity_0, #limit_to', $form).change(buildSelects);
233
234 buildSelects();
235
236 function buildSelects() {
237 var mappingID = $('#entity_0', $form).val();
238 var isLimit = $('#limit_to', $form).val();
239
240 $.getJSON(CRM.url('civicrm/ajax/mapping'), {mappingID: mappingID, isLimit: isLimit},
241 function (result) {
242 CRM.utils.setOptions($('#start_action_date', $form), result.sel4);
243 CRM.utils.setOptions($('#end_date', $form), result.sel4);
244 CRM.utils.setOptions($('#recipient', $form), result.sel5);
245 recipientMapping = result.recipientMapping;
246 populateRecipient();
247 }
248 );
249 }
250 {/literal}{else}{literal}
251 populateRecipient();
252 $('#limit_to', $form).change(populateRecipient);
253 {/literal}{/if}{literal}
254
255 function loadMsgBox() {
256 if (cj('#mode').val() == 'Email' || cj('#mode').val() == 0){
257 cj('#sms').hide();
258 cj('#email').show();
259 }
260 else if (cj('#mode').val() == 'SMS'){
261 cj('#email').hide();
262 cj('#sms').show();
263 showSaveUpdateChkBox('SMS');
264 }
265 else if (cj('#mode').val() == 'User_Preference'){
266 cj('#email').show();
267 cj('#sms').show();
268 showSaveUpdateChkBox('SMS');
269 }
270 }
271
272 });
273 </script>
274 {/literal}
275
276 {/if}
277
278 <div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="bottom"}</div>
279 </div>