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

* extensions/resource_registration.php, extensions/system_info.php,
	extensions/update_manager/lib/libupdate_manager.php,
	godmode/agentes/modificar_agente.php,
	godmode/alerts/alert_actions.php,
	godmode/alerts/alert_list.list.php,
	godmode/massive/massive_add_profiles.php,
	godmode/massive/massive_edit_modules.php,
	godmode/servers/manage_recontask.php,
	godmode/setup/setup_visuals.php, include/functions_api.php,
	include/functions_graph.php, include/functions_messages.php,
	include/graphs/functions_flot.php,
	include/graphs/flot/pandora.flot.js, operation/tree.php,
	operation/agentes/status_events.php,
	operation/agentes/ver_agente.php, operation/events/events_list.php,
	operation/events/events_marquee.php,
	operation/events/events_rss.php: cleaned source code style.
	
	* godmode/reporting/reporting_builder.item_editor.php,
	include/functions_ui.php, include/ajax/agent.php: continue to change
	to the new function "ui_print_agent_autocomplete_input" to make more
	easy (and standar) the autocomplete agent input.




git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6988 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
mdtrooper 2012-09-19 14:45:59 +00:00
parent b4e5748f7e
commit 02a119099f
25 changed files with 391 additions and 301 deletions

View File

@ -1,3 +1,27 @@
2012-09-19 Miguel de Dios <miguel.dedios@artica.es>
* extensions/resource_registration.php, extensions/system_info.php,
extensions/update_manager/lib/libupdate_manager.php,
godmode/agentes/modificar_agente.php,
godmode/alerts/alert_actions.php,
godmode/alerts/alert_list.list.php,
godmode/massive/massive_add_profiles.php,
godmode/massive/massive_edit_modules.php,
godmode/servers/manage_recontask.php,
godmode/setup/setup_visuals.php, include/functions_api.php,
include/functions_graph.php, include/functions_messages.php,
include/graphs/functions_flot.php,
include/graphs/flot/pandora.flot.js, operation/tree.php,
operation/agentes/status_events.php,
operation/agentes/ver_agente.php, operation/events/events_list.php,
operation/events/events_marquee.php,
operation/events/events_rss.php: cleaned source code style.
* godmode/reporting/reporting_builder.item_editor.php,
include/functions_ui.php, include/ajax/agent.php: continue to change
to the new function "ui_print_agent_autocomplete_input" to make more
easy (and standar) the autocomplete agent input.
2012-09-19 Vanessa Gil <vanessa.gil@artica.es> 2012-09-19 Vanessa Gil <vanessa.gil@artica.es>
* gomode/netflow/nf_item_list.php * gomode/netflow/nf_item_list.php

View File

@ -157,7 +157,8 @@ if ($update_action) {
"Trying to access Alert Management"); "Trying to access Alert Management");
require ("general/noaccess.php"); require ("general/noaccess.php");
exit; exit;
}else }
else
// Header // Header
ui_print_page_header (__('Alerts').' &raquo; '.__('Alert actions'), "images/god2.png", false, "", true); ui_print_page_header (__('Alerts').' &raquo; '.__('Alert actions'), "images/god2.png", false, "", true);
} }
@ -220,7 +221,8 @@ if ($delete_action) {
"Trying to access Alert Management"); "Trying to access Alert Management");
require ("general/noaccess.php"); require ("general/noaccess.php");
exit; exit;
}else }
else
// Header // Header
ui_print_page_header (__('Alerts').' &raquo; '.__('Alert actions'), "images/god2.png", false, "", true); ui_print_page_header (__('Alerts').' &raquo; '.__('Alert actions'), "images/god2.png", false, "", true);
// If user tries to delete an action of others groups // If user tries to delete an action of others groups

View File

@ -517,6 +517,12 @@ html_print_input_hidden('id_item', $idItem);
$params['hidden_input_idagent_id'] = 'hidden-id_agent'; $params['hidden_input_idagent_id'] = 'hidden-id_agent';
$params['use_input_server'] = true; $params['use_input_server'] = true;
$params['input_server_id'] = 'hidden-server_name'; $params['input_server_id'] = 'hidden-server_name';
if (($config['metaconsole'] == 1) &&
(defined('METACONSOLE'))) {
//It is a page in the new metaconsole.
$params['metaconsole_enabled'] = true;
$params['javascript_ajax_page'] = '../../ajax.php';
}
ui_print_agent_autocomplete_input($params); ui_print_agent_autocomplete_input($params);
?> ?>

View File

