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,19 +1276,11 @@ if ($update_module || $create_module) {
$m_hide = $m['hide']; $m_hide = $m['hide'];
} }
if ($update_module) {
if ($m_hide == '1') { if ($m_hide == '1') {
$macros[$k]['value'] = io_input_password(get_parameter($m['macro'], '')); $macros[$k]['value'] = io_input_password(get_parameter($m['macro'], ''));
} else { } else {
$macros[$k]['value'] = get_parameter($m['macro'], ''); $macros[$k]['value'] = 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 = io_json_mb_encode($macros); $macros = io_json_mb_encode($macros);

View File

@ -536,7 +536,7 @@ function configure_modules_form() {
var obj = jQuery.parseJSON(data["macros"]); var obj = jQuery.parseJSON(data["macros"]);
$.each(obj, function(k, macro) { $.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"]; var macro_desc = macro["desc"];
// Change the carriage returns by html returns <br> in help // Change the carriage returns by html returns <br> in help
var macro_help = macro["help"].replace(/&#x0d;/g, "<br>"); 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 />") var macro_value = $("<div />")
.html(macro["value"]) .html(macro["value"])
.text(); .text();
var macro_hide = macro["hide"];
macro_value.type = "password"; 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 // Change attributes to be unique and with identificable class
$macro_field.attr("id", row_id); $macro_field.attr("id", row_id);
$macro_field.attr("class", "macro_field"); $macro_field.attr("class", "macro_field");
// Get the number of fields already printed // 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 // Change the label
if (macro_help == "") { if (macro_help == "") {
$("#" + row_id) $("#" + row_id)
@ -855,13 +868,11 @@ function add_macro_field(macro, row_model_id, type_copy) {
.children() .children()
.eq(1) .eq(1)
.children() .children()
.eq(0)
.attr("id", "text-" + macro_macro); .attr("id", "text-" + macro_macro);
$("#" + row_id) $("#" + row_id)
.children() .children()
.eq(1) .eq(1)
.children() .children()
.eq(0)
.attr("name", macro_macro); .attr("name", macro_macro);
} else { } else {
$("#" + row_id) $("#" + row_id)
@ -893,14 +904,12 @@ function add_macro_field(macro, row_model_id, type_copy) {
.children() .children()
.eq(1) .eq(1)
.children() .children()
.eq(0)
.attr("type", "password"); .attr("type", "password");
} else { } else {
$("#" + row_id) $("#" + row_id)
.children() .children()
.eq(1) .eq(1)
.children() .children()
.eq(0)
.val(macro_value); .val(macro_value);
} }
} else { } else {