From 005a738ee38ca7fca36ab7fe88b09e9f17b8e7ce Mon Sep 17 00:00:00 2001 From: juanmanuelr Date: Thu, 7 Jun 2012 14:22:38 +0000 Subject: [PATCH] 2012-06-07 Juan Manuel Ramon * include/styles/pandora_minimal.css operation/extensions.php operation/menu.php general/header.php godmode/extensions.php: Hide not valid sections with metaconsole activated. Merged from branches. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6443 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 11 + pandora_console/general/header.php | 13 +- pandora_console/godmode/extensions.php | 8 + .../include/styles/pandora_minimal.css | 21 ++ pandora_console/operation/extensions.php | 8 +- pandora_console/operation/menu.php | 194 ++++++++++-------- 6 files changed, 158 insertions(+), 97 deletions(-) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 868fb7be12..80783b1243 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,14 @@ +2012-06-07 Juan Manuel Ramon + + * include/styles/pandora_minimal.css + operation/extensions.php + operation/menu.php + general/header.php + godmode/extensions.php: Hide not valid sections with metaconsole + activated. + + Merged from branches. + 2012-06-07 Dario Rodriguez * include/functions_os.php: Created this file. diff --git a/pandora_console/general/header.php b/pandora_console/general/header.php index 2f9a13cc14..993de80b3f 100644 --- a/pandora_console/general/header.php +++ b/pandora_console/general/header.php @@ -92,7 +92,13 @@ config_check(); // Main help icon echo " "; echo " "; - echo ui_print_help_icon ("main_help", true); + echo ui_print_help_icon ("main_help", true); + if ($config['metaconsole'] == 1) { + echo " "; + echo " "; + html_print_image("images/application_double.png", false, array("alt" => __('Metaconsole activated'), "class" => 'bot', "title" => __('You are using metaconsole'))); + } + echo ''; echo ''; @@ -117,10 +123,7 @@ config_check(); unset ($servers); // Since this is the header, we don't like to trickle down variables. echo ''; } - else { - // TODO: Put here to remark this is a metaconsole - echo ""; - } + ?> diff --git a/pandora_console/godmode/extensions.php b/pandora_console/godmode/extensions.php index b141843b8f..eceeb6b564 100644 --- a/pandora_console/godmode/extensions.php +++ b/pandora_console/godmode/extensions.php @@ -258,6 +258,14 @@ foreach ($extensions as $file => $extension) { ' ' . html_print_image("images/lightbulb.png", true) . ''; } + // Filter operation and godmode extensions not included in metaconsole + if ($config['metaconsole'] == 1) { + if (!empty($config['extensions'][$file]['operation_menu']['fatherId']) and !array_key_exists($config['extensions'][$file]['operation_menu']['fatherId'], $operation_menu_array)) + continue; + if (!empty($config['extensions'][$file]['godmode_menu']['fatherId']) and !array_key_exists($config['extensions'][$file]['godmode_menu']['fatherId'], $menu)) + continue; + } + $table->data[] = $data; } html_print_table ($table); diff --git a/pandora_console/include/styles/pandora_minimal.css b/pandora_console/include/styles/pandora_minimal.css index f5d3648081..b3819316fa 100644 --- a/pandora_console/include/styles/pandora_minimal.css +++ b/pandora_console/include/styles/pandora_minimal.css @@ -181,4 +181,25 @@ input.next { padding-right: 21px; } +.info_box { + background: #EBEBEB; + margin: 10px auto; + padding: 5px; + border: 1px solid #A8A8A8; + width: 85% !important; + -moz-box-shadow: 0px 2px 2px #010E1B !important; + -webkit-box-shadow: 0px 2px 2px #010E1B !important; + box-shadow: 0px 2px 2px #010E1B !important; +} + +.info_box .title * { + font-size: 10pt !important; + font-weight: bolder; +} + +.info_box .icon { + width: 30px !important; + text-align: center; +} + diff --git a/pandora_console/operation/extensions.php b/pandora_console/operation/extensions.php index 18d056bb9c..5e2efa767a 100644 --- a/pandora_console/operation/extensions.php +++ b/pandora_console/operation/extensions.php @@ -55,7 +55,13 @@ foreach ($config['extensions'] as $extension) { continue; if ($extension['operation_menu'] == null) continue; - + + // If metaconsole is activated skip extensions without fatherID in menu array (this sections and extensions are filtered in metaconsole mode) + if ($config['metaconsole'] == 1) { + if (!empty($extension['operation_menu']['fatherId']) and !array_key_exists($extension['operation_menu']['fatherId'], $operation_menu_array)) + continue; + } + $data = array (); $data[0] = $extension['operation_menu']['name']; $data[1] = '' . __('Execute') . ''; diff --git a/pandora_console/operation/menu.php b/pandora_console/operation/menu.php index 2f27e50d09..0dcfdb28d3 100644 --- a/pandora_console/operation/menu.php +++ b/pandora_console/operation/menu.php @@ -30,79 +30,83 @@ if (check_acl ($config['id_user'], 0, "AR")) { enterprise_hook ('metaconsole_menu'); - //View agents - $menu["estado"]["text"] = __('Monitoring'); - $menu["estado"]["sec2"] = "operation/agentes/tactical"; - $menu["estado"]["refr"] = 0; - $menu["estado"]["id"] = "oper-agents"; - - $sub = array (); - $sub["operation/agentes/tactical"]["text"] = __('Tactical view'); - $sub["operation/agentes/tactical"]["refr"] = 0; + if ($config['metaconsole'] == 0) { + //View agents + $menu["estado"]["text"] = __('Monitoring'); + $menu["estado"]["sec2"] = "operation/agentes/tactical"; + $menu["estado"]["refr"] = 0; + $menu["estado"]["id"] = "oper-agents"; - $sub["operation/agentes/group_view"]["text"] = __('Group view'); - $sub["operation/agentes/group_view"]["refr"] = 0; - - $sub["operation/agentes/estado_agente"]["text"] = __('Agent detail'); - $sub["operation/agentes/estado_agente"]["refr"] = 0; - $sub["operation/agentes/estado_agente"]["subsecs"] = array( - "operation/agentes/ver_agente"); - - $sub["operation/agentes/alerts_status"]["text"] = __('Alert detail'); - $sub["operation/agentes/alerts_status"]["refr"] = 0; - - $sub["operation/agentes/status_monitor"]["text"] = __('Monitor detail'); - $sub["operation/agentes/status_monitor"]["refr"] = 0; - - enterprise_hook ('services_menu'); - - enterprise_hook ('inventory_menu'); - - $sub["operation/servers/recon_view"]["text"] = __('Recon view'); - $sub["operation/servers/recon_view"]["refr"] = 0; - - - //SNMP Console - $sub["operation/snmpconsole/snmp_view"]["text"] = __('SNMP console'); - $sub["operation/snmpconsole/snmp_view"]["refr"] = 0; - $sub["operation/snmpconsole/snmp_view"]["subsecs"] = array( - "enterprise/godmode/snmpconsole", - "godmode/snmpconsole/snmp_trap_editor", - "godmode/snmpconsole/snmp_alert", - "godmode/snmpconsole/snmp_filters", - "godmode/snmpconsole/snmp_trap_generator"); - - $sub2 = array(); - - $sub2["godmode/snmpconsole/snmp_alert"]["text"] = __("SNMP alerts"); - $sub2['godmode/snmpconsole/snmp_filters']['text'] = __('SNMP filters'); - enterprise_hook ('snmpconsole_submenu'); - $sub2['godmode/snmpconsole/snmp_trap_generator']['text'] = __('SNMP trap generator'); + $sub = array (); + $sub["operation/agentes/tactical"]["text"] = __('Tactical view'); + $sub["operation/agentes/tactical"]["refr"] = 0; + + $sub["operation/agentes/group_view"]["text"] = __('Group view'); + $sub["operation/agentes/group_view"]["refr"] = 0; + + $sub["operation/agentes/estado_agente"]["text"] = __('Agent detail'); + $sub["operation/agentes/estado_agente"]["refr"] = 0; + $sub["operation/agentes/estado_agente"]["subsecs"] = array( + "operation/agentes/ver_agente"); + + $sub["operation/agentes/alerts_status"]["text"] = __('Alert detail'); + $sub["operation/agentes/alerts_status"]["refr"] = 0; + + $sub["operation/agentes/status_monitor"]["text"] = __('Monitor detail'); + $sub["operation/agentes/status_monitor"]["refr"] = 0; + + enterprise_hook ('services_menu'); + + enterprise_hook ('inventory_menu'); + + $sub["operation/servers/recon_view"]["text"] = __('Recon view'); + $sub["operation/servers/recon_view"]["refr"] = 0; + + + //SNMP Console + $sub["operation/snmpconsole/snmp_view"]["text"] = __('SNMP console'); + $sub["operation/snmpconsole/snmp_view"]["refr"] = 0; + $sub["operation/snmpconsole/snmp_view"]["subsecs"] = array( + "enterprise/godmode/snmpconsole", + "godmode/snmpconsole/snmp_trap_editor", + "godmode/snmpconsole/snmp_alert", + "godmode/snmpconsole/snmp_filters", + "godmode/snmpconsole/snmp_trap_generator"); + + $sub2 = array(); + + $sub2["godmode/snmpconsole/snmp_alert"]["text"] = __("SNMP alerts"); + $sub2['godmode/snmpconsole/snmp_filters']['text'] = __('SNMP filters'); + enterprise_hook ('snmpconsole_submenu'); + $sub2['godmode/snmpconsole/snmp_trap_generator']['text'] = __('SNMP trap generator'); - $sub["operation/snmpconsole/snmp_view"]["sub2"] = $sub2; - - $sub['operation/tree']['text'] = __('Tree view'); - $sub["operation/tree"]["refr"] = 0; + $sub["operation/snmpconsole/snmp_view"]["sub2"] = $sub2; - $menu["estado"]["sub"] = $sub; - //End of view agents + $sub['operation/tree']['text'] = __('Tree view'); + $sub["operation/tree"]["refr"] = 0; + + $menu["estado"]["sub"] = $sub; + //End of view agents + } - //Start network view - - $menu["network"]["text"] = __('Network View'); - $menu["network"]["sec2"] = "operation/agentes/networkmap_list"; - $menu["network"]["refr"] = 0; - $menu["network"]["id"] = "oper-networkconsole"; - - $sub = array(); - - $sub["operation/agentes/networkmap_list"]["text"] = __('Network map'); - $sub["operation/agentes/networkmap_list"]["refr"] = 0; - - enterprise_hook ('networkmap_console'); - - $menu["network"]["sub"] = $sub; - //End networkview + if ($config['metaconsole'] == 0) { + //Start network view + + $menu["network"]["text"] = __('Network View'); + $menu["network"]["sec2"] = "operation/agentes/networkmap_list"; + $menu["network"]["refr"] = 0; + $menu["network"]["id"] = "oper-networkconsole"; + + $sub = array(); + + $sub["operation/agentes/networkmap_list"]["text"] = __('Network map'); + $sub["operation/agentes/networkmap_list"]["refr"] = 0; + + enterprise_hook ('networkmap_console'); + + $menu["network"]["sub"] = $sub; + //End networkview + } // Reporting $menu["reporting"]["text"] = __('Reporting'); @@ -172,25 +176,28 @@ if (check_acl ($config['id_user'], 0, "AR")) { } } - $sub["godmode/reporting/map_builder"]["sub2"] = $sub2; - - $sub["godmode/reporting/graphs"]["text"] = __('Custom graphs'); - //Set godomode path - $sub["godmode/reporting/graphs"]["subsecs"] = array( - "operation/reporting/graph_viewer", - "godmode/reporting/graph_builder"); + if ($config['metaconsole'] == 0) { + $sub["godmode/reporting/map_builder"]["sub2"] = $sub2; + + $sub["godmode/reporting/graphs"]["text"] = __('Custom graphs'); + //Set godomode path + $sub["godmode/reporting/graphs"]["subsecs"] = array( + "operation/reporting/graph_viewer", + "godmode/reporting/graph_builder"); + + $sub["operation/agentes/exportdata"]["text"] = __('Export data'); + $sub["operation/agentes/exportdata"]["subsecs"] = array("operation/agentes/exportdata"); - $sub["operation/agentes/exportdata"]["text"] = __('Export data'); - $sub["operation/agentes/exportdata"]["subsecs"] = array("operation/agentes/exportdata"); - - enterprise_hook ('dashboard_menu'); - enterprise_hook ('reporting_godmenu'); - + enterprise_hook ('dashboard_menu'); + enterprise_hook ('reporting_godmenu'); + } + $menu["reporting"]["sub"] = $sub; //End reporting + //INI GIS Maps - if ($config['activate_gis']) { + if ($config['activate_gis'] and ($config['metaconsole'] == 0)) { $menu["gismaps"]["text"] = __('GIS Maps'); $menu["gismaps"]["sec2"] = "operation/gis_maps/index"; $menu["gismaps"]["refr"] = 0; @@ -229,7 +236,7 @@ if (check_acl ($config['id_user'], 0, "AR")) { } // Rest of options, all with AR privilege (or should events be with incidents?) -if (check_acl ($config['id_user'], 0, "AR")) { +if (check_acl ($config['id_user'], 0, "AR") and ($config['metaconsole'] == 0)) { // Events $menu["eventos"]["text"] = __('View events'); $menu["eventos"]["refr"] = 0; @@ -332,7 +339,7 @@ $menu["workspace"]["sub"] = $sub; //End Workspace -if (check_acl ($config['id_user'], 0, "IR")) { +if (check_acl ($config['id_user'], 0, "IR") and ($config['metaconsole'] == 0)) { if ($config['activate_netflow']) { $menu["netf"]["text"] = __('Netflow'); $menu["netf"]["sec2"] = "operation/netflow/nf_reporting"; @@ -345,11 +352,13 @@ if (check_acl ($config['id_user'], 0, "IR")) { // Rest of options, all with AR privilege (or should events be with incidents?) if (check_acl ($config['id_user'], 0, "AR")) { - //SNMP Console - $menu["snmpconsole"]["text"] = __('SNMP console'); - $menu["snmpconsole"]["refr"] = 0; - $menu["snmpconsole"]["sec2"] = "operation/snmpconsole/snmp_view"; - $menu["snmpconsole"]["id"] = "oper-snmpc"; + if ($config['metaconsole'] == 0) { + //SNMP Console + $menu["snmpconsole"]["text"] = __('SNMP console'); + $menu["snmpconsole"]["refr"] = 0; + $menu["snmpconsole"]["sec2"] = "operation/snmpconsole/snmp_view"; + $menu["snmpconsole"]["id"] = "oper-snmpc"; + } // Extensions menu additions if (is_array ($config['extensions'])) { @@ -374,7 +383,8 @@ if (check_acl ($config['id_user'], 0, "AR")) { } else { if (array_key_exists('fatherId',$extension_menu)) { - if (strlen($extension_menu['fatherId']) > 0) { + // Check that extension father ID exists previously on the menu + if ((strlen($extension_menu['fatherId']) > 0) and (($config['metaconsole'] == 0) or (array_key_exists($extension_menu['fatherId'], $menu)))) { $menu[$extension_menu['fatherId']]['sub'][$extension_menu['sec2']]["text"] = __($extension_menu['name']); $menu[$extension_menu['fatherId']]['sub'][$extension_menu['sec2']]["refr"] = 0; $menu[$extension_menu['fatherId']]['sub'][$extension_menu['sec2']]["icon"] = $extension_menu['icon']; @@ -391,6 +401,8 @@ if (check_acl ($config['id_user'], 0, "AR")) { } } +// Save operation menu array to use in operation/extensions.php view +$operation_menu_array = $menu; menu_print_menu ($menu, true); ?>