| 1 | {* |
| 2 | +--------------------------------------------------------------------+ |
| 3 | | CiviCRM version 4.6 | |
| 4 | +--------------------------------------------------------------------+ |
| 5 | | Copyright CiviCRM LLC (c) 2004-2014 | |
| 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 | {ts 1=$totalSelectedContacts}Number of selected contacts: %1{/ts} |
| 27 | |
| 28 | {if $searchtype eq 'ts_sel'} |
| 29 | <div id="popupContainer"> |
| 30 | <table id="selectedRecords-{$group.id}" class="display crm-copy-fields"> |
| 31 | <thead> |
| 32 | <tr class="columnheader"> |
| 33 | <th class="contact_details">{ts}Name{/ts}</th> |
| 34 | </tr> |
| 35 | </thead> |
| 36 | |
| 37 | <tbody> |
| 38 | {foreach from=$value item='row'} |
| 39 | <tr class="{cycle values="odd-row,even-row"}"> |
| 40 | <td class="name">{$row}</td> |
| 41 | </tr> |
| 42 | {/foreach} |
| 43 | </tbody> |
| 44 | </table> |
| 45 | |
| 46 | </div><br /> |
| 47 | <a href="#" id="popup-button" title="{ts}View Selected Contacts{/ts}">{ts}View Selected Contacts{/ts}</a> |
| 48 | {/if} |
| 49 | |
| 50 | {if $searchtype eq 'ts_sel'} |
| 51 | {literal} |
| 52 | <script type="text/javascript"> |
| 53 | CRM.$(function($) { |
| 54 | $("#popupContainer").css({ |
| 55 | "background-color":"#E0E0E0", |
| 56 | 'display':'none' |
| 57 | }); |
| 58 | |
| 59 | $("#popup-button").click(function() { |
| 60 | $("#popupContainer").dialog({ |
| 61 | title: {/literal}"{ts escape='js'}Selected Contacts{/ts}"{literal}, |
| 62 | width:700, |
| 63 | height:500, |
| 64 | modal: true, |
| 65 | overlay: { |
| 66 | opacity: 0.5, |
| 67 | background: "black" |
| 68 | } |
| 69 | }); |
| 70 | return false; |
| 71 | }); |
| 72 | |
| 73 | var count = 0; var columns = ''; var sortColumn = ''; |
| 74 | $('#selectedRecords-{/literal}{$group.id}{literal} th').each(function() { |
| 75 | if ($(this).attr('class') == 'contact_details') { |
| 76 | sortColumn += '[' + count + ', "asc" ],'; |
| 77 | columns += '{"sClass": "contact_details"},'; |
| 78 | } |
| 79 | else { |
| 80 | columns += '{ "bSortable": false },'; |
| 81 | } |
| 82 | count++; |
| 83 | }); |
| 84 | |
| 85 | columns = columns.substring(0, columns.length - 1 ); |
| 86 | sortColumn = sortColumn.substring(0, sortColumn.length - 1 ); |
| 87 | eval('sortColumn =[' + sortColumn + ']'); |
| 88 | eval('columns =[' + columns + ']'); |
| 89 | |
| 90 | //load jQuery data table. |
| 91 | $('#selectedRecords-{/literal}{$group.id}{literal}').dataTable( { |
| 92 | "sPaginationType": "full_numbers", |
| 93 | "bJQueryUI" : true, |
| 94 | "aaSorting" : sortColumn, |
| 95 | "aoColumns" : columns, |
| 96 | "bFilter" : false |
| 97 | }); |
| 98 | }); |
| 99 | |
| 100 | </script> |
| 101 | {/literal} |
| 102 | {/if} |
| 103 | |
| 104 | {if $rows} |
| 105 | <div class="form-item"> |
| 106 | <table width="30%"> |
| 107 | <tr class="columnheader"> |
| 108 | <th>{ts}Name{/ts}</th> |
| 109 | </tr> |
| 110 | {foreach from=$rows item=row} |
| 111 | <tr class="{cycle values="odd-row,even-row"}"> |
| 112 | <td>{$row.displayName}</td> |
| 113 | </tr> |
| 114 | {/foreach} |
| 115 | </table> |
| 116 | </div> |
| 117 | {/if} |