diff --git a/pandora_console/extras/mr/26.sql b/pandora_console/extras/mr/26.sql index ac973eaa52..197a523599 100644 --- a/pandora_console/extras/mr/26.sql +++ b/pandora_console/extras/mr/26.sql @@ -11,6 +11,7 @@ CREATE TABLE IF NOT EXISTS `tnetwork_matrix` ( UNIQUE (`source`, `destination`, `utimestamp`) ) ENGINE = InnoDB DEFAULT CHARSET=utf8 ; +ALTER TABLE `treport_content` ADD COLUMN `show_extended_events` tinyint(1) default '0'; UPDATE `treport_content` SET type="netflow_summary" WHERE type="netflow_pie" OR type="netflow_statistics"; UPDATE `tnetflow_filter` SET aggregate="dstip" WHERE aggregate NOT IN ("dstip", "srcip", "dstport", "srcport"); @@ -22,4 +23,6 @@ ALTER TABLE tagent_custom_fields ADD COLUMN `combo_values` VARCHAR(255) DEFAULT ALTER TABLE `treport_content` ADD COLUMN `show_extended_events` tinyint(1) default '0'; +ALTER TABLE `trecon_task` ADD COLUMN `summary` text; + COMMIT; diff --git a/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql b/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql index d678198e97..6e5e2ebcc9 100644 --- a/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql +++ b/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql @@ -1413,6 +1413,7 @@ ALTER TABLE trecon_task ADD `vlan_enabled` int(2) unsigned default '0'; ALTER TABLE trecon_task ADD `wmi_enabled` tinyint(1) unsigned DEFAULT '0'; ALTER TABLE trecon_task ADD `auth_strings` text; ALTER TABLE trecon_task ADD `autoconfiguration_enabled` tinyint(1) unsigned default '0'; +ALTER TABLE trecon_task ADD `summary` text; -- --------------------------------------------------------------------- -- Table `twidget` AND Table `twidget_dashboard` diff --git a/pandora_console/general/firts_task/collections.php b/pandora_console/general/firts_task/collections.php index 269de3ba12..8e27ce6ee3 100755 --- a/pandora_console/general/firts_task/collections.php +++ b/pandora_console/general/firts_task/collections.php @@ -22,7 +22,7 @@ ui_require_css_file('firts_task'); __('Collections')]); ?>
-

+

true, 'message' => __('There are no custom __('Custom Fields')]); ?>

-

+

true, 'message' => __('There are no custom __('Custom Graphs')]); ?>

-

+

__('Fields Manager')]); ?>

-

+

__('Incidents')]); ?>

-

+

__('Visual Console')]); ?>

-

+

__('Network Map')]); ?>

-

+

__('Planned Downtime')]); ?>

-

+

__('Discovery server')]); ?>

-

+

__('Services')]); ?>

-

+

__('SNMP Filter')]); ?>

-

+

__('Tags')]); ?>

-

+

__('Transactions')]); ?>

-

+

'; if (file_exists(ENTERPRISE_DIR.'/load_enterprise.php')) { if (isset($config['custom_splash_login'])) { - html_print_image('enterprise/images/custom_splash_login/'.$config['custom_splash_login'], false, [ 'alt' => 'splash', 'border' => 0, 'title' => $splash_title], false, true); + html_print_image('enterprise/images/custom_splash_login/'.$config['custom_splash_login'], false, [ 'alt' => 'splash', 'border' => 0], false, true); } else { - html_print_image('enterprise/images/custom_splash_login/splash_image_default.png', false, ['alt' => 'logo', 'border' => 0, 'title' => $splash_title], false, true); + html_print_image('enterprise/images/custom_splash_login/splash_image_default.png', false, ['alt' => 'logo', 'border' => 0], false, true); } } else { - html_print_image('images/splash_image_default.png', false, ['alt' => 'logo', 'border' => 0, 'title' => $splash_title], false, true); + html_print_image('images/splash_image_default.png', false, ['alt' => 'logo', 'border' => 0], false, true); } echo '

