diff --git a/pandora_console/operation/visual_console/render_view.php b/pandora_console/operation/visual_console/render_view.php index 08b528c64a..dc51cbaac1 100755 --- a/pandora_console/operation/visual_console/render_view.php +++ b/pandora_console/operation/visual_console/render_view.php @@ -13,7 +13,7 @@ // GNU General Public License for more details. global $config; -$legacy = (bool) get_parameter('legacy', false); +$legacy = (bool) get_parameter('legacy'); if ($legacy === false) { include_once $config['homedir'].'/operation/visual_console/view.php'; return; diff --git a/pandora_console/operation/visual_console/view.php b/pandora_console/operation/visual_console/view.php index 4881086c7d..193f6ce34f 100644 --- a/pandora_console/operation/visual_console/view.php +++ b/pandora_console/operation/visual_console/view.php @@ -19,10 +19,11 @@ check_login(); require_once $config['homedir'].'/vendor/autoload.php'; require_once $config['homedir'].'/include/functions_visual_map.php'; -$id_layout = (int) get_parameter(!is_metaconsole() ? 'id' : 'id_visualmap'); +// Query parameters. +$visualConsoleId = (int) get_parameter(!is_metaconsole() ? 'id' : 'id_visualmap'); +$pure = (bool) get_parameter('pure', $config['pure']); -// Get input parameter for layout id. -if (!$id_layout) { +if (!$visualConsoleId) { db_pandora_audit( 'ACL Violation', 'Trying to access visual console without id layout' @@ -31,8 +32,7 @@ if (!$id_layout) { exit; } -$layout = db_get_row('tlayout', 'id', $id_layout); - +$layout = db_get_row('tlayout', 'id', $visualConsoleId); if (!$layout) { db_pandora_audit( 'ACL Violation', @@ -42,15 +42,15 @@ if (!$layout) { exit; } -$id_group = $layout['id_group']; -$layout_name = $layout['name']; +$groupId = $layout['id_group']; +$visualConsoleName = $layout['name']; // ACL. -$vconsole_read = check_acl($config['id_user'], $id_group, 'VR'); -$vconsole_write = check_acl($config['id_user'], $id_group, 'VW'); -$vconsole_manage = check_acl($config['id_user'], $id_group, 'VM'); +$aclRead = check_acl($config['id_user'], $groupId, 'VR'); +$aclWrite = check_acl($config['id_user'], $groupId, 'VW'); +$aclManage = check_acl($config['id_user'], $groupId, 'VM'); -if (!$vconsole_read && !$vconsole_write && !$vconsole_manage) { +if (!$aclRead && !$aclWrite && !$aclManage) { db_pandora_audit( 'ACL Violation', 'Trying to access visual console without group access' @@ -59,32 +59,22 @@ if (!$vconsole_read && !$vconsole_write && !$vconsole_manage) { exit; } -$refr = (int) get_parameter('refr', $config['vc_refr']); -$graph_javascript = (bool) get_parameter('graph_javascript', true); -$vc_refr = false; - -if (isset($config['vc_refr']) && $config['vc_refr'] != 0) { - $view_refresh = $config['vc_refr']; -} else { - $view_refresh = '300'; -} - // Render map. $options = []; -$options['consoles_list']['text'] = ''.html_print_image( +$options['consoles_list']['text'] = ''.html_print_image( 'images/visual_console.png', true, ['title' => __('Visual consoles list')] ).''; -if ($vconsole_write || $vconsole_manage) { +if ($aclWrite || $aclManage) { $url_base = 'index.php?sec=network&sec2=godmode/reporting/visual_console_builder&action='; - $hash = md5($config['dbpass'].$id_layout.$config['id_user']); + $hash = md5($config['dbpass'].$visualConsoleId.$config['id_user']); $options['public_link']['text'] = ''.html_print_image( 'images/camera_mc.png', true, @@ -92,43 +82,51 @@ if ($vconsole_write || $vconsole_manage) { ).''; $options['public_link']['active'] = false; - $options['data']['text'] = ''.html_print_image( + $options['data']['text'] = ''.html_print_image( 'images/op_reporting.png', true, ['title' => __('Main data')] ).''; - $options['list_elements']['text'] = ''.html_print_image( + $options['list_elements']['text'] = ''.html_print_image( 'images/list.png', true, ['title' => __('List elements')] ).''; if (enterprise_installed()) { - $options['wizard_services']['text'] = ''.html_print_image( + $options['wizard_services']['text'] = ''.html_print_image( 'images/wand_services.png', true, ['title' => __('Services wizard')] ).''; } - $options['wizard']['text'] = ''.html_print_image( + $options['wizard']['text'] = ''.html_print_image( 'images/wand.png', true, ['title' => __('Wizard')] ).''; - $options['editor']['text'] = ''.html_print_image( + $options['editor']['text'] = ''.html_print_image( 'images/builder.png', true, ['title' => __('Builder')] ).''; } -$options['view']['text'] = ''.html_print_image('images/operation.png', true, ['title' => __('View')]).''; +$options['view']['text'] = ''.html_print_image('images/operation.png', true, ['title' => __('View')]).''; $options['view']['active'] = true; + if (!is_metaconsole()) { if (!$config['pure']) { - $options['pure']['text'] = ''.html_print_image('images/full_screen.png', true, ['title' => __('Full screen mode')]).''; - ui_print_page_header($layout_name, 'images/visual_console.png', false, '', false, $options); + $options['pure']['text'] = ''.html_print_image('images/full_screen.png', true, ['title' => __('Full screen mode')]).''; + ui_print_page_header( + $visualConsoleName, + 'images/visual_console.png', + false, + '', + false, + $options + ); } // Set the hidden value for the javascript. @@ -140,8 +138,9 @@ if (!is_metaconsole()) { use Models\VisualConsole\Container as VisualConsole; +// TODO: Show an error message when the models can't be loaded. $visualConsole = VisualConsole::fromArray($layout); -$visualConsoleItems = VisualConsole::getItemsFromDB($id_layout); +$visualConsoleItems = VisualConsole::getItemsFromDB($visualConsoleId); // TODO: Extract to a function. $vcClientPath = 'include/visual-console-client'; @@ -174,69 +173,52 @@ if (is_dir($dir)) { echo '
'; -if ($config['pure']) { - // Floating menu - Start +if ($pure === true) { + // Floating menu - Start. echo '
'; echo ''; echo '
'; - // Floating menu - End - ui_require_jquery_file('countdown'); - + // Floating menu - End. ?> - +