' . html_print_image ("images/operation.png", true, array ("title" =>__('View'))) . ''; $viewtab['operation'] = true; $viewtab['active'] = false; $onheader = array('view' => $viewtab); // Header ui_print_page_header (__('Agents defined in Pandora'), "images/agent_mc.png", false, "", true, $onheader); // Perform actions $agent_to_delete = (int)get_parameter('borrar_agente'); $enable_agent = (int)get_parameter('enable_agent'); $disable_agent = (int)get_parameter('disable_agent'); $result = null; if ($agent_to_delete) { $id_agente = $agent_to_delete; $agent_name = agents_get_name ($id_agente); $id_grupo = agents_get_agent_group($id_agente); if (check_acl ($config["id_user"], $id_grupo, "AW")) { $id_agentes[0] = $id_agente; $result = agents_delete_agent($id_agentes); } else { // NO permissions. db_pandora_audit("ACL Violation", "Trying to delete agent \'$agent_name\'"); require ("general/noaccess.php"); exit; } ui_print_result_message($result, __('Success deleted agent.'), __('Could not be deleted.')); if (enterprise_installed()) { // Check if the remote config file still exist if (isset ($config["remote_config"])) { enterprise_include_once('include/functions_config_agents.php'); if (enterprise_hook('config_agents_has_remote_configuration', array($id_agente))) { ui_print_error_message(__('Maybe the files conf or md5 could not be deleted')); } } } } if ($enable_agent) { $result = db_process_sql_update('tagente', array('disabled' => 0), array('id_agente' => $enable_agent)); if ($result) { db_pandora_audit("Agent management", 'Enable ' . $enable_agent); } else { db_pandora_audit("Agent management", 'Fail to enable ' . $enable_agent); } ui_print_result_message ($result, __('Successfully enabled'), __('Could not be enabled')); } if ($disable_agent) { $result = db_process_sql_update('tagente', array('disabled' => 1), array('id_agente' => $disable_agent)); if ($result) { db_pandora_audit("Agent management", 'Disable ' . $disable_agent); } else { db_pandora_audit("Agent management", 'Fail to disable ' . $disable_agent); } ui_print_result_message ($result, __('Successfully disabled'), __('Could not be disabled')); } echo "
".__('Agent name') . ' ' . '' . html_print_image("images/sort_up.png", true, array("style" => $selectNameUp)) . '' . '' . html_print_image("images/sort_down.png", true, array("style" => $selectNameDown)) . ''; echo " | "; echo "".__('R')." | "; echo "".__('OS'). ' ' . '' . html_print_image("images/sort_up.png", true, array("style" => $selectOsUp)) . '' . '' . html_print_image("images/sort_down.png", true, array("style" => $selectOsDown)) . ''; echo " | "; echo "".__('Group'). ' ' . '' . html_print_image("images/sort_up.png", true, array("style" => $selectGroupUp)) . '' . '' . html_print_image("images/sort_down.png", true, array("style" => $selectGroupDown)) . ''; echo " | "; echo "" . __('Description') . " | "; echo "" . __('Actions') . " | "; $color=1; $rowPair = true; $iterator = 0; foreach ($agents as $agent) { $id_grupo = $agent["id_grupo"]; if (! check_acl ($config["id_user"], $id_grupo, "AW", $agent['id_agente']) && ! check_acl ($config["id_user"], $id_grupo, "AD", $agent['id_agente'])) continue; if ($color == 1) { $tdcolor = "datos"; $color = 0; } else { $tdcolor = "datos2"; $color = 1; } if ($rowPair) $rowclass = 'rowPair'; else $rowclass = 'rowOdd'; $rowPair = !$rowPair; $iterator++; // Agent name echo "
---|---|---|---|---|---|
"; if ($agent["disabled"]) { echo ""; } echo ''; echo ""; if ($agent['quiet']) { html_print_image("images/dot_green.disabled.png", false, array("border" => '0', "title" => __('Quiet'), "alt" => "")); echo " "; } if (check_acl ($config["id_user"], $agent["id_grupo"], "AW")) { $main_tab = 'main'; } else { $main_tab = 'module'; } echo "" . ui_print_truncate_text($agent["nombre"], 'agent_medium', true, true, true, '[…]', 'font-size: 7pt') . ""; echo ""; if ($agent["disabled"]) { ui_print_help_tip(__('Disabled')); echo ""; } echo ' '; echo " | "; echo ""; // Has remote configuration ? if (enterprise_installed()) { enterprise_include_once('include/functions_config_agents.php'); if (config_agents_has_remote_configuration($agent["id_agente"])) { echo ""; echo html_print_image("images/application_edit.png", true, array("align" => 'middle', "title" => __('Edit remote config'))); echo ""; } } echo " | "; // Operating System icon echo ""; ui_print_os_icon ($agent["id_os"], false); echo " | "; // Group icon and name echo "" . ui_print_group_icon ($id_grupo, true)." | "; // Description echo "" . ui_print_truncate_text($agent["comentarios"], 'description', true, true, true, '[…]', 'font-size: 6.5pt;')." | "; // Action //When there is only one element in page it's necesary go back page. if ((count($agents) == 1) && ($offset >= $config["block_size"])) $offsetArg = $offset - $config["block_size"]; else $offsetArg = $offset; echo ""; if ($agent['disabled']) { echo "". html_print_image('images/lightbulb_off.png', true, array('alt' => __('Enable agent'), 'title' => __('Enable agent'))) .""; } else { echo "". html_print_image('images/lightbulb.png', true, array('alt' => __('Disable agent'), 'title' => __('Disable agent'))) .""; } if (check_acl ($config["id_user"], $agent["id_grupo"], "AW")) { echo " '; echo html_print_image('images/cross.png', true, array("border" => '0')) . ""; } echo " | "; } echo "
";
}
else {
echo " " . __('There are no defined agents') . " ";
echo " |
";
}
if (check_acl ($config["id_user"], 0, "AW")) {
// Create agent button
echo ' ';
echo '";
echo ' ';
}
echo " |