'; diff --git a/pandora_console/godmode/servers/discovery.php b/pandora_console/godmode/servers/discovery.php index 46ee2f8979..d9e19abdff 100755 --- a/pandora_console/godmode/servers/discovery.php +++ b/pandora_console/godmode/servers/discovery.php @@ -15,8 +15,6 @@ if (! check_acl($config['id_user'], 0, 'AW')) { ui_require_css_file('discovery'); -ui_print_page_header(__('Discovery'), '', false, '', true); - /** * Mask class names. diff --git a/pandora_console/godmode/wizards/DiscoveryTaskList.class.php b/pandora_console/godmode/wizards/DiscoveryTaskList.class.php index 2cedd211d4..610353ebb7 100644 --- a/pandora_console/godmode/wizards/DiscoveryTaskList.class.php +++ b/pandora_console/godmode/wizards/DiscoveryTaskList.class.php @@ -96,7 +96,8 @@ class DiscoveryTaskList extends Wizard ] ); - $this->printHeader(); + // Header + ui_print_page_header(__('Task list'), '', false, '', true, '', false, '', GENERIC_SIZE_TEXT, '', $this->printHeader(true)); // Show redirected messages from discovery.php. if ($status === 0) { @@ -432,7 +433,7 @@ class DiscoveryTaskList extends Wizard // Name task. $data[1] = ''; if ($task['disabled'] != 2) { - $data[1] .= ''; + $data[1] .= ''; } $data[1] .= ''.$task['name'].''; @@ -503,7 +504,7 @@ class DiscoveryTaskList extends Wizard } if ($task['disabled'] != 2) { - $data[9] = ''; + $data[9] = ''; $data[9] .= html_print_image( 'images/eye.png', true @@ -512,7 +513,7 @@ class DiscoveryTaskList extends Wizard } if ($task['disabled'] != 2 && $task['utimestamp'] > 0) { - $data[9] .= ''; + $data[9] .= ''; $data[9] .= html_print_image( 'images/dynamic_network_icon.png', true @@ -565,6 +566,9 @@ class DiscoveryTaskList extends Wizard $data[9] = ''; } + // Div neccesary for modal progress task. + echo ''; + array_push($table->data, $data); } @@ -576,8 +580,8 @@ class DiscoveryTaskList extends Wizard html_print_table($table); } - // Div neccesary for modal progress task. - echo ''; + // Div neccesary for modal map task. + echo ''; unset($table); diff --git a/pandora_console/godmode/wizards/HostDevices.class.php b/pandora_console/godmode/wizards/HostDevices.class.php index f0e8325459..e4e0e97fdc 100755 --- a/pandora_console/godmode/wizards/HostDevices.class.php +++ b/pandora_console/godmode/wizards/HostDevices.class.php @@ -152,7 +152,7 @@ class HostDevices extends Wizard ] ); - $this->printHeader(); + ui_print_page_header(__('Host & devices'), '', false, '', true, '', false, '', GENERIC_SIZE_TEXT, '', $this->printHeader(true)); $this->printBigButtonsList($buttons); return; @@ -512,9 +512,15 @@ class HostDevices extends Wizard $task_url = '&task='.$this->task['id_rt']; } - $breadcrum[] = [ - 'link' => 'index.php?sec=gservers&sec2=godmode/servers/discovery&wiz=hd', - 'label' => __($this->label), + $breadcrum = [ + [ + 'link' => 'index.php?sec=gservers&sec2=godmode/servers/discovery', + 'label' => 'Discovery', + ], + [ + 'link' => 'index.php?sec=gservers&sec2=godmode/servers/discovery&wiz=hd', + 'label' => __($this->label), + ], ]; for ($i = 0; $i < $this->maxPagesNetScan; $i++) { $breadcrum[] = [ @@ -527,7 +533,7 @@ class HostDevices extends Wizard if ($this->page < $this->maxPagesNetScan) { // Avoid to print header out of wizard. $this->prepareBreadcrum($breadcrum); - $this->printHeader(); + ui_print_page_header(__('NetScan'), '', false, '', true, '', false, '', GENERIC_SIZE_TEXT, '', $this->printHeader(true)); } if (isset($this->page) === true diff --git a/pandora_console/godmode/wizards/Wizard.main.php b/pandora_console/godmode/wizards/Wizard.main.php index 7a1a5916aa..022402a8d1 100644 --- a/pandora_console/godmode/wizards/Wizard.main.php +++ b/pandora_console/godmode/wizards/Wizard.main.php @@ -196,20 +196,38 @@ class Wizard * * @return void */ - public function prepareBreadcrum(array $urls, bool $add=false) + public function prepareBreadcrum(array $urls, bool $add=false, bool $separator_beginning=false) { $bc = []; $i = 0; + $count = 0; + $array_size = count($urls); + foreach ($urls as $url) { + $count++; + if ($url['selected'] == 1) { $class = 'selected'; } else { $class = ''; } - $bc[$i] = ''; - $bc[$i] .= '
'.$url['label']; - $bc[$i++] .= '
'; + $bc[$i] = ''; + + if ($separator_beginning === true) { + $bc[$i] .= ' / '; + } + + $bc[$i] .= ''; + $bc[$i] .= $url['label']; + $bc[$i] .= ''; + if ($count < $array_size) { + $bc[$i] .= ' / '; + } + + $bc[$i] .= ''; + + $i++; } if ($add === true) { @@ -257,7 +275,7 @@ class Wizard */ public function printBreadcrum() { - return '

