diff --git a/pandora_console/godmode/servers/plugin.php b/pandora_console/godmode/servers/plugin.php index afa5efe943..1fcd2d693b 100644 --- a/pandora_console/godmode/servers/plugin.php +++ b/pandora_console/godmode/servers/plugin.php @@ -13,20 +13,82 @@ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. -if (is_ajax ()) { - $get_plugin_description = get_parameter('get_plugin_description'); - $id_plugin = get_parameter('id_plugin'); - - $description = db_get_value_filter('description', 'tplugin', array('id' => $id_plugin)); - $preload = io_safe_output($description); - $preload = str_replace ("\n", "
", $preload); - - echo $preload; - return; -} - // Load global vars global $config; + +if (is_ajax ()) { + $get_plugin_description = get_parameter('get_plugin_description'); + $get_list_modules_and_component_locked_plugin = (bool) + get_parameter('get_list_modules_and_component_locked_plugin', 0); + + if ($get_plugin_description) { + $id_plugin = get_parameter('id_plugin'); + + $description = db_get_value_filter('description', 'tplugin', array('id' => $id_plugin)); + $preload = io_safe_output($description); + $preload = str_replace ("\n", "
", $preload); + + echo $preload; + return; + } + + if ($get_list_modules_and_component_locked_plugin) { + $id_plugin = (int)get_parameter('id_plugin', 0); + + $network_components = db_get_all_rows_filter( + 'tnetwork_component', + array('id_plugin' => $id_plugin)); + if (empty($network_components)) { + $network_components = array(); + } + $modules = db_get_all_rows_filter( + 'tagente_modulo', + array('delete_pending' => 0, 'id_plugin' => $id_plugin)); + if (empty($modules)) { + $modules = array(); + } + + $table = null; + $table->width = "100%"; + $table->head[0] = __('Network Components'); + $table->data = array(); + foreach ($network_components as $net_comp) { + $table->data[] = array($net_comp['name']); + } + if (!empty($table->data)) { + html_print_table($table); + + echo "
"; + } + + $table = null; + $table->width = "100%"; + $table->head[0] = __('Agent'); + $table->head[1] = __('Module'); + foreach ($modules as $mod) { + $agent_name = '' . + modules_get_agentmodule_agent_name( + $mod['id_agente_modulo']) . + ''; + + + $table->data[] = array( + $agent_name, + $mod['nombre'] + ); + } + if (!empty($table->data)) { + html_print_table($table); + } + + return; + } +} + + require_once ($config['homedir'] . "/include/functions_filemanager.php"); check_login (); @@ -544,8 +606,9 @@ else { echo "" . __('Name') . ""; echo "" . __('Type') . ""; echo "" . __('Command') . ""; - echo "" . - '' . __('Op.') . '' . ""; + echo "" . + '' . __('Op.') . '' . + ""; $color = 0; foreach ($rows as $row) { @@ -569,15 +632,34 @@ else { echo __('Nagios'); echo ""; echo $row["execute"]; - echo ""; + echo ""; + echo ""; + + //Show it is locket + $modules_using_plugin = db_get_value_filter( + 'count(*)', + 'tagente_modulo', + array('delete_pending' => 0, 'id_plugin' => $row["id"])); + $components_using_plugin = db_get_value_filter( + 'count(*)', + 'tnetwork_component', + array('id_plugin' => $row["id"])); + if (($components_using_plugin + $modules_using_plugin) > 0) { + echo ""; + html_print_image('images/lock.png'); + echo ""; + } echo "" . html_print_image('images/config.png', true, array("title" => __("Edit"))) . "  "; echo "" . html_print_image("images/cross.png", true, array("border" => '0')) . ""; - echo ""; + echo ""; + echo ""; } echo ""; } else { - echo '
'. __('There are no plugins in the system') . '
'; + echo '
' . + __('There are no plugins in the system') . + '
'; echo "
"; } echo ""; @@ -586,6 +668,11 @@ else { echo ""; echo "
"; + echo ""; + enterprise_hook('close_meta_frame'); } @@ -626,7 +713,41 @@ ui_require_javascript_file('pandora_modules'); }); - ", + data: parameters, + dataType: "html", + success: function(data) { + $("#dialog_locked") + .html(data); + $("#dialog_locked") + .dialog ({ + resizable: true, + draggable: true, + modal: true, + overlay: { + opacity: 0.5, + background: "black" + }, + width: 650, + height: 500 + }) + .show (); + } + }); + } + + $('.command_advanced_conf').click(function() {