2 +--------------------------------------------------------------------+
3 | CiviCRM version 4.3 |
4 +--------------------------------------------------------------------+
5 | Copyright CiviCRM LLC (c) 2004-2013 |
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;
66 var context = {/literal}"{$context}"{literal};
67 var filterSearchOnLoad = false;
68 if (context == 'activity') {
69 filterSearchOnLoad = true;
71 buildContactActivities{/literal}{$context}{literal}( filterSearchOnLoad );
73 cj('.crm-activity-selector-'+ context +' #activity_type_filter_id').change( function( ) {
74 buildContactActivities{/literal}{$context}{literal}( true );
77 cj('.crm-activity-selector-'+ context +' #activity_type_exclude_filter_id').change( function( ) {
78 buildContactActivities{/literal}{$context}{literal}( true );
82 function buildContactActivities{/literal}{$context}{literal}( filterSearch ) {
83 if ( filterSearch && {/literal}{$context}{literal}oTable ) {
84 {/literal}{$context}{literal}oTable.fnDestroy();
87 var context = {/literal}"{$context}"{literal};
89 var sourceUrl = {/literal}'{crmURL p="civicrm/ajax/contactactivity" h=0 q="snippet=4&context=$context&cid=$contactId"}'{literal};
91 var ZeroRecordText = {/literal}'{ts escape="js"}No matches found{/ts}'{literal};
92 if ( cj('.crm-activity-selector-'+ context +' select#activity_type_filter_id').val( ) ) {
93 ZeroRecordText += {/literal}'{ts escape="js"} for Activity Type = "{/ts}'{literal} + cj('.crm-activity-selector-'+ context +' select#activity_type_filter_id :selected').text( ) + '"';
96 ZeroRecordText += '.';
99 {/literal}{$context}{literal}oTable = cj('#contact-activity-selector-' + context ).dataTable({
101 "bAutoWidth" : false,
104 {sClass:'crm-contact-activity-activity_type'},
105 {sClass:'crm-contact-activity_subject'},
106 {sClass:'crm-contact-activity-source_contact'},
107 {sClass:'crm-contact-activity-target_contact', bSortable:false},
108 {sClass:'crm-contact-activity-assignee_contact', bSortable:false},
109 {sClass:'crm-contact-activity-activity_date'},
110 {sClass:'crm-contact-activity-activity_status'},
111 {sClass:'crm-contact-activity-links', bSortable:false},
112 {sClass:'hiddenElement', bSortable:false}
115 "sPaginationType": "full_numbers",
116 "sDom" : '<"crm-datatable-pager-top"lfp>rt<"crm-datatable-pager-bottom"ip>',
119 "sAjaxSource": sourceUrl,
120 "iDisplayLength": 25,
122 "sZeroRecords": ZeroRecordText,
123 "sProcessing": {/literal}"{ts escape='js'}Processing...{/ts}"{literal},
124 "sLengthMenu": {/literal}"{ts escape='js'}Show _MENU_ entries{/ts}"{literal},
125 "sInfo": {/literal}"{ts escape='js'}Showing _START_ to _END_ of _TOTAL_ entries{/ts}"{literal},
126 "sInfoEmpty": {/literal}"{ts escape='js'}Showing 0 to 0 of 0 entries{/ts}"{literal},
127 "sInfoFiltered": {/literal}"{ts escape='js'}(filtered from _MAX_ total entries){/ts}"{literal},
128 "sSearch": {/literal}"{ts escape='js'}Search:{/ts}"{literal},
130 "sFirst": {/literal}"{ts escape='js'}First{/ts}"{literal},
131 "sPrevious": {/literal}"{ts escape='js'}Previous{/ts}"{literal},
132 "sNext": {/literal}"{ts escape='js'}Next{/ts}"{literal},
133 "sLast": {/literal}"{ts escape='js'}Last{/ts}"{literal}
136 "fnDrawCallback": function() { setSelectorClass{/literal}{$context}{literal}( context ); },
137 "fnServerData": function ( sSource, aoData, fnCallback ) {
138 aoData.push( {name:'contact_id', value: {/literal}{$contactId}{literal}},
139 {name:'admin', value: {/literal}'{$admin}'{literal}}
142 if ( filterSearch ) {
144 {name:'activity_type_id', value: cj('.crm-activity-selector-'+ context +' select#activity_type_filter_id').val()},
145 {name:'activity_type_exclude_id', value: cj('.crm-activity-selector-'+ context +' select#activity_type_exclude_filter_id').val()}
153 "success": fnCallback,
155 "dataFilter": function(data, type) { return data.replace(/[\n\v\t]/g, " "); }
161 function setSelectorClass{/literal}{$context}{literal}( context ) {
162 cj('#contact-activity-selector-' + context + ' td:last-child').each( function( ) {
163 cj(this).parent().addClass(cj(this).text() );