From ae8f569f53c5ff36db7145b516fd5a0af3a9a6c4 Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Fri, 8 Aug 2014 15:30:26 +0100 Subject: [PATCH] Legacy js cleanup - change cj to $ within closures --- CRM/Admin/Form/Setting/Mapping.php | 4 +- CRM/Contribute/Form/Contribution.php | 2 +- CRM/Pledge/Form/Pledge.php | 2 +- templates/CRM/Activity/Form/Activity.tpl | 6 +- templates/CRM/Activity/Form/Search.tpl | 16 +- templates/CRM/Activity/Form/Search/Common.tpl | 20 +- .../CRM/Admin/Form/Preferences/Display.tpl | 48 ++- .../CRM/Admin/Form/ScheduleReminders.tpl | 65 ++-- templates/CRM/Admin/Form/Setting/Mapping.tpl | 17 +- templates/CRM/Admin/Form/Setting/Smtp.tpl | 30 +- templates/CRM/Admin/Page/Extensions.tpl | 12 +- templates/CRM/Admin/Page/MessageTemplates.tpl | 4 +- templates/CRM/Admin/Page/Navigation.tpl | 198 ++++++------ templates/CRM/Admin/Page/Tag.tpl | 3 +- templates/CRM/Batch/Form/Entry.js | 42 +-- templates/CRM/Batch/Form/Entry.tpl | 36 +-- templates/CRM/Block/RecentlyViewed.tpl | 6 +- templates/CRM/Campaign/Form/Gotv.tpl | 2 +- templates/CRM/Campaign/Form/Petition.tpl | 8 +- .../CRM/Campaign/Form/Petition/Block.tpl | 6 +- templates/CRM/Campaign/Form/ResultOptions.tpl | 4 +- .../CRM/Campaign/Form/Search/Campaign.tpl | 4 +- .../CRM/Campaign/Form/Search/Petition.tpl | 4 +- templates/CRM/Campaign/Form/Search/Survey.tpl | 4 +- templates/CRM/Campaign/Form/Survey/Main.tpl | 8 +- templates/CRM/Case/Form/Activity.tpl | 6 +- .../CRM/Case/Form/ActivityChangeStatusJs.tpl | 2 +- .../Form/Edit/CommunicationPreferences.tpl | 34 +- templates/CRM/Contact/Form/Edit/Lock.tpl | 20 +- .../Form/Inline/CommunicationPreferences.tpl | 22 +- templates/CRM/Contact/Form/Merge.tpl | 14 +- .../Contact/Form/Search/Criteria/Basic.tpl | 18 +- .../Form/Search/Criteria/ChangeLog.tpl | 30 +- .../Contact/Form/Search/Criteria/Location.tpl | 6 +- templates/CRM/Contact/Form/ShareAddress.tpl | 80 ++--- .../CRM/Contact/Import/Form/MapTable.tpl | 10 +- templates/CRM/Contact/Page/Dashlet.tpl | 20 +- .../Form/AdditionalInfo/Premium.tpl | 2 +- .../CRM/Contribute/Form/Contribution.tpl | 45 +-- .../Form/Contribution/MembershipBlock.tpl | 8 +- .../Form/Contribution/OnBehalfOf.tpl | 6 +- .../Form/Contribution/PremiumBlock.tpl | 102 +++--- .../Form/ContributionPage/AddProduct.tpl | 50 ++- .../Form/ContributionPage/Amount.tpl | 2 +- .../Form/ContributionPage/Premium.tpl | 6 +- templates/CRM/Contribute/Page/PaymentInfo.tpl | 8 +- templates/CRM/Core/BillingBlock.tpl | 86 ++--- templates/CRM/Custom/Form/ChangeFieldType.tpl | 6 +- templates/CRM/Custom/Form/Group.tpl | 48 +-- templates/CRM/Event/Form/EventFees.tpl | 2 +- templates/CRM/Event/Form/ManageEvent/Fee.tpl | 2 +- .../Form/ManageEvent/ScheduleReminders.tpl | 2 +- templates/CRM/Event/Form/Participant.tpl | 28 +- .../Event/Form/ParticipantFeeSelection.tpl | 2 +- templates/CRM/Event/Form/Task/Batch.tpl | 6 +- templates/CRM/Financial/Form/Export.tpl | 8 +- templates/CRM/Mailing/Form/Count.tpl | 70 ++-- templates/CRM/Mailing/Form/InsertTokens.tpl | 40 +-- templates/CRM/Mailing/Form/Schedule.tpl | 16 +- templates/CRM/Mailing/Form/Settings.tpl | 18 +- templates/CRM/Mailing/Page/Event.tpl | 2 +- templates/CRM/Member/Form/Membership.tpl | 13 +- templates/CRM/Member/Form/MembershipBlock.tpl | 4 +- .../CRM/Member/Form/MembershipRenewal.tpl | 4 +- templates/CRM/Member/Form/MembershipType.tpl | 16 +- templates/CRM/Pledge/Form/Pledge.tpl | 47 +-- templates/CRM/Price/Form/LineItem.tpl | 2 +- templates/CRM/Profile/Form/Dynamic.tpl | 2 +- templates/CRM/Profile/Form/Search.tpl | 4 +- templates/CRM/Queue/Page/Runner.tpl | 46 +-- templates/CRM/Report/Form/Criteria.tpl | 10 +- .../Report/Form/Event/ParticipantListing.tpl | 7 +- templates/CRM/Report/Form/Instance.tpl | 8 +- templates/CRM/Report/Form/Layout/Graph.tpl | 2 +- templates/CRM/SMS/Form/Schedule.tpl | 16 +- templates/CRM/UF/Form/Block.tpl | 4 +- templates/CRM/UF/Form/Field.tpl | 5 +- templates/CRM/UF/Page/Group.tpl | 4 +- templates/CRM/common/TrackingFields.tpl | 2 +- templates/CRM/common/additionalBlocks.tpl | 2 +- templates/CRM/common/batchCopy.tpl | 189 ++++++----- templates/CRM/common/jcalendar.tpl | 48 +-- templates/CRM/common/jsortable.tpl | 305 +++++++++--------- templates/CRM/common/paymentBlock.tpl | 6 +- .../templates/ActivitySearch.tpl | 7 - 85 files changed, 1021 insertions(+), 1110 deletions(-) diff --git a/CRM/Admin/Form/Setting/Mapping.php b/CRM/Admin/Form/Setting/Mapping.php index 5fd5e83a18..e368e64cac 100644 --- a/CRM/Admin/Form/Setting/Mapping.php +++ b/CRM/Admin/Form/Setting/Mapping.php @@ -50,9 +50,9 @@ class CRM_Admin_Form_Setting_Mapping extends CRM_Admin_Form_Setting { $map = CRM_Core_SelectValues::mapProvider(); $geo = CRM_Core_SelectValues::geoProvider(); - $this->addElement('select', 'mapProvider', ts('Mapping Provider'), array('' => '- select -') + $map, array('onChange' => 'showHideMapAPIkey( this.value );')); + $this->addElement('select', 'mapProvider', ts('Mapping Provider'), array('' => '- select -') + $map, array('class' => 'crm-select2')); $this->add('text', 'mapAPIKey', ts('Map Provider Key'), NULL); - $this->addElement('select', 'geoProvider', ts('Geocoding Provider'), array('' => '- select -') + $geo); + $this->addElement('select', 'geoProvider', ts('Geocoding Provider'), array('' => '- select -') + $geo, array('class' => 'crm-select2')); $this->add('text', 'geoAPIKey', ts('Geo Provider Key'), NULL); parent::buildQuickForm(); diff --git a/CRM/Contribute/Form/Contribution.php b/CRM/Contribute/Form/Contribution.php index 8ce805bc96..cfefe62ec1 100644 --- a/CRM/Contribute/Form/Contribution.php +++ b/CRM/Contribute/Form/Contribution.php @@ -667,7 +667,7 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP $this->assign('entityID', $this->_id); if ($this->_context == 'standalone') { - $this->addEntityRef('contact_id', ts('Contact'), array('create' => TRUE), TRUE); + $this->addEntityRef('contact_id', ts('Contact'), array('create' => TRUE, 'api' => array('extra' => array('email'))), TRUE); } $attributes = CRM_Core_DAO::getAttribute('CRM_Contribute_DAO_Contribution'); diff --git a/CRM/Pledge/Form/Pledge.php b/CRM/Pledge/Form/Pledge.php index a847c6556c..6db57883b3 100644 --- a/CRM/Pledge/Form/Pledge.php +++ b/CRM/Pledge/Form/Pledge.php @@ -247,7 +247,7 @@ class CRM_Pledge_Form_Pledge extends CRM_Core_Form { } if ($this->_context == 'standalone') { - $this->addEntityRef('contact_id', ts('Contact'), array('create' => TRUE), TRUE); + $this->addEntityRef('contact_id', ts('Contact'), array('create' => TRUE, 'api' => array('extra' => array('email'))), TRUE); } $showAdditionalInfo = FALSE; diff --git a/templates/CRM/Activity/Form/Activity.tpl b/templates/CRM/Activity/Form/Activity.tpl index 4436b894e9..62bb3afe51 100644 --- a/templates/CRM/Activity/Form/Activity.tpl +++ b/templates/CRM/Activity/Form/Activity.tpl @@ -239,10 +239,10 @@ {literal} {/literal} diff --git a/templates/CRM/Activity/Form/Search/Common.tpl b/templates/CRM/Activity/Form/Search/Common.tpl index d775f68390..a2e32dcc68 100644 --- a/templates/CRM/Activity/Form/Search/Common.tpl +++ b/templates/CRM/Activity/Form/Search/Common.tpl @@ -148,17 +148,17 @@ campaignContext="componentSearch" campaignTrClass='' campaignTdClass=''} CRM.$(function($) { //Searchable activity custom fields which extend ALL activity types are always displayed in the form //hence hide remaining activity custom data - cj('#activityCustom').children( ).each( function( ) { - cj('#'+cj(this).attr('id')+' div').each( function( ) { - if (cj(this).children( ).attr('id')) { - var activityCustomdataGroup = cj(this).attr('id'); //div id - var fieldsetId = cj(this).children( ).attr('id'); // fieldset id + $('#activityCustom').children( ).each( function( ) { + $('#'+$(this).attr('id')+' div').each( function( ) { + if ($(this).children( ).attr('id')) { + var activityCustomdataGroup = $(this).attr('id'); //div id + var fieldsetId = $(this).children( ).attr('id'); // fieldset id var splitFieldsetId = fieldsetId.split(""); var splitFieldsetLength = splitFieldsetId.length; //length of fieldset var show = 0; //setdefault activity custom data group if corresponding activity type is checked - cj('#Activity div').each(function( ) { - var checkboxId = cj(this).children().attr('id'); //activity type element name + $('#Activity div').each(function( ) { + var checkboxId = $(this).children().attr('id'); //activity type element name if (document.getElementById( checkboxId ).checked ) { var element = checkboxId.split('['); var splitElement = element[1].split(']'); // get activity type id @@ -173,16 +173,12 @@ campaignContext="componentSearch" campaignTrClass='' campaignTdClass=''} } }); if (show < 1) { - cj('#'+activityCustomdataGroup).hide( ); + $('#'+activityCustomdataGroup).hide( ); } } }); }); }); - - - - {/literal} {/if} diff --git a/templates/CRM/Admin/Form/ScheduleReminders.tpl b/templates/CRM/Admin/Form/ScheduleReminders.tpl index 1dfe67dfc1..fb8cbae96f 100644 --- a/templates/CRM/Admin/Form/ScheduleReminders.tpl +++ b/templates/CRM/Admin/Form/ScheduleReminders.tpl @@ -155,42 +155,43 @@ var entityMapping = eval({/literal}{$entityMapping}{literal}); var recipientMapping = eval({/literal}{$recipientMapping}{literal}); - cj('#absolute_date_display').change( function() { - if(cj('#absolute_date_display').val()) { - cj('#relativeDate').hide(); - cj('#relativeDateRepeat').hide(); - cj('#repeatFields').hide(); - } else { - cj('#relativeDate').show(); - cj('#relativeDateRepeat').show(); - } - }); CRM.$(function($) { - if (cj('#absolute_date_display').val()) { - cj('#relativeDate').hide(); - cj('#relativeDateRepeat').hide(); - cj('#repeatFields').hide(); - } + $('#absolute_date_display').change(function() { + if($('#absolute_date_display').val()) { + $('#relativeDate').hide(); + $('#relativeDateRepeat').hide(); + $('#repeatFields').hide(); + } else { + $('#relativeDate').show(); + $('#relativeDateRepeat').show(); + } + }); + + if ($('#absolute_date_display').val()) { + $('#relativeDate, #relativeDateRepeat, #repeatFields').hide(); + } - cj('#entity_0').change( function( ) { - buildSelect("start_action_date"); + $('#entity_0').change( function( ) { + buildSelect("start_action_date"); buildSelect("end_date"); buildSelect1("recipient"); - }); - }); + showHideLimitTo(); + }); - CRM.$(function($) { - loadMsgBox(); - cj('#mode').change(function () { loadMsgBox(); - }); + $('#mode').change(loadMsgBox); - showHideLimitTo(); - cj('#entity_0').change(function () { showHideLimitTo(); + + if ($('#is_recipient_listing').val()) { + $('#recipientList').show(); + } + else { + $('#recipientList').hide(); + } + $('#recipient').change(populateRecipient); }); - }); function loadMsgBox() { if (cj('#mode').val() == 'Email' || cj('#mode').val() == 0){ @@ -219,18 +220,6 @@ } } - CRM.$(function($) { - if (cj('#is_recipient_listing').val()) { - cj('#recipientList').show(); - } - else { - cj('#recipientList').hide(); - } - cj('#recipient').change(function () { - populateRecipient(); - }); - }); - function populateRecipient( ) { var recipient = cj("#recipient option:selected").val(); var entity = cj("#entity_0 option:selected").val(); diff --git a/templates/CRM/Admin/Form/Setting/Mapping.tpl b/templates/CRM/Admin/Form/Setting/Mapping.tpl index bdb6e786c1..b48a52d6cc 100644 --- a/templates/CRM/Admin/Form/Setting/Mapping.tpl +++ b/templates/CRM/Admin/Form/Setting/Mapping.tpl @@ -55,14 +55,15 @@ {literal} {/literal} diff --git a/templates/CRM/Admin/Form/Setting/Smtp.tpl b/templates/CRM/Admin/Form/Setting/Smtp.tpl index bf3d06c09b..db97144c8c 100644 --- a/templates/CRM/Admin/Form/Setting/Smtp.tpl +++ b/templates/CRM/Admin/Form/Setting/Smtp.tpl @@ -101,46 +101,46 @@ {literal} @@ -120,7 +120,7 @@ {literal} diff --git a/templates/CRM/Admin/Page/Navigation.tpl b/templates/CRM/Admin/Page/Navigation.tpl index a058ff84b2..3fce13160c 100644 --- a/templates/CRM/Admin/Page/Navigation.tpl +++ b/templates/CRM/Admin/Page/Navigation.tpl @@ -52,117 +52,117 @@ } {/literal} {/if} diff --git a/templates/CRM/Admin/Page/Tag.tpl b/templates/CRM/Admin/Page/Tag.tpl index f2ea634f9c..6d4e302bc1 100644 --- a/templates/CRM/Admin/Page/Tag.tpl +++ b/templates/CRM/Admin/Page/Tag.tpl @@ -147,10 +147,9 @@ CRM.$(function($) { $("input[name=select_merge_tag]", this).crmError(ts('Select a tag')); return false; } - /* send synchronous request so that disabling any actions for slow servers*/ var postUrl = {/literal}"{crmURL p='civicrm/ajax/mergeTags' h=0 }"{literal}; var data = {fromId: tag.id, toId: toId, key:{/literal}"{crmKey name='civicrm/ajax/mergeTags'}"{literal}}; - cj.ajax({ + $.ajax({ type: "POST", url: postUrl, data: data, diff --git a/templates/CRM/Batch/Form/Entry.js b/templates/CRM/Batch/Form/Entry.js index 3fe3693d5e..28df468717 100644 --- a/templates/CRM/Batch/Form/Entry.js +++ b/templates/CRM/Batch/Form/Entry.js @@ -1,24 +1,24 @@ //@todo functions partially moved from tpl but still need an enclosure / cleanup // jslinting etc CRM.$(function($) { - cj('.selector-rows').change(function () { + $('.selector-rows').change(function () { var options = { 'url': CRM.url('civicrm/ajax/batch') }; - cj("#Entry").ajaxSubmit(options); + $("#Entry").ajaxSubmit(options); // validate rows - checkColumns(cj(this)); + checkColumns($(this)); }); - cj('input[name^="soft_credit_contact["]').change(function(){ - var rowNum = cj(this).attr('id').replace('soft_credit_contact_',''); - var totalAmount = cj('#field_'+rowNum+'_total_amount').val(); + $('input[name^="soft_credit_contact["]').change(function(){ + var rowNum = $(this).attr('id').replace('soft_credit_contact_',''); + var totalAmount = $('#field_'+rowNum+'_total_amount').val(); //assign total amount as default soft credit amount - cj('#soft_credit_amount_'+ rowNum).val(totalAmount); + $('#soft_credit_amount_'+ rowNum).val(totalAmount); //assign soft credit type default value if any - cj('#field_'+rowNum+'_soft_credit_type').val(cj('#sct_default_id').val()); + $('#field_'+rowNum+'_soft_credit_type').val($('#sct_default_id').val()); }); // validate rows @@ -27,7 +27,7 @@ CRM.$(function($) { //calculate the actual total for the batch calculateActualTotal(); - cj('input[id*="_total_amount"]').bind('keyup change', function () { + $('input[id*="_total_amount"]').bind('keyup change', function () { calculateActualTotal(); }); @@ -36,35 +36,35 @@ CRM.$(function($) { hideSendReceipt(); // hide the receipt date if send receipt is checked - cj('input[id*="][send_receipt]"]').change(function () { - showHideReceipt(cj(this)); + $('input[id*="][send_receipt]"]').change(function () { + showHideReceipt($(this)); }); } else{ - cj('select[id^="member_option_"]').each(function () { - if (cj(this).val() == 1) { - cj(this).prop('disabled', true); + $('select[id^="member_option_"]').each(function () { + if ($(this).val() == 1) { + $(this).prop('disabled', true); } }); // set payment info accord to membership type - cj('select[id*="_membership_type_0"]').change(function () { - setPaymentBlock(cj(this), null); + $('select[id*="_membership_type_0"]').change(function () { + setPaymentBlock($(this), null); }); - cj('select[id*="_membership_type_1"]').change(function () { - setPaymentBlock(cj(this), cj(this).val()); + $('select[id*="_membership_type_1"]').change(function () { + setPaymentBlock($(this), $(this).val()); }); } // line breaks between radio buttons and checkboxes - cj('input.form-radio').next().after('
'); - cj('input.form-checkbox').next().after('
'); + $('input.form-radio').next().after('
'); + $('input.form-checkbox').next().after('
'); //set the focus on first element - cj('#primary_contact_1').focus(); + $('#primary_contact_1').focus(); }); diff --git a/templates/CRM/Batch/Form/Entry.tpl b/templates/CRM/Batch/Form/Entry.tpl index 90c43bd65f..a3bb2a852b 100644 --- a/templates/CRM/Batch/Form/Entry.tpl +++ b/templates/CRM/Batch/Form/Entry.tpl @@ -107,17 +107,17 @@ {literal} {/literal} diff --git a/templates/CRM/Campaign/Form/Gotv.tpl b/templates/CRM/Campaign/Form/Gotv.tpl index 45446c613d..6db4c0979c 100755 --- a/templates/CRM/Campaign/Form/Gotv.tpl +++ b/templates/CRM/Campaign/Form/Gotv.tpl @@ -137,7 +137,7 @@ function loadVoterList( ) var dataLength = aoData.length; var count = 1; - var searchCriteria = new Array( 'campaign_search_voter_for' ); + var searchCriteria = ['campaign_search_voter_for']; //get the search criteria. var searchParams = {/literal}{$searchParams}{literal}; diff --git a/templates/CRM/Campaign/Form/Petition.tpl b/templates/CRM/Campaign/Form/Petition.tpl index cca8e77cb9..4dc49dd7a8 100644 --- a/templates/CRM/Campaign/Form/Petition.tpl +++ b/templates/CRM/Campaign/Form/Petition.tpl @@ -129,13 +129,13 @@ //show edit profile field links CRM.$(function($) { // show edit for both contact and activity profile - cj('select[id$="profile_id"]').change(function () { - buildLinks(cj(this), cj(this).val()); + $('select[id$="profile_id"]').change(function () { + buildLinks($(this), $(this).val()); }); // make sure we set edit links for both profiles when form loads - cj('select[id$="profile_id"]').each(function (e) { - buildLinks(cj(this), cj(this).val()); + $('select[id$="profile_id"]').each(function (e) { + buildLinks($(this), $(this).val()); }); }); diff --git a/templates/CRM/Campaign/Form/Petition/Block.tpl b/templates/CRM/Campaign/Form/Petition/Block.tpl index faa9f72fc1..7472e9bce8 100644 --- a/templates/CRM/Campaign/Form/Petition/Block.tpl +++ b/templates/CRM/Campaign/Form/Petition/Block.tpl @@ -147,9 +147,9 @@ {literal} diff --git a/templates/CRM/Campaign/Form/ResultOptions.tpl b/templates/CRM/Campaign/Form/ResultOptions.tpl index e8ab4965e7..1572347c73 100644 --- a/templates/CRM/Campaign/Form/ResultOptions.tpl +++ b/templates/CRM/Campaign/Form/ResultOptions.tpl @@ -88,8 +88,8 @@ @@ -111,7 +111,7 @@ {include file="CRM/common/customData.tpl" includeWysiwygEditor=true} {literal} diff --git a/templates/CRM/Contact/Form/Inline/CommunicationPreferences.tpl b/templates/CRM/Contact/Form/Inline/CommunicationPreferences.tpl index 0e7e3ae67c..2e713af264 100644 --- a/templates/CRM/Contact/Form/Inline/CommunicationPreferences.tpl +++ b/templates/CRM/Contact/Form/Inline/CommunicationPreferences.tpl @@ -147,19 +147,19 @@ {literal} {/literal} diff --git a/templates/CRM/Contact/Form/Search/Criteria/Basic.tpl b/templates/CRM/Contact/Form/Search/Criteria/Basic.tpl index e4664a1e43..9a091dd1b9 100644 --- a/templates/CRM/Contact/Form/Search/Criteria/Basic.tpl +++ b/templates/CRM/Contact/Form/Search/Criteria/Basic.tpl @@ -76,23 +76,23 @@ {/literal} diff --git a/templates/CRM/Contact/Form/Search/Criteria/Location.tpl b/templates/CRM/Contact/Form/Search/Criteria/Location.tpl index 4f3c67434f..44f914b4fe 100644 --- a/templates/CRM/Contact/Form/Search/Criteria/Location.tpl +++ b/templates/CRM/Contact/Form/Search/Criteria/Location.tpl @@ -142,9 +142,9 @@ function processAddressFields( name, loadData ) { } CRM.$(function($) { - if ( cj('#street_name').val( ).length > 0 || - cj('#street_unit').val( ).length > 0 || - cj('#street_number').val( ).length > 0 ) { + if ( $('#street_name').val( ).length > 0 || + $('#street_unit').val( ).length > 0 || + $('#street_number').val( ).length > 0 ) { processAddressFields( 'addressElements', 1 ); } } diff --git a/templates/CRM/Contact/Form/ShareAddress.tpl b/templates/CRM/Contact/Form/ShareAddress.tpl index 19358ad2c8..60e3d6cb5e 100644 --- a/templates/CRM/Contact/Form/ShareAddress.tpl +++ b/templates/CRM/Contact/Form/ShareAddress.tpl @@ -51,35 +51,35 @@ {literal} {/literal} diff --git a/templates/CRM/Contact/Import/Form/MapTable.tpl b/templates/CRM/Contact/Import/Form/MapTable.tpl index 799b5742a8..a8b781546e 100644 --- a/templates/CRM/Contact/Import/Form/MapTable.tpl +++ b/templates/CRM/Contact/Import/Form/MapTable.tpl @@ -171,11 +171,11 @@ CRM.$(function($) { var defaultLocationType = "{/literal}{$defaultLocationType}{literal}"; if (defaultLocationType.length) { - cj('#map-field').on('change', 'select[id^="mapper"][id$="_0"]', function() { - var select = cj(this).next(); - cj('option', select).each(function() { - if (cj(this).attr('value') == defaultLocationType - && cj(this).text() == "{/literal}{$defaultLocationTypeLabel}{literal}") { + $('#map-field').on('change', 'select[id^="mapper"][id$="_0"]', function() { + var select = $(this).next(); + $('option', select).each(function() { + if ($(this).attr('value') == defaultLocationType + && $(this).text() == "{/literal}{$defaultLocationTypeLabel}{literal}") { select.val(defaultLocationType); } }); diff --git a/templates/CRM/Contact/Page/Dashlet.tpl b/templates/CRM/Contact/Page/Dashlet.tpl index 216edee77b..394f51c5d5 100644 --- a/templates/CRM/Contact/Page/Dashlet.tpl +++ b/templates/CRM/Contact/Page/Dashlet.tpl @@ -61,18 +61,18 @@ diff --git a/templates/CRM/Contribute/Form/Contribution/MembershipBlock.tpl b/templates/CRM/Contribute/Form/Contribution/MembershipBlock.tpl index feb71e9af2..1c8dab03df 100644 --- a/templates/CRM/Contribute/Form/Contribution/MembershipBlock.tpl +++ b/templates/CRM/Contribute/Form/Contribution/MembershipBlock.tpl @@ -94,14 +94,14 @@ CRM.$(function($) { //if price set is set we use below below code to show for showing auto renew var autoRenewOption = {/literal}'{$autoRenewOption}'{literal}; - cj('#allow_auto_renew').hide(); + $('#allow_auto_renew').hide(); if ( autoRenewOption == 1 ) { - cj('#allow_auto_renew').show(); + $('#allow_auto_renew').show(); } else if ( autoRenewOption == 2 ) { - var autoRenew = cj("#auto_renew"); + var autoRenew = $("#auto_renew"); autoRenew.prop('checked', true ); autoRenew.attr( 'readonly', true ); - cj('#allow_auto_renew').show(); + $('#allow_auto_renew').show(); } }); diff --git a/templates/CRM/Contribute/Form/Contribution/OnBehalfOf.tpl b/templates/CRM/Contribute/Form/Contribution/OnBehalfOf.tpl index 38773cf2b5..b9181ecc6d 100644 --- a/templates/CRM/Contribute/Form/Contribution/OnBehalfOf.tpl +++ b/templates/CRM/Contribute/Form/Contribution/OnBehalfOf.tpl @@ -296,9 +296,9 @@ function selectCreateOrg( orgOption, reset ) { {if $membershipContactID} {literal} CRM.$(function($) { - cj('#organization_id').val("{/literal}{$membershipContactName}{literal}"); - cj('#organization_name').val("{/literal}{$membershipContactName}{literal}"); - cj('#onbehalfof_id').val("{/literal}{$membershipContactID}{literal}"); + $('#organization_id').val("{/literal}{$membershipContactName}{literal}"); + $('#organization_name').val("{/literal}{$membershipContactName}{literal}"); + $('#onbehalfof_id').val("{/literal}{$membershipContactID}{literal}"); setLocationDetails( "{/literal}{$membershipContactID}{literal}" ); }); {/literal} diff --git a/templates/CRM/Contribute/Form/Contribution/PremiumBlock.tpl b/templates/CRM/Contribute/Form/Contribution/PremiumBlock.tpl index 96f5c6bcac..ea9f21a8fa 100644 --- a/templates/CRM/Contribute/Form/Contribution/PremiumBlock.tpl +++ b/templates/CRM/Contribute/Form/Contribution/PremiumBlock.tpl @@ -132,26 +132,26 @@ // select a new premium function select_premium(premium_id) { - if(cj(premium_id).length) { + if($(premium_id).length) { // hide other active premium - cj('.premium-full').hide(); - cj('.premium-short').show(); + $('.premium-full').hide(); + $('.premium-short').show(); // show this one - cj('.premium-short', cj(premium_id)).hide(); - cj('.premium-full', cj(premium_id)).show(); + $('.premium-short', $(premium_id)).hide(); + $('.premium-full', $(premium_id)).show(); // record this one var id_parts = premium_id.split('-'); - cj('#selectProduct').val(id_parts[1]); + $('#selectProduct').val(id_parts[1]); } } // click premium to select - cj('.premium-short').click(function(){ - select_premium( '#'+cj(cj(this).parent()).attr('id') ); + $('.premium-short').click(function(){ + select_premium( '#'+$($(this).parent()).attr('id') ); }); // select the default premium - var premium_id = cj('#selectProduct').val(); + var premium_id = $('#selectProduct').val(); if(premium_id == '') premium_id = 'no_thanks'; select_premium('#premium_id-'+premium_id); @@ -164,17 +164,17 @@ } // see if other amount exists and has a value - if(cj('.other_amount-content input').length) { - amount = Number(cj('.other_amount-content input').val()); + if($('.other_amount-content input').length) { + amount = Number($('.other_amount-content input').val()); if(isNaN(amount)) amount = 0; } function check_price_set(price_set_radio_buttons) { if (!amount) { - cj(price_set_radio_buttons).each(function(){ - if (cj(this).prop('checked')) { - amount = cj(this).attr('data-amount'); + $(price_set_radio_buttons).each(function(){ + if ($(this).prop('checked')) { + amount = $(this).attr('data-amount'); if (typeof amount !== "undefined") { amount = Number(amount); } @@ -211,26 +211,26 @@ function update_premiums() { var amount = get_amount(); - cj('.premium').each(function(){ - var min_contribution = cj(this).attr('min_contribution'); + $('.premium').each(function(){ + var min_contribution = $(this).attr('min_contribution'); if(amount < min_contribution) { - cj(this).addClass('premium-disabled'); + $(this).addClass('premium-disabled'); } else { - cj(this).removeClass('premium-disabled'); + $(this).removeClass('premium-disabled'); } }); } - cj('.other_amount-content input').change(update_premiums); - cj('input, #priceset').change(update_premiums); + $('.other_amount-content input').change(update_premiums); + $('input, #priceset').change(update_premiums); update_premiums(); // build a list of price sets var amounts = []; var price_sets = {}; - cj('input, #priceset select,#priceset').each(function(){ + $('input, #priceset select,#priceset').each(function(){ if (this.tagName == 'SELECT') { - var selectID = cj(this).attr('id'); - var selectvalues = JSON.parse(cj(this).attr('price')); + var selectID = $(this).attr('id'); + var selectvalues = JSON.parse($(this).attr('price')); Object.keys(selectvalues).forEach(function (key) { var option = selectvalues[key].split(optionSep); amount = Number(option[0]); @@ -239,11 +239,11 @@ }); } else { - var amount = Number(cj(this).attr('data-amount')); + var amount = Number($(this).attr('data-amount')); if (!isNaN(amount)) { amounts.push(amount); - var id = cj(this).attr('id'); + var id = $(this).attr('id'); price_sets[amount] = '#'+id; } } @@ -251,16 +251,16 @@ amounts.sort(function(a,b){return a - b}); // make contribution instead buttons work - cj('.premium-full-disabled input').click(function(){ - var amount = Number(cj(this).attr('amount')); + $('.premium-full-disabled input').click(function(){ + var amount = Number($(this).attr('amount')); if (price_sets[amount]) { - if (!cj(price_sets[amount]).length) { + if (!$(price_sets[amount]).length) { var option = price_sets[amount].split('-'); - cj(option[0]).val(option[1]); - cj(option[0]).trigger('change'); + $(option[0]).val(option[1]); + $(option[0]).trigger('change'); } - else if (cj(price_sets[amount]).attr('type') == 'checkbox') { - cj(price_sets[amount]).prop("checked",true); + else if ($(price_sets[amount]).attr('type') == 'checkbox') { + $(price_sets[amount]).prop("checked",true); if ((typeof totalfee !== 'undefined') && (typeof display == 'function')) { if (totalfee > 0) { totalfee += amount; @@ -272,24 +272,24 @@ } } else { - cj(price_sets[amount]).click(); - cj(price_sets[amount]).trigger('click'); + $(price_sets[amount]).click(); + $(price_sets[amount]).trigger('click'); } } else { // is there an other amount input box? - if(cj('.other_amount-section input').length) { + if($('.other_amount-section input').length) { // is this a membership form with separate payment? if(is_separate_payment) { var current_amount = 0; - if(cj('#priceset input[type="radio"]:checked').length) { - current_amount = Number(cj('#priceset input[type="radio"]:checked').attr('data-amount')); + if($('#priceset input[type="radio"]:checked').length) { + current_amount = Number($('#priceset input[type="radio"]:checked').attr('data-amount')); if(!current_amount) current_amount = 0; } var new_amount = amount - current_amount; - cj('.other_amount-section input').val(new_amount.toFixed(2)); + $('.other_amount-section input').val(new_amount.toFixed(2)); } else { - cj('.other_amount-section input').click(); - cj('.other_amount-section input').val(cj(this).attr('amount')); + $('.other_amount-section input').click(); + $('.other_amount-section input').val($(this).attr('amount')); } } else { // find the next best price set @@ -304,13 +304,13 @@ selected_price_set = amounts[amounts.length-1]; } - if (!cj(price_sets[selected_price_set]).length) { + if (!$(price_sets[selected_price_set]).length) { var option = price_sets[selected_price_set].split('-'); - cj(option[0]).val(option[1]); - cj(option[0]).trigger('change'); + $(option[0]).val(option[1]); + $(option[0]).trigger('change'); } - else if (cj(price_sets[selected_price_set]).attr('type') == 'checkbox') { - cj(price_sets[selected_price_set]).prop("checked",true); + else if ($(price_sets[selected_price_set]).attr('type') == 'checkbox') { + $(price_sets[selected_price_set]).prop("checked",true); if ((typeof totalfee !== 'undefined') && (typeof display == 'function')) { if (totalfee > 0) { totalfee += amount; @@ -322,8 +322,8 @@ } } else { - cj(price_sets[selected_price_set]).click(); - cj(price_sets[selected_price_set]).trigger('click'); + $(price_sets[selected_price_set]).click(); + $(price_sets[selected_price_set]).trigger('click'); } } } @@ -332,9 +332,9 @@ // validation of premiums var error_message = '{/literal}{ts escape="js"}You must contribute more to get that item{/ts}{literal}'; - cj.validator.addMethod('premiums', function(value, element, params){ - var premium_id = cj('#selectProduct').val(); - var premium$ = cj('#premium_id-'+premium_id); + $.validator.addMethod('premiums', function(value, element, params){ + var premium_id = $('#selectProduct').val(); + var premium$ = $('#premium_id-'+premium_id); if(premium$.length) { if(premium$.hasClass('premium-disabled')) { return false; @@ -345,7 +345,7 @@ // add validation rules CRM.validate.functions.push(function(){ - cj('#selectProduct').rules('add', 'premiums'); + $('#selectProduct').rules('add', 'premiums'); }); // need to use jquery validate's ignore option, so that it will not ignore hidden fields diff --git a/templates/CRM/Contribute/Form/ContributionPage/AddProduct.tpl b/templates/CRM/Contribute/Form/ContributionPage/AddProduct.tpl index 354be5427d..6141e3f66e 100644 --- a/templates/CRM/Contribute/Form/ContributionPage/AddProduct.tpl +++ b/templates/CRM/Contribute/Form/ContributionPage/AddProduct.tpl @@ -72,39 +72,33 @@ {/if} {* $action ne view *} - diff --git a/templates/CRM/Contribute/Form/ContributionPage/Amount.tpl b/templates/CRM/Contribute/Form/ContributionPage/Amount.tpl index 4cec3180a6..187f834238 100644 --- a/templates/CRM/Contribute/Form/ContributionPage/Amount.tpl +++ b/templates/CRM/Contribute/Form/ContributionPage/Amount.tpl @@ -195,7 +195,7 @@ {literal} diff --git a/templates/CRM/Core/BillingBlock.tpl b/templates/CRM/Core/BillingBlock.tpl index 85a4efe456..d3d2f91d00 100644 --- a/templates/CRM/Core/BillingBlock.tpl +++ b/templates/CRM/Core/BillingBlock.tpl @@ -176,11 +176,11 @@ CRM.$(function($) { var address_fields = {/literal}{$profileAddressFields|@json_encode}{literal}; var input_ids = {}; var select_ids = {}; - var orig_id = field = field_name = null; + var orig_id, field, field_name; // build input ids - cj('.billing_name_address-section input').each(function(i){ - orig_id = cj(this).attr('id'); + $('.billing_name_address-section input').each(function(i){ + orig_id = $(this).attr('id'); field = orig_id.split('-'); field_name = field[0].replace('billing_', ''); if(field[1]) { @@ -189,16 +189,16 @@ CRM.$(function($) { } } }); - if(cj('#first_name').length) + if($('#first_name').length) input_ids['#first_name'] = '#billing_first_name'; - if(cj('#middle_name').length) + if($('#middle_name').length) input_ids['#middle_name'] = '#billing_middle_name'; - if(cj('#last_name').length) + if($('#last_name').length) input_ids['#last_name'] = '#billing_last_name'; // build select ids - cj('.billing_name_address-section select').each(function(i){ - orig_id = cj(this).attr('id'); + $('.billing_name_address-section select').each(function(i){ + orig_id = $(this).attr('id'); field = orig_id.split('-'); field_name = field[0].replace('billing_', '').replace('_id', ''); if(field[1]) { @@ -211,82 +211,82 @@ CRM.$(function($) { // detect if billing checkbox should default to checked var checked = true; for(var id in input_ids) { - var orig_id = input_ids[id]; - if(cj(id).val() != cj(orig_id).val()) { + orig_id = input_ids[id]; + if($(id).val() != $(orig_id).val()) { checked = false; break; } } for(var id in select_ids) { - var orig_id = select_ids[id]; - if(cj(id).val() != cj(orig_id).val()) { + orig_id = select_ids[id]; + if($(id).val() != $(orig_id).val()) { checked = false; break; } } if(checked) { - cj('#billingcheckbox').prop('checked', true); - cj('.billing_name_address-group').hide(); + $('#billingcheckbox').prop('checked', true); + $('.billing_name_address-group').hide(); } // onchange handlers for non-billing fields for(var id in input_ids) { - var orig_id = input_ids[id]; - cj(id).change(function(){ - var id = '#'+cj(this).attr('id'); + orig_id = input_ids[id]; + $(id).change(function(){ + var id = '#'+$(this).attr('id'); var orig_id = input_ids[id]; // if billing checkbox is active, copy other field into billing field - if(cj('#billingcheckbox').prop('checked')) { - cj(orig_id).val( cj(id).val() ); - }; + if($('#billingcheckbox').prop('checked')) { + $(orig_id).val( $(id).val() ); + } }); - }; + } for(var id in select_ids) { - var orig_id = select_ids[id]; - cj(id).change(function(){ - var id = '#'+cj(this).attr('id'); + orig_id = select_ids[id]; + $(id).change(function(){ + var id = '#'+$(this).attr('id'); var orig_id = select_ids[id]; // if billing checkbox is active, copy other field into billing field - if(cj('#billingcheckbox').prop('checked')) { - cj(orig_id+' option').prop('selected', false); - cj(orig_id+' option[value="'+cj(id).val()+'"]').prop('selected', true); - }; + if($('#billingcheckbox').prop('checked')) { + $(orig_id+' option').prop('selected', false); + $(orig_id+' option[value="'+$(id).val()+'"]').prop('selected', true); + } if(orig_id == '#billing_country_id-5') { - cj(orig_id).change(); + $(orig_id).change(); } }); - }; + } // toggle show/hide - cj('#billingcheckbox').click(function(){ + $('#billingcheckbox').click(function(){ if(this.checked) { - cj('.billing_name_address-group').hide(200); + $('.billing_name_address-group').hide(200); // copy all values for(var id in input_ids) { - var orig_id = input_ids[id]; - cj(orig_id).val( cj(id).val() ); - }; + orig_id = input_ids[id]; + $(orig_id).val( $(id).val() ); + } for(var id in select_ids) { - var orig_id = select_ids[id]; - cj(orig_id+' option').prop('selected', false); - cj(orig_id+' option[value="'+cj(id).val()+'"]').prop('selected', true); - }; + orig_id = select_ids[id]; + $(orig_id+' option').prop('selected', false); + $(orig_id+' option[value="'+$(id).val()+'"]').prop('selected', true); + } } else { - cj('.billing_name_address-group').show(200); + $('.billing_name_address-group').show(200); } }); // remove spaces, dashes from credit card number - cj('#credit_card_number').change(function(){ - var cc = cj('#credit_card_number').val() + $('#credit_card_number').change(function(){ + var cc = $('#credit_card_number').val() .replace(/ /g, '') .replace(/-/g, ''); - cj('#credit_card_number').val(cc); + $('#credit_card_number').val(cc); }); }); {/literal} diff --git a/templates/CRM/Custom/Form/ChangeFieldType.tpl b/templates/CRM/Custom/Form/ChangeFieldType.tpl index 4670263289..50c444755c 100644 --- a/templates/CRM/Custom/Form/ChangeFieldType.tpl +++ b/templates/CRM/Custom/Form/ChangeFieldType.tpl @@ -42,10 +42,10 @@ {literal} diff --git a/templates/CRM/Event/Form/ManageEvent/ScheduleReminders.tpl b/templates/CRM/Event/Form/ManageEvent/ScheduleReminders.tpl index 405774df96..9b9ba34623 100755 --- a/templates/CRM/Event/Form/ManageEvent/ScheduleReminders.tpl +++ b/templates/CRM/Event/Form/ManageEvent/ScheduleReminders.tpl @@ -150,7 +150,7 @@ {/if} {* end of main event block*} diff --git a/templates/CRM/Event/Form/ParticipantFeeSelection.tpl b/templates/CRM/Event/Form/ParticipantFeeSelection.tpl index e6838e2f2e..50f84fb49c 100644 --- a/templates/CRM/Event/Form/ParticipantFeeSelection.tpl +++ b/templates/CRM/Event/Form/ParticipantFeeSelection.tpl @@ -86,7 +86,7 @@ function populatebalanceFee(updatedAmt, onlyStatusUpdate) { } CRM.$(function($) { - var updatedFeeUnFormatted = cj('#pricevalue').text(); + var updatedFeeUnFormatted = $('#pricevalue').text(); var updatedAmt = parseFloat(updatedFeeUnFormatted.replace(/[^0-9-.]/g, '')); populatebalanceFee(updatedAmt, true); diff --git a/templates/CRM/Event/Form/Task/Batch.tpl b/templates/CRM/Event/Form/Task/Batch.tpl index daa9633093..7e14d5aeed 100644 --- a/templates/CRM/Event/Form/Task/Batch.tpl +++ b/templates/CRM/Event/Form/Task/Batch.tpl @@ -93,9 +93,9 @@ * Function to update participant status */ CRM.$(function($) { - cj('#status_change').change( function() { - if ( cj(this).val() ) { - cj('.crm-copy-fields [name^="field["][name*="[participant_status]"]').val( cj(this).val() ); + $('#status_change').change( function() { + if ( $(this).val() ) { + $('.crm-copy-fields [name^="field["][name*="[participant_status]"]').val( $(this).val() ); } }); diff --git a/templates/CRM/Financial/Form/Export.tpl b/templates/CRM/Financial/Form/Export.tpl index 1368a541ad..03940dc20f 100644 --- a/templates/CRM/Financial/Form/Export.tpl +++ b/templates/CRM/Financial/Form/Export.tpl @@ -53,10 +53,10 @@ {literal} diff --git a/templates/CRM/Mailing/Form/Count.tpl b/templates/CRM/Mailing/Form/Count.tpl index 4be3523f5f..6c6b74c558 100644 --- a/templates/CRM/Mailing/Form/Count.tpl +++ b/templates/CRM/Mailing/Form/Count.tpl @@ -49,49 +49,45 @@ {literal} {/literal} {/if} diff --git a/templates/CRM/Mailing/Form/InsertTokens.tpl b/templates/CRM/Mailing/Form/InsertTokens.tpl index 7ad51d8032..cf5ebcd07c 100644 --- a/templates/CRM/Mailing/Form/InsertTokens.tpl +++ b/templates/CRM/Mailing/Form/InsertTokens.tpl @@ -253,7 +253,7 @@ if ( isMailing ) { {literal} CRM.$(function($) { if ( isMailing ) { - cj('div.html').hover( + $('div.html').hover( function( ) { if ( tinyMCE.get(html_message) ) { tinyMCE.get(html_message).onKeyUp.add(function() { @@ -276,7 +276,7 @@ if ( isMailing ) { {literal} CRM.$(function($) { if ( isMailing ) { - cj('div.html').hover( + $('div.html').hover( verify, verify ); @@ -347,7 +347,7 @@ CRM.$(function($) { } } else { - cj( "#"+ html_message ).replaceSelection( token ); + $( "#"+ html_message ).replaceSelection( token ); } } @@ -361,29 +361,29 @@ CRM.$(function($) { placeholder: '{/literal}{ts escape='js'}Insert Token{/ts}{literal}' }); - cj('.accordion .head').addClass( "ui-accordion-header ui-helper-reset ui-state-default ui-corner-all "); - cj('.resizable-textarea textarea').css( 'width', '99%' ); - cj('.grippie').css( 'margin-right', '3px'); - cj('.accordion .head').hover( function() { cj(this).addClass( "ui-state-hover"); - }, function() { cj(this).removeClass( "ui-state-hover"); + $('.accordion .head').addClass( "ui-accordion-header ui-helper-reset ui-state-default ui-corner-all "); + $('.resizable-textarea textarea').css( 'width', '99%' ); + $('.grippie').css( 'margin-right', '3px'); + $('.accordion .head').hover( function() { $(this).addClass( "ui-state-hover"); + }, function() { $(this).removeClass( "ui-state-hover"); }).bind('click', function() { - var checkClass = cj(this).find('span').attr( 'class' ); + var checkClass = $(this).find('span').attr( 'class' ); var len = checkClass.length; if ( checkClass.substring( len - 1, len ) == 's' ) { - cj(this).find('span').removeClass().addClass('ui-icon ui-icon-triangle-1-e'); - cj("span#help"+cj(this).find('span').attr('id')).hide(); + $(this).find('span').removeClass().addClass('ui-icon ui-icon-triangle-1-e'); + $("span#help"+$(this).find('span').attr('id')).hide(); } else { - cj(this).find('span').removeClass().addClass('ui-icon ui-icon-triangle-1-s'); - cj("span#help"+cj(this).find('span').attr('id')).show(); + $(this).find('span').removeClass().addClass('ui-icon ui-icon-triangle-1-s'); + $("span#help"+$(this).find('span').attr('id')).show(); } - cj(this).next().toggle(); return false; + $(this).next().toggle(); return false; }).next().hide(); - cj('span#html').removeClass().addClass('ui-icon ui-icon-triangle-1-s'); - cj("div.html").show(); + $('span#html').removeClass().addClass('ui-icon ui-icon-triangle-1-s'); + $("div.html").show(); if ( !isMailing ) { - cj("div.text").show(); + $("div.text").show(); } function setSignature() { @@ -433,12 +433,12 @@ CRM.$(function($) { }, 'json'); } } - if (!cj().find('div.crm-error').text()) { - cj(window).load(function () { + if (!$().find('div.crm-error').text()) { + $(window).load(function () { setSignature(); }); } - cj("#fromEmailAddress").change( function( ) { + $("#fromEmailAddress").change( function( ) { setSignature( ); }); }); diff --git a/templates/CRM/Mailing/Form/Schedule.tpl b/templates/CRM/Mailing/Form/Schedule.tpl index 80fdc36e24..64f65c4cd6 100644 --- a/templates/CRM/Mailing/Form/Schedule.tpl +++ b/templates/CRM/Mailing/Form/Schedule.tpl @@ -73,16 +73,16 @@ diff --git a/templates/CRM/Price/Form/LineItem.tpl b/templates/CRM/Price/Form/LineItem.tpl index d2ae77d6d3..c583f2b66b 100644 --- a/templates/CRM/Price/Form/LineItem.tpl +++ b/templates/CRM/Price/Form/LineItem.tpl @@ -83,7 +83,7 @@
{literal} {/literal} diff --git a/templates/CRM/Queue/Page/Runner.tpl b/templates/CRM/Queue/Page/Runner.tpl index dc9705e966..f8b2cb09a6 100644 --- a/templates/CRM/Queue/Page/Runner.tpl +++ b/templates/CRM/Queue/Page/Runner.tpl @@ -28,32 +28,32 @@ CRM.$(function($) { } var pct = 100 * queueRunnerData.completed / (queueRunnerData.completed + queueRunnerData.numberOfItems); - cj("#crm-queue-runner-progress").progressbar({ value: pct }); + $("#crm-queue-runner-progress").progressbar({ value: pct }); if (data.is_error) { - cj("#crm-queue-runner-buttonset").show(); + $("#crm-queue-runner-buttonset").show(); if (queueRunnerData.isEnded) { - cj('#crm-queue-runner-skip').button('disable'); + $('#crm-queue-runner-skip').button('disable'); } - cj('#crm-queue-runner-title').text('Error: ' + data.last_task_title); + $('#crm-queue-runner-title').text('Error: ' + data.last_task_title); } else if (!data.is_continue && queueRunnerData.numberOfItems == 0) { - cj('#crm-queue-runner-title').text('Done'); + $('#crm-queue-runner-title').text('Done'); } else { - cj('#crm-queue-runner-title').text('Executed: ' + data.last_task_title); + $('#crm-queue-runner-title').text('Executed: ' + data.last_task_title); } if (data.exception) { - cj('#crm-queue-runner-message').html(''); - cj('
').html(data.exception).prependTo('#crm-queue-runner-message'); + $('#crm-queue-runner-message').html(''); + $('
').html(data.exception).prependTo('#crm-queue-runner-message'); } }; var handleError = function(jqXHR, textStatus, errorThrown) { // Do this regardless of whether the response was well-formed - cj("#crm-queue-runner-buttonset").show(); + $("#crm-queue-runner-buttonset").show(); - var data = cj.parseJSON(jqXHR.responseText) + var data = $.parseJSON(jqXHR.responseText) if (data) { displayResponseData(data); } @@ -80,7 +80,7 @@ CRM.$(function($) { // Dequeue and execute the next item var runNext = function() { - cj.ajax({ + $.ajax({ type: 'POST', url: (queueRunnerData.isEnded ? queueRunnerData.onEndAjax : queueRunnerData.runNextAjax), data: { @@ -88,7 +88,7 @@ CRM.$(function($) { }, dataType: 'json', beforeSend: function(jqXHR, settings) { - cj("#crm-queue-runner-buttonset").hide(); + $("#crm-queue-runner-buttonset").hide(); }, error: handleError, success: handleSuccess @@ -96,13 +96,13 @@ CRM.$(function($) { } var retryNext = function() { - cj('#crm-queue-runner-message').html(''); + $('#crm-queue-runner-message').html(''); runNext(); } // Dequeue and the next item, then move on to runNext for the subsequent items var skipNext = function() { - cj.ajax({ + $.ajax({ type: 'POST', url: queueRunnerData.skipNextAjax, data: { @@ -110,8 +110,8 @@ CRM.$(function($) { }, dataType: 'json', beforeSend: function(jqXHR, settings) { - cj('#crm-queue-runner-message').html(''); - cj("#crm-queue-runner-buttonset").hide(); + $('#crm-queue-runner-message').html(''); + $("#crm-queue-runner-buttonset").hide(); }, error: handleError, success: handleSuccess @@ -120,25 +120,25 @@ CRM.$(function($) { // Set up the UI - cj("#crm-queue-runner-progress").progressbar({ value: 0 }); + $("#crm-queue-runner-progress").progressbar({ value: 0 }); if (queueRunnerData.buttons.retry == 1) { - cj("#crm-queue-runner-retry").button({ + $("#crm-queue-runner-retry").button({ text: false, icons: {primary: 'ui-icon-refresh'} }).click(retryNext); } else { - cj("#crm-queue-runner-retry").remove(); + $("#crm-queue-runner-retry").remove(); } if (queueRunnerData.buttons.skip == 1) { - cj("#crm-queue-runner-skip").button({ + $("#crm-queue-runner-skip").button({ text: false, icons: {primary: 'ui-icon-seek-next'} }).click(skipNext); } else { - cj("#crm-queue-runner-skip").remove(); + $("#crm-queue-runner-skip").remove(); } - cj("#crm-queue-runner-buttonset").buttonset(); - cj("#crm-queue-runner-buttonset").hide(); + $("#crm-queue-runner-buttonset").buttonset(); + $("#crm-queue-runner-buttonset").hide(); window.setTimeout(runNext, 50); }); diff --git a/templates/CRM/Report/Form/Criteria.tpl b/templates/CRM/Report/Form/Criteria.tpl index b3fa82d23d..2679bf054c 100644 --- a/templates/CRM/Report/Form/Criteria.tpl +++ b/templates/CRM/Report/Form/Criteria.tpl @@ -268,13 +268,13 @@ } } - cj(document).ready(function(){ - cj('.crm-report-criteria-groupby input:checkbox').click(function() { - cj('#fields_' + this.id.substr(10)).prop('checked', this.checked); + CRM.$(function($) { + $('.crm-report-criteria-groupby input:checkbox').click(function() { + $('#fields_' + this.id.substr(10)).prop('checked', this.checked); }); {/literal}{if $displayToggleGroupByFields}{literal} - cj('.crm-report-criteria-field input:checkbox').click(function() { - cj('#group_bys_' + this.id.substr(7)).prop('checked', this.checked); + $('.crm-report-criteria-field input:checkbox').click(function() { + $('#group_bys_' + this.id.substr(7)).prop('checked', this.checked); }); {/literal}{/if}{literal} }); diff --git a/templates/CRM/Report/Form/Event/ParticipantListing.tpl b/templates/CRM/Report/Form/Event/ParticipantListing.tpl index fd2472d315..7519db6d23 100644 --- a/templates/CRM/Report/Form/Event/ParticipantListing.tpl +++ b/templates/CRM/Report/Form/Event/ParticipantListing.tpl @@ -26,11 +26,8 @@ {literal} {/literal} diff --git a/templates/CRM/Report/Form/Instance.tpl b/templates/CRM/Report/Form/Instance.tpl index 301da14aa7..2fc9f42fd8 100644 --- a/templates/CRM/Report/Form/Instance.tpl +++ b/templates/CRM/Report/Form/Instance.tpl @@ -136,17 +136,17 @@ }); CRM.$(function($) { var formName = {/literal}"{$form.formName}"{literal}; - cj('#_qf_' + formName + '_submit_save').click ( + $('#_qf_' + formName + '_submit_save').click ( function(){ - if ( cj('#is_navigation').prop('checked') && cj('#parent_id').val() == '') { + if ( $('#is_navigation').prop('checked') && $('#parent_id').val() == '') { var confirmMsg = {/literal}'{ts escape="js"}You have chosen to include this report in the Navigation Menu without selecting a Parent Menu item from the dropdown. This will add the report to the top level menu bar. Are you sure you want to continue?{/ts}'{literal} return confirm(confirmMsg); } } ); - cj('#_qf_' + formName + '_submit_next').click ( + $('#_qf_' + formName + '_submit_next').click ( function(){ - if ( cj('#title').data('initial_value') == cj('#title').val() ) { + if ( $('#title').data('initial_value') == $('#title').val() ) { var confirmMsg = {/literal}'{ts escape="js"}You are saving a copy of this report with the same report title. Are you sure you want to continue?{/ts}'{literal} return confirm(confirmMsg); } diff --git a/templates/CRM/Report/Form/Layout/Graph.tpl b/templates/CRM/Report/Form/Layout/Graph.tpl index c23920f0f2..5936a356cb 100644 --- a/templates/CRM/Report/Form/Layout/Graph.tpl +++ b/templates/CRM/Report/Form/Layout/Graph.tpl @@ -50,7 +50,7 @@ CRM.$(function($) { buildChart( ); - cj("input[id$='submit_print'],input[id$='submit_pdf']").bind('click', function(e){ + $("input[id$='submit_print'],input[id$='submit_pdf']").bind('click', function(e){ // image creator php file path and append image name var url = CRM.url('civicrm/report/chart', 'name=' + '{/literal}{$chartId}{literal}' + '.png'); diff --git a/templates/CRM/SMS/Form/Schedule.tpl b/templates/CRM/SMS/Form/Schedule.tpl index 86679daeb7..950db84a3e 100644 --- a/templates/CRM/SMS/Form/Schedule.tpl +++ b/templates/CRM/SMS/Form/Schedule.tpl @@ -74,16 +74,16 @@ {literal} CRM.$(function($) { - cj('#start_date_display').change( function( ) { - if ( cj(this).val( ) ) { - cj('#now').prop('checked', false ); + $('#start_date_display').change( function( ) { + if ( $(this).val( ) ) { + $('#now').prop('checked', false ); } }); - cj('#now').change( function( ) { - if ( cj('#now').prop('checked', true ) ) { - cj('#start_date_display').val( '' ); - cj('#start_date').val( '' ); - cj('#start_date_time').val( '' ); + $('#now').change( function( ) { + if ( $('#now').prop('checked', true ) ) { + $('#start_date_display').val( '' ); + $('#start_date').val( '' ); + $('#start_date_time').val( '' ); } }); }); diff --git a/templates/CRM/UF/Form/Block.tpl b/templates/CRM/UF/Form/Block.tpl index a7763289b6..e49f3c2577 100644 --- a/templates/CRM/UF/Form/Block.tpl +++ b/templates/CRM/UF/Form/Block.tpl @@ -174,8 +174,8 @@ {literal} {/literal} diff --git a/templates/CRM/UF/Form/Field.tpl b/templates/CRM/UF/Form/Field.tpl index 02f4572378..067cf5ddee 100644 --- a/templates/CRM/UF/Form/Field.tpl +++ b/templates/CRM/UF/Form/Field.tpl @@ -91,12 +91,9 @@ {literal} diff --git a/templates/CRM/common/TrackingFields.tpl b/templates/CRM/common/TrackingFields.tpl index 6dbff68fc2..30ea784edc 100644 --- a/templates/CRM/common/TrackingFields.tpl +++ b/templates/CRM/common/TrackingFields.tpl @@ -29,7 +29,7 @@ CRM.$(function($) { {/literal} {foreach from=$trackingFields key=trackingFieldName item=dontCare} - cj("#{$trackingFieldName}").parent().parent().hide( ); + $("#{$trackingFieldName}").parent().parent().hide( ); {/foreach} {literal} } diff --git a/templates/CRM/common/additionalBlocks.tpl b/templates/CRM/common/additionalBlocks.tpl index 45adc63e4d..c0cbaf0ad7 100644 --- a/templates/CRM/common/additionalBlocks.tpl +++ b/templates/CRM/common/additionalBlocks.tpl @@ -177,7 +177,7 @@ function clearFirstBlock( blockName , blockId ) { } function getAddressBlock( position ) { - var addressBlockIds = new Array(); + var addressBlockIds = []; var i = 0; switch ( position ) { case 'last': diff --git a/templates/CRM/common/batchCopy.tpl b/templates/CRM/common/batchCopy.tpl index 8103142b1f..2b6456b6fc 100644 --- a/templates/CRM/common/batchCopy.tpl +++ b/templates/CRM/common/batchCopy.tpl @@ -26,85 +26,75 @@ {literal} {/literal} diff --git a/templates/CRM/common/jcalendar.tpl b/templates/CRM/common/jcalendar.tpl index b4e25f3d0d..ea6560f6b6 100644 --- a/templates/CRM/common/jcalendar.tpl +++ b/templates/CRM/common/jcalendar.tpl @@ -77,15 +77,15 @@ var element_time = "#{$elementId}_time"; {if $timeElement} element_time = "#{$timeElement}"; - var time_format = cj( element_time ).attr('timeFormat'); + var time_format = $( element_time ).attr('timeFormat'); {literal} - cj(element_time).timeEntry({ show24Hours : time_format, spinnerImage: '' }); + $(element_time).timeEntry({ show24Hours : time_format, spinnerImage: '' }); {/literal} {/if} var currentYear = new Date().getFullYear(); var alt_field = '#{$elementId}'; - cj( alt_field ).hide(); - var date_format = cj( alt_field ).attr('format'); + $( alt_field ).hide(); + var date_format = $( alt_field ).attr('format'); var altDateFormat = 'mm/dd/yy'; {literal} @@ -97,22 +97,22 @@ } if ( !( ( date_format == 'M yy' ) || ( date_format == 'yy' ) || ( date_format == 'yy-mm' ) ) ) { - cj( element_date ).addClass( 'dpDate' ); + $( element_date ).addClass( 'dpDate' ); } {/literal} - var yearRange = currentYear - parseInt( cj( alt_field ).attr('startOffset') ); + var yearRange = currentYear - parseInt( $( alt_field ).attr('startOffset') ); yearRange += ':'; - yearRange += currentYear + parseInt( cj( alt_field ).attr('endOffset' ) ); + yearRange += currentYear + parseInt( $( alt_field ).attr('endOffset' ) ); {literal} - var startRangeYr = currentYear - parseInt( cj( alt_field ).attr('startOffset') ); - var endRangeYr = currentYear + parseInt( cj( alt_field ).attr('endOffset' ) ); + var startRangeYr = currentYear - parseInt( $( alt_field ).attr('startOffset') ); + var endRangeYr = currentYear + parseInt( $( alt_field ).attr('endOffset' ) ); var lcMessage = {/literal}"{$config->lcMessages}"{literal}; var localisation = lcMessage.split('_'); - var dateValue = cj(alt_field).val( ); - cj(element_date).datepicker({ + var dateValue = $(alt_field).val( ); + $(element_date).datepicker({ closeAtTop : true, dateFormat : date_format, changeMonth : true, @@ -128,31 +128,31 @@ // set default value to display field, setDefault param for datepicker // is not working hence using below logic // parse the date - var displayDateValue = cj.datepicker.parseDate( altDateFormat, dateValue ); + var displayDateValue = $.datepicker.parseDate( altDateFormat, dateValue ); // format date according to display field - displayDateValue = cj.datepicker.formatDate( date_format, displayDateValue ); - cj( element_date).val( displayDateValue ); + displayDateValue = $.datepicker.formatDate( date_format, displayDateValue ); + $( element_date).val( displayDateValue ); //support unsaved-changes warning: CRM-14353 - cj( element_date).data('crm-initial-value', displayDateValue); + $( element_date).data('crm-initial-value', displayDateValue); - cj(element_date).click( function( ) { + $(element_date).click( function( ) { hideYear( this ); }); - cj('.ui-datepicker-trigger').click( function( ) { - hideYear( cj(this).prev() ); + $('.ui-datepicker-trigger').click( function( ) { + hideYear( $(this).prev() ); }); function hideYear( element ) { - var format = cj( element ).attr('format'); + var format = $( element ).attr('format'); if ( format == 'dd-mm' || format == 'mm/dd' ) { - cj(".ui-datepicker-year").css('display', 'none'); + $(".ui-datepicker-year").css('display', 'none'); } } - cj(alt_field + ',' + element_date + ',' + element_time).on('blur change', function() { - var vis = cj(alt_field).val() || cj(element_time).val() ? '' : 'hidden'; - cj(this).siblings('.crm-clear-link').css('visibility', vis); + $(alt_field + ',' + element_date + ',' + element_time).on('blur change', function() { + var vis = $(alt_field).val() || $(element_time).val() ? '' : 'hidden'; + $(this).siblings('.crm-clear-link').css('visibility', vis); }); - cj(alt_field).change(); + $(alt_field).change(); }); {/literal} diff --git a/templates/CRM/common/jsortable.tpl b/templates/CRM/common/jsortable.tpl index 1491a16b6a..44da77eec7 100644 --- a/templates/CRM/common/jsortable.tpl +++ b/templates/CRM/common/jsortable.tpl @@ -25,183 +25,184 @@ *} {literal} {/literal} diff --git a/templates/CRM/common/paymentBlock.tpl b/templates/CRM/common/paymentBlock.tpl index 8cb3c8a32b..d9f0427732 100644 --- a/templates/CRM/common/paymentBlock.tpl +++ b/templates/CRM/common/paymentBlock.tpl @@ -59,10 +59,10 @@ function buildPaymentBlock( type ) { } CRM.$(function($) { - cj('.crm-group.payment_options-group').show(); + $('.crm-group.payment_options-group').show(); - cj('input[name="payment_processor"]').change( function() { - buildPaymentBlock( cj(this).val() ); + $('input[name="payment_processor"]').change( function() { + buildPaymentBlock( $(this).val() ); }); }); diff --git a/tools/extensions/org.civicrm.search.activity/templates/ActivitySearch.tpl b/tools/extensions/org.civicrm.search.activity/templates/ActivitySearch.tpl index 473ca8b47a..f66785dbcd 100644 --- a/tools/extensions/org.civicrm.search.activity/templates/ActivitySearch.tpl +++ b/tools/extensions/org.civicrm.search.activity/templates/ActivitySearch.tpl @@ -140,10 +140,3 @@ {/if} {/if} -{literal} - -{/literal} -- 2.25.1