diff --git a/pandora_console/extensions/resource_exportation.php b/pandora_console/extensions/resource_exportation.php index ddfa9866ad..14384aaec3 100755 --- a/pandora_console/extensions/resource_exportation.php +++ b/pandora_console/extensions/resource_exportation.php @@ -238,19 +238,6 @@ function output_xml_report($id) echo ''; echo ''; break; - - /* - case 'TTRT': - break; - - case 'TTO': - break; - - case 'MTBF': - break; - - case 'MTTR': - break;*/ } echo "\n"; diff --git a/pandora_console/extensions/resource_registration.php b/pandora_console/extensions/resource_registration.php index ea9a5f50e8..dae61e3a78 100755 --- a/pandora_console/extensions/resource_registration.php +++ b/pandora_console/extensions/resource_registration.php @@ -375,19 +375,6 @@ function process_upload_xml_report($xml, $group_filter=0) $values['line_separator'] = io_safe_input($item['line_separator']); $values['column_separator'] = io_safe_input($item['column_separator']); break; - - /* - case 'TTRT': - break; - - case 'TTO': - break; - - case 'MTBF': - break; - - case 'MTTR': - break;*/ } if (empty($agents_item)) { diff --git a/pandora_console/extensions/sample_agent.php b/pandora_console/extensions/sample_agent.php new file mode 100644 index 0000000000..ba92debae9 --- /dev/null +++ b/pandora_console/extensions/sample_agent.php @@ -0,0 +1,66 @@ + $id_agente], 'id_agente_modulo'); + $count_modules = count($modules); + + // Update of layout 1 (Rack sample). + $images_rack_server = [ + 'rack_server_rack', + 'rack_server', + 'rack_switch', + 'rack_firewall', + 'rack_double_server', + 'rack_frame', + 'rack_pdu', + ]; + $query = 'UPDATE `tlayout_data` SET `id_agent` = '.$id_agente.', `id_agente_modulo` = CASE '; + for ($i = 0; $i < $count_modules; $i++) { + $query .= 'WHEN `image` = "'.$images_rack_server[$i].'" THEN '.$modules[$i]['id_agente_modulo'].' '; + } + + $query .= 'END WHERE `id_layout` = 1 AND `image` IN ("'.implode('","', $images_rack_server).'");'; + + db_process_sql($query); + // Update of layout 2 (Dashboard). + $query = 'UPDATE `tlayout_data` SET `id_agent`= '.$id_agente.', `id_agente_modulo` = CASE '; + $query .= 'WHEN `id` = 107 THEN '.$modules[0]['id_agente_modulo'].' '; + $query .= 'WHEN `id` = 108 THEN '.$modules[1]['id_agente_modulo'].' '; + $query .= 'WHEN `id` = 109 THEN '.$modules[2]['id_agente_modulo'].' '; + $query .= 'WHEN `id` = 110 THEN '.$modules[2]['id_agente_modulo'].' '; + $query .= 'WHEN `id` = 111 THEN '.$modules[3]['id_agente_modulo'].' '; + $query .= 'WHEN `id` = 112 THEN '.$modules[4]['id_agente_modulo'].' '; + $query .= 'WHEN `id` = 113 THEN '.$modules[5]['id_agente_modulo'].' '; + $query .= 'WHEN `id` = 114 THEN '.$modules[6]['id_agente_modulo'].' '; + $query .= 'END WHERE `id_layout` = 2 AND `id` IN (107,108,109,110,111,112,113,114);'; + + db_process_sql($query); + + // This setting will avoid regenerate all the times the visual consoles. + config_update_value('sample_agent_deployed', 1); +} + +extensions_add_main_function('sample_agent_deployment'); diff --git a/pandora_console/extras/mr/33.sql b/pandora_console/extras/mr/33.sql index c34209b867..50fc5e0bce 100644 --- a/pandora_console/extras/mr/33.sql +++ b/pandora_console/extras/mr/33.sql @@ -1,5 +1,7 @@ START TRANSACTION; +ALTER TABLE `tlayout_template_data` ADD COLUMN `cache_expiration` INTEGER UNSIGNED NOT NULL DEFAULT 0; + INSERT INTO `ttipo_modulo` VALUES (34,'remote_cmd', 10, 'Remote execution, numeric data', 'mod_remote_cmd.png'), (35,'remote_cmd_proc', 10, 'Remote execution, boolean data', 'mod_remote_cmd_proc.png'), @@ -22,7 +24,7 @@ CREATE TABLE `tremote_command` ( CREATE TABLE `tremote_command_target` ( `id` SERIAL, `rcmd_id` bigint unsigned NOT NULL, - `id_agente` int(10) unsigned NOT NULL, + `id_agent` int(10) unsigned NOT NULL, `utimestamp` int(20) unsigned NOT NULL default 0, `stdout` text, `stderr` text, @@ -32,4 +34,4 @@ CREATE TABLE `tremote_command_target` ( ON UPDATE CASCADE ON DELETE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -COMMIT; \ No newline at end of file +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 d195823d7b..bbbcb509ac 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 @@ -1912,6 +1912,7 @@ CREATE TABLE IF NOT EXISTS `tlayout_template_data` ( `linked_layout_status_as_service_warning` FLOAT(20, 3) NOT NULL default 0, `linked_layout_status_as_service_critical` FLOAT(20, 3) NOT NULL default 0, `linked_layout_node_id` INT(10) NOT NULL default 0, + `cache_expiration` INTEGER UNSIGNED NOT NULL default 0, PRIMARY KEY(`id`), FOREIGN KEY (`id_layout_template`) REFERENCES tlayout_template(`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE = InnoDB DEFAULT CHARSET=utf8; diff --git a/pandora_console/general/firts_task/planned_downtime.php b/pandora_console/general/firts_task/planned_downtime.php index dcd98fdebb..21bfb4b083 100644 --- a/pandora_console/general/firts_task/planned_downtime.php +++ b/pandora_console/general/firts_task/planned_downtime.php @@ -33,7 +33,7 @@ ui_require_css_file('firts_task'); ); ?>

