2014-03-18 Miguel de Dios <miguel.dedios@artica.es>

* godmode/agentes/configurar_agente.php,
	godmode/agentes/module_manager_editor_plugin.php,
	include/ajax/module.php, include/javascript/pandora_modules.js:
	fixed the save module plugin server from the component.




git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@9612 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
mdtrooper 2014-03-18 15:29:09 +00:00
parent 8d70785421
commit 2b8ca22e57
5 changed files with 49 additions and 32 deletions

View File

@ -1,3 +1,10 @@
2014-03-18 Miguel de Dios <miguel.dedios@artica.es>
* godmode/agentes/configurar_agente.php,
godmode/agentes/module_manager_editor_plugin.php,
include/ajax/module.php, include/javascript/pandora_modules.js:
fixed the save module plugin server from the component.
2014-03-18 Alejandro Gallardo <alejandro.gallardo@artica.es> 2014-03-18 Alejandro Gallardo <alejandro.gallardo@artica.es>
* pandoradb.data.oracle.sql, * pandoradb.data.oracle.sql,

View File

@ -790,15 +790,15 @@ if ($update_module || $create_module) {
if (!empty($macros)) { if (!empty($macros)) {
$macros = json_decode(base64_decode($macros), true); $macros = json_decode(base64_decode($macros), true);
foreach($macros as $k => $m) { foreach ($macros as $k => $m) {
$macros[$k]['value'] = get_parameter($m['macro'], ''); $macros[$k]['value'] = get_parameter($m['macro'], '');
} }
$macros = json_encode($macros); $macros = json_encode($macros);
$conf_array = explode("\n",$configuration_data); $conf_array = explode("\n", $configuration_data);
foreach($conf_array as $line) { foreach ($conf_array as $line) {
if(preg_match("/^module_name\s*(.*)/", $line, $match)) { if (preg_match("/^module_name\s*(.*)/", $line, $match)) {
$new_configuration_data .= "module_name $name\n"; $new_configuration_data .= "module_name $name\n";
} }
// We delete from conf all the module macros starting with _field // We delete from conf all the module macros starting with _field

View File

@ -94,24 +94,17 @@ if (!empty($macros)) {
?> ?>
<script type="text/javascript"> <script type="text/javascript">
var load_module_component = false; var load_module_component = false;
function changePluginSelect() {
jQuery.post ("ajax.php",
{"page" : "godmode/servers/plugin",
"get_plugin_description" : 1,
"id_plugin" : $("#id_plugin").val()
},
function (data, status) {
$("#plugin_description").html(data);
}
);
load_plugin_macros_fields('simple-macro'); function changePluginSelect() {
forced_title_callback();
load_plugin_description($("#id_plugin").val());
//For to avoid the deletion of macros in the code load_plugin_macros_fields('simple-macro');
//$("#network_component").change (function () { forced_title_callback();
//In the file pandora_modules.js
load_module_component = true; //For to avoid the deletion of macros in the code
} //$("#network_component").change (function () {
</script> //In the file pandora_modules.js
load_module_component = true;
}
</script>

View File

@ -24,10 +24,12 @@ enterprise_include_once ('include/functions_metaconsole.php');
$get_plugin_macros = get_parameter('get_plugin_macros'); $get_plugin_macros = get_parameter('get_plugin_macros');
if ($get_plugin_macros) { if ($get_plugin_macros) {
$plugin_macros = db_get_value('macros','tplugin','id',get_parameter('id_plugin',0)); $id_plugin = get_parameter('id_plugin', 0);
$plugin_macros = db_get_value('macros', 'tplugin', 'id',
$id_plugin);
$macros = array(); $macros = array();
$macros['base64'] = base64_encode($plugin_macros); $macros['base64'] = base64_encode($plugin_macros);
$macros['array'] = json_decode($plugin_macros,true); $macros['array'] = json_decode($plugin_macros,true);
@ -36,7 +38,6 @@ if ($get_plugin_macros) {
} }
$search_modules = get_parameter('search_modules'); $search_modules = get_parameter('search_modules');
if ($search_modules) { if ($search_modules) {
$id_agents = json_decode(io_safe_output(get_parameter('id_agents'))); $id_agents = json_decode(io_safe_output(get_parameter('id_agents')));
$filter = get_parameter('q', '') . '%'; $filter = get_parameter('q', '') . '%';

View File

@ -231,9 +231,10 @@ function configure_modules_form () {
$("#component_loading").show (); $("#component_loading").show ();
$(".error").hide (); $(".error").hide ();
jQuery.post ("ajax.php", jQuery.post ("ajax.php",
{"page" : "godmode/agentes/module_manager_editor", {
"get_module_component" : 1, "page" : "godmode/agentes/module_manager_editor",
"id_module_component" : this.value "get_module_component" : 1,
"id_module_component" : this.value
}, },
function (data, status) { function (data, status) {
$("#text-name").attr ("value", js_html_entity_decode (data["name"])); $("#text-name").attr ("value", js_html_entity_decode (data["name"]));
@ -330,10 +331,11 @@ function configure_modules_form () {
if (!load_module_component) { if (!load_module_component) {
// Delete macro fields // Delete macro fields
$('.macro_field').remove(); $('.macro_field').remove();
$('#hidden-macros').val('');
} }
load_module_component = false; load_module_component = false;
$('#hidden-macros').val('');
// If exist macros, load the fields // If exist macros, load the fields
if (data["macros"] != '' && data["macros"] != null) { if (data["macros"] != '' && data["macros"] != null) {
@ -612,7 +614,8 @@ function load_plugin_macros_fields(row_model_id) {
var params = []; var params = [];
params.push("page=include/ajax/module"); params.push("page=include/ajax/module");
params.push("get_plugin_macros=1"); params.push("get_plugin_macros=1");
params.push("id_plugin="+id_plugin); params.push("id_plugin=" + id_plugin);
jQuery.ajax ({ jQuery.ajax ({
data: params.join ("&"), data: params.join ("&"),
type: 'POST', type: 'POST',
@ -636,6 +639,19 @@ function load_plugin_macros_fields(row_model_id) {
}); });
} }
function load_plugin_description(id_plugin) {
jQuery.post ("ajax.php",
{
"page" : "godmode/servers/plugin",
"get_plugin_description" : 1,
"id_plugin" : id_plugin
},
function (data, status) {
$("#plugin_description").html(data);
}
);
}
// Show the modal window of a module // Show the modal window of a module
function show_module_detail_dialog(module_id, id_agente) { function show_module_detail_dialog(module_id, id_agente) {