2009-01-26 Evi Vanoost <vanooste@rcbi.rochester.edu>

* include/styles/pandora.css: Fixed several small errors. Now it looks 
	more similar on other browsers.
	
	* operation/events/events.php: Fixed filter to use get_users ()
	
	* reporting/fgraph.php: Fixed several issues with user graphs

git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1403 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
guruevi 2009-01-26 16:48:22 +00:00
parent aa9fd78177
commit 45b05d670f
4 changed files with 110 additions and 189 deletions

View File

@ -1,3 +1,12 @@
2009-01-26 Evi Vanoost <vanooste@rcbi.rochester.edu>
* include/styles/pandora.css: Fixed several small errors. Now it looks
more similar on other browsers.
* operation/events/events.php: Fixed filter to use get_users ()
* reporting/fgraph.php: Fixed several issues with user graphs
2009-01-26 Esteban Sanchez <estebans@artica.es> 2009-01-26 Esteban Sanchez <estebans@artica.es>
* godmode/alerts/configure_alert_template.php: Decode HTML entities of * godmode/alerts/configure_alert_template.php: Decode HTML entities of

View File

@ -4,7 +4,7 @@
// Copyright (c) 2004-2008 Sancho Lerena, slerena@gmail.comnt // Copyright (c) 2004-2008 Sancho Lerena, slerena@gmail.comnt
// Copyright (c) 2004-2008 Raul Mateos Martin, raulofpandora@gmail.com // Copyright (c) 2004-2008 Raul Mateos Martin, raulofpandora@gmail.com
// Copyright (c) 2005-2008 Artica Soluciones Tecnologicas, info@artica.es // Copyright (c) 2005-2008 Artica Soluciones Tecnologicas, info@artica.es
// Copyright (c) 2008-2008 Evi Vanoost, vanooste@rcbi.rochester.edu // Copyright (c) 2008-2009 Evi Vanoost, vanooste@rcbi.rochester.edu
// This program is free software; you can redistribute it and/or // This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License // modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; version 2 // as published by the Free Software Foundation; version 2
@ -35,14 +35,13 @@ textarea {
} }
textarea.conf_editor { textarea.conf_editor {
padding: 5px; padding: 5px;
width: 650; width: 650px;
height: 350; height: 350px;
} }
input { input {
padding: 2px 3px 4px 3px; padding: 2px 3px 4px 3px;
} }
input.button { input.button {
margin: 0;
font-family: Arial,Sans-serif; font-family: Arial,Sans-serif;
border: 1px solid #ccc; border: 1px solid #ccc;
background: #fff; background: #fff;
@ -124,7 +123,7 @@ div#login {
border-left: solid 1px #000; border-left: solid 1px #000;
border-top: solid 1px #000; border-top: solid 1px #000;
border-bottom: solid 2px #000; border-bottom: solid 2px #000;
border-right: solid 2px #000 border-right: solid 2px #000;
} }
div#login_in, #login_f { div#login_in, #login_f {
margin: 0 auto; margin: 0 auto;
@ -245,7 +244,12 @@ input.sub {
font-weight: bold; font-weight: bold;
border-bottom-color: #708090; border-bottom-color: #708090;
border-right-color: #708090; border-right-color: #708090;
-moz-border-radius: 5%; /* These borders haven't made it yet in a valid standard
First one is for Mozilla, second for Webkit (Safari, Konqueror), third one for IE7+ and valid CSS3.
Percentage values are invalid here but .4em seems big enough */
-moz-border-radius: .4em;
-webkit-border-radius: .4em;
border-radius: .4em;
font-size: 8pt; font-size: 8pt;
background-color: #e5e5e5; background-color: #e5e5e5;
} }
@ -283,8 +287,9 @@ th {
color: #fff; color: #fff;
background-color: #786; background-color: #786;
} }
tr.datos, tr.datost, tr.datosb , tr.datos_id, tr.datosf9, tr.datos, tr.datost, tr.datosb , tr.datos_id,
tr.datos2, tr.datos2t, tr.datos2b, tr.datos2_id , tr.datos2f9, { tr.datosf9, tr.datos2, tr.datos2t,
tr.datos2b, tr.datos2_id , tr.datos2f9 {
background-color: #f9f9f9; background-color: #f9f9f9;
} }
tr.datos:hover, tr.datost:hover, tr.datosb:hover, tr.datos_id:hover, tr.datos:hover, tr.datost:hover, tr.datosb:hover, tr.datos_id:hover,
@ -723,7 +728,7 @@ a.big_data {
text-align: right; text-align: right;
} }
.top { .top {
vertical-align: top vertical-align: top;
margin-top: 0; margin-top: 0;
padding-top: 0; padding-top: 0;
} }
@ -736,7 +741,7 @@ span.actions {
margin-left: 30px; margin-left: 30px;
} }
code { code {
font-family: courier; font-family: courier, serif;
} }
select#template, select#action { select#template, select#action {
width: 250px; width: 250px;

