2011-06-29 Ramon Novoa <rnovoa@artica.es>
* operation/events/events_list.php, operation/events/events.php: Improved event behaviour. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4500 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
0ad0450849
commit
a154c840fa
|
@ -162,7 +162,7 @@ $id_event = (int) get_parameter ("id_event", -1);
|
||||||
$pagination = (int) get_parameter ("pagination", $config["block_size"]);
|
$pagination = (int) get_parameter ("pagination", $config["block_size"]);
|
||||||
$event_view_hr = (int) get_parameter ("event_view_hr", $config["event_view_hr"]);
|
$event_view_hr = (int) get_parameter ("event_view_hr", $config["event_view_hr"]);
|
||||||
$id_user_ack = get_parameter ("id_user_ack", 0);
|
$id_user_ack = get_parameter ("id_user_ack", 0);
|
||||||
$group_rep = (int) get_parameter ("group_rep", 0);
|
$group_rep = (int) get_parameter ("group_rep", 1);
|
||||||
$delete = (bool) get_parameter ("delete");
|
$delete = (bool) get_parameter ("delete");
|
||||||
$validate = (bool) get_parameter ("validate", 0);
|
$validate = (bool) get_parameter ("validate", 0);
|
||||||
$section = (string) get_parameter ("section", "list");
|
$section = (string) get_parameter ("section", "list");
|
||||||
|
|
|
@ -272,17 +272,17 @@ if ($group_rep == 0) {
|
||||||
else {
|
else {
|
||||||
switch ($config["dbtype"]) {
|
switch ($config["dbtype"]) {
|
||||||
case "mysql":
|
case "mysql":
|
||||||
process_sql ('SET group_concat_max_len = 9999999');
|
db_process_sql ('SET group_concat_max_len = 9999999');
|
||||||
$sql = "SELECT *, GROUP_CONCAT(DISTINCT user_comment SEPARATOR '') AS user_comment,
|
$sql = "SELECT *, MAX(id_evento) AS id_evento, GROUP_CONCAT(DISTINCT user_comment SEPARATOR '') AS user_comment,
|
||||||
MAX(estado) AS estado, COUNT(*) AS event_rep, MAX(utimestamp) AS timestamp_rep
|
MIN(estado) AS min_estado, MAX(estado) AS max_estado, COUNT(*) AS event_rep, MAX(utimestamp) AS timestamp_rep
|
||||||
FROM tevento
|
FROM tevento
|
||||||
WHERE 1=1 ".$sql_post."
|
WHERE 1=1 ".$sql_post."
|
||||||
GROUP BY evento, id_agentmodule
|
GROUP BY evento, id_agentmodule
|
||||||
ORDER BY timestamp_rep DESC LIMIT ".$offset.",".$pagination;
|
ORDER BY timestamp_rep DESC LIMIT ".$offset.",".$pagination;
|
||||||
break;
|
break;
|
||||||
case "postgresql":
|
case "postgresql":
|
||||||
$sql = "SELECT *, array_to_string(array_agg(DISTINCT user_comment), '') AS user_comment,
|
$sql = "SELECT *, MAX(id_evento) AS id_evento, array_to_string(array_agg(DISTINCT user_comment), '') AS user_comment,
|
||||||
MAX(estado) AS estado, COUNT(*) AS event_rep, MAX(utimestamp) AS timestamp_rep
|
MIN(estado) AS min_estado, MAX(estado) AS max_estado, COUNT(*) AS event_rep, MAX(utimestamp) AS timestamp_rep
|
||||||
FROM tevento
|
FROM tevento
|
||||||
WHERE 1=1 ".$sql_post."
|
WHERE 1=1 ".$sql_post."
|
||||||
GROUP BY evento, id_agentmodule
|
GROUP BY evento, id_agentmodule
|
||||||
|
@ -294,16 +294,16 @@ else {
|
||||||
$set['offset'] = $offset;
|
$set['offset'] = $offset;
|
||||||
// TODO: Remove duplicate user comments
|
// TODO: Remove duplicate user comments
|
||||||
$sql = "SELECT a.*, b.event_rep, b.timestamp_rep
|
$sql = "SELECT a.*, b.event_rep, b.timestamp_rep
|
||||||
FROM (select * from tevento WHERE 1=1 ".$sql_post.") a,
|
FROM (SELECT * FROM tevento WHERE 1=1 ".$sql_post.") a,
|
||||||
(select min(id_evento) as id_evento, to_char(evento) as evento,
|
(SELECT MAX (id_evento) AS id_evento, to_char(evento) AS evento,
|
||||||
id_agentmodule, COUNT(*) AS event_rep, MAX(estado) AS estado,
|
id_agentmodule, COUNT(*) AS event_rep, MIN(estado) AS min_estado, MAX(estado) AS max_estado,
|
||||||
LISTAGG(user_comment, '') AS user_comment, MAX(utimestamp) AS timestamp_rep
|
LISTAGG(user_comment, '') AS user_comment, MAX(utimestamp) AS timestamp_rep
|
||||||
from tevento
|
FROM tevento
|
||||||
WHERE 1=1 ".$sql_post."
|
WHERE 1=1 ".$sql_post."
|
||||||
GROUP BY to_char(evento), id_agentmodule) b
|
GROUP BY to_char(evento), id_agentmodule) b
|
||||||
where a.id_evento=b.id_evento and
|
WHERE a.id_evento=b.id_evento AND
|
||||||
to_char(a.evento)=to_char(b.evento)
|
to_char(a.evento)=to_char(b.evento)
|
||||||
and a.id_agentmodule=b.id_agentmodule";
|
AND a.id_agentmodule=b.id_agentmodule";
|
||||||
$sql = oracle_recode_query ($sql, $set);
|
$sql = oracle_recode_query ($sql, $set);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -369,8 +369,23 @@ foreach ($result as $event) {
|
||||||
//First pass along the class of this row
|
//First pass along the class of this row
|
||||||
$table->rowclass[] = get_priority_class ($event["criticity"]);
|
$table->rowclass[] = get_priority_class ($event["criticity"]);
|
||||||
|
|
||||||
|
// Grouped events
|
||||||
|
if ($group_rep != 0) {
|
||||||
|
if ($event["max_estado"] == 2) {
|
||||||
|
$estado = 2;
|
||||||
|
} else if ($event["min_estado"] == 0) {
|
||||||
|
$estado = 0;
|
||||||
|
} else {
|
||||||
|
$estado = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Ungrouped events
|
||||||
|
else {
|
||||||
|
$estado = $event["estado"];
|
||||||
|
}
|
||||||
|
|
||||||
// Colored box
|
// Colored box
|
||||||
switch($event["estado"]) {
|
switch($estado) {
|
||||||
case 0:
|
case 0:
|
||||||
$img_st = "images/star.png";
|
$img_st = "images/star.png";
|
||||||
$title_st = __('New event');
|
$title_st = __('New event');
|
||||||
|
@ -482,12 +497,7 @@ foreach ($result as $event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
//Checkbox
|
//Checkbox
|
||||||
if($event["estado"] != 1) {
|
|
||||||
$data[5] = html_print_checkbox_extended ("eventid[]", $event["id_evento"], false, false, false, 'class="chk"', true);
|
$data[5] = html_print_checkbox_extended ("eventid[]", $event["id_evento"], false, false, false, 'class="chk"', true);
|
||||||
}
|
|
||||||
else {
|
|
||||||
$data[5] = '';
|
|
||||||
}
|
|
||||||
array_push ($table->data, $data);
|
array_push ($table->data, $data);
|
||||||
|
|
||||||
//Hiden row with description form
|
//Hiden row with description form
|
||||||
|
|
Loading…
Reference in New Issue