show agent and module name tip

This commit is contained in:
alejandro.campos@artica.es 2022-01-31 15:43:56 +01:00
parent b9c78bbfb1
commit 2b6a9f0277
2 changed files with 18 additions and 10 deletions

View File

@ -88,6 +88,23 @@ function js_html_entity_decode(str) {
return str2;
}
function truncate_string(str, str_length, separator) {
if (str.length <= str_length) {
return str;
}
separator = separator || "...";
var separator_length = separator.length,
chars_to_show = str_length - separator_length,
front_chars = Math.ceil(chars_to_show / 2),
tail_chars = Math.floor(chars_to_show / 2);
return (
str.substr(0, front_chars) + separator + str.substr(str.length - tail_chars)
);
}
/**
* Function to search an element in an array.
*
@ -620,7 +637,7 @@ function module_changed_by_multiple_modules(event, id_module, selected) {
s = js_html_entity_decode(val);
$("#agents").append(
$("<option></option>")
.html(s)
.html(truncate_string(s, 30, "..."))
.attr({ value: i, title: s })
);
$("#agents").fadeIn("normal");

View File

@ -365,15 +365,6 @@ if (is_ajax()) {
'AW'
);
if ($truncate_agent_names === true) {
$names = array_map(
function ($name) {
return ui_print_truncate_text($name, 30);
},
$names
);
}
echo json_encode($names);
return;
}