commiting uncommited changes on live site
[weblabels.fsf.org.git] / crm.fsf.org / 20131203 / files / sites / all / modules-old / civicrm / templates / CRM / Contact / Page / View / GroupContact.tpl
1 {*
2 +--------------------------------------------------------------------+
3 | CiviCRM version 4.6 |
4 +--------------------------------------------------------------------+
5 | Copyright CiviCRM LLC (c) 2004-2015 |
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 <div class="view-content view-contact-groups">
27 {if $groupCount eq 0}
28 <div class="messages status no-popup">
29 <div class="icon inform-icon"></div>
30 &nbsp;{ts}This contact does not currently belong to any groups.{/ts}
31 </div>
32 {else}
33 {include file="CRM/common/jsortable.tpl"}
34 {/if}
35
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}
40
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>
48 <tr>
49 <th>{ts}Group{/ts}</th>
50 <th>{ts}Status{/ts}</th>
51 <th>{ts}Date Added{/ts}</th>
52 <th></th>
53 </tr>
54 </thead>
55 {foreach from=$groupIn item=row}
56 <tr id="group_contact-{$row.id}" class="crm-entity {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 class="action-item crm-hover-button" href="#Removed" title="{ts 1=$displayName 2=$row.title}Remove %1 from %2? (status in this group will be changed to 'Removed').{/ts}">
67 {ts}Remove{/ts}</a>
68 <a class="action-item crm-hover-button" href="#Deleted" title="{ts 1=$displayName 2=$row.title}Delete %1 from %2? (remove contact AND delete their record of having been in this group).{/ts}">
69 {ts}Delete{/ts}</a>
70 {/if}
71 </td>
72 </tr>
73 {/foreach}
74 </table>
75 {/strip}
76 {/if}
77
78 {if $contactSmartGroupSettings neq 3}
79 <div class="spacer" style="height: 1.5em;"></div>
80 <div class="accordion ui-accordion ui-widget ui-helper-reset">
81 <div class="crm-accordion-wrapper crm-ajax-accordion crm-smartgroup-accordion {if $contactSmartGroupSettings eq 1}collapsed{/if}">
82 <div class="crm-accordion-header" id="crm-contact_smartgroup" contact_id="{$contactId}">
83 {ts}Smart Groups{/ts}
84 </div>
85 <!-- /.crm-accordion-header -->
86 <div class="crm-accordion-body">
87 <div class="crm-contact_smartgroup" style="min-height: 3em;"></div>
88 </div>
89 <!-- /.crm-accordion-body -->
90 </div>
91 <!-- /.crm-accordion-wrapper -->
92 </div>
93 {/if}
94
95 {if $groupPending}
96 <div class="ht-one"></div>
97 <h3 class="status-pending">{ts}Pending{/ts}</h3>
98 <div class="description">{ts}Joining these group(s) is pending confirmation by this contact.{/ts}</div>
99 {strip}
100 <table id="pending_group" class="display">
101 <thead>
102 <tr>
103 <th>{ts}Group{/ts}</th>
104 <th>{ts}Status{/ts}</th>
105 <th>{ts}Date Pending{/ts}</th>
106 <th></th>
107 </tr>
108 </thead>
109 {foreach from=$groupPending item=row}
110 <tr id="group_contact-{$row.id}" class="crm-entity {cycle values="odd-row,even-row"}">
111 <td class="bold">
112 <a href="{crmURL p='civicrm/group/search' q="reset=1&force=1&context=smog&gid=`$row.group_id`"}">
113 {$row.title}
114 </a>
115 </td>
116 <td>{ts 1=$row.pending_method}Pending (by %1){/ts}</td>
117 <td>{$row.pending_date|crmDate}</td>
118 <td>
119 {if $permission EQ 'edit'}
120 <a class="action-item crm-hover-button" href="#Removed" title="{ts 1=$displayName 2=$row.title}Remove %1 from %2? (status in this group will be changed to 'Removed').{/ts}">
121 {ts}Remove{/ts}</a>
122 <a class="action-item crm-hover-button" href="#Deleted" title="{ts 1=$displayName 2=$row.title}Delete %1 from %2? (this group will no longer be listed under Pending Groups){/ts}">
123 {ts}Delete{/ts}</a>
124 {/if}
125 </td>
126 </tr>
127 {/foreach}
128 </table>
129 {/strip}
130 {/if}
131
132 {if $groupOut}
133 <div class="ht-one"></div>
134 <h3 class="status-removed">{ts}Past Groups{/ts}</h3>
135 <div class="description">{ts 1=$displayName}%1 is no longer part of these group(s).{/ts}</div>
136 {strip}
137 <table id="past_group" class="display">
138 <thead>
139 <tr>
140 <th>{ts}Group{/ts}</th>
141 <th>{ts}Status{/ts}</th>
142 <th>{ts}Date Added{/ts}</th>
143 <th>{ts}Date Removed{/ts}</th>
144 <th></th>
145 </tr>
146 </thead>
147 {foreach from=$groupOut item=row}
148 <tr id="group_contact-{$row.id}" class="crm-entity {cycle values="odd-row,even-row"}">
149 <td class="bold">
150 <a href="{crmURL p='civicrm/group/search' q="reset=1&force=1&context=smog&gid=`$row.group_id`"}">
151 {$row.title}
152 </a>
153 </td>
154 <td class="status-removed">{ts 1=$row.out_method}Removed (by %1){/ts}</td>
155 <td>{$row.date_added|crmDate}</td>
156 <td>{$row.out_date|crmDate}</td>
157 <td>{if $permission EQ 'edit'}
158 <a class="action-item crm-hover-button" href="#Added" title="{ts 1=$displayName 2=$row.title}Add %1 back into %2?{/ts}">
159 {ts}Rejoin Group{/ts}</a>
160 <a class="action-item crm-hover-button" href="#Deleted" title="{ts 1=$displayName 2=$row.title}Delete %1 from %2? (this group will no longer be listed under Past Groups).{/ts}">
161 {ts}Delete{/ts}</a>{/if}
162 </td>
163 </tr>
164 {/foreach}
165 </table>
166 {/strip}
167 {/if}
168 </div>
169
170
171 {literal}
172 <script type="text/javascript">
173 CRM.$(function($) {
174 // load panes function calls for snippet based on id of crm-accordion-header
175 function loadPanes() {
176 var $el = $(this).parent().find('div.crm-contact_smartgroup');
177 var contactId = $(this).attr('contact_id');
178 if (!$el.html()) {
179 CRM.loadPage(CRM.url('civicrm/contact/view/smartgroup', {cid: contactId}), {target: $el});
180 }
181 }
182 // bind first click of accordion header to load crm-accordion-body with snippet
183 $('.view-contact-groups .crm-ajax-accordion.collapsed .crm-accordion-header').one('click', loadPanes);
184 $('.view-contact-groups .crm-ajax-accordion:not(.collapsed) .crm-accordion-header').each(loadPanes);
185 // Handle enable/delete links
186 var that;
187 function refresh() {
188 CRM.refreshParent(that);
189 }
190 function enableDisableGroup() {
191 var params = {
192 id: $(that).closest('.crm-entity').attr('id').split('-')[1],
193 method: 'Admin'
194 };
195 var status = that.href.split('#')[1];
196 if (status === 'Deleted') {
197 params.skip_undelete = true;
198 } else {
199 params.status = status;
200 }
201 // This api is weird - 'delete' actually works for updating as well as deleting
202 // Normally you wouldn't put a variable within ts() but this works due to smarty hack below
203 CRM.api3('group_contact', 'delete', params, {success: ts(status)}).done(refresh);
204 }
205 $('.view-contact-groups a.action-item').click(function() {
206 that = this;
207 CRM.confirm(enableDisableGroup, {message: this.title});
208 return false;
209 });
210 });
211 {/literal}
212 // Hack to ensure status msg is properly translated
213 CRM.strings.Added = "{ts escape='js'}Added{/ts}";
214 CRM.strings.Removed = "{ts escape='js'}Removed{/ts}";
215 CRM.strings.Deleted = "{ts escape='js'}Deleted{/ts}";
216 </script>