diff --git a/pandora_console/extras/mr/62.sql b/pandora_console/extras/mr/62.sql new file mode 100644 index 0000000000..4d21f9bb2a --- /dev/null +++ b/pandora_console/extras/mr/62.sql @@ -0,0 +1,63 @@ +START TRANSACTION; + +UPDATE tconfig_os SET `icon_name` = 'linux@os.svg' WHERE `id_os` = 1; +UPDATE tconfig_os SET `icon_name` = 'solaris@os.svg' WHERE `id_os` = 2; +UPDATE tconfig_os SET `icon_name` = 'aix@os.svg' WHERE `id_os` = 3; +UPDATE tconfig_os SET `icon_name` = 'freebsd@os.svg' WHERE `id_os` = 4; +UPDATE tconfig_os SET `icon_name` = 'HP@os.svg' WHERE `id_os` = 5; +UPDATE tconfig_os SET `icon_name` = 'cisco@os.svg' WHERE `id_os` = 7; +UPDATE tconfig_os SET `icon_name` = 'apple@os.svg' WHERE `id_os` = 8; +UPDATE tconfig_os SET `icon_name` = 'windows@os.svg' WHERE `id_os` = 9; +UPDATE tconfig_os SET `icon_name` = 'other-OS@os.svg' WHERE `id_os` = 10; +UPDATE tconfig_os SET `icon_name` = 'network-server@os.svg' WHERE `id_os` = 11; +UPDATE tconfig_os SET `icon_name` = 'network-server@os.svg' WHERE `id_os` = 12; +UPDATE tconfig_os SET `icon_name` = 'network-server@os.svg' WHERE `id_os` = 13; +UPDATE tconfig_os SET `icon_name` = 'embedded@os.svg' WHERE `id_os` = 14; +UPDATE tconfig_os SET `icon_name` = 'android@os.svg' WHERE `id_os` = 15; +UPDATE tconfig_os SET `icon_name` = 'vmware@os.svg' WHERE `id_os` = 16; +UPDATE tconfig_os SET `icon_name` = 'routers@os.svg' WHERE `id_os` = 17; +UPDATE tconfig_os SET `icon_name` = 'switch@os.svg' WHERE `id_os` = 18; +UPDATE tconfig_os SET `icon_name` = 'satellite@os.svg' WHERE `id_os` = 19; +UPDATE tconfig_os SET `icon_name` = 'mainframe@os.svg' WHERE `id_os` = 20; +UPDATE tconfig_os SET `icon_name` = 'cluster@os.svg' WHERE `id_os` = 100; + +UPDATE tgrupo SET `icon` = 'servers@groups.svg' WHERE `id_grupo` = 2; +UPDATE tgrupo SET `icon` = 'firewall@groups.svg' WHERE `id_grupo` = 4; +UPDATE tgrupo SET `icon` = 'database@groups.svg' WHERE `id_grupo` = 8; +UPDATE tgrupo SET `icon` = 'network@groups.svg' WHERE `id_grupo` = 9; +UPDATE tgrupo SET `icon` = 'unknown@groups.svg' WHERE `id_grupo` = 10; +UPDATE tgrupo SET `icon` = 'workstation@groups.svg' WHERE `id_grupo` = 11; +UPDATE tgrupo SET `icon` = 'applications@groups.svg' WHERE `id_grupo` = 12; +UPDATE tgrupo SET `icon` = 'web@groups.svg' WHERE `id_grupo` = 13; + +UPDATE `ttipo_modulo` SET `icon` = 'data-server@svg.svg' WHERE `id_tipo` = 1; +UPDATE `ttipo_modulo` SET `icon` = 'generic-boolean@svg.svg' WHERE `id_tipo` = 2; +UPDATE `ttipo_modulo` SET `icon` = 'generic-string@svg.svg' WHERE `id_tipo` = 3; +UPDATE `ttipo_modulo` SET `icon` = 'data-server@svg.svg' WHERE `id_tipo` = 4; +UPDATE `ttipo_modulo` SET `icon` = 'data-server@svg.svg' WHERE `id_tipo` = 5; +UPDATE `ttipo_modulo` SET `icon` = 'ICMP-network-boolean-data@svg.svg' WHERE `id_tipo` = 6; +UPDATE `ttipo_modulo` SET `icon` = 'ICMP-network-latency@svg.svg' WHERE `id_tipo` = 7; +UPDATE `ttipo_modulo` SET `icon` = 'TCP-network-numeric-data@svg.svg' WHERE `id_tipo` = 8; +UPDATE `ttipo_modulo` SET `icon` = 'TCP-network-boolean-data@svg.svg' WHERE `id_tipo` = 9; +UPDATE `ttipo_modulo` SET `icon` = 'TCP-network-alphanumeric-data@svg.svg' WHERE `id_tipo` = 10; +UPDATE `ttipo_modulo` SET `icon` = 'TCP-network-incremental-data@svg.svg' WHERE `id_tipo` = 11; +UPDATE `ttipo_modulo` SET `icon` = 'SNMP-network-numeric-data@svg.svg' WHERE `id_tipo` = 15; +UPDATE `ttipo_modulo` SET `icon` = 'SNMP-network-incremental-data@svg.svg' WHERE `id_tipo` = 16; +UPDATE `ttipo_modulo` SET `icon` = 'SNMP-network-alphanumeric-data@svg.svg' WHERE `id_tipo` = 17; +UPDATE `ttipo_modulo` SET `icon` = 'SNMP-network-incremental-data@svg.svg' WHERE `id_tipo` = 18; +UPDATE `ttipo_modulo` SET `icon` = 'asynchronus-data@svg.svg' WHERE `id_tipo` = 21; +UPDATE `ttipo_modulo` SET `icon` = 'asynchronus-data@svg.svg' WHERE `id_tipo` = 22; +UPDATE `ttipo_modulo` SET `icon` = 'asynchronus-data@svg.svg' WHERE `id_tipo` = 23; +UPDATE `ttipo_modulo` SET `icon` = 'wux@svg.svg' WHERE `id_tipo` = 25; +UPDATE `ttipo_modulo` SET `icon` = 'server-web@svg.svg' WHERE `id_tipo` = 30; +UPDATE `ttipo_modulo` SET `icon` = 'web-analisys-data@svg.svg' WHERE `id_tipo` = 31; +UPDATE `ttipo_modulo` SET `icon` = 'server-web@svg.svg' WHERE `id_tipo` = 32; +UPDATE `ttipo_modulo` SET `icon` = 'server-web@svg.svg' WHERE `id_tipo` = 33; +UPDATE `ttipo_modulo` SET `icon` = 'remote-execution-numeric-data@svg.svg' WHERE `id_tipo` = 34; +UPDATE `ttipo_modulo` SET `icon` = 'remote-execution-boolean-data@svg.svg' WHERE `id_tipo` = 35; +UPDATE `ttipo_modulo` SET `icon` = 'remote-execution-alphanumeric-data@svg.svg' WHERE `id_tipo` = 36; +UPDATE `ttipo_modulo` SET `icon` = 'remote-execution-incremental-data@svg.svg' WHERE `id_tipo` = 37; +UPDATE `ttipo_modulo` SET `icon` = 'server-web@svg.svg' WHERE `id_tipo` = 38; +UPDATE `ttipo_modulo` SET `icon` = 'keepalive@svg.svg' WHERE `id_tipo` = 100; + +COMMIT; diff --git a/pandora_console/general/header.php b/pandora_console/general/header.php index fc666af8b0..d82f1a0be2 100644 --- a/pandora_console/general/header.php +++ b/pandora_console/general/header.php @@ -26,7 +26,7 @@ config_check(); echo sprintf('
', $menuTypeClass); ?> -
+
', $menuTypeClass); // ======= Servers List =============================================== if ((bool) check_acl($config['id_user'], 0, 'AW') !== false) { - $servers_list = '
'; $servers = []; $servers['all'] = (int) db_get_value('COUNT(id_server)', 'tserver'); if ($servers['all'] != 0) { @@ -45,22 +44,33 @@ echo sprintf('
', $menuTypeClass); $servers['down'] = ($servers['all'] - $servers['up']); if ($servers['up'] == 0) { // All Servers down or no servers at all. - $servers_check_img = html_print_image('images/header_down_gray.png', true, ['alt' => 'cross', 'class' => 'bot', 'title' => __('All systems').': '.__('Down')]); + $servers_check_img = html_print_image('images/system_error@header.svg', true, ['alt' => 'cross', 'class' => 'main_menu_icon bot', 'title' => __('All systems').': '.__('Down')]); } else if ($servers['down'] != 0) { // Some servers down. - $servers_check_img = html_print_image('images/header_warning_gray.png', true, ['alt' => 'error', 'class' => 'bot', 'title' => $servers['down'].' '.__('servers down')]); + $servers_check_img = html_print_image('images/system_warning@header.svg', true, ['alt' => 'error', 'class' => 'main_menu_icon bot', 'title' => $servers['down'].' '.__('servers down')]); } else { // All servers up. - $servers_check_img = html_print_image('images/header_ready_gray.png', true, ['alt' => 'ok', 'class' => 'bot', 'title' => __('All systems').': '.__('Ready')]); + $servers_check_img = html_print_image('images/system_ok@header.svg', true, ['alt' => 'ok', 'class' => 'main_menu_icon bot', 'title' => __('All systems').': '.__('Ready')]); } unset($servers); // Since this is the header, we don't like to trickle down variables. - $servers_check_img_link = ''; - $servers_check_img_link .= $servers_check_img; - $servers_check_img_link .= ''; + $servers_check_img_link = html_print_anchor( + [ + 'href' => 'index.php?sec=gservers&sec2=godmode/servers/modificar_server&refr=60', + 'content' => $servers_check_img, + ], + true + ); }; - $servers_list .= $servers_check_img_link.'
'; + + $servers_list = html_print_div( + [ + 'id' => 'servers_list', + 'content' => $servers_check_img_link, + ], + true + ); } @@ -71,9 +81,9 @@ echo sprintf('
', $menuTypeClass); $check_minor_release_available = db_check_minor_relase_available(); - if ($check_minor_release_available) { + if ($check_minor_release_available === true) { if (users_is_admin($config['id_user'])) { - if ($config['language'] == 'es') { + if ($config['language'] === 'es') { set_pandora_error_for_header('Hay una o mas revisiones menores en espera para ser actualizadas. '.__('Sobre actualización de revisión menor').'', 'Revisión/es menor/es disponible/s'); } else { set_pandora_error_for_header('There are one or more minor releases waiting for update. '.__('About minor release update').'', 'minor release/s available'); @@ -227,10 +237,10 @@ echo sprintf('
', $menuTypeClass); if ($do_refresh) { $autorefresh_img = html_print_image( - 'images/header_refresh_gray.png', + 'images/auto_refresh@header.svg', true, [ - 'class' => 'bot', + 'class' => 'main_menu_icon bot', 'alt' => 'lightning', 'title' => __('Configure autorefresh'), ] @@ -293,10 +303,10 @@ echo sprintf('
', $menuTypeClass); $display_counter = 'display:block'; } else { $autorefresh_img = html_print_image( - 'images/header_refresh_disabled_gray.png', + 'images/auto_refresh@header.svg', true, [ - 'class' => 'bot autorefresh_disabled invert_filter', + 'class' => 'main_menu_icon bot autorefresh_disabled invert_filter', 'alt' => 'lightning', 'title' => __('Disabled autorefresh'), ] @@ -312,10 +322,10 @@ echo sprintf('
', $menuTypeClass); } } else { $autorefresh_img = html_print_image( - 'images/header_refresh_disabled_gray.png', + 'images/auto_refresh@header.svg', true, [ - 'class' => 'bot autorefresh_disabled invert_filter', + 'class' => 'main_menu_icon bot autorefresh_disabled invert_filter', 'alt' => 'lightning', 'title' => __('Disabled autorefresh'), ] @@ -350,9 +360,10 @@ echo sprintf('
', $menuTypeClass); $header_feedback .= ''; $header_feedback .= ''; $header_feedback .= html_print_image( - 'images/feedback-header.png', + 'images/send_feedback@header.svg', true, [ + 'class' => 'main_menu_icon', 'title' => __('Feedback'), 'id' => 'feedback-header', 'alt' => __('Feedback'), @@ -373,11 +384,11 @@ echo sprintf('
', $menuTypeClass); $header_support = '
'; $header_support .= ''; $header_support .= html_print_image( - 'images/header_support.png', + 'images/support@header.svg', true, [ 'title' => __('Go to support'), - 'class' => 'bot invert_filter', + 'class' => 'main_menu_icon bot invert_filter', 'alt' => 'user', ] ); @@ -387,11 +398,11 @@ echo sprintf('
', $menuTypeClass); $header_docu = '
'; $header_docu .= ''; $header_docu .= html_print_image( - 'images/header_docu.png', + 'images/documentation@header.svg', true, [ 'title' => __('Go to documentation'), - 'class' => 'bot invert_filter', + 'class' => 'main_menu_icon bot invert_filter', 'alt' => 'user', ] ); @@ -399,15 +410,14 @@ echo sprintf('
', $menuTypeClass); // User. - $headerUserImage = (is_user_admin($config['id_user']) === true) ? 'images/header_user_admin_green.png' : 'images/header_user_green.png'; - + // $headerUserImage = (is_user_admin($config['id_user']) === true) ? 'images/header_user_admin_green.png' : 'images/header_user_green.png'; $headerUser = []; $headerUser[] = html_print_image( - $headerUserImage, + 'images/edit_user@header.svg', true, [ 'title' => __('Edit my user'), - 'class' => 'bot', + 'class' => 'main_menu_icon bot', 'alt' => 'user', ] ); @@ -431,7 +441,7 @@ echo sprintf('
', $menuTypeClass); // Logout. $header_logout = ''; echo ''; */ function menu_calculate_top(index, item_height) { const result = index * item_height; - return 140 + result; + return 133 + result; } }); diff --git a/pandora_console/godmode/setup/os.builder.php b/pandora_console/godmode/setup/os.builder.php index 83b79e95a4..ac2026d0e6 100644 --- a/pandora_console/godmode/setup/os.builder.php +++ b/pandora_console/godmode/setup/os.builder.php @@ -1,17 +1,32 @@ '; $table = new stdClass(); $table->width = '100%'; $table->class = 'databox filters'; -$table->style[0] = 'font-weight: bolder;'; +$table->style[0] = 'width: 15%'; $table->data[0][0] = __('Name:'); -$table->data[0][1] = html_print_input_text('name', $name, __('Name'), 20, 30, true); +$table->data[0][1] = html_print_input_text('name', $name, __('Name'), 20, 30, true, false, false, '', 'w250px'); $table->data[1][0] = __('Description'); -$table->data[1][1] = html_print_textarea('description', 5, 10, $description, '', true); -$icons = get_list_os_icons_dir(); +$table->data[1][1] = html_print_textarea('description', 5, 20, $description, '', true, 'w250px'); $table->data[2][0] = __('Icon'); -$table->data[2][1] = html_print_select($icons, 'icon', $icon, 'show_icon_OS();', __('None'), 0, true); -$table->data[2][1] .= ' '.ui_print_os_icon($idOS, false, true).''; + +$iconData = []; +$iconData[] = html_print_select( + $icons, + 'icon', + $icon, + 'show_icon_OS();', + __('None'), + 0, + true +); +$iconData[] = html_print_div( + [ + 'id' => 'icon_image', + 'class' => 'inverse_filter main_menu_icon', + 'style' => 'margin-left: 10px', + 'content' => ui_print_os_icon($idOS, false, true), + ], + true +); + +$table->data[2][1] = html_print_div( + [ + 'style' => 'display: flex;align-items: center;', + 'content' => implode('', $iconData), + ], + true +); html_print_table($table); @@ -47,9 +89,11 @@ html_print_table($table); html_print_input_hidden('id_os', $idOS); html_print_input_hidden('action', $actionHidden); -echo '
'; -html_print_submit_button($textButton, 'update_button', false, $classButton); -echo '
'; +html_print_action_buttons( + html_print_submit_button($textButton, 'update_button', false, $classButton, true), + ['type' => 'form_action'] +); + echo ''; @@ -59,18 +103,10 @@ function get_list_os_icons_dir() $return = []; - $items = scandir($config['homedir'].'/images/os_icons'); + $items = scandir($config['homedir'].'/images/'); foreach ($items as $item) { - if (strstr($item, '_small.png') || strstr($item, '_small.gif') - || strstr($item, '_small.jpg') - ) { - continue; - } - - if (strstr($item, '.png') || strstr($item, '.gif') - || strstr($item, '.jpg') - ) { + if (strstr($item, '@os.svg')) { $return[$item] = $item; } } @@ -86,7 +122,7 @@ function show_icon_OS() { var params = []; params.push("get_image_path=1"); - params.push('img_src=images/os_icons/' + $("#icon").val()); + params.push('img_src=images/' + $("#icon").val()); params.push("page=include/ajax/skins.ajax"); jQuery.ajax ({ data: params.join ("&"), diff --git a/pandora_console/godmode/setup/os.list.php b/pandora_console/godmode/setup/os.list.php index 48a8b9b534..f8ba6a865a 100644 --- a/pandora_console/godmode/setup/os.list.php +++ b/pandora_console/godmode/setup/os.list.php @@ -1,6 +1,6 @@ width = '100%'; +// $table->width = '100%'; +$table->styleTable = 'margin: 10px 10px 0'; $table->class = 'info_table'; $table->head[0] = ''; @@ -102,7 +103,7 @@ if ($osList === false) { $table->data = []; foreach ($osList as $os) { $data = []; - $data[] = ui_print_os_icon($os['id_os'], false, true); + $data[] = html_print_div(['class' => 'main_menu_icon', 'content' => ui_print_os_icon($os['id_os'], false, true)], true); $data[] = $os['id_os']; if ($is_management_allowed === true) { if (is_metaconsole() === true) { @@ -119,11 +120,20 @@ foreach ($osList as $os) { if ($is_management_allowed === true) { $table->cellclass[][4] = 'table_action_buttons'; if ($os['id_os'] > 16) { - if (is_metaconsole()) { - $data[] = '
'.html_print_image('images/cross.png', true).''; + if (is_metaconsole() === true) { + $hrefDelete = 'index.php?sec=advanced&sec2=advanced/component_management&tab=os_manage&action=delete&tab2=list&id_os='.$os['id_os']; } else { - $data[] = ''.html_print_image('images/cross.png', true, ['class' => 'invert_filter']).''; + $hrefDelete = 'index.php?sec=gsetup&sec2=godmode/setup/os&action=delete&tab=list&id_os='.$os['id_os']; } + + $data[] = html_print_anchor( + [ + 'href' => $hrefDelete, + 'class' => 'inverse_filter main_menu_icon', + 'content' => html_print_image('images/delete.svg', true), + ], + true + ); } else { // The original icons of pandora don't delete. $data[] = ''; @@ -134,7 +144,6 @@ foreach ($osList as $os) { } if (isset($data) === true) { - ui_pagination($count_osList, ui_get_url_refresh(['message' => false]), $offset); html_print_table($table); ui_pagination($count_osList, ui_get_url_refresh(['message' => false]), $offset, 0, false, 'offset', true, 'pagination-bottom'); } else { diff --git a/pandora_console/godmode/setup/os.php b/pandora_console/godmode/setup/os.php index dafdfe0730..8ced483492 100644 --- a/pandora_console/godmode/setup/os.php +++ b/pandora_console/godmode/setup/os.php @@ -71,7 +71,7 @@ if ($is_management_allowed === true) { case 'edit': $actionHidden = 'update'; $textButton = __('Update'); - $classButton = 'class="sub upd"'; + $classButton = ['icon' => 'wand']; break; case 'save': @@ -93,7 +93,7 @@ if ($is_management_allowed === true) { $tab = 'builder'; $actionHidden = 'save'; $textButton = __('Create'); - $classButton = 'class="sub next"'; + $classButton = ['icon' => 'wand']; } else { $tab = 'list'; $message = 1; @@ -140,7 +140,7 @@ if ($is_management_allowed === true) { $actionHidden = 'update'; $textButton = __('Update'); - $classButton = 'class="sub upd"'; + $classButton = ['icon' => 'wand']; if (is_metaconsole() === true) { header('Location:'.$config['homeurl'].'index.php?sec=advanced&sec2=advanced/component_management&tab=os_manage&tab2='.$tab.'&message='.$message); } else { @@ -175,7 +175,7 @@ if ($is_management_allowed === true) { case 'new': $actionHidden = 'save'; $textButton = __('Create'); - $classButton = 'class="sub next"'; + $classButton = ['icon' => 'next']; break; } } @@ -184,11 +184,11 @@ $buttons = []; $buttons['list'] = [ 'active' => false, 'text' => ''.html_print_image( - 'images/list.png', + 'images/logs@svg.svg', true, [ 'title' => __('List OS'), - 'class' => 'invert_filter', + 'class' => 'invert_filter main_menu_icon', ] ).'', ]; @@ -196,11 +196,11 @@ if ($is_management_allowed === true) { $buttons['builder'] = [ 'active' => false, 'text' => ''.html_print_image( - 'images/builder.png', + 'images/edit.svg', true, [ 'title' => __('Builder OS'), - 'class' => 'invert_filter', + 'class' => 'invert_filter main_menu_icon', ] ).'', ]; diff --git a/pandora_console/images/HP@svg.svg b/pandora_console/images/HP@os.svg similarity index 100% rename from pandora_console/images/HP@svg.svg rename to pandora_console/images/HP@os.svg diff --git a/pandora_console/images/aix@svg.svg b/pandora_console/images/aix@os.svg similarity index 100% rename from pandora_console/images/aix@svg.svg rename to pandora_console/images/aix@os.svg diff --git a/pandora_console/images/android@svg.svg b/pandora_console/images/android@os.svg similarity index 100% rename from pandora_console/images/android@svg.svg rename to pandora_console/images/android@os.svg diff --git a/pandora_console/images/apple@svg.svg b/pandora_console/images/apple@os.svg similarity index 100% rename from pandora_console/images/apple@svg.svg rename to pandora_console/images/apple@os.svg diff --git a/pandora_console/images/auto_refresh@header.svg b/pandora_console/images/auto_refresh@header.svg new file mode 100644 index 0000000000..4c9de8f3aa --- /dev/null +++ b/pandora_console/images/auto_refresh@header.svg @@ -0,0 +1,11 @@ + + + + Dark / 20 / Auto refresh@svg + Created with Sketch. + + + + + + \ No newline at end of file diff --git a/pandora_console/images/cisco@svg.svg b/pandora_console/images/cisco@os.svg similarity index 100% rename from pandora_console/images/cisco@svg.svg rename to pandora_console/images/cisco@os.svg diff --git a/pandora_console/images/cluster@svg.svg b/pandora_console/images/cluster@os.svg similarity index 100% rename from pandora_console/images/cluster@svg.svg rename to pandora_console/images/cluster@os.svg diff --git a/pandora_console/images/discovery_error@header.svg b/pandora_console/images/discovery_error@header.svg new file mode 100644 index 0000000000..cb323bfbb2 --- /dev/null +++ b/pandora_console/images/discovery_error@header.svg @@ -0,0 +1,9 @@ + + + + Dark / 20 / Header discovery error@svg + Created with Sketch. + + + + \ No newline at end of file diff --git a/pandora_console/images/discovery_ok@header.svg b/pandora_console/images/discovery_ok@header.svg new file mode 100644 index 0000000000..2b9ca237ac --- /dev/null +++ b/pandora_console/images/discovery_ok@header.svg @@ -0,0 +1,9 @@ + + + + Dark / 20 / Header discovery ok@svg + Created with Sketch. + + + + \ No newline at end of file diff --git a/pandora_console/images/discovery_warning@header.svg b/pandora_console/images/discovery_warning@header.svg new file mode 100644 index 0000000000..c85e425eec --- /dev/null +++ b/pandora_console/images/discovery_warning@header.svg @@ -0,0 +1,9 @@ + + + + Dark / 20 / Header discovery warning@svg + Created with Sketch. + + + + \ No newline at end of file diff --git a/pandora_console/images/documentation@header.svg b/pandora_console/images/documentation@header.svg new file mode 100644 index 0000000000..3e7cbb0889 --- /dev/null +++ b/pandora_console/images/documentation@header.svg @@ -0,0 +1,9 @@ + + + + Dark / 20 / Documentation@svg + Created with Sketch. + + + + \ No newline at end of file diff --git a/pandora_console/images/edit_user@header.svg b/pandora_console/images/edit_user@header.svg new file mode 100644 index 0000000000..f1cc04deb7 --- /dev/null +++ b/pandora_console/images/edit_user@header.svg @@ -0,0 +1,9 @@ + + + + Dark / 20 / Edit User@svg + Created with Sketch. + + + + \ No newline at end of file diff --git a/pandora_console/images/embedded@svg.svg b/pandora_console/images/embedded@os.svg similarity index 100% rename from pandora_console/images/embedded@svg.svg rename to pandora_console/images/embedded@os.svg diff --git a/pandora_console/images/example_qr.png b/pandora_console/images/example_qr.png new file mode 100644 index 0000000000..e20000cb3c Binary files /dev/null and b/pandora_console/images/example_qr.png differ diff --git a/pandora_console/images/freebsd@svg.svg b/pandora_console/images/freebsd@os.svg similarity index 100% rename from pandora_console/images/freebsd@svg.svg rename to pandora_console/images/freebsd@os.svg diff --git a/pandora_console/images/linux@svg.svg b/pandora_console/images/linux@os.svg similarity index 100% rename from pandora_console/images/linux@svg.svg rename to pandora_console/images/linux@os.svg diff --git a/pandora_console/images/mainframe@svg.svg b/pandora_console/images/mainframe@os.svg similarity index 100% rename from pandora_console/images/mainframe@svg.svg rename to pandora_console/images/mainframe@os.svg diff --git a/pandora_console/images/network-server@svg.svg b/pandora_console/images/network-server@os.svg similarity index 100% rename from pandora_console/images/network-server@svg.svg rename to pandora_console/images/network-server@os.svg diff --git a/pandora_console/images/other-OS@svg.svg b/pandora_console/images/other-OS@os.svg similarity index 100% rename from pandora_console/images/other-OS@svg.svg rename to pandora_console/images/other-OS@os.svg diff --git a/pandora_console/images/routers@svg.svg b/pandora_console/images/routers@os.svg similarity index 100% rename from pandora_console/images/routers@svg.svg rename to pandora_console/images/routers@os.svg diff --git a/pandora_console/images/satellite@svg.svg b/pandora_console/images/satellite@os.svg similarity index 100% rename from pandora_console/images/satellite@svg.svg rename to pandora_console/images/satellite@os.svg diff --git a/pandora_console/images/send_feedback@header.svg b/pandora_console/images/send_feedback@header.svg new file mode 100644 index 0000000000..cd4ef7e83b --- /dev/null +++ b/pandora_console/images/send_feedback@header.svg @@ -0,0 +1,9 @@ + + + + Dark / 20 / Send feedbacks@svg + Created with Sketch. + + + + \ No newline at end of file diff --git a/pandora_console/images/sign_out@header.svg b/pandora_console/images/sign_out@header.svg new file mode 100644 index 0000000000..7d23d328f1 --- /dev/null +++ b/pandora_console/images/sign_out@header.svg @@ -0,0 +1,9 @@ + + + + Dark / 20 / Sign out@svg + Created with Sketch. + + + + \ No newline at end of file diff --git a/pandora_console/images/solaris@svg.svg b/pandora_console/images/solaris@os.svg similarity index 100% rename from pandora_console/images/solaris@svg.svg rename to pandora_console/images/solaris@os.svg diff --git a/pandora_console/images/support@header.svg b/pandora_console/images/support@header.svg new file mode 100644 index 0000000000..3b9cf3e31a --- /dev/null +++ b/pandora_console/images/support@header.svg @@ -0,0 +1,9 @@ + + + + Dark / 20 / Support@svg + Created with Sketch. + + + + \ No newline at end of file diff --git a/pandora_console/images/svg/add.svg b/pandora_console/images/svg/add.svg deleted file mode 100644 index 3530cc8203..0000000000 --- a/pandora_console/images/svg/add.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/pandora_console/images/svg/arrow.svg b/pandora_console/images/svg/arrow.svg deleted file mode 100644 index 7fb5d31ac4..0000000000 --- a/pandora_console/images/svg/arrow.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/pandora_console/images/svg/bell.svg b/pandora_console/images/svg/bell.svg deleted file mode 100644 index eec47bd762..0000000000 --- a/pandora_console/images/svg/bell.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/pandora_console/images/svg/bubble.svg b/pandora_console/images/svg/bubble.svg deleted file mode 100644 index 08bf0727fb..0000000000 --- a/pandora_console/images/svg/bubble.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/pandora_console/images/svg/device.svg b/pandora_console/images/svg/device.svg deleted file mode 100644 index 46ea97ad8c..0000000000 --- a/pandora_console/images/svg/device.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/pandora_console/images/svg/display.svg b/pandora_console/images/svg/display.svg deleted file mode 100644 index 38e3a84fa4..0000000000 --- a/pandora_console/images/svg/display.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/pandora_console/images/svg/down.svg b/pandora_console/images/svg/down.svg deleted file mode 100644 index b515cd5102..0000000000 --- a/pandora_console/images/svg/down.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/pandora_console/images/svg/dropdown-down.svg b/pandora_console/images/svg/dropdown-down.svg deleted file mode 100644 index 20da85c0d7..0000000000 --- a/pandora_console/images/svg/dropdown-down.svg +++ /dev/null @@ -1,9 +0,0 @@ - - - - Dark / 20 / dropdown-down - Created with Sketch. - - - - \ No newline at end of file diff --git a/pandora_console/images/svg/dropdown-up.svg b/pandora_console/images/svg/dropdown-up.svg deleted file mode 100644 index c8e9add524..0000000000 --- a/pandora_console/images/svg/dropdown-up.svg +++ /dev/null @@ -1,9 +0,0 @@ - - - - Dark / 20 / dropdown-up - Created with Sketch. - - - - \ No newline at end of file diff --git a/pandora_console/images/svg/duplicate.svg b/pandora_console/images/svg/duplicate.svg deleted file mode 100644 index 54b78c2aad..0000000000 --- a/pandora_console/images/svg/duplicate.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/pandora_console/images/svg/envelope.svg b/pandora_console/images/svg/envelope.svg deleted file mode 100644 index b50e20e331..0000000000 --- a/pandora_console/images/svg/envelope.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/pandora_console/images/svg/exit.svg b/pandora_console/images/svg/exit.svg deleted file mode 100644 index 16e0eae613..0000000000 --- a/pandora_console/images/svg/exit.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/pandora_console/images/svg/eye.svg b/pandora_console/images/svg/eye.svg deleted file mode 100644 index 5f9c897222..0000000000 --- a/pandora_console/images/svg/eye.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/pandora_console/images/svg/fail.svg b/pandora_console/images/svg/fail.svg deleted file mode 100644 index f6a60f9276..0000000000 --- a/pandora_console/images/svg/fail.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/pandora_console/images/svg/file.svg b/pandora_console/images/svg/file.svg deleted file mode 100644 index 6ef321521c..0000000000 --- a/pandora_console/images/svg/file.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/pandora_console/images/svg/house.svg b/pandora_console/images/svg/house.svg deleted file mode 100644 index 1361d98cdc..0000000000 --- a/pandora_console/images/svg/house.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/pandora_console/images/svg/iconos-27.svg b/pandora_console/images/svg/iconos-27.svg deleted file mode 100644 index 9eb41e512d..0000000000 --- a/pandora_console/images/svg/iconos-27.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/pandora_console/images/svg/info.svg b/pandora_console/images/svg/info.svg deleted file mode 100644 index a7b23d52d4..0000000000 --- a/pandora_console/images/svg/info.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/pandora_console/images/svg/left.svg b/pandora_console/images/svg/left.svg deleted file mode 100644 index d74cf540b3..0000000000 --- a/pandora_console/images/svg/left.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/pandora_console/images/svg/menu_horizontal.svg b/pandora_console/images/svg/menu_horizontal.svg deleted file mode 100644 index bcd2f124cb..0000000000 --- a/pandora_console/images/svg/menu_horizontal.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/pandora_console/images/svg/menu_vertical.svg b/pandora_console/images/svg/menu_vertical.svg deleted file mode 100644 index 1b5e468eb1..0000000000 --- a/pandora_console/images/svg/menu_vertical.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/pandora_console/images/svg/ok.svg b/pandora_console/images/svg/ok.svg deleted file mode 100644 index af6c3850cd..0000000000 --- a/pandora_console/images/svg/ok.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/pandora_console/images/svg/picture.svg b/pandora_console/images/svg/picture.svg deleted file mode 100644 index 978557a383..0000000000 --- a/pandora_console/images/svg/picture.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/pandora_console/images/svg/plus.svg b/pandora_console/images/svg/plus.svg deleted file mode 100644 index 18736fde28..0000000000 --- a/pandora_console/images/svg/plus.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/pandora_console/images/svg/protected.svg b/pandora_console/images/svg/protected.svg deleted file mode 100644 index 39f9c69aa1..0000000000 --- a/pandora_console/images/svg/protected.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/pandora_console/images/svg/radial-disabled.svg b/pandora_console/images/svg/radial-disabled.svg deleted file mode 100644 index 1b38fe43c0..0000000000 --- a/pandora_console/images/svg/radial-disabled.svg +++ /dev/null @@ -1,11 +0,0 @@ - - - - Dark / 20 / radial-disable@svg - Created with Sketch. - - - - - - \ No newline at end of file diff --git a/pandora_console/images/svg/radial-off.svg b/pandora_console/images/svg/radial-off.svg deleted file mode 100644 index 68d23663ca..0000000000 --- a/pandora_console/images/svg/radial-off.svg +++ /dev/null @@ -1,11 +0,0 @@ - - - - Dark / 20 / radial-off@svg - Created with Sketch. - - - - - - \ No newline at end of file diff --git a/pandora_console/images/svg/radial-on.svg b/pandora_console/images/svg/radial-on.svg deleted file mode 100644 index 7e17258abb..0000000000 --- a/pandora_console/images/svg/radial-on.svg +++ /dev/null @@ -1,13 +0,0 @@ - - - - Dark / 20 / radial-on@svg - Created with Sketch. - - - - - - - - \ No newline at end of file diff --git a/pandora_console/images/svg/right.svg b/pandora_console/images/svg/right.svg deleted file mode 100644 index e74f4abeb8..0000000000 --- a/pandora_console/images/svg/right.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/pandora_console/images/svg/search.svg b/pandora_console/images/svg/search.svg deleted file mode 100644 index 14f8f5fd8e..0000000000 --- a/pandora_console/images/svg/search.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/pandora_console/images/svg/settings.svg b/pandora_console/images/svg/settings.svg deleted file mode 100644 index 16858510e1..0000000000 --- a/pandora_console/images/svg/settings.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/pandora_console/images/svg/sound.svg b/pandora_console/images/svg/sound.svg deleted file mode 100644 index 1ff57a311f..0000000000 --- a/pandora_console/images/svg/sound.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/pandora_console/images/svg/star.svg b/pandora_console/images/svg/star.svg deleted file mode 100644 index 1ba2f60041..0000000000 --- a/pandora_console/images/svg/star.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/pandora_console/images/svg/success.svg b/pandora_console/images/svg/success.svg deleted file mode 100644 index 26e83ff1f7..0000000000 --- a/pandora_console/images/svg/success.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/pandora_console/images/svg/trash.svg b/pandora_console/images/svg/trash.svg deleted file mode 100644 index 0dc58d9e0f..0000000000 --- a/pandora_console/images/svg/trash.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/pandora_console/images/svg/up.svg b/pandora_console/images/svg/up.svg deleted file mode 100644 index 88fe9cb5be..0000000000 --- a/pandora_console/images/svg/up.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/pandora_console/images/svg/user_a.svg b/pandora_console/images/svg/user_a.svg deleted file mode 100644 index 797b4e04a0..0000000000 --- a/pandora_console/images/svg/user_a.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/pandora_console/images/switch@svg.svg b/pandora_console/images/switch@os.svg similarity index 100% rename from pandora_console/images/switch@svg.svg rename to pandora_console/images/switch@os.svg diff --git a/pandora_console/images/system_error@header.svg b/pandora_console/images/system_error@header.svg new file mode 100644 index 0000000000..d1318690cf --- /dev/null +++ b/pandora_console/images/system_error@header.svg @@ -0,0 +1,9 @@ + + + + Dark / 20 / Systems error@svg + Created with Sketch. + + + + \ No newline at end of file diff --git a/pandora_console/images/system_ok@header.svg b/pandora_console/images/system_ok@header.svg new file mode 100644 index 0000000000..cead9354b0 --- /dev/null +++ b/pandora_console/images/system_ok@header.svg @@ -0,0 +1,9 @@ + + + + Dark / 20 / Systems ok@svg + Created with Sketch. + + + + \ No newline at end of file diff --git a/pandora_console/images/system_warning@header.svg b/pandora_console/images/system_warning@header.svg new file mode 100644 index 0000000000..681915d0c6 --- /dev/null +++ b/pandora_console/images/system_warning@header.svg @@ -0,0 +1,9 @@ + + + + Dark / 20 / Systems warning@svg + Created with Sketch. + + + + \ No newline at end of file diff --git a/pandora_console/images/vmware@svg.svg b/pandora_console/images/vmware@os.svg similarity index 100% rename from pandora_console/images/vmware@svg.svg rename to pandora_console/images/vmware@os.svg diff --git a/pandora_console/images/windows@svg.svg b/pandora_console/images/windows@os.svg similarity index 100% rename from pandora_console/images/windows@svg.svg rename to pandora_console/images/windows@os.svg diff --git a/pandora_console/include/class/ExternalTools.class.php b/pandora_console/include/class/ExternalTools.class.php index 002642c5a9..67345a61f8 100644 --- a/pandora_console/include/class/ExternalTools.class.php +++ b/pandora_console/include/class/ExternalTools.class.php @@ -528,14 +528,16 @@ class ExternalTools extends HTML // Form table. $table = new StdClass(); - $table->class = 'databox filters w100p'; + $table->class = 'fixed_filter_bar'; $table->id = 'externalToolTable'; - + $table->cellstyle['captions'][0] = 'width: 0'; + $table->cellstyle['captions'][1] = 'width: 0'; + $table->cellstyle['captions'][2] = 'width: 0'; $table->data = []; - $table->data[0][0] = __('Operation'); + $table->data['captions'][0] = __('Operation'); - $table->data[0][1] = html_print_select( + $table->data['inputs'][0] = html_print_select( $commandList, 'operation', $this->operation, @@ -545,8 +547,8 @@ class ExternalTools extends HTML true ); - $table->data[0][2] = __('IP Adress'); - $table->data[0][3] = html_print_select( + $table->data['captions'][1] = __('IP Adress'); + $table->data['inputs'][1] = html_print_select( $ipsSelect, 'select_ips', $principal_ip, @@ -556,10 +558,10 @@ class ExternalTools extends HTML true ); - $table->cellclass[0][4] = 'snmpcolumn'; - $table->data[0][4] = __('SNMP Version'); - $table->data[0][4] .= ' '; - $table->data[0][4] .= html_print_select( + $table->cellclass['captions'][2] = 'snmpcolumn'; + $table->cellclass['inputs'][2] = 'snmpcolumn'; + $table->data['captions'][2] = __('SNMP Version'); + $table->data['inputs'][2] = html_print_select( [ '1' => 'v1', '2c' => 'v2c', @@ -572,10 +574,10 @@ class ExternalTools extends HTML true ); - $table->cellclass[0][5] = 'snmpcolumn'; - $table->data[0][5] = __('SNMP Community'); - $table->data[0][5] .= ' '; - $table->data[0][5] .= html_print_input_text( + $table->cellclass['captions'][3] = 'snmpcolumn'; + $table->cellclass['inputs'][3] = 'snmpcolumn'; + $table->data['captions'][3] = __('SNMP Community'); + $table->data['inputs'][3] = html_print_input_text( 'community', $this->community, '', @@ -584,7 +586,7 @@ class ExternalTools extends HTML true ); - $table->data[0][6] = html_print_div( + $table->data['inputs'][4] = html_print_div( [ 'class' => 'action-buttons', 'content' => html_print_submit_button( @@ -719,7 +721,7 @@ class ExternalTools extends HTML try { // If caption is not added, don't show anything. if (empty($caption) === false) { - $output .= sprintf('

%s

', $caption); + $output .= sprintf('

%s

', $caption); } $output .= '
';
@@ -787,7 +789,7 @@ class ExternalTools extends HTML
                     'format'         => '-Oqn',
                 ];
 
-                echo '

'.__('SNMP information for ').$ip.'

'; + echo '

'.__('SNMP information for ').$ip.'

'; $snmp_obj['base_oid'] = '.1.3.6.1.2.1.1.3.0'; $result = get_h_snmpwalk($snmp_obj); @@ -849,7 +851,7 @@ class ExternalTools extends HTML html_print_table($table); } else if ((int) $operation === COMMAND_DIGWHOIS) { - echo '

'.__('Domain and IP information for ').$ip.'

'; + echo '

'.__('Domain and IP information for ').$ip.'

'; // Dig execution. $dig = $this->whereIsTheCommand('dig'); diff --git a/pandora_console/include/functions_html.php b/pandora_console/include/functions_html.php index d51e83c940..ff02de3639 100644 --- a/pandora_console/include/functions_html.php +++ b/pandora_console/include/functions_html.php @@ -2478,6 +2478,7 @@ function html_print_input_text_extended( $autocomplete='off', $disabled=false ) { + global $config; static $idcounter = 0; if ($maxlength === 0) { @@ -2542,12 +2543,19 @@ function html_print_input_text_extended( $output .= 'disabled="disabled" '; } + $hasClass = false; if (is_array($attributes)) { foreach ($attributes as $attribute => $attr_value) { - if (! in_array($attribute, $valid_attrs)) { + if (in_array($attribute, $valid_attrs) === false) { continue; } + // Only for password inputs. + if (($attribute === 'class') && ($password === true)) { + $attr_value .= ' show-hide-pass-background'; + $hasClass = true; + } + $output .= $attribute.'="'.$attr_value.'" '; } } else { @@ -2555,6 +2563,10 @@ function html_print_input_text_extended( $attributes = []; } + if (($hasClass === false) && ($password === true)) { + $output .= 'class="show-hide-pass-background" '; + } + if (!empty($alt)) { $output .= 'alt="'.$alt.'" '; } @@ -2603,6 +2615,17 @@ function html_print_input_text_extended( $output .= $function.'/>'; + if ($password === true) { + $output .= html_print_div( + [ + 'id' => 'show-hide-'.$id, + 'class' => 'show-hide-pass', + 'onClick' => 'show_hide_password(event, \''.$config['homeurl'].'\')', + ], + true + ); + } + if (!$return) { echo $output; } @@ -2637,10 +2660,11 @@ function html_print_div( 'style', 'class', 'title', + 'onClick', ]; - if (isset($options['hidden'])) { - if (isset($options['style'])) { + if (isset($options['hidden']) === true) { + if (isset($options['style']) === true) { $options['style'] .= 'display:none;'; } else { $options['style'] = 'display:none;'; @@ -2648,7 +2672,7 @@ function html_print_div( } foreach ($attrs as $attribute) { - if (isset($options[$attribute])) { + if (isset($options[$attribute]) === true) { $output .= ' '.$attribute.'="'.io_safe_input_html($options[$attribute]).'"'; } } @@ -2659,7 +2683,7 @@ function html_print_div( $output .= '
'; - if ($return) { + if ($return === true) { return $output; } else { echo $output; diff --git a/pandora_console/include/functions_menu.php b/pandora_console/include/functions_menu.php index b9774ae800..d0baa614c8 100644 --- a/pandora_console/include/functions_menu.php +++ b/pandora_console/include/functions_menu.php @@ -79,6 +79,36 @@ function menu_print_menu(&$menu) } else if ($sec2 === 'godmode/events/events') { $section = (string) get_parameter('section'); $sec2 = 'godmode/events/events§ion='.$section; + } else if ($sec2 === 'operation/dashboard/dashboard') { + $id = (int) get_parameter('dashboardId', 0); + if (empty($id) === false) { + $sec2 = 'operation/dashboard/dashboard&dashboardId='.$id; + } + } else if ($sec2 === 'enterprise/operation/services/services') { + $tab = (string) get_parameter('tab', ''); + $action = (string) get_parameter('action', ''); + $id_service = (int) get_parameter('id_service', 0); + if (empty($tab) === false + && empty($action) === false + && empty($id_service) === false + ) { + $sec2 = sprintf( + 'enterprise/operation/services/services&tab=%s&action=%s&id_service=%d', + $tab, + $action, + $id_service + ); + } + } else if ($sec2 === 'operation/visual_console/render_view') { + $id = (int) get_parameter('id', 0); + if (empty($id) === false) { + $sec2 = 'operation/visual_console/render_view&id='.$id; + } + } else if ($sec2 === 'operation/messages/message_edit') { + $new_msg = (int) get_parameter('new_msg', 0); + if (empty($new_msg) === false) { + $sec2 = 'operation/messages/message_edit&new_msg='.$new_msg; + } } else { $sec2 = (string) get_parameter('sec2'); } diff --git a/pandora_console/include/javascript/pandora.js b/pandora_console/include/javascript/pandora.js index 49afd629f6..03c7308faf 100644 --- a/pandora_console/include/javascript/pandora.js +++ b/pandora_console/include/javascript/pandora.js @@ -2340,3 +2340,15 @@ function autoclose_info_box(id, autoCloseTime) { close_info_box(id); }, autoCloseTime); } + +function show_hide_password(e, url) { + let inputPass = e.target.previousElementSibling; + + if (inputPass.type === "password") { + inputPass.type = "text"; + inputPass.style.backgroundImage = "url(" + url + "/images/disable.svg)"; + } else { + inputPass.type = "password"; + inputPass.style.backgroundImage = "url(" + url + "/images/enable.svg)"; + } +} diff --git a/pandora_console/include/javascript/tree/TreeControllerMeta.js b/pandora_console/include/javascript/tree/TreeControllerMeta.js new file mode 100644 index 0000000000..ab56ab73f0 --- /dev/null +++ b/pandora_console/include/javascript/tree/TreeControllerMeta.js @@ -0,0 +1,1503 @@ +// Pandora FMS - http://pandorafms.com +// ================================================== +// Copyright (c) 2005-2021 Artica Soluciones Tecnologicas +// Please see http://pandorafms.org for full contribution list + +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public License +// as published by the Free Software Foundation; version 2 + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +/*global $, _*/ + +var TreeController = { + controllers: [], + getController: function() { + var controller = { + index: -1, + recipient: "", + tree: [], + emptyMessage: "No data found.", + foundMessage: "Groups found", + errorMessage: "Error", + baseURL: "", + ajaxURL: "ajax.php", + ajaxPage: "include/ajax/tree.ajax", + detailRecipient: "", + filter: {}, + counterTitles: {}, + shouldHaveCounters: true, + reload: function() { + // Bad recipient + if ( + typeof this.recipient == "undefined" || + this.recipient.length == 0 + ) { + return; + } + + function _recursiveGroupsCount(elements, childGroupsLength) { + if (typeof childGroupsLength === "undefined") { + childGroupsLength = 0; + } + + _.each(elements, function(element) { + if (typeof element.children !== "undefined") { + childGroupsLength = _recursiveGroupsCount( + element.children, + childGroupsLength + ); + childGroupsLength += element.children.length; + } + }); + return childGroupsLength; + } + + // Load branch + function _processGroup(container, elements, rootGroup) { + var $group = $("
    "); + var childGroupsLength = _recursiveGroupsCount(elements); + + // First group. + if (typeof rootGroup != "undefined" && rootGroup == true) { + var messageLength = controller.tree.length; + if (childGroupsLength > 0) { + messageLength = childGroupsLength + controller.tree.length; + } + + group_message = controller.foundMessage + ": " + messageLength; + if (controller.foundMessage == "") { + group_message = ""; + } + $group + .addClass("tree-root") + .hide() + .prepend( + '
    ' + + '' + + "" + + (controller.tree.length > 0 ? group_message : "") + + "
    " + ); + } else { + // Normal group. + $group.addClass("tree-group").hide(); + } + + container.append($group); + + _.each(elements, function(element) { + element.jqObject = _processNode($group, element); + }); + + return $group; + } + + // Load leaf counters + function _processNodeCounters(container, counters, type) { + var hasCounters = false; + + if (typeof counters != "undefined") { + function _processNodeCounterTitle( + container, + elementType, + counterType + ) { + var defaultCounterTitles = { + total: { + agents: "Total agents", + modules: "Total modules", + none: "Total" + }, + alerts: { + agents: "Alerts fired", + modules: "Alerts fired", + none: "Alerts fired" + }, + critical: { + agents: "Critical agents", + modules: "Critical modules", + none: "Critical" + }, + warning: { + agents: "Warning agents", + modules: "Warning modules", + none: "Warning" + }, + unknown: { + agents: "Unknown agents", + modules: "Unknown modules", + none: "Unknown" + }, + not_init: { + agents: "Not init agents", + modules: "Not init modules", + none: "Not init" + }, + ok: { + agents: "Normal agents", + modules: "Normal modules", + none: "Normal" + } + }; + + var serviceCounterTitles = { + total_services: { + totals: "Services" + }, + total_agents: { + totals: "Agents" + }, + total_modules: { + totals: "Modules" + } + }; + + var IPAMSupernetCounterTitles = { + total_networks: { + totals: "Networks" + } + }; + + var IPAMNetworkCounterTitles = { + alive_ips: { + totals: "Alive IPs" + }, + total_ips: { + totals: "Total IPs" + } + }; + + try { + var title = ""; + + switch (elementType) { + case "group": + if ( + typeof controller.counterTitles != "undefined" && + typeof controller.counterTitles[counterType] != + "undefined" && + typeof controller.counterTitles[counterType].agents != + "undefined" + ) { + title = controller.counterTitles[counterType].agents; + } else { + title = defaultCounterTitles[counterType].agents; + } + break; + case "agent": + if ( + typeof controller.counterTitles != "undefined" && + typeof controller.counterTitles[counterType] != + "undefined" && + typeof controller.counterTitles[counterType].modules != + "undefined" + ) { + title = controller.counterTitles[counterType].modules; + } else { + title = defaultCounterTitles[counterType].modules; + } + break; + case "services": + title = serviceCounterTitles[counterType].totals; + break; + case "IPAM_supernets": + title = IPAMSupernetCounterTitles[counterType].totals; + break; + case "IPAM_networks": + title = IPAMNetworkCounterTitles[counterType].totals; + break; + default: + if ( + typeof controller.counterTitles != "undefined" && + typeof controller.counterTitles[counterType] != + "undefined" && + typeof controller.counterTitles[counterType].none != + "undefined" + ) { + title = controller.counterTitles[counterType].none; + } else { + title = defaultCounterTitles[counterType].none; + } + break; + } + if (title.length > 0) { + container + .data("title", title) + .addClass("forced_title") + .data("use_title_for_force_title", 1); // Trick to make easier the 'force title' output + } + } catch (error) { + // console.log(error); + } + } + + if (type == "services") { + var $counters = $("
    "); + $counters.addClass("tree-node-counters"); + + if ( + counters.total_services + + counters.total_agents + + counters.total_modules > + 0 + ) { + // Open the parentheses + $counters.append(" ("); + + if ( + typeof counters.total_services != "undefined" && + counters.total_services >= 0 + ) { + var $servicesCounter = $("
    "); + $servicesCounter + .addClass("tree-node-counter") + .addClass("total") + .html(counters.total_services); + + _processNodeCounterTitle( + $servicesCounter, + type, + "total_services" + ); + + $counters.append($servicesCounter); + } else { + var $servicesCounter = $("
    "); + $servicesCounter + .addClass("tree-node-counter") + .addClass("total") + .html("0"); + + _processNodeCounterTitle( + $servicesCounter, + type, + "total_services" + ); + + $counters.append($servicesCounter); + } + + if ( + typeof counters.total_agents != "undefined" && + counters.total_agents > 0 + ) { + var $agentsCounter = $("
    "); + $agentsCounter + .addClass("tree-node-counter") + .html(counters.total_agents); + + _processNodeCounterTitle( + $agentsCounter, + type, + "total_agents" + ); + + $counters.append(" : ").append($agentsCounter); + } else { + var $agentsCounter = $("
    "); + $agentsCounter + .addClass("tree-node-counter") + .addClass("total") + .html("0"); + + _processNodeCounterTitle( + $agentsCounter, + type, + "total_agents" + ); + + $counters.append(" : ").append($agentsCounter); + } + + if ( + typeof counters.total_modules != "undefined" && + counters.total_modules > 0 + ) { + var $modulesCounter = $("
    "); + $modulesCounter + .addClass("tree-node-counter") + .addClass("total") + .html(counters.total_modules); + + _processNodeCounterTitle( + $modulesCounter, + type, + "total_modules" + ); + + $counters.append(" : ").append($modulesCounter); + } else { + var $modulesCounter = $("
    "); + $modulesCounter + .addClass("tree-node-counter") + .addClass("total") + .html("0"); + + _processNodeCounterTitle( + $modulesCounter, + type, + "total_modules" + ); + + $counters.append(" : ").append($modulesCounter); + } + + // Close the parentheses + $counters.append(")"); + + hasCounters = true; + } + } else if (type == "IPAM_supernets") { + var $counters = $("
    "); + $counters.addClass("tree-node-counters"); + + if (counters.total_networks > 0) { + // Open the parentheses + $counters.append(" ("); + + if ( + typeof counters.total_networks !== "undefined" && + counters.total_networks >= 0 + ) { + var $networksCounter = $("
    "); + $networksCounter + .addClass("tree-node-counter") + .addClass("total") + .html(counters.total_networks); + + _processNodeCounterTitle( + $networksCounter, + type, + "total_networks" + ); + + $counters.append($networksCounter); + } else { + var $networksCounter = $("
    "); + $networksCounter + .addClass("tree-node-counter") + .addClass("total") + .html("0"); + + _processNodeCounterTitle( + $networksCounter, + type, + "total_networks" + ); + + $counters.append($networksCounter); + } + + // Close the parentheses + $counters.append(")"); + + hasCounters = true; + } + } else if (type == "IPAM_networks") { + var $counters = $("
    "); + $counters.addClass("tree-node-counters"); + + // Open the parentheses + $counters.append(" ("); + + if ( + typeof counters.alive_ips !== "undefined" && + counters.alive_ips >= 0 + ) { + var $aliveCounter = $("
    "); + $aliveCounter + .addClass("tree-node-counter") + .addClass("total") + .html(counters.alive_ips); + + _processNodeCounterTitle($aliveCounter, type, "alive_ips"); + + $counters.append($aliveCounter); + } else { + var $aliveCounter = $("
    "); + $aliveCounter + .addClass("tree-node-counter") + .addClass("total") + .html("0"); + + _processNodeCounterTitle($aliveCounter, type, "alive_ips"); + + $counters.append($aliveCounter); + } + + if ( + typeof counters.total_ips !== "undefined" && + counters.total_ips >= 0 + ) { + var $totalCounter = $("
    "); + $totalCounter + .addClass("tree-node-counter") + .addClass("total") + .html(counters.total_ips); + + _processNodeCounterTitle($totalCounter, type, "total_ips"); + + $counters.append(" : ").append($totalCounter); + } else { + var $totalCounter = $("
    "); + $totalCounter + .addClass("tree-node-counter") + .addClass("total") + .html("0"); + + _processNodeCounterTitle($totalCounter, type, "total_ips"); + + $counters.append(" : ").append($totalCounter); + } + + // Close the parentheses + $counters.append(")"); + + hasCounters = true; + } else { + var $counters = $("
    "); + $counters.addClass("tree-node-counters"); + + if (typeof counters.total != "undefined" && counters.total >= 0) { + var $totalCounter = $("
    "); + $totalCounter + .addClass("tree-node-counter") + .addClass("total") + .html(counters.total); + + _processNodeCounterTitle($totalCounter, type, "total"); + + // Open the parentheses + $counters.append("      [ "); + + $counters.append($totalCounter); + + if ( + typeof counters.alerts != "undefined" && + counters.alerts > 0 + ) { + var $firedCounter = $("
    "); + $firedCounter + .addClass("tree-node-counter") + .addClass("alerts") + .addClass("orange") + .html(counters.alerts); + + _processNodeCounterTitle($firedCounter, type, "alerts"); + + $counters.append(" : ").append($firedCounter); + } + if ( + typeof counters.critical != "undefined" && + counters.critical > 0 + ) { + var $criticalCounter = $("
    "); + $criticalCounter + .addClass("tree-node-counter") + .addClass("critical") + .addClass("red") + .html(counters.critical); + + _processNodeCounterTitle($criticalCounter, type, "critical"); + + $counters.append(" : ").append($criticalCounter); + } + if ( + typeof counters.warning != "undefined" && + counters.warning > 0 + ) { + var $warningCounter = $("
    "); + $warningCounter + .addClass("tree-node-counter") + .addClass("warning") + .addClass("yellow") + .html(counters.warning); + + _processNodeCounterTitle($warningCounter, type, "warning"); + + $counters.append(" : ").append($warningCounter); + } + if ( + typeof counters.unknown != "undefined" && + counters.unknown > 0 + ) { + var $unknownCounter = $("
    "); + $unknownCounter + .addClass("tree-node-counter") + .addClass("unknown") + .addClass("grey") + .html(counters.unknown); + + _processNodeCounterTitle($unknownCounter, type, "unknown"); + + $counters.append(" : ").append($unknownCounter); + } + if ( + typeof counters.not_init != "undefined" && + counters.not_init > 0 + ) { + var $notInitCounter = $("
    "); + $notInitCounter + .addClass("tree-node-counter") + .addClass("not_init") + .addClass("blue") + .html(counters.not_init); + + _processNodeCounterTitle($notInitCounter, type, "not_init"); + + $counters.append(" : ").append($notInitCounter); + } + if (typeof counters.ok != "undefined" && counters.ok > 0) { + var $okCounter = $("
    "); + $okCounter + .addClass("tree-node-counter") + .addClass("ok") + .addClass("green") + .html(counters.ok); + + _processNodeCounterTitle($okCounter, type, "ok"); + + $counters.append(" : ").append($okCounter); + } + } + + // Close the parentheses + $counters.append(" ]"); + + hasCounters = true; + } + + // Add the counters html to the container + container.append($counters); + } + + return hasCounters; + } + + // Load leaf + function _processNode(container, element) { + // type, [id], [serverID], callback + function _getTreeDetailData(type, id, serverID, callback) { + var lastParam = arguments[arguments.length - 1]; + var callback; + if (typeof lastParam === "function") callback = lastParam; + + var serverID; + if (arguments.length >= 4) serverID = arguments[2]; + var id; + if (arguments.length >= 3) id = arguments[1]; + var type; + if (arguments.length >= 2) type = arguments[0]; + + if (typeof type === "undefined") + throw new TypeError("Type required"); + if (typeof callback === "undefined") + throw new TypeError("Callback required"); + + var postData = { + page: controller.ajaxPage, + getDetail: 1, + type: type, + auth_class: controller.auth_class, + id_user: controller.id_user, + auth_hash: controller.auth_hash + }; + + if (typeof id !== "undefined") postData.id = id; + if (typeof serverID !== "undefined") postData.serverID = serverID; + + $.ajax({ + url: controller.ajaxURL, + type: "POST", + dataType: "html", + data: postData, + success: function(data, textStatus, xhr) { + callback(null, data); + }, + error: function(xhr, textStatus, errorThrown) { + callback(errorThrown); + } + }); + } + + var $node = $("
  • "); + var $leafIcon = $("
    "); + var $content = $("
    "); + + // Leaf icon + $leafIcon.addClass("leaf-icon invert_filter"); + + // Content + $content.addClass("node-content"); + var disabled = false; + if (element.disabled == true) { + disabled = true; + $content.addClass("disabled"); + } + switch (element.type) { + case "group": + if ( + typeof element.icon != "undefined" && + element.icon.length > 0 + ) { + $content.append( + ' ' + ); + } else if ( + typeof element.iconHTML != "undefined" && + element.iconHTML.length > 0 + ) { + $content.append(element.iconHTML + " "); + } + $content.append(element.name); + + if (typeof element.edit != "undefined") { + var url_edit = + controller.baseURL + + "index.php?sec=gagente&sec2=godmode/groups/configure_group&tab=tree&id_group=" + + element.id; + var $updateicon = $( + '' + ); + var $updatebtn = $('').append( + $updateicon + ); + $content.append($updatebtn); + } + + if (typeof element.delete != "undefined") { + var url_delete = + controller.baseURL + + "index.php?sec=gagente&sec2=godmode/groups/group_list&tab=tree&delete_group=1&id_group=" + + element.id; + var $deleteBtn = $( + '' + ); + $deleteBtn.click(function(event) { + var ok_function = function() { + window.location.replace(url_delete); + }; + display_confirm_dialog( + element.delete.messages.messg, + element.delete.messages.confirm, + element.delete.messages.cancel, + ok_function + ); + }); + $content.append($deleteBtn); + } + + if (typeof element.alerts != "undefined") { + $content.append(element.alerts); + } + + break; + case "agent": + // Is quiet + + if ( + typeof element.quietImageHTML != "undefined" && + element.quietImageHTML.length > 0 + ) { + var $quietImage = $(element.quietImageHTML); + $quietImage.addClass("agent-quiet"); + + $content.append($quietImage); + } + // Status image + if ( + typeof element.statusImageHTML != "undefined" && + element.statusImageHTML.length > 0 + ) { + var $statusImage = $(element.statusImageHTML); + $statusImage.addClass("agent-status"); + + $content.append($statusImage); + } + + // Events by agent + if (element.showEventsBtn == 1) { + if (typeof element.eventAgent != "undefined") { + $content.append( + '' + ); + var $eventImage = $( + ' ' + ); + $eventImage.addClass("agent-alerts-fired"); + $eventImage + .click(function(e) { + e.preventDefault(); + + document + .getElementById( + "hiddenAgentsEventsForm-" + element.eventAgent + ) + .submit(); + }) + .css("cursor", "pointer"); + + $content.append($eventImage); + } + } + + $content.append(" " + element.alias); + break; + case "IPAM_supernets": + var IPAMSupernetDetailImage = $( + ' ' + ); + + if (typeof element.id !== "undefined") { + IPAMSupernetDetailImage.click(function(e) { + e.preventDefault(); + + var postData = { + page: "enterprise/include/ajax/ipam.ajax", + show_networkmap_statistics: 1, + "node_data[id_net]": element.id, + "node_data[type_net]": "supernet" + }; + + $.ajax({ + url: controller.ajaxURL, + type: "POST", + dataType: "html", + data: postData, + success: function(data, textStatus, xhr) { + controller.detailRecipient + .render("IPAMsupernets", data) + .open(); + } + }); + }).css("cursor", "pointer"); + + $content.append(IPAMSupernetDetailImage); + } + + if (element.name !== null) { + $content.append("   " + element.name); + } + + break; + case "IPAM_networks": + $content.addClass("ipam-network"); + + var IPAMNetworkDetailImage = $( + ' ' + ); + + if (typeof element.id !== "undefined") { + IPAMNetworkDetailImage.click(function(e) { + e.preventDefault(); + + //window.location.href = element.IPAMNetworkDetail; + var postData = { + page: "enterprise/include/ajax/ipam.ajax", + show_networkmap_statistics: 1, + "node_data[id_net]": element.id, + "node_data[type_net]": "network" + }; + + $.ajax({ + url: controller.ajaxURL, + type: "POST", + dataType: "html", + data: postData, + success: function(data, textStatus, xhr) { + controller.detailRecipient + .render("IPAMnetwork", data) + .open(); + } + }); + }).css("cursor", "pointer"); + + $content.append(IPAMNetworkDetailImage); + } + + if (element.name !== null) { + $content.append("   " + element.name); + } + + break; + case "services": + if ( + typeof element.statusImageHTML != "undefined" && + element.statusImageHTML.length > 0 + ) { + var $statusImage = $(element.statusImageHTML); + $statusImage.addClass("agent-status"); + + $content.append($statusImage); + } + var image_tooltip = + '' +
+                element.name +
+                ' '; + + var $serviceDetailImage = $( + ' ' + ); + + if ( + typeof element.serviceDetail != "undefined" && + element.name != null + ) { + $serviceDetailImage + .click(function(e) { + e.preventDefault(); + + window.location.href = element.serviceDetail; + }) + .css("cursor", "pointer"); + $content.append($serviceDetailImage); + $content.append(" " + image_tooltip); + + if ( + typeof element.elementDescription !== "undefined" && + element.elementDescription != "" + ) { + $content.append(" " + element.elementDescription); + } else if ( + typeof element.description !== "undefined" && + element.description != "" + ) { + $content.append(" " + element.description); + } else { + $content.append(" " + element.name); + } + } else { + $content.remove($node); + } + + break; + case "modules": + if ( + typeof element.statusImageHTML != "undefined" && + element.statusImageHTML.length > 0 + ) { + var $statusImage = $(element.statusImageHTML); + $statusImage.addClass("agent-status"); + + $content.append($statusImage); + } + + // Events by module + if (element.showEventsBtn == 1) { + if (typeof element.eventModule != "undefined") { + $content.append( + '' + ); + var $moduleImage = $( + ' ' + ); + $moduleImage + .click(function(e) { + e.preventDefault(); + + document + .getElementById( + "hiddenModulesEventsForm-" + element.eventModule + ) + .submit(); + }) + .css("cursor", "pointer"); + + $content.append($moduleImage); + } + } + + $content.append(" " + element.name); + break; + case "module": + $content.addClass("module"); + + // Status image + if ( + typeof element.statusImageHTML != "undefined" && + element.statusImageHTML.length > 0 + ) { + var $statusImage = $(element.statusImageHTML); + $statusImage.addClass("module-status"); + + $content.append($statusImage); + } + + element.name = htmlDecode(element.name); + // Name max 42 chars. + $content.append( + '' + + element.name.substring(0, 42) + + (element.name.length > 42 ? "..." : "") + + "" + ); + + // Avoiding 'undefined' text. + if (typeof element.value === "undefined") { + element.value = ""; + } + + // Value. + $content.append( + '' + element.value + "" + ); + + if ( + typeof element.showGraphs != "undefined" && + element.showGraphs != 0 + ) { + // Graph histogram pop-up + if (typeof element.histogramGraph != "undefined") { + var graphImageHistogram = $( + ' ' + ); + + graphImageHistogram + .addClass("module-graph") + .click(function(e) { + e.stopPropagation(); + try { + winopeng_var( + element.histogramGraph.url, + element.histogramGraph.handle, + 800, + 480 + ); + } catch (error) { + // console.log(error); + } + }); + + $content.append(graphImageHistogram); + } + + // Graph pop-up + if (typeof element.moduleGraph != "undefined") { + if (element.statusImageHTML.indexOf("data:image") != -1) { + var $graphImage = $( + ' ' + ); + } else { + var $graphImage = $( + ' ' + ); + } + + $graphImage.addClass("module-graph").click(function(e) { + e.stopPropagation(); + if (element.statusImageHTML.indexOf("data:image") != -1) { + try { + winopeng_var( + decodeURI(element.snapshot[0]), + element.snapshot[1], + element.snapshot[2], + element.snapshot[3] + ); + } catch (error) { + // console.log(error); + } + } else { + try { + winopeng_var( + element.moduleGraph.url, + element.moduleGraph.handle, + 800, + 480 + ); + } catch (error) { + // console.log(error); + } + } + }); + + $content.append($graphImage); + } + + // Data pop-up + if (typeof element.id != "undefined" && !isNaN(element.id)) { + if (isNaN(element.metaID)) { + var $dataImage = $( + ' ' + ); + $dataImage.addClass("module-data").click(function(e) { + e.stopPropagation(); + + try { + var serverName = + element.serverName.length > 0 + ? element.serverName + : ""; + if ($("#module_details_window").length > 0) + show_module_detail_dialog( + element.id, + "", + serverName, + 0, + 86400, + element.name.replace(/ /g, " ") + ); + } catch (error) { + // console.log(error); + } + }); + + $content.append($dataImage); + } + } + } + + // Alerts + if ( + typeof element.alertsImageHTML != "undefined" && + element.alertsImageHTML.length > 0 + ) { + var $alertsImage = $(element.alertsImageHTML); + + $alertsImage + .addClass("module-alerts") + .click(function(e) { + _getTreeDetailData( + "alert", + element.id, + element.serverID, + function(error, data) { + if (error) { + // console.error(error); + } else { + controller.detailRecipient + .render(element.name, data) + .open(); + } + } + ); + + // Avoid the execution of the module detail event + e.stopPropagation(); + }) + .css("cursor", "pointer"); + + $content.append($alertsImage); + } + + break; + case "os": + if ( + typeof element.icon != "undefined" && + element.icon.length > 0 + ) { + $content.append( + ' ' + ); + } + $content.append(element.name); + break; + case "tag": + if ( + typeof element.icon != "undefined" && + element.icon.length > 0 + ) { + $content.append( + ' ' + ); + } else { + $content.append( + ' ' + ); + } + $content.append(element.name); + break; + case "services": + // Status image + if ( + typeof element.statusImageHTML != "undefined" && + element.statusImageHTML.length > 0 + ) { + var $statusImage = $(element.statusImageHTML); + $statusImage.addClass("agent-status"); + + $content.append($statusImage); + } + $content.append(element.name); + break; + default: + $content.append(element.name); + break; + } + + // Load the status counters + var hasCounters = _processNodeCounters( + $content, + element.counters, + element.type + ); + //Don't show empty groups + if (element.type == "agent") { + if (!hasCounters) { + return; + } + } + // If detail container exists, show the data. + if ( + typeof controller.detailRecipient !== "undefined" || + disabled == false + ) { + if (element.type == "agent" || element.type == "module") { + if (typeof element.noAcl === "undefined") { + $content + .click(function(e) { + _getTreeDetailData( + element.type, + element.id, + element.serverID, + function(error, data) { + if (error) { + // console.error(error); + } else { + controller.detailRecipient + .render(element.name, data) + .open(); + } + } + ); + }) + .css("cursor", "pointer"); + } + } + } + + $node + .addClass("tree-node") + .append($leafIcon) + .append($content); + + container.append($node); + + $node.addClass("leaf-empty"); + + if ( + (typeof element.children != "undefined" && + element.children.length > 0) || + element.disabled == false + ) { + // Add children + var $children = _processGroup($node, element.children); + $node.data("children", $children); + + if ( + typeof element.searchChildren == "undefined" || + !element.searchChildren + ) { + $leafIcon.click(function(e) { + e.preventDefault(); + + if ($node.hasClass("leaf-open")) { + $node + .removeClass("leaf-open") + .addClass("leaf-closed") + .data("children") + .slideUp(); + } else { + $node + .removeClass("leaf-closed") + .addClass("leaf-open") + .data("children") + .slideDown(); + } + }); + } + } + + if ( + typeof element.searchChildren != "undefined" && + element.searchChildren + ) { + if ( + element.rootType == "group_edition" && + typeof element.children == "undefined" + ) { + $node.addClass("leaf-empty"); + } else { + $node.removeClass("leaf-empty").addClass("leaf-closed"); + $leafIcon.click(function(e) { + e.preventDefault(); + + if ( + !$node.hasClass("leaf-loading") && + !$node.hasClass("children-loaded") && + !$node.hasClass("leaf-empty") + ) { + $node + .removeClass("leaf-closed") + .removeClass("leaf-error") + .addClass("leaf-loading"); + + $.ajax({ + url: controller.ajaxURL, + type: "POST", + dataType: "json", + data: { + page: controller.ajaxPage, + getChildren: 1, + id: element.id, + type: element.type, + rootID: element.rootID, + serverID: element.serverID, + rootType: element.rootType, + metaID: element.metaID, + title: element.title, + filter: controller.filter, + auth_class: controller.auth_class, + id_user: controller.id_user, + auth_hash: controller.auth_hash + }, + complete: function(xhr, textStatus) { + $node.removeClass("leaf-loading"); + $node.addClass("children-loaded"); + }, + success: function(data, textStatus, xhr) { + if (data.success) { + var $group = $node.children("ul.tree-group"); + if ( + (typeof data.tree != "undefined" && + data.tree.length > 0) || + $group.length > 0 + ) { + $node.addClass("leaf-open"); + + if ($group.length <= 0) { + $group = $("
      "); + $group.addClass("tree-group").hide(); + $node.append($group); + } + + // Get the main values of the tree. + var rawTree = Object.values(data.tree); + // Sorting tree by description (services.treeview_services.php). + rawTree.sort(function(a, b) { + // Only the services are ordered since only they have the elementDescription property. + if (a.elementDescription && b.elementDescription) { + var x = a.elementDescription.toLowerCase(); + var y = b.elementDescription.toLowerCase(); + if (x < y) { + return -1; + } + if (x > y) { + return 1; + } + } + return 0; + }); + + _.each(rawTree, function(element) { + element.jqObject = _processNode($group, element); + }); + + $group.slideDown(); + + $node.data("children", $group); + + // Add again the hover event to the 'force_callback' elements + forced_title_callback(); + } else { + $node.addClass("leaf-empty"); + } + } else { + $node.addClass("leaf-error"); + } + }, + error: function(xhr, textStatus, errorThrown) { + $node.addClass("leaf-error"); + } + }); + } else if (!$node.hasClass("leaf-empty")) { + if ($node.hasClass("leaf-open")) { + $node + .removeClass("leaf-open") + .addClass("leaf-closed") + .data("children") + .slideUp(); + } else { + $node + .removeClass("leaf-closed") + .addClass("leaf-open") + .data("children") + .slideDown(); + } + } + }); + } + } + + return $node; + } + + if (controller.recipient.length == 0) { + return; + } else if (controller.tree.length == 0) { + controller.recipient.empty(); + controller.recipient.html( + "
      " + controller.emptyMessage + "
      " + ); + return; + } + + controller.recipient.empty(); + var $children = _processGroup(this.recipient, this.tree, true); + $children.show(); + + controller.recipient.data("children", $children); + + // Add again the hover event to the 'force_callback' elements + forced_title_callback(); + }, + load: function() { + this.reload(); + }, + changeTree: function(tree) { + this.tree = tree; + this.reload(); + }, + init: function(data) { + if ( + typeof data.recipient !== "undefined" && + data.recipient.length > 0 + ) { + this.recipient = data.recipient; + } + if (typeof data.detailRecipient !== "undefined") { + this.detailRecipient = data.detailRecipient; + } + if (typeof data.tree !== "undefined") { + this.tree = data.tree; + } + if ( + typeof data.emptyMessage !== "undefined" && + data.emptyMessage.length > 0 + ) { + this.emptyMessage = data.emptyMessage; + } + if ( + typeof data.foundMessage !== "undefined" && + data.foundMessage.length > 0 + ) { + this.foundMessage = data.foundMessage; + } + if ( + typeof data.errorMessage !== "undefined" && + data.errorMessage.length > 0 + ) { + this.errorMessage = data.errorMessage; + } + if (typeof data.baseURL !== "undefined" && data.baseURL.length > 0) { + this.baseURL = data.baseURL; + } + if (typeof data.ajaxURL !== "undefined" && data.ajaxURL.length > 0) { + this.ajaxURL = data.ajaxURL; + } + if (typeof data.ajaxPage !== "undefined" && data.ajaxPage.length > 0) { + this.ajaxPage = data.ajaxPage; + } + if (typeof data.filter !== "undefined") { + this.filter = data.filter; + } + + if (typeof data.auth_class !== "undefined") { + this.auth_class = data.auth_class; + } + if (typeof data.id_user !== "undefined") { + this.id_user = data.id_user; + } + if (typeof data.auth_hash !== "undefined") { + this.auth_hash = data.auth_hash; + } + if ( + typeof data.tree !== "undefined" && + Array.isArray(data.tree) && + data.tree.length > 0 && + data.tree[0]["rootType"] == "services" + ) { + this.foundMessage = ""; + } + this.load(); + }, + remove: function() { + if (typeof this.recipient != "undefined" && this.recipient.length > 0) { + this.recipient.empty(); + } + + if (this.index > -1) { + TreeController.controllers.splice(this.index, 1); + } + } + }; + controller.index = TreeController.controllers.push(controller) - 1; + + return controller; + } +}; diff --git a/pandora_console/include/lib/Dashboard/Widgets/tree_view.php b/pandora_console/include/lib/Dashboard/Widgets/tree_view.php index bdb30b16ce..373e70c1f6 100644 --- a/pandora_console/include/lib/Dashboard/Widgets/tree_view.php +++ b/pandora_console/include/lib/Dashboard/Widgets/tree_view.php @@ -134,7 +134,12 @@ class TreeViewWidget extends Widget ) { global $config; - ui_require_css_file('tree'); + if (is_metaconsole() === true) { + ui_require_css_file('tree_meta'); + } else { + ui_require_css_file('tree'); + } + ui_require_css_file('fixed-bottom-box'); // WARNING: Do not edit. This chunk must be in the constructor. @@ -544,7 +549,12 @@ class TreeViewWidget extends Widget $height = $size['height']; // Css Files. - \ui_require_css_file('tree', 'include/styles/', true); + if (is_metaconsole() === true) { + \ui_require_css_file('tree_meta', 'include/styles/', true); + } else { + \ui_require_css_file('tree', 'include/styles/', true); + } + if ($config['style'] == 'pandora_black' && !is_metaconsole()) { \ui_require_css_file('pandora_black', 'include/styles/', true); } @@ -556,11 +566,19 @@ class TreeViewWidget extends Widget 'include/javascript/i18n/' ); - \ui_require_javascript_file( - 'TreeController', - 'include/javascript/tree/', - true - ); + if (is_metaconsole() === true) { + \ui_require_javascript_file( + 'TreeControllerMeta', + 'include/javascript/tree/', + true + ); + } else { + \ui_require_javascript_file( + 'TreeController', + 'include/javascript/tree/', + true + ); + } \ui_require_javascript_file( 'fixed-bottom-box', diff --git a/pandora_console/include/styles/agent_manager.css b/pandora_console/include/styles/agent_manager.css index b7fc3846f8..02cc4ba09c 100644 --- a/pandora_console/include/styles/agent_manager.css +++ b/pandora_console/include/styles/agent_manager.css @@ -168,6 +168,7 @@ a#qr_code_agent_view { .agent_description { height: 126px; } +/* .agent_custom_id { padding-bottom: 0.7em; padding-top: 0.5em; @@ -176,6 +177,7 @@ a#qr_code_agent_view { border: 1px solid #ccc; } +*/ #safe_mode_module { margin-top: 0.6em; } diff --git a/pandora_console/include/styles/login.css b/pandora_console/include/styles/login.css index c07361fbd0..7c97edefd9 100644 --- a/pandora_console/include/styles/login.css +++ b/pandora_console/include/styles/login.css @@ -216,7 +216,6 @@ div.login_button button span { } div.login_pass input { - background-image: url("../../images/eye-open-input.png"); padding-right: 40px; } diff --git a/pandora_console/include/styles/pandora.css b/pandora_console/include/styles/pandora.css index e81f4d4c6d..88eb27d931 100644 --- a/pandora_console/include/styles/pandora.css +++ b/pandora_console/include/styles/pandora.css @@ -153,7 +153,7 @@ html { } body { - background-color: #fbfbfb; + background-color: #f6f7fb; margin: 0 auto; display: flex; flex-direction: column; @@ -1080,14 +1080,14 @@ div#page { } body.pure { - background-color: #fbfbfb; + background-color: #f6f7fb; } div#container { margin: 0 auto; min-width: 960px; text-align: left; - background: #fbfbfb; + background: #f6f7fb; width: 100%; } @@ -1096,7 +1096,7 @@ div#main { /* width: 100%; */ /* margin-left: 3em; */ background-color: #f6f7fb; - margin-bottom: 3em; + padding-bottom: 3em; position: relative; /* margin-top: 8.8em; */ flex-direction: column; @@ -2545,14 +2545,14 @@ div#pandora_logo_header { } .header_title { + font-size: 12px; + color: #161628; font-weight: 600; - font-size: 10.5pt; - color: #303030; } .header_subtitle { - font-size: 10pt; - color: #606060; + font-size: 15px; + color: #8a96a6; font-weight: 300; } @@ -2612,6 +2612,7 @@ div#header_autorefresh_counter { } .autorefresh_disabled { + opacity: 0.5; cursor: not-allowed; } @@ -4757,17 +4758,16 @@ div#dialog_messages table th:last-child { font-weight: bold; } -.notification-ball.notification-ball-new-messages:hover { - box-shadow: 0 0 3px #888; -} - .notification-ball-no-messages { - background-color: #82b92e; - cursor: pointer; + background-image: url(../../images/discovery_ok@header.svg); + background-repeat: no-repeat; + background-position: center; } .notification-ball-new-messages { - background-color: #e63c52; + background-image: url(../../images/discovery_error@header.svg); + background-repeat: no-repeat; + background-position: center; } #notification-wrapper { @@ -9886,7 +9886,7 @@ div#err_msg_centralised { .inputFile { background-color: #f6f7fb; - height: 28px; + height: 16px; font: normal normal normal 13px Pandora-Light; padding: 5.5pt 20pt; cursor: pointer; @@ -9908,9 +9908,9 @@ input, textarea, select { background-color: #f6f7fb; - height: 42px; - border: 1px solid #c0ccdc; - border-radius: 8px; + height: 38px; + border: 2px solid #c0ccdc; + border-radius: 6px; padding-left: 12px; font: normal normal normal 14px Pandora-Light; color: #2b3332; @@ -9937,7 +9937,7 @@ select:disabled, input:not([type="image"]):focus, textarea:focus, select:focus { - border: 1px solid #8a96a6; + border: 2px solid #8a96a6; } :focus { @@ -10361,6 +10361,19 @@ button div.fail { -webkit-mask: url(../../images/fail@svg.svg) no-repeat center / contain; } +button div.cog.rotation { + animation: rotation 4s infinite linear; +} + +@keyframes rotation { + from { + transform: rotate(0deg); + } + + to { + transform: rotate(359deg); + } +} .ui-dialog-buttonset { width: 100%; display: flex; @@ -10424,15 +10437,15 @@ button.ui-button.ui-widget.submit-cancel:active { } .moduleIdBox { - height: 40px; - border-top-right-radius: 8px; - border-bottom-right-radius: 8px; + height: 36px; + border-top-right-radius: 6px; + border-bottom-right-radius: 6px; margin-left: -56px; - border: 1px solid #c0ccdc; + border: 2px solid #c0ccdc; background-color: #f6f7fb; padding: 0 16px; z-index: 0; - line-height: 42px; + line-height: 40px; } /* Custom Checkbox Style */ @@ -10567,14 +10580,14 @@ tr.bring_next_field { vertical-align: middle; text-align: left; min-width: 150px !important; - z-index: 10002; + z-index: 60; } .select2-container .select2-selection--single, .select2-container .select2-selection--multiple { background-color: #f6f7fb !important; - border: 1px solid #c0ccdc !important; - border-radius: 8px !important; + border: 2px solid #c0ccdc !important; + border-radius: 6px !important; color: #2b3332 !important; -webkit-box-sizing: border-box !important; -moz-box-sizing: border-box !important; @@ -10584,7 +10597,7 @@ tr.bring_next_field { } .select2-container .select2-selection--single { - height: 42px !important; + height: 38px !important; padding-left: 4px !important; display: block; user-select: none; @@ -10592,7 +10605,7 @@ tr.bring_next_field { } .select2-container .select2-selection--multiple { - height: 42px !important; + height: 38px !important; padding-left: 0px !important; } @@ -10621,7 +10634,7 @@ tr.bring_next_field { border: 0 !important; height: 20px !important; margin-left: -8px !important; - margin-top: 10px !important; + margin-top: 8px !important; position: absolute !important; width: 20px !important; background: url(../../images/dropdown-down.svg) no-repeat content-box !important; @@ -10642,7 +10655,7 @@ tr.bring_next_field { text-overflow: ellipsis; white-space: nowrap; color: #444 !important; - line-height: 42px !important; + line-height: 36px !important; } .select2-container--default.select2-container--open.select2-container--below @@ -10808,7 +10821,7 @@ tr.bring_next_field { position: absolute; left: 0; top: 0; - height: 58px; + height: 62px; border: 1px solid #e5e9ed; background-color: #fff; /*z-index: 10000;*/ @@ -10818,18 +10831,23 @@ tr.bring_next_field { left: -95px !important; } +.external_tools_title { + padding: 0 10px; +} pre.external_tools_output { + padding: 0 10px; + /* border: 1px solid #e5e9ed; -moz-box-shadow: 0 3px 6px 0 rgb(0 0 0 / 13%); -webkit-box-shadow: 0 3px 6px 0 rgb(0 0 0 / 13%); box-shadow: 0 3px 6px 0 rgb(0 0 0 / 13%); border-radius: 8px; color: #cacaca; - padding: 10px; background-color: #000; background-image: radial-gradient(rgba(0, 150, 0, 0.75), #000 120%); font-size: 11pt; text-shadow: 0 0 5px #000; + */ } .dialog_table_form td:first-child { @@ -10919,6 +10937,10 @@ table.table_modal_alternate .select2-selection__arrow { top: -4px !important; } +.fixed_filter_bar .select2-selection__arrow b, +.filter_table .select2-selection__arrow b { + margin-top: 11px !important; +} .filter_table .select2-container .select2-selection--single @@ -11214,3 +11236,23 @@ form#satellite_conf_edit > fieldset.full-column { .inputs_date_details > input { margin: 5px; } + +.show-hide-pass { + position: relative; + right: 48px; + top: 14px; + border: 0; + outline: none; + margin: 0; + height: 40px; + width: 40px; + cursor: pointer; + display: inline-block; +} + +.show-hide-pass-background { + background-position: center right 15px; + background-repeat: no-repeat; + background-size: 24px; + background-image: url("../../images/enable.svg"); +} diff --git a/pandora_console/include/styles/tree_meta.css b/pandora_console/include/styles/tree_meta.css new file mode 100644 index 0000000000..08b1d635ed --- /dev/null +++ b/pandora_console/include/styles/tree_meta.css @@ -0,0 +1,195 @@ +.tree-root { + margin-top: 0px; + margin-bottom: 0px; +} + +.tree-group { + margin-left: 24px; + padding-top: 1px; +} + +.tree-node { + white-space: nowrap; + + background-image: url(../../images/tree/branch.png); + background-position: 0px 0px; + background-repeat: repeat-y; + + min-height: 26px; +} + +div.tree-node { + background: 0 0; +} + +div.tree-node span { + font-size: 1.2em; +} + +.tree-node:last-child { + background: 0 0; +} +.node-content { + height: 26px; + font-size: 1.2em; + display: flex; + flex-direction: row; + flex-wrap: wrap; + align-items: center; +} + +.node-content > img { + position: relative; + top: -2px; +} + +.node-content:hover { + background-color: #fff; + + -moz-border-radius: 3px; + -webkit-border-radius: 3px; + border-radius: 3px; +} + +.leaf-icon { + width: 18px; + height: 20px; +} + +.node-content, +.leaf-icon { + display: inline-block; +} + +.node-content > img, +.node-content > div { + display: inline; +} + +.tree-node.leaf-open > .leaf-icon { + background-image: url(../../images/tree/last_expanded.png); + cursor: pointer; +} + +.tree-node.tree-first.leaf-open > .leaf-icon { + background-image: url(../../images/tree/first_expanded.png); + cursor: pointer; +} + +.tree-node.leaf-closed > .leaf-icon { + background-image: url(../../images/tree/last_closed.png); + cursor: pointer; +} + +.tree-node.tree-first.leaf-closed > .leaf-icon { + background-image: url(../../images/tree/first_closed.png); + cursor: pointer; +} + +.tree-node.leaf-loading > .leaf-icon { + background-image: url(../../images/tree/last_expanded.png); +} + +.tree-node.leaf-empty > .leaf-icon { + background-image: url(../../images/tree/last_leaf.png); +} + +.tree-node.tree-first.leaf-empty > .leaf-icon { + background-image: url(../../images/tree/first_leaf.png); +} + +.tree-node.leaf-error > .leaf-icon { + background-image: url(../../images/tree/last_leaf.png); +} + +.tree-node > .leaf-icon { + background-position: 0px 0px; + background-repeat: no-repeat; +} + +.tree-node > .node-content > img { + max-height: 20px; + /*max-width: 20px;*/ +} + +.tree-node > .node-content > img.module-data, +.tree-node > .node-content > img.module-graph { + cursor: pointer; + padding-right: 3px; +} + +.tree-node > .node-content > .agent-status.status_balls, +.tree-node > .node-content > .status_small_balls { + width: 0.6em; + height: 1.5em; + margin-bottom: -0.4em; + border-radius: 0; +} +.tree-node > .node-content > .module-status.status_small_balls { + width: 0.4em; +} + +.tree-node > .node-content > .module-name { + margin: 0 0 0 1em; + width: 250px; + display: inline-block; +} + +.tree-node > .node-content > .module-value { + width: 120px; + display: inline-block; + text-align: right; + margin: 0 1em; +} + +.tree-node > .node-content > img.module-server-type, +.tree-node > .node-content > img.agent-status, +.tree-node > .node-content > img.agent-alerts-fired, +.tree-node > .node-content > img.agent-quiet, +.tree-node > .node-content > img.module-status, +.tree-node > .node-content > img.module-alerts { + padding-right: 3px; +} + +.tree-node > .node-content > .tree-node-counters, +.tree-node > .node-content > .tree-node-counters > .tree-node-counter { + display: inline; +} + +.tree-node > .node-content > .tree-node-counters { + font-size: 1.2em; +} + +.tree-node > .node-content > img { + vertical-align: middle; +} + +.tree-node > .node-content > .tree-node-counters > .tree-node-counter { + font-weight: bold; + font-size: 0.9em; + cursor: default; +} + +div#tree-controller-recipient { + text-align: left; + width: 98%; + margin-top: 10px; +} + +.tree-controller-recipient { + text-align: left; + width: 98%; + margin-top: 10px; +} + +.tree-node > .node-content > div + div:not(.tree-node-counters) { + margin-left: 3px; +} + +.tree-node .disabled { + filter: opacity(0.3); +} + +.ipam-network { + font-size: 9pt; +} diff --git a/pandora_console/index.php b/pandora_console/index.php index 39956244a9..4e69b273bc 100755 --- a/pandora_console/index.php +++ b/pandora_console/index.php @@ -1456,10 +1456,10 @@ if (__PAN_XHPROF__ === 1) { } if ($config['pure'] == 0) { - echo '
      '; + // echo '
      '; echo '
      '; // Main. - echo '
       
      '; + // echo '
       
      '; echo '
      '; // Page (id = page). } else { @@ -1488,7 +1488,7 @@ if ($config['pure'] == 0) { echo '
      '; // Container div. echo '
      '; - echo '
      '; + // echo '
      '; echo '
      '; } @@ -1670,4 +1670,11 @@ require 'include/php_to_js_values.php'; } ); }); + + // Cog animations. + $(document).ready(function() { + $(".submitButton").click(function(){ + $("#"+this.id+" > .subIcon.cog").addClass("rotation"); + }); + }); diff --git a/pandora_console/operation/agentes/estado_agente.php b/pandora_console/operation/agentes/estado_agente.php index 0639b0ffea..8c18231536 100644 --- a/pandora_console/operation/agentes/estado_agente.php +++ b/pandora_console/operation/agentes/estado_agente.php @@ -272,7 +272,7 @@ $searchForm .= ''; ui_toggle( $searchForm, - __('Filter'), + ''.__('Filters').'', 'filter_form' ); diff --git a/pandora_console/operation/agentes/external_tools.php b/pandora_console/operation/agentes/external_tools.php index 1d57c06f81..eb2fbd835b 100644 --- a/pandora_console/operation/agentes/external_tools.php +++ b/pandora_console/operation/agentes/external_tools.php @@ -14,7 +14,7 @@ * |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______| * * ============================================================================ - * Copyright (c) 2005-2021 Artica Soluciones Tecnologicas + * Copyright (c) 2005-2023 Artica Soluciones Tecnologicas * Please see http://pandorafms.org for full contribution list * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License diff --git a/pandora_console/operation/agentes/status_monitor.php b/pandora_console/operation/agentes/status_monitor.php index 839bd50846..e2db157682 100644 --- a/pandora_console/operation/agentes/status_monitor.php +++ b/pandora_console/operation/agentes/status_monitor.php @@ -946,8 +946,9 @@ $tableFilter->data[4][0] = html_print_button( false, '', [ - 'icon' => 'wand', - 'mode' => 'mini secondary', + 'icon' => 'wand', + 'mode' => 'mini secondary', + 'class' => 'float-left margin-right-2 sub config', ], true ); @@ -959,8 +960,9 @@ $tableFilter->data[4][1] = html_print_button( false, '', [ - 'icon' => 'wand', - 'mode' => 'mini secondary', + 'icon' => 'wand', + 'mode' => 'mini secondary', + 'class' => 'float-left margin-right-2 sub wand', ], true ); @@ -1405,6 +1407,16 @@ if ($autosearch) { // Start Build List Result. if (empty($result) === false) { + if (is_metaconsole() === true) { + html_print_action_buttons( + html_print_div(['style' => 'float:left; height: 55px;', 'class' => 'mrgn_top_15px'], true), + [ + 'type' => 'form_action', + 'right_content' => $tablePagination, + ] + ); + } + $table = new StdClass(); $table->cellpadding = 0; $table->cellspacing = 0; @@ -1662,25 +1674,24 @@ if (empty($result) === false) { } if (in_array('status', $show_fields) || is_metaconsole()) { - hd($row['utimestamp'], true); - hd($row['module_type'], true); + $data[6] = '
      '; if ($row['utimestamp'] === 0 && (($row['module_type'] < 21 || $row['module_type'] > 23) && $row['module_type'] != 100) ) { - $data[6] = ui_print_status_image( + $data[6] .= ui_print_status_image( STATUS_MODULE_NO_DATA, __('NOT INIT'), true ); } else if ($row['estado'] == 0) { if (is_numeric($row['datos'])) { - $data[6] = ui_print_status_image( + $data[6] .= ui_print_status_image( STATUS_MODULE_OK, __('NORMAL').': '.remove_right_zeros(number_format($row['datos'], $config['graph_precision'], $config['decimal_separator'], $config['thousand_separator'])), true ); } else { - $data[6] = ui_print_status_image( + $data[6] .= ui_print_status_image( STATUS_MODULE_OK, __('NORMAL').': '.htmlspecialchars($row['datos']), true @@ -1688,7 +1699,7 @@ if (empty($result) === false) { } } else if ($row['estado'] == 1) { if (is_numeric($row['datos'])) { - $data[6] = ui_print_status_image( + $data[6] .= ui_print_status_image( STATUS_MODULE_CRITICAL, __('CRITICAL').': '.remove_right_zeros( number_format( @@ -1701,7 +1712,7 @@ if (empty($result) === false) { true ); } else { - $data[6] = ui_print_status_image( + $data[6] .= ui_print_status_image( STATUS_MODULE_CRITICAL, __('CRITICAL').': '.htmlspecialchars($row['datos']), true @@ -1709,7 +1720,7 @@ if (empty($result) === false) { } } else if ($row['estado'] == 2) { if (is_numeric($row['datos'])) { - $data[6] = ui_print_status_image( + $data[6] .= ui_print_status_image( STATUS_MODULE_WARNING, __('WARNING').': '.remove_right_zeros( number_format( @@ -1722,7 +1733,7 @@ if (empty($result) === false) { true ); } else { - $data[6] = ui_print_status_image( + $data[6] .= ui_print_status_image( STATUS_MODULE_WARNING, __('WARNING').': '.htmlspecialchars($row['datos']), true @@ -1730,7 +1741,7 @@ if (empty($result) === false) { } } else if ($row['estado'] == 3) { if (is_numeric($row['datos'])) { - $data[6] = ui_print_status_image( + $data[6] .= ui_print_status_image( STATUS_MODULE_UNKNOWN, __('UNKNOWN').': '.remove_right_zeros( number_format( @@ -1743,7 +1754,7 @@ if (empty($result) === false) { true ); } else { - $data[6] = ui_print_status_image( + $data[6] .= ui_print_status_image( STATUS_MODULE_UNKNOWN, __('UNKNOWN').': '.htmlspecialchars($row['datos']), true @@ -1751,7 +1762,7 @@ if (empty($result) === false) { } } else if ($row['estado'] == 4) { if (is_numeric($row['datos'])) { - $data[6] = ui_print_status_image( + $data[6] .= ui_print_status_image( STATUS_MODULE_NO_DATA, __('NO DATA').': '.remove_right_zeros( number_format( @@ -1764,7 +1775,7 @@ if (empty($result) === false) { true ); } else { - $data[6] = ui_print_status_image( + $data[6] .= ui_print_status_image( STATUS_MODULE_NO_DATA, __('NO DATA').': '.htmlspecialchars($row['datos']), true @@ -1774,17 +1785,17 @@ if (empty($result) === false) { $last_status = modules_get_agentmodule_last_status( $row['id_agente_modulo'] ); - hd('pues por aqui tambien', true); + switch ($last_status) { case 0: if (is_numeric($row['datos'])) { - $data[6] = ui_print_status_image( + $data[6] .= ui_print_status_image( STATUS_MODULE_UNKNOWN, __('UNKNOWN').' - '.__('Last status').' '.__('NORMAL').': '.remove_right_zeros(number_format($row['datos'], $config['graph_precision'], $config['decimal_separator'], $config['thousand_separator'])), true ); } else { - $data[6] = ui_print_status_image( + $data[6] .= ui_print_status_image( STATUS_MODULE_UNKNOWN, __('UNKNOWN').' - '.__('Last status').' '.__('NORMAL').': '.htmlspecialchars($row['datos']), true @@ -1794,13 +1805,13 @@ if (empty($result) === false) { case 1: if (is_numeric($row['datos'])) { - $data[6] = ui_print_status_image( + $data[6] .= ui_print_status_image( STATUS_MODULE_UNKNOWN, __('UNKNOWN').' - '.__('Last status').' '.__('CRITICAL').': '.remove_right_zeros(number_format($row['datos'], $config['graph_precision'], $config['decimal_separator'], $config['thousand_separator'])), true ); } else { - $data[6] = ui_print_status_image( + $data[6] .= ui_print_status_image( STATUS_MODULE_UNKNOWN, __('UNKNOWN').' - '.__('Last status').' '.__('CRITICAL').': '.htmlspecialchars($row['datos']), true @@ -1810,13 +1821,13 @@ if (empty($result) === false) { case 2: if (is_numeric($row['datos'])) { - $data[6] = ui_print_status_image( + $data[6] .= ui_print_status_image( STATUS_MODULE_UNKNOWN, __('UNKNOWN').' - '.__('Last status').' '.__('WARNING').': '.remove_right_zeros(number_format($row['datos'], $config['graph_precision'], $config['decimal_separator'], $config['thousand_separator'])), true ); } else { - $data[6] = ui_print_status_image( + $data[6] .= ui_print_status_image( STATUS_MODULE_UNKNOWN, __('UNKNOWN').' - '.__('Last status').' '.__('WARNING').': '.htmlspecialchars($row['datos']), true @@ -1825,6 +1836,8 @@ if (empty($result) === false) { break; } } + + $data[6] .= '
      '; } if (in_array('last_status_change', $show_fields) || is_metaconsole()) { @@ -2120,7 +2133,6 @@ if (empty($result) === false) { html_print_table($table); if ($count_modules > $config['block_size']) { - hd('patata'); $tablePagination = ui_pagination($count_modules, false, $offset, 0, true, 'offset', false); } } else { @@ -2131,13 +2143,15 @@ if (empty($result) === false) { } } -html_print_action_buttons( - html_print_div(['style' => 'float:left; height: 55px;'], true), - [ - 'type' => 'form_action', - 'right_content' => $tablePagination, - ] -); +if (is_metaconsole() !== true) { + html_print_action_buttons( + html_print_div(['style' => 'float:left; height: 55px;'], true), + [ + 'type' => 'form_action', + 'right_content' => $tablePagination, + ] + ); +} // End Build List Result. echo "
      "; diff --git a/pandora_console/operation/menu.php b/pandora_console/operation/menu.php index 4531432d6e..cb9ce7321a 100644 --- a/pandora_console/operation/menu.php +++ b/pandora_console/operation/menu.php @@ -307,14 +307,21 @@ if ($access_console_node === true) { if (check_acl($config['id_user'], 0, 'VR') || check_acl($config['id_user'], 0, 'VW') || check_acl($config['id_user'], 0, 'VM')) { + $url_visual_console = ''; if (!isset($config['vc_favourite_view']) || $config['vc_favourite_view'] == 0) { // Visual console. $sub['godmode/reporting/map_builder']['text'] = __('Visual console'); $sub['godmode/reporting/map_builder']['id'] = 'Visual_console'; + $sub['godmode/reporting/map_builder']['type'] = 'direct'; + $sub['godmode/reporting/map_builder']['subtype'] = 'nolink'; + $url_visual_console = 'godmode/reporting/map_builder'; } else { // Visual console favorite. $sub['godmode/reporting/visual_console_favorite']['text'] = __('Visual console'); $sub['godmode/reporting/visual_console_favorite']['id'] = 'Visual_console'; + $sub['godmode/reporting/visual_console_favorite']['type'] = 'direct'; + $sub['godmode/reporting/visual_console_favorite']['subtype'] = 'nolink'; + $url_visual_console = 'godmode/reporting/visual_console_favorite'; } if ($config['vc_menu_items'] != 0) { @@ -341,6 +348,12 @@ if ($access_console_node === true) { $layouts = visual_map_get_user_layouts($config['id_user'], false, false, $returnAllGroups, true); $sub2 = []; + $sub2[$url_visual_console] = [ + 'text' => __('Visual console list'), + 'title' => __('Visual console list'), + 'refr' => 0, + ]; + if ($layouts === false) { $layouts = []; } else { @@ -364,15 +377,15 @@ if ($access_console_node === true) { $name = io_safe_output($layout['name']); - $sub2['operation/visual_console/render_view&id='.$layout['id']]['text'] = ui_print_truncate_text($name, MENU_SIZE_TEXT, false, true, false); - $sub2['operation/visual_console/render_view&id='.$layout['id']]['id'] = mb_substr($name, 0, 19); - $sub2['operation/visual_console/render_view&id='.$layout['id']]['title'] = $name; + $sub2['operation/visual_console/render_view&id='.$layout['id']]['text'] = ui_print_truncate_text($name, MENU_SIZE_TEXT, false, true, false); + $sub2['operation/visual_console/render_view&id='.$layout['id']]['id'] = mb_substr($name, 0, 19); + $sub2['operation/visual_console/render_view&id='.$layout['id']]['title'] = $name; if (!empty($config['vc_refr'])) { - $sub2['operation/visual_console/render_view&id='.$layout['id']]['refr'] = $config['vc_refr']; + $sub2['operation/visual_console/render_view&id='.$layout['id']]['refr'] = $config['vc_refr']; } else if (((int) get_parameter('refr', 0)) > 0) { - $sub2['operation/visual_console/render_view&id='.$layout['id']]['refr'] = (int) get_parameter('refr', 0); + $sub2['operation/visual_console/render_view&id='.$layout['id']]['refr'] = (int) get_parameter('refr', 0); } else { - $sub2['operation/visual_console/render_view&id='.$layout['id']]['refr'] = 0; + $sub2['operation/visual_console/render_view&id='.$layout['id']]['refr'] = 0; } } @@ -424,10 +437,10 @@ if ($access_console_node === true) { continue; } - $sub2['operation/gis_maps/render_view&map_id='.$gisMap['id_tgis_map']]['text'] = ui_print_truncate_text(io_safe_output($gisMap['map_name']), MENU_SIZE_TEXT, false, true, false); - $sub2['operation/gis_maps/render_view&map_id='.$gisMap['id_tgis_map']]['id'] = mb_substr(io_safe_output($gisMap['map_name']), 0, 15); - $sub2['operation/gis_maps/render_view&map_id='.$gisMap['id_tgis_map']]['title'] = io_safe_output($gisMap['map_name']); - $sub2['operation/gis_maps/render_view&map_id='.$gisMap['id_tgis_map']]['refr'] = 0; + $sub2['operation/gis_maps/render_view&map_id='.$gisMap['id_tgis_map']]['text'] = ui_print_truncate_text(io_safe_output($gisMap['map_name']), MENU_SIZE_TEXT, false, true, false); + $sub2['operation/gis_maps/render_view&map_id='.$gisMap['id_tgis_map']]['id'] = mb_substr(io_safe_output($gisMap['map_name']), 0, 15); + $sub2['operation/gis_maps/render_view&map_id='.$gisMap['id_tgis_map']]['title'] = io_safe_output($gisMap['map_name']); + $sub2['operation/gis_maps/render_view&map_id='.$gisMap['id_tgis_map']]['refr'] = 0; } $sub['gismaps']['sub2'] = $sub2; @@ -480,10 +493,16 @@ if ($access_console_node === true) { $sub['operation/dashboard/dashboard']['id'] = 'Dashboard'; $sub['operation/dashboard/dashboard']['refr'] = 0; $sub['operation/dashboard/dashboard']['subsecs'] = ['operation/dashboard/dashboard']; + $sub['operation/dashboard/dashboard']['type'] = 'direct'; + $sub['operation/dashboard/dashboard']['subtype'] = 'nolink'; $dashboards = Manager::getDashboards(-1, -1, true); $sub2 = []; + $sub2['operation/dashboard/dashboard'] = [ + 'text' => __('Dashboard list'), + 'title' => __('Dashboard list'), + ]; foreach ($dashboards as $dashboard) { $name = io_safe_output($dashboard['name']); @@ -637,7 +656,7 @@ if ($access_console_node === true) { $sub['message_list']['subtype'] = 'nolink'; $sub2 = []; $sub2['operation/messages/message_list']['text'] = __('Messages List'); - $sub2['operation/messages/message_edit&new_msg=1']['text'] = __('New message'); + $sub2['operation/messages/message_edit&new_msg=1']['text'] = __('New message'); $sub['message_list']['sub2'] = $sub2; } diff --git a/pandora_console/operation/tree.php b/pandora_console/operation/tree.php index 29d4c95b78..a662da4d99 100755 --- a/pandora_console/operation/tree.php +++ b/pandora_console/operation/tree.php @@ -27,7 +27,12 @@ */ // Begin. -ui_require_css_file('tree'); +if (is_metaconsole() === true) { + ui_require_css_file('tree_meta'); +} else { + ui_require_css_file('tree'); +} + ui_require_css_file('fixed-bottom-box'); global $config; @@ -309,7 +314,12 @@ html_print_input_hidden('tag-id', $tag_id); ui_include_time_picker(); ui_require_jquery_file('ui.datepicker-'.get_user_language(), 'include/javascript/i18n/'); -ui_require_javascript_file('TreeController', 'include/javascript/tree/'); +if (is_metaconsole() === true) { + ui_require_javascript_file('TreeControllerMeta', 'include/javascript/tree/'); +} else { + ui_require_javascript_file('TreeController', 'include/javascript/tree/'); +} + ui_print_spinner(__('Loading')); /* html_print_image( diff --git a/pandora_console/pandoradb_data.sql b/pandora_console/pandoradb_data.sql index 7d13eb5379..bde4538077 100644 --- a/pandora_console/pandoradb_data.sql +++ b/pandora_console/pandoradb_data.sql @@ -155,26 +155,26 @@ UNLOCK TABLES; LOCK TABLES `tconfig_os` WRITE; INSERT INTO `tconfig_os` (`id_os`, `name`, `description`, `icon_name`, `previous_name`) VALUES -(1,'Linux','Linux: All versions','linux@svg.svg', ''), -(2,'Solaris','Sun Solaris','solaris@svg.svg', ''), -(3,'AIX','IBM AIX','aix@svg.svg', ''), -(4,'BSD','OpenBSD, FreeBSD and Others','freebsd@svg.svg', ''), -(5,'HP-UX','HP-UX Unix OS','HP@svg.svg', ''), -(7,'Cisco','CISCO IOS','cisco@svg.svg', ''), -(8,'MacOS','MAC OS','apple@svg.svg', ''), -(9,'Windows','Microsoft Windows OS','windows@svg.svg', ''), -(10,'Other','Other SO','other-OS@svg.svg', ''), -(11,'Network','Network Agent','network-server@svg.svg', ''), -(12,'Web Server','Web Server/Application','network-server@svg.svg', ''), -(13,'Sensor','Hardware Agent (Sensor)','network-server@svg.svg', ''), -(14,'Embedded','Embedded device running an agent','embedded@svg.svg', ''), -(15,'Android','Android agent','android@svg.svg', ''), -(16, 'VMware', 'VMware Architecture', 'vmware@svg.svg', ''), -(17, 'Router', 'Generic router', 'routers@svg.svg', ''), -(18, 'Switch', 'Generic switch', 'switch@svg.svg', ''), -(19, 'Satellite', 'Satellite agent', 'satellite@svg.svg', ''), -(20, 'Mainframe', 'Mainframe agent', 'mainframe@svg.svg', ''), -(100, 'Cluster', 'Cluster agent', 'cluster@svg.svg', ''); +(1,'Linux','Linux: All versions','linux@os.svg', ''), +(2,'Solaris','Sun Solaris','solaris@os.svg', ''), +(3,'AIX','IBM AIX','aix@os.svg', ''), +(4,'BSD','OpenBSD, FreeBSD and Others','freebsd@os.svg', ''), +(5,'HP-UX','HP-UX Unix OS','HP@os.svg', ''), +(7,'Cisco','CISCO IOS','cisco@os.svg', ''), +(8,'MacOS','MAC OS','apple@os.svg', ''), +(9,'Windows','Microsoft Windows OS','windows@os.svg', ''), +(10,'Other','Other SO','other-OS@os.svg', ''), +(11,'Network','Network Agent','network-server@os.svg', ''), +(12,'Web Server','Web Server/Application','network-server@os.svg', ''), +(13,'Sensor','Hardware Agent (Sensor)','network-server@os.svg', ''), +(14,'Embedded','Embedded device running an agent','embedded@os.svg', ''), +(15,'Android','Android agent','android@os.svg', ''), +(16, 'VMware', 'VMware Architecture', 'vmware@os.svg', ''), +(17, 'Router', 'Generic router', 'routers@os.svg', ''), +(18, 'Switch', 'Generic switch', 'switch@os.svg', ''), +(19, 'Satellite', 'Satellite agent', 'satellite@os.svg', ''), +(20, 'Mainframe', 'Mainframe agent', 'mainframe@os.svg', ''), +(100, 'Cluster', 'Cluster agent', 'cluster@os.svg', ''); UNLOCK TABLES;