2009-09-07 Miguel de Dios <miguel.dedios@artica.es>

* include/javascript/pandora_modules.js: add events for selects in
	local modules form:
	* godmode/agentes/module_manager_editor.php: add ajax request for local
	modules form.



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1919 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
mdtrooper 2009-09-07 16:40:56 +00:00
parent a71596aa8c
commit 973d1c0e39
3 changed files with 87 additions and 0 deletions

View File

@ -1,3 +1,10 @@
2009-09-07 Miguel de Dios <miguel.dedios@artica.es>
* include/javascript/pandora_modules.js: add events for selects in
local modules form:
* godmode/agentes/module_manager_editor.php: add ajax request for local
modules form.
2009-09-04 Sancho Lerena <slerena@artica.es>
* pandoradb.sql: Commented server type codes.

View File

@ -20,6 +20,8 @@ if (is_ajax ()) {
$snmp_walk = (bool) get_parameter ('snmp_walk');
$get_module_component = (bool) get_parameter ('get_module_component');
$get_module_components = (bool) get_parameter ('get_module_components');
$get_module_local_components = (bool) get_parameter('get_module_local_components');
$get_module_local_component = (bool) get_parameter('get_module_local_component');
if ($get_module_component) {
$id_component = (int) get_parameter ('id_module_component');
@ -44,6 +46,25 @@ if (is_ajax ()) {
return;
}
if ($get_module_local_components) {
require_once ($config['homedir'].'/'.ENTERPRISE_DIR.'/include/functions_local_components.php');
$id_module_group = (int) get_parameter ('id_module_component_group');
$localComponents = get_local_components(array('id_network_component_group' => $id_module_group), array('id', 'name'));
echo json_encode($localComponents);
return;
}
if ($get_module_local_component) {
$id_component = (int) get_parameter ('id_module_component');
$component = get_db_row ('tlocal_component', 'id', $id_component);
echo json_encode ($component);
return;
}
if ($snmp_walk) {
$ip_target = (string) get_parameter ('ip_target');
$snmp_community = (string) get_parameter ('snmp_community');

View File

@ -19,6 +19,65 @@ function configure_modules_form () {
}
});
$("#local_component_group").change (function () {
var $select = $("#local_component").hide ();
$("#component").hide ();
if (this.value == 0)
return;
$("#component_loading").show ();
$(".error, #no_component").hide ();
$("option[value!=0]", $select).remove ();
jQuery.post ("ajax.php",
{"page" : "godmode/agentes/module_manager_editor",
"get_module_local_components" : 1,
"id_module_component_group" : this.value,
"id_module_component_type" : $("#hidden-id_module_component_type").attr ("value")
},
function (data, status) {
if (data == false) {
$("#component_loading").hide ();
$("span#no_component").show ();
return;
}
jQuery.each (data, function (i, val) {
option = $("<option></option>")
.attr ("value", val['id'])
.append (val['name']);
$select.append (option);
});
$("#component_loading").hide ();
$select.show ();
$("#component").show ();
},
"json"
);
}
);
$("#local_component").change (function () {
if (this.value == 0)
return;
$("#component_loading").show ();
$(".error").hide ();
jQuery.post ("ajax.php",
{"page" : "godmode/agentes/module_manager_editor",
"get_module_local_component" : 1,
"id_module_component" : this.value
},
function (data, status) {
$("#text-name").attr ("value", html_entity_decode (data["name"]));
$("#textarea_description").attr ("value", html_entity_decode (data["description"]));
$("#textarea_configuration_data").attr ("value", html_entity_decode (data["data"]));
$("#component_loading").hide ();
$("#id_module_type").change ();
},
"json"
);
});
$("#network_component_group").change (function () {
var $select = $("#network_component").hide ();
$("#component").hide ();