Commit | Line | Data |
---|---|---|
6a488035 TO |
1 | {* |
2 | +--------------------------------------------------------------------+ | |
232624b1 | 3 | | CiviCRM version 4.4 | |
6a488035 TO |
4 | +--------------------------------------------------------------------+ |
5 | | Copyright CiviCRM LLC (c) 2004-2013 | | |
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/editing other (custom) activities. *} | |
27 | {if $cdType } | |
28 | {include file="CRM/Custom/Form/CustomData.tpl"} | |
29 | {else} | |
30 | {if $action eq 4} | |
31 | <div class="crm-block crm-content-block crm-activity-view-block"> | |
32 | {else} | |
33 | {if $context NEQ 'standalone'} | |
da520b85 | 34 | <h3>{if $action eq 1 or $action eq 1024}{ts 1=$activityTypeName}New activity: %1{/ts}{elseif $action eq 8}{ts 1=$activityTypeName}Delete %1{/ts}{else}{ts 1=$activityTypeName}Edit %1{/ts}{/if}</h3> |
6a488035 TO |
35 | {/if} |
36 | {if $activityTypeDescription } | |
37 | <div class="help">{$activityTypeDescription}</div> | |
38 | {/if} | |
39 | <div class="crm-block crm-form-block crm-activity-form-block"> | |
40 | {/if} | |
41 | {* added onload javascript for source contact*} | |
42 | {literal} | |
43 | <script type="text/javascript"> | |
44 | var assignee_contact = ''; | |
45 | ||
46 | {/literal} | |
47 | {if $assignee_contact} | |
48 | var assignee_contact = {$assignee_contact}; | |
49 | {/if} | |
50 | {literal} | |
51 | ||
52 | //loop to set the value of cc and bcc if form rule. | |
53 | var assignee_contact_id = null; | |
54 | var toDataUrl = "{/literal}{crmURL p='civicrm/ajax/checkemail' q='id=1&noemail=1' h=0 }{literal}"; {/literal} | |
55 | {foreach from=","|explode:"assignee" key=key item=element} | |
56 | {assign var=currentElement value=`$element`_contact_id} | |
57 | {if $form.$currentElement.value } | |
58 | {literal} var {/literal}{$currentElement}{literal} = cj.ajax({ url: toDataUrl + "&cid={/literal}{$form.$currentElement.value}{literal}", async: false }).responseText;{/literal} | |
59 | {/if} | |
60 | {/foreach} | |
61 | {literal} | |
62 | ||
63 | if ( assignee_contact_id ) { | |
64 | eval( 'assignee_contact = ' + assignee_contact_id ); | |
65 | } | |
66 | ||
67 | cj(function( ) { | |
68 | {/literal} | |
69 | {if $source_contact and $admin and $action neq 4} | |
70 | {literal} cj( '#source_contact_id' ).val( "{/literal}{$source_contact}{literal}");{/literal} | |
71 | {/if} | |
72 | {literal} | |
73 | ||
74 | var sourceDataUrl = "{/literal}{$dataUrl}{literal}"; | |
75 | var tokenDataUrl_assignee = "{/literal}{$tokenUrl}&context=activity_assignee{literal}"; | |
76 | var hintText = "{/literal}{ts escape='js'}Type in a partial or complete name of an existing contact.{/ts}{literal}"; | |
77 | cj( "#assignee_contact_id").tokenInput( tokenDataUrl_assignee, { prePopulate: assignee_contact, theme: 'facebook', hintText: hintText }); | |
78 | cj( 'ul.token-input-list-facebook, div.token-input-dropdown-facebook' ).css( 'width', '450px' ); | |
401906c1 | 79 | cj('#source_contact_id').autocomplete( sourceDataUrl, { width : 180, selectFirst : false, hintText: hintText, matchContains: true, minChars: 1, max: {/literal}{crmSetting name="search_autocomplete_count" group="Search Preferences"}{literal} |
6a488035 TO |
80 | }).result( function(event, data, formatted) { cj( "#source_contact_qid" ).val( data[1] ); |
81 | }).bind( 'click', function( ) { cj( "#source_contact_qid" ).val(''); }); | |
82 | }); | |
83 | </script> | |
84 | ||
85 | {/literal} | |
86 | {if !$action or ( $action eq 1 ) or ( $action eq 2 ) } | |
87 | <div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="top"}</div> | |
88 | {/if} | |
89 | ||
90 | {if $action eq 8} {* Delete action. *} | |
91 | <table class="form-layout"> | |
92 | <tr> | |
93 | <td colspan="2"> | |
94 | <div class="status">{ts 1=$delName}Are you sure you want to delete '%1'?{/ts}</div> | |
95 | </td> | |
96 | </tr> | |
97 | {elseif $action eq 1 or $action eq 2 or $action eq 4 or $context eq 'search' or $context eq 'smog'} | |
98 | ||
99 | <table class="{if $action eq 4}crm-info-panel{else}form-layout{/if}"> | |
100 | ||
101 | {if $action eq 4} | |
102 | <h3>{$activityTypeName}</h3> | |
103 | {if $activityTypeDescription } | |
104 | <div class="help">{$activityTypeDescription}</div> | |
edc51caa | 105 | {/if} |
6a488035 TO |
106 | {else} |
107 | {if $context eq 'standalone' or $context eq 'search' or $context eq 'smog'} | |
108 | <tr class="crm-activity-form-block-activity_type_id"> | |
109 | <td class="label">{$form.activity_type_id.label}</td><td class="view-value">{$form.activity_type_id.html}</td> | |
110 | </tr> | |
111 | {/if} | |
112 | {/if} | |
113 | ||
114 | {if $surveyActivity} | |
115 | <tr class="crm-activity-form-block-survey"> | |
116 | <td class="label">{ts}Survey Title{/ts}</td><td class="view-value">{$surveyTitle}</td> | |
117 | </tr> | |
118 | {/if} | |
119 | ||
120 | <tr class="crm-activity-form-block-source_contact_id"> | |
121 | <td class="label">{$form.source_contact_id.label}</td> | |
122 | <td class="view-value"> | |
123 | {if $admin and $action neq 4}{$form.source_contact_id.html} {else} {$source_contact_value} {/if} | |
124 | </td> | |
125 | </tr> | |
126 | ||
127 | <tr class="crm-activity-form-block-target_contact_id"> | |
128 | {if $single eq false} | |
129 | <td class="label">{ts}With Contact(s){/ts}</td> | |
ef89f226 KJ |
130 | <td class="view-value" style="white-space: normal"> |
131 | {$with|escape} | |
132 | <br/> | |
0d4db96c | 133 | {$form.is_multi_activity.html} {$form.is_multi_activity.label} {help id="id-is_multi_activity"} |
ef89f226 | 134 | </td> |
6a488035 TO |
135 | {elseif $action neq 4} |
136 | <td class="label">{ts}With Contact{/ts}</td> | |
137 | <td class="view-value"> | |
138 | {include file="CRM/Contact/Form/NewContact.tpl" noLabel=true skipBreak=true multiClient=true} | |
52c7b3a2 KJ |
139 | {if $action eq 1} |
140 | <br/> | |
3efc2908 | 141 | {$form.is_multi_activity.html} {$form.is_multi_activity.label} {help id="id-is_multi_activity"} |
52c7b3a2 | 142 | {/if} |
6a488035 TO |
143 | </td> |
144 | {else} | |
145 | <td class="label">{ts}With Contact{/ts}</td> | |
146 | <td class="view-value" style="white-space: normal"> | |
147 | {foreach from=$target_contact key=id item=name} | |
148 | <a href="{crmURL p='civicrm/contact/view' q="reset=1&cid=$id"}">{$name}</a>; | |
149 | {/foreach} | |
150 | </td> | |
151 | {/if} | |
152 | </tr> | |
8ef12e64 | 153 | |
9285bb0f AH |
154 | {if $action neq 4} |
155 | <tr class="crm-activity-form-block-swap_target_assignee"> | |
156 | <td class="label"></td> | |
157 | <td> | |
43f7a76f | 158 | <a href="#" class="button" id="swap_target_assignee"> |
9285bb0f | 159 | <span> |
094ea729 | 160 | <div class="icon swap-icon"></div>{ts}Swap Target and Assignee Contacts{/ts} |
9285bb0f AH |
161 | </span> |
162 | </div> | |
163 | </td> | |
164 | </tr> | |
165 | {/if} | |
6a488035 TO |
166 | |
167 | <tr class="crm-activity-form-block-assignee_contact_id"> | |
168 | {if $action eq 4} | |
169 | <td class="label">{ts}Assigned To{/ts}</td><td class="view-value"> | |
170 | {foreach from=$assignee_contact key=id item=name} | |
171 | <a href="{crmURL p='civicrm/contact/view' q="reset=1&cid=$id"}">{$name}</a>; | |
172 | {/foreach} | |
173 | </td> | |
174 | {else} | |
175 | <td class="label">{ts}Assigned To{/ts}</td> | |
176 | <td>{$form.assignee_contact_id.html} | |
177 | {edit} | |
178 | <span class="description">{ts}You can optionally assign this activity to someone. Assigned activities will appear in their Activities listing at CiviCRM Home.{/ts} | |
6db7e202 | 179 | {if $activityAssigneeNotification} |
6a488035 TO |
180 | <br />{ts}A copy of this activity will be emailed to each Assignee.{/ts} |
181 | {/if} | |
182 | </span> | |
183 | {/edit} | |
184 | </td> | |
185 | {/if} | |
186 | </tr> | |
187 | ||
188 | {if $activityTypeFile} | |
189 | {include file="CRM/$crmDir/Form/Activity/$activityTypeFile.tpl"} | |
190 | {/if} | |
191 | ||
192 | <tr class="crm-activity-form-block-subject"> | |
193 | <td class="label">{$form.subject.label}</td><td class="view-value">{$form.subject.html|crmAddClass:huge}</td> | |
194 | </tr> | |
195 | ||
196 | {* CRM-7362 --add campaign to activities *} | |
197 | {include file="CRM/Campaign/Form/addCampaignToComponent.tpl" | |
198 | campaignTrClass="crm-activity-form-block-campaign_id"} | |
199 | ||
200 | {* build engagement level CRM-7775 *} | |
201 | {if $buildEngagementLevel} | |
202 | <tr class="crm-activity-form-block-engagement_level"> | |
203 | <td class="label">{$form.engagement_level.label}</td> | |
204 | <td class="view-value">{$form.engagement_level.html}</td> | |
205 | </tr> | |
206 | {/if} | |
207 | ||
208 | <tr class="crm-activity-form-block-location"> | |
209 | <td class="label">{$form.location.label}</td><td class="view-value">{$form.location.html|crmAddClass:huge}</td> | |
210 | </tr> | |
211 | <tr class="crm-activity-form-block-activity_date_time"> | |
212 | <td class="label">{$form.activity_date_time.label}</td> | |
213 | {if $action neq 4} | |
214 | <td class="view-value">{include file="CRM/common/jcalendar.tpl" elementName=activity_date_time}</td> | |
215 | {else} | |
216 | <td class="view-value">{$form.activity_date_time.html|crmDate}</td> | |
217 | {/if} | |
218 | </tr> | |
219 | <tr class="crm-activity-form-block-duration"> | |
220 | <td class="label">{$form.duration.label}</td> | |
221 | <td class="view-value"> | |
222 | {$form.duration.html} | |
223 | {if $action neq 4}<span class="description">{ts}Total time spent on this activity (in minutes).{/ts}{/if} | |
224 | </td> | |
225 | </tr> | |
226 | <tr class="crm-activity-form-block-status_id"> | |
227 | <td class="label">{$form.status_id.label}</td><td class="view-value">{$form.status_id.html}</td> | |
228 | </tr> | |
229 | <tr class="crm-activity-form-block-details"> | |
230 | <td class="label">{$form.details.label}</td> | |
231 | {if $activityTypeName eq "Print PDF Letter"} | |
232 | <td class="view-value"> | |
233 | {* If using plain textarea, assign class=huge to make input large enough. *} | |
234 | {if $defaultWysiwygEditor eq 0}{$form.details.html|crmAddClass:huge}{else}{$form.details.html}{/if} | |
235 | </td> | |
236 | {else} | |
237 | <td class="view-value"> | |
238 | {* If using plain textarea, assign class=huge to make input large enough. *} | |
239 | {if $defaultWysiwygEditor eq 0}{$form.details.html|crmStripAlternatives|crmAddClass:huge}{else}{$form.details.html|crmStripAlternatives}{/if} | |
240 | </td> | |
241 | {/if} | |
242 | </tr> | |
243 | <tr class="crm-activity-form-block-priority_id"> | |
244 | <td class="label">{$form.priority_id.label}</td><td class="view-value">{$form.priority_id.html}</td> | |
245 | </tr> | |
246 | {if $surveyActivity } | |
247 | <tr class="crm-activity-form-block-result"> | |
248 | <td class="label">{$form.result.label}</td><td class="view-value">{$form.result.html}</td> | |
249 | </tr> | |
250 | {/if} | |
251 | {if $form.tag.html} | |
252 | <tr class="crm-activity-form-block-tag"> | |
253 | <td class="label">{$form.tag.label}</td> | |
254 | <td class="view-value"><div class="crm-select-container">{$form.tag.html}</div> | |
255 | {literal} | |
256 | <script type="text/javascript"> | |
257 | cj(".crm-activity-form-block-tag select[multiple]").crmasmSelect({ | |
258 | addItemTarget: 'bottom', | |
259 | animate: true, | |
260 | highlight: true, | |
261 | sortable: true, | |
262 | respectParents: true | |
263 | }); | |
264 | </script> | |
265 | {/literal} | |
266 | </td> | |
267 | </tr> | |
268 | {/if} | |
269 | ||
270 | {if $tagsetInfo_activity} | |
271 | <tr class="crm-activity-form-block-tag_set"><td colspan="2">{include file="CRM/common/Tag.tpl" tagsetType='activity'}</td></tr> | |
272 | {/if} | |
273 | ||
274 | {if $action neq 4 OR $viewCustomData} | |
275 | <tr class="crm-activity-form-block-custom_data"> | |
276 | <td colspan="2"> | |
277 | {if $action eq 4} | |
278 | {include file="CRM/Custom/Page/CustomDataView.tpl"} | |
279 | {else} | |
280 | <div id="customData"></div> | |
281 | {/if} | |
282 | </td> | |
283 | </tr> | |
284 | {/if} | |
285 | ||
286 | {if $action eq 4 AND $currentAttachmentInfo} | |
287 | {include file="CRM/Form/attachment.tpl"}{* For view action the include provides the row and cells. *} | |
288 | {elseif $action eq 1 OR $action eq 2} | |
289 | <tr class="crm-activity-form-block-attachment"> | |
290 | <td colspan="2"> | |
291 | {include file="CRM/Form/attachment.tpl"} | |
292 | </td> | |
293 | </tr> | |
294 | {/if} | |
295 | ||
296 | {if $action neq 4} {* Don't include "Schedule Follow-up" section in View mode. *} | |
297 | <tr class="crm-activity-form-block-schedule_followup"> | |
298 | <td colspan="2"> | |
299 | <div class="crm-accordion-wrapper collapsed"> | |
300 | <div class="crm-accordion-header"> | |
301 | {ts}Schedule Follow-up{/ts} | |
302 | </div><!-- /.crm-accordion-header --> | |
303 | <div class="crm-accordion-body"> | |
304 | <table class="form-layout-compressed"> | |
305 | <tr><td class="label">{ts}Schedule Follow-up Activity{/ts}</td> | |
306 | <td>{$form.followup_activity_type_id.html} {ts}on{/ts} | |
307 | {include file="CRM/common/jcalendar.tpl" elementName=followup_date} | |
308 | </td> | |
309 | </tr> | |
310 | <tr> | |
311 | <td class="label">{$form.followup_activity_subject.label}</td> | |
312 | <td>{$form.followup_activity_subject.html|crmAddClass:huge}</td> | |
313 | </tr> | |
314 | </table> | |
315 | </div><!-- /.crm-accordion-body --> | |
316 | </div><!-- /.crm-accordion-wrapper --> | |
317 | {literal} | |
318 | <script type="text/javascript"> | |
319 | cj(function() { | |
320 | cj().crmAccordions(); | |
321 | cj('.crm-accordion-body').each( function() { | |
322 | //open tab if form rule throws error | |
323 | if ( cj(this).children( ).find('span.crm-error').text( ).length > 0 ) { | |
324 | cj(this).parent('.collapsed').crmAccordionToggle(); | |
325 | } | |
326 | }); | |
327 | }); | |
9285bb0f AH |
328 | cj('#swap_target_assignee').click( function() { |
329 | var assignees = cj('input#assignee_contact_id').tokenInput("get"); | |
330 | var targets = cj('input#contact_1').tokenInput("get"); | |
331 | cj('#assignee_contact_id').tokenInput("clear"); | |
332 | cj('#contact_1').tokenInput("clear"); | |
333 | cj(assignees).each( function() { | |
334 | cj('#contact_1').tokenInput("add", this); | |
335 | }); | |
336 | cj(targets).each( function() { | |
337 | cj('#assignee_contact_id').tokenInput("add", this); | |
338 | }); | |
43f7a76f | 339 | return false; |
9285bb0f | 340 | }); |
6a488035 TO |
341 | </script> |
342 | {/literal} | |
343 | </td> | |
344 | </tr> | |
345 | {/if} | |
346 | {/if} {* End Delete vs. Add / Edit action *} | |
347 | </table> | |
348 | <div class="crm-submit-buttons"> | |
349 | {if $action eq 4 && $activityTName neq 'Inbound Email'} | |
350 | {if !$context } | |
351 | {assign var="context" value='activity'} | |
352 | {/if} | |
353 | {if $permission EQ 'edit'} | |
354 | {assign var='urlParams' value="reset=1&atype=$atype&action=update&reset=1&id=$entityID&cid=$contactId&context=$context"} | |
355 | {if ($context eq 'fulltext' || $context eq 'search') && $searchKey} | |
356 | {assign var='urlParams' value="reset=1&atype=$atype&action=update&reset=1&id=$entityID&cid=$contactId&context=$context&key=$searchKey"} | |
357 | {/if} | |
358 | <a href="{crmURL p='civicrm/activity/add' q=$urlParams}" class="edit button" title="{ts}Edit{/ts}"><span><div class="icon edit-icon"></div>{ts}Edit{/ts}</span></a> | |
359 | {/if} | |
360 | ||
361 | {if call_user_func(array('CRM_Core_Permission','check'), 'delete activities')} | |
362 | {assign var='urlParams' value="reset=1&atype=$atype&action=delete&reset=1&id=$entityID&cid=$contactId&context=$context"} | |
363 | {if ($context eq 'fulltext' || $context eq 'search') && $searchKey} | |
364 | {assign var='urlParams' value="reset=1&atype=$atype&action=delete&reset=1&id=$entityID&cid=$contactId&context=$context&key=$searchKey"} | |
365 | {/if} | |
366 | <a href="{crmURL p='civicrm/contact/view/activity' q=$urlParams}" class="delete button" title="{ts}Delete{/ts}"><span><div class="icon delete-icon"></div>{ts}Delete{/ts}</span></a> | |
367 | {/if} | |
368 | {/if} | |
369 | {include file="CRM/common/formButtons.tpl" location="bottom"} | |
370 | </div> | |
371 | ||
372 | {include file="CRM/Case/Form/ActivityToCase.tpl"} | |
373 | ||
374 | {if $action eq 1 or $action eq 2 or $context eq 'search' or $context eq 'smog'} | |
375 | {*include custom data js file*} | |
376 | {include file="CRM/common/customData.tpl"} | |
377 | {literal} | |
378 | <script type="text/javascript"> | |
379 | cj(function() { | |
380 | {/literal} | |
381 | {if $customDataSubType} | |
382 | CRM.buildCustomData( '{$customDataType}', {$customDataSubType} ); | |
383 | {else} | |
384 | CRM.buildCustomData( '{$customDataType}' ); | |
385 | {/if} | |
386 | {literal} | |
387 | }); | |
388 | </script> | |
389 | {/literal} | |
390 | {/if} | |
391 | {if ! $form.case_select} | |
392 | {include file="CRM/common/formNavigate.tpl"} | |
393 | {/if} | |
394 | </div>{* end of form block*} | |
395 | {/if} {* end of snippet if*} |