Merge remote-tracking branch 'upstream/4.4' into 4.4-master-2014-06-30-11-58-01
[civicrm-core.git] / templates / CRM / Contact / Page / View / RelationshipSelector.tpl
CommitLineData
40458f6c 1{*
2 +--------------------------------------------------------------------+
819d0d41 3 | CiviCRM version 4.5 |
40458f6c 4 +--------------------------------------------------------------------+
819d0d41 5 | Copyright CiviCRM LLC (c) 2004-2014 |
40458f6c 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}">
24e7a504 29 <table class="crm-contact-relationship-selector-{$context}">
40458f6c 30 <thead>
31 <tr>
32 <th class='crm-contact-relationship-type'>{ts}Relationship{/ts}</th>
33 <th class='crm-contact-relationship-contact_name'>&nbsp;</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
3cc60a06 50 CRM.$(function($) {
40458f6c 51 buildContactRelationships{/literal}{$context}{literal}();
2c68626a
DJ
52 function buildContactRelationships{/literal}{$context}{literal}() {
53 var context = {/literal}"{$context}"{literal};
54 var sourceUrl = {/literal}'{crmURL p="civicrm/ajax/contactrelationships" h=0 q="context=$context&cid=$contactId"}'{literal};
40458f6c 55
2c68626a
DJ
56 if (context == 'user') {
57 var ZeroRecordText = {/literal}'{ts escape="js"}There are no related contacts / organizations on record for you.{/ts}'{literal};
58 }
59 else if (context == 'past') {
60 var ZeroRecordText = {/literal}'{ts escape="js"}There are no past / disabled relationships for this contact.{/ts}'{literal};
61 }
62 else {
63 var ZeroRecordText = {/literal}'{ts escape="js"}There are no relationships entered for this contact.{/ts}'{literal};
64 }
40458f6c 65
2c68626a
DJ
66 {/literal}{$context}{literal}oTable = $('table.crm-contact-relationship-selector-' + context).dataTable({
67 "bFilter": false,
68 "bAutoWidth": false,
69 "aaSorting": [],
70 "aoColumns": [
71 {sClass: 'crm-contact-relationship-type'},
72 {sClass: 'crm-contact-relationship-contact_name'},
73 {sClass: 'crm-contact-relationship-start_date'},
74 {sClass: 'crm-contact-relationship-end_date'},
75 {sClass: 'crm-contact-relationship-city'},
76 {sClass: 'crm-contact-relationship-state'},
77 {sClass: 'crm-contact-relationship-email'},
78 {sClass: 'crm-contact-relationship-phone'},
79 {sClass: 'crm-contact-relationship-links', bSortable: false},
80 {sClass: 'hiddenElement', bSortable: false},
81 {sClass: 'hiddenElement', bSortable: false}
82 ],
83 "bProcessing": true,
84 "sPaginationType": "full_numbers",
85 "sDom": '<"crm-datatable-pager-top"lfp>rt<"crm-datatable-pager-bottom"ip>',
86 "bServerSide": true,
87 "bJQueryUI": true,
88 "sAjaxSource": sourceUrl,
89 "iDisplayLength": 10,
90 "oLanguage": {
91 "sZeroRecords": ZeroRecordText,
92 "sProcessing": {/literal}"{ts escape='js'}Processing...{/ts}"{literal},
93 "sLengthMenu": {/literal}"{ts escape='js'}Show _MENU_ entries{/ts}"{literal},
94 "sInfo": {/literal}"{ts escape='js'}Showing _START_ to _END_ of _TOTAL_ entries{/ts}"{literal},
95 "sInfoEmpty": {/literal}"{ts escape='js'}Showing 0 to 0 of 0 entries{/ts}"{literal},
96 "sInfoFiltered": {/literal}"{ts escape='js'}(filtered from _MAX_ total entries){/ts}"{literal},
97 "sSearch": {/literal}"{ts escape='js'}Search:{/ts}"{literal},
98 "oPaginate": {
99 "sFirst": {/literal}"{ts escape='js'}First{/ts}"{literal},
100 "sPrevious": {/literal}"{ts escape='js'}Previous{/ts}"{literal},
101 "sNext": {/literal}"{ts escape='js'}Next{/ts}"{literal},
102 "sLast": {/literal}"{ts escape='js'}Last{/ts}"{literal}
103 }
104 },
105 "fnDrawCallback": function () {
106 {/literal}{if $context eq 'current'}{literal}
107 if ($('#tab_rel').length) {
108 CRM.tabHeader.updateCount($('#tab_rel'), currentoTable.fnSettings().fnRecordsTotal());
109 }
110 {/literal}{/if}{literal}
111 },
112 "fnRowCallback": function( nRow, aData, iDisplayIndex, iDisplayIndexFull) {
113 $(nRow).attr('id', 'relationship-'+ aData[9]);
114 if (aData[10] == 0) {
115 $(nRow).addClass('crm-entity disabled');
116 }
117 else {
118 $(nRow).addClass('crm-entity');
119 }
f1321272 120 }
2c68626a
DJ
121 });
122 }
123 });
40458f6c 124</script>
125{/literal}