From 5ee29865abe71f3b7344c1e75c3b7b7beb58f6f3 Mon Sep 17 00:00:00 2001 From: m-lopez-f Date: Wed, 31 Aug 2016 15:23:05 +0200 Subject: [PATCH] When click in management permmision autoclicked in inferior options of same part. Ticket: #3912 (cherry picked from commit a0753238f79ccb32e196814d08a5f323305fffc0) --- .../godmode/users/configure_profile.php | 92 ++++++++++--------- pandora_console/include/javascript/pandora.js | 14 +++ 2 files changed, 65 insertions(+), 41 deletions(-) diff --git a/pandora_console/godmode/users/configure_profile.php b/pandora_console/godmode/users/configure_profile.php index 88eef6789e..4552537665 100644 --- a/pandora_console/godmode/users/configure_profile.php +++ b/pandora_console/godmode/users/configure_profile.php @@ -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[] = '
'; // 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[] = '
'; // 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[] = '
'; // 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[] = '
'; + // 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[] = '
'; // 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[] = '
'; // 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[] = '
'; + + // 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[] = '
'; + + // Users + $row = array(); + $row['name'] = __('Manage users'); + $row['input'] = html_print_checkbox ('user_management', 1, $user_management, true); + $table->data['UM'] = $row; + $table->data[] = '
'; + + // DB + $row = array(); + $row['name'] = __('Manage database'); + $row['input'] = html_print_checkbox ('db_management', 1, $db_management, true); + $table->data['DM'] = $row; + $table->data[] = '
'; // Pandora $row = array(); $row['name'] = __('Pandora management'); $row['input'] = html_print_checkbox ('pandora_management', 1, $pandora_management, true); $table->data['PM'] = $row; + $table->data[] = '
'; echo '
'; @@ -373,5 +384,4 @@ if ($id_profile || $new_profile) { } enterprise_hook('close_meta_frame'); - ?> diff --git a/pandora_console/include/javascript/pandora.js b/pandora_console/include/javascript/pandora.js index a914beddc9..5e03a2e52e 100644 --- a/pandora_console/include/javascript/pandora.js +++ b/pandora_console/include/javascript/pandora.js @@ -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.