CRM-10043 - merge in changes to Activity.tpl and splitting of ActivityJs.tpl with...
[civicrm-core.git] / templates / CRM / Activity / Form / Activity.tpl
1 {*
2 +--------------------------------------------------------------------+
3 | CiviCRM version 4.4 |
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'}
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>
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 {include file="CRM/Activity/Form/ActivityJs.tpl" tokenContext="activity"}
43 {if !$action or ( $action eq 1 ) or ( $action eq 2 ) }
44 <div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="top"}</div>
45 {/if}
46
47 {if $action eq 8} {* Delete action. *}
48 <table class="form-layout">
49 <tr>
50 <td colspan="2">
51 <div class="status">{ts 1=$delName}Are you sure you want to delete '%1'?{/ts}</div>
52 </td>
53 </tr>
54 {elseif $action eq 1 or $action eq 2 or $action eq 4 or $context eq 'search' or $context eq 'smog'}
55
56 <table class="{if $action eq 4}crm-info-panel{else}form-layout{/if}">
57
58 {if $action eq 4}
59 <h3>{$activityTypeName}</h3>
60 {if $activityTypeDescription }
61 <div class="help">{$activityTypeDescription}</div>
62 {/if}
63 {else}
64 {if $context eq 'standalone' or $context eq 'search' or $context eq 'smog'}
65 <tr class="crm-activity-form-block-activity_type_id">
66 <td class="label">{$form.activity_type_id.label}</td><td class="view-value">{$form.activity_type_id.html}</td>
67 </tr>
68 {/if}
69 {/if}
70
71 {if $surveyActivity}
72 <tr class="crm-activity-form-block-survey">
73 <td class="label">{ts}Survey Title{/ts}</td><td class="view-value">{$surveyTitle}</td>
74 </tr>
75 {/if}
76
77 <tr class="crm-activity-form-block-source_contact_id">
78 <td class="label">{$form.source_contact_id.label}</td>
79 <td class="view-value">
80 {if $admin and $action neq 4}{$form.source_contact_id.html} {else} {$source_contact_value} {/if}
81 </td>
82 </tr>
83
84 <tr class="crm-activity-form-block-target_contact_id">
85 {if $single eq false}
86 <td class="label">{ts}With Contact(s){/ts}</td>
87 <td class="view-value" style="white-space: normal">
88 {$with|escape}
89 <br/>
90 {$form.is_multi_activity.html}&nbsp;{$form.is_multi_activity.label} {help id="id-is_multi_activity"}
91 </td>
92 {elseif $action neq 4}
93 <td class="label">{ts}With Contact{/ts}</td>
94 <td class="view-value">
95 {include file="CRM/Contact/Form/NewContact.tpl" noLabel=true skipBreak=true multiClient=true parent="activity" showNewSelect=true}
96 {if $action eq 1}
97 <br/>
98 {$form.is_multi_activity.html}&nbsp;{$form.is_multi_activity.label} {help id="id-is_multi_activity"}
99 {/if}
100 </td>
101 {else}
102 <td class="label">{ts}With Contact{/ts}</td>
103 <td class="view-value" style="white-space: normal">
104 {foreach from=$target_contact key=id item=name}
105 <a href="{crmURL p='civicrm/contact/view' q="reset=1&cid=$id"}">{$name}</a>;&nbsp;
106 {/foreach}
107 </td>
108 {/if}
109 </tr>
110
111 <tr class="crm-activity-form-block-assignee_contact_id">
112 {if $action eq 4}
113 <td class="label">{ts}Assigned To{/ts}</td><td class="view-value">
114 {foreach from=$assignee_contact key=id item=name}
115 <a href="{crmURL p='civicrm/contact/view' q="reset=1&cid=$id"}">{$name}</a>;&nbsp;
116 {/foreach}
117 </td>
118 {else}
119 <td class="label">{ts}Assigned To{/ts}</td>
120 <td>
121 <a href="#" class="button" id="swap_target_assignee" title="{ts}Swap Target and Assignee Contacts{/ts}" style="float:right;">
122 <span>
123 <div class="icon swap-icon"></div>
124 </span>
125 </a>
126 {$form.assignee_contact_id.html}
127 {edit}
128 <span class="description">{ts}You can optionally assign this activity to someone. Assigned activities will appear in their Activities listing at CiviCRM Home.{/ts}
129 {if $activityAssigneeNotification}
130 <br />{ts}A copy of this activity will be emailed to each Assignee.{/ts}
131 {/if}
132 </span>
133 {/edit}
134 </td>
135 {/if}
136 </tr>
137
138 {if $activityTypeFile}
139 {include file="CRM/$crmDir/Form/Activity/$activityTypeFile.tpl"}
140 {/if}
141
142 <tr class="crm-activity-form-block-subject">
143 <td class="label">{$form.subject.label}</td><td class="view-value">{$form.subject.html|crmAddClass:huge}</td>
144 </tr>
145
146 {* CRM-7362 --add campaign to activities *}
147 {include file="CRM/Campaign/Form/addCampaignToComponent.tpl"
148 campaignTrClass="crm-activity-form-block-campaign_id"}
149
150 {* build engagement level CRM-7775 *}
151 {if $buildEngagementLevel}
152 <tr class="crm-activity-form-block-engagement_level">
153 <td class="label">{$form.engagement_level.label}</td>
154 <td class="view-value">{$form.engagement_level.html}</td>
155 </tr>
156 {/if}
157
158 <tr class="crm-activity-form-block-location">
159 <td class="label">{$form.location.label}</td><td class="view-value">{$form.location.html|crmAddClass:huge}</td>
160 </tr>
161 <tr class="crm-activity-form-block-activity_date_time">
162 <td class="label">{$form.activity_date_time.label}</td>
163 {if $action neq 4}
164 <td class="view-value">{include file="CRM/common/jcalendar.tpl" elementName=activity_date_time}</td>
165 {else}
166 <td class="view-value">{$form.activity_date_time.html|crmDate}</td>
167 {/if}
168 </tr>
169 <tr class="crm-activity-form-block-duration">
170 <td class="label">{$form.duration.label}</td>
171 <td class="view-value">
172 {$form.duration.html}
173 {if $action neq 4}<span class="description">{ts}Total time spent on this activity (in minutes).{/ts}{/if}
174 </td>
175 </tr>
176 <tr class="crm-activity-form-block-status_id">
177 <td class="label">{$form.status_id.label}</td><td class="view-value">{$form.status_id.html}</td>
178 </tr>
179 <tr class="crm-activity-form-block-details">
180 <td class="label">{$form.details.label}</td>
181 {if $activityTypeName eq "Print PDF Letter"}
182 <td class="view-value">
183 {* If using plain textarea, assign class=huge to make input large enough. *}
184 {if $defaultWysiwygEditor eq 0}{$form.details.html|crmAddClass:huge}{else}{$form.details.html}{/if}
185 </td>
186 {else}
187 <td class="view-value">
188 {* If using plain textarea, assign class=huge to make input large enough. *}
189 {if $defaultWysiwygEditor eq 0}{$form.details.html|crmStripAlternatives|crmAddClass:huge}{else}{$form.details.html|crmStripAlternatives}{/if}
190 </td>
191 {/if}
192 </tr>
193 <tr class="crm-activity-form-block-priority_id">
194 <td class="label">{$form.priority_id.label}</td><td class="view-value">{$form.priority_id.html}</td>
195 </tr>
196 {if $surveyActivity }
197 <tr class="crm-activity-form-block-result">
198 <td class="label">{$form.result.label}</td><td class="view-value">{$form.result.html}</td>
199 </tr>
200 {/if}
201 {if $form.tag.html}
202 <tr class="crm-activity-form-block-tag">
203 <td class="label">{$form.tag.label}</td>
204 <td class="view-value"><div class="crm-select-container">{$form.tag.html}</div>
205 {literal}
206 <script type="text/javascript">
207 cj(".crm-activity-form-block-tag select[multiple]").crmasmSelect({
208 addItemTarget: 'bottom',
209 animate: true,
210 highlight: true,
211 sortable: true,
212 respectParents: true
213 });
214 </script>
215 {/literal}
216 </td>
217 </tr>
218 {/if}
219
220 {if $tagsetInfo_activity}
221 <tr class="crm-activity-form-block-tag_set"><td colspan="2">{include file="CRM/common/Tag.tpl" tagsetType='activity'}</td></tr>
222 {/if}
223
224 {if $action neq 4 OR $viewCustomData}
225 <tr class="crm-activity-form-block-custom_data">
226 <td colspan="2">
227 {if $action eq 4}
228 {include file="CRM/Custom/Page/CustomDataView.tpl"}
229 {else}
230 <div id="customData"></div>
231 {/if}
232 </td>
233 </tr>
234 {/if}
235
236 {if $action eq 4 AND $currentAttachmentInfo}
237 {include file="CRM/Form/attachment.tpl"}{* For view action the include provides the row and cells. *}
238 {elseif $action eq 1 OR $action eq 2}
239 <tr class="crm-activity-form-block-attachment">
240 <td colspan="2">
241 {include file="CRM/Form/attachment.tpl"}
242 </td>
243 </tr>
244 {/if}
245
246 {if $action neq 4} {* Don't include "Schedule Follow-up" section in View mode. *}
247 <tr class="crm-activity-form-block-schedule_followup">
248 <td colspan="2">
249 <div class="crm-accordion-wrapper collapsed">
250 <div class="crm-accordion-header">
251 {ts}Schedule Follow-up{/ts}
252 </div><!-- /.crm-accordion-header -->
253 <div class="crm-accordion-body">
254 <table class="form-layout-compressed">
255 <tr><td class="label">{ts}Schedule Follow-up Activity{/ts}</td>
256 <td>{$form.followup_activity_type_id.html}&nbsp;&nbsp;{ts}on{/ts}
257 {include file="CRM/common/jcalendar.tpl" elementName=followup_date}
258 </td>
259 </tr>
260 <tr>
261 <td class="label">{$form.followup_activity_subject.label}</td>
262 <td>{$form.followup_activity_subject.html|crmAddClass:huge}</td>
263 </tr>
264 <tr>
265 <td class="label">{ts}Assign To{/ts}</td>
266 <td>{$form.followup_assignee_contact_id.html}
267 {edit}<span class="description">{ts}You can optionally assign this activity to someone. Assigned activities will appear in their Activities listing at CiviCRM Home.{/ts}
268 </span>
269 {/edit}
270 </td>
271 </tr>
272 </table>
273 </div><!-- /.crm-accordion-body -->
274 </div><!-- /.crm-accordion-wrapper -->
275 {literal}
276 <script type="text/javascript">
277 cj(function() {
278 cj().crmAccordions();
279 cj('.crm-accordion-body').each( function() {
280 //open tab if form rule throws error
281 if ( cj(this).children( ).find('span.crm-error').text( ).length > 0 ) {
282 cj(this).parent('.collapsed').crmAccordionToggle();
283 }
284 });
285 });
286 cj('#swap_target_assignee').click( function() {
287 var assignees = cj('input#assignee_contact_id').tokenInput("get");
288 var targets = cj('input#contact_1').tokenInput("get");
289 cj('#assignee_contact_id').tokenInput("clear");
290 cj('#contact_1').tokenInput("clear");
291 cj(assignees).each( function() {
292 cj('#contact_1').tokenInput("add", this);
293 });
294 cj(targets).each( function() {
295 cj('#assignee_contact_id').tokenInput("add", this);
296 });
297 return false;
298 });
299 </script>
300 {/literal}
301 </td>
302 </tr>
303 {/if}
304 {/if} {* End Delete vs. Add / Edit action *}
305 </table>
306 <div class="crm-submit-buttons">
307 {if $action eq 4 && $activityTName neq 'Inbound Email'}
308 {if !$context }
309 {assign var="context" value='activity'}
310 {/if}
311 {if $permission EQ 'edit'}
312 {assign var='urlParams' value="reset=1&atype=$atype&action=update&reset=1&id=$entityID&cid=$contactId&context=$context"}
313 {if ($context eq 'fulltext' || $context eq 'search') && $searchKey}
314 {assign var='urlParams' value="reset=1&atype=$atype&action=update&reset=1&id=$entityID&cid=$contactId&context=$context&key=$searchKey"}
315 {/if}
316 <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>
317 {/if}
318
319 {if call_user_func(array('CRM_Core_Permission','check'), 'delete activities')}
320 {assign var='urlParams' value="reset=1&atype=$atype&action=delete&reset=1&id=$entityID&cid=$contactId&context=$context"}
321 {if ($context eq 'fulltext' || $context eq 'search') && $searchKey}
322 {assign var='urlParams' value="reset=1&atype=$atype&action=delete&reset=1&id=$entityID&cid=$contactId&context=$context&key=$searchKey"}
323 {/if}
324 <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>
325 {/if}
326 {/if}
327 {include file="CRM/common/formButtons.tpl" location="bottom"}
328 </div>
329
330 {include file="CRM/Case/Form/ActivityToCase.tpl"}
331
332 {if $action eq 1 or $action eq 2 or $context eq 'search' or $context eq 'smog'}
333 {*include custom data js file*}
334 {include file="CRM/common/customData.tpl"}
335 {literal}
336 <script type="text/javascript">
337 cj(function() {
338 {/literal}
339 {if $customDataSubType}
340 CRM.buildCustomData( '{$customDataType}', {$customDataSubType} );
341 {else}
342 CRM.buildCustomData( '{$customDataType}' );
343 {/if}
344 {literal}
345 });
346 </script>
347 {/literal}
348 {/if}
349 {if ! $form.case_select}
350 {include file="CRM/common/formNavigate.tpl"}
351 {/if}
352 </div>{* end of form block*}
353 {/if} {* end of snippet if*}