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