2013-07-31 Sergio Martin <sergio.martin@artica.es>

* include/functions_agents.php: Fix a if condition
	broken for a previous test code

	* godmode/groups/group_list.php: Fix propagate ACL 
	field when create group

	* godmode/groups/configure_group.php: Fixed pure parameter

	* godmode/users/configure_user.php: Fixed autohidding of fields in 
	user edition due return avoiding javascript code



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@8606 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
zarzuelo 2013-07-31 11:34:42 +00:00
parent af0a970cea
commit 77b944b6e1
5 changed files with 106 additions and 92 deletions

View File

@ -1,3 +1,16 @@
2013-07-31 Sergio Martin <sergio.martin@artica.es>
* include/functions_agents.php: Fix a if condition
broken for a previous test code
* godmode/groups/group_list.php: Fix propagate ACL
field when create group
* godmode/groups/configure_group.php: Fixed pure parameter
* godmode/users/configure_user.php: Fixed autohidding of fields in
user edition due return avoiding javascript code
2013-07-31 Miguel de Dios <miguel.dedios@artica.es> 2013-07-31 Miguel de Dios <miguel.dedios@artica.es>
* operation/agentes/networkmap.php: added dinamic tab. * operation/agentes/networkmap.php: added dinamic tab.

View File

@ -153,7 +153,7 @@ if ($isFunctionSkins !== ENTERPRISE_NOT_HOOK) {
$table->data[9][1] = skins_print_select($config["id_user"], 'skin', $skin, '', __('None'), 0, true); $table->data[9][1] = skins_print_select($config["id_user"], 'skin', $skin, '', __('None'), 0, true);
} }
echo '<form name="grupo" method="post" action="index.php?sec=gagente&sec2=godmode/groups/group_list">'; echo '<form name="grupo" method="post" action="index.php?sec=gagente&sec2=godmode/groups/group_list&pure=' . $config['pure'] . '">';
html_print_table ($table); html_print_table ($table);
echo '<div class="action-buttons" style="width: '.$table->width.'">'; echo '<div class="action-buttons" style="width: '.$table->width.'">';
if ($id_group) { if ($id_group) {
@ -186,7 +186,7 @@ function icon_changed () {
jQuery.ajax ({ jQuery.ajax ({
data: params.join ("&"), data: params.join ("&"),
type: 'POST', type: 'POST',
url: action="ajax.php", url: action="<?php echo ui_get_full_url("ajax.php", false, false, false); ?>",
async: false, async: false,
timeout: 10000, timeout: 10000,
success: function (result) { success: function (result) {
@ -206,7 +206,7 @@ function parent_changed () {
jQuery.ajax ({ jQuery.ajax ({
data: inputs.join ("&"), data: inputs.join ("&"),
type: 'GET', type: 'GET',
url: action="ajax.php", url: action="<?php echo ui_get_full_url("ajax.php", false, false, false); ?>",
timeout: 10000, timeout: 10000,
dataType: 'json', dataType: 'json',
success: function (data) { success: function (data) {
@ -225,7 +225,7 @@ function parent_changed () {
jQuery.ajax ({ jQuery.ajax ({
data: params.join ("&"), data: params.join ("&"),
type: 'POST', type: 'POST',
url: action="ajax.php", url: action="<?php echo ui_get_full_url("ajax.php", false, false, false); ?>",
async: false, async: false,
timeout: 10000, timeout: 10000,
success: function (result) { success: function (result) {

View File

@ -137,20 +137,21 @@ if (($create_group) && (check_acl($config['id_user'], 0, "PM"))) {
$contact = (string) get_parameter ('contact'); $contact = (string) get_parameter ('contact');
$other = (string) get_parameter ('other'); $other = (string) get_parameter ('other');
$check = db_get_value('nombre', 'tgrupo', 'nombre', $name); $check = db_get_value('nombre', 'tgrupo', 'nombre', $name);
$propagate = (bool) get_parameter('propagate');
/*Check if name field is empty*/ /*Check if name field is empty*/
if ($name != "") { if ($name != "") {
if (!$check) { if (!$check) {
$values = array( $values = array(
'nombre' => $name, 'nombre' => $name,
'icon' => substr ($icon, 0, -4), 'icon' => empty($icon) ? '' : substr ($icon, 0, -4),
'parent' => $id_parent, 'parent' => $id_parent,
'disabled' => $alerts_disabled, 'disabled' => $alerts_disabled,
'custom_id' => $custom_id, 'custom_id' => $custom_id,
'id_skin' => $skin, 'id_skin' => $skin,
'description' => $description, 'description' => $description,
'contact' => $contact, 'contact' => $contact,
'propagate' => $propagate,
'other' => $other 'other' => $other
); );
@ -194,7 +195,7 @@ if ($update_group) {
$sql = sprintf ('UPDATE tgrupo SET nombre = "%s", $sql = sprintf ('UPDATE tgrupo SET nombre = "%s",
icon = "%s", disabled = %d, parent = %d, custom_id = "%s", propagate = %d, id_skin = %d, description = "%s", contact = "%s", other = "%s" icon = "%s", disabled = %d, parent = %d, custom_id = "%s", propagate = %d, id_skin = %d, description = "%s", contact = "%s", other = "%s"
WHERE id_grupo = %d', WHERE id_grupo = %d',
$name, substr ($icon, 0, -4), !$alerts_enabled, $id_parent, $custom_id, $propagate, $skin, $description, $contact, $other, $id_group); $name, empty($icon) ? '' : substr ($icon, 0, -4), !$alerts_enabled, $id_parent, $custom_id, $propagate, $skin, $description, $contact, $other, $id_group);
break; break;
case "postgresql": case "postgresql":
case "oracle": case "oracle":

View File

@ -547,102 +547,102 @@ echo '</form>';
echo '<br />'; echo '<br />';
/* Don't show anything else if we're creating an user */ /* Don't show anything else if we're creating an user */
if (empty ($id) || $new_user) if (!empty ($id) && !$new_user) {
return; echo '<h4>'. __('Profiles/Groups assigned to this user') . '</h4>';
echo '<h4>'. __('Profiles/Groups assigned to this user') . '</h4>'; $table->width = '98%';
$table->data = array ();
$table->head = array ();
$table->align = array ();
$table->style = array ();
$table->style[0] = 'font-weight: bold';
$table->style[1] = 'font-weight: bold';
$table->head[0] = __('Profile name');
$table->head[1] = __('Group');
$table->head[2] = __('Tags');
$table->head[3] = __('Action');
$table->align[3] = 'center';
$table->width = '98%'; /*
$table->data = array (); if ($enterprise_include) {
$table->head = array (); add_enterprise_column_user_profile_form($table);
$table->align = array ();
$table->style = array ();
$table->style[0] = 'font-weight: bold';
$table->style[1] = 'font-weight: bold';
$table->head[0] = __('Profile name');
$table->head[1] = __('Group');
$table->head[2] = __('Tags');
$table->head[3] = __('Action');
$table->align[3] = 'center';
/*
if ($enterprise_include) {
add_enterprise_column_user_profile_form($table);
}
*/
$result = db_get_all_rows_field_filter ("tusuario_perfil", "id_usuario", $id);
if ($result === false) {
$result = array ();
}
foreach ($result as $profile) {
if($profile["id_grupo"] == -1) {
continue;
} }
*/
$result = db_get_all_rows_field_filter ("tusuario_perfil", "id_usuario", $id);
if ($result === false) {
$result = array ();
}
foreach ($result as $profile) {
if($profile["id_grupo"] == -1) {
continue;
}
$data = array ();
$data[0] = '<a href="index.php?sec='.$sec.'&amp;sec2=godmode/users/configure_profile&id='.$profile['id_perfil'].'&pure='.$pure.'">'.profile_get_name ($profile['id_perfil']).'</a>';
$data[1] = ui_print_group_icon($profile["id_grupo"], true);
if (!defined('METACONSOLE'))
$data[1] .= '<a href="index.php?sec=estado&sec2=operation/agentes/estado_agente&refr=60&group_id='.$profile['id_grupo'].'&pure='.$pure.'">';
$data[1] .= '&nbsp;' . ui_print_truncate_text(groups_get_name ($profile['id_grupo'], True), GENERIC_SIZE_TEXT);
if (!defined('METACONSOLE'))
$data[1] .= '</a>';
if(empty($profile["tags"])) {
$data[2] = '';
}
else {
$tags_ids = explode(',',$profile["tags"]);
$tags = tags_get_tags($tags_ids);
$data[2] = tags_get_tags_formatted($tags);
}
$data[3] = '<form method="post" onsubmit="if (!confirm (\''.__('Are you sure?').'\')) return false">';
$data[3] .= html_print_input_hidden ('delete_profile', 1, true);
$data[3] .= html_print_input_hidden ('id_user_profile', $profile['id_up'], true);
$data[3] .= html_print_input_hidden ('id_user', $id, true);
$data[3] .= html_print_input_image ('del', 'images/cross.png', 1, '', true);
$data[3] .= '</form>';
array_push ($table->data, $data);
}
$data = array (); $data = array ();
$data[0] = '<a href="index.php?sec='.$sec.'&amp;sec2=godmode/users/configure_profile&id='.$profile['id_perfil'].'&pure='.$pure.'">'.profile_get_name ($profile['id_perfil']).'</a>'; $data[0] = '<form method="post">';
$data[1] = ui_print_group_icon($profile["id_grupo"], true); if (check_acl ($config['id_user'], 0, "PM")) {
if (!defined('METACONSOLE')) $data[0] .= html_print_select (profile_get_profiles (), 'assign_profile', 0, '',
$data[1] .= '<a href="index.php?sec=estado&sec2=operation/agentes/estado_agente&refr=60&group_id='.$profile['id_grupo'].'&pure='.$pure.'">'; __('None'), 0, true, false, false);
$data[1] .= '&nbsp;' . ui_print_truncate_text(groups_get_name ($profile['id_grupo'], True), GENERIC_SIZE_TEXT);
if (!defined('METACONSOLE'))
$data[1] .= '</a>';
if(empty($profile["tags"])) {
$data[2] = '';
} }
else { else {
$tags_ids = explode(',',$profile["tags"]); $data[0] .= html_print_select (profile_get_profiles (array ('pandora_management' => '<> 1',
$tags = tags_get_tags($tags_ids); 'db_management' => '<> 1')), 'assign_profile', 0, '', __('None'), 0,
true, false, false);
$data[2] = tags_get_tags_formatted($tags);
} }
$data[3] = '<form method="post" onsubmit="if (!confirm (\''.__('Are you sure?').'\')) return false">'; $data[1] = html_print_select_groups($config['id_user'], "UM",
$data[3] .= html_print_input_hidden ('delete_profile', 1, true); $own_info['is_admin'], 'assign_group', -1, '', __('None'), -1, true,
$data[3] .= html_print_input_hidden ('id_user_profile', $profile['id_up'], true); false, false);
$data[3] .= html_print_input_hidden ('id_user', $id, true);
$data[3] .= html_print_input_image ('del', 'images/cross.png', 1, '', true); $tags = tags_get_all_tags();
$data[2] = html_print_select($tags, 'assign_tags[]', '', '', __('Any'), '', true, true);
$data[3] = html_print_input_image ('add', 'images/add.png', 1, '', true);
$data[3] .= html_print_input_hidden ('id', $id, true);
$data[3] .= html_print_input_hidden ('add_profile', 1, true);
$data[3] .= '</form>'; $data[3] .= '</form>';
array_push ($table->data, $data); array_push ($table->data, $data);
html_print_table ($table);
unset ($table);
} }
$data = array ();
$data[0] = '<form method="post">';
if (check_acl ($config['id_user'], 0, "PM")) {
$data[0] .= html_print_select (profile_get_profiles (), 'assign_profile', 0, '',
__('None'), 0, true, false, false);
}
else {
$data[0] .= html_print_select (profile_get_profiles (array ('pandora_management' => '<> 1',
'db_management' => '<> 1')), 'assign_profile', 0, '', __('None'), 0,
true, false, false);
}
$data[1] = html_print_select_groups($config['id_user'], "UM",
$own_info['is_admin'], 'assign_group', -1, '', __('None'), -1, true,
false, false);
$tags = tags_get_all_tags();
$data[2] = html_print_select($tags, 'assign_tags[]', '', '', __('Any'), '', true, true);
$data[3] = html_print_input_image ('add', 'images/add.png', 1, '', true);
$data[3] .= html_print_input_hidden ('id', $id, true);
$data[3] .= html_print_input_hidden ('add_profile', 1, true);
$data[3] .= '</form>';
array_push ($table->data, $data);
html_print_table ($table);
unset ($table);
enterprise_hook('close_meta_frame'); enterprise_hook('close_meta_frame');
?> ?>

View File

@ -167,7 +167,7 @@ function agents_get_alerts_simple ($id_agent = false, $filter = '', $options = f
} }
// If there are any errors add imposible condition // If there are any errors add imposible condition
if(in_array($where_tags, array(ERR_WRONG_PARAMETERS, ERR_ACL)) || TRUE) { if(in_array($where_tags, array(ERR_WRONG_PARAMETERS, ERR_ACL))) {
$subQuery .= ' AND 1 = 0'; $subQuery .= ' AND 1 = 0';
} }
else { else {