From a097aabf801712464b99617db7ae04ca9d806dc2 Mon Sep 17 00:00:00 2001 From: Alejandro Gallardo Escobar Date: Tue, 14 Jul 2015 11:11:22 +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 718b04c674..5403d9aeb9 100644 --- a/pandora_console/godmode/agentes/agent_wizard.snmp_explorer.php +++ b/pandora_console/godmode/agentes/agent_wizard.snmp_explorer.php @@ -1060,7 +1060,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 e3aa54b61b..7682ab09d6 100644 --- a/pandora_console/godmode/agentes/agent_wizard.snmp_interfaces_explorer.php +++ b/pandora_console/godmode/agentes/agent_wizard.snmp_interfaces_explorer.php @@ -502,11 +502,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. @@ -515,7 +515,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 032f8110b9..cf0e332a2d 100644 --- a/pandora_console/godmode/agentes/agent_wizard.wmi_explorer.php +++ b/pandora_console/godmode/agentes/agent_wizard.wmi_explorer.php @@ -493,7 +493,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 623f862b2b..e05241a6d7 100644 --- a/pandora_console/godmode/agentes/module_manager_editor_common.php +++ b/pandora_console/godmode/agentes/module_manager_editor_common.php @@ -730,13 +730,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 8dd422b4e9..99fafcc3f5 100644 --- a/pandora_console/godmode/events/custom_events.php +++ b/pandora_console/godmode/events/custom_events.php @@ -231,7 +231,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 821a564e4e..baff6e1d40 100644 --- a/pandora_console/godmode/events/event_responses.editor.php +++ b/pandora_console/godmode/events/event_responses.editor.php @@ -156,7 +156,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 d68a6018f7..294f24ab22 100644 --- a/pandora_console/godmode/gis_maps/configure_gis_map.php +++ b/pandora_console/godmode/gis_maps/configure_gis_map.php @@ -571,7 +571,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 dc6d94e13c..a9d5178b4e 100755 --- a/pandora_console/godmode/massive/massive_copy_modules.php +++ b/pandora_console/godmode/massive/massive_copy_modules.php @@ -408,7 +408,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 8376708a0b..24e4b13288 100644 --- a/pandora_console/godmode/modules/manage_network_components_form.php +++ b/pandora_console/godmode/modules/manage_network_components_form.php @@ -469,13 +469,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 df5b537c5a..663de1f283 100755 --- a/pandora_console/godmode/reporting/visual_console_builder.editor.js +++ b/pandora_console/godmode/reporting/visual_console_builder.editor.js @@ -774,16 +774,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 ba9f41dfac..fb75d21d4e 100644 --- a/pandora_console/godmode/reporting/visual_console_builder.wizard.php +++ b/pandora_console/godmode/reporting/visual_console_builder.wizard.php @@ -384,7 +384,7 @@ $(document).ready (function () { .html(noneText) .attr("None", "") .attr('value', -1) - .attr('selected', true)); + .prop('selected', true)); } else { jQuery.each (data, function (i, val) { @@ -511,7 +511,7 @@ function item_per_agent_change(itemPerAgent) { $('#label_type') .append($('') .html() - .attr('value', 'agent').attr('selected', true)); + .attr('value', 'agent').prop('selected', true)); $('#label_type') .append($('') .html() @@ -539,7 +539,7 @@ function item_per_agent_change(itemPerAgent) { .append($('') .html() .attr('value', 'agent_module') - .attr('selected', true)); + .prop('selected', true)); $('#label_type') .append($('') .html() 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 51ea1fcfff..c63dc2df8d 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) { @@ -224,7 +224,7 @@ function agent_changed_by_multiple_agents (event, id_agent, selected) { .append ($('') .html(noneText) .attr ("None", "") - .attr('selected', true)); + .prop('selected', true)); return; } @@ -235,7 +235,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') { @@ -243,7 +243,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. @@ -256,7 +256,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) { @@ -322,11 +322,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. @@ -335,7 +335,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) { @@ -395,19 +395,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. @@ -417,7 +417,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) { @@ -462,11 +462,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. @@ -475,7 +475,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)); } } @@ -575,15 +575,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(); } @@ -658,10 +658,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); } } @@ -729,7 +729,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; } @@ -738,7 +738,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 e0e2b1b5a0..4c7d5d2f48 100644 --- a/pandora_console/operation/events/events.php +++ b/pandora_console/operation/events/events.php @@ -804,7 +804,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', true).parent('select'); } else { $('.event_form_' + id_event).css('display', '');