From 6f9cd76f756657d231d86af06cc49995fd31c531 Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Mon, 30 Dec 2013 21:30:32 -0800 Subject: [PATCH] CRM-13932 - Fix deprecated useages of jQuery.attr --- js/jquery/jquery.crmasmselect.js | 12 ++++++------ js/view/crm.designer.js | 3 +-- js/view/crm.profile-selector.js | 2 +- templates/CRM/Batch/Form/Entry.js | 6 +++--- templates/CRM/Batch/Form/Entry.tpl | 4 ++-- .../CRM/Campaign/Form/addCampaignToComponent.tpl | 4 ++-- templates/CRM/Contact/Form/Relationship.tpl | 8 ++++---- templates/CRM/Contact/Form/Search/Criteria/Basic.tpl | 4 ++-- templates/CRM/Contact/Form/Task/EmailCommon.js | 2 +- .../Contribute/Form/AdditionalInfo/CreditCard.tpl | 6 +++--- .../CRM/Contribute/Form/Contribution/OnBehalfOf.tpl | 2 +- templates/CRM/Core/BillingBlock.tpl | 8 ++++---- templates/CRM/Custom/Form/Group.tpl | 4 ++-- .../Event/Cart/Form/Checkout/ConferenceEvents.tpl | 2 +- templates/CRM/Event/Cart/Form/Checkout/Payment.tpl | 2 +- templates/CRM/Event/Form/ManageEvent/EventInfo.tpl | 2 +- templates/CRM/Event/Form/Participant.tpl | 4 ++-- templates/CRM/Financial/Form/BatchTransaction.tpl | 8 ++++---- templates/CRM/Financial/Form/Search.tpl | 2 +- templates/CRM/Group/Form/Edit.tpl | 2 +- templates/CRM/Member/Form/Task/Label.js | 8 ++++---- templates/CRM/Report/Form/Actions.tpl | 8 ++++---- templates/CRM/Report/Form/Criteria.tpl | 4 ++-- templates/CRM/Tag/Form/Tag.tpl | 2 +- templates/CRM/common/customData.tpl | 4 ++-- 25 files changed, 56 insertions(+), 57 deletions(-) diff --git a/js/jquery/jquery.crmasmselect.js b/js/jquery/jquery.crmasmselect.js index ffee488329..49b93e1239 100644 --- a/js/jquery/jquery.crmasmselect.js +++ b/js/jquery/jquery.crmasmselect.js @@ -212,7 +212,7 @@ // select the firm item from the regular select that we created - $select.children(":eq(0)").attr("selected", true); + $select.children(":eq(0)").prop("selected", true); } function disableSelectOption($option) { @@ -222,8 +222,8 @@ // we apply a class that reproduces the disabled look in other browsers $option.addClass(options.optionDisabledClass) - .attr("selected", false) - .attr("disabled", true); + .prop("selected", false) + .prop("disabled", true); if(options.hideWhenAdded) $option.hide(); if($.browser.msie) $select.hide().show(); // this forces IE to update display @@ -234,7 +234,7 @@ // given an already disabled select option, enable it $option.removeClass(options.optionDisabledClass) - .attr("disabled", false); + .prop("disabled", false); if(options.hideWhenAdded) $option.show(); if($.browser.msie) $select.hide().show(); // this forces IE to update display @@ -271,7 +271,7 @@ if(!buildingSelect) { if($O.is(":selected")) return; // already have it - $O.attr('selected', true); + $O.prop('selected', true); } if(options.addItemTarget == 'top' && !buildingSelect) { @@ -333,7 +333,7 @@ if(highlightItem == undefined) var highlightItem = true; var $O = $('#' + optionId); - $O.attr('selected', false); + $O.prop('selected', false); $item = $ol.children("li[rel=" + optionId + "]"); dropListItemHide($item); diff --git a/js/view/crm.designer.js b/js/view/crm.designer.js index 684b60f6f2..0098ca9b1e 100644 --- a/js/view/crm.designer.js +++ b/js/view/crm.designer.js @@ -203,7 +203,7 @@ }, onUfChanged: function(isUfUnsaved) { if (isUfUnsaved) { - this.$('.crm-designer-save').removeAttr('style').removeAttr('disabled'); + this.$('.crm-designer-save').removeAttr('style').prop('disabled', false); } }, doSave: function(event) { @@ -763,7 +763,6 @@ this.form.commit(); this.$('.field-is_multi_summary').toggle(this.options.fieldSchema.civiIsMultiple ? true : false); this.$('.field-in_selector').toggle(this.model.isInSelectorAllowed()); - // this.$(':input').attr('disabled', this.model.get("is_reserved") == 1); if (!this.model.isInSelectorAllowed() && this.model.get('in_selector') != "0") { this.model.set('in_selector', "0"); diff --git a/js/view/crm.profile-selector.js b/js/view/crm.profile-selector.js index 438d58b708..19660552f8 100644 --- a/js/view/crm.profile-selector.js +++ b/js/view/crm.profile-selector.js @@ -63,7 +63,7 @@ this.doPreview(); }, toggleButtons: function() { - this.$('.crm-profile-selector-edit,.crm-profile-selector-copy').attr('disabled', !this.hasUfGroupId()); + this.$('.crm-profile-selector-edit,.crm-profile-selector-copy').prop('disabled', !this.hasUfGroupId()); }, hasUfGroupId: function() { return (this.getUfGroupId() && this.getUfGroupId() != '') ? true : false; diff --git a/templates/CRM/Batch/Form/Entry.js b/templates/CRM/Batch/Form/Entry.js index 78ab8337de..6b81bd1962 100644 --- a/templates/CRM/Batch/Form/Entry.js +++ b/templates/CRM/Batch/Form/Entry.js @@ -44,7 +44,7 @@ cj(function () { else{ cj('select[id^="member_option_"]').each(function () { if (cj(this).val() == 1) { - cj(this).attr('disabled', true); + cj(this).prop('disabled', true); } }); @@ -95,7 +95,7 @@ function updateContactInfo(blockNo, prefix) { if(CRM.batch.type_id == 2) { CRM.api('Membership', 'get', { 'sequential': '1', - 'contact_id': contactId, + 'contact_id': contactId }, { success: function (data) { if (data.count > 0) { @@ -108,7 +108,7 @@ function updateContactInfo(blockNo, prefix) { }, { success: function (data) { var memTypeContactId = data.values[0].member_of_contact_id; - cj('select[id="member_option_' + blockNo + '"]').removeAttr('disabled').val(2); + cj('select[id="member_option_' + blockNo + '"]').prop('disabled', false).val(2); cj('select[id="field_' + blockNo + '_membership_type_0"]').val(memTypeContactId).change(); cj('select[id="field_' + blockNo + '_membership_type_1"]').val(membershipTypeId).change(); setDateFieldValue('join_date', membershipJoinDate, blockNo) diff --git a/templates/CRM/Batch/Form/Entry.tpl b/templates/CRM/Batch/Form/Entry.tpl index 4e3ea15ccf..6f84ef48b4 100644 --- a/templates/CRM/Batch/Form/Entry.tpl +++ b/templates/CRM/Batch/Form/Entry.tpl @@ -140,7 +140,7 @@ cj(function () { {/literal}{else}{literal} cj('select[id^="member_option_"]').each(function () { if (cj(this).val() == 1) { - cj(this).attr('disabled', true); + cj(this).prop('disabled', true); } }); @@ -338,7 +338,7 @@ function updateContactInfo(blockNo, prefix) { }, { success: function (data) { var memTypeContactId = data.values[0].member_of_contact_id; - cj('select[id="member_option_' + blockNo + '"]').removeAttr('disabled').val(2); + cj('select[id="member_option_' + blockNo + '"]').prop('disabled', false).val(2); cj('select[id="field_' + blockNo + '_membership_type_0"]').val(memTypeContactId).change(); cj('select[id="field_' + blockNo + '_membership_type_1"]').val(membershipTypeId).change(); setDateFieldValue('join_date', membershipJoinDate, blockNo) diff --git a/templates/CRM/Campaign/Form/addCampaignToComponent.tpl b/templates/CRM/Campaign/Form/addCampaignToComponent.tpl index 230e7be1c6..aaf99214a7 100644 --- a/templates/CRM/Campaign/Form/addCampaignToComponent.tpl +++ b/templates/CRM/Campaign/Form/addCampaignToComponent.tpl @@ -25,8 +25,8 @@ value = cj(this).val(); if ( value == 'current_campaign' || value == 'past_campaign' ) { cj(this).css( 'color', 'black' ); - cj(this).attr( 'disabled', true ); - cj(this).attr( 'selected', false); + cj(this).prop( 'disabled', true ); + cj(this).prop( 'selected', false); cj(this).addClass( 'asmOptionDisabled' ); } }); diff --git a/templates/CRM/Contact/Form/Relationship.tpl b/templates/CRM/Contact/Form/Relationship.tpl index 6510367c28..5cc6f68d95 100644 --- a/templates/CRM/Contact/Form/Relationship.tpl +++ b/templates/CRM/Contact/Form/Relationship.tpl @@ -143,14 +143,14 @@ contactAutocomplete.unautocomplete( ); if ( relationshipTypeValue ) { - cj('#profiles_1').attr('disabled', false); - contactAutocomplete.attr('disabled', false); + cj('#profiles_1').prop('disabled', false); + contactAutocomplete.prop('disabled', false); contactAutocomplete.addClass('ac_input'); buildCreateNewSelect( 'profiles_1', relationshipTypeValue ); } else { - cj('#profiles_1').attr('disabled', true); + cj('#profiles_1').prop('disabled', true); contactAutocomplete.removeClass('ac_input'); - contactAutocomplete.attr('disabled', true); + contactAutocomplete.prop('disabled', true); } } diff --git a/templates/CRM/Contact/Form/Search/Criteria/Basic.tpl b/templates/CRM/Contact/Form/Search/Criteria/Basic.tpl index 0316619aed..f4ef9274d5 100644 --- a/templates/CRM/Contact/Form/Search/Criteria/Basic.tpl +++ b/templates/CRM/Contact/Form/Search/Criteria/Basic.tpl @@ -101,14 +101,14 @@ cj('#groupselect').show(); cj('#group_type').val('') ; cj('#crmasmList2 li').remove(); - cj('#crmasmSelect2').children().removeClass('asmOptionDisabled').removeAttr('disabled'); + cj('#crmasmSelect2').children().removeClass('asmOptionDisabled').prop('disabled', false); } function showGroupTypeSearch(){ cj('#groupselect').hide(); cj('#grouptypeselect').show(); cj('#group').val('') ; cj('#crmasmList1 li').remove(); - cj('#crmasmSelect1').children().removeClass('asmOptionDisabled').removeAttr('disabled'); + cj('#crmasmSelect1').children().removeClass('asmOptionDisabled').prop('disabled', false); } cj(function(){ diff --git a/templates/CRM/Contact/Form/Task/EmailCommon.js b/templates/CRM/Contact/Form/Task/EmailCommon.js index bb7610e4c9..d58d7e990f 100644 --- a/templates/CRM/Contact/Form/Task/EmailCommon.js +++ b/templates/CRM/Contact/Form/Task/EmailCommon.js @@ -9,7 +9,7 @@ cj(function ($) { // for some browsers like chrome. Used for purpose of // submit the form and stop accidental multiple clicks setTimeout(function(){ - $('.form-submit').not('.cancel').attr({disabled: 'disabled'}); + $('.form-submit').not('.cancel').prop({disabled: true}); }, 0); }); }); diff --git a/templates/CRM/Contribute/Form/AdditionalInfo/CreditCard.tpl b/templates/CRM/Contribute/Form/AdditionalInfo/CreditCard.tpl index e283801dc7..b4e2a444c0 100644 --- a/templates/CRM/Contribute/Form/AdditionalInfo/CreditCard.tpl +++ b/templates/CRM/Contribute/Form/AdditionalInfo/CreditCard.tpl @@ -46,9 +46,9 @@ installments.val( '' ); } - frUnit.attr( 'disabled', isDisabled ); - frInerval.attr( 'disabled', isDisabled ); - installments.attr( 'disabled', isDisabled ); + frUnit.prop( 'disabled', isDisabled ); + frInerval.prop( 'disabled', isDisabled ); + installments.prop( 'disabled', isDisabled ); } function buildRecurBlock( processorId ) { diff --git a/templates/CRM/Contribute/Form/Contribution/OnBehalfOf.tpl b/templates/CRM/Contribute/Form/Contribution/OnBehalfOf.tpl index 726371eaa9..f218ab6936 100644 --- a/templates/CRM/Contribute/Form/Contribution/OnBehalfOf.tpl +++ b/templates/CRM/Contribute/Form/Contribution/OnBehalfOf.tpl @@ -235,7 +235,7 @@ function setLocationDetails(contactID) { } else if (data[ele].type == 'Multi-Select') { for (var selectedOption in data[ele].value) { - cj('#' + ele + " option[value='" + selectedOption + "']").attr('selected', 'selected'); + cj('#' + ele + " option[value='" + selectedOption + "']").prop('selected', true); } } else if (data[ele].type == 'Autocomplete-Select') { diff --git a/templates/CRM/Core/BillingBlock.tpl b/templates/CRM/Core/BillingBlock.tpl index 9efb53a3ce..129fce7fa9 100644 --- a/templates/CRM/Core/BillingBlock.tpl +++ b/templates/CRM/Core/BillingBlock.tpl @@ -250,8 +250,8 @@ cj( function( ) { // if billing checkbox is active, copy other field into billing field if(cj('#billingcheckbox').prop('checked')) { - cj(orig_id+' option').removeAttr('selected'); - cj(orig_id+' option[value="'+cj(id).val()+'"]').attr('selected', 'selected'); + cj(orig_id+' option').prop('selected', false); + cj(orig_id+' option[value="'+cj(id).val()+'"]').prop('selected', true); }; if(orig_id == '#billing_country_id-5') { @@ -273,8 +273,8 @@ cj( function( ) { }; for(var id in select_ids) { var orig_id = select_ids[id]; - cj(orig_id+' option').removeAttr('selected'); - cj(orig_id+' option[value="'+cj(id).val()+'"]').attr('selected', 'selected'); + cj(orig_id+' option').prop('selected', false); + cj(orig_id+' option[value="'+cj(id).val()+'"]').prop('selected', true); }; } else { cj('.billing_name_address-group').show(200); diff --git a/templates/CRM/Custom/Form/Group.tpl b/templates/CRM/Custom/Form/Group.tpl index 7c13b83ecb..d11b6e17cb 100644 --- a/templates/CRM/Custom/Form/Group.tpl +++ b/templates/CRM/Custom/Form/Group.tpl @@ -146,12 +146,12 @@ cj(function($) { function showRange(onFormLoad) { if(cj("#is_multiple :checked").length) { cj("tr#multiple").show(); - cj("select#style option[value='Tab']").attr("selected", "selected"); + cj("select#style option[value='Tab']").prop("selected", true); } else { cj("tr#multiple").hide(); if (!onFormLoad) { - cj("select#style option[value='Inline']").attr("selected", "selected"); + cj("select#style option[value='Inline']").prop("selected", true); } } } diff --git a/templates/CRM/Event/Cart/Form/Checkout/ConferenceEvents.tpl b/templates/CRM/Event/Cart/Form/Checkout/ConferenceEvents.tpl index 3820afeff9..f347b381a6 100644 --- a/templates/CRM/Event/Cart/Form/Checkout/ConferenceEvents.tpl +++ b/templates/CRM/Event/Cart/Form/Checkout/ConferenceEvents.tpl @@ -27,7 +27,7 @@ for (var radio_id in session_options) var label_sel = "label[for=" + radio_id + "]"; cj("#"+radio_id +","+ label_sel).wrapAll("
  • "); if (info.session_full) { - cj("#"+radio_id).attr('disabled', 'disabled'); + cj("#"+radio_id).prop('disabled', true); cj("#"+radio_id).after('{/literal}{ts escape='js'}Session is Full{/ts}{literal}: '); } var more = cj('{/literal}{ts escape='js'}more info{/ts}{literal}').click(function(event) { diff --git a/templates/CRM/Event/Cart/Form/Checkout/Payment.tpl b/templates/CRM/Event/Cart/Form/Checkout/Payment.tpl index 2dd3e30275..cca4692f7f 100644 --- a/templates/CRM/Event/Cart/Form/Checkout/Payment.tpl +++ b/templates/CRM/Event/Cart/Form/Checkout/Payment.tpl @@ -163,7 +163,7 @@ cj("document").ready(function() { cj(".pay-later-instructions").toggle(is_pay_later); cj("div.billingNameInfo-section .description").html(is_pay_later ? "Enter the billing address at which you can be invoiced." : "Enter the name as shown on your credit or debit card, and the billing address for this card."); } - cj("input#source").attr('disabled', 'disabled'); + cj("input#source").prop('disabled', true); cj(pay_later_sel).change(function() { refresh(); diff --git a/templates/CRM/Event/Form/ManageEvent/EventInfo.tpl b/templates/CRM/Event/Form/ManageEvent/EventInfo.tpl index 86df08880d..1e40f861d2 100644 --- a/templates/CRM/Event/Form/ManageEvent/EventInfo.tpl +++ b/templates/CRM/Event/Form/ManageEvent/EventInfo.tpl @@ -181,7 +181,7 @@ function reloadWindow(tempId) { //freeze the event type element //when template form is loading. - cj( "#event_type_id" ).attr('disabled', true ); + cj( "#event_type_id" ).prop('disabled', true ); window.location += '&template_id=' + tempId; } diff --git a/templates/CRM/Event/Form/Participant.tpl b/templates/CRM/Event/Form/Participant.tpl index ad53363cae..5a37446fda 100644 --- a/templates/CRM/Event/Form/Participant.tpl +++ b/templates/CRM/Event/Form/Participant.tpl @@ -377,11 +377,11 @@ }); cj("#feeBlock").ajaxStart(function(){ - cj(".disable-buttons input").attr('disabled', true); + cj(".disable-buttons input").prop('disabled', true); }); cj("#feeBlock").ajaxStop(function(){ - cj(".disable-buttons input").attr('disabled', false); + cj(".disable-buttons input").prop('disabled', false); }); //show event real full as well as waiting list message. diff --git a/templates/CRM/Financial/Form/BatchTransaction.tpl b/templates/CRM/Financial/Form/BatchTransaction.tpl index be93fddce7..4f5ff95936 100644 --- a/templates/CRM/Financial/Form/BatchTransaction.tpl +++ b/templates/CRM/Financial/Form/BatchTransaction.tpl @@ -133,8 +133,8 @@ cj( function() { return false; }); - cj("#trans_assign").attr('disabled',true); - cj("#trans_remove").attr('disabled',true); + cj("#trans_assign").prop('disabled',true); + cj("#trans_remove").prop('disabled',true); cj('#crm-transaction-selector-assign #toggleSelect').click( function() { enableActions('x'); }); @@ -190,10 +190,10 @@ cj( function() { function enableActions( type ) { if (type == 'x') { - cj("#trans_assign").attr('disabled',false); + cj("#trans_assign").prop('disabled',false); } else { - cj("#trans_remove").attr('disabled',false); + cj("#trans_remove").prop('disabled',false); } } diff --git a/templates/CRM/Financial/Form/Search.tpl b/templates/CRM/Financial/Form/Search.tpl index f785374c2f..72028b6987 100644 --- a/templates/CRM/Financial/Form/Search.tpl +++ b/templates/CRM/Financial/Form/Search.tpl @@ -70,7 +70,7 @@ cj(function($) { var batchSelector; buildBatchSelector(); - $("#batch_update").removeAttr('disabled'); + $("#batch_update").prop('disabled', false); $('#financial-search-form :input') .change(function() { diff --git a/templates/CRM/Group/Form/Edit.tpl b/templates/CRM/Group/Form/Edit.tpl index ed72d748c8..1787954075 100644 --- a/templates/CRM/Group/Form/Edit.tpl +++ b/templates/CRM/Group/Form/Edit.tpl @@ -145,7 +145,7 @@ {literal} diff --git a/templates/CRM/Report/Form/Criteria.tpl b/templates/CRM/Report/Form/Criteria.tpl index cfbd681aa8..db132b78ef 100644 --- a/templates/CRM/Report/Form/Criteria.tpl +++ b/templates/CRM/Report/Form/Criteria.tpl @@ -139,10 +139,10 @@ function disPageBreak() { if (!cj(this).prop('checked')) { - cj(this).parent('td').next('td').children('input[id^="order_by_pagebreak_"]').attr({checked: false, disabled: "disabled"}); + cj(this).parent('td').next('td').children('input[id^="order_by_pagebreak_"]').prop({checked: false, disabled: true}); } else { - cj(this).parent('td').next('td').children('input[id^="order_by_pagebreak_"]').attr({disabled: false}); + cj(this).parent('td').next('td').children('input[id^="order_by_pagebreak_"]').prop({disabled: false}); } } diff --git a/templates/CRM/Tag/Form/Tag.tpl b/templates/CRM/Tag/Form/Tag.tpl index 3132cabb2e..5da3014400 100644 --- a/templates/CRM/Tag/Form/Tag.tpl +++ b/templates/CRM/Tag/Form/Tag.tpl @@ -60,7 +60,7 @@ {/literal} {if $permission neq 'edit'} {literal} - $("#tagtree input").attr('disabled', true); + $("#tagtree input").prop('disabled', true); {/literal} {/if} {literal} diff --git a/templates/CRM/common/customData.tpl b/templates/CRM/common/customData.tpl index e203162dd8..941003430c 100644 --- a/templates/CRM/common/customData.tpl +++ b/templates/CRM/common/customData.tpl @@ -108,8 +108,8 @@ CRM.buildCustomData = function( type, subType, subName, cgCount, groupID, isMult cj('textarea', this).each(function() { cj(this).text(cj(this).val()); }); - cj('option:selected', this).attr('selected', 'selected'); - cj('option:not(:selected)', this).removeAttr('selected'); + cj('option:selected', this).prop('selected', true); + cj('option:not(:selected)', this).prop('selected', false); storage[id] = cj(this).detach(); } }); -- 2.25.1