diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 5724a99cdb..a489c42259 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,9 @@ +2009-09-18 Miguel de Dios + + * godmode/agentes/module_manager.php: add checkbox to multiple delete + modules in agent managent. And add class style css for disabled modules. + * include/styles/pandora_minimal.css, include/styles/pandora_red.css, + include/styles/pandora.css: Add "disabled_module" class for use this style. 2009-09-25 Sancho lerena diff --git a/pandora_console/godmode/agentes/module_manager.php b/pandora_console/godmode/agentes/module_manager.php index ae8fb0e88d..abc8ea6008 100644 --- a/pandora_console/godmode/agentes/module_manager.php +++ b/pandora_console/godmode/agentes/module_manager.php @@ -16,7 +16,7 @@ /* You can redefine $url and unset $id_agente to reuse the form. Dirty (hope temporal) hack */ if (isset ($id_agente)) { $url = 'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=module&id_agente='.$id_agente; - echo "

".__('Agent configuration')." » ".__('Modules')."

"; + echo "

".__('Agent configuration')." » ".__('Modules')."

"; } enterprise_include ('godmode/agentes/module_manager.php'); @@ -64,6 +64,60 @@ echo ""; if (! isset ($id_agente)) return; + + +$multiple_delete = 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) dame_id_grupo ($id_agente); + + if (! give_acl ($config["id_user"], $id_grupo, "AW")) { + audit_db($config["id_user"],$REMOTE_ADDR, "ACL Violation", + "Trying to delete a module without admin rights"); + require ("general/noaccess.php"); + exit; + } + + if ($id_agent_module_del < 1) { + audit_db ($config["id_user"],$REMOTE_ADDR, "HACK Attempt", + "Expected variable from form is not correct"); + die ("Nice try buddy"); + exit; + } + + //Init transaction + $error = 0; + 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. + + if (process_sql ("UPDATE tagente_modulo + SET nombre = 'pendingdelete', disabled = 1, delete_pending = 1 WHERE id_agente_modulo = ".$id_agent_module_del) === false) + $error++; + + if (process_sql ("DELETE FROM tagente_estado WHERE id_agente_modulo = ".$id_agent_module_del) === false) + $error++; + + if (process_sql ("DELETE FROM tagente_datos_inc WHERE id_agente_modulo = ".$id_agent_module_del) === false) + $error++; + + + //Check for errors + if ($error != 0) { + process_sql_rollback (); + print_error_message (__('There was a problem deleting the module')); + } else { + process_sql_commit (); + print_success_message (__('Module deleted succesfully')); + } + } +} + // ========================== // MODULE VISUALIZATION TABLE // ========================== @@ -139,7 +193,7 @@ foreach ($modules as $module) { $data[0] = ''; if ($module["disabled"]) - $data[0] .= ''.$module['nombre'].''; + $data[0] .= ''.$module['nombre'].''; else $data[0] .= $module['nombre']; $data[0] .= ''; @@ -175,7 +229,8 @@ foreach ($modules as $module) { $data[5] .= ' / '.($module["min"] != $module['max']? $module["min"] : __('N/A')); // Delete module - $data[6] = ''; $data[6] .= print_image ('images/cross.png', true, array ('title' => __('Delete'))); @@ -195,5 +250,12 @@ foreach ($modules as $module) { array_push ($table->data, $data); } +echo '
'; print_table ($table); +echo '
'; +print_input_hidden ('multiple_delete', 1); +print_submit_button (__('Delete'), 'multiple_delete', false, 'class="sub"'); +echo '
'; +echo '
' ?> diff --git a/pandora_console/include/styles/pandora.css b/pandora_console/include/styles/pandora.css index 93d358091b..673f8d076f 100644 --- a/pandora_console/include/styles/pandora.css +++ b/pandora_console/include/styles/pandora.css @@ -1033,3 +1033,7 @@ div#pandora_logo_header { height: 60px; float: left; } + +.disabled_module { + color: #aaa; +} diff --git a/pandora_console/include/styles/pandora_minimal.css b/pandora_console/include/styles/pandora_minimal.css index 6431ea4d92..7bdb2ecb6a 100644 --- a/pandora_console/include/styles/pandora_minimal.css +++ b/pandora_console/include/styles/pandora_minimal.css @@ -117,3 +117,7 @@ tr.rowPair:hover { tr.rowOdd:hover { background-color: #444; } + +.disabled_module { + color: #98c2ed; +} \ No newline at end of file diff --git a/pandora_console/include/styles/pandora_red.css b/pandora_console/include/styles/pandora_red.css index 6b569da114..a15c6d0d98 100644 --- a/pandora_console/include/styles/pandora_red.css +++ b/pandora_console/include/styles/pandora_red.css @@ -732,3 +732,7 @@ div#pandora_logo_header { height: 60px; float: left; } + +.disabled_module { + color: #d88c8c; +} \ No newline at end of file