#10676 increase chars in agents name in monitor view and truncate at the end
This commit is contained in:
parent
885ed9747b
commit
9cdc7273a6
|
@ -99,13 +99,18 @@ function ui_print_truncate_text(
|
|||
$forced_title=false
|
||||
) {
|
||||
global $config;
|
||||
|
||||
$truncate_at_end = false;
|
||||
if (is_string($numChars)) {
|
||||
switch ($numChars) {
|
||||
case 'agent_small':
|
||||
$numChars = $config['agent_size_text_small'];
|
||||
break;
|
||||
|
||||
case 'truncate_at_end':
|
||||
$numChars = 28;
|
||||
$truncate_at_end = true;
|
||||
break;
|
||||
|
||||
case 'agent_medium':
|
||||
$numChars = $config['agent_size_text_medium'];
|
||||
break;
|
||||
|
@ -147,6 +152,11 @@ function ui_print_truncate_text(
|
|||
// '/2' because [...] is in the middle of the word.
|
||||
$half_length = intval(($numChars - 3) / 2);
|
||||
|
||||
if ($truncate_at_end === true) {
|
||||
// Recover the html entities to avoid XSS attacks.
|
||||
$truncateText = ($text_has_entities) ? io_safe_input(substr($text_html_decoded, 0, $numChars)) : $text_html_decoded;
|
||||
$truncateText .= '...';
|
||||
} else {
|
||||
// Depending on the strange behavior of mb_strimwidth() itself,
|
||||
// the 3rd parameter is not to be $numChars but the length of
|
||||
// original text (just means 'large enough').
|
||||
|
@ -168,6 +178,7 @@ function ui_print_truncate_text(
|
|||
|
||||
// Recover the html entities to avoid XSS attacks.
|
||||
$truncateText = ($text_has_entities) ? io_safe_input($truncateText).$suffix.io_safe_input($truncateText2) : $truncateText.$suffix.$truncateText2;
|
||||
}
|
||||
|
||||
if ($showTextInTitle) {
|
||||
if ($style === null) {
|
||||
|
|
|
@ -1729,7 +1729,7 @@ if (empty($result) === false) {
|
|||
|
||||
$agent_alias = ui_print_truncate_text(
|
||||
$agent_alias,
|
||||
'agent_small',
|
||||
'truncate_at_end',
|
||||
false,
|
||||
true,
|
||||
true,
|
||||
|
@ -1743,7 +1743,7 @@ if (empty($result) === false) {
|
|||
}
|
||||
} else {
|
||||
$data[1] = '<strong><a href="index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$row['id_agent'].'">';
|
||||
$data[1] .= ui_print_truncate_text($agent_alias, 'agent_medium', false, true, false, '[…]', 'font-size:7.5pt;');
|
||||
$data[1] .= ui_print_truncate_text($agent_alias, 'agent_at_end', false, true, false, '[…]', 'font-size:7.5pt;');
|
||||
$data[1] .= '</a></strong>';
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue