mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-31 01:35:36 +02:00
a2013-10-14 Miguel de Dios <miguel.dedios@artica.es>
* operation/events/events.build_query.php, operation/events/events_list.php, operation/events/events.php: added the filter for events of group childrens of parent group selected. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@8911 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
ec1f12b9ea
commit
5adf9a17e4
@ -1,3 +1,9 @@
|
||||
2013-10-14 Miguel de Dios <miguel.dedios@artica.es>
|
||||
|
||||
* operation/events/events.build_query.php,
|
||||
operation/events/events_list.php, operation/events/events.php: added
|
||||
the filter for events of group childrens of parent group selected.
|
||||
|
||||
2013-10-14 Sergio Martin <sergio.martin@artica.es>
|
||||
|
||||
* include/functions_events.php
|
||||
|
@ -23,11 +23,25 @@ if ($id_group > 0 && in_array ($id_group, array_keys ($groups))) {
|
||||
$group_name = groups_get_name ($id_group);
|
||||
$sql_post = " AND group_name = '$group_name'";
|
||||
}
|
||||
else {
|
||||
if ($recursion) {
|
||||
$childrens_ids = array($id_group);
|
||||
|
||||
$childrens = groups_get_childrens($id_group);
|
||||
if (!empty($childrens)) {
|
||||
foreach ($childrens as $child) {
|
||||
$childrens_ids[] = $child['id_grupo'];
|
||||
}
|
||||
}
|
||||
|
||||
$sql_post = " AND id_grupo IN (" . implode(',', $childrens_ids) . ")";
|
||||
}
|
||||
else {
|
||||
//If a group is selected and it's in the groups allowed
|
||||
$sql_post = " AND id_grupo = $id_group";
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (is_user_admin ($id_user)) {
|
||||
//Do nothing if you're admin, you get full access
|
||||
|
@ -181,6 +181,14 @@ if (is_ajax ()) {
|
||||
|
||||
$offset = (int) get_parameter ("offset", 0);
|
||||
$id_group = (int) get_parameter('id_group', 0);//0 all
|
||||
//**********************************************************************
|
||||
// TODO
|
||||
// This code is disabled for to enabled in Pandora 5.1
|
||||
// but it needs a field in tevent_filter.
|
||||
//
|
||||
//$recursion = (bool)get_parameter('recursion', false); //Flag show in child groups
|
||||
//**********************************************************************
|
||||
$recursion = (bool)get_parameter('recursion', true); //Flag show in child groups
|
||||
$event_type = get_parameter ("event_type", ''); // 0 all
|
||||
$severity = (int) get_parameter ("severity", -1); // -1 all
|
||||
$status = (int) get_parameter ("status", 3); // -1 all, 0 only new, 1 only validated, 2 only in process, 3 only not validated,
|
||||
@ -225,6 +233,7 @@ $params = "search=" . rawurlencode(io_safe_input($search)) .
|
||||
"&severity=" . $severity .
|
||||
"&status=" . $status .
|
||||
"&id_group=" . $id_group .
|
||||
"&recursion=" . $recursion .
|
||||
"&refr=" . (int)get_parameter("refr", 0) .
|
||||
"&id_agent=" . $id_agent .
|
||||
"&pagination=" . $pagination .
|
||||
@ -238,7 +247,6 @@ $params = "search=" . rawurlencode(io_safe_input($search)) .
|
||||
"&toogle_filter=no" .
|
||||
"&filter_id=" . $filter_id .
|
||||
"&id_name=" . $id_name .
|
||||
"&id_group=" . $id_group .
|
||||
"&history=" . (int)$history .
|
||||
"&section=" . $section .
|
||||
"&open_filter=" . $open_filter .
|
||||
@ -520,7 +528,8 @@ $(document).ready( function() {
|
||||
}
|
||||
|
||||
jQuery.post ("<?php echo ui_get_full_url("ajax.php", false, false, false); ?>",
|
||||
{"page" : "operation/events/events",
|
||||
{
|
||||
"page" : "operation/events/events",
|
||||
"validate_event" : 1,
|
||||
"id" : id,
|
||||
"comment" : comment,
|
||||
@ -533,29 +542,35 @@ $(document).ready( function() {
|
||||
// Refresh interface elements, don't reload (awfull)
|
||||
// Validate
|
||||
if (select_validate == 1) {
|
||||
$("#status_img_"+id).attr ("src", "images/spinner.gif");
|
||||
$("#status_img_"+id)
|
||||
.attr ("src", "images/spinner.gif");
|
||||
// Change status description
|
||||
$("#status_row_"+id).html(<?php echo "'" . __('Event validated') . "'"; ?>);
|
||||
$("#status_row_"+id)
|
||||
.html(<?php echo "'" . __('Event validated') . "'"; ?>);
|
||||
|
||||
// Get event comment
|
||||
jQuery.post ("<?php echo ui_get_full_url("ajax.php", false, false, false); ?>",
|
||||
{"page" : "operation/events/events",
|
||||
{
|
||||
"page" : "operation/events/events",
|
||||
"get_comment" : 1,
|
||||
"id" : id
|
||||
},
|
||||
function (data, status) {
|
||||
$("#comment_row_"+id).html(data);
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
// Get event comment in header
|
||||
jQuery.post ("<?php echo ui_get_full_url("ajax.php", false, false, false); ?>",
|
||||
{"page" : "operation/events/events",
|
||||
{
|
||||
"page" : "operation/events/events",
|
||||
"get_comment_header" : 1,
|
||||
"id" : id
|
||||
},
|
||||
function (data, status) {
|
||||
$("#comment_header_"+id).html(data);
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
// Change state image
|
||||
$("#validate-"+id).css("display", "none");
|
||||
@ -597,23 +612,27 @@ $(document).ready( function() {
|
||||
|
||||
// Get event comment
|
||||
jQuery.post ("<?php echo ui_get_full_url("ajax.php", false, false, false); ?>",
|
||||
{"page" : "operation/events/events",
|
||||
{
|
||||
"page" : "operation/events/events",
|
||||
"get_comment" : 1,
|
||||
"id" : id
|
||||
},
|
||||
function (data, status) {
|
||||
$("#comment_row_"+id).html(data);
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
// Get event comment in header
|
||||
jQuery.post ("<?php echo ui_get_full_url("ajax.php", false, false, false); ?>",
|
||||
{"page" : "operation/events/events",
|
||||
{
|
||||
"page" : "operation/events/events",
|
||||
"get_comment_header" : 1,
|
||||
"id" : id
|
||||
},
|
||||
function (data, status) {
|
||||
$("#comment_header_"+id).html(data);
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
// Remove delete link (if event is not grouped and there is more than one event)
|
||||
if ($("#group_rep").val() == 1) {
|
||||
|
@ -413,12 +413,22 @@ $table->data = array();
|
||||
$data = array();
|
||||
$data[0] = __('Group') . '<br>';
|
||||
$data[0] .= html_print_select_groups($config["id_user"], "ER", true,
|
||||
'id_group', $id_group, '', '', 0, true, false, false, 'w130');
|
||||
'id_group', $id_group, '', '', 0, true, false, false, 'w130') . '<br>';
|
||||
//**********************************************************************
|
||||
// TODO
|
||||
// This code is disabled for to enabled in Pandora 5.1
|
||||
// but it needs a field in tevent_filter.
|
||||
//
|
||||
//$data[0] .= __('Group recursion') . ' ';
|
||||
//$data[0] .= html_print_checkbox ("recursion", 1, $recursion, true, false);
|
||||
//**********************************************************************
|
||||
|
||||
$data[1] = __('Event type') . '<br>';
|
||||
$types = get_event_types ();
|
||||
// Expand standard array to add not_normal (not exist in the array, used only for searches)
|
||||
$types["not_normal"] = __("Not normal");
|
||||
$data[1] .= html_print_select ($types, 'event_type', $event_type, '', __('All'), '', true);
|
||||
|
||||
$data[2] = __('Severity') . '<br>';
|
||||
$data[2] .= html_print_select (get_priorities (), "severity", $severity, '', __('All'), '-1', true, false, false);
|
||||
$table->data[] = $data;
|
||||
|
Loading…
x
Reference in New Issue
Block a user