{include file="CRM/Case/Form/ActivityToCase.tpl" contactID=$contactId}
{literal}
<script type="text/javascript">
- var {/literal}{$context}{literal}oTable;
-
- CRM.$(function($) {
- var context = {/literal}"{$context}"{literal};
- var filterSearchOnLoad = false;
- if (context == 'activity') {
- filterSearchOnLoad = true;
- }
- buildContactActivities{/literal}{$context}{literal}( filterSearchOnLoad );
-
- cj('.crm-activity-selector-'+ context +' #activity_type_filter_id').change( function( ) {
- buildContactActivities{/literal}{$context}{literal}( true );
- });
+var {/literal}{$context}{literal}oTable;
+CRM.$(function($) {
+ var context = {/literal}"{$context}"{literal};
+ var filterSearchOnLoad = false;
+ if (context == 'activity') {
+ filterSearchOnLoad = true;
+ }
+ buildContactActivities{/literal}{$context}{literal}( filterSearchOnLoad );
- cj('.crm-activity-selector-'+ context +' #activity_type_exclude_filter_id').change( function( ) {
- buildContactActivities{/literal}{$context}{literal}( true );
- });
+ $('.crm-activity-selector-'+ context +' #activity_type_filter_id').change( function( ) {
+ buildContactActivities{/literal}{$context}{literal}( true );
});
-function buildContactActivities{/literal}{$context}{literal}( filterSearch ) {
- if ( filterSearch && {/literal}{$context}{literal}oTable ) {
- {/literal}{$context}{literal}oTable.fnDestroy();
- }
+ $('.crm-activity-selector-'+ context +' #activity_type_exclude_filter_id').change( function( ) {
+ buildContactActivities{/literal}{$context}{literal}( true );
+ });
- var context = {/literal}"{$context}"{literal};
- var columns = '';
- var sourceUrl = {/literal}'{crmURL p="civicrm/ajax/contactactivity" h=0 q="snippet=4&context=$context&cid=$contactId"}'{literal};
+ function buildContactActivities{/literal}{$context}{literal}( filterSearch ) {
+ if ( filterSearch && {/literal}{$context}{literal}oTable ) {
+ {/literal}{$context}{literal}oTable.fnDestroy();
+ }
- var ZeroRecordText = {/literal}'{ts escape="js"}No matches found{/ts}'{literal};
- if ( cj('.crm-activity-selector-'+ context +' select#activity_type_filter_id').val( ) ) {
- ZeroRecordText += {/literal}'{ts escape="js"} for Activity Type = "{/ts}'{literal} + cj('.crm-activity-selector-'+ context +' select#activity_type_filter_id :selected').text( ) + '"';
- }
- else {
- ZeroRecordText += '.';
- }
+ var context = {/literal}"{$context}"{literal};
+ var columns = '';
+ var sourceUrl = {/literal}'{crmURL p="civicrm/ajax/contactactivity" h=0 q="snippet=4&context=$context&cid=$contactId"}'{literal};
- {/literal}{$context}{literal}oTable = cj('.contact-activity-selector-' + context ).dataTable({
- "bFilter" : false,
- "bAutoWidth" : false,
- "aaSorting" : [],
- "aoColumns" : [
- {sClass:'crm-contact-activity-activity_type'},
- {sClass:'crm-contact-activity_subject'},
- {sClass:'crm-contact-activity-source_contact'},
- {sClass:'crm-contact-activity-target_contact', bSortable:false},
- {sClass:'crm-contact-activity-assignee_contact', bSortable:false},
- {sClass:'crm-contact-activity-activity_date'},
- {sClass:'crm-contact-activity-activity_status'},
- {sClass:'crm-contact-activity-links', bSortable:false},
- {sClass:'hiddenElement', bSortable:false}
- ],
- "bProcessing": true,
- "sPaginationType": "full_numbers",
- "sDom" : '<"crm-datatable-pager-top"lfp>rt<"crm-datatable-pager-bottom"ip>',
- "bServerSide": true,
- "bJQueryUI": true,
- "sAjaxSource": sourceUrl,
- "iDisplayLength": 25,
- "oLanguage": {
- "sZeroRecords": ZeroRecordText,
- "sProcessing": {/literal}"{ts escape='js'}Processing...{/ts}"{literal},
- "sLengthMenu": {/literal}"{ts escape='js'}Show _MENU_ entries{/ts}"{literal},
- "sInfo": {/literal}"{ts escape='js'}Showing _START_ to _END_ of _TOTAL_ entries{/ts}"{literal},
- "sInfoEmpty": {/literal}"{ts escape='js'}Showing 0 to 0 of 0 entries{/ts}"{literal},
- "sInfoFiltered": {/literal}"{ts escape='js'}(filtered from _MAX_ total entries){/ts}"{literal},
- "sSearch": {/literal}"{ts escape='js'}Search:{/ts}"{literal},
- "oPaginate": {
- "sFirst": {/literal}"{ts escape='js'}First{/ts}"{literal},
- "sPrevious": {/literal}"{ts escape='js'}Previous{/ts}"{literal},
- "sNext": {/literal}"{ts escape='js'}Next{/ts}"{literal},
- "sLast": {/literal}"{ts escape='js'}Last{/ts}"{literal}
- }
- },
- "fnDrawCallback": function() { setSelectorClass{/literal}{$context}{literal}( context ); },
- "fnServerData": function ( sSource, aoData, fnCallback ) {
- aoData.push( {name:'contact_id', value: {/literal}{$contactId}{literal}},
- {name:'admin', value: {/literal}'{$admin}'{literal}}
- );
+ var ZeroRecordText = {/literal}'{ts escape="js"}No matches found{/ts}'{literal};
+ if ( $('.crm-activity-selector-'+ context +' select#activity_type_filter_id').val( ) ) {
+ ZeroRecordText += {/literal}'{ts escape="js"} for Activity Type = "{/ts}'{literal} + $('.crm-activity-selector-'+ context +' select#activity_type_filter_id :selected').text( ) + '"';
+ }
+ else {
+ ZeroRecordText += '.';
+ }
- if ( filterSearch ) {
- aoData.push(
- {name:'activity_type_id', value: cj('.crm-activity-selector-'+ context +' select#activity_type_filter_id').val()},
- {name:'activity_type_exclude_id', value: cj('.crm-activity-selector-'+ context +' select#activity_type_exclude_filter_id').val()}
+ {/literal}{$context}{literal}oTable = $('.contact-activity-selector-' + context ).dataTable({
+ "bFilter" : false,
+ "bAutoWidth" : false,
+ "aaSorting" : [],
+ "aoColumns" : [
+ {sClass:'crm-contact-activity-activity_type'},
+ {sClass:'crm-contact-activity_subject'},
+ {sClass:'crm-contact-activity-source_contact'},
+ {sClass:'crm-contact-activity-target_contact', bSortable:false},
+ {sClass:'crm-contact-activity-assignee_contact', bSortable:false},
+ {sClass:'crm-contact-activity-activity_date'},
+ {sClass:'crm-contact-activity-activity_status'},
+ {sClass:'crm-contact-activity-links', bSortable:false},
+ {sClass:'hiddenElement', bSortable:false}
+ ],
+ "bProcessing": true,
+ "sPaginationType": "full_numbers",
+ "sDom" : '<"crm-datatable-pager-top"lfp>rt<"crm-datatable-pager-bottom"ip>',
+ "bServerSide": true,
+ "bJQueryUI": true,
+ "sAjaxSource": sourceUrl,
+ "iDisplayLength": 25,
+ "oLanguage": {
+ "sZeroRecords": ZeroRecordText,
+ "sProcessing": {/literal}"{ts escape='js'}Processing...{/ts}"{literal},
+ "sLengthMenu": {/literal}"{ts escape='js'}Show _MENU_ entries{/ts}"{literal},
+ "sInfo": {/literal}"{ts escape='js'}Showing _START_ to _END_ of _TOTAL_ entries{/ts}"{literal},
+ "sInfoEmpty": {/literal}"{ts escape='js'}Showing 0 to 0 of 0 entries{/ts}"{literal},
+ "sInfoFiltered": {/literal}"{ts escape='js'}(filtered from _MAX_ total entries){/ts}"{literal},
+ "sSearch": {/literal}"{ts escape='js'}Search:{/ts}"{literal},
+ "oPaginate": {
+ "sFirst": {/literal}"{ts escape='js'}First{/ts}"{literal},
+ "sPrevious": {/literal}"{ts escape='js'}Previous{/ts}"{literal},
+ "sNext": {/literal}"{ts escape='js'}Next{/ts}"{literal},
+ "sLast": {/literal}"{ts escape='js'}Last{/ts}"{literal}
+ }
+ },
+ "fnDrawCallback": function() { setSelectorClass{/literal}{$context}{literal}( context ); },
+ "fnServerData": function ( sSource, aoData, fnCallback ) {
+ aoData.push( {name:'contact_id', value: {/literal}{$contactId}{literal}},
+ {name:'admin', value: {/literal}'{$admin}'{literal}}
);
+
+ if ( filterSearch ) {
+ aoData.push(
+ {name:'activity_type_id', value: $('.crm-activity-selector-'+ context +' select#activity_type_filter_id').val()},
+ {name:'activity_type_exclude_id', value: $('.crm-activity-selector-'+ context +' select#activity_type_exclude_filter_id').val()}
+ );
+ }
+ $.ajax( {
+ "dataType": 'json',
+ "type": "POST",
+ "url": sSource,
+ "data": aoData,
+ "success": fnCallback,
+ // CRM-10244
+ "dataFilter": function(data, type) { return data.replace(/[\n\v\t]/g, " "); }
+ });
}
- cj.ajax( {
- "dataType": 'json',
- "type": "POST",
- "url": sSource,
- "data": aoData,
- "success": fnCallback,
- // CRM-10244
- "dataFilter": function(data, type) { return data.replace(/[\n\v\t]/g, " "); }
- });
- }
- });
-}
+ });
+ }
-function setSelectorClass{/literal}{$context}{literal}( context ) {
- cj('.contact-activity-selector-' + context + ' td:last-child').each( function( ) {
- cj(this).parent().addClass(cj(this).text() );
- });
-}
+ function setSelectorClass{/literal}{$context}{literal}( context ) {
+ $('.contact-activity-selector-' + context + ' td:last-child').each( function( ) {
+ $(this).parent().addClass($(this).text() );
+ });
+ }
+});
</script>
{/literal}
<script type="text/javascript">
CRM.$(function($) {
buildBatchSelector( false );
- cj('#_qf_Search_refresh').click( function() {
+ $('#_qf_Search_refresh').click( function() {
buildBatchSelector(true);
});
-});
-function buildBatchSelector( filterSearch ) {
- var status = {/literal}{$status}{literal};
- if (filterSearch) {
- crmBatchSelector.fnDestroy();
- var ZeroRecordText = '<div class="status messages">{/literal}{ts escape="js"}No matching Data Entry Batches found for your search criteria.{/ts}{literal}</li></ul></div>';
- }
- else if (status == 1) {
- var ZeroRecordText = {/literal}'<div class="status messages">{ts escape="js"}You do not have any Open Data Entry Batches.{/ts}</div>'{literal};
- }
- else {
- var ZeroRecordText = {/literal}'<div class="status messages">{ts escape="js"}No Data Entry Batches have been created for this site.{/ts}</div>'{literal};
- }
-
- var columns = '';
- var sourceUrl = {/literal}'{crmURL p="civicrm/ajax/batchlist" h=0 q="snippet=4"}'{literal};
-
- crmBatchSelector = cj('.crm-batch-selector').dataTable({
- "bFilter" : false,
- "bAutoWidth" : false,
- "aaSorting" : [],
- "aoColumns" : [
- {sClass:'crm-batch-name'},
- {sClass:'crm-batch-type'},
- {sClass:'crm-batch-item_count right'},
- {sClass:'crm-batch-total_amount right'},
- {sClass:'crm-batch-status'},
- {sClass:'crm-batch-created_by'},
- {sClass:'crm-batch-links', bSortable:false}
- ],
- "bProcessing": true,
- "asStripClasses" : [ "odd-row", "even-row" ],
- "sPaginationType": "full_numbers",
- "sDom" : '<"crm-datatable-pager-top"lfp>rt<"crm-datatable-pager-bottom"ip>',
- "bServerSide": true,
- "bJQueryUI": true,
- "sAjaxSource": sourceUrl,
- "iDisplayLength": 25,
- "oLanguage": { "sZeroRecords": ZeroRecordText,
- "sProcessing": {/literal}"{ts escape='js'}Processing...{/ts}"{literal},
- "sLengthMenu": {/literal}"{ts escape='js'}Show _MENU_ entries{/ts}"{literal},
- "sInfo": {/literal}"{ts escape='js'}Showing _START_ to _END_ of _TOTAL_ entries{/ts}"{literal},
- "sInfoEmpty": {/literal}"{ts escape='js'}Showing 0 to 0 of 0 entries{/ts}"{literal},
- "sInfoFiltered": {/literal}"{ts escape='js'}(filtered from _MAX_ total entries){/ts}"{literal},
- "sSearch": {/literal}"{ts escape='js'}Search:{/ts}"{literal},
- "oPaginate": {
- "sFirst": {/literal}"{ts escape='js'}First{/ts}"{literal},
- "sPrevious": {/literal}"{ts escape='js'}Previous{/ts}"{literal},
- "sNext": {/literal}"{ts escape='js'}Next{/ts}"{literal},
- "sLast": {/literal}"{ts escape='js'}Last{/ts}"{literal}
- }
- },
- "fnServerData": function ( sSource, aoData, fnCallback ) {
+ function buildBatchSelector( filterSearch ) {
+ var status = {/literal}{$status}{literal};
if (filterSearch) {
- aoData.push(
- {name:'title', value: cj('.crm-batch-search-form-block #title').val()}
- );
+ crmBatchSelector.fnDestroy();
+ var ZeroRecordText = '<div class="status messages">{/literal}{ts escape="js"}No matching Data Entry Batches found for your search criteria.{/ts}{literal}</li></ul></div>';
}
- cj.ajax({
- "dataType": 'json',
- "type": "POST",
- "url": sSource,
- "data": aoData,
- "success": fnCallback
+ else if (status == 1) {
+ var ZeroRecordText = {/literal}'<div class="status messages">{ts escape="js"}You do not have any Open Data Entry Batches.{/ts}</div>'{literal};
+ }
+ else {
+ var ZeroRecordText = {/literal}'<div class="status messages">{ts escape="js"}No Data Entry Batches have been created for this site.{/ts}</div>'{literal};
+ }
+
+ var columns = '';
+ var sourceUrl = {/literal}'{crmURL p="civicrm/ajax/batchlist" h=0 q="snippet=4"}'{literal};
+ var $context = $('#crm-main-content-wrapper');
+
+ crmBatchSelector = $('table.crm-batch-selector', $context).dataTable({
+ "bFilter" : false,
+ "bAutoWidth" : false,
+ "aaSorting" : [],
+ "aoColumns" : [
+ {sClass:'crm-batch-name'},
+ {sClass:'crm-batch-type'},
+ {sClass:'crm-batch-item_count right'},
+ {sClass:'crm-batch-total_amount right'},
+ {sClass:'crm-batch-status'},
+ {sClass:'crm-batch-created_by'},
+ {sClass:'crm-batch-links', bSortable:false}
+ ],
+ "bProcessing": true,
+ "asStripClasses" : [ "odd-row", "even-row" ],
+ "sPaginationType": "full_numbers",
+ "sDom" : '<"crm-datatable-pager-top"lfp>rt<"crm-datatable-pager-bottom"ip>',
+ "bServerSide": true,
+ "bJQueryUI": true,
+ "sAjaxSource": sourceUrl,
+ "iDisplayLength": 25,
+ "oLanguage": { "sZeroRecords": ZeroRecordText,
+ "sProcessing": {/literal}"{ts escape='js'}Processing...{/ts}"{literal},
+ "sLengthMenu": {/literal}"{ts escape='js'}Show _MENU_ entries{/ts}"{literal},
+ "sInfo": {/literal}"{ts escape='js'}Showing _START_ to _END_ of _TOTAL_ entries{/ts}"{literal},
+ "sInfoEmpty": {/literal}"{ts escape='js'}Showing 0 to 0 of 0 entries{/ts}"{literal},
+ "sInfoFiltered": {/literal}"{ts escape='js'}(filtered from _MAX_ total entries){/ts}"{literal},
+ "sSearch": {/literal}"{ts escape='js'}Search:{/ts}"{literal},
+ "oPaginate": {
+ "sFirst": {/literal}"{ts escape='js'}First{/ts}"{literal},
+ "sPrevious": {/literal}"{ts escape='js'}Previous{/ts}"{literal},
+ "sNext": {/literal}"{ts escape='js'}Next{/ts}"{literal},
+ "sLast": {/literal}"{ts escape='js'}Last{/ts}"{literal}
+ }
+ },
+ "fnServerData": function ( sSource, aoData, fnCallback ) {
+ if (filterSearch) {
+ aoData.push(
+ {name:'title', value: $('.crm-batch-search-form-block #title').val()}
+ );
+ }
+ $.ajax({
+ "dataType": 'json',
+ "type": "POST",
+ "url": sSource,
+ "data": aoData,
+ "success": fnCallback
+ });
+ }
});
}
- });
-}
+});
</script>
{/literal}
//carry survey and interviewer id,
//might be helpful if user jump from current tab to interview tab.
- var surveyId = cj( '#campaign_survey_id' ).val();
- var interviewerId = cj( '#survey_interviewer_id' ).val();
+ var surveyId = CRM.$( '#campaign_survey_id' ).val();
+ var interviewerId = CRM.$( '#survey_interviewer_id' ).val();
if ( surveyId ) dataUrl = dataUrl + '&sid=' + surveyId;
if ( interviewerId ) dataUrl = dataUrl + '&cid=' + interviewerId;
//lets carry qfKey to retain form session.
if ( qfKey ) dataUrl = dataUrl + '&qfKey=' + qfKey;
- cj.get( dataUrl, null, function( voterList ) {
- cj( '#voterList' ).html( voterList ).trigger('crmLoad');
+ CRM.$.get( dataUrl, null, function( voterList ) {
+ CRM.$( '#voterList' ).html( voterList ).trigger('crmLoad');
//collapse the search form.
var searchFormName = '#search_form_' + {/literal}'{$searchVoterFor}'{literal};
- cj( searchFormName + '.crm-accordion-wrapper:not(.collapsed)').crmAccordionToggle();
+ CRM.$( searchFormName + '.crm-accordion-wrapper:not(.collapsed)').crmAccordionToggle();
}, 'html' );
}
var sourceUrl = {/literal}"{crmURL p='civicrm/ajax/rest' h=0 q='snippet=4&className=CRM_Campaign_Page_AJAX&fnName=voterList' }"{literal};
var searchVoterFor = {/literal}'{$searchVoterFor}'{literal};
-
- cj( '.gotvVoterRecords' ).dataTable({
+ var $context = CRM.$('form#{/literal}{$form.formName}{literal}');
+ CRM.$( 'table.gotvVoterRecords', $context ).dataTable({
"bFilter" : false,
"bAutoWidth" : false,
"bProcessing": true,
"sDom" : '<"crm-datatable-pager-top"lfp>rt<"crm-datatable-pager-bottom"ip>',
"bServerSide": true,
"sAjaxSource": sourceUrl,
- "fnDrawCallback": function() { cj().crmtooltip(); },
+ "fnDrawCallback": function() { CRM.$().crmtooltip(); },
"fnServerData": function ( sSource, aoData, fnCallback ) {
var dataLength = aoData.length;
//get the search criteria.
var searchParams = {/literal}{$searchParams}{literal};
for ( param in searchParams ) {
- if ( val = cj( '#' + param ).val( ) ) {
+ if ( val = CRM.$( '#' + param ).val( ) ) {
aoData[dataLength++] = {name: param , value: val };
}
searchCriteria[count++] = param;
//lets transfer search criteria.
aoData[dataLength++] = {name: 'searchCriteria', value:searchCriteria.join(',')};
- cj.ajax( {
+ CRM.$.ajax( {
"dataType": 'json',
"type": "POST",
"url": sSource,
var data = new Object;
if ( operation == 'release' ) {
data['operation'] = operation;
- data['activity_id'] = cj( element ).val( );
- data['isDelete'] = cj( element ).prop('checked') ? 1:0;
+ data['activity_id'] = CRM.$( element ).val( );
+ data['isDelete'] = CRM.$( element ).prop('checked') ? 1:0;
} else if ( operation == 'reserve' ) {
- var interviewerId = cj( '#survey_interviewer_id' ).val( );
+ var interviewerId = CRM.$( '#survey_interviewer_id' ).val( );
data['operation'] = operation;
- data['source_record_id'] = cj( '#campaign_survey_id' ).val( );
- data['target_contact_id'] = cj( element ).val( );
+ data['source_record_id'] = CRM.$( '#campaign_survey_id' ).val( );
+ data['target_contact_id'] = CRM.$( element ).val( );
data['source_contact_id'] = interviewerId;
data['assignee_contact_id'] = interviewerId;
- data['isReserved'] = cj( element ).prop('checked') ? 1:0;
+ data['isReserved'] = CRM.$( element ).prop('checked') ? 1:0;
} else if ( operation == 'gotv' ) {
data['operation'] = operation;
- data['activity_id'] = cj( element ).val( );
- data['hasVoted'] = cj( element ).prop('checked') ? 1: 0;
+ data['activity_id'] = CRM.$( element ).val( );
+ data['hasVoted'] = CRM.$( element ).prop('checked') ? 1: 0;
}
data['surveyTitle'] = {/literal}'{$surveyTitle|escape:javascript}'{literal};
{literal};
//post data to save voter as voted/non voted.
- cj.post( actUrl,
+ CRM.$.post( actUrl,
data,
function( response ) {
if ( response.status == 'success' ) {
- var msgId = '#success_msg_' + cj( element ).val( );
- cj( msgId ).fadeIn('slow').fadeOut('slow');
+ var msgId = '#success_msg_' + CRM.$( element ).val( );
+ CRM.$( msgId ).fadeIn('slow').fadeOut('slow');
if ( operation == 'release' ) {
msg = '{/literal}{ts escape='js'}Save as voted.{/ts}{literal}';
- var isDeleted = cj( element ).prop('checked') ? 1:0;
+ var isDeleted = CRM.$( element ).prop('checked') ? 1:0;
if ( !isDeleted ) msg = '{/literal}{ts escape='js'}Save as non voted.{/ts}{literal}';
} else if ( operation == 'gotv' ) {
msg = '{/literal}{ts escape='js'}Vote Recorded.{/ts}{literal}';
- var hasVoted = cj( element ).prop('checked') ? 1:0;
- var trObject = cj( '[id^="survey_activity['+ cj( element ).val() +']"]' ).parents('tr' );
+ var hasVoted = CRM.$( element ).prop('checked') ? 1:0;
+ var trObject = CRM.$( '[id^="survey_activity['+ CRM.$( element ).val() +']"]' ).parents('tr' );
var methodName = 'addClass';
if ( !hasVoted ) {
msg = '{/literal}{ts escape='js'}Vote Cancelled.{/ts}{literal}';
}
eval( 'trObject.' + methodName + "( 'name disabled' )" );
} else if ( operation == 'reserve' ) {
- if ( cj( element ).prop('checked') ) {
+ if ( CRM.$( element ).prop('checked') ) {
msg = '{/literal}{ts escape='js'}Reserved.{/ts}{literal}';
} else {
msg = '{/literal}{ts escape='js'}Released.{/ts}{literal}';
}
}
- cj( msgId ).html( msg );
+ CRM.$( msgId ).html( msg );
}
}, 'json' );
dataUrl = dataUrl + '&qfKey=' + qfKey;
}
- cj.get(dataUrl, null, function (campaignList) {
- cj('#campaignList').html(campaignList).trigger('crmLoad');
+ CRM.$.get(dataUrl, null, function (campaignList) {
+ CRM.$('#campaignList').html(campaignList).trigger('crmLoad');
//collapse the search form.
var searchFormName = '#search_form_' + {/literal}'{$searchFor}'{literal};
- cj(searchFormName + '.crm-accordion-wrapper:not(.collapsed)').crmAccordionToggle();
+ CRM.$(searchFormName + '.crm-accordion-wrapper:not(.collapsed)').crmAccordionToggle();
}, 'html');
}
var count = 0;
var searchQill = new Array();
for (param in searchParams) {
- if (val = cj('#' + param).val()) {
+ if (val = CRM.$('#' + param).val()) {
if (param == 'status_id') {
val = campaignStatus[val];
}
}
}
noRecordFoundMsg += searchQill.join('<span class="font-italic"> ...AND... </span></div><div class="qill">');
-
- cj('.campaigns').dataTable({
+ var $context = CRM.$('#campaignList');
+ CRM.$('table.campaigns', $context).dataTable({
"bFilter": false,
"bAutoWidth": false,
"bProcessing": false,
"oLanguage": {"sEmptyTable": noRecordFoundMsg,
"sZeroRecords": noRecordFoundMsg },
"fnDrawCallback": function () {
- cj().crmtooltip();
+ CRM.$().crmtooltip();
},
"fnRowCallback": function (nRow, aData, iDisplayIndex) {
//insert the id for each row for enable/disable.
var rowId = 'campaign_row_' + aData[0];
- cj(nRow).attr('id', rowId);
+ CRM.$(nRow).attr('id', rowId);
//handled disabled rows.
var isActive = Boolean(Number(aData[10]));
if (!isActive) {
- cj(nRow).addClass('disabled');
+ CRM.$(nRow).addClass('disabled');
}
//add id for yes/no column.
- cj(nRow).children().eq(11).attr('id', rowId + '_status');
+ CRM.$(nRow).children().eq(11).attr('id', rowId + '_status');
return nRow;
},
if (param == 'campaign_title') {
fldName = 'title';
}
- if (val = cj('#' + param).val()) {
+ if (val = CRM.$('#' + param).val()) {
aoData[dataLength++] = {name: fldName, value: val};
}
searchCriteria[count++] = fldName;
//lets transfer search criteria.
aoData[dataLength++] = {name: 'searchCriteria', value: searchCriteria.join(',')};
- cj.ajax({
+ CRM.$.ajax({
"dataType": 'json',
"type": "POST",
"url": sSource,
//lets carry qfKey to retain form session.
if ( qfKey ) dataUrl = dataUrl + '&qfKey=' + qfKey;
- cj.get( dataUrl, null, function( petitionList ) {
- cj( '#petitionList' ).html( petitionList ).trigger('crmLoad');
+ CRM.$.get( dataUrl, null, function( petitionList ) {
+ CRM.$( '#petitionList' ).html( petitionList ).trigger('crmLoad');
//collapse the search form.
var searchFormName = '#search_form_' + {/literal}'{$searchFor}'{literal};
- cj( searchFormName + '.crm-accordion-wrapper:not(.collapsed)').crmAccordionToggle();
+ CRM.$( searchFormName + '.crm-accordion-wrapper:not(.collapsed)').crmAccordionToggle();
}, 'html' );
}
var count = 0;
var searchQill = new Array( );
for ( param in searchParams ) {
- if ( val = cj( '#' + param ).val( ) ) {
+ if ( val = CRM.$( '#' + param ).val( ) ) {
if ( param == 'petition_campaign_id' ) val = campaigns[val];
searchQill[count++] = searchParams[param] + ' : ' + val;
}
}
noRecordFoundMsg += searchQill.join( '<span class="font-italic"> ...AND... </span></div><div class="qill">' );
-
- cj( '.petitions' ).dataTable({
+ var $context = CRM.$('#petitionList');
+ CRM.$( 'table.petitions', $context ).dataTable({
"bFilter" : false,
"bAutoWidth" : false,
"bProcessing": false,
"asStripClasses" : [ "odd-row", "even-row" ],
"oLanguage":{"sEmptyTable" : noRecordFoundMsg,
"sZeroRecords" : noRecordFoundMsg },
- "fnDrawCallback": function() { cj().crmtooltip(); },
+ "fnDrawCallback": function() { CRM.$().crmtooltip(); },
"fnRowCallback": function( nRow, aData, iDisplayIndex ) {
//insert the id for each row for enable/disable.
var rowId = 'petition_row_' + aData[0];
- cj(nRow).attr( 'id', rowId );
+ CRM.$(nRow).attr( 'id', rowId );
//handled disabled rows.
var isActive = Boolean(Number(aData[7]));
- if ( !isActive ) cj(nRow).addClass( 'disabled' );
+ if ( !isActive ) CRM.$(nRow).addClass( 'disabled' );
//add id for yes/no column.
- cj(nRow).children().eq(8).attr( 'id', rowId + '_status' );
+ CRM.$(nRow).children().eq(8).attr( 'id', rowId + '_status' );
return nRow;
},
fldName = param;
if ( param == 'petition_title' ) fldName = 'title';
if ( param == 'petition_campaign_id' ) fldName = 'campaign_id';
- if ( val = cj( '#' + param ).val( ) ) {
+ if ( val = CRM.$( '#' + param ).val( ) ) {
aoData[dataLength++] = {name: fldName, value: val};
}
searchCriteria[count++] = fldName;
//lets transfer search criteria.
aoData[dataLength++] = {name: 'searchCriteria', value:searchCriteria.join(',')};
- cj.ajax( {
+ CRM.$.ajax( {
"dataType": 'json',
"type": "POST",
"url": sSource,
//lets carry qfKey to retain form session.
if ( qfKey ) dataUrl = dataUrl + '&qfKey=' + qfKey;
- cj.get( dataUrl, null, function( surveyList ) {
- cj( '#surveyList' ).html( surveyList ).trigger('crmLoad');
+ CRM.$.get( dataUrl, null, function( surveyList ) {
+ CRM.$( '#surveyList' ).html( surveyList ).trigger('crmLoad');
//collapse the search form.
var searchFormName = '#search_form_' + {/literal}'{$searchFor}'{literal};
- cj( searchFormName + '.crm-accordion-wrapper:not(.collapsed)').crmAccordionToggle();
+ CRM.$( searchFormName + '.crm-accordion-wrapper:not(.collapsed)').crmAccordionToggle();
}, 'html' );
}
var count = 0;
var searchQill = new Array( );
for ( param in searchParams ) {
- if ( val = cj( '#' + param ).val( ) ) {
+ if ( val = CRM.$( '#' + param ).val( ) ) {
if ( param == 'activity_type_id' ) val = surveyTypes[val];
if ( param == 'survey_campaign_id' ) val = surveyCampaigns[val];
searchQill[count++] = searchParams[param] + ' : ' + val;
}
}
noRecordFoundMsg += searchQill.join( '<span class="font-italic"> ...AND... </span></div><div class="qill">' );
-
- cj( '.surveys' ).dataTable({
+ var $context = CRM.$('#surveyList');
+ CRM.$( 'table.surveys', $context).dataTable({
"bFilter" : false,
"bAutoWidth" : false,
"bProcessing": false,
"asStripClasses" : [ "odd-row", "even-row" ],
"oLanguage":{"sEmptyTable" : noRecordFoundMsg,
"sZeroRecords" : noRecordFoundMsg },
- "fnDrawCallback": function() { cj().crmtooltip(); },
+ "fnDrawCallback": function() { CRM.$().crmtooltip(); },
"fnRowCallback": function( nRow, aData, iDisplayIndex ) {
//insert the id for each row for enable/disable.
var rowId = 'survey_row_' + aData[0];
- cj(nRow).attr( 'id', rowId );
+ CRM.$(nRow).attr( 'id', rowId );
//handled disabled rows.
var isActive = Boolean(Number(aData[10]));
- if ( !isActive ) cj(nRow).addClass( 'disabled' );
+ if ( !isActive ) CRM.$(nRow).addClass( 'disabled' );
//add id for yes/no column.
- cj(nRow).children().eq(11).attr( 'id', rowId + '_status' );
+ CRM.$(nRow).children().eq(11).attr( 'id', rowId + '_status' );
return nRow;
},
fldName = param;
if ( param == 'survey_title' ) fldName = 'title';
if ( param == 'survey_campaign_id' ) fldName = 'campaign_id';
- if ( val = cj( '#' + param ).val( ) ) {
+ if ( val = CRM.$( '#' + param ).val( ) ) {
aoData[dataLength++] = {name: fldName, value: val};
}
searchCriteria[count++] = fldName;
//lets transfer search criteria.
aoData[dataLength++] = {name: 'searchCriteria', value:searchCriteria.join(',')};
- cj.ajax( {
+ CRM.$.ajax( {
"dataType": 'json',
"type": "POST",
"url": sSource,
var content = '<tr><th>{/literal}{ts escape='js'}Label{/ts}{literal}</th><th>{/literal}{ts escape='js'}Value{/ts}{literal}</th><th>{/literal}{ts escape='js'}Recontact Interval{/ts}{literal}</th><th>{/literal}{ts escape='js'}Weight{/ts}{literal}</th></tr>';
var setTitle = '{/literal}{ts escape='js'}Result Set for{/ts} {literal}' + surveyTitle;
- cj.post( dataUrl, data, function( opGroup ) {
+ CRM.$.post( dataUrl, data, function( opGroup ) {
if ( opGroup.status == 'success' ) {
var result = opGroup.result;
for( key in result ) {
content += '<tr><td>'+ result[key].label +'</td><td>'+ result[key].value +'</td><td>'+ interval +'</td><td>'+ result[key].weight +'</td></tr>';
}
- cj("#survey-result-set-dialog").show( ).html('<table>'+content+'</table>').dialog({
+ CRM.$("#survey-result-set-dialog").show( ).html('<table>'+content+'</table>').dialog({
title: setTitle,
modal: true,
width: 480,
background: "black"
},
beforeclose: function(event, ui) {
- cj(this).dialog("destroy");
+ CRM.$(this).dialog("destroy");
}
});
}
// hide and display the appropriate blocks as directed by the php code
on_load_init_blocks( showRows, hideBlocks, '' );
- if (cj("#order_bys_2_column").val()){
- cj("#optionField_2").show();
+ if (CRM.$("#order_bys_2_column").val()){
+ CRM.$("#optionField_2").show();
}
- if (cj("#order_bys_3_column").val()){
- cj("#optionField_3").show();
+ if (CRM.$("#order_bys_3_column").val()){
+ CRM.$("#optionField_3").show();
}
- if (cj("#order_bys_4_column").val()){
- cj("#optionField_4").show();
+ if (CRM.$("#order_bys_4_column").val()){
+ CRM.$("#optionField_4").show();
}
function hideRow(i) {
showHideRow(i);
// clear values on hidden field, so they're not saved
- cj('select#order_by_column_'+ i).val('');
- cj('select#order_by_order_'+ i).val('ASC');
+ CRM.$('select#order_by_column_'+ i).val('');
+ CRM.$('select#order_by_order_'+ i).val('ASC');
}
{/literal}
</script>
</fieldset>
</div>
-
{literal}
<script type="text/javascript">
var updateVote = "{/literal}{ts escape='js'}Update Response{/ts}{literal}";
CRM.$(function($) {
var count = 0; var columns='';
- cj('#voterRecords-{/literal}{$instanceId}{literal} th').each( function( ) {
- if ( cj(this).attr('class') == 'contact_details' ) {
+ CRM.$('#voterRecords-{/literal}{$instanceId}{literal} th').each( function( ) {
+ if ( CRM.$(this).attr('class') == 'contact_details' ) {
columns += '{"sClass": "contact_details"},';
}
else {
eval('columns =[' + columns + ']');
//load jQuery data table.
- cj('#voterRecords-{/literal}{$instanceId}{literal}').dataTable( {
+ CRM.$('table#voterRecords-{/literal}{$instanceId}{literal}').dataTable( {
"sPaginationType": "full_numbers",
"bJQueryUI" : true,
"aoColumns" : columns
function registerInterview( voterId ) {
//reset all errors.
- cj( '#responseErrors' ).hide( ).html( '' );
+ CRM.$( '#responseErrors' ).hide( ).html( '' );
//collect all submitted data.
var data = new Object;
//get the values for common elements.
var fieldName = 'field_' + voterId + '_custom_';
var specialFieldType = new Array( 'radio', 'checkbox', 'select' );
- cj( '[id^="'+ fieldName +'"]' ).each( function( ) {
- fieldType = cj( this ).attr( 'type' );
+ CRM.$( '[id^="'+ fieldName +'"]' ).each( function( ) {
+ fieldType = CRM.$( this ).attr( 'type' );
if ( specialFieldType.indexOf( fieldType ) == -1 ) {
- data[cj(this).attr( 'id' )] = cj( this ).val( );
+ data[CRM.$(this).attr( 'id' )] = CRM.$( this ).val( );
}
});
//get the values for select.
- cj('select[id^="'+ fieldName +'"]').each( function( ) {
- value = cj(this).val( );
- if (cj(this).attr( 'multiple')) {
+ CRM.$('select[id^="'+ fieldName +'"]').each( function( ) {
+ value = CRM.$(this).val( );
+ if (CRM.$(this).attr( 'multiple')) {
values = value;
value = '';
if ( values ) {
}
}
}
- data[cj(this).attr('id')] = value;
+ data[CRM.$(this).attr('id')] = value;
});
var checkBoxField = 'field['+ voterId +'][custom_';
- cj('input:checkbox[name^="'+ checkBoxField +'"]').each( function( ) {
+ CRM.$('input:checkbox[name^="'+ checkBoxField +'"]').each( function( ) {
value = '';
- if (cj(this).is(':checked') == true) value = 1;
- data[cj(this).attr( 'name' )] = value;
+ if (CRM.$(this).is(':checked') == true) value = 1;
+ data[CRM.$(this).attr( 'name' )] = value;
});
var allRadios = new Object;
var radioField = 'field['+ voterId +'][custom_';
- cj('input:radio[name^="'+ radioField +'"]').each( function( ) {
- radioName = cj(this).attr( 'name' );
- if (cj(this).is(':checked') == true) {
- data[radioName] = cj(this).val();
+ CRM.$('input:radio[name^="'+ radioField +'"]').each( function( ) {
+ radioName = CRM.$(this).attr( 'name' );
+ if (CRM.$(this).is(':checked') == true) {
+ data[radioName] = CRM.$(this).val();
}
allRadios[radioName] = radioName;
});
//carry contact related profile field data.
var fieldName = 'field_' + voterId;
var checkBoxFieldName = 'field[' + voterId + ']';
- cj('[id^="'+ fieldName +'"], [id^="'+ checkBoxFieldName +'"]').each(function( ) {
- fldId = cj(this).attr('id');
+ CRM.$('[id^="'+ fieldName +'"], [id^="'+ checkBoxFieldName +'"]').each(function( ) {
+ fldId = CRM.$(this).attr('id');
if (fldId.indexOf('_custom_') == -1 &&
fldId.indexOf('_result') == -1 &&
fldId.indexOf('_note') == -1 ) {
- data[fldId] = cj(this).val( );
+ data[fldId] = CRM.$(this).val( );
}
});
data['interviewer_id'] = {/literal}{$interviewerId}{literal};
data['activity_type_id'] = {/literal}{$surveyTypeId}{literal};
data['activity_id'] = activityId;
- data['result'] = cj( '#field_' + voterId + '_result' ).val( );
- data['note'] = cj( '#field_' + voterId + '_note' ).val( );
+ data['result'] = CRM.$( '#field_' + voterId + '_result' ).val( );
+ data['note'] = CRM.$( '#field_' + voterId + '_note' ).val( );
data['surveyTitle'] = {/literal}'{$surveyValues.title|escape:javascript}'{literal};
data['survey_id'] = {/literal}'{$surveyValues.id}'{literal};
var dataUrl = {/literal}"{crmURL p='civicrm/campaign/registerInterview' h=0}"{literal}
//post data to create interview.
- cj.post(dataUrl, data, function(interview) {
+ CRM.$.post(dataUrl, data, function(interview) {
if ( interview.status == 'success' ) {
- cj("#row_"+voterId+' td.name').attr('class', 'name survey-completed' );
- cj('#restmsg_vote_' + voterId).fadeIn("slow").fadeOut("slow");
- cj('#interview_voter_button_' + voterId).html(updateVote);
- cj('#release_voter_button_' + voterId).hide( );
+ CRM.$("#row_"+voterId+' td.name').attr('class', 'name survey-completed' );
+ CRM.$('#restmsg_vote_' + voterId).fadeIn("slow").fadeOut("slow");
+ CRM.$('#interview_voter_button_' + voterId).html(updateVote);
+ CRM.$('#release_voter_button_' + voterId).hide( );
}
else if (interview.status == 'fail' && interview.errors) {
var errorList = '';
}
if ( errorList ) {
var allErrors = '<div class = "icon red-icon alert-icon"></div>Please correct the following errors in the survey fields below:' + '<ul>' + errorList + '</ul>';
- cj('#responseErrors').show( ).html(allErrors);
+ CRM.$('#responseErrors').show( ).html(allErrors);
}
}
}, 'json');
if ( !activityId ) return;
var operation = 'release';
- var isReleaseOrReserve = cj('#field_' + voterId + '_is_release_or_reserve').val( );
+ var isReleaseOrReserve = CRM.$('#field_' + voterId + '_is_release_or_reserve').val( );
if (isReleaseOrReserve == 1) {
operation = 'reserve';
isReleaseOrReserve = 0;
{literal};
//post data to release / reserve voter.
- cj.post( actUrl,
+ CRM.$.post( actUrl,
data,
function( response ) {
if (response.status == 'success') {
if ( operation == 'release' ) {
- cj( '#interview_voter_button_' + voterId ).hide( );
- cj( '#restmsg_release_or_reserve' + voterId ).fadeIn( 'slow' ).fadeOut( 'slow' );
- cj( '#row_' + voterId + ' td.name' ).addClass( 'disabled' );
- cj( '#release_voter_button_'+ voterId ).html( "{/literal}{ts escape='js'}reserve{/ts}{literal}" );
- cj( '#release_voter_button_' + voterId ).attr('title',"{/literal}{ts escape='js'}Reserve{/ts}{literal}");
+ CRM.$( '#interview_voter_button_' + voterId ).hide( );
+ CRM.$( '#restmsg_release_or_reserve' + voterId ).fadeIn( 'slow' ).fadeOut( 'slow' );
+ CRM.$( '#row_' + voterId + ' td.name' ).addClass( 'disabled' );
+ CRM.$( '#release_voter_button_'+ voterId ).html( "{/literal}{ts escape='js'}reserve{/ts}{literal}" );
+ CRM.$( '#release_voter_button_' + voterId ).attr('title',"{/literal}{ts escape='js'}Reserve{/ts}{literal}");
}
else {
- cj( '#interview_voter_button_' + voterId ).show( );
- cj( '#restmsg_release_or_reserve' + voterId ).fadeIn( 'slow' ).fadeOut( 'slow' );
- cj( '#row_' + voterId + ' td.name' ).removeClass( 'disabled' );
- cj( '#release_voter_button_'+ voterId ).html( "{/literal}{ts escape='js'}release{/ts}{literal}" );
- cj( '#release_voter_button_' + voterId ).attr('title',"{/literal}{ts escape='js'}Release{/ts}{literal}");
+ CRM.$( '#interview_voter_button_' + voterId ).show( );
+ CRM.$( '#restmsg_release_or_reserve' + voterId ).fadeIn( 'slow' ).fadeOut( 'slow' );
+ CRM.$( '#row_' + voterId + ' td.name' ).removeClass( 'disabled' );
+ CRM.$( '#release_voter_button_'+ voterId ).html( "{/literal}{ts escape='js'}release{/ts}{literal}" );
+ CRM.$( '#release_voter_button_' + voterId ).attr('title',"{/literal}{ts escape='js'}Release{/ts}{literal}");
}
- cj( '#field_' + voterId + '_is_release_or_reserve' ).val( isReleaseOrReserve );
+ CRM.$( '#field_' + voterId + '_is_release_or_reserve' ).val( isReleaseOrReserve );
}
},
'json');
function registerInterviewforall( ) {
var Ids = {/literal}{$componentIdsJson}{literal};
for (var contactid in Ids) {
- if (cj('#field_'+ Ids[contactid] +'_result').val()) {
+ if (CRM.$('#field_'+ Ids[contactid] +'_result').val()) {
registerInterview(Ids[contactid]);
- cj('#interview_voter_button').html(updateVoteforall);
+ CRM.$('#interview_voter_button').html(updateVoteforall);
}
}
}
sourceUrl = sourceUrl + '&cid={/literal}{$contactID}{literal}';
sourceUrl = sourceUrl + '&userID={/literal}{$userID}{literal}';
- cj('#case_id_'+CaseId+' th').each(function( ) {
- if (cj(this).attr('id') != 'nosort') {
- columns += '{"sClass": "' + cj(this).attr('class') +'"},';
+ CRM.$('#case_id_'+CaseId+' th').each(function( ) {
+ if (CRM.$(this).attr('id') != 'nosort') {
+ columns += '{"sClass": "' + CRM.$(this).attr('class') +'"},';
}
else {
columns += '{ "bSortable": false },';
columns = columns.substring(0, columns.length - 1 );
eval('columns =[' + columns + ']');
- oTable = cj('#case_id_'+CaseId).dataTable({
+ oTable = CRM.$('#case_id_'+CaseId).dataTable({
"bFilter" : false,
"bAutoWidth" : false,
"aaSorting" : [],
if ( filterSearch ) {
var activity_deleted = 0;
- if ( cj("#activity_deleted_"+CaseId+":checked").val() == 1 ) {
+ if ( CRM.$("#activity_deleted_"+CaseId+":checked").val() == 1 ) {
activity_deleted = 1;
}
aoData.push(
- {name:'status_id', value: cj("select#status_id_"+CaseId).val()},
- {name:'reporter_id', value: cj("select#reporter_id_"+CaseId).val()},
- {name:'activity_type_id', value: cj("select#activity_type_filter_id_"+CaseId).val()},
- {name:'activity_date_low', value: cj("#activity_date_low_"+CaseId).val()},
- {name:'activity_date_high', value: cj("#activity_date_high_"+CaseId).val() },
+ {name:'status_id', value: CRM.$("select#status_id_"+CaseId).val()},
+ {name:'reporter_id', value: CRM.$("select#reporter_id_"+CaseId).val()},
+ {name:'activity_type_id', value: CRM.$("select#activity_type_filter_id_"+CaseId).val()},
+ {name:'activity_date_low', value: CRM.$("#activity_date_low_"+CaseId).val()},
+ {name:'activity_date_high', value: CRM.$("#activity_date_high_"+CaseId).val() },
{name:'activity_deleted', value: activity_deleted }
);
}
- cj.ajax( {
+ CRM.$.ajax( {
"dataType": 'json',
"type": "POST",
"url": sSource,
}
function setSelectorClass(CaseId) {
- cj("#case_id_"+CaseId+" td:last-child").each( function( ) {
- cj(this).parent().addClass(cj(this).text() );
+ CRM.$("#case_id_"+CaseId+" td:last-child").each( function( ) {
+ CRM.$(this).parent().addClass(CRM.$(this).text() );
});
}
</script>
{if $hasAccessToAllCases}
<div class="crm-submit-buttons">
- <a class="button case-miniform" href="#addCaseRoleDialog" data-key="{crmKey name='civicrm/ajax/relation'}" rel="#caseRoles-selector"><div class="icon add-icon"></div>{ts}Add new role{/ts}</a>
+ <a class="button case-miniform" href="#addCaseRoleDialog" data-key="{crmKey name='civicrm/ajax/relation'}" rel="#caseRoles-selector-{$caseID}"><div class="icon add-icon"></div>{ts}Add new role{/ts}</a>
</div>
<div id="addCaseRoleDialog" class="hiddenElement">
<div>{$form.role_type.label}</div>
<div><input name="edit_role_contact_id" placeholder="{ts}- select contact -{/ts}" class="huge" /></div>
</div>
- <table id="caseRoles-selector" class="report-layout">
+ <table id="caseRoles-selector-{$caseID}" class="report-layout">
<thead><tr>
<th>{ts}Case Role{/ts}</th>
<th>{ts}Name{/ts}</th>
CRM.$(function($) {
buildCaseRoles(false);
- });
-
- function buildCaseRoles(filterSearch) {
- if(filterSearch) {
- oTable.fnDestroy();
- }
- var count = 0;
- var columns = '';
- var sourceUrl = {/literal}"{crmURL p='civicrm/ajax/caseroles' h=0 q='snippet=4&caseID='}{$caseID}"{literal};
- sourceUrl = sourceUrl + '&cid={/literal}{$contactID}{literal}';
- sourceUrl = sourceUrl + '&userID={/literal}{$userID}{literal}';
-
- cj('#caseRoles-selector th').each( function( ) {
- if ( cj(this).attr('id') != 'nosort' ) {
- columns += '{"sClass": "' + cj(this).attr('class') +'"},';
- }
- else {
- columns += '{ "bSortable": false },';
+ function buildCaseRoles(filterSearch) {
+ if(filterSearch) {
+ oTable.fnDestroy();
}
- count++;
- });
-
- columns = columns.substring(0, columns.length - 1 );
- eval('columns =[' + columns + ']');
-
- oTable = cj('#caseRoles-selector').dataTable({
- "bFilter" : false,
- "bAutoWidth" : false,
- "aaSorting" : [],
- "aoColumns" : columns,
- "bProcessing": true,
- "bJQueryUI": true,
- "asStripClasses" : [ "odd-row", "even-row" ],
- "sPaginationType": "full_numbers",
- "sDom" : '<"crm-datatable-pager-top"lfp>rt<"crm-datatable-pager-bottom"ip>',
- "bServerSide": true,
- "sAjaxSource": sourceUrl,
- "iDisplayLength": 10,
- "fnDrawCallback": function() { setCaseRolesSelectorClass(); },
- "fnServerData": function ( sSource, aoData, fnCallback ) {
- cj.ajax({
- "dataType": 'json',
- "type": "POST",
- "url": sSource,
- "data": aoData,
- "success": fnCallback
- });
- }
- });
- }
-
- function setCaseRolesSelectorClass( ) {
- cj("#caseRoles-selector td:last-child").each( function( ) {
- cj(this).parent().addClass(cj(this).text() );
- });
- }
+ var count = 0;
+ var columns = '';
+ var sourceUrl = {/literal}"{crmURL p='civicrm/ajax/caseroles' h=0 q='snippet=4&caseID='}{$caseID}"{literal};
+ sourceUrl = sourceUrl + '&cid={/literal}{$contactID}{literal}';
+ sourceUrl = sourceUrl + '&userID={/literal}{$userID}{literal}';
+
+ $('#caseRoles-selector-{/literal}{$caseID}{literal} th').each( function( ) {
+ if ( $(this).attr('id') != 'nosort' ) {
+ columns += '{"sClass": "' + $(this).attr('class') +'"},';
+ }
+ else {
+ columns += '{ "bSortable": false },';
+ }
+ count++;
+ });
+
+ columns = columns.substring(0, columns.length - 1 );
+ eval('columns =[' + columns + ']');
+
+ oTable = $('#caseRoles-selector-{/literal}{$caseID}{literal}').dataTable({
+ "bFilter" : false,
+ "bAutoWidth" : false,
+ "aaSorting" : [],
+ "aoColumns" : columns,
+ "bProcessing": true,
+ "bJQueryUI": true,
+ "asStripClasses" : [ "odd-row", "even-row" ],
+ "sPaginationType": "full_numbers",
+ "sDom" : '<"crm-datatable-pager-top"lfp>rt<"crm-datatable-pager-bottom"ip>',
+ "bServerSide": true,
+ "sAjaxSource": sourceUrl,
+ "iDisplayLength": 10,
+ "fnDrawCallback": function() { setCaseRolesSelectorClass(); },
+ "fnServerData": function ( sSource, aoData, fnCallback ) {
+ $.ajax({
+ "dataType": 'json',
+ "type": "POST",
+ "url": sSource,
+ "data": aoData,
+ "success": fnCallback
+ });
+ }
+ });
+ }
+ function setCaseRolesSelectorClass( ) {
+ $("#caseRoles-selector-{/literal}{$caseID}{literal} td:last-child").each( function( ) {
+ $(this).parent().addClass($(this).text() );
+ });
+ }
+ });
</script>
{/literal}
</div><!-- /.crm-accordion-body -->
<a class="button" href="{$relUrl}">
<div class="icon add-icon"></div>{ts}Add client relationship{/ts}</a>
</div>
- <table id="clientRelationships-selector" class="report-layout">
+ <table id="clientRelationships-selector-{$caseID}" class="report-layout">
<thead><tr>
<th>{ts}Client Relationship{/ts}</th>
<th>{ts}Name{/ts}</th>
{literal}
<script type="text/javascript">
CRM.$(function($) {
- buildCaseClientRelationships(false);
- });
-
- function buildCaseClientRelationships(filterSearch) {
- if (filterSearch) {
- oTable.fnDestroy();
+ buildCaseClientRelationships(false);
+ function buildCaseClientRelationships(filterSearch) {
+ if (filterSearch) {
+ oTable.fnDestroy();
+ }
+ var count = 0;
+ var columns = '';
+ var sourceUrl = {/literal}"{crmURL p='civicrm/ajax/clientrelationships' h=0 q='snippet=4&caseID='}{$caseID}"{literal};
+ sourceUrl = sourceUrl + '&cid={/literal}{$contactID}{literal}';
+ sourceUrl = sourceUrl + '&userID={/literal}{$userID}{literal}';
+
+ $('#clientRelationships-selector-{/literal}{$caseID}{literal} th').each( function( ) {
+ if ( $(this).attr('id') != 'nosort' ) {
+ columns += '{"sClass": "' + $(this).attr('class') +'"},';
+ }
+ else {
+ columns += '{ "bSortable": false },';
+ }
+ count++;
+ });
+
+ columns = columns.substring(0, columns.length - 1 );
+ eval('columns =[' + columns + ']');
+
+ oTable = $('#clientRelationships-selector-{/literal}{$caseID}{literal}').dataTable({
+ "bFilter" : false,
+ "bAutoWidth" : false,
+ "aaSorting" : [],
+ "aoColumns" : columns,
+ "bProcessing": true,
+ "bJQueryUI": true,
+ "asStripClasses" : [ "odd-row", "even-row" ],
+ "sPaginationType": "full_numbers",
+ "sDom" : '<"crm-datatable-pager-top"lfp>rt<"crm-datatable-pager-bottom"ip>',
+ "bServerSide": true,
+ "sAjaxSource": sourceUrl,
+ "iDisplayLength": 10,
+ "fnDrawCallback": function() { setClientRelationshipsSelectorClass(); },
+ "fnServerData": function (sSource, aoData, fnCallback) {
+ $.ajax( {
+ "dataType": 'json',
+ "type": "POST",
+ "url": sSource,
+ "data": aoData,
+ "success": fnCallback
+ });
+ }
+ });
}
- var count = 0;
- var columns = '';
- var sourceUrl = {/literal}"{crmURL p='civicrm/ajax/clientrelationships' h=0 q='snippet=4&caseID='}{$caseID}"{literal};
- sourceUrl = sourceUrl + '&cid={/literal}{$contactID}{literal}';
- sourceUrl = sourceUrl + '&userID={/literal}{$userID}{literal}';
-
- cj('#clientRelationships-selector th').each( function( ) {
- if ( cj(this).attr('id') != 'nosort' ) {
- columns += '{"sClass": "' + cj(this).attr('class') +'"},';
- }
- else {
- columns += '{ "bSortable": false },';
- }
- count++;
- });
-
- columns = columns.substring(0, columns.length - 1 );
- eval('columns =[' + columns + ']');
-
- oTable = cj('#clientRelationships-selector').dataTable({
- "bFilter" : false,
- "bAutoWidth" : false,
- "aaSorting" : [],
- "aoColumns" : columns,
- "bProcessing": true,
- "bJQueryUI": true,
- "asStripClasses" : [ "odd-row", "even-row" ],
- "sPaginationType": "full_numbers",
- "sDom" : '<"crm-datatable-pager-top"lfp>rt<"crm-datatable-pager-bottom"ip>',
- "bServerSide": true,
- "sAjaxSource": sourceUrl,
- "iDisplayLength": 10,
- "fnDrawCallback": function() { setClientRelationshipsSelectorClass(); },
- "fnServerData": function (sSource, aoData, fnCallback) {
- cj.ajax( {
- "dataType": 'json',
- "type": "POST",
- "url": sSource,
- "data": aoData,
- "success": fnCallback
- } );
- }
- });
- }
-
- function setClientRelationshipsSelectorClass( ) {
- cj("#clientRelationships-selector td:last-child").each(function() {
- cj(this).parent().addClass(cj(this).text());
- });
- }
+
+ function setClientRelationshipsSelectorClass( ) {
+ $("#clientRelationships-selector-{/literal}{$caseID}{literal} td:last-child").each(function() {
+ $(this).parent().addClass($(this).text());
+ });
+ }
+ });
</script>
{/literal}
<br />
{if !empty($globalGroupInfo.id)}
<div class="crm-submit-buttons">
- <a class="button case-miniform" href="#addMembersToGroupDialog" rel="#globalRelationships-selector" data-group_id="{$globalGroupInfo.id}">
+ <a class="button case-miniform" href="#addMembersToGroupDialog" rel="#globalRelationships-selector-{$caseId}" data-group_id="{$globalGroupInfo.id}">
<div class="icon add-icon"></div>{ts 1=$globalGroupInfo.title}Add members to %1{/ts}
</a>
</div>
<div id="addMembersToGroupDialog" class="hiddenElement">
<input name="add_member_to_group_contact_id" placeholder="{ts}- select contact -{/ts}" class="huge" />
</div>
- <table id="globalRelationships-selector" class="report-layout">
+ <table id="globalRelationships-selector-{$caseId}" class="report-layout">
<thead><tr>
<th>{$globalGroupInfo.title}</th>
<th>{ts}Phone{/ts}</th>
{literal}
<script type="text/javascript">
-
- CRM.$(function($) {
- buildCaseGlobalRelationships(false);
- });
-
- function buildCaseGlobalRelationships(filterSearch) {
- if (filterSearch) {
- oTable.fnDestroy();
- }
- var count = 0;
- var columns = '';
- var sourceUrl = {/literal}"{crmURL p='civicrm/ajax/globalrelationships' h=0 q='snippet=4&caseID='}{$caseID}"{literal};
- sourceUrl = sourceUrl + '&cid={/literal}{$contactID}{literal}';
- sourceUrl = sourceUrl + '&userID={/literal}{$userID}{literal}';
-
- cj('#globalRelationships-selector th').each( function( ) {
- if (cj(this).attr('id') != 'nosort') {
- columns += '{"sClass": "' + cj(this).attr('class') +'"},';
- }
- else {
- columns += '{ "bSortable": false },';
- }
- count++;
- });
-
- columns = columns.substring(0, columns.length - 1 );
- eval('columns =[' + columns + ']');
-
- oTable = cj('#globalRelationships-selector').dataTable({
- "bFilter" : false,
- "bAutoWidth" : false,
- "aaSorting" : [],
- "aoColumns" : columns,
- "bProcessing": true,
- "bJQueryUI": true,
- "asStripClasses" : [ "odd-row", "even-row" ],
- "sPaginationType": "full_numbers",
- "sDom" : '<"crm-datatable-pager-top"lfp>rt<"crm-datatable-pager-bottom"ip>',
- "bServerSide": true,
- "sAjaxSource": sourceUrl,
- "iDisplayLength": 10,
- "fnDrawCallback": function() { setGlobalRelationshipsSelectorClass(); },
- "oLanguage": {
- "sEmptyTable": {/literal}'{ts escape='js' 1=$globalGroupInfo.title}The group %1 has no members.{/ts}'{literal}
- },
- "fnServerData": function ( sSource, aoData, fnCallback ) {
- cj.ajax( {
- "dataType": 'json',
- "type": "POST",
- "url": sSource,
- "data": aoData,
- "success": fnCallback
- } );
- }
- });
- }
-
- function setGlobalRelationshipsSelectorClass( ) {
- cj("#globalRelationships-selector td:last-child").each( function( ) {
- cj(this).parent().addClass(cj(this).text() );
- });
- }
+ CRM.$(function($) {
+ buildCaseGlobalRelationships(false);
+ function buildCaseGlobalRelationships(filterSearch) {
+ if (filterSearch) {
+ oTable.fnDestroy();
+ }
+ var count = 0;
+ var columns = '';
+ var sourceUrl = {/literal}"{crmURL p='civicrm/ajax/globalrelationships' h=0 q='snippet=4&caseID='}{$caseID}"{literal};
+ sourceUrl = sourceUrl + '&cid={/literal}{$contactID}{literal}';
+ sourceUrl = sourceUrl + '&userID={/literal}{$userID}{literal}';
+
+ $('#globalRelationships-selector-{/literal}{$caseID}{literal} th').each( function( ) {
+ if ($(this).attr('id') != 'nosort') {
+ columns += '{"sClass": "' + $(this).attr('class') +'"},';
+ }
+ else {
+ columns += '{ "bSortable": false },';
+ }
+ count++;
+ });
+
+ columns = columns.substring(0, columns.length - 1 );
+ eval('columns =[' + columns + ']');
+
+ oTable = $('#globalRelationships-selector-{/literal}{$caseID}{literal}').dataTable({
+ "bFilter" : false,
+ "bAutoWidth" : false,
+ "aaSorting" : [],
+ "aoColumns" : columns,
+ "bProcessing": true,
+ "bJQueryUI": true,
+ "asStripClasses" : [ "odd-row", "even-row" ],
+ "sPaginationType": "full_numbers",
+ "sDom" : '<"crm-datatable-pager-top"lfp>rt<"crm-datatable-pager-bottom"ip>',
+ "bServerSide": true,
+ "sAjaxSource": sourceUrl,
+ "iDisplayLength": 10,
+ "fnDrawCallback": function() { setGlobalRelationshipsSelectorClass(); },
+ "oLanguage": {
+ "sEmptyTable": {/literal}'{ts escape='js' 1=$globalGroupInfo.title}The group %1 has no members.{/ts}'{literal}
+ },
+ "fnServerData": function ( sSource, aoData, fnCallback ) {
+ $.ajax( {
+ "dataType": 'json',
+ "type": "POST",
+ "url": sSource,
+ "data": aoData,
+ "success": fnCallback
+ });
+ }
+ });
+ }
+
+ function setGlobalRelationshipsSelectorClass( ) {
+ $("#globalRelationships-selector-{/literal}{$caseID}{literal} td:last-child").each( function( ) {
+ $(this).parent().addClass($(this).text() );
+ });
+ }
+ });
</script>
{/literal}
</div><!-- /.crm-accordion-body -->
CRM.$(function($) {
buildContactRelationships{/literal}{$context}{literal}();
- });
-
- function buildContactRelationships{/literal}{$context}{literal}() {
- var context = {/literal}"{$context}"{literal};
- var sourceUrl = {/literal}'{crmURL p="civicrm/ajax/contactrelationships" h=0 q="context=$context&cid=$contactId"}'{literal};
+ function buildContactRelationships{/literal}{$context}{literal}() {
+ var context = {/literal}"{$context}"{literal};
+ var sourceUrl = {/literal}'{crmURL p="civicrm/ajax/contactrelationships" h=0 q="context=$context&cid=$contactId"}'{literal};
- if (context == 'user') {
- var ZeroRecordText = {/literal}'{ts escape="js"}There are no related contacts / organizations on record for you.{/ts}'{literal};
- }
- else if (context == 'past') {
- var ZeroRecordText = {/literal}'{ts escape="js"}There are no past / disabled relationships for this contact.{/ts}'{literal};
- }
- else {
- var ZeroRecordText = {/literal}'{ts escape="js"}There are no relationships entered for this contact.{/ts}'{literal};
- }
+ if (context == 'user') {
+ var ZeroRecordText = {/literal}'{ts escape="js"}There are no related contacts / organizations on record for you.{/ts}'{literal};
+ }
+ else if (context == 'past') {
+ var ZeroRecordText = {/literal}'{ts escape="js"}There are no past / disabled relationships for this contact.{/ts}'{literal};
+ }
+ else {
+ var ZeroRecordText = {/literal}'{ts escape="js"}There are no relationships entered for this contact.{/ts}'{literal};
+ }
- {/literal}{$context}{literal}oTable = cj('.crm-contact-relationship-selector-' + context).dataTable({
- "bFilter": false,
- "bAutoWidth": false,
- "aaSorting": [],
- "aoColumns": [
- {sClass: 'crm-contact-relationship-type'},
- {sClass: 'crm-contact-relationship-contact_name'},
- {sClass: 'crm-contact-relationship-start_date'},
- {sClass: 'crm-contact-relationship-end_date'},
- {sClass: 'crm-contact-relationship-city'},
- {sClass: 'crm-contact-relationship-state'},
- {sClass: 'crm-contact-relationship-email'},
- {sClass: 'crm-contact-relationship-phone'},
- {sClass: 'crm-contact-relationship-links', bSortable: false},
- {sClass: 'hiddenElement', bSortable: false},
- {sClass: 'hiddenElement', bSortable: false}
- ],
- "bProcessing": true,
- "sPaginationType": "full_numbers",
- "sDom": '<"crm-datatable-pager-top"lfp>rt<"crm-datatable-pager-bottom"ip>',
- "bServerSide": true,
- "bJQueryUI": true,
- "sAjaxSource": sourceUrl,
- "iDisplayLength": 10,
- "oLanguage": {
- "sZeroRecords": ZeroRecordText,
- "sProcessing": {/literal}"{ts escape='js'}Processing...{/ts}"{literal},
- "sLengthMenu": {/literal}"{ts escape='js'}Show _MENU_ entries{/ts}"{literal},
- "sInfo": {/literal}"{ts escape='js'}Showing _START_ to _END_ of _TOTAL_ entries{/ts}"{literal},
- "sInfoEmpty": {/literal}"{ts escape='js'}Showing 0 to 0 of 0 entries{/ts}"{literal},
- "sInfoFiltered": {/literal}"{ts escape='js'}(filtered from _MAX_ total entries){/ts}"{literal},
- "sSearch": {/literal}"{ts escape='js'}Search:{/ts}"{literal},
- "oPaginate": {
- "sFirst": {/literal}"{ts escape='js'}First{/ts}"{literal},
- "sPrevious": {/literal}"{ts escape='js'}Previous{/ts}"{literal},
- "sNext": {/literal}"{ts escape='js'}Next{/ts}"{literal},
- "sLast": {/literal}"{ts escape='js'}Last{/ts}"{literal}
- }
- },
- "fnDrawCallback": function () {
- {/literal}{if $context eq 'current'}{literal}
- if (cj('#tab_rel').length) {
- CRM.tabHeader.updateCount(cj('#tab_rel'), currentoTable.fnSettings().fnRecordsTotal());
- }
- {/literal}{/if}{literal}
- },
- "fnRowCallback": function( nRow, aData, iDisplayIndex, iDisplayIndexFull) {
- cj(nRow).attr('id', 'relationship-'+ aData[9]);
- if (aData[10] == 0) {
- cj(nRow).addClass('crm-entity disabled');
- }
- else {
- cj(nRow).addClass('crm-entity');
+ {/literal}{$context}{literal}oTable = $('table.crm-contact-relationship-selector-' + context).dataTable({
+ "bFilter": false,
+ "bAutoWidth": false,
+ "aaSorting": [],
+ "aoColumns": [
+ {sClass: 'crm-contact-relationship-type'},
+ {sClass: 'crm-contact-relationship-contact_name'},
+ {sClass: 'crm-contact-relationship-start_date'},
+ {sClass: 'crm-contact-relationship-end_date'},
+ {sClass: 'crm-contact-relationship-city'},
+ {sClass: 'crm-contact-relationship-state'},
+ {sClass: 'crm-contact-relationship-email'},
+ {sClass: 'crm-contact-relationship-phone'},
+ {sClass: 'crm-contact-relationship-links', bSortable: false},
+ {sClass: 'hiddenElement', bSortable: false},
+ {sClass: 'hiddenElement', bSortable: false}
+ ],
+ "bProcessing": true,
+ "sPaginationType": "full_numbers",
+ "sDom": '<"crm-datatable-pager-top"lfp>rt<"crm-datatable-pager-bottom"ip>',
+ "bServerSide": true,
+ "bJQueryUI": true,
+ "sAjaxSource": sourceUrl,
+ "iDisplayLength": 10,
+ "oLanguage": {
+ "sZeroRecords": ZeroRecordText,
+ "sProcessing": {/literal}"{ts escape='js'}Processing...{/ts}"{literal},
+ "sLengthMenu": {/literal}"{ts escape='js'}Show _MENU_ entries{/ts}"{literal},
+ "sInfo": {/literal}"{ts escape='js'}Showing _START_ to _END_ of _TOTAL_ entries{/ts}"{literal},
+ "sInfoEmpty": {/literal}"{ts escape='js'}Showing 0 to 0 of 0 entries{/ts}"{literal},
+ "sInfoFiltered": {/literal}"{ts escape='js'}(filtered from _MAX_ total entries){/ts}"{literal},
+ "sSearch": {/literal}"{ts escape='js'}Search:{/ts}"{literal},
+ "oPaginate": {
+ "sFirst": {/literal}"{ts escape='js'}First{/ts}"{literal},
+ "sPrevious": {/literal}"{ts escape='js'}Previous{/ts}"{literal},
+ "sNext": {/literal}"{ts escape='js'}Next{/ts}"{literal},
+ "sLast": {/literal}"{ts escape='js'}Last{/ts}"{literal}
+ }
+ },
+ "fnDrawCallback": function () {
+ {/literal}{if $context eq 'current'}{literal}
+ if ($('#tab_rel').length) {
+ CRM.tabHeader.updateCount($('#tab_rel'), currentoTable.fnSettings().fnRecordsTotal());
+ }
+ {/literal}{/if}{literal}
+ },
+ "fnRowCallback": function( nRow, aData, iDisplayIndex, iDisplayIndexFull) {
+ $(nRow).attr('id', 'relationship-'+ aData[9]);
+ if (aData[10] == 0) {
+ $(nRow).addClass('crm-entity disabled');
+ }
+ else {
+ $(nRow).addClass('crm-entity');
+ }
}
- }
- });
- }
+ });
+ }
+ });
</script>
{/literal}
{literal}
<script type="text/javascript">
CRM.$(function($) {
- cj('#_qf_BatchTransaction_submit-top, #_qf_BatchTransaction_submit-botttom').click(function() {
- cj('.crm-batch_transaction_search-accordion:not(.collapsed)').crmAccordionToggle();
+ CRM.$('#_qf_BatchTransaction_submit-top, #_qf_BatchTransaction_submit-botttom').click(function() {
+ CRM.$('.crm-batch_transaction_search-accordion:not(.collapsed)').crmAccordionToggle();
});
var batchStatus = {/literal}{$statusID}{literal};
// build transaction listing only for open batches
buildTransactionSelectorAssign( false );
}
buildTransactionSelectorRemove();
- cj('#_qf_BatchTransaction_submit-botttom, #_qf_BatchTransaction_submit-top').click( function() {
+ CRM.$('#_qf_BatchTransaction_submit-botttom, #_qf_BatchTransaction_submit-top').click( function() {
buildTransactionSelectorAssign( true );
return false;
});
- cj("#trans_assign").prop('disabled',true);
- cj("#trans_remove").prop('disabled',true);
- cj('#crm-transaction-selector-assign-{/literal}{$entityID}{literal} #toggleSelect').click( function() {
+ CRM.$("#trans_assign").prop('disabled',true);
+ CRM.$("#trans_remove").prop('disabled',true);
+ CRM.$('#crm-transaction-selector-assign-{/literal}{$entityID}{literal} #toggleSelect').click( function() {
enableActions('x');
});
- cj('#crm-transaction-selector-remove-{/literal}{$entityID}{literal} #toggleSelects').click( function() {
+ CRM.$('#crm-transaction-selector-remove-{/literal}{$entityID}{literal} #toggleSelects').click( function() {
enableActions('y');
});
- cj('#Go').click( function() {
+ CRM.$('#Go').click( function() {
return selectAction("trans_assign","toggleSelect", "crm-transaction-selector-assign-{/literal}{$entityID}{literal} input[id^='mark_x_']");
});
- cj('#GoRemove').click( function() {
+ CRM.$('#GoRemove').click( function() {
return selectAction("trans_remove","toggleSelects", "crm-transaction-selector-remove-{/literal}{$entityID}{literal} input[id^='mark_y_']");
});
- cj('#Go').click( function() {
- if (cj("#trans_assign" ).val() != "" && cj("input[id^='mark_x_']").is(':checked')) {
+ CRM.$('#Go').click( function() {
+ if (CRM.$("#trans_assign" ).val() != "" && CRM.$("input[id^='mark_x_']").is(':checked')) {
bulkAssignRemove('Assign');
}
return false;
});
- cj('#GoRemove').click( function() {
- if (cj("#trans_remove" ).val() != "" && cj("input[id^='mark_y_']").is(':checked')) {
+ CRM.$('#GoRemove').click( function() {
+ if (CRM.$("#trans_remove" ).val() != "" && CRM.$("input[id^='mark_y_']").is(':checked')) {
bulkAssignRemove('Remove');
}
return false;
});
- cj("#crm-transaction-selector-assign-{/literal}{$entityID}{literal} input[id^='mark_x_']").click( function() {
+ CRM.$("#crm-transaction-selector-assign-{/literal}{$entityID}{literal} input[id^='mark_x_']").click( function() {
enableActions('x');
});
- cj("#crm-transaction-selector-remove-{/literal}{$entityID}{literal} input[id^='mark_y_']").click( function() {
+ CRM.$("#crm-transaction-selector-remove-{/literal}{$entityID}{literal} input[id^='mark_y_']").click( function() {
enableActions('y');
});
- cj("#crm-transaction-selector-assign-{/literal}{$entityID}{literal} #toggleSelect").click( function() {
- if (cj("#crm-transaction-selector-assign-{/literal}{$entityID}{literal} #toggleSelect").is(':checked')) {
- cj("#crm-transaction-selector-assign-{/literal}{$entityID}{literal} input[id^='mark_x_']").prop('checked',true);
+ CRM.$("#crm-transaction-selector-assign-{/literal}{$entityID}{literal} #toggleSelect").click( function() {
+ if (CRM.$("#crm-transaction-selector-assign-{/literal}{$entityID}{literal} #toggleSelect").is(':checked')) {
+ CRM.$("#crm-transaction-selector-assign-{/literal}{$entityID}{literal} input[id^='mark_x_']").prop('checked',true);
}
else {
- cj("#crm-transaction-selector-assign-{/literal}{$entityID}{literal} input[id^='mark_x_']").prop('checked',false);
+ CRM.$("#crm-transaction-selector-assign-{/literal}{$entityID}{literal} input[id^='mark_x_']").prop('checked',false);
}
});
- cj("#crm-transaction-selector-remove-{/literal}{$entityID}{literal} #toggleSelects").click( function() {
- if (cj("#crm-transaction-selector-remove-{/literal}{$entityID}{literal} #toggleSelects").is(':checked')) {
- cj("#crm-transaction-selector-remove-{/literal}{$entityID}{literal} input[id^='mark_y_']").prop('checked',true);
+ CRM.$("#crm-transaction-selector-remove-{/literal}{$entityID}{literal} #toggleSelects").click( function() {
+ if (CRM.$("#crm-transaction-selector-remove-{/literal}{$entityID}{literal} #toggleSelects").is(':checked')) {
+ CRM.$("#crm-transaction-selector-remove-{/literal}{$entityID}{literal} input[id^='mark_y_']").prop('checked',true);
}
else {
- cj("#crm-transaction-selector-remove-{/literal}{$entityID}{literal} input[id^='mark_y_']").prop('checked',false);
+ CRM.$("#crm-transaction-selector-remove-{/literal}{$entityID}{literal} input[id^='mark_y_']").prop('checked',false);
}
});
}
function enableActions( type ) {
if (type == 'x') {
- cj("#trans_assign").prop('disabled',false);
+ CRM.$("#trans_assign").prop('disabled',false);
}
else {
- cj("#trans_remove").prop('disabled',false);
+ CRM.$("#trans_remove").prop('disabled',false);
}
}
var ZeroRecordText = '<div class="status messages">{/literal}{ts escape="js"}No Contributions found for your search criteria.{/ts}{literal}</li></ul></div>';
}
- crmBatchSelector1 = cj('#crm-transaction-selector-assign-{/literal}{$entityID}{literal}').dataTable({
+ crmBatchSelector1 = CRM.$('#crm-transaction-selector-assign-{/literal}{$entityID}{literal}').dataTable({
"bDestroy" : true,
"bFilter" : false,
"bAutoWidth" : false,
},
"fnServerData": function ( sSource, aoData, fnCallback ) {
if ( filterSearch ) {
- cj('#searchForm :input').each(function() {
- if (cj(this).val()) {
+ CRM.$('#searchForm :input').each(function() {
+ if (CRM.$(this).val()) {
aoData.push(
- {name:cj(this).attr('id'), value: cj(this).val()}
+ {name:CRM.$(this).attr('id'), value: CRM.$(this).val()}
);
- cj(':radio, :checkbox').each(function() {
- if (cj(this).is(':checked')) {
- aoData.push( { name: cj(this).attr('name'), value: cj(this).val() } );
+ CRM.$(':radio, :checkbox').each(function() {
+ if (CRM.$(this).is(':checked')) {
+ aoData.push( { name: CRM.$(this).attr('name'), value: CRM.$(this).val() } );
}
});
}
});
}
- cj.ajax({
+ CRM.$.ajax({
"dataType": 'json',
"type": "POST",
"url": sSource,
var columns = '';
var sourceUrl = {/literal}'{crmURL p="civicrm/ajax/rest" h=0 q="className=CRM_Financial_Page_AJAX&fnName=getFinancialTransactionsList&snippet=4&context=financialBatch&entityID=$entityID&statusID=$statusID"}'{literal};
- crmBatchSelector = cj('#crm-transaction-selector-remove-{/literal}{$entityID}{literal}').dataTable({
+ crmBatchSelector = CRM.$('#crm-transaction-selector-remove-{/literal}{$entityID}{literal}').dataTable({
"bDestroy" : true,
"bFilter" : false,
"bAutoWidth" : false,
}
},
"fnServerData": function (sSource, aoData, fnCallback) {
- cj.ajax({
+ CRM.$.ajax({
"dataType": 'json',
"type": "POST",
"url": sSource,
}
function selectAction( id, toggleSelectId, checkId ) {
- if (cj("#"+ id ).is(':disabled')) {
+ if (CRM.$("#"+ id ).is(':disabled')) {
return false;
}
- else if (!cj("#" + toggleSelectId).is(':checked') && !cj("#" + checkId).is(':checked') && cj("#" + id).val() != "") {
+ else if (!CRM.$("#" + toggleSelectId).is(':checked') && !CRM.$("#" + checkId).is(':checked') && CRM.$("#" + id).val() != "") {
CRM.alert ({/literal}'{ts escape="js"}Please select one or more contributions for this action.{/ts}'{literal});
return false;
}
- else if (cj("#" + id).val() == "") {
+ else if (CRM.$("#" + id).val() == "") {
CRM.alert ({/literal}'{ts escape="js"}Please select an action from the drop-down menu.{/ts}'{literal});
return false;
}
var postUrl = {/literal}"{crmURL p='civicrm/ajax/rest' h=0 q="className=CRM_Financial_Page_AJAX&fnName=bulkAssignRemove&entityID=$entityID" }"{literal};
var fids = [];
if (action == 'Assign') {
- cj("input[id^='mark_x_']:checked").each( function () {
- var a = cj(this).attr('id');
+ CRM.$("input[id^='mark_x_']:checked").each( function () {
+ var a = CRM.$(this).attr('id');
fids.push(a);
});
}
if (action == 'Remove') {
- cj("input[id^='mark_y_']:checked").each( function () {
- var a = cj(this).attr('id');
+ CRM.$("input[id^='mark_y_']:checked").each( function () {
+ var a = CRM.$(this).attr('id');
fids.push(a);
});
}
- cj.post(postUrl, { ID: fids, action:action }, function(data) {
+ CRM.$.post(postUrl, { ID: fids, action:action }, function(data) {
//this is custom status set when record update success.
if (data.status == 'record-updated-success') {
buildTransactionSelectorAssign( true );
CRM.$(function($) {
var entityID = {/literal}{$entityID}{literal};
batchSummary(entityID);
- cj('#close_batch').click( function() {
+ CRM.$('#close_batch').click( function() {
assignRemove(entityID, 'close');
return false;
});
- cj('#export_batch').click( function() {
+ CRM.$('#export_batch').click( function() {
assignRemove(entityID, 'export');
return false;
});
var mismatch = checkMismatch();
}
else {
- cj('#mark_x_' + recordID).closest('tr').block({message: {/literal}'{ts escape="js"}Updating{/ts}'{literal}});
+ CRM.$('#mark_x_' + recordID).closest('tr').block({message: {/literal}'{ts escape="js"}Updating{/ts}'{literal}});
}
if (op == 'close' || (op == 'export' && mismatch.length)) {
- cj("#enableDisableStatusMsg").dialog({
+ CRM.$("#enableDisableStatusMsg").dialog({
title: {/literal}'{ts escape="js"}Close Batch{/ts}'{literal},
modal: true,
open:function() {
else {
var msg = {/literal}'{ts escape="js"}Are you sure you want to close and export this batch?{/ts}'{literal};
}
- cj('#enableDisableStatusMsg').show().html(msg + mismatch);
+ CRM.$('#enableDisableStatusMsg').show().html(msg + mismatch);
},
buttons: {
{/literal}"{ts escape='js'}Cancel{/ts}"{literal}: function() {
- cj(this).dialog("close");
+ CRM.$(this).dialog("close");
},
{/literal}"{ts escape='js'}OK{/ts}"{literal}: function() {
- cj(this).dialog("close");
+ CRM.$(this).dialog("close");
saveRecord(recordID, op, recordBAO, entityID);
}
}
}
var postUrl = {/literal}"{crmURL p='civicrm/ajax/rest' h=0 q='className=CRM_Financial_Page_AJAX&fnName=assignRemove'}"{literal};
//post request and get response
- cj.post( postUrl, { records: [recordID], recordBAO: recordBAO, op:op, entityID:entityID, key: {/literal}"{crmKey name='civicrm/ajax/ar'}"{literal} }, function( html ){
+ CRM.$.post( postUrl, { records: [recordID], recordBAO: recordBAO, op:op, entityID:entityID, key: {/literal}"{crmKey name='civicrm/ajax/ar'}"{literal} }, function( html ){
//this is custom status set when record update success.
if (html.status == 'record-updated-success') {
if (op == 'close') {
function batchSummary(entityID) {
var postUrl = {/literal}"{crmURL p='civicrm/ajax/rest' h=0 q='className=CRM_Financial_Page_AJAX&fnName=getBatchSummary'}"{literal};
//post request and get response
- cj.post( postUrl, {batchID: entityID}, function(html) {
- cj.each(html, function(i, val) {
- cj("#row_" + i).html(val);
+ CRM.$.post( postUrl, {batchID: entityID}, function(html) {
+ CRM.$.each(html, function(i, val) {
+ CRM.$("#row_" + i).html(val);
});
},
'json');
function checkMismatch() {
var txt = '';
- var enteredItem = cj("#row_item_count").text();
- var assignedItem = cj("#row_assigned_item_count").text();
- var enteredTotal = cj("#row_total").text();
- var assignedTotal = cj("#row_assigned_total").text();
+ var enteredItem = CRM.$("#row_item_count").text();
+ var assignedItem = CRM.$("#row_assigned_item_count").text();
+ var enteredTotal = CRM.$("#row_total").text();
+ var assignedTotal = CRM.$("#row_assigned_total").text();
if (enteredItem != "" && enteredItem != assignedItem) {
txt = '{/literal}<div class="messages crm-error"><strong>Item Count mismatch:</strong><br/>{ts escape="js"}Expected{/ts}:' + enteredItem +'<br/>{ts escape="js"}Current Total{/ts}:' + assignedItem + '</div>{literal}';
}
.on('click', 'a.button, a.action-item[href*="action=update"], a.action-item[href*="action=delete"]', CRM.popup)
.on('crmPopupFormSuccess', 'a.button, a.action-item[href*="action=update"], a.action-item[href*="action=delete"]', function() {
// Refresh datatable when form completes
- $('.crm-group-selector').dataTable().fnDraw();
+ var $context = $('#crm-main-content-wrapper');
+ $('table.crm-group-selector',$context ).dataTable().fnDraw();
});
-});
-function buildGroupSelector( filterSearch, parentsOnlyArg ) {
+ function buildGroupSelector( filterSearch, parentsOnlyArg ) {
if ( filterSearch ) {
- if (typeof crmGroupSelector !== 'undefined') {
- crmGroupSelector.fnDestroy();
- }
- var parentsOnly = 0;
- var ZeroRecordText = '<div class="status messages">{/literal}{ts escape="js"}No matching Groups found for your search criteria. Suggestions:{/ts}{literal}<div class="spacer"></div><ul><li>{/literal}{ts escape="js"}Check your spelling.{/ts}{literal}</li><li>{/literal}{ts escape="js"}Try a different spelling or use fewer letters.{/ts}{literal}</li><li>{/literal}{ts escape="js"}Make sure you have enough privileges in the access control system.{/ts}{literal}</li></ul></div>';
+ if (typeof crmGroupSelector !== 'undefined') {
+ crmGroupSelector.fnDestroy();
+ }
+ var parentsOnly = 0;
+ var ZeroRecordText = '<div class="status messages">{/literal}{ts escape="js"}No matching Groups found for your search criteria. Suggestions:{/ts}{literal}<div class="spacer"></div><ul><li>{/literal}{ts escape="js"}Check your spelling.{/ts}{literal}</li><li>{/literal}{ts escape="js"}Try a different spelling or use fewer letters.{/ts}{literal}</li><li>{/literal}{ts escape="js"}Make sure you have enough privileges in the access control system.{/ts}{literal}</li></ul></div>';
} else {
var parentsOnly = 1;
var ZeroRecordText = {/literal}'{ts escape="js"}<div class="status messages">No Groups have been created for this site.{/ts}</div>'{literal};
var columns = '';
var sourceUrl = {/literal}'{crmURL p="civicrm/ajax/grouplist" h=0 q="snippet=4"}'{literal};
var showOrgInfo = {/literal}"{$showOrgInfo}"{literal};
+ var $context = $('#crm-main-content-wrapper');
- crmGroupSelector = cj('.crm-group-selector').dataTable({
+ crmGroupSelector = $('table.crm-group-selector', $context).dataTable({
"bFilter" : false,
"bAutoWidth" : false,
"aaSorting" : [],
}
},
"fnRowCallback": function(nRow, aData, iDisplayIndex, iDisplayIndexFull) {
- var id = cj('td:eq(1)', nRow).text();
- cj(nRow).addClass('crm-entity').attr('data-entity', 'group').attr('data-id', id);
- cj('td:eq(0)', nRow).wrapInner('<span class="crm-editable crmf-name" />');
- cj('td:eq(3)', nRow).wrapInner('<span class="crm-editable crmf-description" data-type="textarea" />');
+ var id = $('td:eq(1)', nRow).text();
+ $(nRow).addClass('crm-entity').attr('data-entity', 'group').attr('data-id', id);
+ $('td:eq(0)', nRow).wrapInner('<span class="crm-editable crmf-name" />');
+ $('td:eq(3)', nRow).wrapInner('<span class="crm-editable crmf-description" data-type="textarea" />');
return nRow;
},
"fnDrawCallback": function() {
setSelectorClass( parentsOnly, showOrgInfo );
- cj('.crm-editable').crmEditable();
+ $('.crm-editable').crmEditable();
},
"fnServerData": function ( sSource, aoData, fnCallback ) {
aoData.push( {name:'showOrgInfo', value: showOrgInfo },
);
if ( filterSearch ) {
var groupTypes = '';
- cj('#group_type-block input').each(function(index) {
- if (cj(this).prop('checked')) {
+ $('#group_type-block input').each(function(index) {
+ if ($(this).prop('checked')) {
if (groupTypes) {
- groupTypes = groupTypes + ',' + cj(this).attr('id').substr(11);
+ groupTypes = groupTypes + ',' + $(this).attr('id').substr(11);
}
else {
- groupTypes = cj(this).attr('id').substr(11);
+ groupTypes = $(this).attr('id').substr(11);
}
}
});
var groupStatus = '';
- if ( cj('.crm-group-search-form-block #group_status_1').prop('checked') ) {
+ if ( $('.crm-group-search-form-block #group_status_1').prop('checked') ) {
groupStatus = '1';
}
- if ( cj('.crm-group-search-form-block #group_status_2').prop('checked') ) {
+ if ( $('.crm-group-search-form-block #group_status_2').prop('checked') ) {
if ( groupStatus ) {
groupStatus = '3';
} else {
}
aoData.push(
- {name:'title', value: cj('.crm-group-search-form-block #title').val()},
- {name:'created_by', value: cj('.crm-group-search-form-block #created_by').val()},
+ {name:'title', value: $('.crm-group-search-form-block #title').val()},
+ {name:'created_by', value: $('.crm-group-search-form-block #created_by').val()},
{name:'group_type', value: groupTypes },
- {name:'visibility', value: cj('.crm-group-search-form-block #visibility').val()},
+ {name:'visibility', value: $('.crm-group-search-form-block #visibility').val()},
{name:'status', value: groupStatus }
);
}
- cj.ajax( {
+ $.ajax( {
"dataType": 'json',
"type": "POST",
"url": sSource,
} );
}
});
-}
+ }
-function setSelectorClass( parentsOnly, showOrgInfo ) {
- cj('.crm-group-selector tr').each( function( ) {
- var className = cj(this).find('td:last-child').text();
- cj(this).addClass( className );
- var rowID = cj(this).find('td:nth-child(2)').text();
- cj(this).prop( 'id', 'row_' + rowID );
- if (parentsOnly) {
- if ( cj(this).hasClass('crm-group-parent') ) {
- cj(this).find('td:first').prepend('{/literal}<span class="collapsed show-children" title="{ts}show child groups{/ts}"/></span>{literal}');
+ function setSelectorClass( parentsOnly, showOrgInfo ) {
+ var $context = $('#crm-main-content-wrapper');
+ $('table.crm-group-selector tr', $context).each( function( ) {
+ var className = $(this).find('td:last-child').text();
+ $(this).addClass( className );
+ var rowID = $(this).find('td:nth-child(2)').text();
+ $(this).prop( 'id', 'row_' + rowID );
+ if (parentsOnly) {
+ if ( $(this).hasClass('crm-group-parent') ) {
+ $(this).find('td:first').prepend('{/literal}<span class="collapsed show-children" title="{ts}show child groups{/ts}"/></span>{literal}');
+ }
}
+ });
+ }
+ // show hide children
+ var $context = $('#crm-main-content-wrapper');
+ $('table.crm-group-selector', $context).on( 'click', 'span.show-children', function(){
+ var showOrgInfo = {/literal}"{$showOrgInfo}"{literal};
+ var rowID = $(this).parents('tr').prop('id');
+ var parentRow = rowID.split('_');
+ var parent_id = parentRow[1];
+ var group_id = '';
+ if ( parentRow[2]) {
+ group_id = parentRow[2];
+ }
+ var levelClass = 'level_2';
+ // check enclosing td if already at level 2
+ if ( $(this).parent().hasClass('level_2') ) {
+ levelClass = 'level_3';
+ }
+ if ( $(this).hasClass('collapsed') ) {
+ $(this).removeClass("collapsed").addClass("expanded").attr("title",{/literal}"{ts escape='js'}hide child groups{/ts}"{literal});
+ showChildren( parent_id, showOrgInfo, group_id, levelClass );
+ }
+ else {
+ $(this).removeClass("expanded").addClass("collapsed").attr("title",{/literal}"{ts escape='js'}show child groups{/ts}"{literal});
+ $('.parent_is_' + parent_id).find('.show-children').removeClass("expanded").addClass("collapsed").attr("title",{/literal}"{ts escape='js'}show child groups{/ts}"{literal});
+ $('.parent_is_' + parent_id).hide();
+ $('.parent_is_' + parent_id).each(function(i, obj) {
+ // also hide children of children
+ var gID = $(this).find('td:nth-child(2)').text();
+ $('.parent_is_' + gID).hide();
+ });
}
});
-}
-
-// show hide children
-cj('.crm-group-selector').on( 'click', 'span.show-children', function(){
- var showOrgInfo = {/literal}"{$showOrgInfo}"{literal};
- var rowID = cj(this).parents('tr').prop('id');
- var parentRow = rowID.split('_');
- var parent_id = parentRow[1];
- var group_id = '';
- if ( parentRow[2]) {
- group_id = parentRow[2];
- }
- var levelClass = 'level_2';
- // check enclosing td if already at level 2
- if ( cj(this).parent().hasClass('level_2') ) {
- levelClass = 'level_3';
- }
- if ( cj(this).hasClass('collapsed') ) {
- cj(this).removeClass("collapsed").addClass("expanded").attr("title",{/literal}"{ts escape='js'}hide child groups{/ts}"{literal});
- showChildren( parent_id, showOrgInfo, group_id, levelClass );
- }
- else {
- cj(this).removeClass("expanded").addClass("collapsed").attr("title",{/literal}"{ts escape='js'}show child groups{/ts}"{literal});
- cj('.parent_is_' + parent_id).find('.show-children').removeClass("expanded").addClass("collapsed").attr("title",{/literal}"{ts escape='js'}show child groups{/ts}"{literal});
- cj('.parent_is_' + parent_id).hide();
- cj('.parent_is_' + parent_id).each(function(i, obj) {
- // also hide children of children
- var gID = cj(this).find('td:nth-child(2)').text();
- cj('.parent_is_' + gID).hide();
- });
+ function showChildren( parent_id, showOrgInfo, group_id, levelClass) {
+ var rowID = '#row_' + parent_id;
+ if ( group_id ) {
+ rowID = '#row_' + parent_id + '_' + group_id;
+ }
+ if ( $(rowID).next().hasClass('parent_is_' + parent_id ) ) {
+ // child rows for this parent have already been retrieved so just show them
+ $('.parent_is_' + parent_id ).show();
+ } else {
+ var sourceUrl = {/literal}'{crmURL p="civicrm/ajax/grouplist" h=0 q="snippet=4"}'{literal};
+ $.ajax( {
+ "dataType": 'json',
+ "url": sourceUrl,
+ "data": {'parent_id': parent_id, 'showOrgInfo': showOrgInfo},
+ "success": function(response){
+ var appendHTML = '';
+ $.each( response, function( i, val ) {
+ appendHTML += '<tr id="row_'+ val.group_id +'_'+parent_id+'" data-entity="group" data-id="'+ val.group_id +'" class="crm-entity parent_is_' + parent_id + ' crm-row-child ' + val.class + '">';
+ if ( val.is_parent ) {
+ appendHTML += '<td class="crm-group-name ' + levelClass + '">' + '{/literal}<span class="collapsed show-children" title="{ts}show child groups{/ts}"/></span>{literal}<span class="crm-editable crmf-name">' + val.group_name + '</span></td>';
+ }
+ else {
+ appendHTML += '<td class="crm-group-name ' + levelClass + '"><span class="crm-no-children"></span><span class="crm-editable crmf-name">' + val.group_name + '</span></td>';
+ }
+ appendHTML += "<td>" + val.group_id + "</td>";
+ appendHTML += "<td>" + val.created_by + "</td>";
+ appendHTML += '<td><span class="crm-editable crmf-description" data-type="textarea">' + (val.group_description || '') + "</span></td>";
+ appendHTML += "<td>" + val.group_type + "</td>";
+ appendHTML += "<td>" + val.visibility + "</td>";
+ if (showOrgInfo) {
+ appendHTML += "<td>" + val.org_info + "</td>";
+ }
+ appendHTML += "<td>" + val.links + "</td>";
+ appendHTML += "</tr>";
+ });
+ $( rowID ).after( appendHTML );
+ $( rowID ).next().trigger('crmLoad');
+ $('.crm-editable').crmEditable();
+ }
+ });
+ }
}
});
-function showChildren( parent_id, showOrgInfo, group_id, levelClass) {
- var rowID = '#row_' + parent_id;
- if ( group_id ) {
- rowID = '#row_' + parent_id + '_' + group_id;
- }
- if ( cj(rowID).next().hasClass('parent_is_' + parent_id ) ) {
- // child rows for this parent have already been retrieved so just show them
- cj('.parent_is_' + parent_id ).show();
- } else {
- var sourceUrl = {/literal}'{crmURL p="civicrm/ajax/grouplist" h=0 q="snippet=4"}'{literal};
- cj.ajax( {
- "dataType": 'json',
- "url": sourceUrl,
- "data": {'parent_id': parent_id, 'showOrgInfo': showOrgInfo},
- "success": function(response){
- var appendHTML = '';
- cj.each( response, function( i, val ) {
- appendHTML += '<tr id="row_'+ val.group_id +'_'+parent_id+'" data-entity="group" data-id="'+ val.group_id +'" class="crm-entity parent_is_' + parent_id + ' crm-row-child ' + val.class + '">';
- if ( val.is_parent ) {
- appendHTML += '<td class="crm-group-name ' + levelClass + '">' + '{/literal}<span class="collapsed show-children" title="{ts}show child groups{/ts}"/></span>{literal}<span class="crm-editable crmf-name">' + val.group_name + '</span></td>';
- }
- else {
- appendHTML += '<td class="crm-group-name ' + levelClass + '"><span class="crm-no-children"></span><span class="crm-editable crmf-name">' + val.group_name + '</span></td>';
- }
- appendHTML += "<td>" + val.group_id + "</td>";
- appendHTML += "<td>" + val.created_by + "</td>";
- appendHTML += '<td><span class="crm-editable crmf-description" data-type="textarea">' + (val.group_description || '') + "</span></td>";
- appendHTML += "<td>" + val.group_type + "</td>";
- appendHTML += "<td>" + val.visibility + "</td>";
- if (showOrgInfo) {
- appendHTML += "<td>" + val.org_info + "</td>";
- }
- appendHTML += "<td>" + val.links + "</td>";
- appendHTML += "</tr>";
- });
- cj( rowID ).after( appendHTML );
- cj( rowID ).next().trigger('crmLoad');
- cj('.crm-editable').crmEditable();
- }
- } );
- }
-}
-
</script>
{/literal}