When click in management permmision autoclicked in inferior options of same part. Ticket: #3912

(cherry picked from commit a0753238f7)
This commit is contained in:
m-lopez-f 2016-08-31 15:23:05 +02:00
parent 778f02b81a
commit 5ee29865ab
2 changed files with 65 additions and 41 deletions

View File

@ -33,7 +33,7 @@ $tab = get_parameter('tab', 'profile');
$pure = get_parameter('pure', 0);
// Header
if (!defined('METACONSOLE')) {
if (!is_metaconsole()) {
$buttons = array(
'user' => array(
'active' => false,
@ -222,7 +222,7 @@ if ($id_profile || $new_profile) {
$table = new stdClass();
$table->width = '100%';
$table->class = 'databox filters';
if (defined("METACONSOLE")) {
if (is_metaconsole()) {
$table->width = '100%';
$table->class = 'databox data';
if ($id_profile)
@ -242,20 +242,7 @@ if ($id_profile || $new_profile) {
$row['name'] = __('Profile name');
$row['input'] = html_print_input_text ('name', $name, '', 30, 60, true);
$table->data['name'] = $row;
// Incidents
$row = array();
$row['name'] = __('View incidents');
$row['input'] = html_print_checkbox ('incident_view', 1, $incident_view, true);
$table->data['IR'] = $row;
$row = array();
$row['name'] = __('Edit incidents');
$row['input'] = html_print_checkbox ('incident_edit', 1, $incident_edit, true);
$table->data['IW'] = $row;
$row = array();
$row['name'] = __('Manage incidents');
$row['input'] = html_print_checkbox ('incident_management', 1, $incident_management, true);
$table->data['IM'] = $row;
$table->data[] = '<hr>';
// Agents
$row = array();
@ -264,12 +251,13 @@ if ($id_profile || $new_profile) {
$table->data['AR'] = $row;
$row = array();
$row['name'] = __('Edit agents');
$row['input'] = html_print_checkbox ('agent_edit', 1, $agent_edit, true);
$row['input'] = html_print_checkbox ('agent_edit', 1, $agent_edit, true, false, 'autoclick_profile_users(\'agent_view\', \'false\')');
$table->data['AW'] = $row;
$row = array();
$row['name'] = __('Disable agents');
$row['input'] = html_print_checkbox ('agent_disable', 1, $agent_disable, true);
$row['input'] = html_print_checkbox ('agent_disable', 1, $agent_disable, true, false, 'autoclick_profile_users(\'agent_view\', \'agent_edit\')');
$table->data['AD'] = $row;
$table->data[] = '<hr>';
// Alerts
$row = array();
@ -278,20 +266,9 @@ if ($id_profile || $new_profile) {
$table->data['LW'] = $row;
$row = array();
$row['name'] = __('Manage alerts');
$row['input'] = html_print_checkbox ('alert_management', 1, $alert_management, true);
$row['input'] = html_print_checkbox ('alert_management', 1, $alert_management, true, false, 'autoclick_profile_users(\'alert_edit\', \'false\')');
$table->data['LM'] = $row;
// Users
$row = array();
$row['name'] = __('Manage users');
$row['input'] = html_print_checkbox ('user_management', 1, $user_management, true);
$table->data['UM'] = $row;
// DB
$row = array();
$row['name'] = __('Manage database');
$row['input'] = html_print_checkbox ('db_management', 1, $db_management, true);
$table->data['DM'] = $row;
$table->data[] = '<hr>';
// Events
$row = array();
@ -300,13 +277,14 @@ if ($id_profile || $new_profile) {
$table->data['ER'] = $row;
$row = array();
$row['name'] = __('Edit events');
$row['input'] = html_print_checkbox ('event_edit', 1, $event_edit, true);
$row['input'] = html_print_checkbox ('event_edit', 1, $event_edit, true, false, 'autoclick_profile_users(\'event_view\', \'false\')');
$table->data['EW'] = $row;
$row = array();
$row['name'] = __('Manage events');
$row['input'] = html_print_checkbox ('event_management', 1, $event_management, true);
$row['input'] = html_print_checkbox ('event_management', 1, $event_management, true, false, 'autoclick_profile_users(\'event_view\', \'event_edit\')');
$table->data['EM'] = $row;
$table->data[] = '<hr>';
// Reports
$row = array();
$row['name'] = __('View reports');
@ -314,12 +292,13 @@ if ($id_profile || $new_profile) {
$table->data['RR'] = $row;
$row = array();
$row['name'] = __('Edit reports');
$row['input'] = html_print_checkbox ('report_edit', 1, $report_edit, true);
$row['input'] = html_print_checkbox ('report_edit', 1, $report_edit, true, false, 'autoclick_profile_users(\'report_view\', \'false\')');
$table->data['RW'] = $row;
$row = array();
$row['name'] = __('Manage reports');
$row['input'] = html_print_checkbox ('report_management', 1, $report_management, true);
$row['input'] = html_print_checkbox ('report_management', 1, $report_management, true, false, 'autoclick_profile_users(\'report_view\', \'report_edit\')');
$table->data['RM'] = $row;
$table->data[] = '<hr>';
// Network maps
$row = array();
@ -328,12 +307,13 @@ if ($id_profile || $new_profile) {
$table->data['MR'] = $row;
$row = array();
$row['name'] = __('Edit network maps');
$row['input'] = html_print_checkbox ('map_edit', 1, $map_edit, true);
$row['input'] = html_print_checkbox ('map_edit', 1, $map_edit, true, false, 'autoclick_profile_users(\'map_view\', \'false\')');
$table->data['MW'] = $row;
$row = array();
$row['name'] = __('Manage network maps');
$row['input'] = html_print_checkbox ('map_management', 1, $map_management, true);
$row['input'] = html_print_checkbox ('map_management', 1, $map_management, true, false, 'autoclick_profile_users(\'map_view\', \'map_edit\')');
$table->data['MM'] = $row;
$table->data[] = '<hr>';
// Visual console
$row = array();
@ -342,18 +322,49 @@ if ($id_profile || $new_profile) {
$table->data['VR'] = $row;
$row = array();
$row['name'] = __('Edit visual console');
$row['input'] = html_print_checkbox ('vconsole_edit', 1, $vconsole_edit, true);
$row['input'] = html_print_checkbox ('vconsole_edit', 1, $vconsole_edit, true, false, 'autoclick_profile_users(\'vconsole_view\', \'false\')');
$table->data['VW'] = $row;
$row = array();
$row['name'] = __('Manage visual console');
$row['input'] = html_print_checkbox ('vconsole_management', 1, $vconsole_management, true);
$row['input'] = html_print_checkbox ('vconsole_management', 1, $vconsole_management, true, false, 'autoclick_profile_users(\'vconsole_view\', \'vconsole_edit\')');
$table->data['VM'] = $row;
$table->data[] = '<hr>';
// Incidents
$row = array();
$row['name'] = __('View incidents');
$row['input'] = html_print_checkbox ('incident_view', 1, $incident_view, true);
$table->data['IR'] = $row;
$row = array();
$row['name'] = __('Edit incidents');
$row['input'] = html_print_checkbox ('incident_edit', 1, $incident_edit, true, false, 'autoclick_profile_users(\'incident_view\', \'false\')');
$table->data['IW'] = $row;
$row = array();
$row['name'] = __('Manage incidents');
$row['input'] = html_print_checkbox ('incident_management', 1, $incident_management, true, false, 'autoclick_profile_users(\'incident_view\', \'incident_edit\');');
$table->data['IM'] = $row;
$table->data[] = '<hr>';
// Users
$row = array();
$row['name'] = __('Manage users');
$row['input'] = html_print_checkbox ('user_management', 1, $user_management, true);
$table->data['UM'] = $row;
$table->data[] = '<hr>';
// DB
$row = array();
$row['name'] = __('Manage database');
$row['input'] = html_print_checkbox ('db_management', 1, $db_management, true);
$table->data['DM'] = $row;
$table->data[] = '<hr>';
// Pandora
$row = array();
$row['name'] = __('Pandora management');
$row['input'] = html_print_checkbox ('pandora_management', 1, $pandora_management, true);
$table->data['PM'] = $row;
$table->data[] = '<hr>';
echo '<form method="post" action="index.php?sec='.$sec.'&sec2=godmode/users/profile_list&pure='.$pure.'">';
@ -373,5 +384,4 @@ if ($id_profile || $new_profile) {
}
enterprise_hook('close_meta_frame');
?>

View File

@ -1009,6 +1009,20 @@ function addTinyMCE(elementID) {
tinyMCE.EditorManager.execCommand('mceAddControl', true, elementID);
}
function autoclick_profile_users(firts_level, second_level) {
if (typeof firts_level !== "undefined") {
var is_checked_firts = $('#checkbox-' + firts_level).is(':checked');
if (!is_checked_firts) {
$('#checkbox-' + firts_level).prop('checked', true);
}
if (second_level !== false) {
if (!$('#checkbox-' + second_level).is(":checked")) {
$('#checkbox-' + second_level).prop('checked', true);
}
}
}
}
/**
* Auto hides an element and shows it
* when the user moves the mouse over the body.