diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 709a69f603..9612928f0c 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,27 @@ +2013-05-30 Sergio Martin + + * include/styles/menu.css + include/styles/cluetip.css + include/styles/pandora.css + include/functions.php + include/functions_events.php + include/graphs/functions_gd.php + include/functions_networkmap.php + include/javascript/jquery.cluetip.js + images/outof.png: Visual improvements + + * include/functions_treeview.php + extensions/module_groups.php + operation/tree.php + operation/events/events.build_table.php + operation/events/events_list.php + operation/agentes/status_monitor.php : Add to the shared + views between normal and meta controls to access remote nodes + for certain users + + * include/functions_visual_map.php + include/functions_ui.php: Little bugfixes and improvements + 2013-05-30 Miguel de Dios * operation/agentes/networkmap.php: fixed the string of button to diff --git a/pandora_console/extensions/module_groups.php b/pandora_console/extensions/module_groups.php index a5b514eed5..bdd55a0fab 100644 --- a/pandora_console/extensions/module_groups.php +++ b/pandora_console/extensions/module_groups.php @@ -332,6 +332,6 @@ function mainModuleGroups() { diff --git a/pandora_console/images/outof.png b/pandora_console/images/outof.png index e808a2f66d..9daafbebc2 100644 Binary files a/pandora_console/images/outof.png and b/pandora_console/images/outof.png differ diff --git a/pandora_console/include/functions.php b/pandora_console/include/functions.php index 1eb1d79597..c430105316 100644 --- a/pandora_console/include/functions.php +++ b/pandora_console/include/functions.php @@ -1795,6 +1795,11 @@ function is_array_empty($InputVariable) return $Result; } +// This function is used to give or not access to nodes in +// Metaconsole. Sometimes is used in common code between +// Meta and normal console, so if Meta is not activated, it +// will return 1 always + // Return 0 if the user hasnt access to node/detail 1 otherwise function can_user_access_node () { global $config; @@ -1805,7 +1810,7 @@ function can_user_access_node () { return $userinfo["is_admin"] == 1 ? 1 : $userinfo["metaconsole_access_node"]; } else { - return $userinfo["is_admin"]; + return 1; } } ?> diff --git a/pandora_console/include/functions_events.php b/pandora_console/include/functions_events.php index 4012f2ecfd..a77ae369eb 100644 --- a/pandora_console/include/functions_events.php +++ b/pandora_console/include/functions_events.php @@ -17,6 +17,8 @@ include_once($config['homedir'] . "/include/functions_ui.php"); include_once($config['homedir'] . "/include/functions_tags.php"); enterprise_include_once ('meta/include/functions_events_meta.php'); +enterprise_include_once ('meta/include/functions_agents_meta.php'); +enterprise_include_once ('meta/include/functions_modules_meta.php'); @@ -1870,7 +1872,14 @@ function events_page_details ($event, $server = "") { } if ($event["id_agente"] != 0) { - $agent = db_get_row('tagente','id_agente',$event["id_agente"]); + if (!empty($server)) { + $agent = agents_meta_get_agent(array('id_agent' => $event["id_agente"], + 'id_server' => $server['id'], + 'server_name' => $server['server_name'])); + } + else { + $agent = db_get_row('tagente','id_agente',$event["id_agente"]); + } } else { $agent = array(); @@ -1884,7 +1893,12 @@ function events_page_details ($event, $server = "") { if (!empty($agent)) { $data = array(); $data[0] = '
'.__('Name').'
'; - $data[1] = ui_print_agent_name ($event["id_agente"], true, 'agent_medium', '', false, $serverstring, $hashstring); + if (can_user_access_node ()) { + $data[1] = ui_print_agent_name ($event["id_agente"], true, 'agent_medium', '', false, $serverstring, $hashstring, $agent['nombre']); + } + else { + $data[1] = ui_print_truncate_text($agent['nombre'], 'agent_medium', true, true, true); + } $table_details->data[] = $data; $data = array(); @@ -1914,7 +1928,12 @@ function events_page_details ($event, $server = "") { } if ($event["id_agentmodule"] != 0) { - $module = db_get_row_filter('tagente_modulo',array('id_agente_modulo' => $event["id_agentmodule"], 'delete_pending' => 0)); + if (!empty($server)) { + $module = meta_modules_get_agentmodule ($event["id_agentmodule"], $server['id']); + } + else { + $module = db_get_row_filter('tagente_modulo',array('id_agente_modulo' => $event["id_agentmodule"], 'delete_pending' => 0)); + } } else { $module = array(); @@ -1929,9 +1948,14 @@ function events_page_details ($event, $server = "") { // Module name $data = array(); $data[0] = '
'.__('Name').'
'; - $data[1] = ''; - $data[1] .= $module['nombre']; - $data[1] .= ''; + if (can_user_access_node ()) { + $data[1] = ''; + $data[1] .= $module['nombre']; + $data[1] .= ''; + } + else { + $data[1] = $module['nombre']; + } $table_details->data[] = $data; // Module group diff --git a/pandora_console/include/functions_networkmap.php b/pandora_console/include/functions_networkmap.php index e553115030..14db298a3a 100644 --- a/pandora_console/include/functions_networkmap.php +++ b/pandora_console/include/functions_networkmap.php @@ -521,6 +521,23 @@ function networkmap_create_agent_node ($agent, $simple = 0, $font_size = 10, $cu $status = agents_get_status_from_counts($agent); + if (defined('METACONSOLE')) { + $server_data = db_get_row('tmetaconsole_setup', 'id', $agent['id_server']); + } + + if(empty($server_data)) { + $server_name = ''; + $server_id = ''; + $url_hash = ''; + $console_url = ''; + } + else { + $server_name = $server_data['server_name']; + $server_id = $server_data['id']; + $console_url = $server_data['server_url'] . '/'; + $url_hash = metaconsole_get_servers_url_hash($server_data); + } + // Set node status switch ($status) { case 0: @@ -564,8 +581,13 @@ function networkmap_create_agent_node ($agent, $simple = 0, $font_size = 10, $cu } if (defined("METACONSOLE")) { - $url = ui_meta_get_url_console_child($id_server, - "estado", "operation/agentes/ver_agente&id_agente=" . $agent['id_agente']); + if (can_user_access_node ()) { + $url = ui_meta_get_url_console_child($id_server, + "estado", "operation/agentes/ver_agente&id_agente=" . $agent['id_agente']); + } + else { + $url = ''; + } $url_tooltip = '../../ajax.php?' . 'page=operation/agentes/ver_agente&' . 'get_agent_status_tooltip=1&' . @@ -584,7 +606,21 @@ function networkmap_create_agent_node ($agent, $simple = 0, $font_size = 10, $cu tooltip="' . $url_tooltip . '"];' . "\n"; } else { - $node = $agent['id_node'] . ' [ color="' . $status_color . '", fontsize='.$font_size.', shape="doublecircle", URL="index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$agent['id_agente'].'",style="filled", fixedsize=true, width=0.20, height=0.20, label="", tooltip="ajax.php?page=operation/agentes/ver_agente&get_agent_status_tooltip=1&id_agent='.$agent['id_agente'].'"];' . "\n"; + $ajax_prefix = ''; + $meta_params = ''; + + if (defined('METACONSOLE')) { + $ajax_prefix = '../../'; + $meta_params = '&metaconsole=1&id_server=' . $id_server; + } + + if (can_user_access_node ()) { + $url_node_link = ', URL="' . $console_url . 'index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=' . $agent['id_agente'] . $url_hash . '"'; + } + else { + $url_node_link = ''; + } + $node = $agent['id_node'] . ' [ color="' . $status_color . '", fontsize=' . $font_size . ', shape="doublecircle"' . $url_node_link . ', style="filled", fixedsize=true, width=0.20, height=0.20, label="", tooltip="' . $ajax_prefix . 'ajax.php?page=operation/agentes/ver_agente&get_agent_status_tooltip=1&id_agent=' . $agent['id_agente'] . $meta_params . '"];' . "\n"; } return $node; diff --git a/pandora_console/include/functions_treeview.php b/pandora_console/include/functions_treeview.php index 1e9bddd8c2..afcf918a1d 100755 --- a/pandora_console/include/functions_treeview.php +++ b/pandora_console/include/functions_treeview.php @@ -55,9 +55,10 @@ function treeview_printModuleTable($id_module, $server_data = false) { return; } - echo '
'; - echo ''; - //Agent name + echo '
'; + echo '
'; + + //Module name echo ''; if ($module["disabled"]) @@ -67,7 +68,29 @@ function treeview_printModuleTable($id_module, $server_data = false) { echo ''; - // Parent + // Interval + echo ''; + echo ''; + + // Warning Min/Max + echo ''; + if (modules_is_string_type($module['id_tipo_modulo'])) { + echo ''; + } + else { + echo ''; + } + + // Critical Min/Max + echo ''; + if (modules_is_string_type($module['id_tipo_modulo'])) { + echo ''; + } + else { + echo ''; + } + + // Module group echo ''; echo ''; - echo ''; - echo ''; - - // Group icon + // Description echo ''; - echo ''; + echo ''; + // Tags + $tags = tags_get_module_tags($module['id_agente_modulo']); + + if(empty($tags)) { + $tags = array(); + } + + foreach($tags as $k => $v) { + $tag_name = tags_get_name($v); + if(empty($tag_name)) { + unset($tags[$k]); + } + else { + $tags[$k] = $tag_name; + } + } + + if(empty($tags)) { + $tags = '' . __('N/A') . ''; + } + else { + $tags = implode(', ' , $tags); + } + + echo ''; + echo ''; + + // Data + $last_data = db_get_row_filter ('tagente_estado', array('id_agente_modulo' => $module['id_agente_modulo'], 'order' => array('field' => 'id_agente_estado', 'order' => 'DESC'))); + if (is_numeric($last_data["datos"])) + $data = "" . format_numeric($last_data["datos"]) . ""; + else + $data = "" . substr(io_safe_output($last_data['datos']),0,12) . ""; + + echo ''; + echo ''; + //End of table echo '
'.__('Module name').''.$cellName.'
' . __('Interval') . '' . human_time_description_raw (modules_get_interval($module['id_agente_modulo']), true) . '
' . __('Warning status') . '' . __('Str.') . ': ' . $module['str_warning'] . '
' . __('Min.') . ': ' . $module['min_warning'] . '
' . __('Max.') . ': ' . $module['max_warning'] . '
' . __('Critical status') . '' . __('Str.') . ': ' . $module['str_warning'] . '
' . __('Min.') . ': ' . $module['min_critical'] . '
' . __('Max.') . ': ' . $module['max_critical'] . '
'.__('Module group').''; $module_group = modules_get_modulegroup_name($module['id_module_group']); @@ -78,32 +101,79 @@ function treeview_printModuleTable($id_module, $server_data = false) { echo __("$module_group"); echo '
'.__('Module type').''; - echo servers_show_type ($module['id_modulo']); - echo '
'.__('Description').''. ui_print_truncate_text ($module['descripcion'], GENERIC_SIZE_TEXT, true, true, true, '[…]') .'
'. ui_print_truncate_text ($module['descripcion'], 'description', true, true, true, '[…]') .'
'.__('Tags').'' . $tags . '
'.__('Last data').''; + + if (!empty($last_data['utimestamp'])) { + echo $data; + + if ($module['unit'] != '') { + echo " "; + echo '('.$module['unit'].')'; + } + + echo " "; + html_print_image('images/clock2.png', false, array('title' => $last_data["timestamp"], 'width' => '18px')); + } + else { + echo '' . __('No data') . ''; + } + + echo '
'; - echo "
"; $id_group = agents_get_agent_group($module['id_agente']); $group_name = db_get_value('nombre', 'tgrupo', 'id_grupo', $id_group); $agent_name = db_get_value('nombre', 'tagente', 'id_agente', $module['id_agente']); - if (can_user_access_node ()) { + if (can_user_access_node () && check_acl ($config["id_user"], $id_group, 'AW')) { // Actions table - echo ''; - echo ''; - echo ''; + echo '
'; + echo '
'; + html_print_submit_button (__('Go to module edition'), 'upd_button', false, 'class="sub config"'); + echo ''; - echo '
'; - html_print_submit_button (__('Go to modules detail'), 'upd_button', false, 'class="sub search"'); - echo '
'; + echo ''; } //id_module and id_agent hidden @@ -135,18 +205,19 @@ function treeview_printAlertsTable($id_module, $server_data = array()) { $module_alerts = alerts_get_alerts_agent_module($id_module); $module_name = db_get_value('nombre', 'tagente_modulo', 'id_agente_modulo', $id_module); $agent_id = db_get_value('id_agente', 'tagente_modulo', 'id_agente_modulo', $id_module); - + $id_group = agents_get_agent_group($agent_id); + if ($module_alerts === false) { ui_print_error_message(__('There was a problem loading alerts')); return; } echo '
'; - echo ''; - echo ''; + echo '
' . html_print_image('images/bell.png', true) . ' ' . $module_name . '
'; + echo ''; - echo ''; - echo ''; + echo ''; + echo ''; foreach($module_alerts as $module_alert) { //Template name @@ -171,14 +242,13 @@ function treeview_printAlertsTable($id_module, $server_data = array()) { } echo '
' . $module_name . '
'.__('Template').''.__('Actions').'
'.__('Template').''.__('Actions').'
'; - if(can_user_access_node ()) { + if(can_user_access_node () && check_acl ($config["id_user"], $id_group, 'LW')) { // Actions table - echo ''; - echo ''; - echo ''; - echo '
'; - html_print_submit_button (__('Go to alerts detail'), 'upd_button', false, 'class="sub search"'); - echo '
'; + echo '
'; + echo '
'; + html_print_submit_button (__('Go to alerts edition'), 'upd_button', false, 'class="sub search"'); + echo '
'; + echo '
'; } } @@ -225,7 +295,7 @@ function treeview_printTable($id_agente, $server_data = array()) { } echo '
'; - echo ''; + echo '
'; //Agent name echo ''; if ($agent['disabled']) { @@ -262,43 +332,13 @@ function treeview_printTable($id_agente, $server_data = array()) { echo ''; // Comments - echo ''; - echo ''; + echo ''; + echo ''; - // Agent version - echo ''; - echo ''; - - // Position Information - if ($config['activate_gis']) { - $dataPositionAgent = gis_get_data_last_position_agent($agent['id_agente']); - - echo ''; - echo ''; - } - - // If the url description is setted - if ($agent['url_address'] != '') { - echo ''; - echo ''; - } // Last contact - echo ''; - // Timezone Offset - if ($agent['timezone_offset'] != 0) { - echo ''; - echo ''; - } // Next contact (agent) $progress = agents_get_next_contact($id_agente); echo ''; - echo ''; + echo ''; + + //End of table + echo '
'.__('Agent name').''.human_time_description_raw ($agent["intervalo"]).'
'.__('Description').''.$agent["comentarios"].'
' . __('Description') . '' . $agent["comentarios"] . '
'.__('Agent Version'). ''.$agent["agent_version"].'
'.__('Position (Long, Lat)'). ''; - - if ($dataPositionAgent === false) { - echo __('There is no GIS data.'); - } - else { - echo ''; - if ($dataPositionAgent['description'] != "") - echo $dataPositionAgent['description']; - else - echo $dataPositionAgent['stored_longitude'].', '.$dataPositionAgent['stored_latitude']; - echo ""; - } - - echo '
'.__('Url address').'' . $agent["url_address"] . '
'.__('Last contact')." / ".__('Remote').''; + echo '
' . __('Last contact') . " / " . __('Remote') . ''; + ui_print_timestamp ($agent["ultimo_contacto"]); echo " / "; @@ -307,20 +347,68 @@ function treeview_printTable($id_agente, $server_data = array()) { echo __('Never'); } else { - echo $agent["ultimo_contacto_remoto"]; + ui_print_timestamp ($agent["ultimo_contacto_remoto"]); } echo '
'.__('Timezone Offset'). ''.$agent["timezone_offset"].'
'.__('Next agent contact').'' . progress_bar($progress, 200, 20) . '
' . progress_bar($progress, 150, 20) . '
'; + + if (can_user_access_node () && check_acl ($config["id_user"], $agent["id_grupo"], "AW")) { + echo '
'; + echo '
'; + html_print_submit_button (__('Go to agent edition'), 'upd_button', false, 'class="sub config"'); + echo '
'; + echo '
'; + } + + // Advanced data + $advanced = '
'; + $advanced .= ''; + + // Agent version + $advanced .= ''; + $advanced .= ''; + + // Position Information + if ($config['activate_gis']) { + $dataPositionAgent = gis_get_data_last_position_agent($agent['id_agente']); + + $advanced .= ''; + $advanced .= ''; + } + + // If the url description is setted + if ($agent['url_address'] != '') { + $advanced .= ''; + $advanced .= ''; + } + + // Timezone Offset + if ($agent['timezone_offset'] != 0) { + $advanced .= ''; + $advanced .= ''; + } // Custom fields $fields = db_get_all_rows_filter('tagent_custom_fields', array('display_on_front' => 1)); @@ -329,44 +417,39 @@ function treeview_printTable($id_agente, $server_data = array()) { } if ($fields) { foreach ($fields as $field) { - echo ''; + $advanced .= ''; $custom_value = db_get_value_filter('description', 'tagent_custom_data', array('id_field' => $field['id_field'], 'id_agent' => $id_agente)); if ($custom_value === false || $custom_value == '') { $custom_value = '-'.__('empty').'-'; } - echo ''; + $advanced .= ''; } } - //End of table - echo '
'.__('Agent Version'). ''.$agent["agent_version"].'
'.__('Position (Long, Lat)'). ''; + + if ($dataPositionAgent === false) { + $advanced .= __('There is no GIS data.'); + } + else { + $advanced .= ''; + if ($dataPositionAgent['description'] != "") + $advanced .= $dataPositionAgent['description']; + else + $advanced .= $dataPositionAgent['stored_longitude'].', '.$dataPositionAgent['stored_latitude']; + $advanced .= ""; + } + + $advanced .= '
'.__('Url address').'' . $agent["url_address"] . '
'.__('Timezone Offset'). ''.$agent["timezone_offset"].'
'.$field['name'] . ui_print_help_tip (__('Custom field'), true).'
'.$field['name'] . ui_print_help_tip (__('Custom field'), true).''.$custom_value.'
'.$custom_value.'
'; + //End of table advanced + $advanced .= '

'; + + ui_toggle($advanced, __('Advanced information')); // Blank space below title, DONT remove this, this // Breaks the layout when Flash charts are enabled :-o - echo '
 
'; - - //Floating div - echo '
'; - + //echo '
 
'; + if ($config["agentaccess"]) { - echo ''.__('Agent access rate (24h)').'
'; + $access_graph = '
'; + $access_graph .= graphic_agentaccess($id_agente, 290, 110, 86400, true); + $access_graph .= '

'; + + ui_toggle($access_graph, __('Agent access rate (24h)')); + } + + $events_graph = '
'; + $events_graph .= graph_graphic_agentevents ($id_agente, 290, 15, 86400, '', true); + $events_graph .= '


'; + + ui_toggle($events_graph, __('Events (24h)')); - graphic_agentaccess($id_agente, 280, 110, 86400); - } - echo '
'; - graph_graphic_agentevents ($id_agente, 290, 15, 86400, ''); - - echo '
'; - - if (can_user_access_node ()) { - echo ''; - echo ''; - echo ''; - echo '
'; - html_print_submit_button (__('Go to agent detail'), 'upd_button', false, 'class="sub search"'); - echo '
'; - } return; } @@ -375,7 +458,7 @@ function treeview_printTree($type) { global $config; echo ''; - echo '
'; + echo '
'; if (! defined ('METACONSOLE')) { $list = treeview_getData ($type); @@ -890,7 +973,7 @@ function treeview_getData ($type) { $id = $item['id_grupo']; $list[$key]['_id_'] = $id; $list[$key]['_name_'] = $item['nombre']; - $list[$key]['_iconImg_'] = html_print_image ("images/groups_small/" . groups_get_icon($item['id_grupo']).".png", true, array ("style" => 'vertical-align: middle; width: 16px; height: 16px;')); + $list[$key]['_iconImg_'] = html_print_image ("images/groups_small/" . groups_get_icon($item['id_grupo']).".png", true, array ("style" => 'vertical-align: middle;')); $list[$key]['_num_ok_'] = groups_agent_ok($id); $list[$key]['_num_critical_'] = groups_agent_critical($id); $list[$key]['_num_warning_'] = groups_agent_warning($id); @@ -932,7 +1015,7 @@ function treeview_getData ($type) { $id = db_get_value('id_tag', 'ttag', 'name', $item['name']); $list[$key]['_id_'] = $id; $list[$key]['_name_'] = $item['name']; - $list[$key]['_iconImg_'] = html_print_image ("images/tag_red.png", true, array ("style" => 'vertical-align: middle; width: 16px; height: 16px;')); + $list[$key]['_iconImg_'] = html_print_image ("images/tag_red.png", true, array ("style" => 'vertical-align: middle;')); $list[$key]['_num_ok_'] = tags_agent_ok($id); $list[$key]['_num_critical_'] = tags_agent_critical($id); $list[$key]['_num_warning_'] = tags_agent_warning($id); diff --git a/pandora_console/include/functions_ui.php b/pandora_console/include/functions_ui.php index 35385192b6..aecb36c277 100644 --- a/pandora_console/include/functions_ui.php +++ b/pandora_console/include/functions_ui.php @@ -621,11 +621,18 @@ function ui_print_os_icon ($id_os, $name = true, $return = false, $apply_skin = * @param string Style of name in css. * @param string server url to concatenate at the begin of the link * @param string extra parameters to concatenate in the link + * @param string name of the agent to avoid the query in some cases * * @return string HTML with agent name and link */ -function ui_print_agent_name ($id_agent, $return = false, $cutoff = 'agent_medium', $style = '', $cutname = false, $server_url = '', $extra_params = '') { - $agent_name = (string) agents_get_name ($id_agent); +function ui_print_agent_name ($id_agent, $return = false, $cutoff = 'agent_medium', $style = '', $cutname = false, $server_url = '', $extra_params = '', $known_agent_name = false) { + if($known_agent_name === false) { + $agent_name = (string) agents_get_name ($id_agent); + } + else { + $agent_name = $known_agent_name; + } + $agent_name_full = $agent_name; if ($cutname) { $agent_name = ui_print_truncate_text($agent_name, $cutoff, true, true, true, '[…]', $style); @@ -659,9 +666,22 @@ function ui_print_agent_name ($id_agent, $return = false, $cutoff = 'agent_mediu * @return array A formatted array with proper html for use in $table->data (6 columns) */ function ui_format_alert_row ($alert, $agent = true, $url = '', $agent_style = false) { - global $config; + if(!isset($alert['server_data'])) { + $server_name = ''; + $server_id = ''; + $url_hash = ''; + $console_url = ''; + } + else { + $server_data = $alert['server_data']; + $server_name = $server_data['server_name']; + $server_id = $server_data['id']; + $console_url = $server_data['server_url'] . '/'; + $url_hash = metaconsole_get_servers_url_hash($server_data); + } + $actionText = ""; require_once ($config['homedir'] . "/include/functions_alerts.php"); $isFunctionPolicies = enterprise_include_once ('include/functions_policies.php'); @@ -759,16 +779,21 @@ function ui_format_alert_row ($alert, $agent = true, $url = '', $agent_style = f } else { if (defined('METACONSOLE')) { - $data[$index['agent_name']] .= $alert['agent_name']; + $agent_name = $alert['agent_name']; + $id_agent = $alert['id_agent']; } else { - if ($agent_style !== false) { - $data[$index['agent_name']] .= ui_print_agent_name (modules_get_agentmodule_agent ($alert["id_agent_module"]), true, 20, $styleDisabled . " $agent_style"); - } - else { - $data[$index['agent_name']] .= ui_print_agent_name (modules_get_agentmodule_agent ($alert["id_agent_module"]), true, 20, $styleDisabled); - } + $agent_name = false; + $id_agent = modules_get_agentmodule_agent ($alert["id_agent_module"]); } + + if ($agent_style !== false) { + $data[$index['agent_name']] .= ui_print_agent_name ($id_agent, true, 'agent_medium', $styleDisabled . " $agent_style", false, $console_url, $url_hash, $agent_name); + } + else { + $data[$index['agent_name']] .= ui_print_agent_name ($id_agent, true, 'agent_medium', $styleDisabled, false, $console_url, $url_hash); + } + $data[$index['module_name']] = ui_print_truncate_text (isset($alert['agent_module_name']) ? $alert['agent_module_name'] : modules_get_agentmodule_name ($alert["id_agent_module"]), 'module_small', false, true, true, '[…]', 'font-size: 7.2pt'); } @@ -778,7 +803,7 @@ function ui_format_alert_row ($alert, $agent = true, $url = '', $agent_style = f $data[$index['description']] = ''; if (defined('METACONSOLE')) { - $data[$index['template']] .= ''; + $data[$index['template']] .= ''; } else { $data[$index['template']] .= ''; diff --git a/pandora_console/include/functions_visual_map.php b/pandora_console/include/functions_visual_map.php index ffe873b3db..fb91864a24 100644 --- a/pandora_console/include/functions_visual_map.php +++ b/pandora_console/include/functions_visual_map.php @@ -961,17 +961,17 @@ function visual_map_print_visual_map ($id_layout, $show_links = true, $draw_line switch ($status_parent) { default: case VISUAL_MAP_STATUS_UNKNOW: - $line["color"] = "#ccc"; // Gray + $line["color"] = COL_UNKNOWN; // Gray break; case VISUAL_MAP_STATUS_WARNING: - $line["color"] = "#20f6f6"; // Yellow + $line["color"] = COL_WARNING; // Yellow break; case VISUAL_MAP_STATUS_NORMAL: - $line["color"] = "#00ff00"; // Green + $line["color"] = COL_NORMAL; // Green break; case VISUAL_MAP_STATUS_CRITICAL_ALERT: case VISUAL_MAP_STATUS_CRITICAL_BAD: - $line["color"] = "#ff0000"; // Red + $line["color"] = COL_CRITICAL; // Red break; } array_push ($lines, $line); @@ -988,24 +988,24 @@ function visual_map_print_visual_map ($id_layout, $show_links = true, $draw_line switch ($status) { case VISUAL_MAP_STATUS_CRITICAL_BAD: //Critical (BAD) - $colorStatus = "#ff0000"; + $colorStatus = COL_CRITICAL; break; case VISUAL_MAP_STATUS_CRITICAL_ALERT: //Critical (ALERT) - $colorStatus = "#ff8800"; + $colorStatus = COL_ALERTFIRED; break; case VISUAL_MAP_STATUS_NORMAL: //Normal (OK) - $colorStatus = "#00ff00"; + $colorStatus = COL_NORMAL; break; case VISUAL_MAP_STATUS_WARNING: //Warning - $colorStatus = "#ffff00"; + $colorStatus = COL_WARNING; break; case VISUAL_MAP_STATUS_UNKNOW: default: //Unknown - $colorStatus = "#5A5AFF"; + $colorStatus = COL_UNKNOWN; // Default is Grey (Other) break; } @@ -1660,7 +1660,7 @@ function visual_map_print_visual_map ($id_layout, $show_links = true, $draw_line // resulting fault image links :( echo grafico_modulo_sparse ($layout_data['id_agente_modulo'], $layout_data['period'], false, $layout_data['width'], $layout_data['height'], - '', null, false, 1, false, 0, '', 0, 0, true, true, $home_url, 2); + '', null, false, 1, false, 0, '', 0, 0, true, true, $home_url, 1); //Restore db connection if ($layout_data['id_metaconsole'] != 0) { diff --git a/pandora_console/include/graphs/functions_gd.php b/pandora_console/include/graphs/functions_gd.php index c37ca76ba6..98fda86e70 100755 --- a/pandora_console/include/graphs/functions_gd.php +++ b/pandora_console/include/graphs/functions_gd.php @@ -162,7 +162,7 @@ function gd_histogram ($width, $height, $mode, $data, $max_value, $font, $title, // *************************************************************************** function gd_progress_bubble ($width, $height, $progress, $title, $font, $out_of_lim_str, $out_of_lim_image, $mode = 1, $fontsize=10, $value_text = '', $colorRGB = '') { if($out_of_lim_str === false) { - $out_of_lim_str = "Out of limits"; + $out_of_lim_str = __("Out of limits"); } if($out_of_lim_image === false) { @@ -273,7 +273,7 @@ function gd_progress_bar ($width, $height, $progress, $title, $font, $out_of_lim function drawRating($rating, $width, $height, $font, $out_of_lim_str, $mode, $fontsize, $value_text, $color) { global $config; global $REMOTE_ADDR; - + // Round corners defined in global setup if ($config["round_corner"] != 0) { $radius = ($height > 18) ? 8 : 0; @@ -367,7 +367,7 @@ function gd_progress_bar ($width, $height, $progress, $title, $font, $out_of_lim if ($rating > 50) if ($rating > 100) - ImageTTFText($image, $fontsize, 0, ($width/4), ($height/2)+($height/5), $back, $font, $out_of_lim_str); + ImageTTFText($image, $fontsize + 2, 0, ($width/4), ($height/2)+($height/5), $back, $font, $out_of_lim_str); else ImageTTFText($image, $fontsize, 0, ($width/2)-($width/10), ($height/2)+($height/5), $back, $font, $value_text); else @@ -430,7 +430,8 @@ function gd_progress_bar ($width, $height, $progress, $title, $font, $out_of_lim drawRating($progress, $width, $height, $font, $out_of_lim_str, $mode, $fontsize, $value_text, $color); break; case 1: - if ($progress > 100 || $progress < 0) { + /* + if (($progress > 100 || $progress < 0) && false) { // HACK: This report a static image... will increase render in about 200% :-) useful for // high number of realtime statusbar images creation (in main all agents view, for example $imgPng = imageCreateFromPng($out_of_lim_image); @@ -441,6 +442,10 @@ function gd_progress_bar ($width, $height, $progress, $title, $font, $out_of_lim else { drawRating($progress, $width, $height, $font, $out_of_lim_str, $mode, 6, $value_text, $color); } + */ + + drawRating($progress, $width, $height, $font, $out_of_lim_str, $mode, 6, $value_text, $color); + break; case 2: if ($progress > 100 || $progress < 0) { diff --git a/pandora_console/include/javascript/jquery.cluetip.js b/pandora_console/include/javascript/jquery.cluetip.js index c8a18b4368..ffbfd32d07 100644 --- a/pandora_console/include/javascript/jquery.cluetip.js +++ b/pandora_console/include/javascript/jquery.cluetip.js @@ -24,7 +24,7 @@ var pY=posX<0?event.pageY+tOffset:event.pageY;$cluetip.css({left:(posX>0&&opts.p wHeight=$(window).height();if(js){$cluetipInner.html(js);cluetipShow(pY);} else if(tipParts){var tpl=tipParts.length;for(var i=0;i'+tipParts[i]+'');}};cluetipShow(pY);} else if(!opts.local&&tipAttribute.indexOf('#')!=0){if(cluetipContents&&opts.ajaxCache){$cluetipInner.html(cluetipContents);cluetipShow(pY);} -else{var ajaxSettings=opts.ajaxSettings;ajaxSettings.url=tipAttribute;ajaxSettings.beforeSend=function(){$cluetipOuter.children().empty();if(opts.waitImage){$('#cluetip-waitimage').css({top:mouseY+20,left:mouseX+20}).show();}};ajaxSettings.error=function(){if(isActive){$cluetipInner.html('sorry, the contents could not be loaded');}};ajaxSettings.success=function(data){cluetipContents=opts.ajaxProcess(data);if(isActive){$cluetipInner.html(cluetipContents);}};ajaxSettings.complete=function(){imgCount=$('#cluetip-inner img').length;if(imgCount&&!$.browser.opera){$('#cluetip-inner img').load(function(){imgCount--;if(imgCount<1){$('#cluetip-waitimage').hide();if(isActive)cluetipShow(pY);}});}else{$('#cluetip-waitimage').hide();if(isActive)cluetipShow(pY);}};$.ajax(ajaxSettings);}}else if(opts.local){var $localContent=$(tipAttribute+':first');var localCluetip=$.fn.wrapInner?$localContent.wrapInner('
').children().clone(true):$localContent.html();$.fn.wrapInner?$cluetipInner.empty().append(localCluetip):$cluetipInner.html(localCluetip);cluetipShow(pY);}};var cluetipShow=function(bpY){$cluetip.addClass('cluetip-'+ctClass);if(opts.truncate){var $truncloaded=$cluetipInner.text().slice(0,opts.truncate)+'...';$cluetipInner.html($truncloaded);} +else{var ajaxSettings=opts.ajaxSettings;ajaxSettings.url=tipAttribute;ajaxSettings.beforeSend=function(){$cluetipOuter.children().empty();if(opts.waitImage){$('#cluetip-waitimage').css({top:mouseY+20,left:mouseX+20}).show();}};ajaxSettings.error=function(){if(isActive){$cluetipInner.html('sorry, the contents could not be loaded');}};ajaxSettings.success=function(data){cluetipContents=opts.ajaxProcess(data);if(isActive){$cluetipInner.html(cluetipContents);}};ajaxSettings.complete=function(){imgCount=$('#cluetip-inner img').length;$('#cluetip-waitimage').hide();if(isActive)cluetipShow(pY);};$.ajax(ajaxSettings);}}else if(opts.local){var $localContent=$(tipAttribute+':first');var localCluetip=$.fn.wrapInner?$localContent.wrapInner('
').children().clone(true):$localContent.html();$.fn.wrapInner?$cluetipInner.empty().append(localCluetip):$cluetipInner.html(localCluetip);cluetipShow(pY);}};var cluetipShow=function(bpY){$cluetip.addClass('cluetip-'+ctClass);if(opts.truncate){var $truncloaded=$cluetipInner.text().slice(0,opts.truncate)+'...';$cluetipInner.html($truncloaded);} function doNothing(){};tipTitle?$cluetipTitle.show().html(tipTitle):(opts.showTitle)?$cluetipTitle.show().html(' '):$cluetipTitle.hide();if(opts.sticky){var $closeLink=$('
');(opts.closePosition=='bottom')?$closeLink.appendTo($cluetipInner):(opts.closePosition=='title')?$closeLink.prependTo($cluetipTitle):$closeLink.prependTo($cluetipInner);$closeLink.click(function(){cluetipClose();return false;});if(opts.mouseOutClose){if($.fn.hoverIntent&&opts.hoverIntent){$cluetip.hoverIntent({over:doNothing,timeout:opts.hoverIntent.timeout,out:function(){$closeLink.trigger('click');}});}else{$cluetip.hover(doNothing,function(){$closeLink.trigger('click');});}}else{$cluetip.unbind('mouseout');}} var direction='';$cluetipOuter.css({overflow:defHeight=='auto'?'visible':'auto',height:defHeight});tipHeight=defHeight=='auto'?Math.max($cluetip.outerHeight(),$cluetip.height()):parseInt(defHeight,10);tipY=posY;baseline=sTop+wHeight;if(opts.positionBy=='fixed'){tipY=posY-opts.dropShadowSteps+tOffset;}else if((posXmouseX)||opts.positionBy=='bottomTop'){if(posY+tipHeight+tOffset>baseline&&mouseY-sTop>tipHeight+tOffset){tipY=mouseY-tipHeight-tOffset;direction='top';}else{tipY=mouseY+tOffset;direction='bottom';}}else if(posY+tipHeight+tOffset>baseline){tipY=(tipHeight>=wHeight)?sTop:baseline-tipHeight-tOffset;}else if($this.css('display')=='block'||$this[0].tagName.toLowerCase()=='area'||opts.positionBy=="mouse"){tipY=bpY-tOffset;}else{tipY=posY-opts.dropShadowSteps;} if(direction==''){posX +echo ''; // Get Groups and profiles from user @@ -902,10 +902,16 @@ foreach ($result as $row) { } } + // TODO: Calculate hash access before to use it more simply like other sections. I.E. Events view if (defined('METACONSOLE')) { - $data[1] = ''; - $data[1] .= ui_print_truncate_text($row["agent_name"], 'agent_small', false, true, false, '[…]', 'font-size:7.5pt;'); - $data[1] .= ''; + $agent_link = ''; + $agent_name = ui_print_truncate_text($row["agent_name"], 'agent_small', false, true, false, '[…]', 'font-size:7.5pt;'); + if (can_user_access_node ()) { + $data[1] = $agent_link . '' . $agent_name . ''; + } + else { + $data[1] = $agent_name; + } } else { $data[1] = ''; diff --git a/pandora_console/operation/events/events.build_table.php b/pandora_console/operation/events/events.build_table.php index 0ad2288e18..90749b183c 100644 --- a/pandora_console/operation/events/events.build_table.php +++ b/pandora_console/operation/events/events.build_table.php @@ -14,7 +14,7 @@ // GNU General Public License for more details. -$table->width = '98%'; +$table->width = '100%'; $table->id = "eventtable"; $table->cellpadding = 4; $table->cellspacing = 4; @@ -39,7 +39,7 @@ $table->align[$i] = 'center'; $i++; if (in_array('server_name', $show_fields)) { $table->head[$i] = __('Server'); - $table->align[$i] = 'center'; + $table->align[$i] = 'left'; $i++; } if (in_array('estado', $show_fields)) { @@ -60,7 +60,7 @@ if (in_array('evento', $show_fields)) { } if (in_array('id_agente', $show_fields)) { $table->head[$i] = __('Agent name'); - $table->align[$i] = 'center'; + $table->align[$i] = 'left'; $table->style[$i] = 'max-width: 350px; word-break: break-all;'; $i++; } @@ -191,6 +191,7 @@ foreach ($result as $event) { $i = 0; $data[$i] = "#".$event["id_evento"]; + $table->cellstyle[count($table->data)][$i] = 'background: #F3F3F3; color: #111 !important;'; // Pass grouped values in hidden fields to use it from modal window if ($group_rep) { @@ -245,10 +246,9 @@ foreach ($result as $event) { if (in_array('estado',$show_fields)) { $data[$i] = html_print_image ($img_st, true, array ("class" => "image_status", - "width" => 16, - "height" => 16, "title" => $title_st, "id" => 'status_img_'.$event["id_evento"])); + $table->cellstyle[count($table->data)][$i] = 'background: #F3F3F3;'; $i++; } if (in_array('id_evento',$show_fields)) { @@ -303,9 +303,13 @@ foreach ($result as $event) { if ($event["id_agente"] > 0) { // Agent name if ($meta) { - $data[$i] = ''; - $data[$i] .= $event["agent_name"]; - $data[$i] .= ""; + $agent_link = ''; + if (can_user_access_node ()) { + $data[$i] = '' . $agent_link . $event["agent_name"] . ''; + } + else { + $data[$i] = $event["agent_name"]; + } } else { $data[$i] .= ui_print_agent_name ($event["id_agente"], true); @@ -377,9 +381,13 @@ foreach ($result as $event) { if (in_array('id_agentmodule',$show_fields)) { if ($meta) { - $data[$i] = ''; - $data[$i] .= $event["module_name"]; - $data[$i] .= ""; + $module_link = ''; + if (can_user_access_node ()) { + $data[$i] = '' . $module_link . $event["module_name"] . ''; + } + else { + $data[$i] = $event["module_name"]; + } } else { $data[$i] = '' @@ -514,6 +522,9 @@ foreach ($result as $event) { $data[$i] .= html_print_image ("images/eye.png", true, array ("title" => __('Show more'))); $data[$i] .= ''; + + $table->cellstyle[count($table->data)][$i] = 'background: #F3F3F3;'; + $i++; if (tags_check_acl ($config["id_user"], $event["id_grupo"], "EM", $event['clean_tags']) == 1) { @@ -528,6 +539,8 @@ foreach ($result as $event) { else if (isset($table->header[$i]) || true) { $data[$i] = ''; } + + $table->cellstyle[count($table->data)][$i] = 'background: #F3F3F3;'; } array_push ($table->data, $data); diff --git a/pandora_console/operation/events/events_list.php b/pandora_console/operation/events/events_list.php index 1b7ffa54ea..64273f6eee 100644 --- a/pandora_console/operation/events/events_list.php +++ b/pandora_console/operation/events/events_list.php @@ -339,7 +339,7 @@ else{ } $table_advanced->id = 'events_filter_form_advanced'; -$table_advanced->width = '99%'; +$table_advanced->width = '98%'; $table_advanced->cellspacing = 4; $table_advanced->cellpadding = 4; $table_advanced->class = 'transparent'; @@ -399,7 +399,7 @@ $table_advanced->data[] = $data; $table_advanced->rowclass[] = ''; $table->id = 'events_filter_form'; -$table->width = '99%'; +$table->width = '100%'; $table->cellspacing = 4; $table->cellpadding = 4; $table->class = 'databox'; diff --git a/pandora_console/operation/tree.php b/pandora_console/operation/tree.php index d23d08435b..2f2de5c525 100644 --- a/pandora_console/operation/tree.php +++ b/pandora_console/operation/tree.php @@ -447,7 +447,7 @@ if (is_ajax ()) echo " "; } - echo ""; + echo ""; echo io_safe_output($row['nombre']); echo ""; if ($row['quiet']) { @@ -455,6 +455,7 @@ if (is_ajax ()) html_print_image("images/dot_green.disabled.png", false, array("border" => '0', "title" => __('Quiet'), "alt" => "")); } + /* if (is_numeric($row["datos"])) $data = format_numeric($row["datos"]); else @@ -470,6 +471,7 @@ if (is_ajax ()) echo " "; echo '('.$row['unit'].')'; } + * */ echo ""; } echo "\n";