'.implode('', $this->breadcrum).'

'; + return implode('', $this->breadcrum); } diff --git a/pandora_console/include/ajax/task_list.ajax.php b/pandora_console/include/ajax/task_list.ajax.php index d6bf652d21..33dc3e6b5f 100644 --- a/pandora_console/include/ajax/task_list.ajax.php +++ b/pandora_console/include/ajax/task_list.ajax.php @@ -34,14 +34,23 @@ $showmap = (bool) get_parameter('showmap', 0); if ($progress_task_discovery) { $id_task = get_parameter('id', 0); - if ($id_task !== 0) { - $result = ''; + if ($id_task <= 0) { + echo json_encode(['error' => true]); + return; + } + + $task = db_get_row('trecon_task', 'id_rt', $id_task); + $global_progress = $task['status']; + $summary = json_decode($task['summary'], true); + + $result = '
'; + if ($task['utimestamp']) { $result .= ''; - echo $result; + $i = 0; + $table = new StdClasS(); + $table->class = 'databox data'; + $table->width = '75%'; + $table->styleTable = 'margin: 2em auto 0;border: 1px solid #ddd;background: white;'; + $table->rowid = []; + $table->data = []; + + // Content. + $table->data[$i][0] = ''.__('Hosts discovered').''; + $table->data[$i][1] = ''; + $table->data[$i][1] .= $summary['summary']['discovered']; + $table->data[$i++][1] .= ''; + + $table->data[$i][0] = ''.__('Alive').''; + $table->data[$i][1] = ''; + $table->data[$i][1] .= $summary['summary']['alive']; + $table->data[$i++][1] .= ''; + + $table->data[$i][0] = ''.__('Not alive').''; + $table->data[$i][1] = ''; + $table->data[$i][1] .= $summary['summary']['not_alive']; + $table->data[$i++][1] .= ''; + + $table->data[$i][0] = ''.__('Responding SNMP').''; + $table->data[$i][1] = ''; + $table->data[$i][1] .= $summary['summary']['SNMP']; + $table->data[$i++][1] .= ''; + + $table->data[$i][0] = ''.__('Responding WMI').''; + $table->data[$i][1] = ''; + $table->data[$i][1] .= $summary['summary']['WMI']; + $table->data[$i++][1] .= ''; + + $result .= html_print_table($table, true).'
'; } else { - // Error. - ui_print_error_message( - __('Please, select task') - ); + $global_progress = -1; + $result .= ui_print_error_message( + __('No data to show'), + '', + true + ).''; } + $result_array['status'] = $global_progress; + $result_array['html'] = $result; + + echo json_encode($result_array); return; } diff --git a/pandora_console/include/class/ConsoleSupervisor.php b/pandora_console/include/class/ConsoleSupervisor.php index 11609d0c81..7259287d68 100644 --- a/pandora_console/include/class/ConsoleSupervisor.php +++ b/pandora_console/include/class/ConsoleSupervisor.php @@ -36,7 +36,7 @@ require_once $config['homedir'].'/include/functions_servers.php'; // Enterprise includes. enterprise_include_once('include/functions_metaconsole.php'); enterprise_include_once('include/functions_license.php'); -enterprise_include_once('extensions/cron/functions.php'); +enterprise_include_once('include/functions_cron.php'); /** * Base class to run scheduled tasks in cron extension diff --git a/pandora_console/include/class/CustomNetScan.class.php b/pandora_console/include/class/CustomNetScan.class.php index a0f8af019d..7477594637 100644 --- a/pandora_console/include/class/CustomNetScan.class.php +++ b/pandora_console/include/class/CustomNetScan.class.php @@ -337,9 +337,15 @@ class CustomNetScan extends Wizard $task_url = '&task='.$this->task['id_rt']; } - $breadcrum[] = [ - 'link' => $run_url.'&wiz=hd', - 'label' => __('Host & Devices'), + $breadcrum = [ + [ + 'link' => 'index.php?sec=gservers&sec2=godmode/servers/discovery', + 'label' => 'Discovery', + ], + [ + 'link' => $run_url.'&wiz=hd', + 'label' => __('Host & Devices'), + ], ]; for ($i = 0; $i < $this->MAXPAGES; $i++) { @@ -353,7 +359,9 @@ class CustomNetScan extends Wizard if ($this->page < $this->MAXPAGES) { // Avoid to print header out of wizard. $this->prepareBreadcrum($breadcrum); - $this->printHeader(); + + // Header + ui_print_page_header(__('NetScan Custom'), '', false, '', true, '', false, '', GENERIC_SIZE_TEXT, '', $this->printHeader(true)); } $task_url = ''; @@ -376,7 +384,9 @@ class CustomNetScan extends Wizard if ($this->page < $this->maxPagesNetScan) { // Avoid to print header out of wizard. $this->prepareBreadcrum($breadcrum); - $this->printHeader(); + + // Header + ui_print_page_header(__('NetScan Custom'), '', false, '', true, '', false, '', GENERIC_SIZE_TEXT, '', $this->printHeader(true)); } if (isset($this->page) === true diff --git a/pandora_console/include/class/ManageNetScanScripts.class.php b/pandora_console/include/class/ManageNetScanScripts.class.php index 377259478a..f3ca4c92b5 100644 --- a/pandora_console/include/class/ManageNetScanScripts.class.php +++ b/pandora_console/include/class/ManageNetScanScripts.class.php @@ -92,9 +92,15 @@ class ManageNetScanScripts extends Wizard $run_url = 'index.php?sec=gservers&sec2=godmode/servers/discovery'; - $breadcrum[] = [ - 'link' => $run_url.'&wiz=hd', - 'label' => __('Host & Devices'), + $breadcrum = [ + [ + 'link' => 'index.php?sec=gservers&sec2=godmode/servers/discovery', + 'label' => 'Discovery', + ], + [ + 'link' => $run_url.'&wiz=hd', + 'label' => __('Host & Devices'), + ], ]; for ($i = 0; $i < $this->MAXPAGES; $i++) { @@ -108,7 +114,9 @@ class ManageNetScanScripts extends Wizard if ($this->page < $this->MAXPAGES) { // Avoid to print header out of wizard. $this->prepareBreadcrum($breadcrum); - $this->printHeader(); + + // Header + ui_print_page_header(__('Net scan scripts'), '', false, '', true, '', false, '', GENERIC_SIZE_TEXT, '', $this->printHeader(true)); } $id_script = get_parameter('id_script', 0); diff --git a/pandora_console/include/class/NetworkMap.class.php b/pandora_console/include/class/NetworkMap.class.php index 56ef4ce0f5..bdcde8660d 100644 --- a/pandora_console/include/class/NetworkMap.class.php +++ b/pandora_console/include/class/NetworkMap.class.php @@ -212,6 +212,13 @@ class NetworkMap */ public $tooltipParams; + /** + * Shows the map using 100% of height and width if is a widget. + * + * @var boolean + */ + public $isWidget; + /** * Defines a custom method to parse Graphviz output and generate Graph. * Function pointer. @@ -380,6 +387,12 @@ class NetworkMap $this->noPopUp = $options['no_popup']; } + // Initialize as widget? + if (isset($options['widget'])) { + $this->isWidget = (bool) $options['widget']; + $this->isWidget = true; + } + // Use a custom parser. if (isset($options['custom_parser'])) { $this->customParser = $options['custom_parser']; @@ -596,10 +609,6 @@ class NetworkMap $this->idGroup = $this->map['id_group']; switch ($this->map['source']) { - case SOURCE_GROUP: - $this->idGroup = $this->map['source_data']; - break; - case SOURCE_TASK: $this->idTask = $this->map['source_data']; break; @@ -608,6 +617,8 @@ class NetworkMap $this->network = $this->map['source_data']; break; + case SOURCE_GROUP: + // Already load. default: // Ignore. break; @@ -764,7 +775,9 @@ class NetworkMap // Empty map returns no data. $nodes = []; } else { - if ($this->mapOptions['map_filter']['dont_show_subgroups'] == 'true') { + if ($this->mapOptions['map_filter']['dont_show_subgroups'] === 'true' + || $this->mapOptions['map_filter']['dont_show_subgroups'] == 1 + ) { // Show only current selected group. $filter['id_grupo'] = $this->idGroup; } else { @@ -2776,6 +2789,10 @@ class NetworkMap false, true ); + + $output .= ''; + $output .= ''; + return $output; } @@ -2999,7 +3016,11 @@ class NetworkMap $table->data = []; - $table->data['interface_row']['node_source_interface'] = html_print_label('', 'node_source_interface'); + $table->data['interface_row']['node_source_interface'] = html_print_label( + '', + 'node_source_interface', + true + ); $table->data['interface_row']['interface_source_select'] = html_print_select( [], @@ -3023,10 +3044,11 @@ class NetworkMap $table->data['interface_row']['node_target_interface'] = html_print_label( '', - 'node_target_interface' + 'node_target_interface', + true ); - $output .= 'br>
'; + $output .= '
'; $table->data['interface_row']['interface_link_button'] = html_print_button( __('Add interface link'), @@ -3228,7 +3250,8 @@ class NetworkMap enterprise_installed: enterprise_installed, node_radius: node_radius, holding_area_dimensions: networkmap_holding_area_dimensions, - url_background_grid: url_background_grid + url_background_grid: url_background_grid, + font_size: '.$this->mapOptions['font_size'].' }); init_drag_and_drop(); init_minimap(); @@ -3289,7 +3312,10 @@ class NetworkMap '/enterprise/include/styles/tooltipster.bundle.min.css' ).'" />'."\n"; - $output .= '
'; + $output .= '
mapOptions['width']; + $output .= ' ;height:'.$this->mapOptions['height'].'">'; $output .= ''; $output .= ''; $output .= '
'; @@ -3321,7 +3347,11 @@ class NetworkMap // Open networkconsole_id div. $output .= '
mapOptions['width'].'; height: '.$this->mapOptions['height'].';position: relative; overflow: hidden; background: #FAFAFA">'; + if ($this->isWidget) { + $output .= ' style="width: 100%; height: 100%;position: relative; overflow: hidden; background: #FAFAFA">'; + } else { + $output .= ' style="width: '.$this->mapOptions['width'].'px; height: '.$this->mapOptions['height'].'px;position: relative; overflow: hidden; background: #FAFAFA">'; + } $output .= '
'; $output .= '= 18) ? 6 : 12; - if ($_SESSION['menu_type']=='classic') + if ($_SESSION['menu_type'] == 'classic') { $output .= ''; - else + } else { $output .= ''; + } // Add the notification ball if defined if (isset($main['notification'])) { diff --git a/pandora_console/include/functions_reporting_xml.php b/pandora_console/include/functions_reporting_xml.php index d1b28ac2a0..1873859bdb 100644 --- a/pandora_console/include/functions_reporting_xml.php +++ b/pandora_console/include/functions_reporting_xml.php @@ -11,10 +11,10 @@ // 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. -require_once 'include/functions_modules.php'; -require_once 'include/functions_events.php'; -require_once 'include/functions_groups.php'; -require_once 'include/functions_netflow.php'; +require_once __DIR__.'/functions_modules.php'; +require_once __DIR__.'/functions_events.php'; +require_once __DIR__.'/functions_groups.php'; +require_once __DIR__.'/functions_netflow.php'; enterprise_include_once('include/functions_metaconsole.php'); diff --git a/pandora_console/include/functions_ui.php b/pandora_console/include/functions_ui.php index eee8138e1e..7865a1c78a 100755 --- a/pandora_console/include/functions_ui.php +++ b/pandora_console/include/functions_ui.php @@ -2768,7 +2768,8 @@ function ui_print_page_header( $modal=false, $message='', $numChars=GENERIC_SIZE_TEXT, - $alias='' + $alias='', + $breadcrumbs='' ) { $title = io_safe_input_html($title); if (($icon == '') && ($godmode == true)) { @@ -2781,15 +2782,21 @@ function ui_print_page_header( if ($godmode == true) { $type = 'view'; - $type2 = 'menu_tab_frame_view'; + $type2 = (empty($breadcrumbs)) ? 'menu_tab_frame_view' : 'menu_tab_frame_view_bc'; $separator_class = 'separator'; } else { $type = 'view'; - $type2 = 'menu_tab_frame_view'; + $type2 = (empty($breadcrumbs)) ? 'menu_tab_frame_view' : 'menu_tab_frame_view_bc'; $separator_class = 'separator_view'; } - $buffer = '