Merge pull request #456 from colemanw/help
[civicrm-core.git] / templates / CRM / Activity / Form / Activity.tpl
CommitLineData
6a488035
TO
1{*
2 +--------------------------------------------------------------------+
3 | CiviCRM version 4.3 |
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' );
79 cj('#source_contact_id').autocomplete( sourceDataUrl, { width : 180, selectFirst : false, hintText: hintText, matchContains: true, minChars: 1
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>
105 {/if}
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}&nbsp;{$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/>
141 {$form.is_multi_activity.html}&nbsp;{$form.is_multi_activity.label}
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>;&nbsp;
149 {/foreach}
150 </td>
151 {/if}
152 </tr>
153
154 <tr class="crm-activity-form-block-assignee_contact_id">
155 {if $action eq 4}
156 <td class="label">{ts}Assigned To{/ts}</td><td class="view-value">
157 {foreach from=$assignee_contact key=id item=name}
158 <a href="{crmURL p='civicrm/contact/view' q="reset=1&cid=$id"}">{$name}</a>;&nbsp;
159 {/foreach}
160 </td>
161 {else}
162 <td class="label">{ts}Assigned To{/ts}</td>
163 <td>{$form.assignee_contact_id.html}
164 {edit}
165 <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 166 {if $activityAssigneeNotification}
6a488035
TO
167 <br />{ts}A copy of this activity will be emailed to each Assignee.{/ts}
168 {/if}
169 </span>
170 {/edit}
171 </td>
172 {/if}
173 </tr>
174
175 {if $activityTypeFile}
176 {include file="CRM/$crmDir/Form/Activity/$activityTypeFile.tpl"}
177 {/if}
178
179 <tr class="crm-activity-form-block-subject">
180 <td class="label">{$form.subject.label}</td><td class="view-value">{$form.subject.html|crmAddClass:huge}</td>
181 </tr>
182
183 {* CRM-7362 --add campaign to activities *}
184 {include file="CRM/Campaign/Form/addCampaignToComponent.tpl"
185 campaignTrClass="crm-activity-form-block-campaign_id"}
186
187 {* build engagement level CRM-7775 *}
188 {if $buildEngagementLevel}
189 <tr class="crm-activity-form-block-engagement_level">
190 <td class="label">{$form.engagement_level.label}</td>
191 <td class="view-value">{$form.engagement_level.html}</td>
192 </tr>
193 {/if}
194
195 <tr class="crm-activity-form-block-location">
196 <td class="label">{$form.location.label}</td><td class="view-value">{$form.location.html|crmAddClass:huge}</td>
197 </tr>
198 <tr class="crm-activity-form-block-activity_date_time">
199 <td class="label">{$form.activity_date_time.label}</td>
200 {if $action neq 4}
201 <td class="view-value">{include file="CRM/common/jcalendar.tpl" elementName=activity_date_time}</td>
202 {else}
203 <td class="view-value">{$form.activity_date_time.html|crmDate}</td>
204 {/if}
205 </tr>
206 <tr class="crm-activity-form-block-duration">
207 <td class="label">{$form.duration.label}</td>
208 <td class="view-value">
209 {$form.duration.html}
210 {if $action neq 4}<span class="description">{ts}Total time spent on this activity (in minutes).{/ts}{/if}
211 </td>
212 </tr>
213 <tr class="crm-activity-form-block-status_id">
214 <td class="label">{$form.status_id.label}</td><td class="view-value">{$form.status_id.html}</td>
215 </tr>
216 <tr class="crm-activity-form-block-details">
217 <td class="label">{$form.details.label}</td>
218 {if $activityTypeName eq "Print PDF Letter"}
219 <td class="view-value">
220 {* If using plain textarea, assign class=huge to make input large enough. *}
221 {if $defaultWysiwygEditor eq 0}{$form.details.html|crmAddClass:huge}{else}{$form.details.html}{/if}
222 </td>
223 {else}
224 <td class="view-value">
225 {* If using plain textarea, assign class=huge to make input large enough. *}
226 {if $defaultWysiwygEditor eq 0}{$form.details.html|crmStripAlternatives|crmAddClass:huge}{else}{$form.details.html|crmStripAlternatives}{/if}
227 </td>
228 {/if}
229 </tr>
230 <tr class="crm-activity-form-block-priority_id">
231 <td class="label">{$form.priority_id.label}</td><td class="view-value">{$form.priority_id.html}</td>
232 </tr>
233 {if $surveyActivity }
234 <tr class="crm-activity-form-block-result">
235 <td class="label">{$form.result.label}</td><td class="view-value">{$form.result.html}</td>
236 </tr>
237 {/if}
238 {if $form.tag.html}
239 <tr class="crm-activity-form-block-tag">
240 <td class="label">{$form.tag.label}</td>
241 <td class="view-value"><div class="crm-select-container">{$form.tag.html}</div>
242 {literal}
243 <script type="text/javascript">
244 cj(".crm-activity-form-block-tag select[multiple]").crmasmSelect({
245 addItemTarget: 'bottom',
246 animate: true,
247 highlight: true,
248 sortable: true,
249 respectParents: true
250 });
251 </script>
252 {/literal}
253 </td>
254 </tr>
255 {/if}
256
257 {if $tagsetInfo_activity}
258 <tr class="crm-activity-form-block-tag_set"><td colspan="2">{include file="CRM/common/Tag.tpl" tagsetType='activity'}</td></tr>
259 {/if}
260
261 {if $action neq 4 OR $viewCustomData}
262 <tr class="crm-activity-form-block-custom_data">
263 <td colspan="2">
264 {if $action eq 4}
265 {include file="CRM/Custom/Page/CustomDataView.tpl"}
266 {else}
267 <div id="customData"></div>
268 {/if}
269 </td>
270 </tr>
271 {/if}
272
273 {if $action eq 4 AND $currentAttachmentInfo}
274 {include file="CRM/Form/attachment.tpl"}{* For view action the include provides the row and cells. *}
275 {elseif $action eq 1 OR $action eq 2}
276 <tr class="crm-activity-form-block-attachment">
277 <td colspan="2">
278 {include file="CRM/Form/attachment.tpl"}
279 </td>
280 </tr>
281 {/if}
282
283 {if $action neq 4} {* Don't include "Schedule Follow-up" section in View mode. *}
284 <tr class="crm-activity-form-block-schedule_followup">
285 <td colspan="2">
286 <div class="crm-accordion-wrapper collapsed">
287 <div class="crm-accordion-header">
288 {ts}Schedule Follow-up{/ts}
289 </div><!-- /.crm-accordion-header -->
290 <div class="crm-accordion-body">
291 <table class="form-layout-compressed">
292 <tr><td class="label">{ts}Schedule Follow-up Activity{/ts}</td>
293 <td>{$form.followup_activity_type_id.html}&nbsp;&nbsp;{ts}on{/ts}
294 {include file="CRM/common/jcalendar.tpl" elementName=followup_date}
295 </td>
296 </tr>
297 <tr>
298 <td class="label">{$form.followup_activity_subject.label}</td>
299 <td>{$form.followup_activity_subject.html|crmAddClass:huge}</td>
300 </tr>
301 </table>
302 </div><!-- /.crm-accordion-body -->
303 </div><!-- /.crm-accordion-wrapper -->
304 {literal}
305 <script type="text/javascript">
306 cj(function() {
307 cj().crmAccordions();
308 cj('.crm-accordion-body').each( function() {
309 //open tab if form rule throws error
310 if ( cj(this).children( ).find('span.crm-error').text( ).length > 0 ) {
311 cj(this).parent('.collapsed').crmAccordionToggle();
312 }
313 });
314 });
315 </script>
316 {/literal}
317 </td>
318 </tr>
319 {/if}
320 {/if} {* End Delete vs. Add / Edit action *}
321 </table>
322 <div class="crm-submit-buttons">
323 {if $action eq 4 && $activityTName neq 'Inbound Email'}
324 {if !$context }
325 {assign var="context" value='activity'}
326 {/if}
327 {if $permission EQ 'edit'}
328 {assign var='urlParams' value="reset=1&atype=$atype&action=update&reset=1&id=$entityID&cid=$contactId&context=$context"}
329 {if ($context eq 'fulltext' || $context eq 'search') && $searchKey}
330 {assign var='urlParams' value="reset=1&atype=$atype&action=update&reset=1&id=$entityID&cid=$contactId&context=$context&key=$searchKey"}
331 {/if}
332 <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>
333 {/if}
334
335 {if call_user_func(array('CRM_Core_Permission','check'), 'delete activities')}
336 {assign var='urlParams' value="reset=1&atype=$atype&action=delete&reset=1&id=$entityID&cid=$contactId&context=$context"}
337 {if ($context eq 'fulltext' || $context eq 'search') && $searchKey}
338 {assign var='urlParams' value="reset=1&atype=$atype&action=delete&reset=1&id=$entityID&cid=$contactId&context=$context&key=$searchKey"}
339 {/if}
340 <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>
341 {/if}
342 {/if}
343 {include file="CRM/common/formButtons.tpl" location="bottom"}
344 </div>
345
346 {include file="CRM/Case/Form/ActivityToCase.tpl"}
347
348 {if $action eq 1 or $action eq 2 or $context eq 'search' or $context eq 'smog'}
349 {*include custom data js file*}
350 {include file="CRM/common/customData.tpl"}
351 {literal}
352 <script type="text/javascript">
353 cj(function() {
354 {/literal}
355 {if $customDataSubType}
356 CRM.buildCustomData( '{$customDataType}', {$customDataSubType} );
357 {else}
358 CRM.buildCustomData( '{$customDataType}' );
359 {/if}
360 {literal}
361 });
362 </script>
363 {/literal}
364 {/if}
365 {if ! $form.case_select}
366 {include file="CRM/common/formNavigate.tpl"}
367 {/if}
368 </div>{* end of form block*}
369{/if} {* end of snippet if*}