2010-04-19 Pablo de la Concepción <pablo.concepcion@artica.es>

* godmode/agentes/module_manager_editor_prediction.php: Make the services
	part (Enterprise) work nicely.

	* godmode/agentes/configurar_agente.php: Added enterprise hook for the 
	services parameters.



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@2576 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
Pablo de la Concepción Sanz 2010-04-19 09:43:32 +00:00
parent 7a2439334a
commit 643020236a
3 changed files with 64 additions and 26 deletions

View File

@ -1,3 +1,11 @@
2010-04-19 Pablo de la Concepción <pablo.concepcion@artica.es>
* godmode/agentes/module_manager_editor_prediction.php: Make the services
part (Enterprise) work nicely.
* godmode/agentes/configurar_agente.php: Added enterprise hook for the
services parameters.
2010-04-19 Pablo de la Concepción <pablo.concepcion@artica.es>
* include/javascript/pandora.js: Added function agent_module_autocomplete

View File

@ -201,7 +201,7 @@ if ($id_agente) {
echo '<li class="nomn"><a href="index.php?sec=gagente&amp;sec2=godmode/agentes/configurar_agente&amp;id_agente='.$id_agente.'">';
print_image ("images/setup.png", false, $img_style);
echo '&nbsp; '.mb_substr(get_agent_name ($id_agente), 0, 21) .'</a>';
echo '&nbsp;<img src="images/help.png" class="img_help" title="'.__('Help').'" onclick="open_help(\'agent_manager\')" alt="'.__('Help').'">';
//echo '&nbsp;'. print_help_icon ('agent_manager', true);
echo "</li></ul></div>";
echo '<div id="menu_tab"><ul class="mn"><li class="nomn">';
@ -459,6 +459,10 @@ if ($update_module || $create_module) {
$custom_string_3 = "";
$custom_integer_1 = "";
$custom_integer_2 = "";
// Services are an enterprise feature, so we got the parameters using this function.
enterprise_hook ('get_service_parameters');
$agent_name = (string) get_parameter('agent_name',get_agent_name ($id_agente));
$snmp_community = (string) get_parameter ('snmp_community');
$snmp_oid = (string) get_parameter ('snmp_oid');

View File

@ -13,10 +13,28 @@
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
enterprise_include_once('include/functions_policies.php');
enterprise_include_once('godmode/agentes/module_manager_editor_prediction.php');
$disabledBecauseInPolicy = false;
$disabledTextBecauseInPolicy = '';
$page = get_parameter('page', '');
$id_agente = get_parameter('id_agente', '');
$agent_name = get_parameter('agent_name', get_agent_name($id_agente));
$id_agente_modulo= get_parameter('id_agent_module',0);
$sql = 'SELECT * FROM tagente_modulo WHERE id_agente_modulo = '.$id_agente_modulo;
$row = get_db_row_sql($sql);
$is_service = false;
if ($row !== false && is_array($row)) {
$prediction_module = $row['prediction_module'];
// Services are an Enterprise feature.
$service_select = $row['custom_integer_1'];
if ($service_select > 0) {
$is_service = true;
}
}
else {
$service_select = 0;
}
if (strstr($page, "policy_modules") === false) {
if ($config['enterprise_installed'])
$disabledBecauseInPolicy = isModuleInPolicy($id_agent_module);
@ -31,33 +49,35 @@ $extra_title = __('Prediction server module');
$data = array ();
$data[0] = __('Source module');
$data[0] .= print_help_icon ('prediction_source_module', true);
$groups = get_user_groups ($config["id_user"], "AR");
$agents = get_group_agents (array_keys ($groups));
if ($prediction_module) {
$prediction_id_agent = get_agentmodule_agent ($prediction_module);
$prediction_id_group = get_agent_group ($prediction_id_agent);
} else {
$prediction_id_agent = $id_agente;
$prediction_id_group = get_agent_group ($id_agente);
$data[1] = '';
// Services are an Enterprise feature.
$module_service_selector = enterprise_hook('get_module_service_selector', array($is_service));
if ($module_service_selector !== ENTERPRISE_NOT_HOOK) {
$data[1] = $module_service_selector;
}
$modules = get_agent_modules ($prediction_id_agent, false, 'disabled = 0 AND history_data = 1');
$data[1] .= '<div id="module_data" style="top:1em; float:left; width:50%;">';
$data[1] .= print_label(__("Agent"),'agent_name', true)."<br/>";
$sql = "SELECT id_agente, nombre FROM tagente";
// TODO: ACL Filter
$data[1] .= print_input_text_extended ('agent_name',$agent_name, 'text_agent_name', '', 30, 100, $is_service, '',
array('style' => 'background: url(images/lightning.png) no-repeat right;'), true, false);
$data[1] .= '<a href="#" class="tip">&nbsp;<span>' . __("Type at least two characters to search") . '</span></a>&nbsp; <br/>';
$data[1] .= print_label(__("Module"),'prediction_module',true);
if($id_agente) {
$sql = "SELECT id_agente_modulo, nombre FROM tagente_modulo WHERE id_agente = ".$id_agente;
$data[1] .= print_select_from_sql($sql, 'prediction_module', $prediction_module, false, __('Select Module'), 0, true, false, true, $is_service);
}
else {
$data[1] .= '<select id="prediction_module" name="prediction_module" disabled="disabled"><option value="0">Select an Agent first</option></select>';
}
$data[1] .= print_input_hidden ('id_agente', $id_agente, true);
$data[1] .= '</div>';
$data[1] = '<label for="prediction_id_group">'.__('Group').'</label>';
$data[1] .= print_select ($groups, 'prediction_id_group', $prediction_id_group, '',
'', '', true, false, true, '', $disabledBecauseInPolicy);
$data[1] .= ' <span id="agent_loading" class="invisible">';
$data[1] .= '<img src="images/spinner.png" />';
$data[1] .= '</span>';
$data[1] .= '<label for="prediction_id_agent">'.__('Agent').'</label>';
$data[1] .= print_select ($agents, 'prediction_id_agent', $prediction_id_agent, '',
'', '', true, false, true, '', $disabledBecauseInPolicy);
$data[1] .= ' <span id="module_loading" class="invisible">';
$data[1] .= '<img src="images/spinner.png" />';
$data[1] .= '</span>';
$data[1] .= '<label for="prediction_module">'.__('Module').'</label>';
$data[1] .= print_select ($modules, 'prediction_module', $prediction_module, '',
'', '', true, false, true, '', $disabledBecauseInPolicy);
// Services are an Enterprise feature.
$selector_form = enterprise_hook('get_selector_form', array($is_service, $service_select));
if ($selector_form !== ENTERPRISE_NOT_HOOK) {
$data[1] .= $selector_form;
}
$table_simple->colspan['prediction_module'][1] = 3;
@ -68,3 +88,9 @@ unset ($table_advanced->data[3]);
unset ($table_advanced->data[2][2]);
unset ($table_advanced->data[2][3]);
?>
<script type="text/javascript">
$(document).ready(function() {agent_module_autocomplete ("#text_agent_name", "#id_agente", "#prediction_module")});
<?php enterprise_hook('print_services_javascript'); ?>
</script>