Merge pull request #1035 from GiantRobot/CRM-12720
[civicrm-core.git] / templates / CRM / Contact / Page / View / Summary.tpl
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 {* Contact Summary template for new tabbed interface. Replaces Basic.tpl *}
27 {if $action eq 2}
28 {include file="CRM/Contact/Form/Contact.tpl"}
29 {else}
30
31 {include file="CRM/common/wysiwyg.tpl" includeWysiwygEditor=true}
32
33 {* include overlay js *}
34 {include file="CRM/common/overlay.tpl"}
35
36 <div class="crm-summary-contactname-block crm-inline-edit-container">
37 <div class="crm-summary-block" id="contactname-block">
38 {include file="CRM/Contact/Page/Inline/ContactName.tpl"}
39 </div>
40 </div>
41
42 <div class="crm-actions-ribbon">
43 <ul id="actions">
44 {assign var='urlParams' value="reset=1"}
45 {if $searchKey}
46 {assign var='urlParams' value=$urlParams|cat:"&key=$searchKey"}
47 {/if}
48 {if $context}
49 {assign var='urlParams' value=$urlParams|cat:"&context=$context"}
50 {/if}
51
52 {* CRM-12735 - Conditionally include the Actions and Edit buttons if contact is NOT in trash.*}
53 {if !$isDeleted}
54 {if call_user_func(array('CRM_Core_Permission','check'), 'access CiviCRM')}
55 <li class="crm-contact-activity crm-summary-block">
56 {include file="CRM/Contact/Page/Inline/Actions.tpl"}
57 </li>
58 {/if}
59 {* Include Edit button if contact has 'edit contacts' permission OR user is viewing their own contact AND has 'edit my contact' permission. *}
60 {if $permission EQ 'edit' && call_user_func(array('CRM_Core_Permission','check'), 'edit my contact')}
61 <li>
62 {assign var='editParams' value=$urlParams|cat:"&action=update&cid=$contactId"}
63 <a href="{crmURL p='civicrm/contact/add' q=$editParams}" class="edit button" title="{ts}Edit{/ts}">
64 <span><div class="icon edit-icon"></div>{ts}Edit{/ts}</span>
65 </a>
66 </li>
67 {/if}
68 {/if}
69
70 {* Check for permissions to provide Restore and Delete Permanently buttons for contacts that are in the trash. *}
71 {if (call_user_func(array('CRM_Core_Permission','check'), 'access deleted contacts') and
72 $is_deleted)}
73 <li class="crm-contact-restore">
74 <a href="{crmURL p='civicrm/contact/view/delete' q="reset=1&cid=$contactId&restore=1"}" class="delete button" title="{ts}Restore{/ts}">
75 <span><div class="icon restore-icon"></div>{ts}Restore from Trash{/ts}</span>
76 </a>
77 </li>
78
79 {if call_user_func(array('CRM_Core_Permission','check'), 'delete contacts')}
80 <li class="crm-contact-permanently-delete">
81 <a href="{crmURL p='civicrm/contact/view/delete' q="reset=1&delete=1&cid=$contactId&skip_undelete=1"}" class="delete button" title="{ts}Delete Permanently{/ts}">
82 <span><div class="icon delete-icon"></div>{ts}Delete Permanently{/ts}</span>
83 </a>
84 </li>
85 {/if}
86
87 {elseif call_user_func(array('CRM_Core_Permission','check'), 'delete contacts')}
88 {assign var='deleteParams' value="&reset=1&delete=1&cid=$contactId"}
89 <li class="crm-delete-action crm-contact-delete">
90 <a href="{crmURL p='civicrm/contact/view/delete' q=$deleteParams}" class="delete button" title="{ts}Delete{/ts}">
91 <span><div class="icon delete-icon"></div>{ts}Delete Contact{/ts}</span>
92 </a>
93 </li>
94 {/if}
95
96 {* Previous and Next contact navigation when accessing contact summary from search results. *}
97 {if $nextPrevError}
98 <li class="crm-next-action">
99 {help id="id-next-prev-buttons"}&nbsp;
100 </li>
101 {else}
102 {if $nextContactID}
103 {assign var='viewParams' value=$urlParams|cat:"&cid=$nextContactID"}
104 <li class="crm-next-action">
105 <a href="{crmURL p='civicrm/contact/view' q=$viewParams}" class="view button" title="{$nextContactName}">
106 <span title="{$nextContactName}"><div class="icon next-icon"></div>{ts}Next{/ts}</span>
107 </a>
108 </li>
109 {/if}
110 {if $prevContactID}
111 {assign var='viewParams' value=$urlParams|cat:"&cid=$prevContactID"}
112 <li class="crm-previous-action">
113 <a href="{crmURL p='civicrm/contact/view' q=$viewParams}" class="view button" title="{$prevContactName}">
114 <span title="{$prevContactName}"><div class="icon previous-icon"></div>{ts}Previous{/ts}</span>
115 </a>
116 </li>
117 {/if}
118 {/if}
119
120
121 {if !empty($groupOrganizationUrl)}
122 <li class="crm-contact-associated-groups">
123 <a href="{$groupOrganizationUrl}" class="associated-groups button" title="{ts}Associated Multi-Org Group{/ts}">
124 <span><div class="icon associated-groups-icon"></div>{ts}Associated Multi-Org Group{/ts}</span>
125 </a>
126 </li>
127 {/if}
128 </ul>
129 <div class="clear"></div>
130 </div><!-- .crm-actions-ribbon -->
131
132 <div class="crm-block crm-content-block crm-contact-page crm-inline-edit-container">
133 <div id="mainTabContainer" class="ui-tabs ui-widget ui-widget-content ui-corner-all">
134 <ul class="crm-contact-tabs-list">
135 <li id="tab_summary" class="crm-tab-button">
136 <a href="#contact-summary" title="{ts}Summary{/ts}">
137 <span> </span> {ts}Summary{/ts}
138 <em>&nbsp;</em>
139 </a>
140 </li>
141 {foreach from=$allTabs key=tabName item=tabValue}
142 <li id="tab_{$tabValue.id}" class="crm-tab-button crm-count-{$tabValue.count}">
143 <a href="{$tabValue.url}" title="{$tabValue.title}">
144 <span> </span> {$tabValue.title}
145 <em>{$tabValue.count}</em>
146 </a>
147 </li>
148 {/foreach}
149 </ul>
150
151 <div id="contact-summary" class="ui-tabs-panel ui-widget-content ui-corner-bottom">
152 {if (isset($hookContentPlacement) and ($hookContentPlacement neq 3)) or empty($hookContentPlacement)}
153
154 {if !empty($hookContent) and isset($hookContentPlacement) and $hookContentPlacement eq 2}
155 {include file="CRM/Contact/Page/View/SummaryHook.tpl"}
156 {/if}
157
158 <div class="contactTopBar contact_panel">
159 <div class="contactCardLeft">
160 <div class="crm-summary-contactinfo-block">
161 <div class="crm-summary-block" id="contactinfo-block">
162 {include file="CRM/Contact/Page/Inline/ContactInfo.tpl"}
163 </div>
164 </div>
165 </div> <!-- end of left side -->
166 <div class="contactCardRight">
167 {if !empty($imageURL)}
168 <div id="crm-contact-thumbnail">
169 {include file="CRM/Contact/Page/ContactImage.tpl"}
170 </div>
171 {/if}
172 <div class="{if !empty($imageURL)} float-left{/if}">
173 <div class="crm-clear crm-summary-block">
174 <div class="crm-summary-row">
175 <div class="crm-label" id="tagLink">
176 <a href="{crmURL p='civicrm/contact/view' q="reset=1&cid=$contactId&selectedChild=tag"}" title="{ts}Edit Tags{/ts}">{ts}Tags{/ts}</a>
177 </div>
178 <div class="crm-content" id="tags">{$contactTag}</div>
179 </div>
180 <div class="crm-summary-row">
181 <div class="crm-label">{ts}Contact Type{/ts}</div>
182 <div class="crm-content crm-contact_type_label">
183 {if isset($contact_type_label)}{$contact_type_label}{/if}
184 </div>
185 </div>
186
187 <div class="crm-summary-row">
188 <div class="crm-label">
189 {ts}CiviCRM ID{/ts}{if !empty($userRecordUrl)} / {ts}User ID{/ts}{/if}
190 </div>
191 <div class="crm-content">
192 <span class="crm-contact-contact_id">{$contactId}</span>
193 {if !empty($userRecordUrl)}
194 <span class="crm-contact-user_record_id">
195 &nbsp;/&nbsp;<a title="View user record" class="user-record-link" href="{$userRecordUrl}">{$userRecordId}</a>
196 </span>
197 {/if}
198 </div>
199 </div>
200 </div>
201 </div>
202
203 </div> <!-- end of right side -->
204 </div>
205 <div class="contact_details">
206 <div class="contact_panel">
207 <div class="contactCardLeft">
208 <div >
209 {if $showEmail}
210 <div class="crm-summary-email-block crm-summary-block" id="email-block">
211 {include file="CRM/Contact/Page/Inline/Email.tpl"}
212 </div>
213 {/if}
214 {if $showWebsite}
215 <div class="crm-summary-website-block crm-summary-block" id="website-block">
216 {include file="CRM/Contact/Page/Inline/Website.tpl"}
217 </div>
218 {/if}
219 </div>
220 </div><!-- #contactCardLeft -->
221
222 <div class="contactCardRight">
223 <div >
224 {if $showPhone}
225 <div class="crm-summary-phone-block crm-summary-block" id="phone-block">
226 {include file="CRM/Contact/Page/Inline/Phone.tpl"}
227 </div>
228 {/if}
229 {if $showIM}
230 <div class="crm-summary-im-block crm-summary-block" id="im-block">
231 {include file="CRM/Contact/Page/Inline/IM.tpl"}
232 </div>
233 {/if}
234 {if $showOpenID}
235 <div class="crm-summary-openid-block crm-summary-block" id="openid-block">
236 {include file="CRM/Contact/Page/Inline/OpenID.tpl"}
237 </div>
238 {/if}
239 </div>
240 </div><!-- #contactCardRight -->
241
242 <div class="clear"></div>
243 </div><!-- #contact_panel -->
244 {if $showAddress}
245 <div class="contact_panel">
246 {assign var='locationIndex' value=1}
247 {if $address}
248 {foreach from=$address item=add key=locationIndex}
249 <div class="{if $locationIndex is odd}contactCardLeft{else}contactCardRight{/if} crm-address_{$locationIndex} crm-address-block crm-summary-block">
250 {include file="CRM/Contact/Page/Inline/Address.tpl"}
251 </div>
252 {/foreach}
253 {assign var='locationIndex' value=$locationIndex+1}
254 {/if}
255 {* add new link *}
256 {if $permission EQ 'edit'}
257 {assign var='add' value=0}
258 <div class="{if $locationIndex is odd}contactCardLeft{else}contactCardRight{/if} crm-address-block crm-summary-block">
259 {include file="CRM/Contact/Page/Inline/Address.tpl"}
260 </div>
261 {/if}
262
263 </div> <!-- end of contact panel -->
264 {/if}
265 <div class="contact_panel">
266 {if $showCommunicationPreferences}
267 <div class="contactCardLeft">
268 <div class="crm-summary-comm-pref-block">
269 <div class="crm-summary-block" id="communication-pref-block" >
270 {include file="CRM/Contact/Page/Inline/CommunicationPreferences.tpl"}
271 </div>
272 </div>
273 </div> <!-- contactCardLeft -->
274 {/if}
275 {if $contact_type eq 'Individual' AND $showDemographics}
276 <div class="contactCardRight">
277 <div class="crm-summary-demographic-block">
278 <div class="crm-summary-block" id="demographic-block">
279 {include file="CRM/Contact/Page/Inline/Demographics.tpl"}
280 </div>
281 </div>
282 </div> <!-- contactCardRight -->
283 {/if}
284 <div class="clear"></div>
285 <div class="separator"></div>
286 </div> <!-- contact panel -->
287 </div><!--contact_details-->
288
289 {if $showCustomData}
290 <div id="customFields">
291 <div class="contact_panel">
292 <div class="contactCardLeft">
293 {include file="CRM/Contact/Page/View/CustomDataView.tpl" side='1'}
294 </div><!--contactCardLeft-->
295
296 <div class="contactCardRight">
297 {include file="CRM/Contact/Page/View/CustomDataView.tpl" side='0'}
298 </div>
299
300 <div class="clear"></div>
301 </div>
302 </div>
303 {/if}
304
305 {if !empty($hookContent) and isset($hookContentPlacement) and $hookContentPlacement eq 1}
306 {include file="CRM/Contact/Page/View/SummaryHook.tpl"}
307 {/if}
308 {else}
309 {include file="CRM/Contact/Page/View/SummaryHook.tpl"}
310 {/if}
311 </div>
312 <div class="clear"></div>
313 </div>
314 <div class="clear"></div>
315 </div><!-- /.crm-content-block -->
316
317 <script type="text/javascript">
318 {literal}
319 cj(function($) {
320 //explicitly stop spinner
321 function stopSpinner( ) {
322 $('li.crm-tab-button span').text(' ');
323 }
324 {/literal}
325 var selectedTab = '{if !empty($selectedChild)}{$selectedChild}{else}summary{/if}';
326 var tabIndex = $('#tab_' + selectedTab).prevAll().length;
327 var spinnerImage = '<img src="{$config->resourceBase}i/loading.gif" style="width:10px;height:10px"/>';
328 {literal}
329 $("#mainTabContainer").tabs({ selected: tabIndex, spinner: spinnerImage, cache: true, load: stopSpinner});
330 $(".crm-tab-button").addClass("ui-corner-bottom");
331 $().crmAccordions();
332
333 $('body').click(function() {
334 cj('#crm-contact-actions-list').hide();
335 });
336 });
337 {/literal}
338 </script>
339 {/if}
340
341 {* CRM-10560 *}
342 {literal}
343 <script type="text/javascript">
344 cj(document).ready(function($) {
345 $('.crm-inline-edit-container').crmFormContactLock({
346 ignoreLabel: "{/literal}{ts escape='js'}Ignore{/ts}{literal}",
347 saveAnywayLabel: "{/literal}{ts escape='js'}Save Anyway{/ts}{literal}",
348 reloadLabel: "{/literal}{ts escape='js'}Reload Page{/ts}{literal}"
349 });
350 });
351 </script>
352 {/literal}
353
354 {* jQuery validate *}
355 {include file="CRM/Form/validate.tpl" form=0}