#12566 changes in events table

This commit is contained in:
Daniel Cebrian 2023-12-04 15:05:01 +01:00
parent 868598b1b2
commit ea474ecd89
2 changed files with 9 additions and 28 deletions

View File

@ -7170,32 +7170,21 @@ function ui_print_comments($comment, $truncate_limit=255)
} }
// Only show the last comment. If commment its too long,the comment will short with ... // Only show the last comment. If commment its too long,the comment will short with ...
// If $config['prominent_time'] is timestamp the date show Month, day, hour and minutes. // Forced time commentary to use copact date for optimize space in table.
// Else show comments hours ago // Else show comments hours ago
if ($comment['action'] != 'Added comment') { if ($comment['action'] != 'Added comment') {
$comment['comment'] = $comment['action']; $comment['comment'] = $comment['action'];
} }
$comment['comment'] = io_safe_output($comment['comment']);
$short_comment = substr($comment['comment'], 0, 20); $short_comment = substr($comment['comment'], 0, 20);
if ($config['prominent_time'] == 'timestamp') { $comentario = '<i>'.ui_print_timestamp($comment['utimestamp'], true, ['style' => 'font-size: 10px', 'prominent' => 'compact']).'&nbsp;('.$comment['id_user'].'):&nbsp;'.$comment['comment'].'';
$comentario = '<i>'.date($config['date_format'], $comment['utimestamp']).'&nbsp;('.$comment['id_user'].'):&nbsp;'.$comment['comment'].'';
if (strlen($comentario) > '200px' && $truncate_limit >= 255) { if (strlen($comentario) > '200px' && $truncate_limit >= 255) {
$comentario = '<i>'.date($config['date_format'], $comment['utimestamp']).'&nbsp;('.$comment['id_user'].'):&nbsp;'.$short_comment.'...'; $comentario = '<i>'.ui_print_timestamp($comment['utimestamp'], true, ['style' => 'font-size: 10px', 'prominent' => 'compact']).'&nbsp;('.$comment['id_user'].'):&nbsp;'.$short_comment.'...';
}
} else {
$rest_time = (time() - $comment['utimestamp']);
$time_last = (($rest_time / 60) / 60);
$comentario = '<i>'.number_format($time_last, 0, $config['decimal_separator'], ($config['thousand_separator'] ?? ',')).'&nbsp; Hours &nbsp;('.$comment['id_user'].'):&nbsp;'.$comment['comment'].'';
if (strlen($comentario) > '200px' && $truncate_limit >= 255) {
$comentario = '<i>'.number_format($time_last, 0, $config['decimal_separator'], ($config['thousand_separator'] ?? ',')).'&nbsp; Hours &nbsp;('.$comment['id_user'].'):&nbsp;'.$short_comment.'...';
}
} }
$comentario = io_safe_output($comentario);
if (strlen($comentario) >= $truncate_limit) { if (strlen($comentario) >= $truncate_limit) {
$comentario = ui_print_truncate_text( $comentario = ui_print_truncate_text(
$comentario, $comentario,

View File

@ -899,7 +899,7 @@ if (is_ajax() === true) {
true, true,
[ [
'title' => __('Unknown'), 'title' => __('Unknown'),
'class' => 'forced-title', 'class' => 'forced-title main_menu_icon',
] ]
); );
$state = 0; $state = 0;
@ -1199,10 +1199,10 @@ if (is_ajax() === true) {
} }
$tmp->custom_data = $custom_data_str; $tmp->custom_data = $custom_data_str;
if (strlen($tmp->custom_data) >= 20) { if (strlen($tmp->custom_data) >= 50) {
$tmp->custom_data = ui_print_truncate_text( $tmp->custom_data = ui_print_truncate_text(
$tmp->custom_data, $tmp->custom_data,
20, 50,
false, false,
true, true,
false, false,
@ -2595,14 +2595,6 @@ try {
} }
foreach ($fields as $key => $field) {
if (is_array($field) === false) {
$fields[$key] = [
'text' => $field,
'class' => 'mw100px',
];
}
}
// Always add options column. // Always add options column.
$fields = array_merge( $fields = array_merge(