2 +--------------------------------------------------------------------+
3 | CiviCRM version 4.5 |
4 +--------------------------------------------------------------------+
5 | Copyright CiviCRM LLC (c) 2004-2014 |
6 +--------------------------------------------------------------------+
7 | This file is a part of CiviCRM. |
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. |
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. |
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 +--------------------------------------------------------------------+
27 <div class="crm-activity-selector-{$context}">
28 <div class="crm-accordion-wrapper crm-search_filters-accordion">
29 <div class="crm-accordion-header">
30 {ts}Filter by Activity Type{/ts}</a>
31 </div><!-- /.crm-accordion-header -->
32 <div class="crm-accordion-body">
33 <div class="no-border form-layout-compressed" id="searchOptions">
34 <div class="crm-contact-form-block-activity_type_filter_id crm-inline-edit-field">
35 {$form.activity_type_filter_id.label} {$form.activity_type_filter_id.html|crmAddClass:big}
37 <div class="crm-contact-form-block-activity_type_exclude_filter_id crm-inline-edit-field">
38 {$form.activity_type_exclude_filter_id.label} {$form.activity_type_exclude_filter_id.html|crmAddClass:big}
41 </div><!-- /.crm-accordion-body -->
42 </div><!-- /.crm-accordion-wrapper -->
43 <table id="contact-activity-selector-{$context}">
46 <th class='crm-contact-activity-activity_type'>{ts}Type{/ts}</th>
47 <th class='crm-contact-activity_subject'>{ts}Subject{/ts}</th>
48 <th class='crm-contact-activity-source_contact'>{ts}Added By{/ts}</th>
49 <th class='crm-contact-activity-target_contact nosort'>{ts}With{/ts}</th>
50 <th class='crm-contact-activity-assignee_contact nosort'>{ts}Assigned{/ts}</th>
51 <th class='crm-contact-activity-activity_date'>{ts}Date{/ts}</th>
52 <th class='crm-contact-activity-activity_status'>{ts}Status{/ts}</th>
53 <th class='crm-contact-activity-links nosort'> </th>
54 <th class='hiddenElement'> </th>
59 {include file="CRM/Case/Form/ActivityToCase.tpl" contactID=$contactId}
61 <script type="text/javascript">
62 var {/literal}{$context}{literal}oTable;
65 var context = {/literal}"{$context}"{literal};
66 var filterSearchOnLoad = false;
67 if (context == 'activity') {
68 filterSearchOnLoad = true;
70 buildContactActivities{/literal}{$context}{literal}( filterSearchOnLoad );
72 cj('.crm-activity-selector-'+ context +' #activity_type_filter_id').change( function( ) {
73 buildContactActivities{/literal}{$context}{literal}( true );
76 cj('.crm-activity-selector-'+ context +' #activity_type_exclude_filter_id').change( function( ) {
77 buildContactActivities{/literal}{$context}{literal}( true );
81 function buildContactActivities{/literal}{$context}{literal}( filterSearch ) {
82 if ( filterSearch && {/literal}{$context}{literal}oTable ) {
83 {/literal}{$context}{literal}oTable.fnDestroy();
86 var context = {/literal}"{$context}"{literal};
88 var sourceUrl = {/literal}'{crmURL p="civicrm/ajax/contactactivity" h=0 q="snippet=4&context=$context&cid=$contactId"}'{literal};
90 var ZeroRecordText = {/literal}'{ts escape="js"}No matches found{/ts}'{literal};
91 if ( cj('.crm-activity-selector-'+ context +' select#activity_type_filter_id').val( ) ) {
92 ZeroRecordText += {/literal}'{ts escape="js"} for Activity Type = "{/ts}'{literal} + cj('.crm-activity-selector-'+ context +' select#activity_type_filter_id :selected').text( ) + '"';
95 ZeroRecordText += '.';
98 {/literal}{$context}{literal}oTable = cj('#contact-activity-selector-' + context ).dataTable({
100 "bAutoWidth" : false,
103 {sClass:'crm-contact-activity-activity_type'},
104 {sClass:'crm-contact-activity_subject'},
105 {sClass:'crm-contact-activity-source_contact'},
106 {sClass:'crm-contact-activity-target_contact', bSortable:false},
107 {sClass:'crm-contact-activity-assignee_contact', bSortable:false},
108 {sClass:'crm-contact-activity-activity_date'},
109 {sClass:'crm-contact-activity-activity_status'},
110 {sClass:'crm-contact-activity-links', bSortable:false},
111 {sClass:'hiddenElement', bSortable:false}
114 "sPaginationType": "full_numbers",
115 "sDom" : '<"crm-datatable-pager-top"lfp>rt<"crm-datatable-pager-bottom"ip>',
118 "sAjaxSource": sourceUrl,
119 "iDisplayLength": 25,
121 "sZeroRecords": ZeroRecordText,
122 "sProcessing": {/literal}"{ts escape='js'}Processing...{/ts}"{literal},
123 "sLengthMenu": {/literal}"{ts escape='js'}Show _MENU_ entries{/ts}"{literal},
124 "sInfo": {/literal}"{ts escape='js'}Showing _START_ to _END_ of _TOTAL_ entries{/ts}"{literal},
125 "sInfoEmpty": {/literal}"{ts escape='js'}Showing 0 to 0 of 0 entries{/ts}"{literal},
126 "sInfoFiltered": {/literal}"{ts escape='js'}(filtered from _MAX_ total entries){/ts}"{literal},
127 "sSearch": {/literal}"{ts escape='js'}Search:{/ts}"{literal},
129 "sFirst": {/literal}"{ts escape='js'}First{/ts}"{literal},
130 "sPrevious": {/literal}"{ts escape='js'}Previous{/ts}"{literal},
131 "sNext": {/literal}"{ts escape='js'}Next{/ts}"{literal},
132 "sLast": {/literal}"{ts escape='js'}Last{/ts}"{literal}
135 "fnDrawCallback": function() { setSelectorClass{/literal}{$context}{literal}( context ); },
136 "fnServerData": function ( sSource, aoData, fnCallback ) {
137 aoData.push( {name:'contact_id', value: {/literal}{$contactId}{literal}},
138 {name:'admin', value: {/literal}'{$admin}'{literal}}
141 if ( filterSearch ) {
143 {name:'activity_type_id', value: cj('.crm-activity-selector-'+ context +' select#activity_type_filter_id').val()},
144 {name:'activity_type_exclude_id', value: cj('.crm-activity-selector-'+ context +' select#activity_type_exclude_filter_id').val()}
152 "success": fnCallback,
154 "dataFilter": function(data, type) { return data.replace(/[\n\v\t]/g, " "); }
160 function setSelectorClass{/literal}{$context}{literal}( context ) {
161 cj('#contact-activity-selector-' + context + ' td:last-child').each( function( ) {
162 cj(this).parent().addClass(cj(this).text() );