From 6e7dfb38fd0482db0314b0cd230ee0f4173f0fc3 Mon Sep 17 00:00:00 2001 From: Daniel Barbero Date: Fri, 5 Jul 2019 13:46:48 +0200 Subject: [PATCH] fixed error network component plugin --- .../manage_network_components_form_plugin.php | 63 +++++++++++----- .../include/javascript/pandora_modules.js | 74 ++++++++++++++----- 2 files changed, 100 insertions(+), 37 deletions(-) diff --git a/pandora_console/godmode/modules/manage_network_components_form_plugin.php b/pandora_console/godmode/modules/manage_network_components_form_plugin.php index 19d3c45e8f..94ce00892e 100755 --- a/pandora_console/godmode/modules/manage_network_components_form_plugin.php +++ b/pandora_console/godmode/modules/manage_network_components_form_plugin.php @@ -1,17 +1,32 @@ rowstyle['macro_field'] = 'display:none'; push_table_row($data, 'macro_field'); -// If there are $macros, we create the form fields +// If there are $macros, we create the form fields. if (!empty($macros)) { $macros = json_decode($macros, true); @@ -68,9 +83,23 @@ if (!empty($macros)) { } if ($m['hide'] == 1) { - $data[1] = html_print_input_text($m['macro'], $m['value'], '', 100, 1024, true); + $data[1] = html_print_input_text( + $m['macro'], + io_output_password($m['value']), + '', + 100, + 1024, + true + ); } else { - $data[1] = html_print_input_text($m['macro'], io_output_password($m['value']), '', 100, 1024, true); + $data[1] = html_print_input_text( + $m['macro'], + $m['value'], + '', + 100, + 1024, + true + ); } $table->colspan['macro'.$m['macro']][1] = 3; diff --git a/pandora_console/include/javascript/pandora_modules.js b/pandora_console/include/javascript/pandora_modules.js index 049bb9e96b..1d5c804289 100644 --- a/pandora_console/include/javascript/pandora_modules.js +++ b/pandora_console/include/javascript/pandora_modules.js @@ -791,7 +791,7 @@ function new_macro(prefix, callback) { } } -function add_macro_field(macro, row_model_id) { +function add_macro_field(macro, row_model_id, type_copy) { var macro_desc = macro["desc"]; // Change the carriage returns by html returns
in help var macro_help = macro["help"].replace(/ /g, "
"); @@ -850,16 +850,31 @@ function add_macro_field(macro, row_model_id) { } // Change the text box id and value - $("#" + row_id) - .children() - .eq(1) - .attr("id", "text-" + macro_macro); - $("#" + row_id) - .children() - .eq(1) - .attr("name", macro_macro); + if (type_copy == "td") { + $("#" + row_id) + .children() + .eq(1) + .children() + .eq(0) + .attr("id", "text-" + macro_macro); + $("#" + row_id) + .children() + .eq(1) + .children() + .eq(0) + .attr("name", macro_macro); + } else { + $("#" + row_id) + .children() + .eq(1) + .attr("id", "text-" + macro_macro); + $("#" + row_id) + .children() + .eq(1) + .attr("name", macro_macro); + } - macro_field_hide = false; + var macro_field_hide = false; if (typeof macro["hide"] == "string") { if (macro["hide"].length == 0) { macro_field_hide = false; @@ -872,16 +887,35 @@ function add_macro_field(macro, row_model_id) { } } - if (macro_field_hide) { - $("#" + row_id) - .children() - .eq(1) - .attr("type", "password"); + if (type_copy == "td") { + if (macro_field_hide) { + $("#" + row_id) + .children() + .eq(1) + .children() + .eq(0) + .attr("type", "password"); + } else { + $("#" + row_id) + .children() + .eq(1) + .children() + .eq(0) + .val(macro_value); + } + } else { + if (macro_field_hide) { + $("#" + row_id) + .children() + .eq(1) + .attr("type", "password"); + } else { + $("#" + row_id) + .children() + .eq(1) + .val(macro_value); + } } - $("#" + row_id) - .children() - .eq(1) - .val(macro_value); $("#" + row_id).show(); } @@ -908,7 +942,7 @@ function load_plugin_macros_fields(row_model_id) { $("#hidden-macros").val(data["base64"]); jQuery.each(data["array"], function(i, macro) { if (macro["desc"] != "") { - add_macro_field(macro, row_model_id); + add_macro_field(macro, row_model_id, "td"); } }); //Plugin text can be larger