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/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/WelcomeWindow.class.php b/pandora_console/include/class/WelcomeWindow.class.php new file mode 100644 index 0000000000..1dcdf61377 --- /dev/null +++ b/pandora_console/include/class/WelcomeWindow.class.php @@ -0,0 +1,767 @@ + $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 '" + ); + $("#confirm_" + randomStr); + $("#confirm_" + randomStr) + .dialog({ + title: settings.title, + close: false, + width: 350, + modal: true, + buttons: [ + { + text: "Cancel", + class: + "ui-widget ui-state-default ui-corner-all ui-button-text-only sub upd submit-cancel", + click: function() { + $(this).dialog("close"); + if (typeof settings.onDeny == "function") settings.onDeny(); + } + }, + { + text: "Ok", + class: + "ui-widget ui-state-default ui-corner-all ui-button-text-only sub ok submit-next", + click: function() { + $(this).dialog("close"); + if (typeof settings.onAccept == "function") settings.onAccept(); + } + } + ] + }) + .show(); +} + /** * Function to show modal with message Validation. * diff --git a/pandora_console/include/styles/new_installation_welcome_window.css b/pandora_console/include/styles/new_installation_welcome_window.css new file mode 100644 index 0000000000..b61b0976af --- /dev/null +++ b/pandora_console/include/styles/new_installation_welcome_window.css @@ -0,0 +1,70 @@ +/* +// Pandora FMS - the Flexible Monitoring System +// ============================================= +// Copyright (c) 2004-2009 Artica Soluciones Tecnológicas S.L + +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU 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. +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +*/ + +.modal { + overflow: hidden; +} + +.welcome_modal_window { + overflow: hidden; +} +label { + font-family: "lato-lighter", "Open Sans", sans-serif; + letter-spacing: 0.03pt; + font-size: 8pt; + font-weight: 900; +} +.content_position { + display: flex; + margin-top: 5px; + font-family: "lato-lighter", "Open Sans", sans-serif; + letter-spacing: 0.03pt; + font-size: 8pt; + font-weight: 800; +} + +.learn_content_indented { + margin-top: 0.5em; + text-indent: 2em; + font-family: "lato-lighter", "Open Sans", sans-serif; + letter-spacing: 0.03pt; + font-size: 8pt; + font-weight: 800; +} + +#lbl_learn { + font-family: "lato-lighter", "Open Sans", sans-serif; + letter-spacing: 0.03pt; + font-size: 8pt; + font-weight: 800; +} + +.go { + background-repeat: no-repeat; + width: 25px; + height: 25px; + border: none; +} + +.pending { + background-image: url(../../images/darrowright.png); +} + +.completed { + background-image: url(../../images/input_tick.png); +}