2012-12-12 Miguel de Dios <miguel.dedios@artica.es>

* include/functions_visual_map_editor.php: increased the size of
	agent autocomplete widget.
	
	* include/functions_visual_map.php: in the function
	"visual_map_print_visual_map" changed for to print corretly the
	urls in public view in metaconsole.
	
	* include/ajax/agent.php: restore the search for any string in
	the autocomplete agent.
	
	* operation/reporting/reporting_xml.php,
	operation/search_results.php,
	operation/visual_console/public_console.php,
	godmode/setup/setup_auth.php, godmode/servers/modificar_server.php:
	cleaned source code style.
	
	* godmode/reporting/visual_console_builder.editor.js: fixed when
	finish a resize action or put the grid, before these actions
	was make a corrupt data of items.




git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7269 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
mdtrooper 2012-12-12 13:51:45 +00:00
parent 8776218209
commit 4b5b7c0db8
10 changed files with 134 additions and 96 deletions

View File

@ -1,3 +1,25 @@
2012-12-12 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_visual_map_editor.php: increased the size of
agent autocomplete widget.
* include/functions_visual_map.php: in the function
"visual_map_print_visual_map" changed for to print corretly the
urls in public view in metaconsole.
* include/ajax/agent.php: restore the search for any string in
the autocomplete agent.
* operation/reporting/reporting_xml.php,
operation/search_results.php,
operation/visual_console/public_console.php,
godmode/setup/setup_auth.php, godmode/servers/modificar_server.php:
cleaned source code style.
* godmode/reporting/visual_console_builder.editor.js: fixed when
finish a resize action or put the grid, before these actions
was make a corrupt data of items.
2012-12-12 Ramon Novoa <rnovoa@artica.es>
* pandoradb_data.sql,

View File

