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

* godmode/agentes/module_manager_editor.php: fixed the javascript
	error when the module have "remote config" and set to translate
	some strings that were not translated.




git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6809 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
mdtrooper 2012-07-25 11:11:29 +00:00
parent e6ae8a76e0
commit 2be7245510
2 changed files with 62 additions and 41 deletions

View File

@ -1,3 +1,9 @@
2012-07-24 Miguel de Dios <miguel.dedios@artica.es>
* godmode/agentes/module_manager_editor.php: fixed the javascript
error when the module have "remote config" and set to translate
some strings that were not translated.
2012-07-24 Miguel de Dios <miguel.dedios@artica.es> 2012-07-24 Miguel de Dios <miguel.dedios@artica.es>
* operation/messages/message_edit.php, * operation/messages/message_edit.php,

View File

@ -73,11 +73,17 @@ if (is_ajax ()) {
switch ($config["dbtype"]) { switch ($config["dbtype"]) {
case "mysql": case "mysql":
$component['type'] = db_get_value_sql('SELECT id_tipo FROM ttipo_modulo WHERE nombre LIKE "' . $typeName . '"'); $component['type'] = db_get_value_sql('
SELECT id_tipo
FROM ttipo_modulo
WHERE nombre LIKE "' . $typeName . '"');
break; break;
case "postgresql": case "postgresql":
case "oracle": case "oracle":
$component['type'] = db_get_value_sql('SELECT id_tipo FROM ttipo_modulo WHERE nombre LIKE \'' . $typeName . '\''); $component['type'] = db_get_value_sql('
SELECT id_tipo
FROM ttipo_modulo
WHERE nombre LIKE \'' . $typeName . '\'');
break; break;
} }
@ -104,11 +110,12 @@ if (is_ajax ()) {
$snmp3_privacy_method = get_parameter('snmp3_privacy_method'); $snmp3_privacy_method = get_parameter('snmp3_privacy_method');
$snmp3_privacy_pass = get_parameter('snmp3_privacy_pass'); $snmp3_privacy_pass = get_parameter('snmp3_privacy_pass');
$snmp_port = get_parameter('snmp_port'); $snmp_port = get_parameter('snmp_port');
$snmpwalk = get_snmpwalk($ip_target, $snmp_version, $snmp_community, $snmp3_auth_user, $snmpwalk = get_snmpwalk($ip_target, $snmp_version, $snmp_community,
$snmp3_security_level, $snmp3_auth_method, $snmp3_auth_pass, $snmp3_auth_user, $snmp3_security_level, $snmp3_auth_method,
$snmp3_privacy_method, $snmp3_privacy_pass, 1, "", $snmp_port); $snmp3_auth_pass, $snmp3_privacy_method, $snmp3_privacy_pass,
1, "", $snmp_port);
if ($snmpwalk === false) { if ($snmpwalk === false) {
echo json_encode ($snmpwalk); echo json_encode ($snmpwalk);
return; return;
@ -152,19 +159,19 @@ if ($id_agent_module) {
$tcp_rcv = $module['tcp_rcv']; $tcp_rcv = $module['tcp_rcv'];
$snmp_community = $module['snmp_community']; $snmp_community = $module['snmp_community'];
$snmp_oid = $module['snmp_oid']; $snmp_oid = $module['snmp_oid'];
// New support for snmp v3 // New support for snmp v3
$snmp_version = $module['tcp_send']; $snmp_version = $module['tcp_send'];
$snmp3_auth_user = $module["plugin_user"]; $snmp3_auth_user = $module["plugin_user"];
$snmp3_auth_pass = $module["plugin_pass"]; $snmp3_auth_pass = $module["plugin_pass"];
// Auth method could be MD5 or SHA // Auth method could be MD5 or SHA
$snmp3_auth_method = $module["plugin_parameter"]; $snmp3_auth_method = $module["plugin_parameter"];
// Privacy method could be DES or AES // Privacy method could be DES or AES
$snmp3_privacy_method = $module["custom_string_1"]; $snmp3_privacy_method = $module["custom_string_1"];
$snmp3_privacy_pass = $module["custom_string_2"]; $snmp3_privacy_pass = $module["custom_string_2"];
// Security level Could be noAuthNoPriv | authNoPriv | authPriv // Security level Could be noAuthNoPriv | authNoPriv | authPriv
$snmp3_security_level = $module["custom_string_3"]; $snmp3_security_level = $module["custom_string_3"];
@ -217,7 +224,7 @@ else {
$tcp_send = ''; $tcp_send = '';
$tcp_rcv = ''; $tcp_rcv = '';
$tcp_port = ''; $tcp_port = '';
if ($moduletype == "wmiserver") if ($moduletype == "wmiserver")
$snmp_community = ''; $snmp_community = '';
else else
@ -236,7 +243,7 @@ else {
$max_critical = 0; $max_critical = 0;
$str_critical = ''; $str_critical = '';
$ff_event = 0; $ff_event = 0;
// New support for snmp v3 // New support for snmp v3
$snmp_version = 1; $snmp_version = 1;
$snmp3_auth_user = ""; $snmp3_auth_user = "";
@ -253,11 +260,11 @@ $is_function_policies = enterprise_include_once('include/functions_policies.php'
if($is_function_policies !== ENTERPRISE_NOT_HOOK) { if($is_function_policies !== ENTERPRISE_NOT_HOOK) {
$relink_policy = get_parameter('relink_policy', 0); $relink_policy = get_parameter('relink_policy', 0);
$unlink_policy = get_parameter('unlink_policy', 0); $unlink_policy = get_parameter('unlink_policy', 0);
if($relink_policy) { if($relink_policy) {
$policy_info = policies_info_module_policy($id_agent_module); $policy_info = policies_info_module_policy($id_agent_module);
$policy_id = $policy_info['id_policy']; $policy_id = $policy_info['id_policy'];
if($relink_policy && policies_get_policy_queue_status ($policy_id) == STATUS_IN_QUEUE_APPLYING) { if($relink_policy && policies_get_policy_queue_status ($policy_id) == STATUS_IN_QUEUE_APPLYING) {
ui_print_error_message(__('This policy is applying and cannot be modified')); ui_print_error_message(__('This policy is applying and cannot be modified'));
} }
@ -268,14 +275,13 @@ if($is_function_policies !== ENTERPRISE_NOT_HOOK) {
db_pandora_audit("Agent management", "Re-link module " . $id_agent_module); db_pandora_audit("Agent management", "Re-link module " . $id_agent_module);
} }
} }
if($unlink_policy) { if($unlink_policy) {
$result = policies_unlink_module($id_agent_module); $result = policies_unlink_module($id_agent_module);
ui_print_result_message($result, __('Module will be unlinked in the next application')); ui_print_result_message($result, __('Module will be unlinked in the next application'));
db_pandora_audit("Agent management", "Unlink module " . $id_agent_module); db_pandora_audit("Agent management", "Unlink module " . $id_agent_module);
} }
} }
global $__code_from; global $__code_from;
$__code_from = 'modules'; $__code_from = 'modules';
@ -336,12 +342,13 @@ switch ($moduletype) {
/* WARNING: type 7 is reserved on enterprise */ /* WARNING: type 7 is reserved on enterprise */
default: default:
if (enterprise_include ('godmode/agentes/module_manager_editor.php') === ENTERPRISE_NOT_HOOK) { if (enterprise_include ('godmode/agentes/module_manager_editor.php') === ENTERPRISE_NOT_HOOK) {
echo '<h3 class="error">DEBUG: Invalid module type specified in '.__FILE__.':'.__LINE__.'</h3>'; echo '<h3 class="error">';
echo 'Most likely you have recently upgraded from an earlier version of Pandora and either <br /> echo sprintf(__('DEBUG: Invalid module type specified in %s:%s'), __FILE__, __LINE__);
echo '</h3>';
echo __('Most likely you have recently upgraded from an earlier version of Pandora and either <br />
1) forgot to use the database converter<br /> 1) forgot to use the database converter<br />
2) used a bad version of the database converter (see Bugreport #2124706 for the solution)<br /> 2) used a bad version of the database converter (see Bugreport #2124706 for the solution)<br />
3) found a new bug - please report a way to duplicate this error'; 3) found a new bug - please report a way to duplicate this error');
return; return;
} }
break; break;
@ -416,36 +423,44 @@ var no_plugin_lang = "<?php echo __('No plug-in provided') ?>";
$(document).ready (function () { $(document).ready (function () {
configure_modules_form (); configure_modules_form ();
$("#module_form").submit(function() { $("#module_form").submit(function() {
if (check_remote_conf) { if (typeof(check_remote_conf) != 'undefined') {
//Check the name if (check_remote_conf) {
name = $("#text-name").val(); //Check the name
remote_config = $("#textarea_configuration_data").val(); name = $("#text-name").val();
remote_config = $("#textarea_configuration_data").val();
regexp_name = new RegExp('module_name\\s*' + name+"\n");
regexp_name = new RegExp('module_name\\s*' + name+"\n");
regexp_plugin = new RegExp('^module_plugin\\s*');
regexp_plugin = new RegExp('^module_plugin\\s*');
if (remote_config == '' || remote_config.match(regexp_name) || remote_config.match(regexp_plugin) || $("#id_module_type").val()==100 || $("#hidden-id_module_type_hidden").val()==100) return true;
else { if (remote_config == '' || remote_config.match(regexp_name) ||
alert("<?php echo __("Error, The field name and name in module_name in data configuration are different.");?>"); remote_config.match(regexp_plugin) ||
return false; $("#id_module_type").val()==100 ||
$("#hidden-id_module_type_hidden").val()==100) {
return true;
}
else {
alert("<?php echo __("Error, The field name and name in module_name in data configuration are different.");?>");
return false;
}
} }
} }
return true; return true;
}); });
function checkKeepaliveModule() { function checkKeepaliveModule() {
// keepalive modules have id = 100 // keepalive modules have id = 100
if($("#id_module_type").val()==100 || $("#hidden-id_module_type_hidden").val()==100) { if ($("#id_module_type").val()==100 ||
$("#simple-configuration_data").hide(); $("#hidden-id_module_type_hidden").val()==100) {
$("#simple-configuration_data").hide();
} }
else { else {
$("#simple-configuration_data").show(); $("#simple-configuration_data").show();
} }
} }
checkKeepaliveModule(); checkKeepaliveModule();
@ -455,4 +470,4 @@ $(document).ready (function () {
}); });
}); });
/* ]]> */ /* ]]> */
</script> </script>