Fixed visual styles ticket 4809

This commit is contained in:
manuel 2019-11-06 10:31:26 +01:00
parent 868bba07b0
commit a486738920
3 changed files with 114 additions and 45 deletions

View File

@ -14,7 +14,7 @@
// Load global vars // Load global vars
check_login(); check_login();
// Take some parameters (GET) // Take some parameters (GET).
$offset = (int) get_parameter('offset'); $offset = (int) get_parameter('offset');
$group_id = (int) get_parameter('group_id'); $group_id = (int) get_parameter('group_id');
$ag_group = get_parameter('ag_group_refresh', -1); $ag_group = get_parameter('ag_group_refresh', -1);
@ -47,10 +47,10 @@ require_once 'include/functions_users.php';
$search = get_parameter('search', ''); $search = get_parameter('search', '');
// Prepare the tab system to the future // Prepare the tab system to the future.
$tab = 'view'; $tab = 'view';
// Setup tab // Setup tab.
$viewtab['text'] = '<a href="index.php?sec=estado&sec2=operation/agentes/estado_agente">'.html_print_image('images/operation.png', true, ['title' => __('View')]).'</a>'; $viewtab['text'] = '<a href="index.php?sec=estado&sec2=operation/agentes/estado_agente">'.html_print_image('images/operation.png', true, ['title' => __('View')]).'</a>';
$viewtab['operation'] = true; $viewtab['operation'] = true;
@ -59,10 +59,10 @@ $viewtab['active'] = false;
$onheader = ['view' => $viewtab]; $onheader = ['view' => $viewtab];
// Header // Header.
ui_print_page_header(__('Agents defined in %s', get_product_name()), 'images/agent_mc.png', false, '', true, $onheader); ui_print_page_header(__('Agents defined in %s', get_product_name()), 'images/agent_mc.png', false, '', true, $onheader);
// Perform actions // Perform actions.
$agent_to_delete = (int) get_parameter('borrar_agente'); $agent_to_delete = (int) get_parameter('borrar_agente');
$enable_agent = (int) get_parameter('enable_agent'); $enable_agent = (int) get_parameter('enable_agent');
$disable_agent = (int) get_parameter('disable_agent'); $disable_agent = (int) get_parameter('disable_agent');
@ -99,7 +99,7 @@ if ($agent_to_delete) {
ui_print_result_message($result, __('Success deleted agent.'), __('Could not be deleted.')); ui_print_result_message($result, __('Success deleted agent.'), __('Could not be deleted.'));
if (enterprise_installed()) { if (enterprise_installed()) {
// Check if the remote config file still exist // Check if the remote config file still exist.
if (isset($config['remote_config'])) { if (isset($config['remote_config'])) {
enterprise_include_once('include/functions_config_agents.php'); enterprise_include_once('include/functions_config_agents.php');
if (enterprise_hook('config_agents_has_remote_configuration', [$id_agente])) { if (enterprise_hook('config_agents_has_remote_configuration', [$id_agente])) {
@ -114,7 +114,7 @@ if ($enable_agent) {
$alias = agents_get_alias($enable_agent); $alias = agents_get_alias($enable_agent);
if ($result) { if ($result) {
// Update the agent from the metaconsole cache // Update the agent from the metaconsole cache.
enterprise_include_once('include/functions_agents.php'); enterprise_include_once('include/functions_agents.php');
$values = ['disabled' => 0]; $values = ['disabled' => 0];
enterprise_hook('agent_update_from_cache', [$enable_agent, $values, $server_name]); enterprise_hook('agent_update_from_cache', [$enable_agent, $values, $server_name]);
@ -136,7 +136,7 @@ if ($disable_agent) {
$alias = agents_get_alias($disable_agent); $alias = agents_get_alias($disable_agent);
if ($result) { if ($result) {
// Update the agent from the metaconsole cache // Update the agent from the metaconsole cache.
enterprise_include_once('include/functions_agents.php'); enterprise_include_once('include/functions_agents.php');
$values = ['disabled' => 1]; $values = ['disabled' => 1];
enterprise_hook('agent_update_from_cache', [$disable_agent, $values, $server_name]); enterprise_hook('agent_update_from_cache', [$disable_agent, $values, $server_name]);
@ -223,6 +223,10 @@ switch ($config['dbtype']) {
case 'oracle': case 'oracle':
$order_collation = ''; $order_collation = '';
break; break;
default:
// Default.
break;
} }
$selected = true; $selected = true;
@ -252,6 +256,10 @@ switch ($sortField) {
'order' => 'DESC', 'order' => 'DESC',
]; ];
break; break;
default:
// Default.
break;
} }
break; break;
@ -274,6 +282,10 @@ switch ($sortField) {
'order' => 'DESC', 'order' => 'DESC',
]; ];
break; break;
default:
// Default.
break;
} }
break; break;
@ -296,6 +308,10 @@ switch ($sortField) {
'order' => 'DESC', 'order' => 'DESC',
]; ];
break; break;
default:
// Default.
break;
} }
break; break;
@ -318,6 +334,10 @@ switch ($sortField) {
'order' => 'DESC', 'order' => 'DESC',
]; ];
break; break;
default:
// Default.
break;
} }
break; break;
@ -378,7 +398,7 @@ if ($os != 0) {
} }
$user_groups_to_sql = ''; $user_groups_to_sql = '';
// Show only selected groups // Show only selected groups.
if ($ag_group > 0) { if ($ag_group > 0) {
$ag_groups = []; $ag_groups = [];
$ag_groups = (array) $ag_group; $ag_groups = (array) $ag_group;
@ -388,7 +408,7 @@ if ($ag_group > 0) {
$user_groups_to_sql = implode(',', $ag_groups); $user_groups_to_sql = implode(',', $ag_groups);
} else { } else {
// Concatenate AW and AD permisions to get all the possible groups where the user can manage // Concatenate AW and AD permisions to get all the possible groups where the user can manage.
$user_groupsAW = users_get_groups($config['id_user'], 'AW'); $user_groupsAW = users_get_groups($config['id_user'], 'AW');
$user_groupsAD = users_get_groups($config['id_user'], 'AD'); $user_groupsAD = users_get_groups($config['id_user'], 'AD');
@ -431,24 +451,25 @@ $sql = sprintf(
$agents = db_get_all_rows_sql($sql); $agents = db_get_all_rows_sql($sql);
// Delete rnum row generated by oracle_recode_query() function // Delete rnum row generated by oracle_recode_query() function.
if (($config['dbtype'] == 'oracle') && ($agents !== false)) { if (($config['dbtype'] == 'oracle') && ($agents !== false)) {
for ($i = 0; $i < count($agents); $i++) { for ($i = 0; $i < count($agents); $i++) {
unset($agents[$i]['rnum']); unset($agents[$i]['rnum']);
} }
} }
// Prepare pagination // Prepare pagination.
ui_pagination($total_agents, "index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id=$ag_group&recursion=$recursion&search=$search&sort_field=$sortField&sort=$sort&disabled=$disabled&os=$os", $offset); ui_pagination($total_agents, "index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id=$ag_group&recursion=$recursion&search=$search&sort_field=$sortField&sort=$sort&disabled=$disabled&os=$os", $offset);
if ($agents !== false) { if ($agents !== false) {
// Urls to sort the table. // Urls to sort the table.
// Agent name size and description for Chinese and Japanese languages are adjusted if ($config['language'] == 'ja'
$agent_font_size = '7'; || $config['language'] == 'zh_CN'
$description_font_size = '6.5'; || $own_info['language'] == 'ja'
if ($config['language'] == 'ja' || $config['language'] == 'zh_CN' || $own_info['language'] == 'ja' || $own_info['language'] == 'zh_CN') { || $own_info['language'] == 'zh_CN'
$agent_font_size = '15'; ) {
$description_font_size = '11'; // Adds a custom font size for Japanese and Chinese language.
$custom_font_size = 'custom_font_size';
} }
$url_up_agente = 'index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id='.$ag_group.'&recursion='.$recursion.'&search='.$search.'&os='.$os.'&offset='.$offset.'&sort_field=name&sort=up&disabled=$disabled'; $url_up_agente = 'index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id='.$ag_group.'&recursion='.$recursion.'&search='.$search.'&os='.$os.'&offset='.$offset.'&sort_field=name&sort=up&disabled=$disabled';
@ -476,21 +497,21 @@ if ($agents !== false) {
$rowPair = true; $rowPair = true;
$iterator = 0; $iterator = 0;
foreach ($agents as $agent) { foreach ($agents as $agent) {
// Begin Update tagente.remote 0/1 with remote agent function return // Begin Update tagente.remote 0/1 with remote agent function return.
if (enterprise_hook('config_agents_has_remote_configuration', [$agent['id_agente']])) { if (enterprise_hook('config_agents_has_remote_configuration', [$agent['id_agente']])) {
db_process_sql_update('tagente', ['remote' => 1], 'id_agente = '.$agent['id_agente'].''); db_process_sql_update('tagente', ['remote' => 1], 'id_agente = '.$agent['id_agente'].'');
} else { } else {
db_process_sql_update('tagente', ['remote' => 0], 'id_agente = '.$agent['id_agente'].''); db_process_sql_update('tagente', ['remote' => 0], 'id_agente = '.$agent['id_agente'].'');
} }
// End Update tagente.remote 0/1 with remote agent function return // End Update tagente.remote 0/1 with remote agent function return.
$all_groups = agents_get_all_groups_agent($agent['id_agente'], $agent['id_grupo']); $all_groups = agents_get_all_groups_agent($agent['id_agente'], $agent['id_grupo']);
$check_aw = check_acl_one_of_groups($config['id_user'], $all_groups, 'AW'); $check_aw = check_acl_one_of_groups($config['id_user'], $all_groups, 'AW');
$check_ad = check_acl_one_of_groups($config['id_user'], $all_groups, 'AD'); $check_ad = check_acl_one_of_groups($config['id_user'], $all_groups, 'AD');
$cluster = db_get_row_sql('select id from tcluster where id_agent = '.$agent['id_agente']); $cluster = db_get_row_sql('select id from tcluster where id_agent = '.$agent['id_agente']);
// Do not show the agent if there is not enough permissions // Do not show the agent if there is not enough permissions.
if (!$check_aw && !$check_ad) { if (!$check_aw && !$check_ad) {
continue; continue;
} }
@ -512,7 +533,7 @@ if ($agents !== false) {
$rowPair = !$rowPair; $rowPair = !$rowPair;
$iterator++; $iterator++;
// Agent name // Agent name.
echo "<tr class='$rowclass'><td class='$tdcolor' width='40%'>"; echo "<tr class='$rowclass'><td class='$tdcolor' width='40%'>";
if ($agent['disabled']) { if ($agent['disabled']) {
echo '<em>'; echo '<em>';
@ -537,7 +558,7 @@ if ($agents !== false) {
} else { } else {
echo '<a alt ='.$agent['nombre']." href='index.php?sec=gagente& echo '<a alt ='.$agent['nombre']." href='index.php?sec=gagente&
sec2=godmode/agentes/configurar_agente&tab=$main_tab& sec2=godmode/agentes/configurar_agente&tab=$main_tab&
id_agente=".$agent['id_agente']."'>".'<span style="font-size: '.$agent_font_size.'pt" title="'.$agent['nombre'].'">'.$agent['alias'].'</span>'.'</a>'; id_agente=".$agent['id_agente']."'>".'<span class="'.$custom_font_size.' title ="'.$agent['nombre'].'">'.$agent['alias'].'</span>'.'</a>';
} }
echo '</strong>'; echo '</strong>';
@ -617,12 +638,12 @@ if ($agents !== false) {
echo '</td>'; echo '</td>';
// Operating System icon // Operating System icon.
echo "<td class='$tdcolor' align='left' valign='middle'>"; echo "<td class='$tdcolor' align='left' valign='middle'>";
ui_print_os_icon($agent['id_os'], false); ui_print_os_icon($agent['id_os'], false);
echo '</td>'; echo '</td>';
// Type agent (Networt, Software or Satellite) // Type agent (Networt, Software or Satellite).
echo "<td class='$tdcolor' align='left' valign='middle'>"; echo "<td class='$tdcolor' align='left' valign='middle'>";
echo ui_print_type_agent_icon( echo ui_print_type_agent_icon(
$agent['id_os'], $agent['id_os'],
@ -634,10 +655,12 @@ if ($agents !== false) {
echo '</td>'; echo '</td>';
// Group icon and name // Group icon and name.
echo "<td class='$tdcolor' align='left' valign='middle'>".ui_print_group_icon($agent['id_grupo'], true).'</td>'; echo "<td class='$tdcolor' align='left' valign='middle'>".ui_print_group_icon($agent['id_grupo'], true).'</td>';
// Description
echo "<td class='".$tdcolor."f9'>".ui_print_truncate_text($agent['comentarios'], 'description', true, true, true, '[&hellip;]', 'font-size: '.$description_font_size.'pt;').'</td>'; // Description.
echo "<td class='".$tdcolor."f9'><span class='".$custom_font_size."'>".ui_print_truncate_text($agent['comentarios'], 'description', true, true, true, '[&hellip;]').'</span></td>';
// Action // Action
// When there is only one element in page it's necesary go back page. // When there is only one element in page it's necesary go back page.
if ((count($agents) == 1) && ($offset >= $config['block_size'])) { if ((count($agents) == 1) && ($offset >= $config['block_size'])) {
@ -695,7 +718,7 @@ if ($agents !== false) {
} }
if (check_acl($config['id_user'], 0, 'AW')) { if (check_acl($config['id_user'], 0, 'AW')) {
// Create agent button // Create agent button.
echo '<div style="text-align: right;">'; echo '<div style="text-align: right;">';
echo '<form method="post" action="index.php?sec=gagente&amp;sec2=godmode/agentes/configurar_agente">'; echo '<form method="post" action="index.php?sec=gagente&amp;sec2=godmode/agentes/configurar_agente">';
html_print_input_hidden('new_agent', 1); html_print_input_hidden('new_agent', 1);

View File

@ -5889,6 +5889,12 @@ table.table_modal_alternate tr td:first-child {
width: 100%; width: 100%;
} }
/*
* ---------------------------------------------------------------------
* - VISUAL STYLES FOR HISTOGRAM GRAPHS
* ---------------------------------------------------------------------
*/
.slicebar-box-hover-styles { .slicebar-box-hover-styles {
position: absolute; position: absolute;
background-color: #fff; background-color: #fff;
@ -5903,3 +5909,15 @@ table.table_modal_alternate tr td:first-child {
.flot-text { .flot-text {
width: 101%; width: 101%;
} }
/*
* ---------------------------------------------------------------------
* - FONT SIZES IN AGENT VIEW. This changes the font size of the agent
* name and the description when the language is Japanese or Chinese
* ---------------------------------------------------------------------
*/
.custom_font_size {
font-size: 14px;
font-weight: bold;
}

View File

@ -155,7 +155,7 @@ if (is_ajax()) {
ob_end_clean(); ob_end_clean();
// Take some parameters (GET) // Take some parameters (GET).
$group_id = (int) get_parameter('group_id', 0); $group_id = (int) get_parameter('group_id', 0);
$search = trim(get_parameter('search', '')); $search = trim(get_parameter('search', ''));
$search_custom = trim(get_parameter('search_custom', '')); $search_custom = trim(get_parameter('search_custom', ''));
@ -172,10 +172,10 @@ $access = ($agent_a === true) ? 'AR' : (($agent_w === true) ? 'AW' : 'AR');
$onheader = []; $onheader = [];
if (check_acl($config['id_user'], 0, 'AW')) { if (check_acl($config['id_user'], 0, 'AW')) {
// Prepare the tab system to the future // Prepare the tab system to the future.
$tab = 'setup'; $tab = 'setup';
// Setup tab // Setup tab.
$setuptab['text'] = '<a href="index.php?sec=gagente&sec2=godmode/agentes/modificar_agente">'.html_print_image('images/setup.png', true, ['title' => __('Setup')]).'</a>'; $setuptab['text'] = '<a href="index.php?sec=gagente&sec2=godmode/agentes/modificar_agente">'.html_print_image('images/setup.png', true, ['title' => __('Setup')]).'</a>';
$setuptab['godmode'] = true; $setuptab['godmode'] = true;
@ -193,7 +193,7 @@ if (!$strict_user) {
} }
} }
// User is deleting agent // User is deleting agent.
if (isset($result_delete)) { if (isset($result_delete)) {
if ($result_delete) { if ($result_delete) {
ui_print_success_message(__('Sucessfully deleted agent')); ui_print_success_message(__('Sucessfully deleted agent'));
@ -283,7 +283,7 @@ $order = null;
$order_collation = ''; $order_collation = '';
switch ($config['dbtype']) { switch ($config['dbtype']) {
case 'mysql': case 'mysql':
// $order_collation = " COLLATE utf8_general_ci"; // $order_collation = " COLLATE utf8_general_ci";.
$order_collation = ''; $order_collation = '';
break; break;
@ -314,6 +314,10 @@ switch ($sortField) {
'order' => 'DESC', 'order' => 'DESC',
]; ];
break; break;
default:
// Default.
break;
} }
break; break;
@ -336,6 +340,10 @@ switch ($sortField) {
'order' => 'DESC', 'order' => 'DESC',
]; ];
break; break;
default:
// Default.
break;
} }
break; break;
@ -358,6 +366,10 @@ switch ($sortField) {
'order' => 'DESC', 'order' => 'DESC',
]; ];
break; break;
default:
// Default.
break;
} }
break; break;
@ -380,6 +392,10 @@ switch ($sortField) {
'order' => 'DESC', 'order' => 'DESC',
]; ];
break; break;
default:
// Default.
break;
} }
break; break;
@ -402,6 +418,10 @@ switch ($sortField) {
'order' => 'DESC', 'order' => 'DESC',
]; ];
break; break;
default:
// Default.
break;
} }
break; break;
@ -424,6 +444,10 @@ switch ($sortField) {
'order' => 'ASC', 'order' => 'ASC',
]; ];
break; break;
default:
// Default.
break;
} }
break; break;
@ -446,6 +470,10 @@ switch ($sortField) {
'order' => 'ASC', 'order' => 'ASC',
]; ];
break; break;
default:
// Default.
break;
} }
break; break;
@ -505,7 +533,7 @@ if (!empty($search_custom)) {
$search_sql_custom = ''; $search_sql_custom = '';
} }
// Show only selected groups // Show only selected groups.
if ($group_id > 0) { if ($group_id > 0) {
$groups = [$group_id]; $groups = [$group_id];
if ($recursion) { if ($recursion) {
@ -624,11 +652,13 @@ if (empty($agents)) {
$agents = []; $agents = [];
} }
$agent_font_size = 'font-size: 7px'; if ($config['language'] == 'ja'
$description_font_size = 'font-size: 6.5px'; || $config['language'] == 'zh_CN'
if ($config['language'] == 'ja' || $config['language'] == 'zh_CN' || $own_info['language'] == 'ja' || $own_info['language'] == 'zh_CN') { || $own_info['language'] == 'ja'
$agent_font_size = 'font-size: 15px'; || $own_info['language'] == 'zh_CN'
$description_font_size = 'font-size: 11px'; ) {
// Adds a custom font size for Japanese and Chinese language.
$custom_font_size = 'custom_font_size';
} }
// Urls to sort the table. // Urls to sort the table.
@ -648,7 +678,7 @@ $url_up_last = 'index.php?sec=view&amp;sec2=operation/agentes/estado_agente&amp;
$url_down_last = 'index.php?sec=view&amp;sec2=operation/agentes/estado_agente&amp;refr='.$refr.'&amp;offset='.$offset.'&amp;group_id='.$group_id.'&amp;recursion='.$recursion.'&amp;search='.$search.'&amp;status='.$status.'&amp;sort_field=last_contact&amp;sort=down'; $url_down_last = 'index.php?sec=view&amp;sec2=operation/agentes/estado_agente&amp;refr='.$refr.'&amp;offset='.$offset.'&amp;group_id='.$group_id.'&amp;recursion='.$recursion.'&amp;search='.$search.'&amp;status='.$status.'&amp;sort_field=last_contact&amp;sort=down';
// Prepare pagination // Prepare pagination.
ui_pagination( ui_pagination(
$total_agents, $total_agents,
ui_get_url_refresh(['group_id' => $group_id, 'recursion' => $recursion, 'search' => $search, 'sort_field' => $sortField, 'sort' => $sort, 'status' => $status]) ui_get_url_refresh(['group_id' => $group_id, 'recursion' => $recursion, 'search' => $search, 'sort_field' => $sortField, 'sort' => $sort, 'status' => $status])
@ -744,10 +774,8 @@ foreach ($agents as $agent) {
$data = []; $data = [];
$data[0] = '<div class="left_'.$agent['id_agente'].'">'; $data[0] = '<div class="left_'.$agent['id_agente'].'">';
$data[0] .= '<span>';
$data[0] .= '<a href="index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$agent['id_agente'].'"> <span style="'.$agent_font_size.';font-weight:bold" title ="'.$agent['nombre'].'">'.$agent['alias'].'</span></a>'; $data[0] .= '<a href="index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$agent['id_agente'].'"><b><span class="'.$custom_font_size.' title ="'.$agent['nombre'].'">'.$agent['alias'].'</span></b></a>';
$data[0] .= '</span>';
if ($agent['quiet']) { if ($agent['quiet']) {
$data[0] .= '&nbsp;'; $data[0] .= '&nbsp;';
@ -779,7 +807,7 @@ foreach ($agents as $agent) {
$data[0] .= '</div></div>'; $data[0] .= '</div></div>';
$data[1] = ui_print_truncate_text($agent['description'], 'description', false, true, true, '[&hellip;]', $description_font_size); $data[1] = '<span class="'.$custom_font_size.'">'.ui_print_truncate_text($agent['description'], 'description', false, true, true, '[&hellip;]').'</span>';
$data[10] = ''; $data[10] = '';