@ -1199,7 +1199,8 @@ function updateDB_visual(type, idElement , values, event, top, left) {
case 'module_graph':
$("#image_" + idElement).attr("src", getModuleGraph(idElement));
case 'static_graph':
if (event != 'dragstop') {
if ((event != 'resizestop') && (event != 'show_grid')
&& (event != 'dragstop')) {
var element_status= null;
var parameter = Array();
parameter.push ({name: "page", value: "include/ajax/visual_console_builder.ajax"});
@ -1336,6 +1337,7 @@ function updateDB(type, idElement , values, event) {
//Check if the event parameter in function is passed in the call.
if (event != null) {
switch (event) {
case 'show_grid':
case 'resizestop':
//Force to move action when resize a background, for to avoid
//lost the label.
@ -1626,7 +1628,7 @@ function eventsBackground() {
values['width'] = $('#background').css('width').replace('px', '');
values['height'] = $('#background').css('height').replace('px', '');
updateDB('background', 0, values);
updateDB('background', 0, values, 'resizestop');
width = ui.size['width'];
height = ui.size['height'];
@ -1687,7 +1689,7 @@ function move_elements_resize(original_width, original_height, width, height) {
values['absolute_left'] = new_width;
values['absolute_top'] = new_height;
updateDB(classItem, idItem, values);
updateDB(classItem, idItem, values, "resizestop");
});
}
@ -1928,7 +1930,7 @@ function showGrid() {
values['absolute_left'] = pos_x;
values['absolute_top'] = pos_y;
updateDB(classItem, idItem, values);
updateDB(classItem, idItem, values, 'show_grid');
});
eventsItems([SIZE_GRID, SIZE_GRID]);

View File

@ -45,8 +45,8 @@ if (isset($_GET["server"])) {
$table->data[] = array (__('IP Address'),html_print_input_text ('address',$row["ip_address"],'',50,0,true));
$table->data[] = array (__('Description'),html_print_input_text ('description',$row["description"],'',50,0,true));
html_print_table ($table);
echo '<div class="action-buttons" style="width: 98%">';
echo '<input type="submit" class="sub upd" value="'.__('Update').'">';
echo "</div>";
@ -83,24 +83,24 @@ else {
}
}
$servers = servers_get_info ();
if ($servers === false) {
echo "<div class='nf'>".__('There are no servers configured into the database')."</div>";
return;
}
$table->width = '98%';
$table->size = array ();
$table->style = array ();
$table->style[0] = 'font-weight: bold';
$table->align = array ();
$table->align[1] = 'center';
$table->align[8] = 'center';
$table->head = array ();
$table->head[0] = __('Name');
$table->head[1] = __('Status');
@ -111,15 +111,15 @@ else {
$table->head[6] = __('T/Q') . ui_print_help_tip (__("Threads / Queued modules currently"), true);
// This will have a column of data such as "6 hours"
$table->head[7] = __('Updated');
//Only Pandora Administrator can delete servers
if (check_acl ($config["id_user"], 0, "PM")) {
$table->head[8] = '<span title="Operations">' . __('Op.') . '</span>';
}
$table->data = array ();
foreach ($servers as $server) {
$data = array ();
@ -156,10 +156,10 @@ else {
$data[5] = '<span style="white-space:nowrap;">'.$server["lag_txt"].'</span>';
break;
}
$data[6] = $server['threads'].' : '.$server['queued_modules'];
$data[7] = ui_print_timestamp ($server['keepalive'], true);
//Only Pandora Administrator can delete servers
if (check_acl ($config["id_user"], 0, "PM")) {
$data[8] = '<a href="index.php?sec=gservers&sec2=godmode/servers/modificar_server&server='.$server["id_server"].'">';
@ -169,15 +169,15 @@ else {
$data[8] .= '&nbsp;&nbsp;<a href="index.php?sec=gservers&sec2=godmode/servers/modificar_server&server_del='.$server["id_server"].'&amp;delete=1">';
$data[8] .= html_print_image ('images/cross.png', true, array ('title' => __('Delete'), 'onclick' => "if (! confirm ('" . __('Modules run by this server will stop working. Do you want to continue?') ."')) return false"));
$data[8] .= '</a>';
}
}
array_push ($table->data, $data);
}
html_print_table ($table);
//Legend
echo "<table>";
echo "<tr><td colspan='5'>" . __('Legend') . "</td></tr>";
echo "<tr>";
@ -196,5 +196,4 @@ else {
echo '<td><span class="prediction">'.__('Prediction server').'</span></td>';
echo "</tr></table>";
}
?>
?>

View File

@ -49,7 +49,7 @@ $table->data[2][0] = __('Autocreate profile');
$profile_list = profile_get_profiles ();
if ($profile_list === false) {
$profile_list = array ();
}
}
$table->data[2][1] = html_print_select ($profile_list, 'default_remote_profile', $config['default_remote_profile'], '', '', '', true, false, true, '', $config['autocreate_remote_users'] == 0);
$table->data[3][0] = __('Autocreate profile group');
$table->data[3][1] = html_print_select_groups ($config['id_user'], "AR", true, 'default_remote_group', $config['default_remote_group'], '', '', '', true, false, true, '', $config['autocreate_remote_users'] == 0);
@ -96,7 +96,7 @@ echo '</form>';
<script type="text/javascript">
function show_selected_rows () {
var auth_method = $("#auth").val ();
$(".remote").css("display", "none");
$(".ldap").css("display", "none");
$(".ad").css("display", "none");
@ -109,10 +109,10 @@ echo '</form>';
}
$("." + auth_method).css('display', '');
}
function enable_profile_options () {
var remote_auto = $("input:radio[name=autocreate_remote_users]:checked").val();
if (remote_auto == 0) {
$("#default_remote_profile").attr("disabled", true);
$("#default_remote_group").attr("disabled", true);

View File

@ -241,10 +241,10 @@ elseif ($search_agents_2 && ($config['metaconsole'] == 1) && defined('METACONSOL
switch ($config["dbtype"]) {
case "mysql":
case "postgresql":
$filter[] = '(nombre COLLATE utf8_general_ci LIKE "'.$string.'%" OR direccion LIKE "'.$string.'%")';
$filter[] = '(nombre COLLATE utf8_general_ci LIKE "%'.$string.'%" OR direccion LIKE "%'.$string.'%")';
break;
case "oracle":
$filter[] = '(UPPER(nombre) LIKE UPPER(\''.$string.'%\') OR UPPER(direccion) LIKE UPPER(\''.$string.'%\'))';
$filter[] = '(UPPER(nombre) LIKE UPPER(\'%'.$string.'%\') OR UPPER(direccion) LIKE UPPER(\'%'.$string.'%\'))';
break;
}

View File

@ -868,6 +868,8 @@ function visual_map_print_visual_map ($id_layout, $show_links = true, $draw_line
$metaconsole_hack = '../../';
}
enterprise_include_once("meta/include/functions_ui_meta.php");
$layout = db_get_row ('tlayout', 'id', $id_layout);
$resizedMap = false;
@ -1037,7 +1039,7 @@ function visual_map_print_visual_map ($id_layout, $show_links = true, $draw_line
$id_service . '&offset=0">';
}
else {
if (!defined('METACONSOLE')) {
if (empty($layout_data['id_metaconsole'])) {
$url = $config['homeurl'] . 'index.php?sec=estado&amp;sec2=operation/agentes/ver_agente&amp;id_agente=' . $layout_data['id_agent'];
}
else {
@ -1052,7 +1054,7 @@ function visual_map_print_visual_map ($id_layout, $show_links = true, $draw_line
}
elseif ($layout_data['id_layout_linked'] > 0) {
// Link to a map
if (!defined('METACONSOLE')) {
if (empty($layout_data['id_metaconsole'])) {
echo '<a href="index.php?sec=reporting&amp;sec2=operation/visual_console/render_view&amp;pure='.$config["pure"].'&amp;id='.$layout_data["id_layout_linked"].'">';
}
else {
@ -1170,7 +1172,7 @@ function visual_map_print_visual_map ($id_layout, $show_links = true, $draw_line
if ($show_links) {
if ($layout_data['id_layout_linked'] > 0) {
// Link to a map
if (!defined('METACONSOLE')) {
if (empty($layout_data['id_metaconsole'])) {
echo '<a href="index.php?sec=reporting&amp;sec2=operation/visual_console/render_view&amp;pure='.$config["pure"].'&amp;id='.$layout_data["id_layout_linked"].'">';
}
else {
@ -1282,7 +1284,7 @@ function visual_map_print_visual_map ($id_layout, $show_links = true, $draw_line
}
elseif ($layout_data['id_layout_linked'] > 0) {
// Link to a map
if (!defined('METACONSOLE')) {
if (empty($layout_data['id_metaconsole'])) {
echo '<a href="index.php?sec=reporting&amp;sec2=operation/visual_console/render_view&amp;pure='.$config["pure"].'&amp;id='.$layout_data["id_layout_linked"].'">';
}
else {
@ -1499,7 +1501,7 @@ function visual_map_print_visual_map ($id_layout, $show_links = true, $draw_line
}
else {
// Link to an agent
if (!defined('METACONSOLE')) {
if (empty($layout_data['id_metaconsole'])) {
$url = $config['homeurl'] .
'index.php?' .
'sec=estado&amp;' .
@ -1518,7 +1520,7 @@ function visual_map_print_visual_map ($id_layout, $show_links = true, $draw_line
elseif ($layout_data['id_layout_linked'] > 0) {
// Link to a map
if (!defined('METACONSOLE')) {
if (empty($layout_data['id_metaconsole'])) {
echo '<a href="index.php?sec=reporting&amp;sec2=operation/visual_console/render_view&amp;pure='.$config["pure"].'&amp;id='.$layout_data["id_layout_linked"].'">';
}
else {
@ -1604,7 +1606,7 @@ function visual_map_print_visual_map ($id_layout, $show_links = true, $draw_line
$id_service . '&offset=0">';
}
else {
if (!defined('METACONSOLE')) {
if (empty($layout_data['id_metaconsole'])) {
$url = $config['homeurl'] .
'index.php?' .
'sec=estado&amp;'.
@ -1621,7 +1623,7 @@ function visual_map_print_visual_map ($id_layout, $show_links = true, $draw_line
}
else {
// Link to a map
if (!defined('METACONSOLE')) {
if (empty($layout_data['id_metaconsole'])) {
echo '<a href="index.php?sec=reporting&amp;sec2=operation/visual_console/render_view&amp;pure='.$config["pure"].'&amp;id='.$layout_data["id_layout_linked"].'">';
}
else {

View File

@ -46,7 +46,7 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) {
echo '<div id="properties_panel" style="display: none; position: absolute; border: 2px solid #114105; padding: 5px; background: white; z-index: 90;">';
//----------------------------Hiden Form----------------------------
?>
<table class="databox" border="0" cellpadding="4" cellspacing="4" width="300">
<table class="databox" border="0" cellpadding="4" cellspacing="4" width="350">
<caption>
<?php
$titles = array(
@ -110,7 +110,7 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) {
$params['return'] = true;
$params['show_helptip'] = true;
$params['input_name'] = 'agent';
$params['size'] = 20;
$params['size'] = 30;
$params['selectbox_id'] = 'module';
$params['javascript_is_function_select'] = true;
if (defined('METACONSOLE')) {

View File

@ -209,19 +209,21 @@ foreach ($contents as $content) {
$data["period"] = human_time_description_raw ($content['period']);
$data["uperiod"] = $content['period'];
$data["type"] = $content["type"];
// Support for metaconsole
$server_name = $content ['server_name'];
// Disable remote connections for netflow report items
if ($content['type'] != 'netflow_area' &&
$content['type'] != 'netflow_pie' &&
$content['type'] != 'netflow_data' &&
$content['type'] != 'netflow_statistics' &&
$content['type'] != 'netflow_summary') {
$remote_connection = 1;
} else {
$remote_connection = 0;
$content['type'] != 'netflow_pie' &&
$content['type'] != 'netflow_data' &&
$content['type'] != 'netflow_statistics' &&
$content['type'] != 'netflow_summary') {
$remote_connection = 1;
}
else {
$remote_connection = 0;
}
if (($config ['metaconsole'] == 1) && ($server_name != '') && defined('METACONSOLE') && $remote_connection == 1) {
@ -229,11 +231,11 @@ foreach ($contents as $content) {
if (metaconsole_connect($connection) != NOERR){
//ui_print_error_message ("Error connecting to ".$server_name);
}
}
}
$session_id = session_id();
switch ($content["type"]) {
case 1:
case 'simple_graph':
$data["module"] = io_safe_output_xml (db_get_value ('nombre', 'tagente_modulo', 'id_agente_modulo', $content['id_agent_module']));
@ -241,43 +243,47 @@ foreach ($contents as $content) {
$data["title"] = __('Simple graph');
$data["objdata"] = array();
$date_end = time();
$date_init = $date_end - $content['period'];
///
$temp_file = $config['attachment_store'] . '/simple_graph_' . $time.'_'.$content['id_rc'] . '.tmp';
$file = fopen ($temp_file, 'a+');
$buffer_file["objdata"] = $config['attachment_store'] . '/simple_graph_' . $time.'_'.$content['id_rc'] . '.tmp';
$limit = 1000;
$offset = 0;
$sql_count = "SELECT COUNT(id_agente_modulo) FROM tagente_datos WHERE id_agente_modulo=".$content['id_agent_module']."
$sql_count = "SELECT COUNT(id_agente_modulo)
FROM tagente_datos
WHERE id_agente_modulo=".$content['id_agent_module']."
AND (utimestamp>=$date_init AND utimestamp<=$date_end)";
$data_count = db_get_value_sql($sql_count);
if ($data_count == false) {
$content_report = " <simple_graph/>\n";
$result = fwrite($file, $content_report);
fclose($file);
} else if ($data_count <= $limit) {
}
else if ($data_count <= $limit) {
$content_report = " <simple_graph>\n";
$result = fwrite($file, $content_report);
fclose($file);
$sql = "SELECT * FROM tagente_datos WHERE id_agente_modulo=".$content['id_agent_module']."
AND (utimestamp>=$date_init AND utimestamp<=$date_end)";
$sql = "SELECT *
FROM tagente_datos
WHERE id_agente_modulo=".$content['id_agent_module']."
AND (utimestamp>=$date_init AND utimestamp<=$date_end)";
$data_module = db_get_all_rows_sql($sql);
xml_file_graph ($data_module, $temp_file);
$file = fopen ($temp_file, 'a+');
$content_report = " </simple_graph>\n";
$result = fwrite($file, $content_report);
} else {
}
else {
$content_report = " <simple_graph>\n";
$result = fwrite($file, $content_report);
fclose($file);
@ -285,8 +291,10 @@ foreach ($contents as $content) {
$position = 0;
while ($offset < $data_count) {
$sql = "SELECT * FROM tagente_datos WHERE id_agente_modulo=".$content['id_agent_module']."
AND (utimestamp>=$date_init AND utimestamp<=$date_end) LIMIT $offset,$limit";
$sql = "SELECT *
FROM tagente_datos
WHERE id_agente_modulo=".$content['id_agent_module']."
AND (utimestamp>=$date_init AND utimestamp<=$date_end) LIMIT $offset,$limit";
$data_module = db_get_all_rows_sql($sql);
$position = xml_file_graph ($data_module, $temp_file, $position);
@ -298,10 +306,9 @@ foreach ($contents as $content) {
$result = fwrite($file, $content_report);
fclose($file);
}
///
break;
case 'simple_baseline_graph':
$data["module"] = io_safe_output_xml (db_get_value ('nombre', 'tagente_modulo', 'id_agente_modulo', $content['id_agent_module']));
$data["agent"] = io_safe_output_xml (modules_get_agentmodule_agent_name ($content['id_agent_module']));
$data["title"] = __('Simple baseline graph');
@ -309,31 +316,36 @@ foreach ($contents as $content) {
$date_end = time();
$date_init = $date_end - $content['period'];
///
$temp_file = $config['attachment_store'] . '/simple_baseline_graph_' . $time.'_'.$content['id_rc'] . '.tmp';
$file = fopen ($temp_file, 'a+');
$buffer_file["objdata"] = $config['attachment_store'] . '/simple_baseline_graph_' . $time.'_'.$content['id_rc'] . '.tmp';
$limit = 1000;
$offset = 0;
$sql_count = "SELECT COUNT(id_agente_modulo) FROM tagente_datos WHERE id_agente_modulo=".$content['id_agent_module']."
$sql_count = "SELECT COUNT(id_agente_modulo)
FROM tagente_datos
WHERE id_agente_modulo=".$content['id_agent_module']."
AND (utimestamp>=$date_init AND utimestamp<=$date_end)";
$data_count = db_get_value_sql($sql_count);
if ($data_count == false) {
$content_report = " <simple_baseline_graph/>\n";
$result = fwrite($file, $content_report);
} else if ($data_count <= $limit) {
}
else if ($data_count <= $limit) {
$content_report = " <simple_baseline_graph>\n";
$result = fwrite($file, $content_report);
fclose($file);
$sql = "SELECT * FROM tagente_datos WHERE id_agente_modulo=".$content['id_agent_module']."
AND (utimestamp>=$date_init AND utimestamp<=$date_end)";
$sql = "SELECT *
FROM tagente_datos
WHERE id_agente_modulo=".$content['id_agent_module']."
AND (utimestamp>=$date_init AND utimestamp<=$date_end)";
$data_module = db_get_all_rows_sql($sql);
xml_file_graph ($data_module, $temp_file);
@ -341,8 +353,9 @@ foreach ($contents as $content) {
$content_report = " </simple_baseline_graph>\n";
$result = fwrite($file, $content_report);
fclose($file);
} else {
}
else {
$content_report = " <simple_baseline_graph>\n";
$result = fwrite($file, $content_report);
fclose($file);

View File

@ -56,7 +56,7 @@ $selected = 'border: 1px solid black;';
if ($searchAgents) {
$agents_tab = array('text' => "<a href='index.php?search_category=agents&keywords=".$config['search_keywords']."&head_search_keywords=Search'>"
. html_print_image ("images/bricks.png", true, array ("title" => __('Agents'))) . "</a>", 'active' => $searchTab == "agents");
. html_print_image ("images/bricks.png", true, array ("title" => __('Agents'))) . "</a>", 'active' => $searchTab == "agents");
}
else {
$agents_tab = '';
@ -64,7 +64,7 @@ else {
if ($searchUsers) {
$users_tab = array('text' => "<a href='index.php?search_category=users&keywords=".$config['search_keywords']."&head_search_keywords=Search'>"
. html_print_image ("images/group.png", true, array ("title" => __('Users'))) . "</a>", 'active' => $searchTab == "users");
. html_print_image ("images/group.png", true, array ("title" => __('Users'))) . "</a>", 'active' => $searchTab == "users");
}
else {
$users_tab = '';
@ -72,15 +72,15 @@ else {
if ($searchAlerts) {
$alerts_tab = array('text' => "<a href='index.php?search_category=alerts&keywords=".$config['search_keywords']."&head_search_keywords=Search'>"
. html_print_image ("images/god2.png", true, array ("title" => __('Alerts'))) . "</a>", 'active' => $searchTab == "alerts");
. html_print_image ("images/god2.png", true, array ("title" => __('Alerts'))) . "</a>", 'active' => $searchTab == "alerts");
}
else {
$alerts_tab = '';
}
}
if ($searchGraphs) {
$graphs_tab = array('text' => "<a href='index.php?search_category=graphs&keywords=".$config['search_keywords']."&head_search_keywords=Search'>"
. html_print_image ("images/chart_curve.png", true, array ("title" => __('Graphs'))) . "</a>", 'active' => $searchTab == "graphs");
. html_print_image ("images/chart_curve.png", true, array ("title" => __('Graphs'))) . "</a>", 'active' => $searchTab == "graphs");
}
else {
$graphs_tab = '';
@ -88,7 +88,7 @@ else {
if ($searchReports) {
$reports_tab = array('text' => "<a href='index.php?search_category=reports&keywords=".$config['search_keywords']."&head_search_keywords=Search'>"
. html_print_image ("images/reporting.png", true, array ("title" => __('Reports'))) . "</a>", 'active' => $searchTab == "reports");
. html_print_image ("images/reporting.png", true, array ("title" => __('Reports'))) . "</a>", 'active' => $searchTab == "reports");
}
else {
$reports_tab = '';
@ -96,7 +96,7 @@ else {
if ($searchMaps) {
$maps_tab = array('text' => "<a href='index.php?search_category=maps&keywords=".$config['search_keywords']."&head_search_keywords=Search'>"
. html_print_image ("images/camera.png", true, array ("title" => __('Maps'))) . "</a>", 'active' => $searchTab == "maps");
. html_print_image ("images/camera.png", true, array ("title" => __('Maps'))) . "</a>", 'active' => $searchTab == "maps");
}
else {
$maps_tab = '';
@ -104,17 +104,17 @@ else {
if ($searchModules) {
$modules_tab = array('text' => "<a href='index.php?search_category=modules&keywords=".$config['search_keywords']."&head_search_keywords=Search'>"
. html_print_image ("images/lightbulb.png", true, array ("title" => __('Modules'))) . "</a>", 'active' => $searchTab == "modules");
. html_print_image ("images/lightbulb.png", true, array ("title" => __('Modules'))) . "</a>", 'active' => $searchTab == "modules");
}
else {
$modules_tab = '';
}
$onheader = array('agents' => $agents_tab, 'users' => $users_tab,
'alerts' => $alerts_tab, 'graphs' => $graphs_tab,
'reports' => $reports_tab, 'maps' => $maps_tab,
'modules' => $modules_tab);
'alerts' => $alerts_tab, 'graphs' => $graphs_tab,
'reports' => $reports_tab, 'maps' => $maps_tab,
'modules' => $modules_tab);
ui_print_page_header (__("Search").": \"".$config['search_keywords']."\"", "images/zoom.png", false, "", false, $onheader);
switch ($searchTab) {
@ -140,4 +140,4 @@ switch ($searchTab) {
require_once('search_modules.php');
break;
}
?>
?>

View File

@ -46,7 +46,7 @@ $config["id_user"] = get_parameter ('id_user');
$myhash = md5($config["dbpass"].$id_layout. $config["id_user"]);
// Check input hash
if ( $myhash != $hash){
if ( $myhash != $hash) {
exit;
}