diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 110aae61e3..163cd8f6cb 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,17 @@ +2012-07-19 Miguel de Dios + + * include/javascript/pandora.js: fixed the doc header for the + function "agent_autocomplete" that was very wrong, and now in this + function when call with the id_server_name equal to false, the + function doesn't save the id_server in hidden input. + + * include/functions_agents.php: added function + "agents_check_agent_exists" that check if any agent exists into the + DB (of course you can check if exist and it is enabled). + + * operation/search_agents.php: fixed the link to manage the agents + show in the search. + 2012-07-18 Miguel de Dios * extensions/resource_registration.php, diff --git a/pandora_console/include/functions_agents.php b/pandora_console/include/functions_agents.php index 213ce93fc6..8eba38c4b4 100644 --- a/pandora_console/include/functions_agents.php +++ b/pandora_console/include/functions_agents.php @@ -22,6 +22,26 @@ require_once($config['homedir'] . "/include/functions_modules.php"); require_once($config['homedir'] . '/include/functions_users.php'); +/** + * Check the agent exists in the DB. + * + * @param int $id_agent The agent id. + * @param boolean $show_disabled Show the agent found althought it is disabled. By default false. + * + * @return boolean The result to check if the agent is in the DB. + */ +function agents_check_agent_exists($id_agent, $show_disabled = true) { + $agent = db_get_value_filter('id_agente', 'tagente', + array('id_agente' => $id_agent, 'disabled' => !$show_disabled)); + + if (!empty($agent)) { + return true; + } + else { + return false; + } +} + /** * Creates an agent * diff --git a/pandora_console/include/javascript/pandora.js b/pandora_console/include/javascript/pandora.js index 4314e0d41e..d68392e7d5 100644 --- a/pandora_console/include/javascript/pandora.js +++ b/pandora_console/include/javascript/pandora.js @@ -557,12 +557,12 @@ function agent_module_autocomplete (id_agent_name, id_agent_id, id_agent_module_ * Autocomplete Agent box functions. * * This function has all the necesary javascript to use the box with to autocomplete - * an agent name, and store it's id on a hidden field and fill a selector with the - * modules from that agent. + * an agent name, and store it's id on a hidden field and fill a hidden field with + * the server. * * @param id_agent_name id of the agent name box + * @param id_server_name id of the hidden field to store the server but if you put false don't save. * @param id_agent_id id of the hidden field to store the agent id - * @param id_agent_module_selector id of the selector for the modules of the agent. */ function agent_autocomplete (id_agent_name, id_server_name, id_agent_id ) { //Check exist the field with id in the var id_agent_name. @@ -606,7 +606,8 @@ function agent_autocomplete (id_agent_name, id_server_name, id_agent_id ) { } //Put the server - if (typeof(id_server_name) != "undefined") { + if (typeof(id_server_name) != "undefined" + || typeof(id_server_name) != "boolean") { $(id_server_name).val(server_name); } @@ -627,7 +628,7 @@ function agent_autocomplete (id_agent_name, id_server_name, id_agent_id ) { .append(text) .appendTo(ul); }; - + //Force the size of autocomplete $(".ui-autocomplete").css("max-height", "100px"); $(".ui-autocomplete").css("overflow-y", "auto"); diff --git a/pandora_console/operation/search_agents.php b/pandora_console/operation/search_agents.php index 06657a7188..e6bebd667a 100755 --- a/pandora_console/operation/search_agents.php +++ b/pandora_console/operation/search_agents.php @@ -273,12 +273,13 @@ else { $time_style = ''.$time.''; $manage_agent = ''; - + if (check_acl ($config['id_user'], $agent['id_grupo'], "AW")) { - $manage_agent = '' . + $url_manage = 'index.php?sec=estado&sec2=godmode/agentes/configurar_agente&id_agente='. $agent["id_agente"]; + $manage_agent = '' . html_print_image("images/setup.png", true, array("title" => __('Manage'), "alt" => __('Manage'))) . ''; } - + array_push($table->data, array( $cellName, ui_print_os_icon ($agent["id_os"], false, true),