diff --git a/pandora_console/include/functions_treeview.php b/pandora_console/include/functions_treeview.php index bb41341d0d..4b0f2198f3 100755 --- a/pandora_console/include/functions_treeview.php +++ b/pandora_console/include/functions_treeview.php @@ -55,55 +55,75 @@ function treeview_printModuleTable($id_module, $server_data = false) { return; } - echo '
'; - echo ''; + $table = new StdClass(); + $table->width = "100%"; + $table->style = array(); + $table->style['title'] = 'font-weight: bold;'; + $table->head = array(); + $table->head[] = __('Module'); + $table->head_colspan[] = 2; + $table->data = array(); //Module name - echo ''; - if ($module["disabled"]) $cellName = "" . ui_print_truncate_text ($module["nombre"], GENERIC_SIZE_TEXT, true, true, true, '[…]',"text-transform: uppercase;") . ui_print_help_tip(__('Disabled'), true) . ""; else $cellName = ui_print_truncate_text ($module["nombre"], GENERIC_SIZE_TEXT, true, true, true, '[…]',"text-transform: uppercase;"); - echo ''; + $row = array(); + $row['title'] = __('Name'); + $row['data'] = "".$cellName.""; + $table->data['name'] = $row; // Interval - echo ''; - echo ''; + $row = array(); + $row['title'] = __('Interval'); + $row['data'] = human_time_description_raw (modules_get_interval($module['id_agente_modulo']), true); + $table->data['interval'] = $row; // Warning Min/Max - echo ''; if (modules_is_string_type($module['id_tipo_modulo'])) { - echo ''; + $warning_status_str = __('Str.') . ': ' . $module['str_warning']; } else { - echo ''; + $warning_status_str = __('Min.') . ': ' . $module['min_warning'] . '
' . __('Max.') . ': ' . $module['max_warning']; } + + $row = array(); + $row['title'] = __('Warning status'); + $row['data'] = $warning_status_str; + $table->data['watning_status'] = $row; // Critical Min/Max - echo '
'; if (modules_is_string_type($module['id_tipo_modulo'])) { - echo ''; + $critical_status_str = __('Str.') . ': ' . $module['str_warning']; } else { - echo ''; + $critical_status_str = __('Min.') . ': ' . $module['min_critical'] . '
' . __('Max.') . ': ' . $module['max_critical']; } + $row = array(); + $row['title'] = __('Critical status'); + $row['data'] = $critical_status_str; + $table->data['critical_status'] = $row; // Module group - echo '
'; - echo ''; + $module_group = __("$module_group"); + + $row = array(); + $row['title'] = __('Module group'); + $row['data'] = $module_group; + $table->data['module_group'] = $row; // Description - echo ''; - echo ''; + $row = array(); + $row['title'] = __('Description'); + $row['data'] = ui_print_truncate_text ($module['descripcion'], 'description', true, true, true, '[…]'); + $table->data['description'] = $row; // Tags $tags = tags_get_module_tags($module['id_agente_modulo']); @@ -135,8 +155,10 @@ function treeview_printModuleTable($id_module, $server_data = false) { $tags = implode(', ' , $tags); } - echo ''; - echo ''; + $row = array(); + $row['title'] = __('Tags'); + $row['data'] = $tags; + $table->data['tags'] = $row; // 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'))); @@ -145,28 +167,28 @@ function treeview_printModuleTable($id_module, $server_data = false) { else $data = "" . substr(io_safe_output($last_data['datos']),0,12) . ""; - echo ''; - echo ''; + $row = array(); + $row['title'] = __('Last data'); + $row['data'] = $last_data_str; + $table->data['last_data'] = $row; //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']); - + if ($module_group === false) - echo __('Not assigned'); + $module_group = __('Not assigned'); else - echo __("$module_group"); - echo '
'.__('Description').''. ui_print_truncate_text ($module['descripcion'], 'description', true, true, true, '[…]') .'
'.__('Tags').'' . $tags . '
'.__('Last data').''; - if (!empty($last_data['utimestamp'])) { - echo $data; + $last_data_str = $data; if ($module['unit'] != '') { - echo " "; - echo '('.$module['unit'].')'; + $last_data_str .= " "; + $last_data_str .= '('.$module['unit'].')'; } - echo " "; - html_print_image('images/clock2.png', false, array('title' => $last_data["timestamp"], 'width' => '18px')); + $last_data_str .= " "; + $last_data_str .= html_print_image('images/clock2.png', true, array('title' => $last_data["timestamp"], 'width' => '18px')); } else { - echo '' . __('No data') . ''; + $last_data_str = '' . __('No data') . ''; } - echo '
'; + html_print_table($table); $id_group = agents_get_agent_group($module['id_agente']); $group_name = db_get_value('nombre', 'tgrupo', 'id_grupo', $id_group); @@ -174,10 +196,10 @@ function treeview_printModuleTable($id_module, $server_data = false) { if (can_user_access_node () && check_acl ($config["id_user"], $id_group, 'AW')) { // Actions table - echo '
'; - echo '
'; + echo '
'; + echo ''; html_print_submit_button (__('Go to module edition'), 'upd_button', false, 'class="sub config"'); - echo ''; + echo ''; echo '
'; } @@ -218,42 +240,53 @@ function treeview_printAlertsTable($id_module, $server_data = array()) { return; } - echo '
'; - echo ''; - echo ''; - - echo ''; - echo ''; + $table = new StdClass(); + $table->width = "100%"; + $table->style = array(); + $table->style['titles'] = 'font-weight: bold; background: #B3B3B3;'; + $table->head = array(); + $table->head[] = __('Alerts') . ": " . $module_name; + $table->head_colspan[] = 2; + $table->data = array(); + + $row = array(); + $row['template'] = __('Template'); + $row['actions'] = __('Actions'); + $table->data['titles'] = $row; foreach($module_alerts as $module_alert) { //Template name - echo ''; $template_name = db_get_value('name','talert_templates','id',$module_alert['id_alert_template']); - echo ''; + $actions = alerts_get_alert_agent_module_actions($module_alert['id']); - echo ''; + + $row = array(); + $row['template'] = $template_name; + $row['actions'] = $actions_list; + $table->data['last_data'] = $row; } - echo '
' . $module_name . '
'.__('Template').''.__('Actions').'
'.$template_name.''; + if (empty($actions)) { - echo ''.__('N/A').''; + $actions_list = ''.__('N/A').''; } else { - echo '
    '; - foreach($actions as $act) { - echo '
  • '; - echo $act['name']; - echo '
  • '; + $actions_list = '
      '; + foreach($actions_list as $act) { + $actions_list .= '
    • '; + $actions_list .= $act['name']; + $actions_list .= '
    • '; } - echo '
    '; + $actions_list .= '
'; } - echo '
'; + + html_print_table($table); if (can_user_access_node () && check_acl ($config["id_user"], $id_group, 'LW')) { // Actions table - echo '
'; - echo '
'; + echo '
'; } } @@ -386,9 +419,9 @@ function treeview_printTable($id_agente, $server_data = array()) { if (can_user_access_node () && check_acl ($config["id_user"], $agent["id_grupo"], "AW")) { $go_to_agent = ''; $agent_table .= $go_to_agent;