'; echo '
"; echo ""; if (! isset ($id_agente)) return; $multiple_delete = (bool) get_parameter('multiple_delete'); if ($multiple_delete) { $id_agent_modules_delete = (array)get_parameter('id_delete'); foreach($id_agent_modules_delete as $id_agent_module_del) { $id_grupo = (int) agents_get_agent_group($id_agente); if (! check_acl ($config["id_user"], $id_grupo, "AW")) { db_pandora_audit("ACL Violation", "Trying to delete a module without admin rights"); require ("general/noaccess.php"); exit; } if ($id_agent_module_del < 1) { db_pandora_audit("HACK Attempt", "Expected variable from form is not correct"); die ("Nice try buddy"); exit; } enterprise_include_once('include/functions_config_agents.php'); enterprise_hook('config_agents_delete_module_in_conf', array(modules_get_agentmodule_agent($id_agent_module_del), modules_get_agentmodule_name($id_agent_module_del))); //Init transaction $error = 0; db_process_sql_begin (); // First delete from tagente_modulo -> if not successful, increment // error. NOTICE that we don't delete all data here, just marking for deletion // and delete some simple data. $status = ''; if (db_process_sql("UPDATE tagente_modulo SET nombre = 'pendingdelete', disabled = 1, delete_pending = 1 WHERE id_agente_modulo = ".$id_agent_module_del, "affected_rows", '', true, $status, false) === false) $error++; switch ($config["dbtype"]) { case "mysql": case "postgresql": $result = db_process_sql_delete('tagente_estado', array('id_agente_modulo' => $id_agent_module_del)); if ($result === false) $error++; $result = db_process_sql_delete('tagente_datos_inc', array('id_agente_modulo' => $id_agent_module_del)); if ($result === false) $error++; break; case "oracle": $result = db_process_delete_temp('tagente_estado', 'id_agente_modulo', $id_agent_module_del); if ($result === false) $error++; $result = db_process_delete_temp('tagente_datos_inc', 'id_agente_modulo', $id_agent_module_del); if ($result === false) $error++; break; } //Check for errors if ($error != 0) { db_process_sql_rollback (); ui_print_error_message (__('There was a problem deleting the module')); } else { db_process_sql_commit (); ui_print_success_message (__('Module deleted succesfully')); } } } // ========================== // MODULE VISUALIZATION TABLE // ========================== $url = 'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=module&id_agente=' . $id_agente; $selectNameUp = ''; $selectNameDown = ''; $selectServerUp = ''; $selectServerDown = ''; $selectTypeUp = ''; $selectTypeDown = ''; $selectIntervalUp = ''; $selectIntervalDown = ''; $sortField = get_parameter('sort_field'); $sort = get_parameter('sort', 'none'); $selected = 'border: 1px solid black;'; $order[] = array('field' => 'id_module_group', 'order' => 'ASC'); switch ($sortField) { case 'name': switch ($sort) { case 'up': $selectNameUp = $selected; switch ($config["dbtype"]) { case "mysql": case "postgresql": $order[] = array('field' => 'tagente_modulo.nombre', 'order' => 'ASC'); break; case "oracle": $order[] = array('field' => 'dbms_lob.substr(tagente_modulo.nombre,4000,1)', 'order' => 'ASC'); break; } break; case 'down': $selectNameDown = $selected; switch ($config["dbtype"]) { case "mysql": case "postgresql": $order[] = array('field' => 'tagente_modulo.nombre', 'order' => 'DESC'); break; case "oracle": $order[] = array('field' => 'dbms_lob.substr(tagente_modulo.nombre,4000,1)', 'order' => 'DESC'); break; } break; } break; case 'server': switch ($sort) { case 'up': $selectServerUp = $selected; $order[] = array('field' => 'id_modulo', 'order' => 'ASC'); break; case 'down': $selectServerDown = $selected; $order[] = array('field' => 'id_modulo', 'order' => 'DESC'); break; } break; case 'type': switch ($sort) { case 'up': $selectTypeUp = $selected; $order[] = array('field' => 'id_tipo_modulo', 'order' => 'ASC'); break; case 'down': $selectTypeDown = $selected; $order[] = array('field' => 'id_tipo_modulo', 'order' => 'DESC'); break; } break; case 'interval': switch ($sort) { case 'up': $selectIntervalUp = $selected; $order[] = array('field' => 'module_interval', 'order' => 'ASC'); break; case 'down': $selectIntervalDown = $selected; $order[] = array('field' => 'module_interval', 'order' => 'DESC'); break; } break; default: $selectNameUp = $selected; $selectNameDown = ''; $selectServerUp = ''; $selectServerDown = ''; $selectTypeUp = ''; $selectTypeDown = ''; $selectIntervalUp = ''; $selectIntervalDown = ''; switch ($config["dbtype"]) { case "mysql": case "postgresql": $order[] = array('field' => 'nombre', 'order' => 'ASC'); break; case "oracle": $order[] = array('field' => 'dbms_lob.substr(nombre,4000,1)', 'order' => 'ASC'); break; } break; } $modules = db_get_all_rows_filter ('tagente_modulo', array ('delete_pending' => 0, 'id_agente' => $id_agente, 'order' => $order), array ('id_agente_modulo', 'id_tipo_modulo', 'descripcion', 'nombre', 'max', 'min', 'module_interval', 'id_modulo', 'id_module_group', 'disabled','max_warning', 'min_warning', 'str_warning', 'max_critical', 'min_critical', 'str_critical')); if ($modules === false) { echo "