| 1 | {* |
| 2 | +--------------------------------------------------------------------+ |
| 3 | | CiviCRM version 4.5 | |
| 4 | +--------------------------------------------------------------------+ |
| 5 | | Copyright CiviCRM LLC (c) 2004-2014 | |
| 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 $activityTypeDescription } |
| 34 | <div class="help">{$activityTypeDescription}</div> |
| 35 | {/if} |
| 36 | <div class="crm-block crm-form-block crm-activity-form-block"> |
| 37 | {/if} |
| 38 | {* added onload javascript for source contact*} |
| 39 | {include file="CRM/Activity/Form/ActivityJs.tpl" tokenContext="activity"} |
| 40 | {if !$action or ( $action eq 1 ) or ( $action eq 2 ) } |
| 41 | <div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="top"}</div> |
| 42 | {/if} |
| 43 | |
| 44 | {if $action eq 8} {* Delete action. *} |
| 45 | <table class="form-layout"> |
| 46 | <tr> |
| 47 | <td colspan="2"> |
| 48 | <div class="status">{ts 1=$delName}Are you sure you want to delete '%1'?{/ts}</div> |
| 49 | </td> |
| 50 | </tr> |
| 51 | {elseif $action eq 1 or $action eq 2 or $action eq 4 or $context eq 'search' or $context eq 'smog'} |
| 52 | |
| 53 | <table class="{if $action eq 4}crm-info-panel{else}form-layout{/if}"> |
| 54 | |
| 55 | {if $action eq 4} |
| 56 | {if $activityTypeDescription } |
| 57 | <div class="help">{$activityTypeDescription}</div> |
| 58 | {/if} |
| 59 | {else} |
| 60 | {if $context eq 'standalone' or $context eq 'search' or $context eq 'smog'} |
| 61 | <tr class="crm-activity-form-block-activity_type_id"> |
| 62 | <td class="label">{$form.activity_type_id.label}</td><td class="view-value">{$form.activity_type_id.html}</td> |
| 63 | </tr> |
| 64 | {/if} |
| 65 | {/if} |
| 66 | |
| 67 | {if $surveyActivity} |
| 68 | <tr class="crm-activity-form-block-survey"> |
| 69 | <td class="label">{ts}Survey Title{/ts}</td><td class="view-value">{$surveyTitle}</td> |
| 70 | </tr> |
| 71 | {/if} |
| 72 | |
| 73 | <tr class="crm-activity-form-block-source_contact_id"> |
| 74 | <td class="label">{$form.source_contact_id.label}</td> |
| 75 | <td class="view-value"> |
| 76 | {$form.source_contact_id.html} |
| 77 | </td> |
| 78 | </tr> |
| 79 | |
| 80 | <tr class="crm-activity-form-block-target_contact_id"> |
| 81 | <td class="label">{$form.target_contact_id.label}</td> |
| 82 | <td class="view-value"> |
| 83 | {$form.target_contact_id.html} |
| 84 | {if $action eq 1 or $single eq false} |
| 85 | <br/> |
| 86 | {$form.is_multi_activity.html} {$form.is_multi_activity.label} {help id="id-is_multi_activity"} |
| 87 | {/if} |
| 88 | </td> |
| 89 | </tr> |
| 90 | |
| 91 | <tr class="crm-activity-form-block-assignee_contact_id"> |
| 92 | <td class="label"> |
| 93 | {$form.assignee_contact_id.label} |
| 94 | {edit}{help id="assignee_contact_id" title=$form.assignee_contact_id.label}{/edit} |
| 95 | </td> |
| 96 | <td> |
| 97 | {$form.assignee_contact_id.html} |
| 98 | {if $action neq 4} |
| 99 | <a href="#" class="crm-hover-button" id="swap_target_assignee" title="{ts}Swap Target and Assignee Contacts{/ts}" style="position:relative; bottom: 1em;"> |
| 100 | <span><div class="icon swap-icon"></div></span> |
| 101 | </a> |
| 102 | {if $activityAssigneeNotification} |
| 103 | <br /> |
| 104 | <span class="description"><span class="icon email-icon"></span>{ts}A copy of this activity will be emailed to each Assignee.{/ts}</span> |
| 105 | {/if} |
| 106 | {/if} |
| 107 | </td> |
| 108 | </tr> |
| 109 | |
| 110 | {if $activityTypeFile} |
| 111 | {include file="CRM/$crmDir/Form/Activity/$activityTypeFile.tpl"} |
| 112 | {/if} |
| 113 | |
| 114 | <tr class="crm-activity-form-block-subject"> |
| 115 | <td class="label">{$form.subject.label}</td><td class="view-value">{$form.subject.html|crmAddClass:huge}</td> |
| 116 | </tr> |
| 117 | |
| 118 | {* CRM-7362 --add campaign to activities *} |
| 119 | {include file="CRM/Campaign/Form/addCampaignToComponent.tpl" |
| 120 | campaignTrClass="crm-activity-form-block-campaign_id"} |
| 121 | |
| 122 | {* build engagement level CRM-7775 *} |
| 123 | {if $buildEngagementLevel} |
| 124 | <tr class="crm-activity-form-block-engagement_level"> |
| 125 | <td class="label">{$form.engagement_level.label}</td> |
| 126 | <td class="view-value">{$form.engagement_level.html}</td> |
| 127 | </tr> |
| 128 | {/if} |
| 129 | |
| 130 | <tr class="crm-activity-form-block-location"> |
| 131 | <td class="label">{$form.location.label}</td><td class="view-value">{$form.location.html|crmAddClass:huge}</td> |
| 132 | </tr> |
| 133 | <tr class="crm-activity-form-block-activity_date_time"> |
| 134 | <td class="label">{$form.activity_date_time.label}</td> |
| 135 | {if $action neq 4} |
| 136 | <td class="view-value">{include file="CRM/common/jcalendar.tpl" elementName=activity_date_time}</td> |
| 137 | {else} |
| 138 | <td class="view-value">{$form.activity_date_time.html|crmDate}</td> |
| 139 | {/if} |
| 140 | </tr> |
| 141 | <tr class="crm-activity-form-block-duration"> |
| 142 | <td class="label">{$form.duration.label}</td> |
| 143 | <td class="view-value"> |
| 144 | {$form.duration.html} |
| 145 | {if $action neq 4}<span class="description">{ts}minutes{/ts}{/if} |
| 146 | </td> |
| 147 | </tr> |
| 148 | <tr class="crm-activity-form-block-status_id"> |
| 149 | <td class="label">{$form.status_id.label}</td><td class="view-value">{$form.status_id.html}</td> |
| 150 | </tr> |
| 151 | <tr class="crm-activity-form-block-details"> |
| 152 | <td class="label">{$form.details.label}</td> |
| 153 | {if $activityTypeName eq "Print PDF Letter"} |
| 154 | <td class="view-value"> |
| 155 | {* If using plain textarea, assign class=huge to make input large enough. *} |
| 156 | {if $defaultWysiwygEditor eq 0}{$form.details.html|crmAddClass:huge}{else}{$form.details.html}{/if} |
| 157 | </td> |
| 158 | {else} |
| 159 | <td class="view-value"> |
| 160 | {* If using plain textarea, assign class=huge to make input large enough. *} |
| 161 | {if $defaultWysiwygEditor eq 0}{$form.details.html|crmStripAlternatives|crmAddClass:huge}{else}{$form.details.html|crmStripAlternatives}{/if} |
| 162 | </td> |
| 163 | {/if} |
| 164 | </tr> |
| 165 | <tr class="crm-activity-form-block-priority_id"> |
| 166 | <td class="label">{$form.priority_id.label}</td><td class="view-value">{$form.priority_id.html}</td> |
| 167 | </tr> |
| 168 | {if $surveyActivity } |
| 169 | <tr class="crm-activity-form-block-result"> |
| 170 | <td class="label">{$form.result.label}</td><td class="view-value">{$form.result.html}</td> |
| 171 | </tr> |
| 172 | {/if} |
| 173 | {if $form.tag.html} |
| 174 | <tr class="crm-activity-form-block-tag"> |
| 175 | <td class="label">{$form.tag.label}</td> |
| 176 | <td class="view-value"> |
| 177 | <div class="crm-select-container">{$form.tag.html}</div> |
| 178 | </td> |
| 179 | </tr> |
| 180 | {/if} |
| 181 | |
| 182 | {if $tagsetInfo.activity} |
| 183 | <tr class="crm-activity-form-block-tag_set">{include file="CRM/common/Tagset.tpl" tagsetType='activity' tableLayout=true}</tr> |
| 184 | {/if} |
| 185 | |
| 186 | {if $action neq 4 OR $viewCustomData} |
| 187 | <tr class="crm-activity-form-block-custom_data"> |
| 188 | <td colspan="2"> |
| 189 | {if $action eq 4} |
| 190 | {include file="CRM/Custom/Page/CustomDataView.tpl"} |
| 191 | {else} |
| 192 | <div id="customData"></div> |
| 193 | {/if} |
| 194 | </td> |
| 195 | </tr> |
| 196 | {/if} |
| 197 | |
| 198 | {if $action eq 4 AND $currentAttachmentInfo} |
| 199 | {include file="CRM/Form/attachment.tpl"}{* For view action the include provides the row and cells. *} |
| 200 | {elseif $action eq 1 OR $action eq 2} |
| 201 | <tr class="crm-activity-form-block-attachment"> |
| 202 | <td colspan="2"> |
| 203 | {include file="CRM/Form/attachment.tpl"} |
| 204 | </td> |
| 205 | </tr> |
| 206 | {/if} |
| 207 | |
| 208 | {if $action neq 4} {* Don't include "Schedule Follow-up" section in View mode. *} |
| 209 | <tr class="crm-activity-form-block-schedule_followup"> |
| 210 | <td colspan="2"> |
| 211 | <div class="crm-accordion-wrapper collapsed"> |
| 212 | <div class="crm-accordion-header"> |
| 213 | {ts}Schedule Follow-up{/ts} |
| 214 | </div><!-- /.crm-accordion-header --> |
| 215 | <div class="crm-accordion-body"> |
| 216 | <table class="form-layout-compressed"> |
| 217 | <tr><td class="label">{ts}Schedule Follow-up Activity{/ts}</td> |
| 218 | <td>{$form.followup_activity_type_id.html} {ts}on{/ts} |
| 219 | {include file="CRM/common/jcalendar.tpl" elementName=followup_date} |
| 220 | </td> |
| 221 | </tr> |
| 222 | <tr> |
| 223 | <td class="label">{$form.followup_activity_subject.label}</td> |
| 224 | <td>{$form.followup_activity_subject.html|crmAddClass:huge}</td> |
| 225 | </tr> |
| 226 | <tr> |
| 227 | <td class="label"> |
| 228 | {$form.followup_assignee_contact_id.label} |
| 229 | {edit} |
| 230 | {/edit} |
| 231 | </td> |
| 232 | <td> |
| 233 | {$form.followup_assignee_contact_id.html} |
| 234 | </td> |
| 235 | </tr> |
| 236 | </table> |
| 237 | </div><!-- /.crm-accordion-body --> |
| 238 | </div><!-- /.crm-accordion-wrapper --> |
| 239 | {literal} |
| 240 | <script type="text/javascript"> |
| 241 | CRM.$(function($) { |
| 242 | cj('.crm-accordion-body').each( function() { |
| 243 | //open tab if form rule throws error |
| 244 | if ( cj(this).children( ).find('span.crm-error').text( ).length > 0 ) { |
| 245 | cj(this).parent('.collapsed').crmAccordionToggle(); |
| 246 | } |
| 247 | }); |
| 248 | $('#swap_target_assignee').click(function() { |
| 249 | var assignees = $('#assignee_contact_id').select2("data"); |
| 250 | var targets = $('#target_contact_id').select2("data"); |
| 251 | $('#assignee_contact_id').select2("data", targets); |
| 252 | $('#target_contact_id').select2("data", assignees); |
| 253 | return false; |
| 254 | }); |
| 255 | }); |
| 256 | </script> |
| 257 | {/literal} |
| 258 | </td> |
| 259 | </tr> |
| 260 | {/if} |
| 261 | {/if} {* End Delete vs. Add / Edit action *} |
| 262 | </table> |
| 263 | <div class="crm-submit-buttons"> |
| 264 | {if $action eq 4 && $activityTName neq 'Inbound Email'} |
| 265 | {if !$context } |
| 266 | {assign var="context" value='activity'} |
| 267 | {/if} |
| 268 | {if $permission EQ 'edit'} |
| 269 | {assign var='urlParams' value="reset=1&atype=$atype&action=update&reset=1&id=$entityID&cid=$contactId&context=$context"} |
| 270 | {if ($context eq 'fulltext' || $context eq 'search') && $searchKey} |
| 271 | {assign var='urlParams' value="reset=1&atype=$atype&action=update&reset=1&id=$entityID&cid=$contactId&context=$context&key=$searchKey"} |
| 272 | {/if} |
| 273 | <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> |
| 274 | {/if} |
| 275 | |
| 276 | {if call_user_func(array('CRM_Core_Permission','check'), 'delete activities')} |
| 277 | {assign var='urlParams' value="reset=1&atype=$atype&action=delete&reset=1&id=$entityID&cid=$contactId&context=$context"} |
| 278 | {if ($context eq 'fulltext' || $context eq 'search') && $searchKey} |
| 279 | {assign var='urlParams' value="reset=1&atype=$atype&action=delete&reset=1&id=$entityID&cid=$contactId&context=$context&key=$searchKey"} |
| 280 | {/if} |
| 281 | <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> |
| 282 | {/if} |
| 283 | {/if} |
| 284 | {include file="CRM/common/formButtons.tpl" location="bottom"} |
| 285 | </div> |
| 286 | |
| 287 | {include file="CRM/Case/Form/ActivityToCase.tpl"} |
| 288 | |
| 289 | {if $action eq 1 or $action eq 2 or $context eq 'search' or $context eq 'smog'} |
| 290 | {*include custom data js file*} |
| 291 | {include file="CRM/common/customData.tpl"} |
| 292 | {literal} |
| 293 | <script type="text/javascript"> |
| 294 | CRM.$(function($) { |
| 295 | {/literal} |
| 296 | {if $customDataSubType} |
| 297 | CRM.buildCustomData( '{$customDataType}', {$customDataSubType} ); |
| 298 | {else} |
| 299 | CRM.buildCustomData( '{$customDataType}' ); |
| 300 | {/if} |
| 301 | {literal} |
| 302 | }); |
| 303 | </script> |
| 304 | {/literal} |
| 305 | {/if} |
| 306 | </div>{* end of form block*} |
| 307 | {/if} {* end of snippet if*} |