40458f6c |
1 | {* |
2 | +--------------------------------------------------------------------+ |
3 | | CiviCRM version 4.4 | |
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 | {* relationship selector *} |
27 | |
28 | <div class="crm-contact-relationship-{$context}"> |
29 | <table id="crm-contact-relationship-selector-{$context}"> |
30 | <thead> |
31 | <tr> |
32 | <th class='crm-contact-relationship-type'>{ts}Relationship{/ts}</th> |
33 | <th class='crm-contact-relationship-contact_name'> </th> |
34 | <th class='crm-contact-relationship-start_date'>{ts}Start{/ts}</th> |
35 | <th class='crm-contact-relationship-end_date'>{ts}End{/ts}</th> |
36 | <th class='crm-contact-relationship-city'>{ts}City{/ts}</th> |
37 | <th class='crm-contact-relationship-state'>{ts}State/Prov{/ts}</th> |
38 | <th class='crm-contact-relationship-email'>{ts}Email{/ts}</th> |
39 | <th class='crm-contact-relationship-phone'>{ts}Phone{/ts}</th> |
40 | <th class='crm-contact-relationship-links nosort'></th> |
41 | </tr> |
42 | </thead> |
43 | </table> |
44 | </div> |
45 | |
46 | {literal} |
47 | <script type="text/javascript"> |
48 | var {/literal}{$context}{literal}oTable; |
49 | |
50 | cj(function () { |
51 | buildContactRelationships{/literal}{$context}{literal}(); |
52 | }); |
53 | |
54 | function buildContactRelationships{/literal}{$context}{literal}() { |
55 | var context = {/literal}"{$context}"{literal}; |
56 | var sourceUrl = {/literal}'{crmURL p="civicrm/ajax/contactrelationships" h=0 q="context=$context&cid=$contactId"}'{literal}; |
57 | |
3d05d368 |
58 | if (context == 'user') { |
59 | var ZeroRecordText = {/literal}'{ts escape="js"}There are no related contacts / organizations on record for you.{/ts}'{literal}; |
60 | } |
630d1aaa |
61 | else if (context == 'past') { |
62 | var ZeroRecordText = {/literal}'{ts escape="js"}There are no past / disabled relationships for this contact.{/ts}'{literal}; |
63 | } |
3d05d368 |
64 | else { |
630d1aaa |
65 | var ZeroRecordText = {/literal}'{ts escape="js"}There are no relationships entered for this contact.{/ts}'{literal}; |
3d05d368 |
66 | } |
40458f6c |
67 | |
68 | {/literal}{$context}{literal}oTable = cj('#crm-contact-relationship-selector-' + context).dataTable({ |
69 | "bFilter": false, |
70 | "bAutoWidth": false, |
71 | "aaSorting": [], |
72 | "aoColumns": [ |
73 | {sClass: 'crm-contact-relationship-type'}, |
74 | {sClass: 'crm-contact-relationship-contact_name'}, |
75 | {sClass: 'crm-contact-relationship-start_date'}, |
76 | {sClass: 'crm-contact-relationship-end_date'}, |
77 | {sClass: 'crm-contact-relationship-city'}, |
78 | {sClass: 'crm-contact-relationship-state'}, |
79 | {sClass: 'crm-contact-relationship-email'}, |
80 | {sClass: 'crm-contact-relationship-phone'}, |
81 | {sClass: 'crm-contact-relationship-links', bSortable: false}, |
f1321272 |
82 | {sClass: 'hiddenElement', bSortable: false}, |
e1cad725 |
83 | {sClass: 'hiddenElement', bSortable: false} |
40458f6c |
84 | ], |
85 | "bProcessing": true, |
86 | "sPaginationType": "full_numbers", |
87 | "sDom": '<"crm-datatable-pager-top"lfp>rt<"crm-datatable-pager-bottom"ip>', |
88 | "bServerSide": true, |
89 | "bJQueryUI": true, |
90 | "sAjaxSource": sourceUrl, |
0a9919da |
91 | "iDisplayLength": 10, |
40458f6c |
92 | "oLanguage": { |
93 | "sZeroRecords": ZeroRecordText, |
94 | "sProcessing": {/literal}"{ts escape='js'}Processing...{/ts}"{literal}, |
95 | "sLengthMenu": {/literal}"{ts escape='js'}Show _MENU_ entries{/ts}"{literal}, |
96 | "sInfo": {/literal}"{ts escape='js'}Showing _START_ to _END_ of _TOTAL_ entries{/ts}"{literal}, |
97 | "sInfoEmpty": {/literal}"{ts escape='js'}Showing 0 to 0 of 0 entries{/ts}"{literal}, |
98 | "sInfoFiltered": {/literal}"{ts escape='js'}(filtered from _MAX_ total entries){/ts}"{literal}, |
99 | "sSearch": {/literal}"{ts escape='js'}Search:{/ts}"{literal}, |
100 | "oPaginate": { |
101 | "sFirst": {/literal}"{ts escape='js'}First{/ts}"{literal}, |
102 | "sPrevious": {/literal}"{ts escape='js'}Previous{/ts}"{literal}, |
103 | "sNext": {/literal}"{ts escape='js'}Next{/ts}"{literal}, |
104 | "sLast": {/literal}"{ts escape='js'}Last{/ts}"{literal} |
105 | } |
106 | }, |
107 | "fnDrawCallback": function () { |
108 | {/literal}{if $context eq 'current'}{literal} |
109 | if (cj('#tab_rel').length) { |
110 | CRM.tabHeader.updateCount(cj('#tab_rel'), currentoTable.fnSettings().fnRecordsTotal()); |
111 | } |
112 | {/literal}{/if}{literal} |
e1cad725 |
113 | }, |
114 | "fnRowCallback": function( nRow, aData, iDisplayIndex, iDisplayIndexFull) { |
e1cad725 |
115 | cj(nRow).attr('id', 'relationship-'+ aData[9]); |
f1321272 |
116 | if (aData[10] == 0) { |
117 | cj(nRow).addClass('crm-entity disabled'); |
118 | } |
119 | else { |
120 | cj(nRow).addClass('crm-entity'); |
121 | } |
40458f6c |
122 | } |
123 | }); |
124 | } |
125 | </script> |
126 | {/literal} |