2019-10-18 10:30:19 +02:00
|
|
|
|
<?php
|
|
|
|
|
/**
|
2019-10-30 16:56:44 +01:00
|
|
|
|
* Welcome to Pandora FMS feature.
|
2019-10-18 10:30:19 +02:00
|
|
|
|
*
|
|
|
|
|
* @category Class
|
|
|
|
|
* @package Pandora FMS
|
|
|
|
|
* @subpackage New Installation Welcome Window
|
|
|
|
|
* @version 1.0.0
|
|
|
|
|
* @license See below
|
|
|
|
|
*
|
|
|
|
|
* ______ ___ _______ _______ ________
|
|
|
|
|
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
|
|
|
|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
|
|
|
|
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
|
|
|
|
*
|
|
|
|
|
* ============================================================================
|
|
|
|
|
* Copyright (c) 2005-2019 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
|
|
|
|
|
* as published by the Free Software Foundation for 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.
|
|
|
|
|
* ============================================================================
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
// Begin.
|
|
|
|
|
global $config;
|
|
|
|
|
|
|
|
|
|
require_once $config['homedir'].'/godmode/wizards/Wizard.main.php';
|
2019-10-30 16:56:44 +01:00
|
|
|
|
|
2019-10-18 10:30:19 +02:00
|
|
|
|
/**
|
2019-10-24 16:56:13 +02:00
|
|
|
|
* Class WelcomeWindow.
|
2019-10-18 10:30:19 +02:00
|
|
|
|
*/
|
2019-10-24 16:56:13 +02:00
|
|
|
|
class WelcomeWindow extends Wizard
|
2019-10-18 10:30:19 +02:00
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Allowed methods to be called using AJAX request.
|
|
|
|
|
*
|
|
|
|
|
* @var array
|
|
|
|
|
*/
|
2019-10-28 18:57:10 +01:00
|
|
|
|
public $AJAXMethods = [
|
|
|
|
|
'loadWelcomeWindow',
|
|
|
|
|
'cancelWelcome',
|
|
|
|
|
];
|
2019-10-18 10:30:19 +02:00
|
|
|
|
|
2019-11-07 14:05:42 +01:00
|
|
|
|
/**
|
|
|
|
|
* Tasks.
|
|
|
|
|
*
|
|
|
|
|
* @var array
|
|
|
|
|
*/
|
|
|
|
|
private $tasks = [
|
|
|
|
|
'welcome_mail_configured',
|
|
|
|
|
'welcome_id_agent',
|
|
|
|
|
'welcome_module',
|
|
|
|
|
'welcome_alert',
|
|
|
|
|
'welcome_task',
|
|
|
|
|
];
|
|
|
|
|
|
2019-10-18 10:30:19 +02:00
|
|
|
|
/**
|
|
|
|
|
* Url of controller.
|
|
|
|
|
*
|
|
|
|
|
* @var string
|
|
|
|
|
*/
|
|
|
|
|
public $ajaxController;
|
|
|
|
|
|
2019-10-24 16:56:13 +02:00
|
|
|
|
/**
|
|
|
|
|
* Current step.
|
|
|
|
|
*
|
2019-10-30 16:56:44 +01:00
|
|
|
|
* @var integer
|
2019-10-24 16:56:13 +02:00
|
|
|
|
*/
|
|
|
|
|
public $step;
|
|
|
|
|
|
2019-10-30 16:56:44 +01:00
|
|
|
|
/**
|
|
|
|
|
* Current agent (created example).
|
|
|
|
|
*
|
|
|
|
|
* @var integer
|
|
|
|
|
*/
|
|
|
|
|
public $agent;
|
|
|
|
|
|
2019-10-24 16:56:13 +02:00
|
|
|
|
|
2019-10-28 18:57:10 +01:00
|
|
|
|
/**
|
|
|
|
|
* Generates a JSON error.
|
|
|
|
|
*
|
|
|
|
|
* @param string $msg Error message.
|
|
|
|
|
*
|
|
|
|
|
* @return void
|
|
|
|
|
*/
|
|
|
|
|
public function error($msg)
|
|
|
|
|
{
|
|
|
|
|
echo json_encode(
|
|
|
|
|
['error' => $msg]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2019-10-18 10:30:19 +02:00
|
|
|
|
/**
|
|
|
|
|
* 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.
|
|
|
|
|
*
|
2019-10-30 16:56:44 +01:00
|
|
|
|
* @param boolean $must_run Must run or not.
|
|
|
|
|
* @param string $ajax_controller Controller.
|
2019-10-18 10:30:19 +02:00
|
|
|
|
*
|
|
|
|
|
* @return object
|
2019-10-30 16:56:44 +01:00
|
|
|
|
* @throws Exception On error.
|
2019-10-18 10:30:19 +02:00
|
|
|
|
*/
|
2019-10-24 16:56:13 +02:00
|
|
|
|
public function __construct(
|
2019-10-30 16:56:44 +01:00
|
|
|
|
bool $must_run=false,
|
2019-10-24 16:56:13 +02:00
|
|
|
|
$ajax_controller='include/ajax/welcome_window'
|
|
|
|
|
) {
|
2019-10-18 10:30:19 +02:00
|
|
|
|
$this->ajaxController = $ajax_controller;
|
2019-10-30 16:56:44 +01:00
|
|
|
|
|
|
|
|
|
if ($this->initialize($must_run) !== true) {
|
|
|
|
|
throw new Exception('Must not be shown');
|
|
|
|
|
}
|
|
|
|
|
|
2019-10-18 10:30:19 +02:00
|
|
|
|
return $this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Main method.
|
|
|
|
|
*
|
|
|
|
|
* @return void
|
|
|
|
|
*/
|
|
|
|
|
public function run()
|
|
|
|
|
{
|
|
|
|
|
ui_require_css_file('new_installation_welcome_window');
|
2019-10-30 16:56:44 +01:00
|
|
|
|
echo '<div id="welcome_modal_window" style="display: none"; >';
|
2019-10-18 10:30:19 +02:00
|
|
|
|
|
|
|
|
|
?>
|
|
|
|
|
<script type="text/javascript">
|
|
|
|
|
load_modal({
|
|
|
|
|
target: $('#welcome_modal_window'),
|
|
|
|
|
url: '<?php echo ui_get_full_url('ajax.php', false, false, false); ?>',
|
|
|
|
|
modal: {
|
|
|
|
|
title: "<?php echo __('Welcome to Pandora FMS'); ?>",
|
2019-11-07 10:42:46 +01:00
|
|
|
|
cancel: '<?php echo __('Do not show anymore'); ?>',
|
|
|
|
|
ok: '<?php echo __('Close'); ?>'
|
2019-10-18 10:30:19 +02:00
|
|
|
|
},
|
|
|
|
|
onshow: {
|
|
|
|
|
page: '<?php echo $this->ajaxController; ?>',
|
2019-10-28 18:57:10 +01:00
|
|
|
|
method: 'loadWelcomeWindow',
|
2019-10-18 10:30:19 +02:00
|
|
|
|
},
|
2019-10-28 18:57:10 +01:00
|
|
|
|
oncancel: {
|
|
|
|
|
page: '<?php echo $this->ajaxController; ?>',
|
|
|
|
|
title: "<?php echo __('Cancel Configuration Window'); ?>",
|
|
|
|
|
method: 'cancelWelcome',
|
|
|
|
|
confirm: function (fn) {
|
|
|
|
|
confirmDialog({
|
|
|
|
|
title: '<?php echo __('Are you sure?'); ?>',
|
|
|
|
|
message: '<?php echo __('Are you sure you want to cancel this tutorial?'); ?>',
|
|
|
|
|
ok: '<?php echo __('OK'); ?>',
|
|
|
|
|
cancel: '<?php echo __('Cancel'); ?>',
|
|
|
|
|
onAccept: function() {
|
|
|
|
|
// Continue execution.
|
|
|
|
|
fn();
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}
|
2019-10-18 10:30:19 +02:00
|
|
|
|
});
|
2019-10-28 18:57:10 +01:00
|
|
|
|
|
2019-10-18 10:30:19 +02:00
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<?php
|
|
|
|
|
echo '</div>';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2019-10-28 18:57:10 +01:00
|
|
|
|
/**
|
2019-10-30 16:56:44 +01:00
|
|
|
|
* Method to cancel welcome modal window.
|
|
|
|
|
*
|
|
|
|
|
* @return void
|
2019-10-28 18:57:10 +01:00
|
|
|
|
*/
|
|
|
|
|
public function cancelWelcome()
|
|
|
|
|
{
|
2019-10-30 16:56:44 +01:00
|
|
|
|
// Config update value.
|
|
|
|
|
$this->setStep(WELCOME_FINISHED);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Return current step.
|
|
|
|
|
*
|
|
|
|
|
* @return integer Step.
|
|
|
|
|
*/
|
|
|
|
|
public function getStep(): int
|
|
|
|
|
{
|
|
|
|
|
global $config;
|
|
|
|
|
$this->step = $config['welcome_state'];
|
|
|
|
|
|
2019-11-07 14:05:42 +01:00
|
|
|
|
// Get step available.
|
2019-11-11 13:38:27 +01:00
|
|
|
|
if (empty($config['welcome_mail_configured']) === true
|
|
|
|
|
&& get_parameter('sec2') == 'godmode/setup/setup'
|
|
|
|
|
&& get_parameter('section', '') == 'general'
|
|
|
|
|
&& get_parameter('update_config', false) !== false
|
|
|
|
|
) {
|
|
|
|
|
$this->step = W_CONFIGURE_MAIL;
|
|
|
|
|
} else if (empty($config['welcome_id_agent']) === true) {
|
2019-11-07 14:05:42 +01:00
|
|
|
|
$this->step = W_CREATE_AGENT;
|
|
|
|
|
} else if (empty($config['welcome_module']) === true) {
|
|
|
|
|
$this->step = W_CREATE_MODULE;
|
|
|
|
|
} else if (empty($config['welcome_alert']) === true) {
|
|
|
|
|
$this->step = W_CREATE_ALERT;
|
|
|
|
|
} else if (empty($config['welcome_task']) === true) {
|
|
|
|
|
$this->step = W_CREATE_TASK;
|
|
|
|
|
}
|
|
|
|
|
|
2019-10-30 16:56:44 +01:00
|
|
|
|
return $this->step;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Sets current step.
|
|
|
|
|
*
|
|
|
|
|
* @param integer $step Current step.
|
|
|
|
|
*
|
|
|
|
|
* @return void
|
|
|
|
|
*/
|
|
|
|
|
public function setStep(int $step)
|
|
|
|
|
{
|
|
|
|
|
$this->step = $step;
|
|
|
|
|
config_update_value('welcome_state', $step);
|
2019-11-07 14:05:42 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Completes current step.
|
|
|
|
|
*
|
|
|
|
|
* @return void
|
|
|
|
|
*/
|
|
|
|
|
public function completeStep()
|
|
|
|
|
{
|
|
|
|
|
switch ($this->step) {
|
|
|
|
|
case W_CONFIGURE_MAIL:
|
|
|
|
|
config_update_value('welcome_mail_configured', true);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case W_CREATE_AGENT:
|
|
|
|
|
config_update_value('welcome_id_agent', true);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case W_CREATE_MODULE:
|
|
|
|
|
config_update_value('welcome_module', true);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case W_CREATE_ALERT:
|
|
|
|
|
config_update_value('welcome_alert', true);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case W_CREATE_TASK:
|
|
|
|
|
config_update_value('welcome_task', true);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
// Ignore.
|
|
|
|
|
break;
|
|
|
|
|
}
|
2019-10-30 16:56:44 +01:00
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2019-11-07 14:05:42 +01:00
|
|
|
|
/**
|
|
|
|
|
* Check if all tasks had been completed.
|
|
|
|
|
*
|
|
|
|
|
* @return boolean All completed or not.
|
|
|
|
|
*/
|
|
|
|
|
public function checkAllTasks()
|
|
|
|
|
{
|
|
|
|
|
global $config;
|
|
|
|
|
|
|
|
|
|
foreach ($this->tasks as $t) {
|
|
|
|
|
if (empty($config[$t]) === true) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2019-10-30 16:56:44 +01:00
|
|
|
|
/**
|
|
|
|
|
* Retrieve current welcome agent id.
|
|
|
|
|
*
|
|
|
|
|
* @return integer Agent id (created).
|
|
|
|
|
*/
|
|
|
|
|
public function getWelcomeAgent()
|
|
|
|
|
{
|
|
|
|
|
global $config;
|
|
|
|
|
|
|
|
|
|
return $config['welcome_id_agent'];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Saves current welcome agent (latest created).
|
|
|
|
|
*
|
|
|
|
|
* @param integer $id_agent Agent id.
|
|
|
|
|
*
|
|
|
|
|
* @return void
|
|
|
|
|
*/
|
|
|
|
|
public function setWelcomeAgent(int $id_agent)
|
|
|
|
|
{
|
|
|
|
|
config_update_value('welcome_id_agent', $id_agent);
|
2019-10-28 18:57:10 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2019-10-18 10:30:19 +02:00
|
|
|
|
/**
|
|
|
|
|
* Loads a welcome window form
|
|
|
|
|
*
|
|
|
|
|
* @return string HTML code for form.
|
|
|
|
|
*
|
2019-10-30 16:56:44 +01:00
|
|
|
|
* @return void Runs loadWelcomeWindow (AJAX).
|
2019-10-18 10:30:19 +02:00
|
|
|
|
*/
|
|
|
|
|
public function loadWelcomeWindow()
|
|
|
|
|
{
|
|
|
|
|
global $config;
|
2019-10-30 18:33:33 +01:00
|
|
|
|
$btn_configure_mail_class = 'pending';
|
|
|
|
|
$btn_create_agent_class = 'pending';
|
2019-10-24 16:56:13 +02:00
|
|
|
|
$btn_create_module_class = '';
|
|
|
|
|
$btn_create_alert_class = '';
|
2019-10-30 18:33:33 +01:00
|
|
|
|
$btn_create_discovery_class = 'pending';
|
2019-10-24 16:56:13 +02:00
|
|
|
|
|
2019-11-07 10:42:46 +01:00
|
|
|
|
$li_configure_mail_class = 'green';
|
|
|
|
|
$li_create_agent_class = 'green';
|
|
|
|
|
$li_create_module_class = 'grey';
|
|
|
|
|
$li_create_alert_class = 'grey';
|
|
|
|
|
$li_create_discovery_class = 'green';
|
|
|
|
|
|
2019-11-07 14:05:42 +01:00
|
|
|
|
if (empty($config['welcome_mail_configured']) === false) {
|
|
|
|
|
$btn_configure_mail_class = ' completed';
|
|
|
|
|
}
|
2019-10-30 16:56:44 +01:00
|
|
|
|
|
2019-11-07 14:05:42 +01:00
|
|
|
|
if (empty($config['welcome_id_agent']) === false) {
|
|
|
|
|
$btn_create_agent_class = ' completed';
|
|
|
|
|
$btn_create_module_class = ' pending';
|
|
|
|
|
$li_create_module_class = 'green';
|
|
|
|
|
}
|
2019-10-30 16:56:44 +01:00
|
|
|
|
|
2019-11-07 14:05:42 +01:00
|
|
|
|
if (empty($config['welcome_module']) === false) {
|
|
|
|
|
$btn_create_module_class = ' completed';
|
|
|
|
|
$btn_create_alert_class = ' pending';
|
|
|
|
|
$li_create_module_class = 'green';
|
|
|
|
|
}
|
2019-10-30 16:56:44 +01:00
|
|
|
|
|
2019-11-07 14:05:42 +01:00
|
|
|
|
if (empty($config['welcome_alert']) === false) {
|
|
|
|
|
$btn_create_alert_class = ' completed';
|
|
|
|
|
$li_create_alert_class = 'green';
|
|
|
|
|
}
|
2019-10-30 16:56:44 +01:00
|
|
|
|
|
2019-11-07 14:05:42 +01:00
|
|
|
|
if (empty($config['welcome_task']) === false) {
|
|
|
|
|
$btn_create_discovery_class = ' completed';
|
|
|
|
|
}
|
2019-10-30 16:56:44 +01:00
|
|
|
|
|
2019-11-07 14:05:42 +01:00
|
|
|
|
if ((int) $config['welcome_state'] === WELCOME_FINISHED) {
|
|
|
|
|
// Nothing left to do.
|
|
|
|
|
$btn_configure_mail_class = ' completed';
|
|
|
|
|
$btn_create_agent_class = ' completed';
|
|
|
|
|
$btn_create_module_class = ' completed';
|
|
|
|
|
$btn_create_alert_class = ' completed';
|
|
|
|
|
$btn_create_discovery_class = ' completed';
|
|
|
|
|
$li_create_module_class = 'green';
|
|
|
|
|
$li_create_alert_class = 'green';
|
2019-10-24 16:56:13 +02:00
|
|
|
|
}
|
2019-10-18 10:30:19 +02:00
|
|
|
|
|
|
|
|
|
$form = [
|
|
|
|
|
'action' => '#',
|
|
|
|
|
'id' => 'welcome_form',
|
|
|
|
|
'onsubmit' => 'this.dialog("close");',
|
|
|
|
|
'class' => 'modal',
|
|
|
|
|
];
|
|
|
|
|
|
2019-11-07 10:42:46 +01:00
|
|
|
|
$logo_url = '';
|
|
|
|
|
if (enterprise_installed()) {
|
|
|
|
|
$logo_url = ENTERPRISE_DIR.'/';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$logo_url .= 'images/custom_logo/'.$config['custom_logo_white_bg'];
|
|
|
|
|
|
2019-10-18 10:30:19 +02:00
|
|
|
|
$inputs = [
|
2019-11-07 10:42:46 +01:00
|
|
|
|
[
|
|
|
|
|
'class' => 'white_box',
|
|
|
|
|
'block_content' => [
|
|
|
|
|
[
|
|
|
|
|
'class' => 'centered_full',
|
|
|
|
|
'arguments' => [
|
|
|
|
|
'type' => 'image',
|
|
|
|
|
'src' => $logo_url,
|
|
|
|
|
'value' => 1,
|
|
|
|
|
'return' => true,
|
|
|
|
|
],
|
|
|
|
|
],
|
|
|
|
|
],
|
|
|
|
|
],
|
2019-10-18 10:30:19 +02:00
|
|
|
|
[
|
|
|
|
|
'wrapper' => 'div',
|
|
|
|
|
'block_id' => 'div_configure_mail',
|
2019-11-07 10:42:46 +01:00
|
|
|
|
'class' => 'hole flex-row w100p '.$li_configure_mail_class,
|
2019-10-18 10:30:19 +02:00
|
|
|
|
'direct' => 1,
|
|
|
|
|
'block_content' => [
|
|
|
|
|
[
|
2019-10-21 18:36:02 +02:00
|
|
|
|
'label' => __('Please ensure mail configuration matches your needs'),
|
2019-10-18 10:30:19 +02:00
|
|
|
|
'arguments' => [
|
|
|
|
|
'class' => 'first_lbl',
|
|
|
|
|
'name' => 'lbl_create_agent',
|
|
|
|
|
'id' => 'lbl_create_agent',
|
|
|
|
|
],
|
|
|
|
|
],
|
|
|
|
|
[
|
|
|
|
|
'arguments' => [
|
2019-10-24 16:56:13 +02:00
|
|
|
|
'label' => '',
|
2019-10-18 10:30:19 +02:00
|
|
|
|
'type' => 'button',
|
2019-10-24 16:56:13 +02:00
|
|
|
|
'attributes' => 'class="go '.$btn_configure_mail_class.'"',
|
2019-10-18 10:30:19 +02:00
|
|
|
|
'name' => 'btn_email_conf',
|
|
|
|
|
'id' => 'btn_email_conf',
|
|
|
|
|
],
|
|
|
|
|
],
|
|
|
|
|
],
|
2019-11-07 10:42:46 +01:00
|
|
|
|
],
|
|
|
|
|
[
|
|
|
|
|
'label' => 'Learn to monitor',
|
|
|
|
|
'class' => 'extra',
|
|
|
|
|
'arguments' => [
|
|
|
|
|
'class' => 'class="lbl_learn"',
|
|
|
|
|
'name' => 'lbl_learn',
|
|
|
|
|
'id' => 'lbl_learn',
|
|
|
|
|
],
|
|
|
|
|
],
|
|
|
|
|
[
|
2019-10-18 10:30:19 +02:00
|
|
|
|
'wrapper' => 'div',
|
|
|
|
|
'block_id' => 'div_create_agent',
|
2019-11-07 10:42:46 +01:00
|
|
|
|
'class' => 'learn_content_indented flex-row w100p '.$li_create_agent_class,
|
2019-10-18 10:30:19 +02:00
|
|
|
|
'direct' => 1,
|
|
|
|
|
'block_content' => [
|
|
|
|
|
[
|
2019-10-21 18:36:02 +02:00
|
|
|
|
'label' => __('Create an agent'),
|
2019-10-18 10:30:19 +02:00
|
|
|
|
'arguments' => [
|
|
|
|
|
'class' => 'first_lbl',
|
|
|
|
|
'name' => 'lbl_create_agent',
|
|
|
|
|
'id' => 'lbl_create_agent',
|
|
|
|
|
],
|
|
|
|
|
],
|
|
|
|
|
[
|
|
|
|
|
'arguments' => [
|
2019-10-24 16:56:13 +02:00
|
|
|
|
'label' => '',
|
2019-10-18 10:30:19 +02:00
|
|
|
|
'type' => 'button',
|
2019-10-24 16:56:13 +02:00
|
|
|
|
'attributes' => 'class="go '.$btn_create_agent_class.'"',
|
2019-10-18 10:30:19 +02:00
|
|
|
|
'name' => 'btn_create_agent',
|
|
|
|
|
'id' => 'btn_create_agent',
|
|
|
|
|
],
|
|
|
|
|
],
|
|
|
|
|
],
|
|
|
|
|
],
|
|
|
|
|
[
|
|
|
|
|
'wrapper' => 'div',
|
|
|
|
|
'block_id' => 'div_monitor_actions',
|
2019-11-07 10:42:46 +01:00
|
|
|
|
'class' => 'learn_content_indented flex-row w100p '.$li_create_module_class,
|
2019-10-18 10:30:19 +02:00
|
|
|
|
'direct' => 1,
|
|
|
|
|
'block_content' => [
|
|
|
|
|
[
|
2019-10-21 18:36:02 +02:00
|
|
|
|
'label' => __('Create a module to check if an agent is online'),
|
2019-10-18 10:30:19 +02:00
|
|
|
|
'arguments' => [
|
|
|
|
|
'class' => 'second_lbl',
|
|
|
|
|
'name' => 'lbl_check_agent',
|
|
|
|
|
'id' => 'lbl_check_agent',
|
|
|
|
|
],
|
|
|
|
|
],
|
|
|
|
|
[
|
|
|
|
|
'arguments' => [
|
2019-10-24 16:56:13 +02:00
|
|
|
|
'label' => '',
|
2019-10-18 10:30:19 +02:00
|
|
|
|
'type' => 'button',
|
2019-10-24 16:56:13 +02:00
|
|
|
|
'attributes' => 'class="go '.$btn_create_module_class.'"',
|
|
|
|
|
'name' => 'btn_create_module',
|
|
|
|
|
'id' => 'btn_create_module',
|
2019-10-18 10:30:19 +02:00
|
|
|
|
],
|
|
|
|
|
],
|
|
|
|
|
],
|
|
|
|
|
],
|
|
|
|
|
[
|
|
|
|
|
'wrapper' => 'div',
|
|
|
|
|
'block_id' => 'div_monitor_actions',
|
2019-11-07 10:42:46 +01:00
|
|
|
|
'class' => 'hole learn_content_indented flex-row w100p '.$li_create_alert_class,
|
2019-10-18 10:30:19 +02:00
|
|
|
|
'direct' => 1,
|
|
|
|
|
'block_content' => [
|
|
|
|
|
[
|
2019-10-21 18:36:02 +02:00
|
|
|
|
'label' => __('Be warned if something is wrong, create an alert on the module'),
|
2019-10-18 10:30:19 +02:00
|
|
|
|
'arguments' => [
|
|
|
|
|
'class' => 'second_lbl',
|
|
|
|
|
'name' => 'lbl_create_alert',
|
|
|
|
|
'id' => 'lbl_create_alert',
|
|
|
|
|
],
|
|
|
|
|
],
|
|
|
|
|
[
|
|
|
|
|
'arguments' => [
|
2019-10-24 16:56:13 +02:00
|
|
|
|
'label' => '',
|
2019-10-18 10:30:19 +02:00
|
|
|
|
'type' => 'button',
|
2019-10-24 16:56:13 +02:00
|
|
|
|
'attributes' => 'class="go '.$btn_create_alert_class.'"',
|
2019-10-18 10:30:19 +02:00
|
|
|
|
'name' => 'btn_create_alert',
|
|
|
|
|
'id' => 'btn_create_alert',
|
|
|
|
|
],
|
|
|
|
|
],
|
|
|
|
|
],
|
|
|
|
|
],
|
|
|
|
|
[
|
|
|
|
|
'wrapper' => 'div',
|
|
|
|
|
'block_id' => 'div_discover',
|
2019-11-07 10:42:46 +01:00
|
|
|
|
'class' => 'hole flex-row w100p '.$li_create_discovery_class,
|
2019-10-18 10:30:19 +02:00
|
|
|
|
'direct' => 1,
|
|
|
|
|
'block_content' => [
|
|
|
|
|
[
|
2019-10-21 18:36:02 +02:00
|
|
|
|
'label' => __('Discover hosts and devices in your network'),
|
2019-10-18 10:30:19 +02:00
|
|
|
|
'arguments' => [
|
|
|
|
|
'class' => 'first_lbl',
|
|
|
|
|
'name' => 'lbl_discover_devices',
|
|
|
|
|
'id' => 'lbl_discover_devices',
|
|
|
|
|
],
|
|
|
|
|
],
|
|
|
|
|
[
|
|
|
|
|
'arguments' => [
|
2019-10-24 16:56:13 +02:00
|
|
|
|
'label' => '',
|
2019-10-18 10:30:19 +02:00
|
|
|
|
'type' => 'button',
|
2019-10-24 16:56:13 +02:00
|
|
|
|
'attributes' => 'class="go '.$btn_create_discovery_class.'"',
|
2019-10-18 10:30:19 +02:00
|
|
|
|
'name' => 'btn_discover_devices',
|
|
|
|
|
'id' => 'btn_discover_devices',
|
|
|
|
|
],
|
|
|
|
|
],
|
|
|
|
|
],
|
|
|
|
|
],
|
2019-11-13 14:32:34 +01:00
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
if (enterprise_installed()) {
|
|
|
|
|
$inputs[] = [
|
2019-10-18 10:30:19 +02:00
|
|
|
|
'wrapper' => 'div',
|
|
|
|
|
'block_id' => 'div_not_working',
|
2019-11-07 10:42:46 +01:00
|
|
|
|
'class' => 'hole flex-row w100p',
|
2019-10-18 10:30:19 +02:00
|
|
|
|
'direct' => 1,
|
|
|
|
|
'block_content' => [
|
|
|
|
|
[
|
2019-10-29 10:38:22 +01:00
|
|
|
|
'label' => __('If something is not working as expected, look for this icon and report!'),
|
2019-10-18 10:30:19 +02:00
|
|
|
|
'arguments' => [
|
|
|
|
|
'class' => 'first_lbl',
|
|
|
|
|
'name' => 'lbl_not_working',
|
|
|
|
|
'id' => 'lbl_not_working',
|
|
|
|
|
],
|
|
|
|
|
],
|
|
|
|
|
[
|
2019-10-30 18:33:33 +01:00
|
|
|
|
'label' => html_print_image(
|
|
|
|
|
'images/feedback-header.png',
|
|
|
|
|
true,
|
|
|
|
|
[
|
|
|
|
|
'onclick' => '$(\'#feedback-header\').click()',
|
|
|
|
|
'style' => 'cursor: pointer;',
|
|
|
|
|
]
|
|
|
|
|
),
|
2019-10-29 10:38:22 +01:00
|
|
|
|
|
2019-10-18 10:30:19 +02:00
|
|
|
|
],
|
|
|
|
|
],
|
2019-11-13 14:32:34 +01:00
|
|
|
|
];
|
|
|
|
|
}
|
2019-10-18 10:30:19 +02:00
|
|
|
|
|
|
|
|
|
$output = $this->printForm(
|
|
|
|
|
[
|
|
|
|
|
'form' => $form,
|
|
|
|
|
'inputs' => $inputs,
|
|
|
|
|
],
|
|
|
|
|
true
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
$output .= $this->loadJS();
|
|
|
|
|
echo $output;
|
|
|
|
|
|
|
|
|
|
// Ajax methods does not continue.
|
|
|
|
|
exit();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2019-10-24 16:56:13 +02:00
|
|
|
|
/**
|
2019-10-30 16:56:44 +01:00
|
|
|
|
* This function acts as a constructor. Receive the condition to check with
|
|
|
|
|
* the global config (welcome_state) if continues
|
|
|
|
|
*
|
|
|
|
|
* @param boolean $must_run Must be run or not (check register.php).
|
|
|
|
|
*
|
|
|
|
|
* @return boolean True if initialized or false if must not run.
|
2019-10-24 16:56:13 +02:00
|
|
|
|
*/
|
2019-10-30 16:56:44 +01:00
|
|
|
|
public function initialize($must_run)
|
2019-10-21 18:36:02 +02:00
|
|
|
|
{
|
2019-10-24 16:56:13 +02:00
|
|
|
|
global $config;
|
|
|
|
|
|
2019-10-30 18:33:33 +01:00
|
|
|
|
if (isset($config['welcome_state']) === false) {
|
2019-11-07 14:05:42 +01:00
|
|
|
|
$this->completeStep();
|
2019-10-30 18:33:33 +01:00
|
|
|
|
$this->setStep(W_CONFIGURE_MAIL);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Check current page.
|
|
|
|
|
$sec2 = get_parameter('sec2', '');
|
|
|
|
|
|
2019-11-07 10:42:46 +01:00
|
|
|
|
// Search also does not fulfill sec2.
|
|
|
|
|
if (empty($sec2) === true) {
|
|
|
|
|
$sec2 = get_parameter('keywords', '');
|
|
|
|
|
}
|
|
|
|
|
|
2019-10-30 16:56:44 +01:00
|
|
|
|
if ($must_run === false
|
2019-11-07 14:05:42 +01:00
|
|
|
|
|| ((int) $config['welcome_state']) === WELCOME_FINISHED
|
2019-10-30 16:56:44 +01:00
|
|
|
|
) {
|
2019-10-30 18:33:33 +01:00
|
|
|
|
// Do not show if finished.
|
2019-10-30 16:56:44 +01:00
|
|
|
|
return false;
|
2019-10-24 16:56:13 +02:00
|
|
|
|
}
|
|
|
|
|
|
2019-10-30 16:56:44 +01:00
|
|
|
|
$this->step = $this->getStep();
|
|
|
|
|
$this->agent = $this->getWelcomeAgent();
|
2019-10-21 18:36:02 +02:00
|
|
|
|
|
2019-10-30 16:56:44 +01:00
|
|
|
|
/*
|
|
|
|
|
* Configure mail. Control current flow.
|
|
|
|
|
*
|
|
|
|
|
* On empty sec2: show current step.
|
|
|
|
|
* On setup page: do not show.
|
|
|
|
|
* After mail configuration: enable agent step.
|
|
|
|
|
*/
|
|
|
|
|
|
2019-11-07 14:05:42 +01:00
|
|
|
|
if ($this->step === W_CONFIGURE_MAIL) {
|
2019-10-30 16:56:44 +01:00
|
|
|
|
if ($sec2 === 'godmode/setup/setup'
|
|
|
|
|
&& get_parameter('section', '') == 'general'
|
|
|
|
|
&& get_parameter('update_config', false) !== false
|
|
|
|
|
) {
|
|
|
|
|
// Mail configuration have been processed.
|
2019-11-07 14:05:42 +01:00
|
|
|
|
$this->step = W_CONFIGURE_MAIL;
|
|
|
|
|
$this->completeStep();
|
2019-10-30 16:56:44 +01:00
|
|
|
|
$this->setStep(W_CREATE_AGENT);
|
|
|
|
|
} else if ($sec2 === 'godmode/setup/setup'
|
|
|
|
|
&& get_parameter('section', '') === 'general'
|
|
|
|
|
) {
|
|
|
|
|
// Mail configuration is being processed.
|
|
|
|
|
return false;
|
2019-10-30 18:33:33 +01:00
|
|
|
|
} else if (empty($sec2) === true) {
|
2019-11-07 14:05:42 +01:00
|
|
|
|
// Show main page.
|
2019-10-30 16:56:44 +01:00
|
|
|
|
return true;
|
2019-10-24 16:56:13 +02:00
|
|
|
|
}
|
2019-10-30 16:56:44 +01:00
|
|
|
|
}
|
2019-10-21 18:36:02 +02:00
|
|
|
|
|
2019-10-30 16:56:44 +01:00
|
|
|
|
/*
|
|
|
|
|
* Create agent. Control current flow.
|
|
|
|
|
*
|
2019-11-07 10:42:46 +01:00
|
|
|
|
* Welcome wizard is shown if you create your first agent.
|
|
|
|
|
*
|
2019-10-30 16:56:44 +01:00
|
|
|
|
*/
|
|
|
|
|
|
2019-11-07 10:42:46 +01:00
|
|
|
|
if (empty($config['welcome_id_agent']) === true) {
|
2019-10-30 16:56:44 +01:00
|
|
|
|
// Create agent is pending.
|
|
|
|
|
if ($sec2 === 'godmode/agentes/configurar_agente'
|
|
|
|
|
&& get_parameter('create_agent', false) !== false
|
|
|
|
|
) {
|
|
|
|
|
// Agent have been created. Store.
|
2019-11-07 14:05:42 +01:00
|
|
|
|
// Here complete step is not needed because is already done
|
|
|
|
|
// by setWelcomeAgent.
|
2019-10-30 16:56:44 +01:00
|
|
|
|
$this->setWelcomeAgent(
|
2019-11-07 14:05:42 +01:00
|
|
|
|
// Non yet processed. Get next available ID.
|
|
|
|
|
db_get_value_sql(
|
|
|
|
|
sprintf(
|
|
|
|
|
'SELECT AUTO_INCREMENT
|
|
|
|
|
FROM information_schema.TABLES
|
|
|
|
|
WHERE TABLE_SCHEMA = "%s"
|
|
|
|
|
AND TABLE_NAME = "%s"',
|
|
|
|
|
$config['dbname'],
|
|
|
|
|
'tagente'
|
|
|
|
|
)
|
2019-10-30 16:56:44 +01:00
|
|
|
|
)
|
|
|
|
|
);
|
|
|
|
|
$this->setStep(W_CREATE_MODULE);
|
|
|
|
|
return true;
|
|
|
|
|
} else if ($sec2 === 'godmode/agentes/configurar_agente') {
|
|
|
|
|
// Agent is being created.
|
|
|
|
|
return false;
|
2019-10-30 18:33:33 +01:00
|
|
|
|
} else if (empty($sec2) === true) {
|
|
|
|
|
// If at main page, show welcome.
|
2019-10-30 16:56:44 +01:00
|
|
|
|
return true;
|
2019-10-24 16:56:13 +02:00
|
|
|
|
}
|
2019-11-07 14:05:42 +01:00
|
|
|
|
} else if ($this->step === W_CREATE_AGENT) {
|
|
|
|
|
$this->step = W_CREATE_MODULE;
|
2019-10-30 16:56:44 +01:00
|
|
|
|
}
|
2019-10-21 18:36:02 +02:00
|
|
|
|
|
2019-10-30 16:56:44 +01:00
|
|
|
|
/*
|
|
|
|
|
* Create module. Control current flow.
|
|
|
|
|
*
|
|
|
|
|
* On empty sec2: show current step.
|
|
|
|
|
* On module creation page: do not show.
|
|
|
|
|
* After module creation: enable alert step.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
if ($this->step === W_CREATE_MODULE) {
|
|
|
|
|
// Create module is pending.
|
|
|
|
|
if ($sec2 === 'godmode/agentes/configurar_agente'
|
|
|
|
|
&& get_parameter('tab', '') === 'module'
|
|
|
|
|
&& get_parameter('create_module', false) !== false
|
|
|
|
|
) {
|
|
|
|
|
// Module have been created.
|
2019-11-07 14:05:42 +01:00
|
|
|
|
$this->completeStep();
|
2019-10-30 16:56:44 +01:00
|
|
|
|
$this->setStep(W_CREATE_ALERT);
|
|
|
|
|
return true;
|
|
|
|
|
} else if ($sec2 === 'godmode/agentes/configurar_agente'
|
|
|
|
|
&& get_parameter('tab', '') === 'module'
|
|
|
|
|
) {
|
|
|
|
|
// Module is being created.
|
|
|
|
|
return false;
|
2019-10-30 18:33:33 +01:00
|
|
|
|
} else if (empty($sec2) === true) {
|
|
|
|
|
// If at main page, show welcome.
|
2019-10-30 16:56:44 +01:00
|
|
|
|
return true;
|
2019-10-24 16:56:13 +02:00
|
|
|
|
}
|
2019-10-30 16:56:44 +01:00
|
|
|
|
}
|
2019-10-21 18:36:02 +02:00
|
|
|
|
|
2019-10-30 16:56:44 +01:00
|
|
|
|
/*
|
|
|
|
|
* Create alert. Control current flow.
|
|
|
|
|
*
|
|
|
|
|
* On empty sec2: show current step.
|
|
|
|
|
* On alert creation page: do not show.
|
|
|
|
|
* After alert creation: enable discovery task step.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
if ($this->step === W_CREATE_ALERT) {
|
|
|
|
|
// Create alert is pending.
|
|
|
|
|
if ($sec2 === 'godmode/agentes/configurar_agente'
|
|
|
|
|
&& get_parameter('tab', '') === 'alert'
|
|
|
|
|
&& get_parameter('create_alert', false) !== false
|
|
|
|
|
) {
|
|
|
|
|
// Alert have been created.
|
2019-11-07 14:05:42 +01:00
|
|
|
|
$this->completeStep();
|
2019-10-30 16:56:44 +01:00
|
|
|
|
$this->setStep(W_CREATE_TASK);
|
|
|
|
|
return true;
|
|
|
|
|
} else if ($sec2 === 'godmode/agentes/configurar_agente'
|
|
|
|
|
&& get_parameter('tab', '') === 'alert'
|
|
|
|
|
) {
|
|
|
|
|
// Alert is being created.
|
|
|
|
|
return false;
|
2019-10-30 18:33:33 +01:00
|
|
|
|
} else if (empty($sec2) === true) {
|
|
|
|
|
// If at main page, show welcome.
|
2019-10-30 16:56:44 +01:00
|
|
|
|
return true;
|
2019-10-24 16:56:13 +02:00
|
|
|
|
}
|
2019-10-30 16:56:44 +01:00
|
|
|
|
}
|
2019-10-24 16:56:13 +02:00
|
|
|
|
|
2019-10-30 16:56:44 +01:00
|
|
|
|
/*
|
|
|
|
|
* Create discovery task. Control current flow.
|
|
|
|
|
*
|
|
|
|
|
* On empty sec2: show current step.
|
|
|
|
|
* On discovery task creation page: do not show.
|
|
|
|
|
* After discovery task creation: finish.
|
|
|
|
|
*/
|
|
|
|
|
|
2019-11-07 14:05:42 +01:00
|
|
|
|
// Create Discovery task is pending.
|
|
|
|
|
// Host&Devices finishses on page 2.
|
|
|
|
|
if ($sec2 === 'godmode/servers/discovery'
|
|
|
|
|
&& get_parameter('page', 0) == 2
|
|
|
|
|
) {
|
|
|
|
|
// Discovery task have been created.
|
|
|
|
|
$this->step = W_CREATE_TASK;
|
|
|
|
|
$this->completeStep();
|
2019-10-30 16:56:44 +01:00
|
|
|
|
|
2019-11-07 14:05:42 +01:00
|
|
|
|
// Check if all other tasks had been completed.
|
|
|
|
|
if ($this->checkAllTasks() === true) {
|
2019-10-30 16:56:44 +01:00
|
|
|
|
// Finished! do not show.
|
2019-11-07 14:05:42 +01:00
|
|
|
|
$this->setStep(WELCOME_FINISHED);
|
2019-10-24 16:56:13 +02:00
|
|
|
|
return false;
|
|
|
|
|
}
|
2019-11-07 14:05:42 +01:00
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
} else if ($sec2 == 'godmode/servers/discovery') {
|
|
|
|
|
// Discovery task is being created.
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Check if all other tasks had been completed.
|
|
|
|
|
if ($this->checkAllTasks() === true) {
|
|
|
|
|
// Finished! do not show.
|
|
|
|
|
$this->setStep(WELCOME_FINISHED);
|
|
|
|
|
return false;
|
2019-11-11 13:46:42 +01:00
|
|
|
|
} else if (empty($sec2) === true) {
|
|
|
|
|
// Pending tasks.
|
|
|
|
|
return true;
|
2019-10-22 16:42:13 +02:00
|
|
|
|
}
|
|
|
|
|
|
2019-10-30 16:56:44 +01:00
|
|
|
|
if ($this->step === WELCOME_FINISHED) {
|
|
|
|
|
// Welcome tutorial finished.
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2019-10-24 16:56:13 +02:00
|
|
|
|
// Return a reference to the new object.
|
2019-10-30 16:56:44 +01:00
|
|
|
|
return false;
|
2019-10-21 18:36:02 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2019-10-24 16:56:13 +02:00
|
|
|
|
/**
|
2019-10-30 16:56:44 +01:00
|
|
|
|
* Load JS content.
|
|
|
|
|
* function that enables the functions to the buttons when its action is
|
|
|
|
|
* completed.
|
|
|
|
|
* Assign the url of each button.
|
|
|
|
|
*
|
|
|
|
|
* @return string HTML code for javascript functionality.
|
2019-10-24 16:56:13 +02:00
|
|
|
|
*/
|
2019-10-18 10:30:19 +02:00
|
|
|
|
public function loadJS()
|
|
|
|
|
{
|
|
|
|
|
ob_start();
|
|
|
|
|
?>
|
|
|
|
|
<script type="text/javascript">
|
2019-10-30 16:56:44 +01:00
|
|
|
|
<?php
|
2019-10-30 18:33:33 +01:00
|
|
|
|
if ($this->step > W_CREATE_AGENT) {
|
|
|
|
|
switch ($this->step) {
|
|
|
|
|
case W_CREATE_MODULE:
|
|
|
|
|
?>
|
2019-10-30 16:56:44 +01:00
|
|
|
|
document.getElementById("button-btn_create_module").setAttribute(
|
|
|
|
|
'onclick',
|
|
|
|
|
'checkAgentOnline()'
|
|
|
|
|
);
|
2019-10-30 18:33:33 +01:00
|
|
|
|
<?php
|
|
|
|
|
break;
|
2019-10-30 16:56:44 +01:00
|
|
|
|
|
2019-10-30 18:33:33 +01:00
|
|
|
|
case W_CREATE_ALERT:
|
|
|
|
|
?>
|
2019-10-30 16:56:44 +01:00
|
|
|
|
document.getElementById("button-btn_create_alert").setAttribute(
|
|
|
|
|
'onclick',
|
|
|
|
|
'createAlertModule()'
|
|
|
|
|
);
|
2019-10-30 18:33:33 +01:00
|
|
|
|
<?php
|
|
|
|
|
break;
|
2019-10-30 16:56:44 +01:00
|
|
|
|
|
2019-10-30 18:33:33 +01:00
|
|
|
|
default:
|
|
|
|
|
// Ignore.
|
|
|
|
|
break;
|
|
|
|
|
}
|
2019-10-30 16:56:44 +01:00
|
|
|
|
}
|
|
|
|
|
?>
|
2019-10-21 18:36:02 +02:00
|
|
|
|
|
2019-10-30 18:33:33 +01:00
|
|
|
|
document.getElementById("button-btn_email_conf").setAttribute(
|
|
|
|
|
'onclick',
|
|
|
|
|
'configureEmail()'
|
|
|
|
|
);
|
|
|
|
|
document.getElementById("button-btn_create_agent").setAttribute(
|
|
|
|
|
'onclick',
|
|
|
|
|
'createNewAgent()'
|
|
|
|
|
);
|
|
|
|
|
document.getElementById("button-btn_discover_devices").setAttribute(
|
|
|
|
|
'onclick',
|
|
|
|
|
'discoverDevicesNetwork()'
|
|
|
|
|
);
|
|
|
|
|
|
2019-10-21 18:36:02 +02:00
|
|
|
|
function configureEmail() {
|
2019-10-24 16:56:13 +02:00
|
|
|
|
window.location = '<?php echo ui_get_full_url('index.php?sec=general&sec2=godmode/setup/setup§ion=general#table3'); ?>';
|
2019-10-21 18:36:02 +02:00
|
|
|
|
}
|
|
|
|
|
|
2019-10-24 16:56:13 +02:00
|
|
|
|
function createNewAgent() {
|
|
|
|
|
window.location = '<?php echo ui_get_full_url('index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&new_agent=1&crt-2=Create+agent'); ?>';
|
2019-10-18 10:30:19 +02:00
|
|
|
|
}
|
|
|
|
|
|
2019-10-24 16:56:13 +02:00
|
|
|
|
function checkAgentOnline() {
|
2019-10-30 16:56:44 +01:00
|
|
|
|
window.location = '<?php echo ui_get_full_url('index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=module&id_agente='.$this->getWelcomeAgent().''); ?>';
|
2019-10-18 10:30:19 +02:00
|
|
|
|
}
|
|
|
|
|
|
2019-10-24 16:56:13 +02:00
|
|
|
|
function createAlertModule() {
|
2019-10-30 16:56:44 +01:00
|
|
|
|
window.location = '<?php echo ui_get_full_url('index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=alert&id_agente='.$this->getWelcomeAgent().''); ?>';
|
2019-10-18 10:30:19 +02:00
|
|
|
|
}
|
|
|
|
|
|
2019-10-24 16:56:13 +02:00
|
|
|
|
function monitorRemoteCommands() {
|
|
|
|
|
window.location = '<?php echo ui_get_full_url(''); ?>';
|
2019-10-18 10:30:19 +02:00
|
|
|
|
}
|
|
|
|
|
|
2019-10-24 16:56:13 +02:00
|
|
|
|
function discoverDevicesNetwork() {
|
|
|
|
|
window.location = '<?php echo ui_get_full_url('index.php?sec=gservers&sec2=godmode/servers/discovery&wiz=hd&mode=netscan'); ?>';
|
2019-10-18 10:30:19 +02:00
|
|
|
|
}
|
|
|
|
|
|
2019-10-24 16:56:13 +02:00
|
|
|
|
function reportIsNotWorking() {
|
2019-10-18 10:30:19 +02:00
|
|
|
|
}
|
|
|
|
|
|
2019-10-28 18:57:10 +01:00
|
|
|
|
function cierre_dialog(){
|
|
|
|
|
this.dialog("close");
|
|
|
|
|
}
|
2019-10-18 10:30:19 +02:00
|
|
|
|
</script>
|
|
|
|
|
<?php
|
|
|
|
|
return ob_get_clean();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|