fixed error in network component

This commit is contained in:
Daniel Barbero 2019-07-08 19:33:54 +02:00
parent b70c904ec3
commit 127f67f2ac
2 changed files with 19 additions and 18 deletions

View File

@ -1276,18 +1276,10 @@ if ($update_module || $create_module) {
$m_hide = $m['hide'];
}
if ($update_module) {
if ($m_hide == '1') {
$macros[$k]['value'] = io_input_password(get_parameter($m['macro'], ''));
} else {
$macros[$k]['value'] = get_parameter($m['macro'], '');
}
if ($m_hide == '1') {
$macros[$k]['value'] = io_input_password(get_parameter($m['macro'], ''));
} else {
if ($m_hide == '1') {
$macros[$k]['value'] = io_input_password($macros_names[$k]);
} else {
$macros[$k]['value'] = $macros_names[$k];
}
$macros[$k]['value'] = get_parameter($m['macro'], '');
}
}

View File

@ -536,7 +536,7 @@ function configure_modules_form() {
var obj = jQuery.parseJSON(data["macros"]);
$.each(obj, function(k, macro) {
add_macro_field(macro, "simple-macro", "td");
add_macro_field(macro, "simple-macro", "td", k);
});
}
@ -791,7 +791,7 @@ function new_macro(prefix, callback) {
}
}
function add_macro_field(macro, row_model_id, type_copy) {
function add_macro_field(macro, row_model_id, type_copy, k) {
var macro_desc = macro["desc"];
// Change the carriage returns by html returns <br> in help
var macro_help = macro["help"].replace(/&#x0d;/g, "<br>");
@ -799,7 +799,6 @@ function add_macro_field(macro, row_model_id, type_copy) {
var macro_value = $("<div />")
.html(macro["value"])
.text();
var macro_hide = macro["hide"];
macro_value.type = "password";
@ -809,6 +808,7 @@ function add_macro_field(macro, row_model_id, type_copy) {
// Change attributes to be unique and with identificable class
$macro_field.attr("id", row_id);
$macro_field.attr("class", "macro_field");
// Get the number of fields already printed
@ -828,6 +828,19 @@ function add_macro_field(macro, row_model_id, type_copy) {
);
}
// Only for create module type plugin need rename
// td id "simple-macro_field" + k + "-1" is horrible.
if (k) {
$("#" + row_model_id + "_field" + k + "_ td:eq(0)").attr(
"id",
"simple-macro_field" + k + "-0"
);
$("#" + row_model_id + "_field" + k + "_ td:eq(1)").attr(
"id",
"simple-macro_field" + k + "-1"
);
}
// Change the label
if (macro_help == "") {
$("#" + row_id)
@ -855,13 +868,11 @@ function add_macro_field(macro, row_model_id, type_copy) {
.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)
@ -893,14 +904,12 @@ function add_macro_field(macro, row_model_id, type_copy) {
.children()
.eq(1)
.children()
.eq(0)
.attr("type", "password");
} else {
$("#" + row_id)
.children()
.eq(1)
.children()
.eq(0)
.val(macro_value);
}
} else {