mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-04-08 18:55:09 +02:00
fixed error comments events
This commit is contained in:
parent
c600f74ee2
commit
a44e1feeb4
pandora_console
include
operation/events
@ -4615,7 +4615,7 @@ function events_page_comments($event, $ajax=false)
|
||||
foreach ($comm as $c) {
|
||||
$data[0] = '<b>'.$c['action'].' by '.$c['id_user'].'</b>';
|
||||
$data[0] .= '<br><br><i>'.date($config['date_format'], $c['utimestamp']).'</i>';
|
||||
$data[1] = $c['comment'];
|
||||
$data[1] = '<p style="word-break: break-word;">'.$c['comment'].'</p>';
|
||||
$table_comments->data[] = $data;
|
||||
}
|
||||
}
|
||||
|
@ -5622,7 +5622,7 @@ function ui_get_sorting_arrows($url_up, $url_down, $selectUp, $selectDown)
|
||||
|
||||
return '<span class="sort_arrow">
|
||||
<a href="'.$url_up.'">'.html_print_image($arrow_up, true, ['alt' => 'up']).'</a>
|
||||
<a href="'.$url_down.'">'.html_print_image($arrow_down, true, ['alt' => 'down']).'</a>
|
||||
<a href="'.$url_down.'">'.html_print_image($arrow_.down, true, ['alt' => 'down']).'</a>
|
||||
</span>';
|
||||
}
|
||||
|
||||
@ -5646,3 +5646,58 @@ function ui_print_breadcrums($tab_name)
|
||||
|
||||
return $section;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Show last comment
|
||||
*
|
||||
* @param array $comments array with comments
|
||||
*
|
||||
* @return string HTML string with the last comment of the events.
|
||||
*/
|
||||
function ui_print_comments($comments)
|
||||
{
|
||||
global $config;
|
||||
|
||||
$comments = explode('<br>', $comments);
|
||||
$comments = str_replace(["\n", '
'], '<br>', $comments);
|
||||
if (is_array($comments)) {
|
||||
foreach ($comments as $comm) {
|
||||
if (empty($comm)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$comments_array[] = json_decode(io_safe_output($comm), true);
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($comments_array as $comm) {
|
||||
// Show the comments more recent first.
|
||||
if (is_array($comm)) {
|
||||
$last_comment[] = array_reverse($comm);
|
||||
}
|
||||
}
|
||||
|
||||
// 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.
|
||||
// Else show comments hours ago
|
||||
$short_comment = substr($last_comment[0][0]['comment'], 0, '80px');
|
||||
if ($config['prominent_time'] == 'timestamp') {
|
||||
$comentario = '<i>'.date($config['date_format'], $last_comment[0][0]['utimestamp']).' ('.$last_comment[0][0]['id_user'].'): '.$last_comment[0][0]['comment'].'';
|
||||
|
||||
if (strlen($comentario) > '200px') {
|
||||
$comentario = '<i>'.date($config['date_format'], $last_comment[0][0]['utimestamp']).' ('.$last_comment[0][0]['id_user'].'): '.$short_comment.'...';
|
||||
}
|
||||
} else {
|
||||
$rest_time = (time() - $last_comment[0][0]['utimestamp']);
|
||||
$time_last = (($rest_time / 60) / 60);
|
||||
$comentario = '<i>'.number_format($time_last, 0).' Hours ('.$last_comment[0][0]['id_user'].'): '.$last_comment[0][0]['comment'].'';
|
||||
|
||||
if (strlen($comentario) > '200px') {
|
||||
$comentario = '<i>'.number_format($time_last, 0).' Hours ('.$last_comment[0][0]['id_user'].'): '.$short_comment.'...';
|
||||
}
|
||||
}
|
||||
|
||||
return io_safe_output($comentario);
|
||||
|
||||
}
|
||||
|
@ -63,6 +63,20 @@ function show_event_dialog(event, dialog_page, result) {
|
||||
height: 600
|
||||
})
|
||||
.show();
|
||||
$.post({
|
||||
url: "ajax.php",
|
||||
data: {
|
||||
page: "include/ajax/events",
|
||||
get_comments: 1,
|
||||
event: event,
|
||||
filter: values
|
||||
},
|
||||
dataType: "html",
|
||||
success: function(data) {
|
||||
$("#extended_event_comments_page").empty();
|
||||
$("#extended_event_comments_page").html(data);
|
||||
}
|
||||
});
|
||||
|
||||
$("#refrcounter").countdown("pause");
|
||||
$("div.vc-countdown").countdown("pause");
|
||||
|
@ -450,7 +450,7 @@ select:-internal-list-box {
|
||||
max-width: 120px;
|
||||
}
|
||||
.mw120px {
|
||||
min-width: 120px;
|
||||
min-width: 10%;
|
||||
}
|
||||
.mw180px {
|
||||
min-width: 180px;
|
||||
|
@ -297,6 +297,10 @@ if (is_ajax()) {
|
||||
$tmp->module_name = io_safe_output($tmp->module_name);
|
||||
}
|
||||
|
||||
if ($tmp->comments) {
|
||||
$tmp->comments = ui_print_comments($tmp->comments);
|
||||
}
|
||||
|
||||
$tmp->agent_name = io_safe_output($tmp->agent_name);
|
||||
$tmp->ack_utimestamp = ui_print_timestamp(
|
||||
$tmp->ack_utimestamp,
|
||||
@ -1600,6 +1604,17 @@ function process_datatables_callback(table, settings) {
|
||||
|
||||
function process_datatables_item(item) {
|
||||
|
||||
// Show comments events.
|
||||
item.user_comment = item.comments
|
||||
|
||||
if(item.comments.length > 80){
|
||||
|
||||
item.user_comment += ' <a id="show_comments" href="javascript:" onclick="show_event_dialog(\'';
|
||||
item.user_comment += item.b64+"','comments'," + $("#group_rep").val()+');">';
|
||||
item.user_comment += '<?php echo html_print_image('images/eye.png', true, ['title' => __('Show more')]); ?></a>';
|
||||
|
||||
}
|
||||
|
||||
// Grouped events.
|
||||
if(item.max_id_evento) {
|
||||
item.id_evento = item.max_id_evento
|
||||
|
Loading…
x
Reference in New Issue
Block a user