2012-04-11 Dario Rodriguez <dario.rodriguez@artica.es>

* operation/agentes/estado_agente.php: Added columns to edit agent
	from operaion view. Only for admins



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@5937 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
darode 2012-04-11 09:22:22 +00:00
parent edd3579c4a
commit 3f20b012c0
2 changed files with 49 additions and 0 deletions

View File

@ -1,3 +1,8 @@
2012-04-11 Dario Rodriguez <dario.rodriguez@artica.es>
* operation/agentes/estado_agente.php: Added columns to edit agent
from operaion view. Only for admins
2012-04-11 Juan Manuel Ramon <juanmanuel.ramon@artica.es>
* godmode/groups/group_list.php

View File

@ -109,6 +109,25 @@ if (is_ajax ()) {
}
ob_end_clean();
$agent_to_delete = get_parameter("borrar_agente");
if (!empty($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")==1) {
$id_agentes[0] = $id_agente;
$result = agents_delete_agent($id_agentes);
db_pandora_audit("Agent management", "Delete Agent " . $agent_name);
}
else {
// NO permissions.
db_pandora_audit("ACL Violation",
"Trying to delete agent \'$agent_name\'");
require ("general/noaccess.php");
exit;
}
}
$first = true;
while ($row = db_get_all_row_by_steps_sql($first, $result, "SELECT * FROM tgrupo")) {
$first = false;
@ -373,6 +392,15 @@ $table->head[8] = __('Last contact'). ' ' .
'<a href="index.php?sec=estado&amp;sec2=operation/agentes/estado_agente&amp;refr=' . $refr . '&amp;offset=' . $offset . '&amp;group_id=' . $group_id . '&amp;recursion=' . $recursion . '&amp;search=' . $search . '&amp;status='. $status . '&amp;sort_field=last_contact&amp;sort=down">' . html_print_image("images/sort_down.png", true, array("style" => $selectLastContactDown, "alt" => "down")) . '</a>';
$table->align = array ();
//Only for AW flag
if (check_acl ($config["id_user"], $group_id, "AW")) {
$table->head[9] = __('R');
$table->align[9] = "center";
$table->head[10] = __('Delete');
$table->align[10] = "center";
}
$table->align[2] = "center";
$table->align[3] = "center";
$table->align[4] = "center";
@ -468,6 +496,22 @@ foreach ($agents as $agent) {
// This old code was returning "never" on agents without modules, BAD !!
// And does not print outdated agents in red. WRONG !!!!
// $data[7] = ui_print_timestamp ($agent_info["last_contact"], true);
//Only for AW flag
if (check_acl ($config["id_user"], $group_id, "AW")) {
// Has remote configuration ?
$data[9]="";
$agent_name = db_get_value("nombre", "tagente", "id_agente", $agent["id_agente"]);
$agent_md5 = md5 ($agent_name, false);
if (file_exists ($config["remote_config"]."/md5/".$agent_md5.".md5")) {
$data[9] = "<a href='index.php?sec=estado&sec2=godmode/agentes/configurar_agente&tab=main&id_agente=".$agent["id_agente"]."&disk_conf=1'>".
html_print_image("images/application_edit.png", true, array("align" => 'middle', "title" => __('Edit remote config')))."</a>";
}
$data[10] = "<a href='index.php?sec=estado&sec2=operation/agentes/estado_agente&
borrar_agente=".$agent["id_agente"]."&group_id=$group_id&recursion=$recursion&search=$search&offset=$offset&sort_field=$sortField&sort=$sort'".
' onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">'.html_print_image('images/cross.png', true, array("border" => '0')) ."</a></td>";
}
array_push ($table->data, $data);
}