View File

@ -197,7 +197,8 @@ echo "</td>";
echo "<tr>"; echo "<tr>";
echo "<td>".__('User ack.')."</td>"; echo "<td>".__('User ack.')."</td>";
echo "<td>"; echo "<td>";
print_select_from_sql ("SELECT id_usuario, nombre_real FROM tusuario", "id_user_ack", $id_user_ack,'', __('Any'), '0', false, false, true); $users = get_users ();
print_select ($users, "id_user_ack", $id_user_ack, '', __('Any'), 0);
echo "</td>"; echo "</td>";

View File

@ -1037,13 +1037,6 @@ function grafico_incidente_prioridad () {
$data[5] += 1; $data[5] += 1;
} }
$mayor = 0;
$mayor_data =0;
for ($i = 0;$i < sizeof($data); $i++)
if ($data[$i] > $mayor_data){
$mayor = $i;
$mayor_data = $data[$i];
}
$legend = array (__('Informative'), $legend = array (__('Informative'),
__('Low'), __('Low'),
__('Medium'), __('Medium'),
@ -1065,27 +1058,8 @@ function graphic_incident_group () {
$data[] = $row2[0]; $data[] = $row2[0];
$legend[] = get_group_name ($row[0])."(".$row2[0].")"; $legend[] = get_group_name ($row[0])."(".$row2[0].")";
} }
// Sort array by bubble method (yes, I study more methods in university, but if you want more speed, please, submit a patch :) array_multisort ($data, $legend);
// or much better, pay me to do a special version for you, highly optimized :-))))
for ($i = 0; $i < sizeof($data); $i++) {
for ($j = $i; $j <sizeof($data); $j++)
if ($data[$j] > $data[$i]) {
$temp = $data[$i];
$temp_label = $legend[$i];
$data[$i] = $data[$j];
$legend[$i] = $legend[$j];
$data[$j] = $temp;
$legend[$j] = $temp_label;
}
}
$mayor = 0;
$mayor_data =0;
for ($i = 0; $i < sizeof($data); $i++) {
if ($data[$i] > $mayor_data) {
$mayor = $i;
$mayor_data = $data[$i];
}
}
generic_pie_graph (320, 200, $data, $legend); generic_pie_graph (320, 200, $data, $legend);
} }
@ -1101,103 +1075,57 @@ function graphic_incident_user() {
$data[] = $row2[0]; $data[] = $row2[0];
$legend[] = $row[0]."(".$row2[0].")"; $legend[] = $row[0]."(".$row2[0].")";
} }
// Sort array by bubble method (yes, I study more methods in university, but if you want more speed, please, submit a patch :) array_multisort ($data, $legend);
// or much better, pay me to do a special version for you, highly optimized :-))))
for ($i = 0; $i < sizeof($data); $i++) {
for ($j = $i; $j <sizeof($data); $j++)
if ($data[$j] > $data[$i]) {
$temp = $data[$i];
$temp_label = $legend[$i];
$data[$i] = $data[$j];
$legend[$i] = $legend[$j];
$data[$j] = $temp;
$legend[$j] = $temp_label;
}
}
$mayor = 0;
$mayor_data =0;
for ($i = 0; $i < sizeof($data); $i++) {
if ($data[$i] > $mayor_data) {
$mayor = $i;
$mayor_data = $data[$i];
}
}
generic_pie_graph (320, 200, $data, $legend); generic_pie_graph (320, 200, $data, $legend);
} }
function graphic_user_activity ($width = 350, $height = 230) { function graphic_user_activity ($width = 350, $height = 230) {
$data = array(); $data = array();
$legend = array(); $legend = array();
$sql1="SELECT DISTINCT ID_usuario FROM tsesion "; $loop = 0;
$result=mysql_query($sql1); $sql = "SELECT COUNT(*) AS count, ID_usuario FROM tsesion GROUP BY ID_usuario ORDER BY count DESC";
while ($row=mysql_fetch_array($result)){ $result = get_db_all_rows_sql ($sql);
$entrada= entrada_limpia($row[0]); foreach ($result as $row) {
$sql1='SELECT COUNT(ID_usuario) FROM tsesion WHERE ID_usuario = "'.$entrada.'"'; if ($loop > 5) {
$result2=mysql_query($sql1); $data[5] += $row["count"];
$row2=mysql_fetch_array($result2); $legend[5] = __('Other')." (".$data[5].")";
$data[] = $row2[0]; } else {
$legend[] = str_pad(substr($row[0],0,16)."(".format_for_graph($row2[0],0).")", 15); if (empty ($row["ID_usuario"])) {
$row["ID_usuario"] = __('Unknown');
}
$data[] = $row["count"];
$legend[] = mb_substr ($row["ID_usuario"], 0, 14)." (".$row["count"].")";
}
$loop++;
} }
// Sort array by bubble method (yes, I study more methods in university, but if you want more speed, please, submit a patch :) array_multisort ($data, $legend);
// or much better, pay me to do a special version for you, highly optimized :-))))
for ($i = 0; $i < sizeof($data); $i++) {
for ($j = $i; $j <sizeof($data); $j++)
if ($data[$j] > $data[$i]) {
$temp = $data[$i];
$temp_label = $legend[$i];
$data[$i] = $data[$j];
$legend[$i] = $legend[$j];
$data[$j] = $temp;
$legend[$j] = $temp_label;
}
}
// Take only the first 5 items generic_pie_graph ($width, $height, $data, $legend);
if (sizeof($data) >= 5){
for ($i = 0; $i < 5; $i++) {
$legend2[]= $legend[$i];
$data2[] = $data[$i];
}
generic_pie_graph ($width, $height, $data2, $legend2);
} else
generic_pie_graph ($width, $height, $data, $legend);
} }
function graphic_incident_source ($width=320, $height=200) { function graphic_incident_source ($width=320, $height=200) {
$data = array(); $data = array();
$legend = array(); $legend = array();
$sql1="SELECT DISTINCT origen FROM tincidencia"; $loop = 0;
$result=mysql_query($sql1); $sql = "SELECT COUNT(*) as count, origen FROM tincidencia GROUP BY origen";
while ($row=mysql_fetch_array($result)){ $result = get_db_all_rows_sql ($sql);
$sql1="SELECT COUNT(id_incidencia) FROM tincidencia WHERE origen = '".$row[0]."'";
$result2=mysql_query($sql1); foreach ($result as $row) {
$row2=mysql_fetch_array($result2); if ($loop > 5) {
$data[] = $row2[0]; $data[5] += $row["count"];
$legend[] = $row[0]."(".$row2[0].")"; $legend[5] = __('Other')." (".$data[5].")";
} } else {
// Sort array by bubble method (yes, I study more methods in university, but if you want more speed, please, submit a patch :) $data[] = $row["count"];
// or much better, pay me to do a special version for you, highly optimized :-)))) $legend[] = mb_substr ($row["origen"], 0, 14)." (".$row["count"].")";
for ($i = 0; $i < sizeof($data); $i++) {
for ($j = $i; $j <sizeof($data); $j++)
if ($data[$j] > $data[$i]) {
$temp = $data[$i];
$temp_label = $legend[$i];
$data[$i] = $data[$j];
$legend[$i] = $legend[$j];
$data[$j] = $temp;
$legend[$j] = $temp_label;
}
}
// Take only the first 5 items
if (sizeof($data) >= 5){
for ($i = 0; $i < 5; $i++) {
$legend2[]= $legend[$i];
$data2[] = $data[$i];
} }
generic_pie_graph ($width, $height, $data2, $legend2); $loop++;
} else }
generic_pie_graph ($width, $height, $data, $legend);
array_multisort ($data, $legend);
generic_pie_graph ($width, $height, $data, $legend);
} }
function grafico_db_agentes_modulos($width, $height) { function grafico_db_agentes_modulos($width, $height) {
@ -1217,42 +1145,30 @@ function grafico_db_agentes_modulos($width, $height) {
generic_bar_graph ($width, $height, $data, array_keys ($data)); generic_bar_graph ($width, $height, $data, array_keys ($data));
} }
function grafico_eventos_usuario( $width=420, $height=200) { function grafico_eventos_usuario ( $width=420, $height=200) {
$data = array(); $data = array();
$legend = array(); $legend = array();
$sql1="SELECT * FROM tusuario"; $loop = 0;
$result=mysql_query($sql1);
while ($row=mysql_fetch_array($result)){ $sql = "SELECT COUNT(*) as count, id_usuario FROM tevento GROUP BY id_usuario";
$sql1="SELECT COUNT(id_evento) FROM tevento WHERE id_usuario = '".$row["id_usuario"]."'"; $result = get_db_all_rows_sql ($sql);
$result2=mysql_query($sql1);
$row2=mysql_fetch_array($result2); foreach ($result as $row) {
if ($row2[0] > 0){ if ($loop > 5) {
$data[] = $row2[0]; $data[5] += $row["count"];
$legend[] = $row["id_usuario"]." ( $row2[0] )"; $legend[5] = __('Other')." (".$data[5].")";
} } else {
} if (empty ($row["id_usuario"])) {
// Sort array by bubble method (yes, I study more methods in university, but if you want more speed, please, submit a patch :) $row["id_usuario"] = __('SYSTEM');
// or much better, pay me to do a special version for you, highly optimized :-))))
for ($i = 0; $i < sizeof($data); $i++) {
for ($j = $i; $j <sizeof($data); $j++)
if ($data[$j] > $data[$i]) {
$temp = $data[$i];
$temp_label = $legend[$i];
$data[$i] = $data[$j];
$legend[$i] = $legend[$j];
$data[$j] = $temp;
$legend[$j] = $temp_label;
} }
} $data[] = $row["count"];
// Take only the first 5 items $legend[] = mb_substr ($row["id_usuario"], 0, 14)." (".$row["count"].")";
if (sizeof($data) >= 5){
for ($i = 0; $i < 5; $i++) {
$legend2[]= $legend[$i];
$data2[] = $data[$i];
} }
generic_pie_graph ($width, $height, $data2, $legend2); $loop++;
} else }
generic_pie_graph ($width, $height, $data, $legend); array_multisort ($data, $legend);
generic_pie_graph ($width, $height, $data, $legend);
} }
function grafico_eventos_total ($filter = "") { function grafico_eventos_total ($filter = "") {
@ -1296,19 +1212,8 @@ function grafico_eventos_total ($filter = "") {
$total = $total + $row[0]; $total = $total + $row[0];
$legend[] = __('Critical')." ( $row[0] )"; $legend[] = __('Critical')." ( $row[0] )";
// Sort array by bubble method (yes, I study more methods in university, but if you want more speed, please, submit a patch :) array_multisort ($data, $legend);
// or much better, pay me to do a special version for you, highly optimized :-))))
for ($i = 0; $i < sizeof($data); $i++) {
for ($j = $i; $j <sizeof($data); $j++)
if ($data[$j] > $data[$i]){
$temp = $data[$i];
$temp_label = $legend[$i];
$data[$i] = $data[$j];
$legend[$i] = $legend[$j];
$data[$j] = $temp;
$legend[$j] = $temp_label;
}
}
generic_pie_graph (320, 200, $data, $legend); generic_pie_graph (320, 200, $data, $legend);
} }
@ -1350,9 +1255,10 @@ function graph_event_module ($width = 300, $height = 200, $id_agent) {
function grafico_eventos_grupo ($width = 300, $height = 200, $url = "") { function grafico_eventos_grupo ($width = 300, $height = 200, $url = "") {
global $config; global $config;
$url = html_entity_decode (rawurldecode ($url),ENT_QUOTES); //It was urlencoded, so we urldecode it $url = html_entity_decode (rawurldecode ($url), ENT_QUOTES); //It was urlencoded, so we urldecode it
$data = array(); $data = array();
$legend = array(); $legend = array();
$loop = 0;
$badstrings = array (";", "SELECT ", "DELETE ", "UPDATE ", "INSERT "); $badstrings = array (";", "SELECT ", "DELETE ", "UPDATE ", "INSERT ");
$url = str_ireplace ($badstrings,"",$url); //remove bad strings from the query so queries like ; DELETE FROM don't pass $url = str_ireplace ($badstrings,"",$url); //remove bad strings from the query so queries like ; DELETE FROM don't pass
@ -1362,26 +1268,26 @@ function grafico_eventos_grupo ($width = 300, $height = 200, $url = "") {
//is required if both DISTINCT() and COUNT() are in the statement //is required if both DISTINCT() and COUNT() are in the statement
$sql = "SELECT DISTINCT(id_agente) AS id_agente, id_grupo, COUNT(id_agente) AS count FROM tevento WHERE 1=1 ".$url." GROUP BY id_agente ORDER BY count DESC"; $sql = "SELECT DISTINCT(id_agente) AS id_agente, id_grupo, COUNT(id_agente) AS count FROM tevento WHERE 1=1 ".$url." GROUP BY id_agente ORDER BY count DESC";
$result = get_db_all_rows_sql ($sql); $result = get_db_all_rows_sql ($sql);
if ($result === false) if ($result === false) {
$result = array(); $result = array();
foreach ($result as $row) {
if (give_acl ($config["id_user"], $row["id_grupo"], "AR") == 1) {
$data[] = $row["count"];
if ($row["id_agente"] == 0) {
//System event
$legend[] = "SYSTEM (".$row["count"].")";
} else {
//Other events
$legend[] = substr (get_agent_name ($row["id_agente"], "lower"), 0, 15)." (".$row["count"].")";
}
}
} }
$max_items = 6; //Maximum items on the piegraph foreach ($result as $row) {
while (count($data) > $max_items) { if (!give_acl ($config["id_user"], $row["id_grupo"], "AR") == 1) {
//Pops an element off the array until the array is small enough continue;
array_pop ($data); }
if ($loop > 5) {
$data[5] += $row["count"];
$legend[5] = __('Other')." (".$data[5].")";
} else {
if ($row["id_agente"] == 0) {
$legend = __('SYSTEM')." (".$row["count"].")";
} else {
$legend[] = mb_substr (get_agent_name ($row["id_agente"], "lower"), 0, 14)." (".$row["count"].")";
}
$data[] = $row["count"];
}
$loop++;
} }
generic_pie_graph ($width, $height, $data, $legend); generic_pie_graph ($width, $height, $data, $legend);