@ -231,7 +231,8 @@ elseif ($search_agents_2 && ($config['metaconsole'] == 1) && defined('METACONSOL
foreach ($agents as $agent) { foreach ($agents as $agent) {
$data[] = array('id' => $agent['id_agente'], $data[] = array('id' => $agent['id_agente'],
'name' => io_safe_output($agent['nombre']) . " (" . io_safe_output($server['server_name']) . ") ", 'name' => io_safe_output($agent['nombre']) . " (" . io_safe_output($server['server_name']) . ") ",
'ip' => io_safe_output($agent['direccion'])); 'ip' => io_safe_output($agent['direccion']),
'server' => io_safe_output($server['server_name']));
} }
//Restore db connection //Restore db connection
metaconsole_restore_db(); metaconsole_restore_db();

View File

@ -3136,7 +3136,6 @@ function api_set_add_plugin_module_policy($id, $thrash1, $other, $thrash3) {
returnData('string', array('type' => 'string', 'data' => $success)); returnData('string', array('type' => 'string', 'data' => $success));
else else
returnError('error_add_plugin_module_policy', 'Error adding plugin module to policy.'); returnError('error_add_plugin_module_policy', 'Error adding plugin module to policy.');
} }
/** /**

View File

@ -2128,18 +2128,43 @@ function ui_print_agent_autocomplete_input($parameters) {
$none_module_text = $parameters['none_module_text']; $none_module_text = $parameters['none_module_text'];
} }
$print_input_server = false; //Default value
if (isset($parameters['print_input_server'])) {
$print_input_server = $parameters['print_input_server'];
}
$use_input_server = false; //Default value $use_input_server = false; //Default value
if (isset($parameters['use_input_server'])) { if (isset($parameters['use_input_server'])) {
$use_input_server = $parameters['use_input_server']; $use_input_server = $parameters['use_input_server'];
} }
$input_server_id = false; //Default value $input_server_name = uniqid('server_'); //Default value
if (isset($parameters['input_server_id'])) { if (isset($parameters['input_server_id'])) {
$input_server_id = $parameters['input_server_id']; $input_server_id = $parameters['input_server_id'];
} }
$input_server_id = 'hidden-' . $input_server_name; //Default value
if (isset($parameters['input_server_id'])) {
$input_server_id = $parameters['input_server_id'];
}
$input_server_value = ''; //Default value
if (isset($parameters['input_server_value'])) {
$input_server_value = $parameters['input_server_value'];
}
$metaconsole_enabled = false; //Default value
if (isset($parameters['metaconsole_enabled'])) {
$metaconsole_enabled = $parameters['metaconsole_enabled'];
}
// Javascript configurations // Javascript configurations
//----------------------------------------- //-----------------------------------------
$javascript_ajax_page = 'ajax.php'; //Default value
if (isset($parameters['javascript_ajax_page'])) {
$javascript_ajax_page = $parameters['javascript_ajax_page'];
}
$javascript_function_action_after_select = ''; //Default value $javascript_function_action_after_select = ''; //Default value
$javascript_function_action_after_select_js_call = ''; //Default value $javascript_function_action_after_select_js_call = ''; //Default value
if (isset($parameters['javascript_function_action_after_select'])) { if (isset($parameters['javascript_function_action_after_select'])) {
@ -2199,10 +2224,20 @@ function ui_print_agent_autocomplete_input($parameters) {
inputs.push ("get_agent_modules_json=1"); inputs.push ("get_agent_modules_json=1");
inputs.push ("page=operation/agentes/ver_agente"); inputs.push ("page=operation/agentes/ver_agente");
if (' . ((int)$metaconsole_enabled) . ') {
inputs.push ("server_name=" + $("#' . $input_server_id . '").val());
}
if ((' . ((int)$print_hidden_input_idagent) . ')
|| (' . ((int)$use_hidden_input_idagent) . ')) {
inputs.push ("id_agent=" + $("#' . $hidden_input_idagent_id . '").val());
}
jQuery.ajax ({ jQuery.ajax ({
data: inputs.join ("&"), data: inputs.join ("&"),
type: "GET", type: "POST",
url: action="ajax.php", url: action="' . $javascript_ajax_page . '",
timeout: 10000, timeout: 10000,
dataType: "json", dataType: "json",
success: function (data) { success: function (data) {
@ -2304,7 +2339,7 @@ function ui_print_agent_autocomplete_input($parameters) {
data: data_params, data: data_params,
async: false, async: false,
type: "POST", type: "POST",
url: action="ajax.php", url: action="' . $javascript_ajax_page . '",
timeout: 10000, timeout: 10000,
dataType: "json", dataType: "json",
success: function (data) { success: function (data) {
@ -2319,25 +2354,36 @@ function ui_print_agent_autocomplete_input($parameters) {
select: function( event, ui ) { select: function( event, ui ) {
var agent_name = ui.item.name; var agent_name = ui.item.name;
var agent_id = ui.item.id; var agent_id = ui.item.id;
var server_name = ui.item.ip; var server_name;
if (' . ((int)$metaconsole_enabled) . ') {
server_name = ui.item.server;
}
else {
server_name = ui.item.ip;
}
//Put the name //Put the name
$(this).val(agent_name); $(this).val(agent_name);
if (' . ((int)$javascript_is_function_select) . ') {
' . $javascript_name_function_select . '(agent_name);
}
if ((' . ((int)$print_hidden_input_idagent) . ') if ((' . ((int)$print_hidden_input_idagent) . ')
|| (' . ((int)$use_hidden_input_idagent) . ')) { || (' . ((int)$use_hidden_input_idagent) . ')) {
$("#' . $hidden_input_idagent_id . '").val(agent_id); $("#' . $hidden_input_idagent_id . '").val(agent_id);
} }
//Put the server id into the hidden input //Put the server id into the hidden input
if (' . ((int)$use_input_server) . ') { if ((' . ((int)$use_input_server) . ')
|| (' . ((int)$print_input_server) . ')) {
$("#' . $input_server_id . '").val(server_name); $("#' . $input_server_id . '").val(server_name);
} }
//Call the function to select (example fill the modules)
if (' . ((int)$javascript_is_function_select) . ') {
' . $javascript_name_function_select . '(agent_name);
}
//Function to call after the select //Function to call after the select
if (' . ((int)!empty($javascript_function_action_after_select_js_call)) . ') { if (' . ((int)!empty($javascript_function_action_after_select_js_call)) . ') {
' . $javascript_function_action_after_select_js_call . ' ' . $javascript_function_action_after_select_js_call . '
@ -2409,6 +2455,11 @@ function ui_print_agent_autocomplete_input($parameters) {
$hidden_input_idagent_value, $hidden_input_idagent_id, true); $hidden_input_idagent_value, $hidden_input_idagent_id, true);
} }
if ($print_input_server) {
$html .= html_print_input_hidden_extended($input_server_name,
$input_server_value, $input_server_id, true);
}
//Write the javascript //Write the javascript
if ($javascript) { if ($javascript) {
if ($javascript_tags) { if ($javascript_tags) {

View File

@ -655,5 +655,4 @@ function flot_slicesbar_graph ($graph_data, $period, $width, $height, $legend, $
return $return; return $return;
} }
?> ?>

View File

@ -316,10 +316,14 @@ if (is_ajax ()) {
if ($config ['metaconsole'] == 1 and !$force_local_modules and defined('METACONSOLE')) { if ($config ['metaconsole'] == 1 and !$force_local_modules and defined('METACONSOLE')) {
if (enterprise_include_once ('include/functions_metaconsole.php') !== ENTERPRISE_NOT_HOOK) { if (enterprise_include_once ('include/functions_metaconsole.php') !== ENTERPRISE_NOT_HOOK) {
$connection = metaconsole_get_connection($server_name); $connection = metaconsole_get_connection($server_name);
if (metaconsole_load_external_db($connection) == NOERR) { if (metaconsole_load_external_db($connection) == NOERR) {
/* Get all agents if no agent was given */ /* Get all agents if no agent was given */
if ($id_agent == 0) if ($id_agent == 0)
$id_agent = array_keys (agents_get_group_agents (array_keys (users_get_groups ()), $search, "none")); $id_agent = array_keys (
agents_get_group_agents (
array_keys (users_get_groups ()), $search, "none"));
$agent_modules = agents_get_modules ($id_agent, $agent_modules = agents_get_modules ($id_agent,
($fields != '' ? explode (',', $fields) : "*"), ($fields != '' ? explode (',', $fields) : "*"),

View File

@ -1135,7 +1135,9 @@ foreach ($result as $event) {
$string .= '<i>- ' . __('Empty') . ' -</i>'; $string .= '<i>- ' . __('Empty') . ' -</i>';
} }
$string .= '</td></tr>'; $string .= '</td></tr>';
} else if ($event["criticity"] == 3) { }
if ($event["criticity"] == 3) {
$string .= '<tr class="' . $odd . '"><td align="left" valign="top">' . '<b>' . __('Warning instructions') . '</td><td align="left">'; $string .= '<tr class="' . $odd . '"><td align="left" valign="top">' . '<b>' . __('Warning instructions') . '</td><td align="left">';
if ($event["warning_instructions"] != '') { if ($event["warning_instructions"] != '') {
$string .= $event["warning_instructions"]; $string .= $event["warning_instructions"];
@ -1146,7 +1148,9 @@ foreach ($result as $event) {
$string .= '<i>- ' . __('Empty') . ' -</i>'; $string .= '<i>- ' . __('Empty') . ' -</i>';
} }
$string .= '</td></tr>'; $string .= '</td></tr>';
} else if ($event["criticity"] == 0) { }
if ($event["criticity"] == 0) {
$string .= '<tr class="' . $odd . '"><td align="left" valign="top">' . '<b>' . __('Unknown instructions') . '</td><td align="left">'; $string .= '<tr class="' . $odd . '"><td align="left" valign="top">' . '<b>' . __('Unknown instructions') . '</td><td align="left">';
if ($event["unknown_instructions"] != '') { if ($event["unknown_instructions"] != '') {
$string .= $event["unknown_instructions"]; $string .= $event["unknown_instructions"];