2010-09-24 Miguel de Dios <miguel.dedios@artica.es>

* include/functions_menu.php, operation/events/events_list.php: cleaned
	style source code.

	* operation/menu.php: added subentry in "View events" for "Sound Events".
	
	* operation/events/events_rss.php: added source code for the $id_agent equal
	-2 (this mean that get the agent by text name) and added new check for new
	status.
	
	* operation/events/events.php: added source code for the $id_agent equal -2
	(this mean that get the agent by text name).



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@3305 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
mdtrooper 2010-09-27 11:24:43 +00:00
parent e75e98a9f3
commit 054ba8e5d9
7 changed files with 138 additions and 14 deletions

View File

@ -1,3 +1,17 @@
2010-09-24 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_menu.php, operation/events/events_list.php: cleaned
style source code.
* operation/menu.php: added subentry in "View events" for "Sound Events".
* operation/events/events_rss.php: added source code for the $id_agent equal
-2 (this mean that get the agent by text name) and added new check for new
status.
* operation/events/events.php: added source code for the $id_agent equal -2
(this mean that get the agent by text name).
2010-09-27 Raúl Mateos <raulofpandora@gmail.com>
* godmode/agentes/modificar_agente.php: Vertical aligned some icons.

View File

@ -97,7 +97,8 @@ function print_menu (&$menu) {
$class = 'submenu_selected';
$selected = true;
$visible = true;
} elseif ($sec2 == $subsec2 && !isset ($sub[$subsec2]["options"])) {
}
elseif ($sec2 == $subsec2 && !isset ($sub[$subsec2]["options"])) {
$class = 'submenu_selected';
$selected = true;
@ -106,7 +107,8 @@ function print_menu (&$menu) {
$visible = true;
else
$visible = false;
} else {
}
else {
//Else it's not selected
$class = 'submenu_not_selected';
}
@ -118,11 +120,13 @@ function print_menu (&$menu) {
if (isset ($sub["type"]) && $sub["type"] == "direct") {
//This is an external link
$submenu_output .= '<li class="'.$class.'"><a href="'.$subsec2.'">'.$sub["text"]."</a></li>";
} else {
}
else {
//This is an internal link
if (isset ($sub[$subsec2]["options"])) {
$link_add = "&amp;".$sub[$subsec2]["options"]["name"]."=".$sub[$subsec2]["options"]["value"];
} else {
}
else {
$link_add = "";
}

View File

@ -159,7 +159,7 @@ $ev_group = (int) get_parameter ("ev_group", 0); //0 = all
$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,
$id_agent = (int) get_parameter ("id_agent", -2); //-1 all, 0 system
$id_agent = (int) get_parameter ("id_agent", -2); //-2 search by text, -1 all, 0 system
$id_event = (int) get_parameter ("id_event", -1);
$pagination = (int) get_parameter ("pagination", $config["block_size"]);
$event_view_hr = (int) get_parameter ("event_view_hr", $config["event_view_hr"]);
@ -168,6 +168,7 @@ $group_rep = (int) get_parameter ("group_rep", 0);
$delete = (bool) get_parameter ("delete");
$validate = (bool) get_parameter ("validate", 0);
$section = (string) get_parameter ("section", "list");
$text_agent = (string)get_parameter('text_agent', __("All"));
$search = preg_replace ("/&([A-Za-z]{0,4}\w{2,3};|#[0-9]{2,3};)/", "%", rawurldecode (get_parameter ("search")));
$groups = get_user_groups ($config["id_user"], "IR");
@ -181,21 +182,26 @@ $url = "index.php?sec=eventos&amp;sec2=operation/events/events&amp;search=" .
$id_agent . "&amp;id_event=" . $id_event . "&amp;pagination=" .
$pagination . "&amp;group_rep=" . $group_rep . "&amp;event_view_hr=" .
$event_view_hr . "&amp;id_user_ack=" . $id_user_ack;
// Header
if ($config["pure"] == 0) {
$pss = get_user_info($config['id_user']);
$hashup = md5($config['id_user'] . $pss['password']);
$buttons = array(
'fullscreen' => array('active' => false,
'text' => '<a href="'.$url.'&amp;pure=1">' .
print_image("images/fullscreen.png", true, array ("title" => __('Full screen'))) .'</a>'),
'rss' => array('active' => false,
'text' => '<a href="operation/events/events_rss.php?ev_group='.$ev_group.'&amp;event_type='.$event_type.'&amp;search='.rawurlencode ($search).'&amp;severity='.$severity.'&amp;status='.$status.'&amp;event_view_hr='.$event_view_hr.'&amp;id_agent='.$id_agent.'">' .
'text' => '<a href="operation/events/events_rss.php?user=' . $config['id_user'] . '&hashup=' . $hashup .
'&text_agent=' . $text_agent . '&ev_group='.$ev_group.'&amp;event_type='.$event_type.'&amp;search='.rawurlencode ($search).'&amp;severity='.$severity.'&amp;status='.$status.'&amp;event_view_hr='.$event_view_hr.'&amp;id_agent='.$id_agent.'">' .
print_image("images/rss.png", true, array ("title" => __('RSS Events'))) .'</a>'),
'marquee' => array('active' => false,
'text' => '<a href="operation/events/events_marquee.php">' .
print_image("images/heart.png", true, array ("title" => __('Marquee display'))) .'</a>'),
'csv' => array('active' => false,
'text' => '<a href="operation/events/export_csv.php?ev_group='.$ev_group.'&amp;event_type='.$event_type.'&amp;search='.rawurlencode ($search).'&amp;severity='.$severity.'&amp;status='.$status.'&amp;event_view_hr='.$event_view_hr.'&amp;id_agent='.$id_agent.'">' .
'text' => '<a href="operation/events/export_csv.php?ev_group=' . $ev_group .
'&text_agent=' . $text_agent . '&amp;event_type='.$event_type.'&amp;search='.rawurlencode ($search).'&amp;severity='.$severity.'&amp;status='.$status.'&amp;event_view_hr='.$event_view_hr.'&amp;id_agent='.$id_agent.'">' .
print_image("images/disk.png", true, array ("title" => __('Export to CSV file'))) .'</a>'),
'sound_event' => array('active' => false,
'text' => '<a href="javascript: openSoundEventWindow();">' . print_image('images/music_note.png', true, array('title' => __('Sound events'))) . '</a>')

View File

@ -29,7 +29,7 @@ if (! give_acl ($config["id_user"], 0, "IR")) {
return;
}
if($id_agent == -2) {
if ($id_agent == -2) {
$text_agent = (string) get_parameter("text_agent", __("All"));
switch ($text_agent)
@ -45,7 +45,7 @@ if($id_agent == -2) {
break;
}
}
else{
else {
switch ($id_agent)
{
case -1:
@ -252,7 +252,8 @@ $result = get_db_all_rows_sql ($sql);
if ($group_rep == 0) {
$sql = "SELECT COUNT(id_evento) FROM tevento WHERE 1=1 ".$sql_post;
} else {
}
else {
$sql = "SELECT COUNT(DISTINCT(evento)) FROM tevento WHERE 1=1 ".$sql_post;
}

View File

@ -24,8 +24,9 @@ require_once "../../include/functions_api.php";
$ipOrigin = $_SERVER['REMOTE_ADDR'];
// Uncoment this to activate ACL on RSS Events
if (!isInACL($ipOrigin))
if (!isInACL($ipOrigin)) {
exit;
}
// Check user credentials
$user = get_parameter('user');
@ -80,8 +81,20 @@ if ($event_view_hr > 0) {
}
if ($ev_group > 1)
$sql_post .= " AND `tevento`.`id_grupo` = $ev_group";
if ($status >= 0)
$sql_post .= " AND `tevento`.`estado` = ".$status;
switch($status) {
case 0:
case 1:
case 2:
$sql_post .= " AND `tevento`.`estado` = ".$status;
break;
case 3:
$sql_post .= " AND (`tevento`.`estado` = 0 OR `tevento`.`estado` = 2)";
break;
}
if ($search != "")
$sql_post .= " AND `tevento`.`evento` LIKE '%$search%'";
if ($event_type != ""){
@ -98,6 +111,42 @@ if ($event_type != ""){
}
if ($severity != -1)
$sql_post .= " AND `tevento`.`criticity` >= ".$severity;
if ($id_agent == -2) {
$text_agent = (string) get_parameter("text_agent", __("All"));
switch ($text_agent)
{
case __('All'):
$id_agent = -1;
break;
case __('Server'):
$id_agent = 0;
break;
default:
$id_agent = get_agent_id($text_agent);
break;
}
}
else {
switch ($id_agent)
{
case -1:
$text_agent = __('All');
break;
case 0:
$text_agent = __('Server');
break;
default:
$text_agent = get_agent_name($id_agent);
break;
}
}
if ($id_agent != -1)
$sql_post .= " AND `tevento`.`id_agente` = ".$id_agent;
if ($id_event != -1)

View File

@ -50,6 +50,39 @@ if (($event_type != "all") AND ($event_type != 0))
$filter['event_type'] = $event_type;
if ($severity != -1)
$filter[] = 'criticity >= '.$severity;
if ($id_agent == -2) {
$text_agent = (string) get_parameter("text_agent", __("All"));
switch ($text_agent)
{
case __('All'):
$id_agent = -1;
break;
case __('Server'):
$id_agent = 0;
break;
default:
$id_agent = get_agent_id($text_agent);
break;
}
}
else {
switch ($id_agent)
{
case -1:
$text_agent = __('All');
break;
case 0:
$text_agent = __('Server');
break;
default:
$text_agent = get_agent_name($id_agent);
break;
}
}
if ($id_agent != -1)
$filter['id_agente'] = $id_agent;

View File

@ -184,6 +184,23 @@ if (give_acl ($config['id_user'], 0, "AR")) {
$sub["operation/events/events_marquee.php"]["text"] = __('Marquee');
$sub["operation/events/events_marquee.php"]["type"] = "direct";
//Sound Events
$javascript = "javascript: window.open('operation/events/sound_events.php');";
$javascript = 'javascript: alert(111);';
$javascript = 'javascript: openSoundEventWindow();';
$sub[$javascript]["text"] = __('Sound Events');
$sub[$javascript]["type"] = "direct";
?>
<script type="text/javascript">
function openSoundEventWindow() {
url = '<?php echo 'http://' . $_SERVER['SERVER_NAME'] . $config['homeurl'] . '/operation/events/sound_events.php'; ?>';
window.open(url, '<?php __('Sound Alerts'); ?>','width=300, height=300, toolbar=no, location=no, directories=no, status=no, menubar=no');
}
</script>
<?php
$menu["eventos"]["sub"] = $sub;
}