From e255844c1baa53ac5f365096e7eb1f2267d26769 Mon Sep 17 00:00:00 2001 From: mdtrooper Date: Tue, 14 May 2013 09:33:13 +0000 Subject: [PATCH] 2013-05-14 Miguel de Dios * include/constants.php: added constant "ITEMS_TO_SHOW_IN_MAIN_TAB". * operation/search_agents.getdata.php, operation/search_agents.php, operation/search_modules.getdata.php, operation/search_main.php, operation/search_results.php: improved the views of global search. * images/visual_console.png: update Carla's work. * images/visual_console_green.png: added a green version. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@8128 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 12 +++ pandora_console/images/visual_console.png | Bin 1411 -> 1425 bytes .../images/visual_console_green.png | Bin 0 -> 1588 bytes pandora_console/include/constants.php | 5 +- .../operation/search_agents.getdata.php | 26 ++--- pandora_console/operation/search_agents.php | 64 +++++++---- pandora_console/operation/search_main.php | 99 ++++++++---------- .../operation/search_modules.getdata.php | 2 +- pandora_console/operation/search_results.php | 1 + 9 files changed, 117 insertions(+), 92 deletions(-) create mode 100644 pandora_console/images/visual_console_green.png diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index cb4bea0e7c..b070c37cab 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,15 @@ +2013-05-14 Miguel de Dios + + * include/constants.php: added constant "ITEMS_TO_SHOW_IN_MAIN_TAB". + + * operation/search_agents.getdata.php, operation/search_agents.php, + operation/search_modules.getdata.php, operation/search_main.php, + operation/search_results.php: improved the views of global search. + + * images/visual_console.png: update Carla's work. + + * images/visual_console_green.png: added a green version. + 2013-05-13 Sergio Martin * include/styles/pandora.css diff --git a/pandora_console/images/visual_console.png b/pandora_console/images/visual_console.png index f28689679098430df6d90cf50692ef9cbb978f2e..d55197af0b71944ddcf70e28748ad3df19e2b325 100644 GIT binary patch delta 666 zcmZqXp2)4(8Q|y6%O%Cdz`(%k>ERLtq$NR^gN=cKar3*aUpFfLW#n=(b1^nDcC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1V5)?o0RK{Pp-}IG zuc~tjSwzGSBxTx9(Q`59$vDQIlgfIx$mlEs!}h<4mn|L?>;fh;22WQ%mvv4FO#p^# B*$@B# diff --git a/pandora_console/images/visual_console_green.png b/pandora_console/images/visual_console_green.png new file mode 100644 index 0000000000000000000000000000000000000000..9ebe25bdaaa5b1b37822460e5c343eb8741188aa GIT binary patch literal 1588 zcmbVMZA=q)7{5|1DrKTk1aaZK8f6iBFMYjAp{3VC7mBrzLAGS;^?HR4dRMN8RAf-; z#>?i0Ai9NR5zRI?!;E7tAv2p0M9_UObMqx`ixSL~;mc(6Z3^8LsoMwRhh1{H|MT4M z_q;#*z5E z^t$y>naYOP{3g26TUgK0CH2LnRDBhNyP>>XFej)J4ESiC1cSb6CZG%Ip*g!c;T%=N z5I6_ntMt(0pvrA_(8O{ysFEYu6rx5!wNj2M5nPF9ff#}!Fp9y5CL2X`Dvb_7!TARg zym4-i&Oun_eF>5ts^odU4ug06_Im=bRD30SWg25P;Eg-T3TN$1VW-|d<%mP6N zD9-EWy(|MpEs`#_me)foeZ`E9l*hMB;8p@fpbLDCPSas>AIqIu1s1H6O&H;kvE z1EpL2H0+=QY%NC#{qV?QWTAG?b`%8)(dagDUZE*uHNjG~KAPdJgdP(9$lYGIj!+W{ zOkvcb1cs=!D5^E835!{S;pTjlP@qW6#?!dCR&7*S)W&?J){LTN47U(QtxBy$j4Gu? zWmLqtRwlrc3`NKMdIi7pT>P0_or$AKp5;newmLQe_DYs#1C^{FG?l32C}<-oFB8>7 z8}v9|g66ziXt#x9ec)V$b>62$V6kW{D5_B+n)%Gt3c{#TU`W0eQ)n;@n&-OzPt{-{ z7&tl}{~4Eu%!Dz)6|_8lJ8`g(+t3N+)iiq4%KAH3e(G{CP!Zx z9BAA-(Uj?Q8q|`tA}V}b6xX)&*Ny%H@eSRQkCPC$)3ZsNaxXG`ugrOO{NaYk@XXBY zC?#opZu5@hIDGf`+4oz^Z-~==4yi&rMFwEJdoW?}?y%_tAa~k%w&_Y?INUxuF_fEl zu8-128rFxqde?;C%}+gd1W0(WCvoVni&Hk~dvAX!Ey#dJZ?3OK-$@L)R`<1cb}p?t z4sAbSIWUuScucYo>@sz<|J3U-E`HrLxZvWH=q!TCotHPeE^OHb znOY{Z9<4g%J0Dh@*wi}-szqPyK#G z^2astNLyD3AIR*L4BVT|L25pVukd#(o4@EY7DsxguZ`|KEp1-ykV?7^Ne@Dw-p`JE zxmmSlzu4&=JA8Fk8a$YCWv9fm;0*~b@|_7Mt{k}gck+wHq3s=cuPUy8qi-F*_~DH7 zQlufiEW=&U&@;K*f2j3DdTO|T^=JF*BNOiI;vkvSb|y*>SX?d5uL zx4pmUs-o@oSP8ReEZJT|)GU)U8=Ud!gHYO%(29hF(0y=-dmbN^oi8a|& + +/* GLOBAL SEARCH */ +define('ITEMS_TO_SHOW_IN_MAIN_TAB', 5); +?> \ No newline at end of file diff --git a/pandora_console/operation/search_agents.getdata.php b/pandora_console/operation/search_agents.getdata.php index 67b5e37106..1938aeb252 100644 --- a/pandora_console/operation/search_agents.getdata.php +++ b/pandora_console/operation/search_agents.getdata.php @@ -175,22 +175,24 @@ if ($searchAgents) { break; } - if($only_count) { - $totalAgents = db_get_value_sql('SELECT COUNT(id_agente) AS agent_count ' . $sql); + $select = + "SELECT t1.id_agente, t1.ultimo_contacto, t1.nombre, t1.id_os, t1.intervalo, t1.id_grupo, t1.disabled"; + if ($only_count) { + $limit = " ORDER BY " . $order['field'] . " " . $order['order'] . + " LIMIT " . ITEMS_TO_SHOW_IN_MAIN_TAB . " OFFSET 0"; } else { - $select = - "SELECT t1.id_agente, t1.ultimo_contacto, t1.nombre, t1.id_os, t1.intervalo, t1.id_grupo, t1.disabled"; $limit = " ORDER BY " . $order['field'] . " " . $order['order'] . " LIMIT " . $config['block_size'] . " OFFSET " . get_parameter ('offset',0); - - $query = $select . $sql . $limit; - - $agents = db_process_sql($query); - - if($agents !== false) { - $totalAgents = db_get_value_sql('SELECT COUNT(id_agente) AS agent_count ' . $sql); - } + } + + $query = $select . $sql . $limit; + + $agents = db_process_sql($query); + + if ($agents !== false) { + $totalAgents = db_get_value_sql( + 'SELECT COUNT(id_agente) AS agent_count ' . $sql); } } ?> diff --git a/pandora_console/operation/search_agents.php b/pandora_console/operation/search_agents.php index dd99d74ae2..622319d767 100755 --- a/pandora_console/operation/search_agents.php +++ b/pandora_console/operation/search_agents.php @@ -19,13 +19,19 @@ global $config; enterprise_include_once('include/functions_policies.php'); require_once ($config['homedir'].'/include/functions_users.php'); +if ($only_count) { + ob_start(); +} + // TODO: CLEAN extra_sql $extra_sql = ''; $searchAgents = check_acl($config['id_user'], 0, "AR"); if (!$agents || !$searchAgents) { - echo "
" . __("Zero results found") . "
\n"; + if (!$only_count) { + echo "
" . __("Zero results found") . "
\n"; + } } else { $table->cellpadding = 4; @@ -34,18 +40,26 @@ else { $table->class = "databox"; $table->head = array (); - $table->head[0] = __('Agent') . ' ' . - '' . html_print_image("images/sort_up.png", true, array("style" => $selectNameUp)) . '' . - '' . html_print_image("images/sort_down.png", true, array("style" => $selectNameDown)) . ''; - $table->head[1] = __('OS'). ' ' . - '' . html_print_image("images/sort_up.png", true, array("style" => $selectOsUp)) . '' . - '' . html_print_image("images/sort_down.png", true, array("style" => $selectOsDown)) . ''; - $table->head[2] = __('Interval'). ' ' . - '' . html_print_image("images/sort_up.png", true, array("style" => $selectIntervalUp)) . '' . - '' . html_print_image("images/sort_down.png", true, array("style" => $selectIntervalDown)) . ''; - $table->head[3] = __('Group'). ' ' . - '' . html_print_image("images/sort_up.png", true, array("style" => $selectGroupUp)) . '' . - '' . html_print_image("images/sort_down.png", true, array("style" => $selectGroupDown)) . ''; + if ($only_count) { + $table->head[0] = __('Agent'); + $table->head[1] = __('OS'); + $table->head[2] = __('Interval'); + $table->head[3] = __('Group'); + } + else { + $table->head[0] = __('Agent') . ' ' . + '' . html_print_image("images/sort_up.png", true, array("style" => $selectNameUp)) . '' . + '' . html_print_image("images/sort_down.png", true, array("style" => $selectNameDown)) . ''; + $table->head[1] = __('OS') . ' ' . + '' . html_print_image("images/sort_up.png", true, array("style" => $selectOsUp)) . '' . + '' . html_print_image("images/sort_down.png", true, array("style" => $selectOsDown)) . ''; + $table->head[2] = __('Interval') . ' ' . + '' . html_print_image("images/sort_up.png", true, array("style" => $selectIntervalUp)) . '' . + '' . html_print_image("images/sort_down.png", true, array("style" => $selectIntervalDown)) . ''; + $table->head[3] = __('Group') . ' ' . + '' . html_print_image("images/sort_up.png", true, array("style" => $selectGroupUp)) . '' . + '' . html_print_image("images/sort_down.png", true, array("style" => $selectGroupDown)) . ''; + } $table->head[4] = __('Modules'); $table->head[5] = __('Status'); $table->head[6] = __('Alerts'); @@ -71,12 +85,12 @@ else { $agent_info = reporting_get_agent_module_info ($agent["id_agente"]); $counts_info = array('total_count' => $agent_info["modules"], - 'normal_count' => $agent_info["monitor_normal"], - 'critical_count' => $agent_info["monitor_critical"], - 'warning_count' => $agent_info["monitor_warning"], - 'unknown_count' => $agent_info["monitor_unknown"], - 'fired_count' => $agent_info["monitor_alertsfired"]); - + 'normal_count' => $agent_info["monitor_normal"], + 'critical_count' => $agent_info["monitor_critical"], + 'warning_count' => $agent_info["monitor_warning"], + 'unknown_count' => $agent_info["monitor_unknown"], + 'fired_count' => $agent_info["monitor_alertsfired"]); + $modulesCell = reporting_tiny_stats($counts_info, true); if ($agent['disabled']) { @@ -114,9 +128,17 @@ else { } echo "
"; - ui_pagination ($totalAgents); + if (!$only_count) { + ui_pagination ($totalAgents); + } html_print_table ($table); unset($table); - ui_pagination ($totalAgents); + if (!$only_count) { + ui_pagination ($totalAgents); + } +} + +if ($only_count) { + $list_agents = ob_get_clean(); } ?> diff --git a/pandora_console/operation/search_main.php b/pandora_console/operation/search_main.php index 3df4b3fb60..93a65cecf4 100644 --- a/pandora_console/operation/search_main.php +++ b/pandora_console/operation/search_main.php @@ -28,64 +28,49 @@ echo '
' $anyfound = false; +$table->id = 'summary'; +$table->width = '98%'; + +$table->style = array (); +$table->style[0] = 'font-weight: bold; text-align: center;'; +$table->style[1] = 'font-weight: bold; text-align: center;'; +$table->style[2] = 'font-weight: bold; text-align: center;'; +$table->style[3] = 'font-weight: bold; text-align: center;'; +$table->style[4] = 'font-weight: bold; text-align: center;'; +$table->style[5] = 'font-weight: bold; text-align: center;'; +$table->style[6] = 'font-weight: bold; text-align: center;'; +$table->style[7] = 'font-weight: bold; text-align: center;'; +$table->style[8] = 'font-weight: bold; text-align: center;'; +$table->style[9] = 'font-weight: bold; text-align: center;'; +$table->style[10] = 'font-weight: bold; text-align: center;'; +$table->style[11] = 'font-weight: bold; text-align: center;'; + +$table->data[0][0] = html_print_image ("images/agent.png", true, array ("title" => __('Agents found'))); +$table->data[0][1] = "" . + sprintf(__("Found %s"), $totalAgents) . ""; +$table->data[0][2] = html_print_image ("images/module.png", true, array ("title" => __('Modules found'))); +$table->data[0][3] = "" . + sprintf(__("Found %s"), $totalModules) . ""; +$table->data[0][4] = html_print_image ("images/bell.png", true, array ("title" => __('Alerts found'))); +$table->data[0][5] = "" . + sprintf(__("Found %s"), $totalAlerts) . ""; +$table->data[0][6] = html_print_image ("images/input_user.png", true, array ("title" => __('Users found'))); +$table->data[0][7] = "" . + sprintf(__("Found %s"), $totalUsers) . ""; +$table->data[0][8] = html_print_image ("images/chart_curve.png", true, array ("title" => __('Graphs found'))); +$table->data[0][9] = "" . + sprintf(__("Found %s"), $totalGraphs) . ""; +$table->data[0][8] = html_print_image ("images/reporting.png", true, array ("title" => __('Reports found'))); +$table->data[0][9] = "" . + sprintf(__("Found %s"), $totalReports) . ""; +$table->data[0][10] = html_print_image ("images/visual_console_green.png", true, array ("title" => __('Maps found'))); +$table->data[0][11] = "" . + sprintf(__("Found %s"), $totalMaps) . ""; + +html_print_table($table); + if ($searchAgents && $totalAgents > 0) { - echo '
'; - echo '' . __('Agents') . ''; - echo sprintf(__("%d results found"), $totalAgents) . " " . html_print_image('images/zoom.png', true, array('title' => __('Show results'))) . ""; - echo '
'; - $anyfound = true; -} - -if ($searchModules && $totalModules > 0) { - echo '
'; - echo '' . __('Modules') . ''; - echo sprintf(__("%d results found"), $totalModules) . " " . html_print_image('images/zoom.png', true, array('title' => __('Show results'))) . ""; - echo '
'; - $anyfound = true; -} - -if ($searchAlerts && $totalAlerts > 0) { - echo '
'; - echo '' . __('Alerts') . ''; - echo sprintf(__("%d results found"), $totalAlerts) . " " . html_print_image('images/zoom.png', true, array('title' => __('Show results'))) . ""; - echo '
'; - $anyfound = true; -} - -if ($searchUsers && $totalUsers > 0) { - echo '
'; - echo '' . __('Users') . ''; - echo sprintf(__("%d results found"), $totalUsers) . " " . html_print_image('images/zoom.png', true, array('title' => __('Show results'))) . ""; - echo '
'; - $anyfound = true; -} - -if ($searchGraphs && $totalGraphs > 0) { - echo '
'; - echo '' . __('Graphs') . ''; - echo sprintf(__("%d results found"), $totalGraphs) . " " . html_print_image('images/zoom.png', true, array('title' => __('Show results'))) . ""; - echo '
'; - $anyfound = true; -} - -if ($searchReports && $totalReports > 0) { - echo '
'; - echo '' . __('Reports') . ''; - echo sprintf(__("%d results found"), $totalReports) . " " . html_print_image('images/zoom.png', true, array('title' => __('Show results'))) . ""; - echo '
'; - $anyfound = true; -} - -if ($searchMaps && $totalMaps > 0) { - echo '
'; - echo '' . __('Maps') . ''; - echo sprintf(__("%d results found"), $totalMaps) . " " . html_print_image('images/zoom.png', true, array('title' => __('Show results'))) . ""; - echo '
'; - $anyfound = true; -} - -if(!$anyfound) { - echo "
" . __("Zero results found") . "
\n"; + echo $list_agents; } echo '
'; diff --git a/pandora_console/operation/search_modules.getdata.php b/pandora_console/operation/search_modules.getdata.php index 80b323141a..96c81ee36a 100644 --- a/pandora_console/operation/search_modules.getdata.php +++ b/pandora_console/operation/search_modules.getdata.php @@ -137,7 +137,7 @@ if ($searchModules) { } $totalModules = db_get_value_sql("SELECT COUNT(t1.id_agente_modulo) AS count_modules " . $chunk_sql); - + if(!$only_count) { $select = "SELECT *, t1.nombre AS module_name, t2.nombre AS agent_name "; $limit = " ORDER BY " . $order['field'] . " " . $order['order'] . diff --git a/pandora_console/operation/search_results.php b/pandora_console/operation/search_results.php index c02cf56647..332cad5c76 100644 --- a/pandora_console/operation/search_results.php +++ b/pandora_console/operation/search_results.php @@ -135,6 +135,7 @@ switch ($searchTab) { case 'main': $only_count = true; require_once('search_agents.getdata.php'); + require_once('search_agents.php'); require_once('search_users.getdata.php'); require_once('search_alerts.getdata.php'); require_once('search_graphs.getdata.php');