diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index da0db944bb..40ac4a1ea9 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,38 @@ +2012-06-14 Miguel de Dios + + * include/functions_html.php, include/functions_reporting.php, + include/functions_groups.php, include/functions_visual_map.php, + include/ajax/reporting.ajax.php, include/functions_ui.php, + extensions/agents_modules.php, extensions/module_groups.php, + operation/incidents/incident.php, + operation/incidents/incident_detail.php, + operation/agentes/status_monitor.php, + operation/agentes/estado_ultimopaquete.php, + operation/agentes/estado_agente.php, + operation/agentes/ver_agente.php, + operation/snmpconsole/snmp_view.php. + operation/integria_incidents/incident.incident.php, + mobile/operation/agents/monitor_status.php, + mobile/operation/agents/view_agents.php, + mobile/operation/agents/view_alerts.php, + mobile/operation/events/events.php, + godmode/groups/modu_group_list.php, godmode/groups/group_list.php, + godmode/agentes/module_manager.php, + godmode/agentes/modificar_agente.php, + godmode/agentes/configurar_agente.php, + godmode/alerts/alert_list.list.php, godmode/setup/os.list.php, + godmode/users/configure_user.php, + godmode/modules/manage_network_templates.php, + godmode/reporting/reporting_builder.list_items.php, + godmode/tag/tag.php: changed the calls of "ui_print_truncate_text" + now we are trying that more easy and standar, now the string name of + agent have the equal number of characters in all code...but there + are two styles, small and medium size for agents text name, modules + text name, but description is only size. You can set this sizes in + the visual setup page into your Pandora. + + MERGED from 4.0.2 + 2012-06-14 Vanessa Gil * include/functions_agents.php diff --git a/pandora_console/extensions/agents_modules.php b/pandora_console/extensions/agents_modules.php index 6b2056aa06..e09e9ac91b 100644 --- a/pandora_console/extensions/agents_modules.php +++ b/pandora_console/extensions/agents_modules.php @@ -222,7 +222,7 @@ function mainAgentsModules() { echo " " . - ui_print_truncate_text(io_safe_output($agent['nombre']), 35, true, true, true, '...', 'font-size:10px; font-weight: bold;') . + ui_print_truncate_text(io_safe_output($agent['nombre']), 'agent_size_text_small', true, true, true, '...', 'font-size:10px; font-weight: bold;') . ""; $agent_modules = agents_get_modules($agent['id_agente']); diff --git a/pandora_console/extensions/module_groups.php b/pandora_console/extensions/module_groups.php index 77d6423ea8..9ac927472f 100644 --- a/pandora_console/extensions/module_groups.php +++ b/pandora_console/extensions/module_groups.php @@ -147,7 +147,7 @@ function mainModuleGroups() { array_walk($modelGroups, 'translate'); //Translate all head titles to language is set foreach ($modelGroups as $i => $n) { - $modelGroups[$i] = ui_print_truncate_text($n, 20); + $modelGroups[$i] = ui_print_truncate_text($n, GENERIC_SIZE_TEXT); } $head = $modelGroups; @@ -170,7 +170,7 @@ function mainModuleGroups() { $row = array(); - array_push($row, ui_print_truncate_text($name, 20)); + array_push($row, ui_print_truncate_text($name, GENERIC_SIZE_TEXT)); foreach ($modelGroups as $idModelGroup => $modelGroup) { $query = sprintf($sql,$idAgentGroup, $idModelGroup); diff --git a/pandora_console/godmode/agentes/configurar_agente.php b/pandora_console/godmode/agentes/configurar_agente.php index b3b6ceb4fd..0588ce1a36 100644 --- a/pandora_console/godmode/agentes/configurar_agente.php +++ b/pandora_console/godmode/agentes/configurar_agente.php @@ -381,17 +381,16 @@ if ($id_agente) { } break; default: - - } - - ui_print_page_header (__('Agent configuration') . ' - ' . ui_print_truncate_text(agents_get_name ($id_agente), 25, false) . ' ' . $tab_description, "images/setup.png", false, "", true, $onheader); + break; + } + ui_print_page_header (__('Agent configuration') . ' - ' . + ui_print_truncate_text(agents_get_name ($id_agente), 'agent_small', false) . + ' ' . $tab_description, "images/setup.png", false, "", true, $onheader); } -// Create agent else { - + // Create agent ui_print_page_header (__('Agent manager'), "images/bricks.png", false, "create_agent", true); - } $delete_conf_file = (bool) get_parameter('delete_conf_file'); diff --git a/pandora_console/godmode/agentes/modificar_agente.php b/pandora_console/godmode/agentes/modificar_agente.php index 5387d748ea..d7ba4111c8 100644 --- a/pandora_console/godmode/agentes/modificar_agente.php +++ b/pandora_console/godmode/agentes/modificar_agente.php @@ -401,8 +401,10 @@ if ($agents !== false) { } echo ''; echo "" . ui_print_truncate_text($agent["nombre"], 60, true, true, true, '[…]', 'font-size: 7pt').""; + sec2=godmode/agentes/configurar_agente&tab=main& + id_agente=" . $agent["id_agente"] . "'>" . + ui_print_truncate_text($agent["nombre"], 'agent_medium', true, true, true, '[…]', 'font-size: 7pt') . + ""; if ($agent["disabled"]) { ui_print_help_tip(__('Disabled')); echo ""; @@ -426,7 +428,7 @@ if ($agents !== false) { echo ''; echo ""; - + echo ""; // Has remote configuration ? $agent_md5 = md5 ($agent["nombre"], false); @@ -436,8 +438,8 @@ if ($agents !== false) { echo ""; } echo ""; - - + + // Operating System icon echo ""; ui_print_os_icon ($agent["id_os"], false); @@ -445,7 +447,8 @@ if ($agents !== false) { // Group icon and name echo "" . ui_print_group_icon ($id_grupo, true).""; // Description - echo "". ui_print_truncate_text($agent["comentarios"], 65, true, true, true, '[…]', 'font-size: 6.5pt;').""; + echo "" . + ui_print_truncate_text($agent["comentarios"], 'description', true, true, true, '[…]', 'font-size: 6.5pt;').""; // Action //When there is only one element in page it's necesary go back page. if ((count($agents) == 1) && ($offset >= $config["block_size"])) @@ -483,7 +486,7 @@ $(document).ready (function () { function () { $(".actions", this).css ("visibility", "hidden"); }); - + $("#ag_group").click ( function () { $(this).css ("width", "auto"); diff --git a/pandora_console/godmode/agentes/module_manager.php b/pandora_console/godmode/agentes/module_manager.php index ec61bf7b48..3a647dad7f 100644 --- a/pandora_console/godmode/agentes/module_manager.php +++ b/pandora_console/godmode/agentes/module_manager.php @@ -459,12 +459,13 @@ foreach ($modules as $module) { $data = array (); } - - $data[0] = ''; + + $data[0] = ''; if ($module["disabled"]) - $data[0] .= '' . ui_print_truncate_text($module['nombre'], 50, false, true, true, '[…]', 'font-size: 7.2pt').''; + $data[0] .= '' . + ui_print_truncate_text($module['nombre'], 'module_medium', false, true, true, '[…]', 'font-size: 7.2pt').''; else - $data[0] .= ui_print_truncate_text($module['nombre'], 50, false, true, true, '[…]', 'font-size: 7.2pt'); + $data[0] .= ui_print_truncate_text($module['nombre'], 'module_medium', false, true, true, '[…]', 'font-size: 7.2pt'); $data[0] .= ''; if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK) { @@ -522,25 +523,26 @@ foreach ($modules as $module) { if ($type) { $data[3] = ui_print_moduletype_icon ($type, true); } - + // Module interval if ($module['module_interval']) { $data[4] = $module['module_interval']; - } else { + } + else { $data[4] = $agent_interval; } - $data[5] = ui_print_truncate_text($module['descripcion'], 50, false); + $data[5] = ui_print_truncate_text($module['descripcion'], 'description', false); $module_status = db_get_row('tagente_estado', 'id_agente_modulo', $module['id_agente_modulo']); modules_get_status($module['id_agente_modulo'], $module_status['estado'], $module_status['datos'], $status, $title); - + $data[6] = ui_print_status_image($status, $title, true); // MAX / MIN values $data[7] = ui_print_module_warn_value ($module["max_warning"], $module["min_warning"], $module["str_warning"], $module["max_critical"], $module["min_critical"], $module["str_critical"]); - + // Delete module $data[8] = html_print_checkbox('id_delete[]', $module['id_agente_modulo'], false, true); $data[8] .= ' '; @@ -564,7 +566,7 @@ foreach ($modules as $module) { $data[8] .= ''; } } - + array_push ($table->data, $data); } diff --git a/pandora_console/godmode/alerts/alert_list.list.php b/pandora_console/godmode/alerts/alert_list.list.php index d92374d152..ed6622f1ba 100644 --- a/pandora_console/godmode/alerts/alert_list.list.php +++ b/pandora_console/godmode/alerts/alert_list.list.php @@ -77,7 +77,6 @@ if ($groups_user === false) { } $groups_id = implode(',', array_keys($groups_user)); - $form_filter .= "\n"; switch ($config["dbtype"]) { case "mysql": @@ -398,25 +397,26 @@ foreach ($simple_alerts as $alert) { $data[0] .= ''; $data[0] .= ''; } - $data[1] = ui_print_truncate_text(modules_get_agentmodule_name ($alert['id_agent_module']), 35, false, true, true, '[…]', 'font-size: 7.2pt'); - + $data[1] = ui_print_truncate_text( + modules_get_agentmodule_name ($alert['id_agent_module']), 'module_small', false, true, true, '[…]', 'font-size: 7.2pt'); + $data[2] = ' ' . html_print_image("images/zoom.png", true, array("id" => 'template-details-'.$alert['id_alert_template'], "class" => "img_help")) . ' '; $data[2] .= ""; - $data[2] .= ui_print_truncate_text(alerts_get_alert_template_name ($alert['id_alert_template']), 55, false, true, true, '[…]', 'font-size: 7.1pt'); + $data[2] .= ui_print_truncate_text( + alerts_get_alert_template_name ($alert['id_alert_template']), GENERIC_SIZE_TEXT, false, true, true, '[…]', 'font-size: 7.1pt'); $data[2] .= ""; - + $actions = alerts_get_alert_agent_module_actions ($alert['id']); - + $data[3] = ''; - if (empty($actions)){ + if (empty($actions)) { // Get and show default actions for this alert $default_action = db_get_sql ("SELECT id_alert_action FROM talert_templates WHERE id = ".$alert["id_alert_template"]); if ($default_action != ""){ $data[3] = __("Default"). " : ".db_get_sql ("SELECT name FROM talert_actions WHERE id = $default_action"); } - } else { $data[3] = ''; } - + $data[3] .= ''; $data[3] .= html_print_image ('images/add.png', true); diff --git a/pandora_console/godmode/groups/group_list.php b/pandora_console/godmode/groups/group_list.php index ce67889e46..b4cb81859f 100644 --- a/pandora_console/godmode/groups/group_list.php +++ b/pandora_console/godmode/groups/group_list.php @@ -321,7 +321,7 @@ if(!empty($groups)) { } } } - + $tabulation = str_repeat('    ', $group['deep']); if ($group['id_grupo'] == 0) { @@ -333,10 +333,13 @@ if(!empty($groups)) { if ($group['hash_branch']) { $data[0] = ''.$tabulation . ' ' . - '' . $symbol . ' '. ui_print_truncate_text($group['nombre']).''; + '' . + $symbol . ' '. ui_print_truncate_text($group['nombre']) . ''; } else { - $data[0] = ''.$tabulation . ' '. ui_print_truncate_text($group['nombre'], 60).''; + $data[0] = ''.$tabulation . ' ' . ui_print_truncate_text($group['nombre']) . ''; } $data[1] = $group['id_grupo']; $data[2] = ui_print_group_icon($group['id_grupo'], true); @@ -345,7 +348,6 @@ if(!empty($groups)) { $data[4] = ''; } else { - $data[4] = '' . html_print_image("images/config.png", true, array("alt" => __('Edit'), "title" => __('Edit'), "border" => '0')); //Check if there is only a group to unable delete it if ((count($groups) > 3) || (count($groups) <= 3 && $group['parent'] != 0)) { @@ -356,7 +358,7 @@ if(!empty($groups)) { array_push ($table->data, $data); $iterator++; } - + html_print_table ($table); } else { @@ -378,7 +380,7 @@ function showBranch(parent) { if (display != 'none') { $('.symbol_' + parent).html('+'); $('.parent_' + parent).css('display', 'none'); - + //Close the child branch too $('.branch_' + parent).css('display', 'none'); $('.symbol_branch_' + parent).html('+'); diff --git a/pandora_console/godmode/groups/modu_group_list.php b/pandora_console/godmode/groups/modu_group_list.php index e457eff7cd..29e5fddc62 100644 --- a/pandora_console/godmode/groups/modu_group_list.php +++ b/pandora_console/godmode/groups/modu_group_list.php @@ -151,23 +151,23 @@ switch ($config["dbtype"]) { LIMIT " . $config['block_size'] . " OFFSET " . $offset; break; case "oracle": - $set = array (); - $set['limit'] = $config["block_size"]; - $set['offset'] = $offset; - - $sql = "SELECT * - FROM tmodule_group - ORDER BY name ASC"; - - $sql = oracle_recode_query ($sql, $set); - break; + $set = array (); + $set['limit'] = $config["block_size"]; + $set['offset'] = $offset; + + $sql = "SELECT * + FROM tmodule_group + ORDER BY name ASC"; + + $sql = oracle_recode_query ($sql, $set); + break; } - + $groups = db_get_all_rows_sql($sql); $table->width = '98%'; -if(!empty($groups)) { +if (!empty($groups)) { $table->head = array (); $table->head[0] = __('ID'); $table->head[1] = __('Name'); @@ -176,19 +176,20 @@ if(!empty($groups)) { $table->align[1] = 'left'; $table->align[2] = 'center'; $table->data = array (); - + foreach ($groups as $id_group ) { $data = array (); $data[0] = $id_group["id_mg"]; - $data[1] = '' . ui_print_truncate_text($id_group["name"], 50).''; + $data[1] = '' . + ui_print_truncate_text($id_group["name"], GENERIC_SIZE_TEXT).''; $data[2] = '' . html_print_image("images/cross.png", true, array("border" => '0')) . ''; array_push ($table->data, $data); } - + html_print_table ($table); } -else{ +else { echo "
".__('There are no defined module groups')."
"; } diff --git a/pandora_console/godmode/modules/manage_network_templates.php b/pandora_console/godmode/modules/manage_network_templates.php index aac2b013b2..9f58631d1c 100644 --- a/pandora_console/godmode/modules/manage_network_templates.php +++ b/pandora_console/godmode/modules/manage_network_templates.php @@ -43,7 +43,8 @@ if ($delete_profile) { // if delete if ($result) { db_pandora_audit("Module management", "Delete module template #$id"); - } else { + } + else { db_pandora_audit("Module management", "Fail try to delete module template #$id"); } @@ -73,7 +74,8 @@ if ($multiple_delete) { $str_ids = implode (',', $ids); if ($result) { db_pandora_audit("Module management", "Multiple delete module template: $str_ids"); - } else { + } + else { db_pandora_audit("Module management", "Fail try to delete module template: $str_ids"); } @@ -198,7 +200,7 @@ $table->data = array (); foreach ($result as $row) { $data = array (); $data[0] = ''. io_safe_output($row["name"]).''; - $data[1] = ui_print_truncate_text(io_safe_output($row["description"]), 80, true, true, true, '[…]'); + $data[1] = ui_print_truncate_text(io_safe_output($row["description"]), 'description', true, true, true, '[…]'); $data[2] = html_print_input_image ("delete_profile", "images/cross.png", $row["id_np"],'', true, array ('onclick' => 'if (!confirm(\''.__('Are you sure?').'\')) return false;')); @@ -222,7 +224,8 @@ if (!empty ($table->data)) { html_print_submit_button(__('Delete'), 'delete_btn', false, 'class="sub delete"'); echo ""; echo ""; -} else { +} +else { echo '
'.__('There are no defined network profiles').'
'; } diff --git a/pandora_console/godmode/reporting/reporting_builder.list_items.php b/pandora_console/godmode/reporting/reporting_builder.list_items.php index 75423b3684..33db797fb0 100644 --- a/pandora_console/godmode/reporting/reporting_builder.list_items.php +++ b/pandora_console/godmode/reporting/reporting_builder.list_items.php @@ -283,20 +283,20 @@ foreach ($items as $item) { $row[3] = ''; } else { - $row[2] = ui_print_truncate_text(agents_get_name(agents_get_agent_id_by_module_id($item['id_agent_module'])), 35); + $row[2] = ui_print_truncate_text(agents_get_name(agents_get_agent_id_by_module_id($item['id_agent_module'])), 'agent_small'); $module_name_db = db_get_value_filter('nombre', 'tagente_modulo', array('id_agente_modulo' => $item['id_agent_module'])); - $row[3] = ui_print_truncate_text(io_safe_output($module_name_db), 35); + $row[3] = ui_print_truncate_text(io_safe_output($module_name_db), 'module_small'); } } else { - $row[2] = ui_print_truncate_text(agents_get_name($item['id_agent']), 35); + $row[2] = ui_print_truncate_text(agents_get_name($item['id_agent']), 'agent_small'); if ($item['id_agent_module'] == '') { $row [3] = ''; } else { $module_name_db = db_get_value_filter('nombre', 'tagente_modulo', array('id_agente_modulo' => $item['id_agent_module'])) - $row[3] = ui_print_truncate_text(io_safe_output($module_name_db),35); + $row[3] = ui_print_truncate_text(io_safe_output($module_name_db), 'module_small'); } } @@ -311,7 +311,7 @@ foreach ($items as $item) { $row[5] = '-'; } else { - $row[5] = ui_print_truncate_text($item['description'], 40, true, true); + $row[5] = ui_print_truncate_text($item['description'], 'description', true, true); } $row[6] = ''; diff --git a/pandora_console/godmode/setup/os.list.php b/pandora_console/godmode/setup/os.list.php index 9faeaf38ed..56ac12c796 100644 --- a/pandora_console/godmode/setup/os.list.php +++ b/pandora_console/godmode/setup/os.list.php @@ -38,7 +38,7 @@ $table->size[0] = '20px'; $table->size[4] = '20px'; $osList = db_get_all_rows_in_table('tconfig_os'); -if($osList === false) { +if ($osList === false) { $osList = array(); } @@ -48,7 +48,7 @@ foreach ($osList as $os) { $data[] = ui_print_os_icon($os['id_os'], false, true); $data[] = $os['id_os']; $data[] = '' . io_safe_output($os['name']) . ''; - $data[] = ui_print_truncate_text(io_safe_output($os['description']), 25, true, true); + $data[] = ui_print_truncate_text(io_safe_output($os['description']), 'description', true, true); if ($os['id_os'] > 16) { $data[] = '' . html_print_image("images/cross.png", true) . ''; } @@ -60,7 +60,7 @@ foreach ($osList as $os) { $table->data[] = $data; } -if(isset($data)) { +if (isset($data)) { html_print_table($table); } else { diff --git a/pandora_console/godmode/tag/tag.php b/pandora_console/godmode/tag/tag.php index 216d414f1d..84452544d0 100644 --- a/pandora_console/godmode/tag/tag.php +++ b/pandora_console/godmode/tag/tag.php @@ -125,7 +125,7 @@ $rowPair = true; $iterator = 0; if (!empty($result)){ - + $table->width = '98%'; $table->data = array (); $table->head = array (); @@ -141,7 +141,7 @@ if (!empty($result)){ $table->head[2] = __('Detail information'); $table->head[3] = __('Number of modules affected'); $table->head[4] = __('Actions'); - + foreach ($result as $tag) { if ($rowPair) $table->rowclass[$iterator] = 'rowPair'; @@ -149,29 +149,28 @@ if (!empty($result)){ $table->rowclass[$iterator] = 'rowOdd'; $rowPair = !$rowPair; $iterator++; - + $data = array (); - - $data[0] = "" . $tag["name"] . ""; - $data[1] = ui_print_truncate_text($tag["description"], 25, false); + + $data[0] = "" . $tag["name"] . ""; + $data[1] = ui_print_truncate_text($tag["description"], 'description', false); $data[2] = '' . $tag["url"] . ''; $data[3] = ' ' . - html_print_image("images/zoom.png", true, array("id" => 'tag-details-'.$tag['id_tag'], "class" => "img_help")) . ' '; - - + href="ajax.php?page=godmode/tag/tag&get_tag_tooltip=1&id_tag=' . $tag['id_tag'] . '">' . + html_print_image("images/zoom.png", true, array("id" => 'tag-details-'.$tag['id_tag'], "class" => "img_help")) . ' '; - $data[3] .= tags_get_modules_count($tag["id_tag"]); + $data[3] .= tags_get_modules_count($tag["id_tag"]); $data[4] = "" . html_print_image("images/config.png", true, array("title" => "Edit")) . "  "; $data[4] .= '' . html_print_image("images/cross.png", true, array("title" => "Delete")) . ''; array_push ($table->data, $data); } - -html_print_table ($table); - -// No tags available or selected -}else + + html_print_table ($table); +} +else { + // No tags available or selected echo "
".__('No tags selected')."
"; +} ui_require_css_file ('cluetip'); ui_require_jquery_file ('cluetip'); @@ -187,6 +186,5 @@ ui_require_jquery_file ('cluetip'); }).click (function () { return false; }); - /* ]]> */ diff --git a/pandora_console/godmode/users/configure_user.php b/pandora_console/godmode/users/configure_user.php index 831b0aebab..ae4007a61c 100644 --- a/pandora_console/godmode/users/configure_user.php +++ b/pandora_console/godmode/users/configure_user.php @@ -482,9 +482,11 @@ foreach ($result as $profile) { } $data = array (); - + $data[0] = ''.profile_get_name ($profile['id_perfil']).''; - $data[1] = ui_print_group_icon($profile["id_grupo"],true).' ' . ui_print_truncate_text(groups_get_name ($profile['id_grupo'], True), 35).''; + $data[1] = ui_print_group_icon($profile["id_grupo"], true) . + ' ' . + ui_print_truncate_text(groups_get_name ($profile['id_grupo'], True), GENERIC_SIZE_TEXT).''; $data[2] = '
'; $data[2] .= html_print_input_hidden ('delete_profile', 1, true); $data[2] .= html_print_input_hidden ('id_user_profile', $profile['id_up'], true); @@ -500,7 +502,7 @@ foreach ($result as $profile) { $data[0] = ''; if (check_acl ($config['id_user'], 0, "PM")) { $data[0] .= html_print_select (profile_get_profiles (), 'assign_profile', 0, '', - __('None'), 0, true, false, false); + __('None'), 0, true, false, false); } else { $data[0] .= html_print_select (profile_get_profiles (array ('pandora_management' => '<> 1', diff --git a/pandora_console/include/ajax/reporting.ajax.php b/pandora_console/include/ajax/reporting.ajax.php index 018251835c..db3f80342f 100644 --- a/pandora_console/include/ajax/reporting.ajax.php +++ b/pandora_console/include/ajax/reporting.ajax.php @@ -137,7 +137,7 @@ if ($get_custom_sql) { if ($truncate_text) { $text = get_parameter ('text', ''); - return ui_print_truncate_text ($text, 20, true, false); + return ui_print_truncate_text ($text, GENERIC_SIZE_TEXT, true, false); } if ($get_metaconsole_hash_data) { diff --git a/pandora_console/include/functions_groups.php b/pandora_console/include/functions_groups.php index 5ece909e0c..6cefab17bd 100644 --- a/pandora_console/include/functions_groups.php +++ b/pandora_console/include/functions_groups.php @@ -659,7 +659,7 @@ function groups_get_group_row($id_group, $group_all, $group, &$printed_groups) { echo "  "; echo $group['prefix'] . ui_print_group_icon ($id_group, true, "groups_small", 'font-size: 7.5pt'); echo " "; - echo ui_print_truncate_text($group['name'], 35); + echo ui_print_truncate_text($group['name']); echo ""; echo ""; echo ""; @@ -675,30 +675,30 @@ function groups_get_group_row($id_group, $group_all, $group, &$printed_groups) { echo ""; - //Total agent field given by function reporting_get_group_stats return the number of agents - //of this groups and its children. It was done to print empty fathers of children groups. - //We need to recalculate the total agents for this group here to get only the total agents - //for this group. Of course the group All (0) is a special case. - - $data["total_agents"]; - - if ($id_group != 0) { - $data["total_agents"] = db_get_sql ("SELECT COUNT(id_agente) FROM tagente - WHERE id_grupo = $id_group AND disabled = 0"); - } - else { - $data["total_agents"] = db_get_sql ("SELECT COUNT(id_agente) FROM tagente - WHERE disabled = 0"); - } - - echo $data["total_agents"]; - echo ""; + //Total agent field given by function reporting_get_group_stats return the number of agents + //of this groups and its children. It was done to print empty fathers of children groups. + //We need to recalculate the total agents for this group here to get only the total agents + //for this group. Of course the group All (0) is a special case. + + $data["total_agents"]; + + if ($id_group != 0) { + $data["total_agents"] = db_get_sql ("SELECT COUNT(id_agente) FROM tagente + WHERE id_grupo = $id_group AND disabled = 0"); + } + else { + $data["total_agents"] = db_get_sql ("SELECT COUNT(id_agente) FROM tagente + WHERE disabled = 0"); + } + + echo $data["total_agents"]; + echo ""; // Agents unknown if ($data["agents_unknown"] > 0) { echo ""; echo ""; + href='index.php?sec=estado&sec2=operation/agentes/estado_agente&group_id=$id_group&status=3'>"; echo $data["agents_unknown"]; echo ""; echo ""; diff --git a/pandora_console/include/functions_html.php b/pandora_console/include/functions_html.php index eb3a198fda..3e6474ec2a 100644 --- a/pandora_console/include/functions_html.php +++ b/pandora_console/include/functions_html.php @@ -228,12 +228,7 @@ function html_print_select_groups($id_user = false, $privilege = "AR", $returnAl $fields = array(); foreach ($user_groups_tree as $group) { - if (isset($config['text_char_long'])) { - $groupName = ui_print_truncate_text($group['nombre'], $config['text_char_long'], false, true, false); - } - else { - $groupName = $group['nombre']; - } + $groupName = ui_print_truncate_text($group['nombre'], GENERIC_SIZE_TEXT, false, true, false); $fields[$group['id_grupo']] = str_repeat("    ", $group['deep']) . $groupName; } @@ -401,21 +396,16 @@ function html_print_select ($fields, $name, $selected = '', $script = '', $nothi function html_print_select_from_sql ($sql, $name, $selected = '', $script = '', $nothing = '', $nothing_value = '0', $return = false, $multiple = false, $sort = true, $disabled = false, $style = false, $size = false) { global $config; - + $fields = array (); $result = db_get_all_rows_sql ($sql); if ($result === false) $result = array (); - + foreach ($result as $row) { $id = array_shift($row); $value = array_shift($row); - if (isset($config['text_char_long'])) { - $fields[$id] = ui_print_truncate_text($value, $config['text_char_long'], false, true, false); - } - else { - $fields[$id] = $value; - } + $fields[$id] = ui_print_truncate_text($value, GENERIC_SIZE_TEXT, false, true, false); } return html_print_select ($fields, $name, $selected, $script, $nothing, $nothing_value, $return, $multiple, $sort,'',$disabled, $style,'', $size); @@ -438,7 +428,7 @@ function html_print_select_from_sql ($sql, $name, $selected = '', $script = '', function html_print_extended_select_for_time ($name, $selected = '', $script = '', $nothing = '', $nothing_value = '0', $size = false, $return = false, $select_style = false) { - + $fields = get_periods(); if (($selected !== false) && (!isset($fields[$selected]) && $selected != 0)) { diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php index 02c9203a5a..ccbf99cb9e 100644 --- a/pandora_console/include/functions_reporting.php +++ b/pandora_console/include/functions_reporting.php @@ -2116,8 +2116,8 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f case 1: case 'simple_graph': reporting_header_content($mini, $content, $report, $table, __('Simple graph'), - ui_print_truncate_text($agent_name, 75, false).'
' . - ui_print_truncate_text($module_name, 75, false)); + ui_print_truncate_text($agent_name, 'agent_medium', false).'
' . + ui_print_truncate_text($module_name, 'module_medium', false)); //RUNNING $table->colspan[1][0] = 4; @@ -2140,7 +2140,8 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f break; case 'projection_graph': reporting_header_content($mini, $content, $report, $table, __('Projection graph'), - ui_print_truncate_text($agent_name, 75, false).'
' . ui_print_truncate_text($module_name, 75, false)); + ui_print_truncate_text($agent_name, 'agent_medium', false).'
' . + ui_print_truncate_text($module_name, 'module_medium', false)); //RUNNING $table->colspan[1][0] = 4; @@ -2189,8 +2190,8 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f break; case 'prediction_date': reporting_header_content($mini, $content, $report, $table, __('Prediction date'), - ui_print_truncate_text($agent_name, 75, false).'
' . - ui_print_truncate_text($module_name, 75, false)); + ui_print_truncate_text($agent_name, 'agent_medium', false).'
' . + ui_print_truncate_text($module_name, 'module_medium', false)); //RUNNING $table->colspan[1][0] = 4; @@ -2223,7 +2224,8 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f break; case 'simple_baseline_graph': reporting_header_content($mini, $content, $report, $table, __('Simple baseline graph'), - ui_print_truncate_text($agent_name, 65, false).'
' . ui_print_truncate_text($module_name, 65, false)); + ui_print_truncate_text($agent_name, 'agent_medium', false).'
' . + ui_print_truncate_text($module_name, 'module_medium', false)); //RUNNING $table->colspan[1][0] = 4; @@ -2263,7 +2265,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f $graph = db_get_row ("tgraph", "id_graph", $content['id_gs']); reporting_header_content($mini, $content, $report, $table, __('Custom graph'), - ui_print_truncate_text($graph['name'], 25, false)); + ui_print_truncate_text($graph['name'], 'item_title', false)); //RUNNING // Put description at the end of the module (if exists) @@ -2544,7 +2546,8 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f case 6: case 'monitor_report': reporting_header_content($mini, $content, $report, $table, __('Monitor report'), - ui_print_truncate_text($agent_name, 70, false).'
'.ui_print_truncate_text($module_name, 70, false)); + ui_print_truncate_text($agent_name, 'agent_medium', false) . + '
'.ui_print_truncate_text($module_name, 'module_medium', false)); //RUNNING @@ -2577,7 +2580,8 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f case 7: case 'avg_value': reporting_header_content($mini, $content, $report, $table, __('Avg. Value'), - ui_print_truncate_text($agent_name, 75, false).'
'.ui_print_truncate_text($module_name, 75, false)); + ui_print_truncate_text($agent_name, 'agent_medium', false) . + '
'.ui_print_truncate_text($module_name, 'module_medium', false)); //RUNNING @@ -2606,7 +2610,8 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f case 8: case 'max_value': reporting_header_content($mini, $content, $report, $table, __('Max. Value'), - ui_print_truncate_text($agent_name, 75, false).'
' . ui_print_truncate_text($module_name, 75, false)); + ui_print_truncate_text($agent_name, 'agent_medium', false) . + '
' . ui_print_truncate_text($module_name, 'module_medium', false)); //RUNNING @@ -2630,13 +2635,14 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f case 9: case 'min_value': reporting_header_content($mini, $content, $report, $table, __('Min. Value'), - ui_print_truncate_text($agent_name, 75, false).'
'.ui_print_truncate_text($module_name, 75, false)); + ui_print_truncate_text($agent_name, 'agent_medium', false) . + '
'.ui_print_truncate_text($module_name, 'module_medium', false)); //RUNNING // Put description at the end of the module (if exists) $table->colspan[0][0] = 2; - if ($content["description"] != ""){ + if ($content["description"] != "") { $data_desc = array(); $data_desc[0] = $content["description"]; array_push ($table->data, $data_desc); @@ -2659,7 +2665,8 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f case 10: case 'sumatory': reporting_header_content($mini, $content, $report, $table, __('Summatory'), - ui_print_truncate_text($agent_name, 75, false).'
'.ui_print_truncate_text($module_name, 75, false)); + ui_print_truncate_text($agent_name, 'agent_medium', false) . + '
' . ui_print_truncate_text($module_name, 'module_medium', false)); //RUNNING @@ -2690,7 +2697,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f case 'agent_detailed_event': case 'event_report_agent': reporting_header_content($mini, $content, $report, $table, __('Agent detailed event'), - ui_print_truncate_text(agents_get_name($content['id_agent']), 75, false)); + ui_print_truncate_text(agents_get_name($content['id_agent']), 'agent_medium', false)); //RUNNING @@ -2837,11 +2844,12 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f break; case 'event_report_module': reporting_header_content($mini, $content, $report, $table, __('Module detailed event'), - ui_print_truncate_text($agent_name, 70, false).'
' . ui_print_truncate_text($module_name, 70, false)); + ui_print_truncate_text($agent_name, 'agent_medium', false) . + '
' . ui_print_truncate_text($module_name, 'module_medium', false)); // Put description at the end of the module (if exists) $table->colspan[1][0] = 3; - if ($content["description"] != ""){ + if ($content["description"] != "") { $data_desc = array(); $data_desc[0] = $content["description"]; array_push ($table->data, $data_desc); @@ -2854,11 +2862,12 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f break; case 'alert_report_module': reporting_header_content($mini, $content, $report, $table, __('Alert report module'), - ui_print_truncate_text($agent_name, 70, false).'
'.ui_print_truncate_text($module_name, 70, false)); + ui_print_truncate_text($agent_name, 'agent_medium', false) . + '
'.ui_print_truncate_text($module_name, 'module_medium', false)); // Put description at the end of the module (if exists) $table->colspan[1][0] = 3; - if ($content["description"] != ""){ + if ($content["description"] != "") { $data_desc = array(); $data_desc[0] = $content["description"]; array_push ($table->data, $data_desc); @@ -2871,7 +2880,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f break; case 'alert_report_agent': reporting_header_content($mini, $content, $report, $table, __('Alert report agent'), - ui_print_truncate_text($agent_name, 70, false)); + ui_print_truncate_text($agent_name, 'agent_medium', false)); // Put description at the end of the module (if exists) $table->colspan[1][0] = 3; @@ -2888,11 +2897,11 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f break; case 'url': reporting_header_content($mini, $content, $report, $table, __('Import text from URL'), - ui_print_truncate_text($content["external_source"], 70, false)); + ui_print_truncate_text($content["external_source"], 'description', false)); // Put description at the end of the module (if exists) $table->colspan[1][0] = 3; - if ($content["description"] != ""){ + if ($content["description"] != "") { $data_desc = array(); $data_desc[0] = $content["description"]; array_push ($table->data, $data_desc); @@ -2910,7 +2919,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f break; case 'database_serialized': reporting_header_content($mini, $content, $report, $table, __('Serialize data'), - ui_print_truncate_text($module_name, 75, false)); + ui_print_truncate_text($module_name, 'module_medium', false)); // Put description at the end of the module (if exists) $table->colspan[1][0] = 3; @@ -2931,7 +2940,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f array_unshift($table2->head, __('Date')); $datelimit = $report["datetime"] - $content['period']; - + $result = db_get_all_rows_sql('SELECT * FROM tagente_datos WHERE id_agente_modulo = ' . $content['id_agent_module'] . ' @@ -2968,11 +2977,12 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f break; case 'TTRT': reporting_header_content($mini, $content, $report, $table, __('TTRT'), - ui_print_truncate_text($agent_name, 70, false).'
'.ui_print_truncate_text($module_name, 70, false)); + ui_print_truncate_text($agent_name, 'agent_medium', false) . + '
'.ui_print_truncate_text($module_name, 'module_medium', false)); // Put description at the end of the module (if exists) $table->colspan[1][0] = 3; - if ($content["description"] != ""){ + if ($content["description"] != "") { $data_desc = array(); $data_desc[0] = $content["description"]; array_push ($table->data, $data_desc); @@ -2983,7 +2993,8 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f $ttr = reporting_get_agentmodule_ttr ($content['id_agent_module'], $content['period'], $report["datetime"]); if ($ttr === false) { $ttr = __('Unknown'); - } else if ($ttr != 0) { + } + else if ($ttr != 0) { $ttr = human_time_description_raw ($ttr); } @@ -2994,11 +3005,12 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f break; case 'TTO': reporting_header_content($mini, $content, $report, $table, __('TTO'), - ui_print_truncate_text($agent_name, 70, false).'
'.ui_print_truncate_text($module_name, 70, false)); + ui_print_truncate_text($agent_name, 'agent_medium', false) . + '
'.ui_print_truncate_text($module_name, 'module_medium', false)); // Put description at the end of the module (if exists) $table->colspan[1][0] = 3; - if ($content["description"] != ""){ + if ($content["description"] != "") { $data_desc = array(); $data_desc[0] = $content["description"]; array_push ($table->data, $data_desc); @@ -3009,7 +3021,8 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f $tto = reporting_get_agentmodule_tto ($content['id_agent_module'], $content['period'], $report["datetime"]); if ($tto === false) { $tto = __('Unknown'); - } else if ($tto != 0) { + } + else if ($tto != 0) { $tto = human_time_description_raw ($tto); } @@ -3020,7 +3033,8 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f break; case 'MTBF': reporting_header_content($mini, $content, $report, $table, __('MTBF'), - ui_print_truncate_text($agent_name, 70, false).'
'.ui_print_truncate_text($module_name, 70, false)); + ui_print_truncate_text($agent_name, 'agent_medium', false) . + '
'.ui_print_truncate_text($module_name, 'module_medium', false)); // Put description at the end of the module (if exists) $table->colspan[1][0] = 3; @@ -3035,7 +3049,8 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f $mtbf = reporting_get_agentmodule_mtbf ($content['id_agent_module'], $content['period'], $report["datetime"]); if ($mtbf === false) { $mtbf = __('Unknown'); - } else if ($mtbf != 0) { + } + else if ($mtbf != 0) { $mtbf = human_time_description_raw ($mtbf); } @@ -3046,11 +3061,12 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f break; case 'MTTR': reporting_header_content($mini, $content, $report, $table, __('MTTR'), - ui_print_truncate_text($agent_name, 70, false).'
'.ui_print_truncate_text($module_name, 70, false)); + ui_print_truncate_text($agent_name, 'agent_medium', false) . + '
'.ui_print_truncate_text($module_name, 'module_medium', false)); // Put description at the end of the module (if exists) $table->colspan[1][0] = 3; - if ($content["description"] != ""){ + if ($content["description"] != "") { $data_desc = array(); $data_desc[0] = $content["description"]; array_push ($table->data, $data_desc); @@ -3061,7 +3077,8 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f $mttr = reporting_get_agentmodule_mttr ($content['id_agent_module'], $content['period'], $report["datetime"]); if ($mttr === false) { $mttr = __('Unknown'); - } else if ($mttr != 0) { + } + else if ($mttr != 0) { $mttr = human_time_description_raw ($mttr); } @@ -3348,7 +3365,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f metaconsole_restore_db(); } } - + $table2->width = '99%'; $table2->data = array (); $table2->head = array (); @@ -3362,7 +3379,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f $i++; $x++; } - + foreach ($agent_list as $a) { $data = array(); $data[0] = $a; @@ -4141,25 +4158,25 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f break; } $table_data = ''; - + $table_data .= ""; - + $nmodules = 0; - foreach($modules_by_name as $module) { + foreach ($modules_by_name as $module) { $nmodules++; if($nmodules > $block) { //Will show only the (block) first modules continue; } - $file_name = string2image(ui_print_truncate_text($module['name'], 30, false, true, false, '...'), false, false, 6, 270, '#90B165', 'FFF', 4, 0); - $table_data .= '"; + $file_name = string2image(ui_print_truncate_text($module['name'], 'module_small', false, true, false, '...'), false, false, 6, 270, '#90B165', 'FFF', 4, 0); + $table_data .= '"; } if ($block < $nmodules) { $table_data .= ""; } - + $filter_agents = false; if($id_group > 0) { $filter_agents = array('id_grupo' => $id_group); @@ -4167,11 +4184,11 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f // Prepare pagination ui_pagination ((int)count(agents_get_agents ($filter_agents))); $table_data .= "
"; - + foreach ($agents as $agent) { // Get stats for this group $agent_status = agents_get_status($agent['id_agente']); - + switch($agent_status) { case 4: // Alert fired status $rowcolor = '#ffa300'; @@ -4199,28 +4216,28 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f $table_data .= ""; - $file_name = string2image(ui_print_truncate_text($agent['nombre'], 35, false, true, false, '...'), false, false, 6, 0, $rowcolor, $textcolor, 4, 0); + $file_name = string2image(ui_print_truncate_text($agent['nombre'], 'agent_small', false, true, false, '...'), false, false, 6, 0, $rowcolor, $textcolor, 4, 0); $table_data .= ""; $agent_modules = agents_get_modules($agent['id_agente']); $nmodules = 0; - - foreach($modules_by_name as $module) { + + foreach ($modules_by_name as $module) { $nmodules++; - if($nmodules > $block) { + if ($nmodules > $block) { continue; } $match = false; foreach($module['id'] as $module_id){ - if(!$match && array_key_exists($module_id,$agent_modules)) { + if (!$match && array_key_exists($module_id,$agent_modules)) { $status = modules_get_agentmodule_status($module_id); $table_data .= ""; } else{ diff --git a/pandora_console/operation/agentes/status_monitor.php b/pandora_console/operation/agentes/status_monitor.php index 316c99521f..8c66d188ad 100644 --- a/pandora_console/operation/agentes/status_monitor.php +++ b/pandora_console/operation/agentes/status_monitor.php @@ -573,12 +573,12 @@ foreach ($result as $row) { } $data[1] = ''; - $data[1] .= ui_print_truncate_text($row["agent_name"], 40, false, true, false, '[…]', 'font-size:7.5pt;'); + $data[1] .= ui_print_truncate_text($row["agent_name"], 'agent_medium', false, true, false, '[…]', 'font-size:7.5pt;'); $data[1] .= ''; $data[2] = html_print_image("images/" . modules_show_icon_type ($row["module_type"]), true); - $data[3] = ui_print_truncate_text($row["module_name"],30,false,true,true); + $data[3] = ui_print_truncate_text($row["module_name"], 'module_small', false, true, true); if ($row["extended_info"] != "") { $data[3] .= ui_print_help_tip ($row["extended_info"], true, '/images/comments.png'); } diff --git a/pandora_console/operation/agentes/ver_agente.php b/pandora_console/operation/agentes/ver_agente.php index 933b7788ab..872dd53444 100644 --- a/pandora_console/operation/agentes/ver_agente.php +++ b/pandora_console/operation/agentes/ver_agente.php @@ -342,7 +342,7 @@ if (is_ajax ()) { echo '
    '; foreach ($bad_modules as $module) { echo '
  • '; - echo ui_print_truncate_text($module['nombre']); + echo ui_print_truncate_text($module['nombre'], 'module_small'); echo '
  • '; } echo '
'; @@ -389,7 +389,7 @@ if (is_ajax ()) { $module = db_get_row ('tagente_modulo', 'id_agente_modulo', $id_module); echo '

'; echo html_print_image("images/brick.png", true) . ' '; - echo ui_print_truncate_text($module['nombre'], 25, false, true, false).'

'; + echo ui_print_truncate_text($module['nombre'], 'module_small', false, true, false).''; echo ''.__('Type').': '; $agentmoduletype = modules_get_agentmodule_type ($module['id_agente_modulo']); echo modules_get_moduletype_name ($agentmoduletype).' '; @@ -403,7 +403,7 @@ if (is_ajax ()) { echo $modulegroup.'
'; } echo ''.__('Agent').': '; - echo ui_print_truncate_text(modules_get_agentmodule_agent_name($module['id_agente_modulo']), 25, false, true, false).'
'; + echo ui_print_truncate_text(modules_get_agentmodule_agent_name($module['id_agente_modulo']), 'agent_small', false, true, false).'
'; if($module['id_tipo_modulo'] == 18) { echo ''.__('Address').': '; @@ -432,7 +432,7 @@ if (is_ajax ()) { $id_group = (int) get_parameter ('id_group'); $group = db_get_row ('tgrupo', 'id_grupo', $id_group); echo '

' . html_print_image("images/groups_small/" . groups_get_icon ($group['id_grupo']) . ".png", true); - echo ui_print_truncate_text($group['nombre'], 25, false, true, false) . '

'; + echo ui_print_truncate_text($group['nombre'], GENERIC_SIZE_TEXT, false, true, false) . ''; echo ''.__('Parent').': '; if ($group['parent'] == 0) { echo __('None').'
'; @@ -759,7 +759,9 @@ switch($tab) { break; } -ui_print_page_header(__('Agent') . ' - ' . ui_print_truncate_text(agents_get_name($id_agente),25, false) . $header_description, $icon, false, "", false, $onheader); +ui_print_page_header(__('Agent') . ' - ' . + ui_print_truncate_text(agents_get_name($id_agente), 'agent_small', false) . + $header_description, $icon, false, "", false, $onheader); switch ($tab) { diff --git a/pandora_console/operation/incidents/incident.php b/pandora_console/operation/incidents/incident.php index 3233a41078..424ac150dd 100755 --- a/pandora_console/operation/incidents/incident.php +++ b/pandora_console/operation/incidents/incident.php @@ -333,7 +333,7 @@ if ($count < 1) { $data[1] = incidents_print_status_img ($row["estado"], true); $data[2] = '' . - ui_print_truncate_text(io_safe_output($row["titulo"]),45).''; + ui_print_truncate_text(io_safe_output($row["titulo"]), 'item_title').''; $data[3] = incidents_print_priority_img ($row["prioridad"], true); $data[4] = ui_print_group_icon ($row["id_grupo"], true); $data[5] = ui_print_timestamp ($row["actualizacion"], true); diff --git a/pandora_console/operation/incidents/incident_detail.php b/pandora_console/operation/incidents/incident_detail.php index e372e26b80..8e0052fc5a 100755 --- a/pandora_console/operation/incidents/incident_detail.php +++ b/pandora_console/operation/incidents/incident_detail.php @@ -185,7 +185,7 @@ elseif (isset ($_GET["insert_form"])) { if (isset ($_GET["from_event"])) { $event = get_parameter ("from_event"); $texto = io_safe_output(events_get_description ($event)); - $titulo = ui_print_truncate_text(events_get_description ($event), 75, false, true, false); + $titulo = ui_print_truncate_text(events_get_description ($event), 'description', false, true, false); $id_grupo = events_get_group ($event); $origen = "Pandora FMS Event"; unset ($event); diff --git a/pandora_console/operation/integria_incidents/incident.incident.php b/pandora_console/operation/integria_incidents/incident.incident.php index 75f514a032..021d1ed4af 100644 --- a/pandora_console/operation/integria_incidents/incident.incident.php +++ b/pandora_console/operation/integria_incidents/incident.incident.php @@ -73,7 +73,7 @@ if(!isset($result['id_incidencia'])) { if (isset ($_GET["from_event"])) { $event = get_parameter ("from_event"); $result['descripcion'] = io_safe_output(events_get_description ($event)); - $result['titulo'] = ui_print_truncate_text($result['descripcion'], 75, false, true, false); + $result['titulo'] = ui_print_truncate_text($result['descripcion'], 'description', false, true, false); unset ($event); } } diff --git a/pandora_console/operation/snmpconsole/snmp_view.php b/pandora_console/operation/snmpconsole/snmp_view.php index 18f8d5d4a8..0a9c163006 100644 --- a/pandora_console/operation/snmpconsole/snmp_view.php +++ b/pandora_console/operation/snmpconsole/snmp_view.php @@ -476,7 +476,7 @@ if ($traps !== false) { $data[3] = __('N/A'); } else { - $data[3] = ui_print_truncate_text($trap["value"], 15, false); + $data[3] = ui_print_truncate_text($trap["value"], GENERIC_SIZE_TEXT, false); } //Custom @@ -484,7 +484,7 @@ if ($traps !== false) { $data[4] = __('N/A'); } else { - $data[4] = ui_print_truncate_text($trap["oid_custom"], 25, false); + $data[4] = ui_print_truncate_text($trap["oid_custom"], GENERIC_SIZE_TEXT, false); } //User
".__("Agents")." / ".__("Modules")."'.html_print_image($file_name, true, array('title' => $module['name']))."' . html_print_image($file_name, true, array('title' => $module['name']))."...
".html_print_image($file_name, true, array('title' => $agent['nombre'])).""; $win_handle = dechex(crc32($module_id.$module["name"])); $graph_type = return_graphtype (modules_get_agentmodule_type($module_id)); - - switch($status){ + + switch ($status) { case 0: $table_data .= ui_print_status_image ('module_ok.png', $module['name']." in ".$agent['nombre'].": ".__('NORMAL'), true, array('width' => '20px', 'height' => '20px')); break; diff --git a/pandora_console/include/functions_ui.php b/pandora_console/include/functions_ui.php index 3dec433d08..261c5c8f12 100644 --- a/pandora_console/include/functions_ui.php +++ b/pandora_console/include/functions_ui.php @@ -716,7 +716,7 @@ function ui_format_alert_row ($alert, $compound = false, $agent = true, $url = ' } elseif ($agent == 0) { $data[$index['module_name']] .= - ui_print_truncate_text(modules_get_agentmodule_name ($alert["id_agent_module"]), 30, false, true, true, '[…]', 'font-size: 7.2pt'); + ui_print_truncate_text(modules_get_agentmodule_name ($alert["id_agent_module"]), 'module_small', false, true, true, '[…]', 'font-size: 7.2pt'); } else { if ($agent_style !== false) { @@ -726,7 +726,7 @@ function ui_format_alert_row ($alert, $compound = false, $agent = true, $url = ' $data[$index['agent_name']] .= ui_print_agent_name (modules_get_agentmodule_agent ($alert["id_agent_module"]), true, 20, $styleDisabled); } $data[$index['module_name']] = - ui_print_truncate_text (modules_get_agentmodule_name ($alert["id_agent_module"]), 30, false, true, true, '[…]', 'font-size: 7.2pt'); + ui_print_truncate_text (modules_get_agentmodule_name ($alert["id_agent_module"]), 'module_small', false, true, true, '[…]', 'font-size: 7.2pt'); } $data[$index['agent_name']] .= $disabledHtmlEnd; @@ -741,7 +741,9 @@ function ui_format_alert_row ($alert, $compound = false, $agent = true, $url = ' else { $actionDefault = db_get_value_sql("SELECT id_alert_action FROM talert_compound_actions WHERE id_alert_compound = " . $alert['id']); } - $data[$index['description']] .= $disabledHtmlStart . ui_print_truncate_text (io_safe_output($description), 35, false, true, true, '[…]', 'font-size: 7.1pt') . $disabledHtmlEnd; + $data[$index['description']] .= $disabledHtmlStart . + ui_print_truncate_text (io_safe_output($description), 'description', false, true, true, '[…]', 'font-size: 7.1pt') . + $disabledHtmlEnd; $actions = alerts_get_alert_agent_module_actions ($alert['id'], false, $compound); @@ -772,10 +774,12 @@ function ui_format_alert_row ($alert, $compound = false, $agent = true, $url = ' if ($alert["times_fired"] > 0) { $status = STATUS_ALERT_FIRED; $title = __('Alert fired').' '.$alert["times_fired"].' '.__('times'); - } elseif ($alert["disabled"] > 0) { + } + elseif ($alert["disabled"] > 0) { $status = STATUS_ALERT_DISABLED; $title = __('Alert disabled'); - } else { + } + else { $status = STATUS_ALERT_NOT_FIRED; $title = __('Alert not fired'); } diff --git a/pandora_console/include/functions_visual_map.php b/pandora_console/include/functions_visual_map.php index 9baa79b545..97977d5b2e 100644 --- a/pandora_console/include/functions_visual_map.php +++ b/pandora_console/include/functions_visual_map.php @@ -513,16 +513,16 @@ function visual_map_process_wizard_add_modules ($id_modules, $image, $id_layout, switch ($label_type) { case 'agent_module': default: - $agent_label = ui_print_truncate_text(agents_get_name ($id_agent), 10, false, true, false, '…', false); - $module_label = ui_print_truncate_text(modules_get_agentmodule_name($id_module), 10, false, true, false, '…', false); + $agent_label = ui_print_truncate_text(agents_get_name ($id_agent), 'agent_small', false, true, false, '…', false); + $module_label = ui_print_truncate_text(modules_get_agentmodule_name($id_module), 'module_small', false, true, false, '…', false); $label = $agent_label . " - " . $module_label; break; case 'module': - $module_label = ui_print_truncate_text(modules_get_agentmodule_name($id_module), 20, false, true, false, '…', false); + $module_label = ui_print_truncate_text(modules_get_agentmodule_name($id_module), 'module_small', false, true, false, '…', false); $label = $module_label; break; case 'agent': - $agent_label = ui_print_truncate_text(agents_get_name ($id_agent), 20, false, true, false, '…', false); + $agent_label = ui_print_truncate_text(agents_get_name ($id_agent), 'agent_small', false, true, false, '…', false); $label = $agent_label; break; case 'none': @@ -1514,11 +1514,11 @@ function visual_map_create_internal_name_item($label = null, $type, $image, $age } if (!empty($agent)) { - $text .= " (" . ui_print_truncate_text($agent, 10, false); + $text .= " (" . ui_print_truncate_text($agent, 'agent_small', false); $moduleName = io_safe_output(db_get_value('nombre', 'tagente_modulo', 'id_agente_modulo', $id_module)); if (!empty($moduleName)) { - $text .= " - " . ui_print_truncate_text($moduleName, 10, false); + $text .= " - " . ui_print_truncate_text($moduleName, 'module_small', false); } $text .= ")"; diff --git a/pandora_console/mobile/operation/agents/monitor_status.php b/pandora_console/mobile/operation/agents/monitor_status.php index 09ecacec12..8705353565 100644 --- a/pandora_console/mobile/operation/agents/monitor_status.php +++ b/pandora_console/mobile/operation/agents/monitor_status.php @@ -217,9 +217,9 @@ class MonitorStatus { $data[] = str_replace('' . - ui_print_truncate_text($row['agent_name'], 25, true, true) . ''; + ui_print_truncate_text($row['agent_name'], 'agent_small', true, true) . ''; $data[] = '' . - ui_print_truncate_text($row['module_name'], 25, true, true) . ''; + ui_print_truncate_text($row['module_name'], 'module_small', true, true) . ''; if (is_numeric($row["datos"])) $data[] = format_numeric($row["datos"]); else diff --git a/pandora_console/mobile/operation/agents/view_agents.php b/pandora_console/mobile/operation/agents/view_agents.php index d1665ca7eb..f345719525 100644 --- a/pandora_console/mobile/operation/agents/view_agents.php +++ b/pandora_console/mobile/operation/agents/view_agents.php @@ -108,7 +108,7 @@ class ViewAgents { $data = array(); - $truncName = ui_print_truncate_text($agent['nombre'], 25, true, true); + $truncName = ui_print_truncate_text($agent['nombre'], 'agent_small', true, true); $data[] = ui_print_group_icon_path($agent["id_grupo"], true, "../images/groups_small", '', false); $data[] = '' . $truncName . ''; @@ -240,7 +240,7 @@ class ViewAgent { $data = array(); $data[] = '' . - ui_print_truncate_text($module["nombre"], 20, true, true) . ''; + ui_print_truncate_text($module["nombre"], 'module_small', true, true) . ''; $status = STATUS_MODULE_WARNING; $title = ""; @@ -347,10 +347,10 @@ class ViewAgent { $data = array(); - $data[] = ui_print_truncate_text(modules_get_agentmodule_name($alert["id_agent_module"]), 20, true, true); + $data[] = ui_print_truncate_text(modules_get_agentmodule_name($alert["id_agent_module"]), 'module_small', true, true); $template = io_safe_output(alerts_get_alert_template ($alert['id_alert_template'])); - $data[] = ui_print_truncate_text(io_safe_output($template['name']), 20, true, true); + $data[] = ui_print_truncate_text(io_safe_output($template['name']), GENERIC_SIZE_TEXT, true, true); $data[] = ui_print_timestamp ($alert["last_fired"], true, array('units' => 'tiny')); @@ -408,7 +408,7 @@ class viewGraph { echo "

" . modules_get_agentmodule_agent_name($this->idAgentModule)." / ".io_safe_output($this->agentModule['nombre']) . "

"; echo "

" . __('Graph') . "

"; - + echo grafico_modulo_sparse($this->idAgentModule, $this->period, 0, 240, 200, io_safe_output($this->agentModule['nombre']), null, false, false, true, 0, '', true, false, true, true, '../'); @@ -524,7 +524,7 @@ class viewGraph { $pagination = ui_pagination ($count, ui_get_url_refresh (array ('period' => $this->period)), 0, 0, true); - + $pagination = str_replace('images/go_first.png', '../images/go_first.png', $pagination); $pagination = str_replace('images/go_previous.png', '../images/go_previous.png', $pagination); $pagination = str_replace('images/go_next.png', '../images/go_next.png', $pagination); diff --git a/pandora_console/mobile/operation/agents/view_alerts.php b/pandora_console/mobile/operation/agents/view_alerts.php index 922d80586d..d5a4ce5126 100644 --- a/pandora_console/mobile/operation/agents/view_alerts.php +++ b/pandora_console/mobile/operation/agents/view_alerts.php @@ -64,10 +64,11 @@ class ViewAlerts { $data = array(); $idAgent = modules_get_agentmodule_agent($alert["id_agent_module"]); - - $data[] = '' . ui_print_truncate_text(modules_get_agentmodule_name($alert["id_agent_module"]), 20, true, true) . ''; + + $data[] = '' . + ui_print_truncate_text(modules_get_agentmodule_name($alert["id_agent_module"]), 'module_small', true, true) . ''; $template = io_safe_output(alerts_get_alert_template ($alert['id_alert_template'])); - $data[] = ui_print_truncate_text(io_safe_output($template['name']), 20, true, true); + $data[] = ui_print_truncate_text(io_safe_output($template['name']), GENERIC_SIZE_TEXT, true, true); $data[] = ui_print_timestamp ($alert["last_fired"], true, array('units' => 'tiny')); $status = STATUS_ALERT_NOT_FIRED; diff --git a/pandora_console/mobile/operation/events/events.php b/pandora_console/mobile/operation/events/events.php index 31998a7a6d..f6f672c88d 100644 --- a/pandora_console/mobile/operation/events/events.php +++ b/pandora_console/mobile/operation/events/events.php @@ -26,7 +26,7 @@ class EventsView { function show() { global $config; - + require_once ($config['homedir'].'/include/functions_agents.php'); $config['text_char_long'] = 12; @@ -107,14 +107,9 @@ class EventsView { $sqlFreeSearch = ''; if ($search != "") $sqlFreeSearch .= " AND evento LIKE '%".$search."%'"; - - - + $unixtime = get_system_time () - ($event_view_hr * 3600); //Put hours in seconds $sqlTimestamp = " AND utimestamp > ".$unixtime; - - - $sql = 'SELECT * FROM tevento @@ -178,20 +173,21 @@ class EventsView { $table->rowclass[$iterator] = get_priority_class($row["criticity"]); $iterator++; - + $data[] = ui_print_timestamp($row["timestamp"], true, array('units' => 'tiny')); - + $data[] = $row["evento"]; if ($row["event_type"] == "system") { - $data[] = ui_print_truncate_text(__('System'), 20, true, true); + $data[] = ui_print_truncate_text(__('System'), GENERIC_SIZE_TEXT, true, true); } elseif ($row["id_agente"] > 0) { // Agent name - $data[] = '' . ui_print_truncate_text(agents_get_name($row["id_agente"]), 20, true, true) . ''; + $data[] = '' . + ui_print_truncate_text(agents_get_name($row["id_agente"]), 'agent_small', true, true) . ''; } else { - $data[] = ui_print_truncate_text(__('Alert SNMP'), 20, true, true); + $data[] = ui_print_truncate_text(__('Alert SNMP'), GENERIC_SIZE_TEXT, true, true); } $table->data[] = $data; diff --git a/pandora_console/operation/agentes/estado_agente.php b/pandora_console/operation/agentes/estado_agente.php index 56e828cbbc..88a8e67db6 100644 --- a/pandora_console/operation/agentes/estado_agente.php +++ b/pandora_console/operation/agentes/estado_agente.php @@ -476,7 +476,7 @@ foreach ($agents as $agent) { $data[0] .= ' '; }*/ - $data[1] = ui_print_truncate_text($agent["description"], 50, false, true, true, '[…]', 'font-size: 6.5pt'); + $data[1] = ui_print_truncate_text($agent["description"], 'description', false, true, true, '[…]', 'font-size: 6.5pt'); $data[2] = ui_print_os_icon ($agent["id_os"], false, true); diff --git a/pandora_console/operation/agentes/estado_ultimopaquete.php b/pandora_console/operation/agentes/estado_ultimopaquete.php index 3e0b1cecc4..a8665371be 100644 --- a/pandora_console/operation/agentes/estado_ultimopaquete.php +++ b/pandora_console/operation/agentes/estado_ultimopaquete.php @@ -420,7 +420,7 @@ foreach ($modules as $module) { AND ($module["id_tipo_modulo"] != 17) AND ($module["id_tipo_modulo"] != 23)) { echo "
"; - echo ui_print_truncate_text(io_safe_output($module["descripcion"]), 35, false); + echo ui_print_truncate_text(io_safe_output($module["descripcion"]), 'description', false); echo "