From 289bcefbe2f0f450e0d3e98729a32e9c564e0406 Mon Sep 17 00:00:00 2001 From: Alejandro Gallardo Escobar Date: Tue, 14 Jul 2015 11:48:30 +0200 Subject: [PATCH] Replaced the use of the jQuery 'attr' function with the 'prop' function when using the 'selected' property. The 'attr' function is going to be deprecated an may cause errors in Firefox. --- .../agentes/agent_wizard.snmp_explorer.php | 2 +- .../agent_wizard.snmp_interfaces_explorer.php | 6 +-- .../agentes/agent_wizard.wmi_explorer.php | 2 +- .../agentes/module_manager_editor_common.php | 4 +- .../godmode/events/custom_events.php | 2 +- .../godmode/events/event_responses.editor.php | 2 +- .../godmode/gis_maps/configure_gis_map.php | 2 +- .../godmode/massive/massive_copy_modules.php | 2 +- .../manage_network_components_form.php | 4 +- .../visual_console_builder.editor.js | 6 +-- .../visual_console_builder.wizard.php | 6 +-- .../javascript/jquery.pandora.controls.js | 2 +- pandora_console/include/javascript/pandora.js | 48 +++++++++---------- pandora_console/operation/events/events.php | 2 +- 14 files changed, 45 insertions(+), 45 deletions(-) diff --git a/pandora_console/godmode/agentes/agent_wizard.snmp_explorer.php b/pandora_console/godmode/agentes/agent_wizard.snmp_explorer.php index 028f228ac2..63afaccf85 100644 --- a/pandora_console/godmode/agentes/agent_wizard.snmp_explorer.php +++ b/pandora_console/godmode/agentes/agent_wizard.snmp_explorer.php @@ -1039,7 +1039,7 @@ $(document).ready (function () { return false; } $('#module option').map(function(){ - $(this).attr('selected','selected'); + $(this).prop('selected', true); }); }); }); diff --git a/pandora_console/godmode/agentes/agent_wizard.snmp_interfaces_explorer.php b/pandora_console/godmode/agentes/agent_wizard.snmp_interfaces_explorer.php index 0ec52b4434..9e50bdbde9 100644 --- a/pandora_console/godmode/agentes/agent_wizard.snmp_interfaces_explorer.php +++ b/pandora_console/godmode/agentes/agent_wizard.snmp_interfaces_explorer.php @@ -508,11 +508,11 @@ function snmp_changed_by_multiple_snmp (event, id_snmp, selected) { if (c == 0) { if (typeof($(document).data('text_for_module')) != 'undefined') { - $('#module').append ($('').html ($(document).data('text_for_module')).attr("value", 0).attr('selected', true)); + $('#module').append ($('').html ($(document).data('text_for_module')).attr("value", 0).prop('selected', true)); } else { if (typeof(data['any_text']) != 'undefined') { - $('#module').append ($('').html (data['any_text']).attr ("value", 0).attr('selected', true)); + $('#module').append ($('').html (data['any_text']).attr ("value", 0).prop('selected', true)); } else { var anyText = $("#any_text").html(); //Trick for catch the translate text. @@ -521,7 +521,7 @@ function snmp_changed_by_multiple_snmp (event, id_snmp, selected) { anyText = 'Any'; } - $('#module').append ($('').html (anyText).attr ("value", 0).attr('selected', true)); + $('#module').append ($('').html (anyText).attr ("value", 0).prop('selected', true)); } } } diff --git a/pandora_console/godmode/agentes/agent_wizard.wmi_explorer.php b/pandora_console/godmode/agentes/agent_wizard.wmi_explorer.php index 3163a00d75..3dc24f1d9d 100644 --- a/pandora_console/godmode/agentes/agent_wizard.wmi_explorer.php +++ b/pandora_console/godmode/agentes/agent_wizard.wmi_explorer.php @@ -491,7 +491,7 @@ $(document).ready (function () { return false; } $('#module option').map(function(){ - $(this).attr('selected','selected'); + $(this).prop('selected', true); }); }); }); diff --git a/pandora_console/godmode/agentes/module_manager_editor_common.php b/pandora_console/godmode/agentes/module_manager_editor_common.php index a9c0f5a73d..c6215f5fe7 100644 --- a/pandora_console/godmode/agentes/module_manager_editor_common.php +++ b/pandora_console/godmode/agentes/module_manager_editor_common.php @@ -704,13 +704,13 @@ $(document).ready (function () { $("#submit-updbutton").click(function () { $('#id_tag_selected option').map(function(){ - $(this).attr('selected','selected'); + $(this).prop('selected', true); }); }); $("#submit-crtbutton").click(function () { $('#id_tag_selected option').map(function(){ - $(this).attr('selected','selected'); + $(this).prop('selected', true); }); }); diff --git a/pandora_console/godmode/events/custom_events.php b/pandora_console/godmode/events/custom_events.php index 1eb7ddde1a..38f9578542 100644 --- a/pandora_console/godmode/events/custom_events.php +++ b/pandora_console/godmode/events/custom_events.php @@ -221,7 +221,7 @@ $(document).ready (function () { $("#submit-upd_button").click(function () { $('#fields_selected option').map(function() { - $(this).attr('selected','selected'); + $(this).prop('selected', true); }); }); }); diff --git a/pandora_console/godmode/events/event_responses.editor.php b/pandora_console/godmode/events/event_responses.editor.php index 1aa7177b60..8b5d36b385 100644 --- a/pandora_console/godmode/events/event_responses.editor.php +++ b/pandora_console/godmode/events/event_responses.editor.php @@ -142,7 +142,7 @@ $('#type').change(function() { switch ($(this).val()) { case 'command': $('#new_window option[value="0"]') - .attr('selected','selected'); + .prop('selected', true); $('#new_window').attr('disabled','disabled'); break; case 'url': diff --git a/pandora_console/godmode/gis_maps/configure_gis_map.php b/pandora_console/godmode/gis_maps/configure_gis_map.php index a9fcbb56da..77ecee369f 100644 --- a/pandora_console/godmode/gis_maps/configure_gis_map.php +++ b/pandora_console/godmode/gis_maps/configure_gis_map.php @@ -586,7 +586,7 @@ function loadAgents(agent_list) { function setFieldsFormLayer(layer_name,layer_group, layer_visible_form, agent_list) { $("#text-layer_name_form").val(layer_name); - $("#layer_group_form [value="+layer_group+"]").attr("selected",true); + $("#layer_group_form [value="+layer_group+"]").prop("selected", true); $("#text_id_agent").val(''); if (layer_visible_form == '0') { $("#checkbox-layer_visible_form").removeAttr("checked"); diff --git a/pandora_console/godmode/massive/massive_copy_modules.php b/pandora_console/godmode/massive/massive_copy_modules.php index 5f4aa8e9cc..0f7deb5a1a 100644 --- a/pandora_console/godmode/massive/massive_copy_modules.php +++ b/pandora_console/godmode/massive/massive_copy_modules.php @@ -397,7 +397,7 @@ $(document).ready (function () { jQuery.each ($(this).fieldValue (), function () { if (module_alerts[this] != undefined) $("#target_modules option[value="+module_alerts[this]+"]") - .attr ("selected", "selected"); + .prop ("selected", true); }); }); diff --git a/pandora_console/godmode/modules/manage_network_components_form.php b/pandora_console/godmode/modules/manage_network_components_form.php index 4958535221..0d141f218c 100644 --- a/pandora_console/godmode/modules/manage_network_components_form.php +++ b/pandora_console/godmode/modules/manage_network_components_form.php @@ -456,13 +456,13 @@ $(document).ready (function () { $("#submit-crt").click(function () { $('#id_tag_selected option').map(function() { - $(this).attr('selected','selected'); + $(this).prop('selected', true); }); }); $("#submit-upd").click(function () { $('#id_tag_selected option').map(function() { - $(this).attr('selected','selected'); + $(this).prop('selected', true); }); }); diff --git a/pandora_console/godmode/reporting/visual_console_builder.editor.js b/pandora_console/godmode/reporting/visual_console_builder.editor.js index 88dad97b3b..dade0c851d 100644 --- a/pandora_console/godmode/reporting/visual_console_builder.editor.js +++ b/pandora_console/godmode/reporting/visual_console_builder.editor.js @@ -541,16 +541,16 @@ function loadFieldsFromDB(item) { .each(function() { if($(this).val() == val) { - $(this).attr('selected',true); + $(this).prop('selected', true); $(this).trigger('change'); anySelected = true; } }); if (anySelected == false) { $('#' + periodId + '_select option') - .eq(0).attr('selected',true); + .eq(0).prop('selected', true); $('#' + periodId + '_units option') - .eq(0).attr('selected',true); + .eq(0).prop('selected', true); $('#hidden-period').val(val); $('#text-' + periodId + '_text').val(val); adjustTextUnits(periodId); diff --git a/pandora_console/godmode/reporting/visual_console_builder.wizard.php b/pandora_console/godmode/reporting/visual_console_builder.wizard.php index 26a3041fb5..d934fa6b1e 100644 --- a/pandora_console/godmode/reporting/visual_console_builder.wizard.php +++ b/pandora_console/godmode/reporting/visual_console_builder.wizard.php @@ -346,7 +346,7 @@ $(document).ready (function () { $('#id_agents') .append($('') .html(noneText).attr ("None", "") - .attr('value', -1).attr('selected', true)); + .attr('value', -1).prop('selected', true)); } else { jQuery.each (data, function (i, val) { @@ -470,7 +470,7 @@ function item_per_agent_change(itemPerAgent) { $('#module').append ($('').html ().attr("value", -1)); $('#module').attr('disabled', true); $('#label_type').empty(); - $('#label_type').append ($('').html ().attr('value', 'agent').attr('selected', true)); + $('#label_type').append ($('').html ().attr('value', 'agent').prop('selected', true)); $('#label_type').append ($('').html ().attr('value', 'none')); $('#hidden-item_per_agent_test').val(1); @@ -488,7 +488,7 @@ function item_per_agent_change(itemPerAgent) { $('#hidden-item_per_agent_test').val(0); $('#label_type').empty(); $('#label_type').append ($('').html ().attr('value', 'agent')); - $('#label_type').append ($('').html ().attr('value', 'agent_module').attr('selected', true)); + $('#label_type').append ($('').html ().attr('value', 'agent_module').prop('selected', true)); $('#label_type').append ($('').html ().attr('value', 'module')); $('#label_type').append ($('').html ().attr('value', 'none')); diff --git a/pandora_console/include/javascript/jquery.pandora.controls.js b/pandora_console/include/javascript/jquery.pandora.controls.js index 44cc9c9ca4..ccc0274fb1 100644 --- a/pandora_console/include/javascript/jquery.pandora.controls.js +++ b/pandora_console/include/javascript/jquery.pandora.controls.js @@ -121,7 +121,7 @@ selected = $('#hidden-'+config.moduleSelect.attr('id')+'_selected').val(); if (selected == i) { option = $("") - .attr ("selected", "selected") + .prop ("selected", true) .attr ("value", value['id_agente_modulo']) .html (js_html_entity_decode (value['nombre'])); } diff --git a/pandora_console/include/javascript/pandora.js b/pandora_console/include/javascript/pandora.js index 17bbffcd82..4867c0b17e 100644 --- a/pandora_console/include/javascript/pandora.js +++ b/pandora_console/include/javascript/pandora.js @@ -88,11 +88,11 @@ function agent_changed (event, id_agent, selected) { $('#module').empty (); if (typeof($(document).data('text_for_module')) != 'undefined') { - $('#module').append ($('').html ($(document).data('text_for_module')).attr("value", 0).attr('selected', true)); + $('#module').append ($('').html ($(document).data('text_for_module')).attr("value", 0).prop('selected', true)); } else { if (typeof(data['any_text']) != 'undefined') { - $('#module').append ($('').html (data['any_text']).attr ("value", 0).attr('selected', true)); + $('#module').append ($('').html (data['any_text']).attr ("value", 0).prop('selected', true)); } else { var anyText = $("#any_text").html(); //Trick for catch the translate text. @@ -101,7 +101,7 @@ function agent_changed (event, id_agent, selected) { anyText = 'Any'; } - $('#module').append ($('').html (anyText).attr ("value", 0).attr('selected', true)); + $('#module').append ($('').html (anyText).attr ("value", 0).prop('selected', true)); } } jQuery.each (data, function (i, val) { @@ -223,7 +223,7 @@ function agent_changed_by_multiple_agents (event, id_agent, selected) { .append ($('') .html(noneText) .attr ("None", "") - .attr('selected', true)); + .prop('selected', true)); return; } @@ -234,7 +234,7 @@ function agent_changed_by_multiple_agents (event, id_agent, selected) { .html ($(document) .data('text_for_module')) .attr("value", 0) - .attr('selected', true)); + .prop('selected', true)); } else { if (typeof(data['any_text']) != 'undefined') { @@ -242,7 +242,7 @@ function agent_changed_by_multiple_agents (event, id_agent, selected) { .append ($('') .html (data['any_text']) .attr ("value", 0) - .attr('selected', true)); + .prop('selected', true)); } else { var anyText = $("#any_text").html(); //Trick for catch the translate text. @@ -255,7 +255,7 @@ function agent_changed_by_multiple_agents (event, id_agent, selected) { .append ($('') .html (anyText) .attr ("value", 0) - .attr('selected', true)); + .prop('selected', true)); } } jQuery.each (data, function (i, val) { @@ -321,11 +321,11 @@ function agent_changed_by_multiple_agents_with_alerts (event, id_agent, selected $('#module').empty (); if (typeof($(document).data('text_for_module')) != 'undefined') { - $('#module').append ($('').html ($(document).data('text_for_module')).attr("value", 0).attr('selected', true)); + $('#module').append ($('').html ($(document).data('text_for_module')).attr("value", 0).prop('selected', true)); } else { if (typeof(data['any_text']) != 'undefined') { - $('#module').append ($('').html (data['any_text']).attr ("value", 0).attr('selected', true)); + $('#module').append ($('').html (data['any_text']).attr ("value", 0).prop('selected', true)); } else { var anyText = $("#any_text").html(); //Trick for catch the translate text. @@ -334,7 +334,7 @@ function agent_changed_by_multiple_agents_with_alerts (event, id_agent, selected anyText = 'Any'; } - $('#module').append ($('').html (anyText).attr ("value", 0).attr('selected', true)); + $('#module').append ($('').html (anyText).attr ("value", 0).prop('selected', true)); } } jQuery.each (data, function (i, val) { @@ -394,19 +394,19 @@ function module_changed_by_multiple_modules (event, id_module, selected) { } $('#agents') - .append($('').html (noneText).attr ("None", "").attr('selected', true)); + .append($('').html (noneText).attr ("None", "").prop('selected', true)); return; } if (typeof($(document).data('text_for_module')) != 'undefined') { $('#agents') - .append ($('').html ($(document).data('text_for_module')).attr("value", 0).attr('selected', true)); + .append ($('').html ($(document).data('text_for_module')).attr("value", 0).prop('selected', true)); } else { if (typeof(data['any_text']) != 'undefined') { $('#agents') - .append ($('').html (data['any_text']).attr ("value", 0).attr('selected', true)); + .append ($('').html (data['any_text']).attr ("value", 0).prop('selected', true)); } else { var anyText = $("#any_text").html(); //Trick for catch the translate text. @@ -416,7 +416,7 @@ function module_changed_by_multiple_modules (event, id_module, selected) { } $('#agents') - .append($('').html (anyText).attr ("value", 0).attr('selected', true)); + .append($('').html (anyText).attr ("value", 0).prop('selected', true)); } } jQuery.each (data, function (i, val) { @@ -461,11 +461,11 @@ function agent_changed_by_multiple_agents_id (event, id_agent, selected) { $('#module').empty (); if (typeof($(document).data('text_for_module')) != 'undefined') { - $('#module').append ($('').html ($(document).data('text_for_module')).attr("value", 0).attr('selected', true)); + $('#module').append ($('').html ($(document).data('text_for_module')).attr("value", 0).prop('selected', true)); } else { if (typeof(data['any_text']) != 'undefined') { - $('#module').append ($('').html (data['any_text']).attr ("value", 0).attr('selected', true)); + $('#module').append ($('').html (data['any_text']).attr ("value", 0).prop('selected', true)); } else { var anyText = $("#any_text").html(); //Trick for catch the translate text. @@ -474,7 +474,7 @@ function agent_changed_by_multiple_agents_id (event, id_agent, selected) { anyText = 'Any'; } - $('#module').append ($('').html (anyText).attr ("value", 0).attr('selected', true)); + $('#module').append ($('').html (anyText).attr ("value", 0).prop('selected', true)); } } @@ -511,15 +511,15 @@ function period_select_init(name) { $('.' + name).val(300); if ($('#' + name + '_select option:eq(0)').val() == 0) { $('#' + name + '_select option:eq(2)') - .attr('selected', 'selected'); + .prop('selected', true); } else { $('#' + name + '_select option:eq(1)') - .attr('selected', 'selected'); + .prop('selected', true); } } else if ($('#text-' + name + '_text').val() == 0) { - $('#' + name + '_units option:last').removeAttr('selected'); + $('#' + name + '_units option:last').prop('selected', false); $('#' + name + '_manual').show(); $('#' + name + '_default').hide(); } @@ -595,10 +595,10 @@ function period_set_value(name, value) { */ function selectFirst(name) { if ($('#'+name+' option:eq(0)').val() == 0) { - $('#'+name+' option:eq(1)').attr('selected', 'selected'); + $('#'+name+' option:eq(1)').prop('selected', true); } else { - $('#'+name+' option:eq(0)').attr('selected', 'selected'); + $('#'+name+' option:eq(0)').prop('selected', true); } } @@ -666,7 +666,7 @@ function adjustTextUnits(name) { var restInt = parseInt(rest).toString(); if(rest != restInt && unitsSelected == false) { - $('#'+name+'_units option:eq('+($(this).index()-1)+')').attr('selected', true); + $('#'+name+'_units option:eq('+($(this).index()-1)+')').prop('selected', true); $('#text-'+name+'_text').val(restPrev); unitsSelected = true; } @@ -675,7 +675,7 @@ function adjustTextUnits(name) { }); if(unitsSelected == false) { - $('#'+name+'_units option:last').attr('selected', true); + $('#'+name+'_units option:last').prop('selected', true); $('#text-'+name+'_text').val(restPrev); } diff --git a/pandora_console/operation/events/events.php b/pandora_console/operation/events/events.php index bd79987ecf..cbb48185bf 100644 --- a/pandora_console/operation/events/events.php +++ b/pandora_console/operation/events/events.php @@ -780,7 +780,7 @@ function toggleCommentForm(id_event) { $('.event_form_' + id_event).css('display', 'none'); // Hide All showed rows $('.event_form').css('display', 'none'); - $(".select_validate").find('option:first').attr('selected', 'selected').parent('select'); + $(".select_validate").find('option:first').prop('selected', false).parent('select'); } else { $('.event_form_' + id_event).css('display', '');