From: Divya Jose Date: Mon, 12 May 2014 12:06:12 +0000 (+0530) Subject: --Added closure and changes cj to $ X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=2c68626a547e4de5d4c4fdcefd758609646f9a46;p=civicrm-core.git --Added closure and changes cj to $ --- diff --git a/templates/CRM/Activity/Selector/Selector.tpl b/templates/CRM/Activity/Selector/Selector.tpl index 54870dc144..cdcac06909 100644 --- a/templates/CRM/Activity/Selector/Selector.tpl +++ b/templates/CRM/Activity/Selector/Selector.tpl @@ -59,108 +59,107 @@ {include file="CRM/Case/Form/ActivityToCase.tpl" contactID=$contactId} {literal} {/literal} diff --git a/templates/CRM/Batch/Form/Search.tpl b/templates/CRM/Batch/Form/Search.tpl index dd93a85594..627d6169a2 100644 --- a/templates/CRM/Batch/Form/Search.tpl +++ b/templates/CRM/Batch/Form/Search.tpl @@ -58,78 +58,79 @@ {/literal} diff --git a/templates/CRM/Campaign/Form/Gotv.tpl b/templates/CRM/Campaign/Form/Gotv.tpl index 5e81d4719b..932fecf79c 100755 --- a/templates/CRM/Campaign/Form/Gotv.tpl +++ b/templates/CRM/Campaign/Form/Gotv.tpl @@ -98,20 +98,20 @@ function searchVoters( qfKey ) //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' ); } @@ -120,8 +120,8 @@ function loadVoterList( ) 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, @@ -132,7 +132,7 @@ function loadVoterList( ) "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; @@ -143,7 +143,7 @@ function loadVoterList( ) //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; @@ -155,7 +155,7 @@ function loadVoterList( ) //lets transfer search criteria. aoData[dataLength++] = {name: 'searchCriteria', value:searchCriteria.join(',')}; - cj.ajax( { + CRM.$.ajax( { "dataType": 'json', "type": "POST", "url": sSource, @@ -174,20 +174,20 @@ function processVoterData( element, operation ) 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}; @@ -196,20 +196,20 @@ function processVoterData( element, operation ) {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}'; @@ -217,13 +217,13 @@ function processVoterData( element, operation ) } 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' ); diff --git a/templates/CRM/Campaign/Form/Search/Campaign.tpl b/templates/CRM/Campaign/Form/Search/Campaign.tpl index 865ffee2c5..4b649568c8 100755 --- a/templates/CRM/Campaign/Form/Search/Campaign.tpl +++ b/templates/CRM/Campaign/Form/Search/Campaign.tpl @@ -161,12 +161,12 @@ 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'); } @@ -184,7 +184,7 @@ 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]; } @@ -195,8 +195,8 @@ } } noRecordFoundMsg += searchQill.join(' ...AND...
'); - - cj('.campaigns').dataTable({ + var $context = CRM.$('#campaignList'); + CRM.$('table.campaigns', $context).dataTable({ "bFilter": false, "bAutoWidth": false, "bProcessing": false, @@ -226,20 +226,20 @@ "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; }, @@ -257,7 +257,7 @@ 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; @@ -269,7 +269,7 @@ //lets transfer search criteria. aoData[dataLength++] = {name: 'searchCriteria', value: searchCriteria.join(',')}; - cj.ajax({ + CRM.$.ajax({ "dataType": 'json', "type": "POST", "url": sSource, diff --git a/templates/CRM/Campaign/Form/Search/Petition.tpl b/templates/CRM/Campaign/Form/Search/Petition.tpl index 5c85ecb995..2dd48b7d7c 100755 --- a/templates/CRM/Campaign/Form/Search/Petition.tpl +++ b/templates/CRM/Campaign/Form/Search/Petition.tpl @@ -142,12 +142,12 @@ function searchPetitions( qfKey ) //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' ); } @@ -166,14 +166,14 @@ function loadPetitionList( ) 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( ' ...AND...
' ); - - cj( '.petitions' ).dataTable({ + var $context = CRM.$('#petitionList'); + CRM.$( 'table.petitions', $context ).dataTable({ "bFilter" : false, "bAutoWidth" : false, "bProcessing": false, @@ -198,17 +198,17 @@ function loadPetitionList( ) "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; }, @@ -225,7 +225,7 @@ function loadPetitionList( ) 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; @@ -237,7 +237,7 @@ function loadPetitionList( ) //lets transfer search criteria. aoData[dataLength++] = {name: 'searchCriteria', value:searchCriteria.join(',')}; - cj.ajax( { + CRM.$.ajax( { "dataType": 'json', "type": "POST", "url": sSource, diff --git a/templates/CRM/Campaign/Form/Search/Survey.tpl b/templates/CRM/Campaign/Form/Search/Survey.tpl index a50f5c2d2d..95ee318ea6 100755 --- a/templates/CRM/Campaign/Form/Search/Survey.tpl +++ b/templates/CRM/Campaign/Form/Search/Survey.tpl @@ -150,12 +150,12 @@ function searchSurveys( qfKey ) //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' ); } @@ -175,15 +175,15 @@ function loadSurveyList( ) 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( ' ...AND...
' ); - - cj( '.surveys' ).dataTable({ + var $context = CRM.$('#surveyList'); + CRM.$( 'table.surveys', $context).dataTable({ "bFilter" : false, "bAutoWidth" : false, "bProcessing": false, @@ -213,17 +213,17 @@ function loadSurveyList( ) "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; }, @@ -240,7 +240,7 @@ function loadSurveyList( ) 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; @@ -252,7 +252,7 @@ function loadSurveyList( ) //lets transfer search criteria. aoData[dataLength++] = {name: 'searchCriteria', value:searchCriteria.join(',')}; - cj.ajax( { + CRM.$.ajax( { "dataType": 'json', "type": "POST", "url": sSource, @@ -271,7 +271,7 @@ function displayResultSet( surveyId, surveyTitle, OptionGroupId ) { var content = '{/literal}{ts escape='js'}Label{/ts}{literal}{/literal}{ts escape='js'}Value{/ts}{literal}{/literal}{ts escape='js'}Recontact Interval{/ts}{literal}{/literal}{ts escape='js'}Weight{/ts}{literal}'; 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 ) { @@ -282,7 +282,7 @@ function displayResultSet( surveyId, surveyTitle, OptionGroupId ) { content += ''+ result[key].label +''+ result[key].value +''+ interval +''+ result[key].weight +''; } - cj("#survey-result-set-dialog").show( ).html(''+content+'
').dialog({ + CRM.$("#survey-result-set-dialog").show( ).html(''+content+'
').dialog({ title: setTitle, modal: true, width: 480, @@ -291,7 +291,7 @@ function displayResultSet( surveyId, surveyTitle, OptionGroupId ) { background: "black" }, beforeclose: function(event, ui) { - cj(this).dialog("destroy"); + CRM.$(this).dialog("destroy"); } }); } diff --git a/templates/CRM/Campaign/Form/Task/Interview.tpl b/templates/CRM/Campaign/Form/Task/Interview.tpl index c1dee1e932..3b2a8c88cb 100644 --- a/templates/CRM/Campaign/Form/Task/Interview.tpl +++ b/templates/CRM/Campaign/Form/Task/Interview.tpl @@ -98,21 +98,21 @@ // 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} @@ -204,7 +204,6 @@
- {literal} diff --git a/templates/CRM/Case/Form/CaseView.tpl b/templates/CRM/Case/Form/CaseView.tpl index af81584988..3eb79817f2 100644 --- a/templates/CRM/Case/Form/CaseView.tpl +++ b/templates/CRM/Case/Form/CaseView.tpl @@ -147,7 +147,7 @@ {if $hasAccessToAllCases}
-
{ts}Add new role{/ts}
+
{ts}Add new role{/ts}
{$form.role_type.label}
@@ -162,7 +162,7 @@
- +
@@ -184,63 +184,61 @@ 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() ); + }); + } + }); {/literal} @@ -258,7 +256,7 @@
{ts}Add client relationship{/ts}
-
{ts}Case Role{/ts} {ts}Name{/ts}
+
@@ -276,76 +274,75 @@ {literal} {/literal}
{if !empty($globalGroupInfo.id)}
- +
{ts 1=$globalGroupInfo.title}Add members to %1{/ts}
-
{ts}Client Relationship{/ts} {ts}Name{/ts}
+
@@ -356,68 +353,66 @@ {literal} {/literal} diff --git a/templates/CRM/Contact/Page/View/RelationshipSelector.tpl b/templates/CRM/Contact/Page/View/RelationshipSelector.tpl index fae62fcb90..965aada020 100644 --- a/templates/CRM/Contact/Page/View/RelationshipSelector.tpl +++ b/templates/CRM/Contact/Page/View/RelationshipSelector.tpl @@ -49,78 +49,77 @@ 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'); + } } - } - }); - } + }); + } + }); {/literal} diff --git a/templates/CRM/Financial/Form/BatchTransaction.tpl b/templates/CRM/Financial/Form/BatchTransaction.tpl index c5f457484e..648725d1fe 100644 --- a/templates/CRM/Financial/Form/BatchTransaction.tpl +++ b/templates/CRM/Financial/Form/BatchTransaction.tpl @@ -90,8 +90,8 @@ {literal} {/literal}
{$globalGroupInfo.title} {ts}Phone{/ts}