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 | *} | |
26 | {include file="CRM/common/pager.tpl" location="top"} | |
27 | ||
28 | {include file="CRM/common/pagerAToZ.tpl"} | |
29 | <a href="#" onclick=" return toggleContactSelection( 'resetSel', 'civicrm search {$qfKey}', 'reset' );">{ts}Reset all selections{/ts}</a> | |
30 | ||
31 | <table summary="{ts}Search results listings.{/ts}" class="selector row-highlight"> | |
32 | <thead class="sticky"> | |
33 | <tr> | |
34 | <th scope="col" title="Select All Rows">{$form.toggleSelect.html}</th> | |
35 | {if $context eq 'smog'} | |
36 | <th scope="col"> | |
37 | {ts}Status{/ts} | |
38 | </th> | |
39 | {/if} | |
40 | {foreach from=$columnHeaders item=header} | |
41 | <th scope="col"> | |
42 | {if $header.sort} | |
43 | {assign var='key' value=$header.sort} | |
44 | {$sort->_response.$key.link} | |
45 | {else} | |
46 | {$header.name} | |
47 | {/if} | |
48 | </th> | |
49 | {/foreach} | |
50 | </tr> | |
51 | </thead> | |
52 | ||
53 | {counter start=0 skip=1 print=false} | |
54 | ||
55 | { if $id } | |
56 | {foreach from=$rows item=row} | |
57 | <tr id='rowid{$row.contact_id}' class="{cycle values='odd-row,even-row'}"> | |
58 | {assign var=cbName value=$row.checkbox} | |
59 | <td>{$form.$cbName.html}</td> | |
60 | {if $context eq 'smog'} | |
61 | {if $row.status eq 'Pending'}<td class="status-pending"}> | |
62 | {elseif $row.status eq 'Removed'}<td class="status-removed"> | |
63 | {else}<td>{/if} | |
64 | {$row.status}</td> | |
65 | {/if} | |
66 | <td>{$row.contact_type}</td> | |
67 | <td><a href="{crmURL p='civicrm/contact/view' q="reset=1&cid=`$row.contact_id`&key=`$qfKey`&context=`$context`"}">{$row.sort_name}</a></td> | |
68 | {foreach from=$row item=value key=key} | |
69 | {if ($key neq "checkbox") and ($key neq "action") and ($key neq "contact_type") and ($key neq "contact_type_orig") and ($key neq "status") and ($key neq "sort_name") and ($key neq "contact_id")and ($key neq "contact_sub_type")} | |
70 | <td> | |
71 | {if $key EQ "household_income_total" } | |
72 | {$value|crmMoney} | |
73 | {elseif strpos( $key, '_date' ) !== false } | |
74 | {$value|crmDate} | |
75 | {else} | |
76 | {$value} | |
77 | {/if} | |
78 | | |
79 | </td> | |
80 | {/if} | |
81 | {/foreach} | |
82 | <td>{$row.action|replace:'xx':$row.contact_id}</td> | |
83 | </tr> | |
84 | {/foreach} | |
85 | {else} | |
86 | {foreach from=$rows item=row} | |
87 | <tr id="rowid{$row.contact_id}" class="{cycle values='odd-row,even-row'}"> | |
88 | {assign var=cbName value=$row.checkbox} | |
89 | <td>{$form.$cbName.html}</td> | |
90 | {if $context eq 'smog'} | |
91 | {if $row.status eq 'Pending'}<td class="status-pending"}> | |
92 | {elseif $row.status eq 'Removed'}<td class="status-removed"> | |
93 | {else}<td>{/if} | |
94 | {$row.status}</td> | |
95 | {/if} | |
96 | <td>{$row.contact_type}</td> | |
97 | <td><a href="{crmURL p='civicrm/contact/view' q="reset=1&cid=`$row.contact_id`&key=`$qfKey`&context=`$context`"}">{if $row.is_deleted}<del>{/if}{$row.sort_name}{if $row.is_deleted}</del>{/if}</a></td> | |
98 | {if $action eq 512 or $action eq 256} | |
99 | {if !empty($columnHeaders.street_address)} | |
100 | <td><span title="{$row.street_address}">{$row.street_address|mb_truncate:22:"...":true}{if $row.do_not_mail} <span class="icon privacy-flag do-not-mail"></span>{/if}</span></td> | |
101 | {/if} | |
102 | {if !empty($columnHeaders.city)} | |
103 | <td>{$row.city}</td> | |
104 | {/if} | |
105 | {if !empty($columnHeaders.state_province)} | |
106 | <td>{$row.state_province}</td> | |
107 | {/if} | |
108 | {if !empty($columnHeaders.postal_code)} | |
109 | <td>{$row.postal_code}</td> | |
110 | {/if} | |
111 | {if !empty($columnHeaders.country)} | |
112 | <td>{$row.country}</td> | |
113 | {/if} | |
114 | <td> | |
115 | {if $row.email} | |
116 | <span title="{$row.email}"> | |
117 | {$row.email|mb_truncate:17:"...":true} | |
118 | {if $row.on_hold} | |
119 | (On Hold)<span class="status-hold" title="{ts}This email is on hold (probably due to bouncing).{/ts}"></span> | |
120 | {elseif $row.do_not_email} | |
121 | <span class="icon privacy-flag do-not-email" title="{ts}Do Not Email{/ts}"></span> | |
122 | {/if} | |
123 | </span> | |
124 | {/if} | |
125 | </td> | |
126 | <td> | |
127 | {if $row.phone} | |
128 | {$row.phone} | |
129 | {if $row.do_not_phone} | |
130 | <span class="icon privacy-flag do-not-phone" title="{ts}Do Not Phone{/ts}" ></span> | |
131 | {/if} | |
132 | {/if} | |
133 | </td> | |
134 | {else} | |
135 | {foreach from=$row item=value key=key} | |
47e85575 | 136 | {if ($key neq "checkbox") and ($key neq "action") and ($key neq "contact_type") and ($key neq "contact_sub_type") and ($key neq "status") and ($key neq "sort_name") and ($key neq "contact_id") and ($key neq "contact_type_orig")} |
6a488035 TO |
137 | <td>{$value} </td> |
138 | {/if} | |
139 | {/foreach} | |
140 | {/if} | |
141 | <td style='width:125px;'>{$row.action|replace:'xx':$row.contact_id}</td> | |
142 | </tr> | |
143 | {/foreach} | |
144 | {/if} | |
145 | </table> | |
146 | ||
147 | <script type="text/javascript"> | |
148 | {literal} | |
149 | cj(function($) { | |
150 | cj("#toggleSelect, input[id^=mark_x_]").removeAttr('checked'); | |
151 | var cids = []; | |
152 | var i = 0; | |
153 | {/literal} | |
154 | {foreach from=$selectedContactIds item=selectedContactId} | |
155 | cids[i++] = "#mark_x_{$selectedContactId}"; | |
156 | {/foreach} | |
157 | {literal} | |
158 | $(cids.join(',')).attr('checked', 'checked'); | |
159 | if (cids.length > 0) { | |
160 | $('input[name=radio_ts][value=ts_sel]').attr('checked', 'checked'); | |
161 | } | |
162 | var params = {getCount: cids.length}; | |
163 | countSelections(params); | |
164 | on_load_init_checkboxes("{/literal}{$form.formName}{literal}"); | |
165 | }); | |
166 | function countSelections(obj) { | |
167 | var label = cj('label[for*=ts_sel]'); | |
168 | if (typeof(obj) == 'undefined') { | |
169 | return parseInt(cj('span', label).text()); | |
170 | } | |
171 | if (obj && typeof(obj.getCount) != 'undefined' && label.length > 0) { | |
172 | if (cj('span', label).length < 1) { | |
173 | label.prepend('<span>' + obj.getCount + '</span> '); | |
174 | } | |
175 | else { | |
176 | cj('span', label).html(obj.getCount); | |
177 | } | |
178 | toggleTaskAction(obj.getCount); | |
179 | } | |
180 | on_load_init_checkboxes("{/literal}{$form.formName}{literal}"); | |
181 | } | |
182 | function toggleContactSelection(name, qfKey, selection) { | |
183 | var url = CRM.url('civicrm/ajax/markSelection'); | |
184 | var params = {qfKey: qfKey}; | |
185 | if (!(cj('#' + name).is(':checked'))) { | |
186 | params.action = 'unselect'; | |
187 | params.state = 'unchecked'; | |
188 | } | |
189 | if (selection == 'multiple') { | |
190 | var rowArr = new Array( ); | |
191 | {/literal}{foreach from=$rows item=row key=keyVal} | |
192 | {literal}rowArr[{/literal}{$keyVal}{literal}] = '{/literal}{$row.checkbox}{literal}'; | |
193 | {/literal}{/foreach}{literal} | |
194 | params.name = rowArr.join('-'); | |
195 | params.variableType = 'multiple'; | |
196 | } | |
197 | else if (name == 'resetSel' && selection == 'reset') { | |
198 | params.variableType = 'multiple'; | |
199 | cj("#toggleSelect, input[id^=mark_x_]").removeAttr('checked'); | |
200 | } | |
201 | else { | |
202 | params.name = name; | |
203 | } | |
204 | cj.getJSON(url, params, countSelections); | |
205 | } | |
206 | {/literal} | |
207 | </script> | |
208 | {include file="CRM/common/pager.tpl" location="bottom"} |