From 7a09a80acea772c8192628c366a95d93d43841df Mon Sep 17 00:00:00 2001 From: fbsanchez Date: Mon, 3 Jun 2019 14:30:23 +0200 Subject: [PATCH] style review --- .../reporting/graph_builder.graph_editor.php | 32 +++++++++- pandora_console/include/ajax/module.php | 51 ++++++++------- pandora_console/include/functions_graph.php | 19 ++++-- pandora_console/include/styles/pandora.css | 12 ++-- pandora_console/include/styles/tables.css | 62 ++++++++++--------- 5 files changed, 109 insertions(+), 67 deletions(-) diff --git a/pandora_console/godmode/reporting/graph_builder.graph_editor.php b/pandora_console/godmode/reporting/graph_builder.graph_editor.php index a03a67737f..33cacc9bab 100644 --- a/pandora_console/godmode/reporting/graph_builder.graph_editor.php +++ b/pandora_console/godmode/reporting/graph_builder.graph_editor.php @@ -356,9 +356,35 @@ echo "".__('Agents').''; echo ''; echo "".__('Modules').''; echo ''; -echo ''.html_print_select(agents_get_group_agents(), 'id_agents[]', 0, false, '', '', true, true, true, '', false, '').''; -echo "".html_print_image('images/darrowright.png', true).''; -echo ''.html_print_select([], 'module[]', 0, false, '', 0, true, true, true, '', false, '').''; +echo ''.html_print_select( + agents_get_group_agents(), + 'id_agents[]', + 0, + false, + '', + '', + true, + true, + true, + 'w100p', + false, + '' +).''; +echo "".html_print_image('images/darrowright.png', true).''; +echo ''.html_print_select( + [], + 'module[]', + 0, + false, + '', + 0, + true, + true, + true, + 'w100p', + false, + '' +).''; echo ''; echo ""; echo ""; diff --git a/pandora_console/include/ajax/module.php b/pandora_console/include/ajax/module.php index 76dc24e145..2543306e74 100755 --- a/pandora_console/include/ajax/module.php +++ b/pandora_console/include/ajax/module.php @@ -824,23 +824,28 @@ if (check_login()) { $table->head[7] = __('Data'); $table->head[8] = __('Graph'); $table->head[9] = __('Last contact').ui_get_sorting_arrows($url_up_last, $url_down_last, $selectLastContactUp, $selectLastContactDown); - $table->align = [ - 'left', - 'left', - 'left', - 'left', - 'left', - 'left', - 'left', - 'left', - 'left', - ]; + $table->align = []; + $table->align[0] = 'left'; + $table->align[1] = 'left'; + $table->align[2] = 'left'; + $table->align[3] = 'left'; + $table->align[4] = 'left'; + $table->align[5] = 'left'; + $table->align[6] = 'center'; + $table->align[7] = 'left'; + $table->align[8] = 'center'; + $table->align[9] = 'right'; - $table->headstyle[2] = 'min-width: 60px'; - $table->headstyle[3] = 'min-width: 100px'; - $table->headstyle[5] = 'min-width: 60px'; - $table->headstyle[8] = 'min-width: 85px'; - $table->headstyle[9] = 'min-width: 100px'; + $table->headstyle[2] = 'min-width: 85px'; + $table->headstyle[3] = 'min-width: 130px'; + $table->size[3] = '30%'; + $table->style[3] = 'max-width: 28em;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;'; + $table->size[4] = '30%'; + $table->headstyle[5] = 'min-width: 85px'; + $table->headstyle[6] = 'min-width: 125px; text-align: center;'; + $table->headstyle[7] = 'min-width: 125px;'; + $table->headstyle[8] = 'min-width: 85px; text-align: center;'; + $table->headstyle[9] = 'min-width: 120px; text-align: right;'; $last_modulegroup = 0; $rowIndex = 0; @@ -879,14 +884,14 @@ if (check_login()) { $last_modulegroup = $module['id_module_group']; } - // End of title of group + // End of title of group. } $data = []; if (($module['id_modulo'] != 1) && ($module['id_tipo_modulo'] != 100)) { if ($agent_w) { if ($module['flag'] == 0) { - $data[0] = ''.html_print_image('images/target.png', true, ['border' => '0', 'title' => __('Force')]).''; + $data[0] = ''.html_print_image('images/target.png', true, ['border' => '0', 'title' => __('Force')]).''; } else { $data[0] = ''.html_print_image('images/refresh.png', true, ['border' => '0', 'title' => __('Refresh')]).''; } @@ -1074,7 +1079,7 @@ if (check_login()) { if ($data_macro) { $salida = $data_macro; } else { - $salida .= ' '.''.io_safe_output($module['unit']).''; + $salida .= ' '.io_safe_output($module['unit']).''; } } } else { @@ -1120,17 +1125,17 @@ if (check_login()) { $draw_events = 0; } - $link = "winopeng_var('".'operation/agentes/stat_win.php?'."type=$graph_type&".'period='.SECONDS_1DAY.'&'.'id='.$module['id_agente_modulo'].'&'.'label='.rawurlencode( + $link = "winopeng_var('".'operation/agentes/stat_win.php?'."type=$graph_type&".'period='.SECONDS_1DAY.'&id='.$module['id_agente_modulo'].'&label='.rawurlencode( urlencode( base64_encode($module['nombre']) ) - ).'&'.'refresh='.SECONDS_10MINUTES.'&'."draw_events=$draw_events', 'day_".$win_handle."', 1000, 650)"; + ).'&refresh='.SECONDS_10MINUTES.'&'."draw_events=$draw_events', 'day_".$win_handle."', 1000, 650)"; if (!is_snapshot_data($module['datos'])) { $data[8] .= ''.html_print_image('images/chart_curve.png', true, ['border' => '0', 'alt' => '']).'   '; } $server_name = ''; - $data[8] .= "".html_print_image('images/binary.png', true, ['border' => '0', 'alt' => '']).''; + $data[8] .= "".html_print_image('images/binary.png', true, ['border' => '0', 'alt' => '']).''; } if ($module['estado'] == 3) { @@ -1177,7 +1182,7 @@ if (check_login()) { ui_print_info_message([ 'no_close' => true, 'message' => __('This agent doesn\'t have any active monitors.') ]); } } else { - $url = 'index.php?'.'sec=estado&'.'sec2=operation/agentes/ver_agente&'.'id_agente='.$id_agente.'&'.'refr=&filter_monitors=1&'.'status_filter_monitor='.$status_filter_monitor.'&'.'status_text_monitor='.$status_text_monitor.'&'.'status_module_group='.$status_module_group; + $url = 'index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$id_agente.'&refr=&filter_monitors=1&status_filter_monitor='.$status_filter_monitor.'&status_text_monitor='.$status_text_monitor.'&status_module_group='.$status_module_group; if ($paginate_module) { ui_pagination( diff --git a/pandora_console/include/functions_graph.php b/pandora_console/include/functions_graph.php index 86de873965..f9e5b402f7 100644 --- a/pandora_console/include/functions_graph.php +++ b/pandora_console/include/functions_graph.php @@ -2343,14 +2343,21 @@ function graphic_agentaccess( $date = get_system_time(); $datelimit = ($date - $period); $data_array = []; + $interval = agents_get_interval($id_agent); $data = db_get_all_rows_sql( - "SELECT count(*) as data, min(utimestamp) as utimestamp - FROM tagent_access - WHERE id_agent = $id_agent - AND utimestamp > $datelimit - AND utimestamp < $date - GROUP by ROUND(utimestamp / 1800)" + sprintf( + 'SELECT utimestamp, count(*) as data + FROM tagent_access + WHERE id_agent = %d + AND utimestamp > %d + AND utimestamp < %d + GROUP BY ROUND(utimestamp/%d)', + $id_agent, + $datelimit, + $date, + $interval + ) ); if (isset($data) && is_array($data)) { diff --git a/pandora_console/include/styles/pandora.css b/pandora_console/include/styles/pandora.css index cc1f3c48f4..d02ffded32 100644 --- a/pandora_console/include/styles/pandora.css +++ b/pandora_console/include/styles/pandora.css @@ -437,27 +437,27 @@ select:-internal-list-box { * --------------------------------------------------------------------- */ .w10p { - max-width: 10%; + width: 10%; } .w20p { - max-width: 20%; + width: 20%; } .w30p { - max-width: 30%; + width: 30%; } .w40p { - max-width: 40%; + width: 40%; } .w50p { - max-width: 50%; + width: 50%; } .w100p { - max-width: 100%; + width: 100%; } .padding-2 { diff --git a/pandora_console/include/styles/tables.css b/pandora_console/include/styles/tables.css index ac2cdcc951..6f1035d3f4 100644 --- a/pandora_console/include/styles/tables.css +++ b/pandora_console/include/styles/tables.css @@ -26,7 +26,7 @@ width: 33%; } -table.info_table { +.info_table { background-color: #fff; margin-bottom: 10px; border-spacing: 0; @@ -35,48 +35,48 @@ table.info_table { border-radius: 5px; } -table.info_table > tbody > tr:nth-child(even) { +.info_table > tbody > tr:nth-child(even) { background-color: #f5f5f5; } -table.info_table tr:first-child > th { +.info_table tr:first-child > th { background-color: #fff; color: #000; text-align: left; vertical-align: middle; } -table.info_table th { +.info_table th { font-size: 7.5pt; letter-spacing: 0.3pt; color: #000; background-color: #fff; } -table.info_table tr th { +.info_table tr th { border-bottom: 1px solid #e2e2e2; } /* Radius top */ -table.info_table > thead > tr:first-child > th:first-child { +.info_table > thead > tr:first-child > th:first-child { border-top-left-radius: 4px; } -table.info_table > thead > tr:first-child > th:last-child { +.info_table > thead > tr:first-child > th:last-child { border-top-right-radius: 4px; } /* Radius bottom */ -table.info_table > tbody > tr:last-child > td:first-child { +.info_table > tbody > tr:last-child > td:first-child { border-top-left-radius: 4px; } -table.info_table > tbody > tr:last-child > td:last-child { +.info_table > tbody > tr:last-child > td:last-child { border-top-right-radius: 4px; } -table.info_table > thead > tr > th, -table.info_table > tbody > tr > th, -table.info_table > thead > tr > th a, -table.info_table > thead > tr > th > span { +.info_table > thead > tr > th, +.info_table > tbody > tr > th, +.info_table > thead > tr > th a, +.info_table > thead > tr > th > span { padding: 0.1em; font-weight: normal; color: #000; @@ -84,11 +84,11 @@ table.info_table > thead > tr > th > span { margin-left: 0.5em; } -table.info_table > tbody > tr { +.info_table > tbody > tr { border-bottom: 1px solid #e2e2e2; } -table.info_table > tbody > tr > td { +.info_table > tbody > tr > td { -moz-border-radius: 0px; -webkit-border-radius: 0px; border-radius: 0px; @@ -99,26 +99,28 @@ table.info_table > tbody > tr > td { padding-bottom: 7px; } -table.info_table > tbody > tr > td > img, -table.info_table > thead > tr > th > img, -table.info_table > tbody > tr > td > div > a > img, -table.info_table > tbody > tr > td > span > img, -table.info_table > tbody > tr > td > span > a > img, -table.info_table > tbody > tr > td > a > img, -table.info_table > tbody > tr > td > form > a > img { +.info_table > tbody > tr > td > img, +.info_table > thead > tr > th > img, +.info_table > tbody > tr > td > div > a > img, +.info_table > tbody > tr > td > span > img, +.info_table > tbody > tr > td > span > a > img, +.info_table > tbody > tr > td > a > img, +.info_table > tbody > tr > td > form > a > img { vertical-align: middle; } -table.info_table > tbody > tr:hover { +.info_table > tbody > tr:hover { background-color: #eee; } -.info_table.profile_list > thead > tr > th > a.tip { +.info_.profile_list > thead > tr > th > a.tip { padding: 0px; } -td.datos3, -td.datos4 { +.info_table .datos3, +.datos3, +.info_table .datos4, +.datos4 { background-color: #fff; color: #000; border-bottom: 2px solid #82b92e; @@ -129,13 +131,15 @@ td.datos4 { font-weight: normal; } -td.datos4 { +.datos4 { /*Add because in php the function html_print_table write style in cell and this is style head.*/ text-align: center; } -td.datos3 *, -td.datos4 * { +.datos3 *, +.datos4 *, +.info_table .datos3 *, +.info_table .datos4 * { font-size: 8.6pt; font-weight: normal; }