#10899 json_ucescaped_unicode to inventory manage and visual fix
This commit is contained in:
parent
aa9fefd30c
commit
f6be23c353
|
@ -75,7 +75,7 @@ if ($add_inventory_module) {
|
||||||
'interval' => $interval,
|
'interval' => $interval,
|
||||||
'username' => $username,
|
'username' => $username,
|
||||||
'password' => $password,
|
'password' => $password,
|
||||||
'custom_fields' => $custom_fields_enabled && !empty($custom_fields) ? base64_encode(json_encode(io_safe_output($custom_fields))) : '',
|
'custom_fields' => $custom_fields_enabled && !empty($custom_fields) ? base64_encode(json_encode(io_safe_output($custom_fields), JSON_UNESCAPED_UNICODE)) : '',
|
||||||
];
|
];
|
||||||
|
|
||||||
$result = db_process_sql_insert('tagent_module_inventory', $values);
|
$result = db_process_sql_insert('tagent_module_inventory', $values);
|
||||||
|
@ -119,7 +119,7 @@ if ($add_inventory_module) {
|
||||||
'interval' => $interval,
|
'interval' => $interval,
|
||||||
'username' => $username,
|
'username' => $username,
|
||||||
'password' => $password,
|
'password' => $password,
|
||||||
'custom_fields' => $custom_fields_enabled && !empty($custom_fields) ? base64_encode(json_encode(io_safe_output($custom_fields))) : '',
|
'custom_fields' => $custom_fields_enabled && !empty($custom_fields) ? base64_encode(json_encode(io_safe_output($custom_fields), JSON_UNESCAPED_UNICODE)) : '',
|
||||||
];
|
];
|
||||||
|
|
||||||
$result = db_process_sql_update('tagent_module_inventory', $values, ['id_agent_module_inventory' => $id_agent_module_inventory, 'id_agente' => $id_agente]);
|
$result = db_process_sql_update('tagent_module_inventory', $values, ['id_agent_module_inventory' => $id_agent_module_inventory, 'id_agente' => $id_agente]);
|
||||||
|
|
|
@ -2880,6 +2880,7 @@ function html_print_input_password(
|
||||||
$class='',
|
$class='',
|
||||||
$autocomplete='off',
|
$autocomplete='off',
|
||||||
$hide_div_eye=false,
|
$hide_div_eye=false,
|
||||||
|
$div_class=''
|
||||||
) {
|
) {
|
||||||
if ($maxlength == 0) {
|
if ($maxlength == 0) {
|
||||||
$maxlength = 255;
|
$maxlength = 255;
|
||||||
|
@ -2910,7 +2911,7 @@ function html_print_input_password(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return '<div class="relative container-div-input-password">'.html_print_input_text_extended($name, $value, 'password-'.$name, $alt, $size, $maxlength, $disabled, '', $attr, $return, true, '', $autocomplete, false, $hide_div_eye).'</div>';
|
return '<div class="relative container-div-input-password '.$div_class.'">'.html_print_input_text_extended($name, $value, 'password-'.$name, $alt, $size, $maxlength, $disabled, '', $attr, $return, true, '', $autocomplete, false, $hide_div_eye).'</div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -7537,59 +7537,45 @@ function ui_get_inventory_module_add_form(
|
||||||
$table->data['userpass-row'] = $row;
|
$table->data['userpass-row'] = $row;
|
||||||
|
|
||||||
$row = [];
|
$row = [];
|
||||||
$row['hidden-title'] = '';
|
|
||||||
$row['hidden-input'] = html_print_input_hidden('hidden-custom-field-name', '', true);
|
|
||||||
$row['hidden-input'] .= html_print_input_hidden('hidden-custom-field-is-secure', 0, true);
|
|
||||||
$row['hidden-input'] .= html_print_input_text(
|
|
||||||
'hidden-custom-field-input',
|
|
||||||
'',
|
|
||||||
'',
|
|
||||||
25,
|
|
||||||
40,
|
|
||||||
true,
|
|
||||||
false,
|
|
||||||
false,
|
|
||||||
'',
|
|
||||||
'w93p'
|
|
||||||
);
|
|
||||||
$row['hidden-input'] .= html_print_image(
|
|
||||||
'images/delete.svg',
|
|
||||||
true,
|
|
||||||
[
|
|
||||||
'border' => '0',
|
|
||||||
'title' => __('Remove'),
|
|
||||||
'style' => 'cursor: pointer;',
|
|
||||||
'class' => 'remove-custom-field invert_filter main_menu_icon',
|
|
||||||
]
|
|
||||||
);
|
|
||||||
|
|
||||||
$table->data['hidden-custom-field-row'] = $row;
|
$table->data['hidden-custom-field-row'] = html_print_label_input_block(
|
||||||
|
'',
|
||||||
|
'<div class="agent_details_agent_data">'.html_print_input_hidden(
|
||||||
|
'hidden-custom-field-name',
|
||||||
|
'',
|
||||||
|
true
|
||||||
|
).html_print_input_hidden(
|
||||||
|
'hidden-custom-field-is-secure',
|
||||||
|
0,
|
||||||
|
true
|
||||||
|
).html_print_input_text(
|
||||||
|
'hidden-custom-field-input',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
25,
|
||||||
|
40,
|
||||||
|
true,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
'',
|
||||||
|
'w100p'
|
||||||
|
).html_print_image(
|
||||||
|
'images/delete.svg',
|
||||||
|
true,
|
||||||
|
[
|
||||||
|
'border' => '0',
|
||||||
|
'title' => __('Remove'),
|
||||||
|
'style' => 'cursor: pointer;',
|
||||||
|
'class' => 'remove-custom-field invert_filter main_menu_icon',
|
||||||
|
]
|
||||||
|
).'</div>'
|
||||||
|
);
|
||||||
|
$table->colspan['hidden-custom-field-row'][0] = 2;
|
||||||
|
|
||||||
if ($custom_fields_enabled) {
|
if ($custom_fields_enabled) {
|
||||||
foreach ($custom_fields as $i => $field) {
|
foreach ($custom_fields as $i => $field) {
|
||||||
$row = [];
|
|
||||||
$row['title'] = '<b>'.$field['name'].'</b>';
|
|
||||||
$row['input'] = html_print_input_hidden(
|
|
||||||
'custom_fields['.$i.'][name]',
|
|
||||||
$field['name'],
|
|
||||||
true
|
|
||||||
);
|
|
||||||
$row['input'] .= html_print_input_hidden(
|
|
||||||
'custom_fields['.$i.'][secure]',
|
|
||||||
$field['secure'],
|
|
||||||
true
|
|
||||||
);
|
|
||||||
if ($field['secure']) {
|
if ($field['secure']) {
|
||||||
$row['input'] .= html_print_input_password(
|
$secure = html_print_input_password(
|
||||||
'custom_fields['.$i.'][value]',
|
|
||||||
$field['value'],
|
|
||||||
'',
|
|
||||||
25,
|
|
||||||
40,
|
|
||||||
true
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
$row['input'] .= html_print_input_text(
|
|
||||||
'custom_fields['.$i.'][value]',
|
'custom_fields['.$i.'][value]',
|
||||||
$field['value'],
|
$field['value'],
|
||||||
'',
|
'',
|
||||||
|
@ -7599,23 +7585,47 @@ function ui_get_inventory_module_add_form(
|
||||||
false,
|
false,
|
||||||
false,
|
false,
|
||||||
'',
|
'',
|
||||||
'w90p'
|
'off',
|
||||||
|
false,
|
||||||
|
'w100p'
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
$secure = html_print_input_text(
|
||||||
|
'custom_fields['.$i.'][value]',
|
||||||
|
$field['value'],
|
||||||
|
'',
|
||||||
|
false,
|
||||||
|
40,
|
||||||
|
true,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
'',
|
||||||
|
'w100p'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
$row['input'] .= '<span> </span>';
|
$table->colspan['custom-field-row-'.$i][0] = 2;
|
||||||
$row['input'] .= html_print_image(
|
$table->data['custom-field-row-'.$i] = html_print_label_input_block(
|
||||||
'images/delete.svg',
|
$field['name'],
|
||||||
true,
|
'<div class="agent_details_agent_data">'.html_print_input_hidden(
|
||||||
[
|
'custom_fields['.$i.'][name]',
|
||||||
'border' => '0',
|
$field['name'],
|
||||||
'title' => __('Remove'),
|
true
|
||||||
'style' => 'cursor: pointer;',
|
).html_print_input_hidden(
|
||||||
'class' => 'remove-custom-field invert_filter main_menu_icon',
|
'custom_fields['.$i.'][secure]',
|
||||||
]
|
$field['secure'],
|
||||||
|
true
|
||||||
|
).$secure.html_print_image(
|
||||||
|
'images/delete.svg',
|
||||||
|
true,
|
||||||
|
[
|
||||||
|
'border' => '0',
|
||||||
|
'title' => __('Remove'),
|
||||||
|
'style' => 'cursor: pointer;',
|
||||||
|
'class' => 'remove-custom-field invert_filter main_menu_icon',
|
||||||
|
]
|
||||||
|
).'</div>'
|
||||||
);
|
);
|
||||||
|
|
||||||
$table->data['custom-field-row-'.$i] = $row;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7684,38 +7694,40 @@ function ui_get_inventory_module_add_form(
|
||||||
}
|
}
|
||||||
|
|
||||||
function add_row_for_custom_field (fieldName, isSecure) {
|
function add_row_for_custom_field (fieldName, isSecure) {
|
||||||
var custom_fields_num = $("tr[id^=inventory-module-form-custom-field-row-]").length;
|
var custom_fields_num = $("tr[id^=inventory-module-form-custom-field-row-]").length+1;
|
||||||
$("#inventory-module-form-hidden-custom-field-row")
|
$("#inventory-module-form-hidden-custom-field-row")
|
||||||
.clone()
|
.clone()
|
||||||
.prop("id", "inventory-module-form-custom-field-row-" + custom_fields_num)
|
.prop("id", "inventory-module-form-custom-field-row-" + custom_fields_num)
|
||||||
.children("#inventory-module-form-hidden-custom-field-row-hidden-title")
|
.children("[id^='inventory-module-form-hidden-custom-field-row']") // go to TD
|
||||||
.prop("id", "inventory-module-form-custom-field-row-title-" + custom_fields_num)
|
.prop("id", "inventory-module-form-hidden-custom-field-row-"+ custom_fields_num)
|
||||||
.html("<b>" + fieldName + "</b>")
|
.children() // go to DIV
|
||||||
.parent()
|
.find('label')
|
||||||
.children("#inventory-module-form-hidden-custom-field-row-hidden-input")
|
.html(fieldName)
|
||||||
.prop("id", "inventory-module-form-custom-field-row-input-" + custom_fields_num)
|
.parent() // up to DIV padre
|
||||||
.prop("colspan", 2)
|
.find('div') //go to DIV no label
|
||||||
.children("input[name=hidden-custom-field-name]")
|
.children("[id^=hidden-hidden-custom-field-name]")
|
||||||
.prop("id", "custom-field-name-" + custom_fields_num)
|
.prop("id", "custom-field-name-" + custom_fields_num)
|
||||||
.prop("name", "custom_fields[" + custom_fields_num + "][name]")
|
.prop("name", "custom_fields[" + custom_fields_num + "][name]")
|
||||||
.val(fieldName)
|
.prop("value", fieldName)
|
||||||
.parent()
|
.parent()
|
||||||
.children("input[name=hidden-custom-field-is-secure]")
|
.children("input[name=hidden-custom-field-is-secure]")
|
||||||
.prop("id", "custom-field-is-secure-" + custom_fields_num)
|
.prop("id", "custom-field-is-secure-" + custom_fields_num)
|
||||||
.prop("name", "custom_fields[" + custom_fields_num + "][secure]")
|
.prop("name", "custom_fields[" + custom_fields_num + "][secure]")
|
||||||
.val(isSecure ? 1 : 0)
|
.val(isSecure ? 1 : 0)
|
||||||
.parent()
|
.parent()
|
||||||
.children("input[name=hidden-custom-field-input]")
|
.children("input[name=hidden-custom-field-input]")
|
||||||
.prop("id", "custom-field-input-" + custom_fields_num)
|
.prop("id", "custom-field-input-" + custom_fields_num)
|
||||||
.prop("type", isSecure ? "password" : "text")
|
.prop("type", isSecure ? "password" : "text")
|
||||||
.prop("name", "custom_fields[" + custom_fields_num + "][value]")
|
.prop("name", "custom_fields[" + custom_fields_num + "][value]")
|
||||||
.parent()
|
.parent()
|
||||||
.children("img.remove-custom-field")
|
.children("img.remove-custom-field")
|
||||||
.click(remove_custom_field)
|
.click(remove_custom_field)
|
||||||
.parent()
|
.parent()
|
||||||
.parent()
|
.parent()
|
||||||
.insertBefore($("#inventory-module-form-custom-fields-row"))
|
.parent() // up to TD
|
||||||
.show();
|
.parent() // up to TR
|
||||||
|
.insertBefore($("#inventory-module-form-custom-fields-row"))
|
||||||
|
.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
function add_custom_field () {
|
function add_custom_field () {
|
||||||
|
|
Loading…
Reference in New Issue