Merge pull request #435 from dlobo/master
[civicrm-core.git] / templates / CRM / Mailing / Page / Tab.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
27 <div class="crm-mailing-selector">
28 <table id="contact-mailing-selector">
29 <thead>
30 <tr>
31 <th class='crm-mailing-contact-subject'>{ts}Subject{/ts}</th>
32 <th class='crm-mailing-contact_created'>{ts}Created By{/ts}</th>
33 <th class='crm-mailing-contact-date'>{ts}Date{/ts}</th>
34 <th class='crm-mailing-contact-links nosort'>&nbsp;</th>
35 <th class='hiddenElement'>&nbsp;</th>
36 </tr>
37 </thead>
38 </table>
39 </div>
40 {literal}
41 <script type="text/javascript">
42 var oTable;
43
44 cj(function ( ) {
45 buildMailingContact( );
46 });
47
48 function buildMailingContact() {
49 oTable.fnDestroy();
50
51 var columns = '';
52 var sourceUrl = {/literal}'{crmURL p="civicrm/ajax/rest" h=0 q="entity=MailingContact&action=get&sequential=1&json=1&contact_id=$contactId"}'{literal};
53
54 var ZeroRecordText = {/literal}'{ts escape="js"}No mailings found{/ts}.'{literal};
55
56 oTable = cj('#mailing-contact-selector').dataTable({
57 "bFilter" : false,
58 "bAutoWidth" : false,
59 "aaSorting" : [],
60 "aoColumns" : [
61 {sClass:'crm-mailing-contact-subject'},
62 {sClass:'crm-mailing-contact_created'},
63 {sClass:'crm-mailing-contact-date'},
64 {sClass:'crm-mailing-contact-links', bSortable:false},
65 {sClass:'hiddenElement', bSortable:false}
66 ],
67 "bProcessing": true,
68 "sPaginationType": "full_numbers",
69 "sDom" : '<"crm-datatable-pager-top"lfp>rt<"crm-datatable-pager-bottom"ip>',
70 "bServerSide": true,
71 "bJQueryUI": true,
72 "sAjaxSource": sourceUrl,
73 "iDisplayLength": 25,
74 "oLanguage": {
75 "sZeroRecords": ZeroRecordText,
76 "sProcessing": {/literal}"{ts escape='js'}Processing...{/ts}"{literal},
77 "sLengthMenu": {/literal}"{ts escape='js'}Show _MENU_ entries{/ts}"{literal},
78 "sInfo": {/literal}"{ts escape='js'}Showing _START_ to _END_ of _TOTAL_ entries{/ts}"{literal},
79 "sInfoEmpty": {/literal}"{ts escape='js'}Showing 0 to 0 of 0 entries{/ts}"{literal},
80 "sInfoFiltered": {/literal}"{ts escape='js'}(filtered from _MAX_ total entries){/ts}"{literal},
81 "sSearch": {/literal}"{ts escape='js'}Search:{/ts}"{literal},
82 "oPaginate": {
83 "sFirst": {/literal}"{ts escape='js'}First{/ts}"{literal},
84 "sPrevious": {/literal}"{ts escape='js'}Previous{/ts}"{literal},
85 "sNext": {/literal}"{ts escape='js'}Next{/ts}"{literal},
86 "sLast": {/literal}"{ts escape='js'}Last{/ts}"{literal}
87 }
88 },
89 "fnDrawCallback": function() { setSelectorClass(); },
90 "fnServerData": function ( sSource, aoData, fnCallback ) {
91 aoData.push( {name:'contact_id', value: {/literal}{$contactId}{literal}},
92 {name:'admin', value: {/literal}'{$admin}'{literal}}
93 );
94
95 cj.ajax( {
96 "dataType": 'json',
97 "type": "POST",
98 "url": sSource,
99 "data": aoData,
100 "success": fnCallxback,
101 // CRM-10244
102 "dataFilter": function(data, type) { return data.replace(/[\n\v\t]/g, " "); }
103 });
104 }
105 });
106 }
107
108 function setSelectorClass( ) {
109 cj('#contact-mailing-selector' + ' td:last-child').each( function( ) {
110 cj(this).parent().addClass(cj(this).text() );
111 });
112 }
113 </script>
114 {/literal}