From 7e649b78b3c139516d9b7fedda373bdf823de2a2 Mon Sep 17 00:00:00 2001 From: daniel Date: Wed, 9 Aug 2017 11:29:16 +0200 Subject: [PATCH] wux new form --- .../godmode/agentes/module_manager_editor.php | 56 ++++++++++++++++++- .../agentes/module_manager_editor_common.php | 26 --------- .../include/javascript/pandora_modules.js | 24 ++++++++ pandora_console/include/styles/pandora.css | 5 ++ 4 files changed, 83 insertions(+), 28 deletions(-) diff --git a/pandora_console/godmode/agentes/module_manager_editor.php b/pandora_console/godmode/agentes/module_manager_editor.php index fb77e9c5c6..a330ef8d03 100644 --- a/pandora_console/godmode/agentes/module_manager_editor.php +++ b/pandora_console/godmode/agentes/module_manager_editor.php @@ -193,7 +193,10 @@ if ($id_agent_module) { $id_plugin = $module['id_plugin']; $post_process = $module['post_process']; $prediction_module = $module['prediction_module']; + $custom_integer_1 = $module ['custom_integer_1']; $custom_integer_2 = $module ['custom_integer_2']; + $custom_string_1 = $module ['custom_string_1']; + $custom_string_2 = $module ['custom_string_2']; $max_timeout = $module['max_timeout']; $max_retries = $module['max_retries']; $custom_id = $module['custom_id']; @@ -301,7 +304,10 @@ else { $quiet_module = 0; $unit = ''; $prediction_module = ''; + $custom_integer_1 = 0; $custom_integer_2 = 0; + $custom_string_1 = ''; + $custom_string_2 = ''; $id_plugin = ''; $id_export = ''; $disabled = "0"; @@ -509,15 +515,18 @@ echo ''; // TODO: Change to the ui_print_error system echo '
'; + html_print_table ($table_simple); ui_toggle(html_print_table ($table_advanced, true), __('Advanced options')); ui_toggle(html_print_table ($table_macros, true), __('Custom macros') . ui_print_help_icon ('module_macros', true)); -ui_toggle(html_print_table ($table_new_relations, true) . - html_print_table ($table_relations, true), __('Module relations')); +if($moduletype != 13){ + ui_toggle(html_print_table ($table_new_relations, true) . + html_print_table ($table_relations, true), __('Module relations')); +} // Submit echo '
'; @@ -571,6 +580,9 @@ var no_plugin_lang = ""; $(document).ready (function () { configure_modules_form (); + + + $("#module_form").submit(function() { if (typeof(check_remote_conf) != 'undefined') { if (check_remote_conf) { @@ -619,6 +631,46 @@ $(document).ready (function () { $("#id_module_type").change (function () { checkKeepaliveModule(); }); + }); + +function handleFileSelect() { + //clear texarea + $('#textarea_custom_string_1').empty(); + $('#mssg_error_div').empty(); + + //messages error + err_msg_1 = ""; + err_msg_2 = ""; + err_msg_3 = ""; + err_msg_4 = ""; + + if (!window.File || !window.FileReader || !window.FileList || !window.Blob) { + $('#mssg_error_div').append(err_msg_1); + return; + } + + input = document.getElementById('file-file_html_text'); + + if (!input) { + $('#mssg_error_div').append(err_msg_2); + } + else if (!input.files) { + $('#mssg_error_div').append(err_msg_3); + } + else if (!input.files[0]) { + $('#mssg_error_div').append(err_msg_4); + } + else { + file = input.files[0]; + fr = new FileReader(); + fr.onload = receivedText; + fr.readAsText(file); + } +} + +function receivedText() { + document.getElementById('textarea_custom_string_1').appendChild(document.createTextNode(fr.result)); +} /* ]]> */ diff --git a/pandora_console/godmode/agentes/module_manager_editor_common.php b/pandora_console/godmode/agentes/module_manager_editor_common.php index dfcff7adc9..c2b8a0c7b1 100644 --- a/pandora_console/godmode/agentes/module_manager_editor_common.php +++ b/pandora_console/godmode/agentes/module_manager_editor_common.php @@ -978,32 +978,6 @@ function advanced_option_dynamic() { } } -//Add a new module macro -function add_macro () { - var macro_count = parseInt($("#hidden-module_macro_count").val()); - var delete_icon = ''; - - // Add inputs for the new macro - $("#module_macros").append('Name \ - \ - Value \ - \ - ' + delete_icon + ''); - - // Update the macro count - $("#hidden-module_macro_count").val(macro_count + 1); -} - -// Delete an existing module macro -function delete_macro (num) { - if ($("#module_macros-" + num).length) { - $("#module_macros-" + num).remove(); - } - - // Do not decrease the macro counter or new macros may overlap existing ones! -} - - /* Relationship javascript */ // Change the modules autocomplete input depending on the result of the agents autocomplete input diff --git a/pandora_console/include/javascript/pandora_modules.js b/pandora_console/include/javascript/pandora_modules.js index cfba698db9..d08810aca7 100644 --- a/pandora_console/include/javascript/pandora_modules.js +++ b/pandora_console/include/javascript/pandora_modules.js @@ -899,3 +899,27 @@ function delete_macro_local_component(prefix) { var $row2 = $('#'+prefix+nrow2).remove(); } +//Add a new module macro +function add_macro () { + var macro_count = parseInt($("#hidden-module_macro_count").val()); + var delete_icon = ''; + + // Add inputs for the new macro + $("#module_macros").append('Name \ + \ + Value \ + \ + ' + delete_icon + ''); + + // Update the macro count + $("#hidden-module_macro_count").val(macro_count + 1); +} + +// Delete an existing module macro +function delete_macro (num) { + if ($("#module_macros-" + num).length) { + $("#module_macros-" + num).remove(); + } + + // Do not decrease the macro counter or new macros may overlap existing ones! +} diff --git a/pandora_console/include/styles/pandora.css b/pandora_console/include/styles/pandora.css index 9d7deb64db..9537114e0e 100644 --- a/pandora_console/include/styles/pandora.css +++ b/pandora_console/include/styles/pandora.css @@ -4186,4 +4186,9 @@ div#footer_help{ .graph_conteiner_inside > div > .nodata_container{ background-size: 120px 80px !important; +} + +#mssg_error_div{ + color: red; + font-size: 12px; } \ No newline at end of file