-
+
diff --git a/pandora_console/general/header.php b/pandora_console/general/header.php index e060cf96f6..157388a43e 100644 --- a/pandora_console/general/header.php +++ b/pandora_console/general/header.php @@ -639,6 +639,7 @@ if ($config['menu_type'] == 'classic') { // Require specific CSS and JS. ui_require_css_file('wizard'); ui_require_css_file('discovery'); + ui_require_css_file('diagnostics'); ?> var btn_ok_text = ''; var btn_cancel_text = ''; diff --git a/pandora_console/general/register.php b/pandora_console/general/register.php index b1d58aada4..e7097b994e 100644 --- a/pandora_console/general/register.php +++ b/pandora_console/general/register.php @@ -30,6 +30,7 @@ global $config; require_once $config['homedir'].'/include/functions_update_manager.php'; +require_once $config['homedir'].'/include/class/WelcomeWindow.class.php'; if (is_ajax()) { @@ -122,6 +123,8 @@ if (is_ajax()) { exit(); } + + ui_require_css_file('register'); $initial = isset($config['initial_wizard']) !== true @@ -170,6 +173,16 @@ if (!$config['disabled_newsletter']) { } } +$welcome = !$registration && !$show_newsletter && !$initial; +try { + $welcome_window = new WelcomeWindow($welcome); + if ($welcome_window !== null) { + $welcome_window->run(); + } +} catch (Exception $e) { + $welcome = false; +} + $newsletter = null; ?> diff --git a/pandora_console/godmode/agentes/configurar_agente.php b/pandora_console/godmode/agentes/configurar_agente.php index 664b173748..61d33193d3 100644 --- a/pandora_console/godmode/agentes/configurar_agente.php +++ b/pandora_console/godmode/agentes/configurar_agente.php @@ -2278,6 +2278,10 @@ if ($updateGIS) { // ----------------------------------- // Load page depending on tab selected // ----------------------------------- +if ($_SESSION['create_module'] && $config['welcome_state'] == 1) { + $edit_module = true; +} + switch ($tab) { case 'main': include 'agent_manager.php'; diff --git a/pandora_console/godmode/agentes/module_manager_editor.php b/pandora_console/godmode/agentes/module_manager_editor.php index 874fe3a9d1..9428a362bc 100644 --- a/pandora_console/godmode/agentes/module_manager_editor.php +++ b/pandora_console/godmode/agentes/module_manager_editor.php @@ -391,6 +391,9 @@ if ($id_agent_module) { } else { if (isset($moduletype) === false) { $moduletype = (string) get_parameter('moduletype'); + if ($_SESSION['create_module'] && $config['welcome_state'] == 1) { + $moduletype = 'networkserver'; + } // Clean up specific network modules fields. $name = ''; diff --git a/pandora_console/godmode/agentes/planned_downtime.editor.php b/pandora_console/godmode/agentes/planned_downtime.editor.php index eef8d5fbdf..ebf64a87c1 100644 --- a/pandora_console/godmode/agentes/planned_downtime.editor.php +++ b/pandora_console/godmode/agentes/planned_downtime.editor.php @@ -827,7 +827,7 @@ $table->data[5][1] = " '; -echo '
'; +echo ''; if ($id_downtime > 0) { echo ''; @@ -929,7 +929,7 @@ if ($id_downtime > 0) { $disabled_add_button = true; } - echo ""; + echo ""; html_print_select_groups(false, $access, true, 'filter_group', $filter_group, '', '', '', false, false, true, '', false, 'min-width:180px;margin-right:15px;'); html_print_checkbox('recursion', 1, $recursion, false, false, ''); @@ -939,7 +939,7 @@ if ($id_downtime > 0) { echo ''; // Show available agents to include into downtime echo '

'.__('Available agents').':

'; - echo ""; + echo ""; echo html_print_select($agents, 'id_agents[]', -1, '', _('Any'), -2, false, true, true, '', false, 'width: 180px;'); @@ -1085,7 +1085,7 @@ if ($id_downtime > 0) { $data[5] = ''.html_print_image('images/config.png', true, ['border' => '0', 'alt' => __('Delete')]).''; } - $data[5] .= ''.html_print_image('images/cross.png', true, ['border' => '0', 'alt' => __('Delete')]).''; + $data[5] .= ''.html_print_image('images/cross.png', true, ['border' => '0', 'alt' => __('Delete')]).''; } $table->data['agent_'.$downtime_agent['id_agente']] = $data; diff --git a/pandora_console/godmode/agentes/planned_downtime.list.php b/pandora_console/godmode/agentes/planned_downtime.list.php index 49a72f125d..01f30afba6 100755 --- a/pandora_console/godmode/agentes/planned_downtime.list.php +++ b/pandora_console/godmode/agentes/planned_downtime.list.php @@ -357,7 +357,7 @@ if (!$downtimes && !$filter_performed) { // No downtimes cause the user performed a search. else if (!$downtimes) { // Filter form. - echo ""; + echo ""; html_print_table($table_form); echo ''; @@ -369,7 +369,7 @@ else if (!$downtimes) { // Create button. if ($write_permisson) { echo ' '; - echo ''; + echo ''; html_print_submit_button(__('Create'), 'create', false, 'class="sub next"'); echo ''; } @@ -378,11 +378,11 @@ else if (!$downtimes) { } // Has downtimes. else { - echo ""; + echo ""; html_print_table($table_form); echo ''; - ui_pagination($downtimes_number, "index.php?sec=estado&sec2=godmode/agentes/planned_downtime.list&$filter_params_str", $offset); + ui_pagination($downtimes_number, "index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.list&$filter_params_str", $offset); // User groups with AR, AD or AW permission. $groupsAD = users_get_groups($config['id_user'], $access); @@ -476,7 +476,7 @@ else { if (in_array($downtime['id_group'], $groupsAD)) { // Stop button if ($downtime['type_execution'] == 'once' && $downtime['executed'] == 1) { - $data['stop'] = ''.html_print_image('images/cancel.png', true, ['title' => __('Stop downtime')]); + $data['stop'] = ''.html_print_image('images/cancel.png', true, ['title' => __('Stop downtime')]); } else { $data['stop'] = ''; } @@ -484,12 +484,12 @@ else { // Edit & delete buttons. if ($downtime['executed'] == 0) { // Edit. - $data['edit'] = ''.html_print_image('images/config.png', true, ['title' => __('Update')]).''; + $data['edit'] = ''.html_print_image('images/config.png', true, ['title' => __('Update')]).''; // Delete. - $data['delete'] = ''.html_print_image('images/cross.png', true, ['title' => __('Delete')]); + $data['delete'] = ''.html_print_image('images/cross.png', true, ['title' => __('Delete')]); } else if ($downtime['executed'] == 1 && $downtime['type_execution'] == 'once') { // Edit. - $data['edit'] = ''.html_print_image('images/config.png', true, ['title' => __('Update')]).''; + $data['edit'] = ''.html_print_image('images/config.png', true, ['title' => __('Update')]).''; // Delete. $data['delete'] = __('N/A'); } else { @@ -515,7 +515,7 @@ else { } html_print_table($table); - ui_pagination($downtimes_number, "index.php?sec=estado&sec2=godmode/agentes/planned_downtime.list&$filter_params_str", $offset, 0, false, 'offset', true, 'pagination-bottom'); + ui_pagination($downtimes_number, "index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.list&$filter_params_str", $offset, 0, false, 'offset', true, 'pagination-bottom'); echo '
'; // CSV export button. @@ -532,7 +532,7 @@ else { // Create button. if ($write_permisson) { echo ' '; - echo '
'; + echo ''; html_print_submit_button(__('Create'), 'create', false, 'class="sub next"'); echo ''; } @@ -559,7 +559,7 @@ $(document).ready (function () { if ( && ) { if (confirm("")) { - window.location.href = "index.php?sec=estado&sec2=godmode/agentes/planned_downtime.list&migrate_malformed=1"; + window.location.href = "index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.list&migrate_malformed=1"; } } }); diff --git a/pandora_console/godmode/reporting/reporting_builder.item_editor.php b/pandora_console/godmode/reporting/reporting_builder.item_editor.php index b59dbc2ee5..e7201ab155 100755 --- a/pandora_console/godmode/reporting/reporting_builder.item_editor.php +++ b/pandora_console/godmode/reporting/reporting_builder.item_editor.php @@ -482,51 +482,6 @@ switch ($action) { $period = $item['period']; break; - /* - case 'TTRT': - $description = $item['description']; - $idAgentModule = $item['id_agent_module']; - $idAgent = db_get_value_filter( - 'id_agente', - 'tagente_modulo', - ['id_agente_modulo' => $idAgentModule] - ); - $period = $item['period']; - break; - - case 'TTO': - $description = $item['description']; - $idAgentModule = $item['id_agent_module']; - $idAgent = db_get_value_filter( - 'id_agente', - 'tagente_modulo', - ['id_agente_modulo' => $idAgentModule] - ); - $period = $item['period']; - break; - - case 'MTBF': - $description = $item['description']; - $idAgentModule = $item['id_agent_module']; - $idAgent = db_get_value_filter( - 'id_agente', - 'tagente_modulo', - ['id_agente_modulo' => $idAgentModule] - ); - $period = $item['period']; - break; - - case 'MTTR': - $description = $item['description']; - $idAgentModule = $item['id_agent_module']; - $idAgent = db_get_value_filter( - 'id_agente', - 'tagente_modulo', - ['id_agente_modulo' => $idAgentModule] - ); - $period = $item['period']; - break; - */ case 'alert_report_module': $description = $item['description']; $idAgentModule = $item['id_agent_module']; @@ -791,11 +746,6 @@ switch ($action) { case 'avg_value': case 'projection_graph': case 'prediction_date': - /* - case 'TTRT': - case 'TTO': - case 'MTBF': - case 'MTTR':*/ case 'simple_baseline_graph': case 'event_report_log': case 'increment': @@ -3757,10 +3707,6 @@ $(document).ready (function () { case 'event_report_module': case 'simple_graph': case 'simple_baseline_graph': -/* case 'TTRT': - case 'TTO': - case 'MTBF': - case 'MTTR':*/ case 'prediction_date': case 'projection_graph': case 'avg_value': @@ -3798,10 +3744,6 @@ $(document).ready (function () { case 'event_report_module': case 'simple_graph': case 'simple_baseline_graph': -/* case 'TTRT': - case 'TTO': - case 'MTBF': - case 'MTTR':*/ case 'prediction_date': case 'projection_graph': case 'avg_value': @@ -4833,38 +4775,6 @@ function chooseType() { $("#row_period").show(); $("#row_historical_db_check").hide(); break; -/* - case 'TTRT': - $("#row_description").show(); - $("#row_agent").show(); - $("#row_module").show(); - $("#row_period").show(); - $("#row_historical_db_check").hide(); - break; - - case 'TTO': - $("#row_description").show(); - $("#row_agent").show(); - $("#row_module").show(); - $("#row_period").show(); - $("#row_historical_db_check").hide(); - break; - - case 'MTBF': - $("#row_description").show(); - $("#row_agent").show(); - $("#row_module").show(); - $("#row_period").show(); - $("#row_historical_db_check").hide(); - break; - - case 'MTTR': - $("#row_description").show(); - $("#row_agent").show(); - $("#row_module").show(); - $("#row_period").show(); - $("#row_historical_db_check").hide(); - break;*/ case 'alert_report_module': $("#row_description").show(); @@ -5218,10 +5128,6 @@ function chooseType() { case 'min_value': case 'max_value': case 'avg_value': - /* case 'TTRT': - case 'TTO': - case 'MTBF': - case 'MTTR':*/ case 'simple_baseline_graph': $("#row_label").show(); break; diff --git a/pandora_console/godmode/reporting/reporting_builder.php b/pandora_console/godmode/reporting/reporting_builder.php index 40ce45b5bb..823713877b 100755 --- a/pandora_console/godmode/reporting/reporting_builder.php +++ b/pandora_console/godmode/reporting/reporting_builder.php @@ -2006,11 +2006,6 @@ switch ($action) { case 'avg_value': case 'projection_graph': case 'prediction_date': - /* - case 'TTRT': - case 'TTO': - case 'MTBF': - case 'MTTR':*/ case 'simple_baseline_graph': case 'nt_top_n': if ($label != '') { @@ -2613,11 +2608,6 @@ switch ($action) { case 'avg_value': case 'projection_graph': case 'prediction_date': - /* - case 'TTRT': - case 'TTO': - case 'MTBF': - case 'MTTR':*/ case 'simple_baseline_graph': case 'nt_top_n': if ($label != '') { diff --git a/pandora_console/include/ajax/welcome_window.php b/pandora_console/include/ajax/welcome_window.php new file mode 100644 index 0000000000..fc2e278a6f --- /dev/null +++ b/pandora_console/include/ajax/welcome_window.php @@ -0,0 +1,62 @@ +ajaxMethod($method) === true) { + $welcome_actions->{$method}(); + } else { + $welcome_actions->error('Unavailable method.'); + } +} else { + $welcome_actions->error('Method not found. ['.$method.']'); +} + + +// Stop any execution. +exit; diff --git a/pandora_console/include/class/Diagnostics.class.php b/pandora_console/include/class/Diagnostics.class.php index 43f3d948b4..af65aa8066 100644 --- a/pandora_console/include/class/Diagnostics.class.php +++ b/pandora_console/include/class/Diagnostics.class.php @@ -1801,6 +1801,7 @@ class Diagnostics extends Wizard 'id' => 'modal_form_feedback', 'onsubmit' => 'return false;', 'class' => 'modal', + 'extra' => 'novalidate', ]; $inputs = []; diff --git a/pandora_console/include/class/NetworkMap.class.php b/pandora_console/include/class/NetworkMap.class.php index 0011167308..505d057665 100644 --- a/pandora_console/include/class/NetworkMap.class.php +++ b/pandora_console/include/class/NetworkMap.class.php @@ -2642,8 +2642,17 @@ class NetworkMap */ public function loadMapData() { + global $config; + $networkmap = $this->map; + // ACL. + $networkmap_write = check_acl( + $config['id_user'], + $networkmap['id_group'], + 'MW' + ); + $simulate = false; if (isset($networkmap['__simulated']) === false) { $networkmap['filter'] = json_decode( @@ -2711,6 +2720,7 @@ class NetworkMap $output .= 'var networkmap_center = [ '.$networkmap['center_x'].', '.$networkmap['center_y']."];\n"; $output .= 'var networkmap_dimensions = [ '.$networkmap['width'].', '.$networkmap['height']."];\n"; $output .= 'var enterprise_installed = '.((int) enterprise_installed()).";\n"; + $output .= 'var networkmap_write = '.$networkmap_write.";\n"; $output .= 'var node_radius = '.$networkmap['filter']['node_radius'].";\n"; $output .= 'var networkmap_holding_area_dimensions = '.json_encode($networkmap['filter']['holding_area']).";\n"; $output .= "var networkmap = {'nodes': [], 'links': []};\n"; diff --git a/pandora_console/include/class/WelcomeWindow.class.php b/pandora_console/include/class/WelcomeWindow.class.php new file mode 100644 index 0000000000..4381323439 --- /dev/null +++ b/pandora_console/include/class/WelcomeWindow.class.php @@ -0,0 +1,760 @@ + $msg] + ); + } + + + /** + * Checks if target method is available to be called using AJAX. + * + * @param string $method Target method. + * + * @return boolean True allowed, false not. + */ + public function ajaxMethod($method) + { + global $config; + + // Check access. + check_login(); + + return in_array($method, $this->AJAXMethods); + } + + + /** + * Constructor. + * + * @param boolean $must_run Must run or not. + * @param string $ajax_controller Controller. + * + * @return object + * @throws Exception On error. + */ + public function __construct( + bool $must_run=false, + $ajax_controller='include/ajax/welcome_window' + ) { + $this->ajaxController = $ajax_controller; + + if ($this->initialize($must_run) !== true) { + throw new Exception('Must not be shown'); + } + + return $this; + } + + + /** + * Main method. + * + * @return void + */ + public function run() + { + ui_require_css_file('new_installation_welcome_window'); + echo '