event history viewer

This commit is contained in:
fbsanchez 2019-06-19 12:56:16 +02:00
parent a7f9484adb
commit 524575171a
2 changed files with 45 additions and 34 deletions

View File

@ -2936,15 +2936,15 @@ function ui_print_datatable(array $parameters)
} }
if (!isset($parameters['order']['field'])) { if (!isset($parameters['order']['field'])) {
$order = 1; $order = 0;
} else { } else {
$order = array_search( $order = array_search(
$parameters['order']['field'], $parameters['order']['field'],
$parameters['columns'] $parameters['columns']
); );
if (empty($order)) { if ($order === false) {
$order = 1; $order = 0;
} }
} }

View File

@ -109,6 +109,8 @@ $date_to = get_parameter('filter[date_to]');
$source = get_parameter('filter[source]'); $source = get_parameter('filter[source]');
$id_extra = get_parameter('filter[id_extra]'); $id_extra = get_parameter('filter[id_extra]');
$user_comment = get_parameter('filter[user_comment]'); $user_comment = get_parameter('filter[user_comment]');
$history = get_parameter('history', false);
$section = get_parameter('section', false);
// Ajax responses. // Ajax responses.
if (is_ajax()) { if (is_ajax()) {
@ -155,7 +157,9 @@ if (is_ajax()) {
} }
$events = events_get_all( $events = events_get_all(
// Fields.
$fields, $fields,
// Filter.
$filter, $filter,
// Offset. // Offset.
$start, $start,
@ -164,7 +168,9 @@ if (is_ajax()) {
// Order. // Order.
$order['direction'], $order['direction'],
// Sort field. // Sort field.
$order['field'] $order['field'],
// History.
$history
); );
$count = events_get_all( $count = events_get_all(
'count', 'count',
@ -1227,7 +1233,10 @@ try {
'class' => 'info_table events', 'class' => 'info_table events',
'style' => 'width: 100%;', 'style' => 'width: 100%;',
'ajax_url' => 'operation/events/events', 'ajax_url' => 'operation/events/events',
'ajax_data' => ['get_events' => 1], 'ajax_data' => [
'get_events' => 1,
'history' => (int) $history,
],
'form' => [ 'form' => [
'id' => 'events_form', 'id' => 'events_form',
'class' => 'flex-row', 'class' => 'flex-row',
@ -1280,39 +1289,41 @@ try {
$sql_event_resp = "SELECT id, name FROM tevent_response WHERE type LIKE 'command'"; $sql_event_resp = "SELECT id, name FROM tevent_response WHERE type LIKE 'command'";
$event_responses = db_get_all_rows_sql($sql_event_resp); $event_responses = db_get_all_rows_sql($sql_event_resp);
if (check_acl($config['id_user'], 0, 'EW') == 1 && !$readonly) { if ($config['event_replication'] != 1) {
$array_events_actions['in_progress_selected'] = __('In progress selected'); if (check_acl($config['id_user'], 0, 'EW') == 1 && !$readonly) {
$array_events_actions['validate_selected'] = __('Validate selected'); $array_events_actions['in_progress_selected'] = __('In progress selected');
} $array_events_actions['validate_selected'] = __('Validate selected');
}
if (check_acl($config['id_user'], 0, 'EM') == 1 && !$readonly) { if (check_acl($config['id_user'], 0, 'EM') == 1 && !$readonly) {
$array_events_actions['delete_selected'] = __('Delete selected'); $array_events_actions['delete_selected'] = __('Delete selected');
}
} }
foreach ($event_responses as $val) { foreach ($event_responses as $val) {
$array_events_actions[$val['id']] = $val['name']; $array_events_actions[$val['id']] = $val['name'];
} }
if ($config['event_replication'] != 1) {
echo '<div class="multi-response-buttons">'; echo '<div class="multi-response-buttons">';
echo '<form method="post" id="form_event_response">'; echo '<form method="post" id="form_event_response">';
echo '<input type="hidden" id="max_execution_event_response" value="'.$config['max_execution_event_response'].'" />'; echo '<input type="hidden" id="max_execution_event_response" value="'.$config['max_execution_event_response'].'" />';
html_print_select($array_events_actions, 'response_id', '', '', '', 0, false, false, false); html_print_select($array_events_actions, 'response_id', '', '', '', 0, false, false, false);
echo '&nbsp&nbsp'; echo '&nbsp&nbsp';
html_print_button(__('Execute event response'), 'submit_event_response', false, 'execute_event_response(true);', 'class="sub next"'); html_print_button(__('Execute event response'), 'submit_event_response', false, 'execute_event_response(true);', 'class="sub next"');
echo "<span id='response_loading_dialog' style='display:none'>".html_print_image('images/spinner.gif', true).'</span>'; echo "<span id='response_loading_dialog' style='display:none'>".html_print_image('images/spinner.gif', true).'</span>';
echo '</form>'; echo '</form>';
echo '<span id="max_custom_event_resp_msg" style="display:none; color:#e63c52; line-height: 200%;">'; echo '<span id="max_custom_event_resp_msg" style="display:none; color:#e63c52; line-height: 200%;">';
echo __( echo __(
'A maximum of %s event custom responses can be selected', 'A maximum of %s event custom responses can be selected',
$config['max_execution_event_response'] $config['max_execution_event_response']
).'</span>'; ).'</span>';
echo '<span id="max_custom_selected" style="display:none; color:#e63c52; line-height: 200%;">'; echo '<span id="max_custom_selected" style="display:none; color:#e63c52; line-height: 200%;">';
echo __( echo __(
'Please, select an event' 'Please, select an event'
).'</span>'; ).'</span>';
echo '</div>'; echo '</div>';
}
// Close viewer. // Close viewer.
enterprise_hook('close_meta_frame'); enterprise_hook('close_meta_frame');
@ -1658,6 +1669,9 @@ function process_datatables_item(item) {
item.options += '<?php echo html_print_image('images/cross.png', true, ['title' => __('Delete event')]); ?></a>'; item.options += '<?php echo html_print_image('images/cross.png', true, ['title' => __('Delete event')]); ?></a>';
} }
} }
<?php
}
?>
// Multi select. // Multi select.
item.m = '<input name="checkbox-multi[]" type="checkbox" value="'; item.m = '<input name="checkbox-multi[]" type="checkbox" value="';
@ -1668,9 +1682,6 @@ function process_datatables_item(item) {
item.m += ' event_rep="0" '; item.m += ' event_rep="0" ';
} }
item.m += 'class="candeleted chk_val">'; item.m += 'class="candeleted chk_val">';
<?php
}
?>
/* Status */ /* Status */
img = '<?php echo html_print_image('images/star.png', true, ['title' => __('Unknown'), 'class' => 'forced-title']); ?>'; img = '<?php echo html_print_image('images/star.png', true, ['title' => __('Unknown'), 'class' => 'forced-title']); ?>';