Commit | Line | Data |
---|---|---|
6a488035 TO |
1 | {* |
2 | +--------------------------------------------------------------------+ | |
232624b1 | 3 | | CiviCRM version 4.4 | |
6a488035 TO |
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 | *} | |
6a488035 | 26 | <div class="view-content"> |
559865a0 | 27 | {if $groupCount eq 0} |
13d0ffc3 KJ |
28 | <div class="messages status no-popup"> |
29 | <div class="icon inform-icon"></div> | |
30 | {ts}This contact does not currently belong to any groups.{/ts} | |
31 | </div> | |
32 | {/if} | |
6a488035 | 33 | |
13d0ffc3 | 34 | {include file="CRM/common/jsortable.tpl"} |
6a488035 | 35 | |
13d0ffc3 KJ |
36 | {* Include 'add to new group' form if session has edit contact permissions *} |
37 | {if $permission EQ 'edit'} | |
38 | {include file="CRM/Contact/Form/GroupContact.tpl"} | |
39 | {/if} | |
6a488035 | 40 | |
13d0ffc3 KJ |
41 | {if $groupIn } |
42 | <div class="ht-one"></div> | |
43 | <h3>{ts}Regular Groups{/ts}</h3> | |
44 | <div class="description">{ts 1=$displayName}%1 has joined or been added to these group(s).{/ts}</div> | |
45 | {strip} | |
46 | <table id="current_group" class="display"> | |
47 | <thead> | |
6a488035 | 48 | <tr> |
13d0ffc3 KJ |
49 | <th>{ts}Group{/ts}</th> |
50 | <th>{ts}Status{/ts}</th> | |
51 | <th>{ts}Date Added{/ts}</th> | |
52 | <th></th> | |
6a488035 | 53 | </tr> |
13d0ffc3 KJ |
54 | </thead> |
55 | {foreach from=$groupIn item=row} | |
56 | <tr id="grp_{$row.id}" class="{cycle values="odd-row,even-row"}"> | |
57 | <td class="bold"> | |
58 | <a href="{crmURL p='civicrm/group/search' q="reset=1&force=1&context=smog&gid=`$row.group_id`"}"> | |
59 | {$row.title} | |
60 | </a> | |
61 | </td> | |
62 | <td>{ts 1=$row.in_method}Added (by %1){/ts}</td> | |
63 | <td>{$row.in_date|crmDate}</td> | |
64 | <td> | |
65 | {if $permission EQ 'edit'} | |
66 | <a href="{crmURL p='civicrm/contact/view/group' q="gcid=`$row.id`&action=delete&st=o"}" | |
67 | onclick="return confirm('{ts 1=$displayName 2=$row.title}Are you sure you want to remove %1 from %2?{/ts}');" | |
68 | title="{ts}Remove contact from this group (status in this group will be changed to 'Removed').{/ts}"> | |
69 | [ {ts}Remove{/ts} ]</a> | |
70 | {/if} | |
71 | {if $permission EQ 'edit'} | |
72 | <a href="{crmURL p='civicrm/contact/view/group' q="gcid=`$row.id`&action=delete&st=d"}" | |
73 | onclick="return confirm('{ts 1=$displayName 2=$row.title}Are you sure you want to delete %1 from %2?{/ts}');" | |
74 | title="{ts}Remove contact from this group AND delete their group status record.{/ts}">[ {ts}Delete{/ts} | |
75 | ]</a> | |
76 | {/if} | |
77 | </td> | |
78 | </tr> | |
79 | {/foreach} | |
80 | </table> | |
81 | {/strip} | |
82 | {/if} | |
6a488035 | 83 | |
559865a0 KJ |
84 | {if $contactSmartGroupSettings neq 3} |
85 | <div class="accordion ui-accordion ui-widget ui-helper-reset"> | |
86 | <div class="crm-accordion-wrapper crm-ajax-accordion crm-smartgroup-accordion {if $contactSmartGroupSettings eq 1}collapsed{/if}"> | |
87 | <div class="crm-accordion-header" id="crm-contact_smartgroup" contact_id="{$contactId}"> | |
88 | {ts}Smart Groups{/ts} | |
89 | </div> | |
90 | <!-- /.crm-accordion-header --> | |
91 | <div class="crm-accordion-body"> | |
92 | <div class="crm-contact_smartgroup"></div> | |
93 | </div> | |
94 | <!-- /.crm-accordion-body --> | |
95 | </div> | |
96 | <!-- /.crm-accordion-wrapper --> | |
97 | </div> | |
98 | {/if} | |
6a488035 | 99 | |
926dcf00 | 100 | {if $groupPending} |
13d0ffc3 KJ |
101 | <div class="ht-one"></div> |
102 | <h3 class="status-pending">{ts}Pending{/ts}</h3> | |
103 | <div class="description">{ts}Joining these group(s) is pending confirmation by this contact.{/ts}</div> | |
104 | {strip} | |
105 | <table id="pending_group" class="display"> | |
106 | <thead> | |
107 | <tr> | |
108 | <th>{ts}Group{/ts}</th> | |
109 | <th>{ts}Status{/ts}</th> | |
110 | <th>{ts}Date Pending{/ts}</th> | |
111 | <th></th> | |
112 | </tr> | |
113 | </thead> | |
114 | {foreach from=$groupPending item=row} | |
115 | <tr class="{cycle values="odd-row,even-row"}"> | |
116 | <td class="bold"> | |
117 | <a href="{crmURL p='civicrm/group/search' q="reset=1&force=1&context=smog&gid=`$row.group_id`"}"> | |
118 | {$row.title} | |
119 | </a> | |
120 | </td> | |
6a488035 TO |
121 | <td>{ts 1=$row.pending_method}Pending (by %1){/ts}</td> |
122 | <td>{$row.pending_date|crmDate}</td> | |
13d0ffc3 KJ |
123 | <td> |
124 | {if $permission EQ 'edit'} | |
125 | <a href="{crmURL p='civicrm/contact/view/group' q="gcid=`$row.id`&action=delete&st=o"}" | |
126 | onclick="return confirm('{ts 1=$displayName 2=$row.title}Are you sure you want to remove %1 from %2?{/ts}');" | |
127 | title="{ts}Remove contact from this group (status in this group will be changed to 'Removed').{/ts}"> | |
128 | [ {ts}Remove{/ts} ]</a> | |
129 | {/if} | |
130 | {if $permission EQ 'edit'} | |
131 | <a href="{crmURL p='civicrm/contact/view/group' q="gcid=`$row.id`&action=delete&st=d"}" | |
132 | onclick="return confirm('{ts 1=$displayName 2=$row.title}Are you sure you want to delete %1 from %2?{/ts}');" | |
133 | title="{ts}Delete the group status record (this group will no longer be listed under Pending Groups).{/ts}"> | |
134 | [ {ts}Delete{/ts} ]</a> | |
135 | {/if} | |
6a488035 | 136 | </td> |
13d0ffc3 KJ |
137 | </tr> |
138 | {/foreach} | |
139 | </table> | |
140 | {/strip} | |
141 | {/if} | |
6a488035 | 142 | |
13d0ffc3 KJ |
143 | {if $groupOut} |
144 | <div class="ht-one"></div> | |
145 | <h3 class="status-removed">{ts}Past Groups{/ts}</h3> | |
6a488035 TO |
146 | <div class="description">{ts 1=$displayName}%1 is no longer part of these group(s).{/ts}</div> |
147 | {strip} | |
13d0ffc3 KJ |
148 | <table id="past_group" class="display"> |
149 | <thead> | |
150 | <tr> | |
151 | <th>{ts}Group{/ts}</th> | |
152 | <th>{ts}Status{/ts}</th> | |
153 | <th>{ts}Date Added{/ts}</th> | |
154 | <th>{ts}Date Removed{/ts}</th> | |
155 | <th></th> | |
156 | </tr> | |
157 | </thead> | |
158 | {foreach from=$groupOut item=row} | |
159 | <tr class="{cycle values="odd-row,even-row"}"> | |
160 | <td class="bold"> | |
161 | <a href="{crmURL p='civicrm/group/search' q="reset=1&force=1&context=smog&gid=`$row.group_id`"}"> | |
162 | {$row.title} | |
163 | </a> | |
164 | </td> | |
165 | <td class="status-removed">{ts 1=$row.out_method}Removed (by %1){/ts}</td> | |
6a488035 TO |
166 | <td>{$row.date_added|crmDate}</td> |
167 | <td>{$row.out_date|crmDate}</td> | |
13d0ffc3 KJ |
168 | <td>{if $permission EQ 'edit'} |
169 | <a href="{crmURL p='civicrm/contact/view/group' q="gcid=`$row.id`&action=delete&st=i"}" | |
170 | onclick="return confirm('{ts 1=$displayName 2=$row.title}Are you sure you want to add %1 back into %2?{/ts}');"> | |
171 | [ {ts}Rejoin Group{/ts} ]</a>{/if} | |
172 | {if $permission EQ 'edit'} | |
173 | <a href="{crmURL p='civicrm/contact/view/group' q="gcid=`$row.id`&action=delete&st=d"}" | |
174 | onclick="return confirm('{ts 1=$displayName 2=$row.title}Are you sure you want to delete %1 from %2?{/ts}');" | |
175 | title="{ts}Delete the group status record (this group will no longer be listed under Past Groups).{/ts}"> | |
176 | [ {ts}Delete{/ts} ]</a>{/if} | |
177 | </td> | |
178 | </tr> | |
179 | {/foreach} | |
180 | </table> | |
181 | {/strip} | |
6a488035 | 182 | {/if} |
559865a0 KJ |
183 | </div> |
184 | ||
185 | ||
186 | {literal} | |
187 | <script type="text/javascript"> | |
188 | // bind first click of accordion header to load crm-accordion-body with snippet | |
189 | // everything else taken care of by cj().crm-accordions() | |
190 | cj(function () { | |
191 | cj('.crm-ajax-accordion .crm-accordion-header').one('click', function () { | |
192 | loadPanes(cj(this)); | |
193 | }); | |
194 | cj('.crm-ajax-accordion:not(.collapsed) .crm-accordion-header').each(function (index) { | |
195 | loadPanes(cj(this)); | |
196 | }); | |
197 | }); | |
198 | ||
199 | // load panes function calls for snippet based on id of crm-accordion-header | |
200 | function loadPanes(paneObj) { | |
201 | var id = paneObj.attr('id'); | |
202 | var contactId = paneObj.attr('contact_id'); | |
203 | ||
204 | var dataUrl = CRM.url('civicrm/contact/view/smartgroup', 'snippet=4&cid=' + contactId); | |
205 | ||
206 | if (!cj('div.' + id).html()) { | |
207 | var loading = '<img src="{/literal}{$config->resourceBase}i/loading.gif{literal}" alt="{/literal}{ts escape='js'}loading{/ts}{literal}" /> {/literal}{ts escape='js'}Loading{/ts}{literal}...'; | |
208 | cj('div.' + id).html(loading); | |
209 | cj.ajax({ | |
210 | url: dataUrl, | |
211 | success: function (data) { | |
212 | cj('div.' + id).html(data); | |
213 | } | |
214 | }); | |
215 | } | |
216 | } | |
217 | </script> | |
232624b1 | 218 | {/literal} |