Merge remote-tracking branch 'upstream/4.3' into 4.3-4.4-2013-11-11-10-44-51
[civicrm-core.git] / templates / CRM / Case / 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
27 {* this template is used for adding/editing activities for a case. *}
28 {if $cdType }
29 {include file="CRM/Custom/Form/CustomData.tpl"}
30 {else}
31 <h3>{if $action eq 1 or $action eq 1024}
32 {ts 1=$activityTypeName}New activity: %1{/ts}
33 {elseif $action eq 8}{ts 1=$activityTypeName}Delete %1{/ts}
34 {elseif $action eq 32768}{ts 1=$activityTypeName}Restore %1{/ts}
35 {else}{ts 1=$activityTypeName}Edit %1{/ts}{/if}
36 </h3>
37 <div class="crm-block crm-form-block crm-case-activity-form-block">
38
39 {if $action neq 8 and $action neq 32768 }
40 {* Include form buttons on top for new and edit modes. *}
41 <div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="top"}</div>
42
43 {* added onload javascript for source contact*}
44 {literal}
45 <script type="text/javascript">
46 var assignee_contact = '';
47
48 {/literal}
49 {if $assignee_contact}
50 var assignee_contact = {$assignee_contact};
51 {/if}
52
53 {literal}
54 var assignee_contact_id = null;
55 //loop to set the value of cc and bcc if form rule.
56 var toDataUrl = "{/literal}{crmURL p='civicrm/ajax/checkemail' q='id=1&noemail=1' h=0 }{literal}"; {/literal}
57 {foreach from=","|explode:"assignee" key=key item=element}
58 {assign var=currentElement value=`$element`_contact_id}
59 {if $form.$currentElement.value}
60 {literal} var {/literal}{$currentElement}{literal} = cj.ajax({ url: toDataUrl + "&cid={/literal}{$form.$currentElement.value}{literal}", async: false }).responseText;{/literal}
61 {/if}
62 {/foreach}
63 {literal}
64
65 if ( assignee_contact_id ) {
66 eval( 'assignee_contact = ' + assignee_contact_id );
67 }
68
69 cj(function( ) {
70 {/literal}
71 {if $source_contact and $admin and $action neq 4}
72 {literal} cj( '#source_contact_id' ).val( "{/literal}{$source_contact}{literal}");{/literal}
73 {/if}
74 {literal}
75
76 var sourceDataUrl = "{/literal}{$dataUrl}{literal}";
77 var tokenDataUrl_assignee = "{/literal}{$tokenUrl}&context=case_activity_assignee{literal}";
78
79 var hintText = "{/literal}{ts escape='js'}Type in a partial or complete name or email address of an existing contact.{/ts}{literal}";
80 cj( "#assignee_contact_id").tokenInput( tokenDataUrl_assignee, { prePopulate: assignee_contact, theme: 'facebook', hintText: hintText });
81 cj( 'ul.token-input-list-facebook, div.token-input-dropdown-facebook' ).css( 'width', '450px' );
82 cj( "#source_contact_id").autocomplete( sourceDataUrl, { width : 180, selectFirst : false, matchContains:true
83 }).result( function(event, data, formatted) { cj( "#source_contact_qid" ).val( data[1] );
84 }).bind( 'click', function( ) { cj( "#source_contact_qid" ).val(''); });
85 });
86 </script>
87 {/literal}
88
89 {/if}
90
91 {if $action eq 8 or $action eq 32768 }
92 <div class="messages status no-popup">
93 <div class="icon inform-icon"></div> &nbsp;
94 {if $action eq 8}
95 {ts 1=$activityTypeName}Click Delete to move this &quot;%1&quot; activity to the Trash.{/ts}
96 {else}
97 {ts 1=$activityTypeName}Click Restore to retrieve this &quot;%1&quot; activity from the Trash.{/ts}
98 {/if}
99 </div><br />
100 {else}
101 <table class="form-layout">
102 {if $activityTypeDescription }
103 <tr>
104 <div id="help">{$activityTypeDescription}</div>
105 </tr>
106 {/if}
107 <tr id="with-clients" class="crm-case-activity-form-block-client_name">
108 <td class="label font-size12pt">{ts}Client{/ts}</td>
109 <td class="view-value">
110 <span class="font-size12pt">
111 {foreach from=$client_names item=client name=clients}
112 {$client.display_name}{if not $smarty.foreach.clients.last}; &nbsp; {/if}
113 {/foreach}
114 </span>
115
116 {if $action eq 1 or $action eq 2}
117 <br />
118 <a href="#" class="crm-with-contact">&raquo; {ts}With other contact(s){/ts}</a>
119 {/if}
120 </td>
121 </tr>
122
123 {if $action eq 1 or $action eq 2}
124 <tr class="crm-case-activity-form-block-target_contact_id hide-block" id="with-contacts-widget">
125 <td class="label font-size10pt">{ts}With Contact{/ts}</td>
126 <td class="view-value">
127 {include file="CRM/Contact/Form/NewContact.tpl" noLabel=true skipBreak=true multiClient=true}
128 <br/>
129 <a href="#" class="crm-with-contact">
130 &raquo; {if not $multiClient}{ts}With client{/ts}{else}{ts}With client(s){/ts}{/if}
131 </a>
132 </td>
133 </tr>
134 {/if}
135
136 <tr class="crm-case-activity-form-block-activityTypeName">
137 <td class="label">{ts}Activity Type{/ts}</td>
138 <td class="view-value bold">{$activityTypeName|escape}</td>
139 </tr>
140 <tr class="crm-case-activity-form-block-source_contact_id">
141 <td class="label">{$form.source_contact_id.label}</td>
142 <td class="view-value"> {if $admin}{$form.source_contact_id.html}{/if}</td>
143 </tr>
144 <tr class="crm-case-activity-form-block-assignee_contact_id">
145 <td class="label">{ts}Assigned To{/ts}</td>
146 <td>{$form.assignee_contact_id.html}
147 {edit}
148 <span class="description">
149 {ts}You can optionally assign this activity to someone.{/ts}
150 {if $activityAssigneeNotification}
151 <br />{ts}A copy of this activity will be emailed to each Assignee.{/ts}
152 {/if}
153 </span>
154 {/edit}
155 </td>
156 </tr>
157
158 {* Include special processing fields if any are defined for this activity type (e.g. Change Case Status / Change Case Type). *}
159 {if $activityTypeFile}
160 {include file="CRM/Case/Form/Activity/$activityTypeFile.tpl"}
161 {/if}
162 {if $activityTypeFile neq 'ChangeCaseStartDate'}
163 <tr class="crm-case-activity-form-block-subject">
164 <td class="label">{$form.subject.label}</td><td class="view-value">{$form.subject.html|crmAddClass:huge}</td>
165 </tr>
166 {/if}
167 <tr class="crm-case-activity-form-block-medium_id">
168 <td class="label">{$form.medium_id.label}</td>
169 <td class="view-value">{$form.medium_id.html}&nbsp;&nbsp;&nbsp;{$form.location.label} &nbsp;{$form.location.html|crmAddClass:huge}</td>
170 </tr>
171 <tr class="crm-case-activity-form-block-activity_date_time">
172 <td class="label">{$form.activity_date_time.label}</td>
173 {if $action eq 2 && $activityTypeFile eq 'OpenCase'}
174 <td class="view-value">{$current_activity_date_time|crmDate}
175 <div class="description">Use a <a href="{$changeStartURL}">Change Start Date</a> activity to change the date</div>
176 {* avoid errors about missing field *}
177 <div style="display: none;">{include file="CRM/common/jcalendar.tpl" elementName=activity_date_time}</div>
178 </td>
179 {else}
180 <td class="view-value">{include file="CRM/common/jcalendar.tpl" elementName=activity_date_time}</td>
181 {/if}
182 </tr>
183 <tr>
184 <td colspan="2"><div id="customData"></div></td>
185 </tr>
186 <tr class="crm-case-activity-form-block-details">
187 <td class="label">{$form.details.label}</td>
188 <td class="view-value">
189 {* If using plain textarea, assign class=huge to make input large enough. *}
190 {if $defaultWysiwygEditor eq 0}{$form.details.html|crmAddClass:huge}{else}{$form.details.html}{/if}
191 </td>
192 </tr>
193 <tr class="crm-case-activity-form-block-attachment">
194 <td colspan="2">{include file="CRM/Form/attachment.tpl"}</td>
195 </tr>
196 {if $searchRows} {* We have got case role rows to display for "Send Copy To" feature *}
197 <tr class="crm-case-activity-form-block-send_copy">
198 <td colspan="2">
199 <div id="sendcopy" class="crm-accordion-wrapper collapsed">
200 <div class="crm-accordion-header">
201 {ts}Send a Copy{/ts}
202 </div><!-- /.crm-accordion-header -->
203 <div id="sendcopy-body" class="crm-accordion-body">
204
205 <div class="description">{ts}Email a complete copy of this activity record to other people involved with the case. Click the top left box to select all.{/ts}</div>
206 {strip}
207 <table>
208 <tr class="columnheader">
209 <th>{$form.toggleSelect.html}&nbsp;</th>
210 <th>{ts}Case Role{/ts}</th>
211 <th>{ts}Name{/ts}</th>
212 <th>{ts}Email{/ts}</th>
213 </tr>
214 {foreach from=$searchRows item=row key=id}
215 <tr class="{cycle values="odd-row,even-row"}">
216 <td class="crm-case-activity-form-block-contact_{$id}">{$form.contact_check[$id].html}</td>
217 <td class="crm-case-activity-form-block-role">{$row.role}</td>
218 <td class="crm-case-activity-form-block-display_name">{$row.display_name}</td>
219 <td class="crm-case-activity-form-block-email">{$row.email}</td>
220 </tr>
221 {/foreach}
222 </table>
223 {/strip}
224 </div><!-- /.crm-accordion-body -->
225 </div><!-- /.crm-accordion-wrapper -->
226 </td>
227 </tr>
228 {/if}
229 <tr class="crm-case-activity-form-block-schedule_followup">
230 <td colspan="2">
231
232 <div id="follow-up" class="crm-accordion-wrapper collapsed">
233 <div class="crm-accordion-header">
234 {ts}Schedule Follow-up{/ts}
235 </div><!-- /.crm-accordion-header -->
236 <div class="crm-accordion-body">
237
238 <table class="form-layout-compressed">
239 <tr class="crm-case-activity-form-block-followup_activity_type_id">
240 <td class="label">{ts}Schedule Follow-up Activity{/ts}</td>
241 <td>{$form.followup_activity_type_id.html}&nbsp;&nbsp;{ts}on{/ts}
242 {include file="CRM/common/jcalendar.tpl" elementName=followup_date}
243 </td>
244 </tr>
245 <tr class="crm-case-activity-form-block-followup_activity_subject">
246 <td class="label">{$form.followup_activity_subject.label}</td>
247 <td>{$form.followup_activity_subject.html|crmAddClass:huge}</td>
248 </tr>
249 </table>
250 </div><!-- /.crm-accordion-body -->
251 </div><!-- /.crm-accordion-wrapper -->
252 </td>
253 </tr>
254 <tr class="crm-case-activity-form-block-duration">
255 <td class="label">{$form.duration.label}</td>
256 <td class="view-value">
257 {$form.duration.html}
258 <span class="description">{ts}Total time spent on this activity (in minutes).{/ts}
259 </td>
260 </tr>
261 {* Suppress activity status and priority for changes to status, case type and start date. PostProc will force status to completed. *}
262 {if $activityTypeFile NEQ 'ChangeCaseStatus'
263 && $activityTypeFile NEQ 'ChangeCaseType'
264 && $activityTypeFile NEQ 'ChangeCaseStartDate'}
265 <tr class="crm-case-activity-form-block-status_id">
266 <td class="label">{$form.status_id.label}</td><td class="view-value">{$form.status_id.html}</td>
267 </tr>
268 <tr class="crm-case-activity-form-block-priority_id">
269 <td class="label">{$form.priority_id.label}</td><td class="view-value">{$form.priority_id.html}</td>
270 </tr>
271 {/if}
272 {if $form.tag.html}
273 <tr class="crm-case-activity-form-block-tag">
274 <td class="label">{$form.tag.label}</td>
275 <td class="view-value"><div class="crm-select-container">{$form.tag.html}</div>
276 {literal}
277 <script type="text/javascript">
278 cj(".crm-case-activity-form-block-tag select[multiple]").crmasmSelect({
279 addItemTarget: 'bottom',
280 animate: true,
281 highlight: true,
282 sortable: true,
283 respectParents: true
284 });
285 </script>
286 {/literal}
287
288 </td>
289 </tr>
290 {/if}
291 <tr class="crm-case-activity-form-block-tag_set"><td colspan="2">{include file="CRM/common/Tag.tpl" tagsetType='activity'}</td></tr>
292 </table>
293
294 {/if}
295
296 <div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="bottom"}</div>
297
298 {if $action eq 1 or $action eq 2}
299 {*include custom data js file*}
300 {include file="CRM/common/customData.tpl"}
301 {literal}
302 <script type="text/javascript">
303 cj(function() {
304 {/literal}
305 {if $customDataSubType}
306 CRM.buildCustomData( '{$customDataType}', {$customDataSubType} );
307 {else}
308 CRM.buildCustomData( '{$customDataType}' );
309 {/if}
310 {literal}
311 });
312 </script>
313 {/literal}
314 {/if}
315
316 {if $action neq 8 and $action neq 32768}
317 <script type="text/javascript">
318 {if $searchRows}
319 cj('#sendcopy').crmAccordionToggle();
320 {/if}
321
322 cj('#follow-up').crmAccordionToggle();
323 </script>
324 {/if}
325
326 {* include jscript to warn if unsaved form field changes *}
327 {include file="CRM/common/formNavigate.tpl"}
328
329 {if $action eq 2 or $action eq 1}
330 {literal}
331 <script type="text/javascript">
332 cj(function( ) {
333 cj('.crm-with-contact').click(function(){
334 cj('#with-contacts-widget').toggle();
335 cj('#with-clients').toggle();
336 });
337 });
338 </script>
339 {/literal}
340 {/if}
341 </div>
342 {/if} {* end of main if block*}