2013-05-14 Miguel de Dios <miguel.dedios@artica.es>

* 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
This commit is contained in:
mdtrooper 2013-05-14 09:33:13 +00:00
parent fe4bcdc14a
commit 9d2e9c5161
9 changed files with 117 additions and 92 deletions

View File

@ -1,3 +1,15 @@
2013-05-14 Miguel de Dios <miguel.dedios@artica.es>
* 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 <sergio.martin@artica.es>
* include/styles/pandora.css

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

@ -280,4 +280,7 @@ define ('REPORT_EXCEPTION_CONDITION_E', 7);
define ('REPORT_EXCEPTION_CONDITION_NE', 8);
define ('REPORT_EXCEPTION_CONDITION_OK', 3);
define ('REPORT_EXCEPTION_CONDITION_NOT_OK', 4);
?>
/* GLOBAL SEARCH */
define('ITEMS_TO_SHOW_IN_MAIN_TAB', 5);
?>

View File

@ -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);
}
}
?>

View File

@ -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 "<br><div class='nf'>" . __("Zero results found") . "</div>\n";
if (!$only_count) {
echo "<br><div class='nf'>" . __("Zero results found") . "</div>\n";
}
}
else {
$table->cellpadding = 4;
@ -34,18 +40,26 @@ else {
$table->class = "databox";
$table->head = array ();
$table->head[0] = __('Agent') . ' ' .
'<a href="index.php?search_category=agents&keywords=' . $config['search_keywords'] . '&head_search_keywords=abc&offset=' . $offset . '&sort_field=name&sort=up">' . html_print_image("images/sort_up.png", true, array("style" => $selectNameUp)) . '</a>' .
'<a href="index.php?search_category=agents&keywords=' . $config['search_keywords'] . '&head_search_keywords=abc&offset=' . $offset . '&sort_field=name&sort=down">' . html_print_image("images/sort_down.png", true, array("style" => $selectNameDown)) . '</a>';
$table->head[1] = __('OS'). ' ' .
'<a href="index.php?search_category=agents&keywords=' . $config['search_keywords'] . '&head_search_keywords=abc&offset=' . $offset . '&sort_field=os&sort=up">' . html_print_image("images/sort_up.png", true, array("style" => $selectOsUp)) . '</a>' .
'<a href="index.php?search_category=agents&keywords=' . $config['search_keywords'] . '&head_search_keywords=abc&offset=' . $offset . '&sort_field=os&sort=down">' . html_print_image("images/sort_down.png", true, array("style" => $selectOsDown)) . '</a>';
$table->head[2] = __('Interval'). ' ' .
'<a href="index.php?search_category=agents&keywords=' . $config['search_keywords'] . '&head_search_keywords=abc&offset=' . $offset . '&sort_field=interval&sort=up">' . html_print_image("images/sort_up.png", true, array("style" => $selectIntervalUp)) . '</a>' .
'<a href="index.php?search_category=agents&keywords=' . $config['search_keywords'] . '&head_search_keywords=abc&offset=' . $offset . '&sort_field=interval&sort=down">' . html_print_image("images/sort_down.png", true, array("style" => $selectIntervalDown)) . '</a>';
$table->head[3] = __('Group'). ' ' .
'<a href="index.php?search_category=agents&keywords=' . $config['search_keywords'] . '&head_search_keywords=abc&offset=' . $offset . '&sort_field=group&sort=up">' . html_print_image("images/sort_up.png", true, array("style" => $selectGroupUp)) . '</a>' .
'<a href="index.php?search_category=agents&keywords=' . $config['search_keywords'] . '&head_search_keywords=abc&offset=' . $offset . '&sort_field=group&sort=down">' . html_print_image("images/sort_down.png", true, array("style" => $selectGroupDown)) . '</a>';
if ($only_count) {
$table->head[0] = __('Agent');
$table->head[1] = __('OS');
$table->head[2] = __('Interval');
$table->head[3] = __('Group');
}
else {
$table->head[0] = __('Agent') . ' ' .
'<a href="index.php?search_category=agents&keywords=' . $config['search_keywords'] . '&head_search_keywords=abc&offset=' . $offset . '&sort_field=name&sort=up">' . html_print_image("images/sort_up.png", true, array("style" => $selectNameUp)) . '</a>' .
'<a href="index.php?search_category=agents&keywords=' . $config['search_keywords'] . '&head_search_keywords=abc&offset=' . $offset . '&sort_field=name&sort=down">' . html_print_image("images/sort_down.png", true, array("style" => $selectNameDown)) . '</a>';
$table->head[1] = __('OS') . ' ' .
'<a href="index.php?search_category=agents&keywords=' . $config['search_keywords'] . '&head_search_keywords=abc&offset=' . $offset . '&sort_field=os&sort=up">' . html_print_image("images/sort_up.png", true, array("style" => $selectOsUp)) . '</a>' .
'<a href="index.php?search_category=agents&keywords=' . $config['search_keywords'] . '&head_search_keywords=abc&offset=' . $offset . '&sort_field=os&sort=down">' . html_print_image("images/sort_down.png", true, array("style" => $selectOsDown)) . '</a>';
$table->head[2] = __('Interval') . ' ' .
'<a href="index.php?search_category=agents&keywords=' . $config['search_keywords'] . '&head_search_keywords=abc&offset=' . $offset . '&sort_field=interval&sort=up">' . html_print_image("images/sort_up.png", true, array("style" => $selectIntervalUp)) . '</a>' .
'<a href="index.php?search_category=agents&keywords=' . $config['search_keywords'] . '&head_search_keywords=abc&offset=' . $offset . '&sort_field=interval&sort=down">' . html_print_image("images/sort_down.png", true, array("style" => $selectIntervalDown)) . '</a>';
$table->head[3] = __('Group') . ' ' .
'<a href="index.php?search_category=agents&keywords=' . $config['search_keywords'] . '&head_search_keywords=abc&offset=' . $offset . '&sort_field=group&sort=up">' . html_print_image("images/sort_up.png", true, array("style" => $selectGroupUp)) . '</a>' .
'<a href="index.php?search_category=agents&keywords=' . $config['search_keywords'] . '&head_search_keywords=abc&offset=' . $offset . '&sort_field=group&sort=down">' . html_print_image("images/sort_down.png", true, array("style" => $selectGroupDown)) . '</a>';
}
$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 "<br />";
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();
}
?>

View File

@ -28,64 +28,49 @@ echo '<br><div style="margin:auto; width:90%; padding: 10px; background: #fff">'
$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] = "<a href='index.php?search_category=agents&keywords=".$keyword."&head_search_keywords=Search'>" .
sprintf(__("Found %s"), $totalAgents) . "</a>";
$table->data[0][2] = html_print_image ("images/module.png", true, array ("title" => __('Modules found')));
$table->data[0][3] = "<a href='index.php?search_category=modules&keywords=".$keyword."&head_search_keywords=Search'>" .
sprintf(__("Found %s"), $totalModules) . "</a>";
$table->data[0][4] = html_print_image ("images/bell.png", true, array ("title" => __('Alerts found')));
$table->data[0][5] = "<a href='index.php?search_category=alerts&keywords=".$keyword."&head_search_keywords=Search'>" .
sprintf(__("Found %s"), $totalAlerts) . "</a>";
$table->data[0][6] = html_print_image ("images/input_user.png", true, array ("title" => __('Users found')));
$table->data[0][7] = "<a href='index.php?search_category=users&keywords=".$keyword."&head_search_keywords=Search'>" .
sprintf(__("Found %s"), $totalUsers) . "</a>";
$table->data[0][8] = html_print_image ("images/chart_curve.png", true, array ("title" => __('Graphs found')));
$table->data[0][9] = "<a href='index.php?search_category=graphs&keywords=".$keyword."&head_search_keywords=Search'>" .
sprintf(__("Found %s"), $totalGraphs) . "</a>";
$table->data[0][8] = html_print_image ("images/reporting.png", true, array ("title" => __('Reports found')));
$table->data[0][9] = "<a href='index.php?search_category=reports&keywords=".$keyword."&head_search_keywords=Search'>" .
sprintf(__("Found %s"), $totalReports) . "</a>";
$table->data[0][10] = html_print_image ("images/visual_console_green.png", true, array ("title" => __('Maps found')));
$table->data[0][11] = "<a href='index.php?search_category=maps&keywords=".$keyword."&head_search_keywords=Search'>" .
sprintf(__("Found %s"), $totalMaps) . "</a>";
html_print_table($table);
if ($searchAgents && $totalAgents > 0) {
echo '<fieldset class="databox tactical_set">';
echo '<legend>' . __('Agents') . '</legend>';
echo sprintf(__("%d results found"), $totalAgents) . " <a href='index.php?search_category=agents&keywords=".$keyword."&head_search_keywords=Search'>" . html_print_image('images/zoom.png', true, array('title' => __('Show results'))) . "</a>";
echo '</fieldset>';
$anyfound = true;
}
if ($searchModules && $totalModules > 0) {
echo '<fieldset class="databox tactical_set">';
echo '<legend>' . __('Modules') . '</legend>';
echo sprintf(__("%d results found"), $totalModules) . " <a href='index.php?search_category=modules&keywords=".$keyword."&head_search_keywords=Search'>" . html_print_image('images/zoom.png', true, array('title' => __('Show results'))) . "</a>";
echo '</fieldset>';
$anyfound = true;
}
if ($searchAlerts && $totalAlerts > 0) {
echo '<fieldset class="databox tactical_set">';
echo '<legend>' . __('Alerts') . '</legend>';
echo sprintf(__("%d results found"), $totalAlerts) . " <a href='index.php?search_category=alerts&keywords=".$keyword."&head_search_keywords=Search'>" . html_print_image('images/zoom.png', true, array('title' => __('Show results'))) . "</a>";
echo '</fieldset>';
$anyfound = true;
}
if ($searchUsers && $totalUsers > 0) {
echo '<fieldset class="databox tactical_set">';
echo '<legend>' . __('Users') . '</legend>';
echo sprintf(__("%d results found"), $totalUsers) . " <a href='index.php?search_category=users&keywords=".$keyword."&head_search_keywords=Search'>" . html_print_image('images/zoom.png', true, array('title' => __('Show results'))) . "</a>";
echo '</fieldset>';
$anyfound = true;
}
if ($searchGraphs && $totalGraphs > 0) {
echo '<fieldset class="databox tactical_set">';
echo '<legend>' . __('Graphs') . '</legend>';
echo sprintf(__("%d results found"), $totalGraphs) . " <a href='index.php?search_category=graphs&keywords=".$keyword."&head_search_keywords=Search'>" . html_print_image('images/zoom.png', true, array('title' => __('Show results'))) . "</a>";
echo '</fieldset>';
$anyfound = true;
}
if ($searchReports && $totalReports > 0) {
echo '<fieldset class="databox tactical_set">';
echo '<legend>' . __('Reports') . '</legend>';
echo sprintf(__("%d results found"), $totalReports) . " <a href='index.php?search_category=reports&keywords=".$keyword."&head_search_keywords=Search'>" . html_print_image('images/zoom.png', true, array('title' => __('Show results'))) . "</a>";
echo '</fieldset>';
$anyfound = true;
}
if ($searchMaps && $totalMaps > 0) {
echo '<fieldset class="databox tactical_set">';
echo '<legend>' . __('Maps') . '</legend>';
echo sprintf(__("%d results found"), $totalMaps) . " <a href='index.php?search_category=maps&keywords=".$keyword."&head_search_keywords=Search'>" . html_print_image('images/zoom.png', true, array('title' => __('Show results'))) . "</a>";
echo '</fieldset>';
$anyfound = true;
}
if(!$anyfound) {
echo "<br><div class='nf'>" . __("Zero results found") . "</div>\n";
echo $list_agents;
}
echo '</div>';

View File

@ -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'] .

View File

@ -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');