Commit | Line | Data |
---|---|---|
6a488035 TO |
1 | {* |
2 | +--------------------------------------------------------------------+ | |
3 | | CiviCRM version 4.3 | | |
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-event-manage-scheduleReminder-form-block"> | |
29 | ||
30 | {if $rows} | |
31 | <div id="reminder"> | |
32 | {include file="CRM/Admin/Page/Reminders.tpl"} | |
33 | ||
34 | <div class="action-link"> | |
35 | <a href="{crmURL q="action=update&reset=1&id=$eventId&new=1"}" id="newScheduleReminder" class="button"><span><div class="icon add-icon"></div>{ts}Add Reminder{/ts}</span></a> | |
36 | </div> | |
37 | </div> | |
38 | ||
39 | {else} | |
40 | ||
41 | <div class="crm-submit-buttons"> | |
42 | {include file="CRM/common/formButtons.tpl" location="top"} | |
43 | </div> | |
44 | {if $action eq 8} | |
45 | <div class="messages status no-popup"> | |
46 | <div class="icon inform-icon"></div> | |
47 | {ts 1=$reminderName}WARNING: You are about to delete the Reminder titled <strong>%1</strong>.{/ts} {ts}Do you want to continue?{/ts} | |
48 | </div> | |
49 | {else} | |
50 | {* added onload javascript for source contact*} | |
51 | {literal} | |
52 | <script type="text/javascript"> | |
53 | var recipient_manual = ''; | |
54 | var recipient_manual_id = null; | |
55 | var toDataUrl = "{/literal}{crmURL p='civicrm/ajax/checkemail' q='id=1&noemail=1' h=0 }{literal}"; {/literal} | |
56 | ||
57 | {if $recipients} | |
58 | {foreach from=$recipients key=id item=name} | |
59 | {literal} recipient_manual += '{"name":"'+{/literal}"{$name}"{literal}+'","id":"'+{/literal}"{$id}"{literal}+'"},';{/literal} | |
60 | {/foreach} | |
61 | {literal} eval( 'recipient_manual = [' + recipient_manual + ']'); {/literal} | |
62 | {/if} | |
63 | ||
64 | {literal} | |
65 | if ( recipient_manual_id ) { | |
66 | eval( 'recipient_manual = ' + recipient_manual_id ); | |
67 | } | |
68 | ||
69 | cj(document).ready( function( ) { | |
70 | {/literal} | |
71 | {literal} | |
72 | ||
73 | eval( 'tokenClass = { tokenList: "token-input-list-facebook", token: "token-input-token-facebook", tokenDelete: "token-input-delete-token-facebook", selectedToken: "token-input-selected-token-facebook", highlightedToken: "token-input-highlighted-token-facebook", dropdown: "token-input-dropdown-facebook", dropdownItem: "token-input-dropdown-item-facebook", dropdownItem2: "token-input-dropdown-item2-facebook", selectedDropdownItem: "token-input-selected-dropdown-item-facebook", inputToken: "token-input-input-token-facebook" } '); | |
74 | ||
75 | var sourceDataUrl = "{/literal}{$dataUrl}{literal}"; | |
76 | var tokenDataUrl = "{/literal}{$tokenUrl}{literal}"; | |
77 | var hintText = "{/literal}{ts escape='js'}Type in a partial or complete name of an existing recipient.{/ts}{literal}"; | |
78 | cj( "#recipient_manual_id").tokenInput( tokenDataUrl, { prePopulate: recipient_manual, classes: tokenClass, hintText: hintText }); | |
79 | cj( 'ul.token-input-list-facebook, div.token-input-dropdown-facebook' ).css( 'width', '450px' ); | |
80 | cj('#source_contact_id').autocomplete( sourceDataUrl, { width : 180, selectFirst : false, hintText: hintText, matchContains: true, minChars: 1 | |
81 | }).result( function(event, data, formatted) { | |
82 | }).bind( 'click', function( ) { }); | |
83 | }); | |
84 | </script> | |
85 | {/literal} | |
86 | <table class="form-layout-compressed"> | |
87 | <tr class="crm-scheduleReminder-form-block-title"> | |
88 | <td class="right">{$form.title.label}</td><td colspan="3">{$form.title.html}</td> | |
89 | </tr> | |
90 | <tr> | |
91 | <td class="label">{$form.entity.label}</td> | |
92 | <td>{$form.entity.html}</td> | |
93 | </tr> | |
94 | <tr class="crm-scheduleReminder-form-block-when"> | |
95 | <td class="right">{$form.start_action_offset.label}</td> | |
96 | <td colspan="3">{include file="CRM/common/jcalendar.tpl" elementName=absolute_date} <strong>{ts}OR{/ts}</strong><br /></td> | |
97 | </tr> | |
98 | <tr id="relativeDate" class="crm-scheduleReminder-form-block-description"> | |
99 | <td class="right"></td> | |
100 | <td colspan="3">{$form.start_action_offset.html} {$form.start_action_unit.html} {$form.start_action_condition.html} {$form.start_action_date.html}</td> | |
101 | </tr> | |
102 | <tr id="recordActivity" class="crm-scheduleReminder-form-block-record_activity"> | |
103 | <td class="label" width="20%">{$form.record_activity.label}</td> | |
104 | <td>{$form.record_activity.html}</td> | |
105 | </tr> | |
106 | <tr id="relativeDateRepeat" class="crm-scheduleReminder-form-block-is_repeat"><td class="label" width="20%">{$form.is_repeat.label}</td> | |
107 | <td>{$form.is_repeat.html} <span class="description">{ts}Enable repetition.{/ts}</span></td> | |
108 | </tr> | |
109 | <tr id="repeatFields" class="crm-scheduleReminder-form-block-repeatFields"> | |
110 | <td></td> | |
111 | <td> | |
112 | <table class="form-layout-compressed"> | |
113 | <tr class="crm-scheduleReminder-form-block-repetition_frequency_interval"> | |
114 | <td class="label">{$form.repetition_frequency_interval.label} {$form.repetition_frequency_interval.html}</td> | |
115 | <td>{$form.repetition_frequency_unit.html}</td> | |
116 | </tr> | |
117 | <tr class="crm-scheduleReminder-form-block-repetition_frequency_interval"> | |
118 | <td class="label">{$form.end_frequency_interval.label} {$form.end_frequency_interval.html} | |
119 | <td>{$form.end_frequency_unit.html} {$form.end_action.html} {$form.end_date.html}</td> | |
120 | </tr> | |
121 | </table> | |
122 | </td> | |
123 | </tr> | |
124 | <tr class="crm-scheduleReminder-form-block-recipient"> | |
125 | <td class="right">{$form.recipient.label}</td><td colspan="3">{$form.recipient.html}</td> | |
126 | </tr> | |
127 | <tr id="recipientList" class="crm-scheduleReminder-form-block-recipientListing"> | |
128 | <td class="right">{$form.recipient_listing.label}</td><td colspan="3">{$form.recipient_listing.html}</td> | |
129 | </tr> | |
130 | <tr id="recipientManual" class="crm-scheduleReminder-form-block-recipient_manual_id"> | |
131 | <td class="label">{$form.recipient_manual_id.label}</td> | |
132 | <td>{$form.recipient_manual_id.html}{edit}<span class="description">{ts}You can manually send out the reminders to these recipients.{/ts}</span>{/edit}</td> | |
133 | </tr> | |
134 | <tr id="recipientGroup" class="crm-scheduleReminder-form-block-recipient_group_id"> | |
135 | <td class="label">{$form.group_id.label}</td> | |
136 | <td>{$form.group_id.html}</td> | |
137 | </tr> | |
138 | ||
139 | </table> | |
140 | <fieldset id="compose_id"><legend>{ts}Email{/ts}</legend> | |
141 | <table id="email-field-table" class="form-layout-compressed"> | |
142 | <tr class="crm-scheduleReminder-form-block-active"> | |
143 | <td class="label"></td> | |
144 | <td>{$form.is_active.html} {$form.is_active.label}</td> | |
145 | </tr> | |
146 | <tr class="crm-scheduleReminder-form-block-template"> | |
147 | <td class="label">{$form.template.label}</td> | |
148 | <td>{$form.template.html}</td> | |
149 | </tr> | |
150 | <tr class="crm-scheduleReminder-form-block-subject"> | |
151 | <td class="label">{$form.subject.label}</td> | |
152 | <td>{$form.subject.html}</td> | |
153 | </tr> | |
154 | </table> | |
155 | {include file="CRM/Contact/Form/Task/EmailCommon.tpl" upload=1 noAttach=1} | |
156 | </fieldset> | |
157 | {/if} | |
158 | ||
159 | <div class="crm-submit-buttons"> | |
160 | {include file="CRM/common/formButtons.tpl" location="bottom"}</div> | |
161 | </div> | |
162 | {/if} | |
163 | {include file="CRM/common/showHideByFieldValue.tpl" | |
164 | trigger_field_id = "is_repeat" | |
165 | trigger_value = "true" | |
166 | target_element_id = "repeatFields" | |
167 | target_element_type = "table-row" | |
168 | field_type = "radio" | |
169 | invert = "false" | |
170 | } | |
171 | ||
172 | {include file="CRM/common/showHideByFieldValue.tpl" | |
173 | trigger_field_id ="recipient" | |
174 | trigger_value = 'manual' | |
175 | target_element_id ="recipientManual" | |
176 | target_element_type ="table-row" | |
177 | field_type ="select" | |
178 | invert = 0 | |
179 | } | |
180 | ||
181 | {include file="CRM/common/showHideByFieldValue.tpl" | |
182 | trigger_field_id ="recipient" | |
183 | trigger_value = 'group' | |
184 | target_element_id ="recipientGroup" | |
185 | target_element_type ="table-row" | |
186 | field_type ="select" | |
187 | invert = 0 | |
188 | } | |
189 | ||
190 | {literal} | |
191 | <script type='text/javascript'> | |
192 | cj(function() { | |
193 | populateRecipient(); | |
194 | cj('#recipient').click( function( ) { | |
195 | populateRecipient(); | |
196 | }); | |
197 | }); | |
198 | ||
199 | function populateRecipient( ) { | |
200 | var recipient = cj("#recipient option:selected").text(); | |
201 | var postUrl = "{/literal}{crmURL p='civicrm/ajax/populateRecipient' h=0}{literal}"; | |
202 | if(recipient == 'Participant Status' || recipient == 'Participant Role'){ | |
203 | var elementID = '#recipient_listing'; | |
204 | cj( elementID ).html(''); | |
205 | cj.post(postUrl, {recipient: recipient}, | |
206 | function ( response ) { | |
207 | response = eval( response ); | |
208 | for (iota = 0; iota < response.length; iota++) { | |
209 | cj( elementID ).get(0).add(new Option(response[iota].name, response[iota].value), document.all ? iota : null); | |
210 | } | |
211 | } | |
212 | ); | |
213 | cj("#recipientList").show(); | |
214 | } else { | |
215 | cj("#recipientList").hide(); | |
216 | } | |
217 | } | |
218 | ||
219 | cj('#absolute_date_display').click( function( ) { | |
220 | if(cj('#absolute_date_display').val()) { | |
221 | cj('#relativeDate').hide(); | |
222 | cj('#relativeDateRepeat').hide(); | |
223 | cj('#repeatFields').hide(); | |
224 | } else { | |
225 | cj('#relativeDate').show(); | |
226 | cj('#relativeDateRepeat').show(); | |
227 | } | |
228 | }); | |
229 | ||
230 | </script> | |
231 | {/literal} | |
232 |