mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-31 01:35:36 +02:00
first changed to welcome window
This commit is contained in:
parent
361f2022f4
commit
353246f9f6
77
pandora_console/general/new_installation_welcome_window.php
Normal file
77
pandora_console/general/new_installation_welcome_window.php
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Credential store
|
||||||
|
*
|
||||||
|
* @category NewInstallationWelcomeWindow
|
||||||
|
* @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.
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class NewInstallationWelcomeWindow.
|
||||||
|
*/
|
||||||
|
|
||||||
|
global $config;
|
||||||
|
|
||||||
|
require_once $config['homedir'].'/include/class/NewInstallationWelcomeWindow.class.php';
|
||||||
|
|
||||||
|
$ajaxPage = 'general/new_installation_welcome_window';
|
||||||
|
|
||||||
|
// Control call flow.
|
||||||
|
try {
|
||||||
|
// User access and validation is being processed on class constructor.
|
||||||
|
$welcome_actions = new NewInstallationWelcomeWindow($ajaxPage);
|
||||||
|
} catch (Exception $e) {
|
||||||
|
if (is_ajax()) {
|
||||||
|
echo json_encode(['error' => '[NewInstallationWelcomeWindow]'.$e->getMessage() ]);
|
||||||
|
exit;
|
||||||
|
} else {
|
||||||
|
echo '[NewInstallationWelcomeWindow]'.$e->getMessage();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Stop this execution, but continue 'globally'.
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Ajax controller.
|
||||||
|
if (is_ajax()) {
|
||||||
|
$method = get_parameter('method', '');
|
||||||
|
|
||||||
|
if (method_exists($welcome_actions, $method) === true) {
|
||||||
|
if ($welcome_actions->ajaxMethod($method) === true) {
|
||||||
|
$welcome_actions->{$method}();
|
||||||
|
} else {
|
||||||
|
$welcome_actions->error('Unavailable method.');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$welcome_actions->error('Method not found. ['.$method.']');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Stop any execution.
|
||||||
|
exit;
|
||||||
|
} else {
|
||||||
|
// Run.
|
||||||
|
$welcome_actions->run();
|
||||||
|
}
|
@ -30,6 +30,7 @@
|
|||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
require_once $config['homedir'].'/include/functions_update_manager.php';
|
require_once $config['homedir'].'/include/functions_update_manager.php';
|
||||||
|
require_once $config['homedir'].'/include/class/NewInstallationWelcomeWindow.class.php';
|
||||||
|
|
||||||
|
|
||||||
if (is_ajax()) {
|
if (is_ajax()) {
|
||||||
@ -122,6 +123,8 @@ if (is_ajax()) {
|
|||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
ui_require_css_file('register');
|
ui_require_css_file('register');
|
||||||
|
|
||||||
$initial = isset($config['initial_wizard']) !== true
|
$initial = isset($config['initial_wizard']) !== true
|
||||||
@ -170,6 +173,15 @@ if (!$config['disabled_newsletter']) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$welcome = !$registration && $initial;
|
||||||
|
$welcome = true;
|
||||||
|
if ($welcome && users_is_admin()) {
|
||||||
|
$welcome = new NewInstallationWelcomeWindow(
|
||||||
|
'general/new_installation_welcome_window'
|
||||||
|
);
|
||||||
|
$welcome->run();
|
||||||
|
}
|
||||||
|
|
||||||
$newsletter = null;
|
$newsletter = null;
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
@ -404,13 +404,42 @@ class Wizard
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Print a block of inputs.
|
* Print a block of inputs.
|
||||||
|
* Example, using direct to 'anidate' inputs directly to wrapper:
|
||||||
|
* [
|
||||||
|
* 'wrapper' => 'div',
|
||||||
|
* 'block_id' => 'example_id',
|
||||||
|
* 'class' => 'your class',
|
||||||
|
* 'direct' => 1,
|
||||||
|
* 'block_content' => [
|
||||||
|
* [
|
||||||
|
* 'arguments' => [
|
||||||
|
* 'label' => __('Sugesstion'),
|
||||||
|
* 'type' => 'button',
|
||||||
|
* 'attributes' => 'class="sub ok btn_sug"',
|
||||||
|
* 'name' => 'option_1',
|
||||||
|
* 'id' => 'option_1',
|
||||||
|
* 'script' => 'change_option1()',
|
||||||
|
* ],
|
||||||
|
* ],
|
||||||
|
* [
|
||||||
|
* 'arguments' => [
|
||||||
|
* 'label' => __('Something is not quite right'),
|
||||||
|
* 'type' => 'button',
|
||||||
|
* 'attributes' => 'class="sub ok btn_something"',
|
||||||
|
* 'name' => 'option_2',
|
||||||
|
* 'id' => 'option_2',
|
||||||
|
* 'script' => 'change_option2()',
|
||||||
|
* ],
|
||||||
|
* ],
|
||||||
|
* ],
|
||||||
|
* ].
|
||||||
*
|
*
|
||||||
* @param array $input Definition of target block to be printed.
|
* @param array $input Definition of target block to be printed.
|
||||||
* @param boolean $return Return as string or direct output.
|
* @param boolean $return Return as string or direct output.
|
||||||
*
|
*
|
||||||
* @return string HTML content.
|
* @return string HTML content.
|
||||||
*/
|
*/
|
||||||
public function printBlock(array $input, bool $return=false)
|
public function printBlock(array $input, bool $return=false, bool $not_direct=false)
|
||||||
{
|
{
|
||||||
$output = '';
|
$output = '';
|
||||||
if ($input['hidden'] == 1) {
|
if ($input['hidden'] == 1) {
|
||||||
@ -424,33 +453,47 @@ class Wizard
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (is_array($input['block_content']) === true) {
|
if (is_array($input['block_content']) === true) {
|
||||||
|
$not_direct = (bool) $input['direct'];
|
||||||
|
|
||||||
// Print independent block of inputs.
|
// Print independent block of inputs.
|
||||||
|
$output .= '<li id="li-'.$input['block_id'].'" class="'.$class.'">';
|
||||||
|
|
||||||
if ($input['wrapper']) {
|
if ($input['wrapper']) {
|
||||||
$output .= '<li id="li-'.$input['block_id'].'" class="'.$class.'">';
|
|
||||||
$output .= '<'.$input['wrapper'].' id="'.$input['block_id'].'" class="'.$class.'">';
|
$output .= '<'.$input['wrapper'].' id="'.$input['block_id'].'" class="'.$class.'">';
|
||||||
} else {
|
|
||||||
$output .= '<li id="'.$input['block_id'].'" class="'.$class.'">';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$output .= '<ul class="wizard '.$input['block_class'].'">';
|
if (!$not_direct) {
|
||||||
|
// Avoid encapsulation if input is direct => 1.
|
||||||
|
$output .= '<ul class="wizard '.$input['block_class'].'">';
|
||||||
|
}
|
||||||
|
|
||||||
foreach ($input['block_content'] as $input) {
|
foreach ($input['block_content'] as $input) {
|
||||||
$output .= $this->printBlock($input, $return);
|
$output .= $this->printBlock($input, $return, (bool) $not_direct);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Close block.
|
// Close block.
|
||||||
if ($input['wrapper']) {
|
if (!$not_direct) {
|
||||||
$output .= '</ul></'.$input['wrapper'].'>';
|
$output .= '</ul>';
|
||||||
} else {
|
|
||||||
$output .= '</ul></li>';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($input['wrapper']) {
|
||||||
|
$output .= '</'.$input['wrapper'].'>';
|
||||||
|
}
|
||||||
|
|
||||||
|
$output .= '</li>';
|
||||||
} else {
|
} else {
|
||||||
if ($input['arguments']['type'] != 'hidden') {
|
if ($input['arguments']['type'] != 'hidden') {
|
||||||
$output .= '<li id="'.$input['id'].'" class="'.$class.'">';
|
if (!$not_direct) {
|
||||||
|
$output .= '<li id="'.$input['id'].'" class="'.$class.'">';
|
||||||
|
}
|
||||||
|
|
||||||
$output .= '<label>'.$input['label'].'</label>';
|
$output .= '<label>'.$input['label'].'</label>';
|
||||||
$output .= $this->printInput($input['arguments']);
|
$output .= $this->printInput($input['arguments']);
|
||||||
// Allow dynamic content.
|
// Allow dynamic content.
|
||||||
$output .= $input['extra'];
|
$output .= $input['extra'];
|
||||||
$output .= '</li>';
|
if (!$not_direct) {
|
||||||
|
$output .= '</li>';
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
$output .= $this->printInput($input['arguments']);
|
$output .= $this->printInput($input['arguments']);
|
||||||
// Allow dynamic content.
|
// Allow dynamic content.
|
||||||
|
@ -0,0 +1,423 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Credential store
|
||||||
|
*
|
||||||
|
* @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';
|
||||||
|
ui_require_css_file('pandora');
|
||||||
|
/**
|
||||||
|
* Class NewInstallationWelcomeWindow.
|
||||||
|
*/
|
||||||
|
class NewInstallationWelcomeWindow extends Wizard
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Allowed methods to be called using AJAX request.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
public $AJAXMethods = ['loadWelcomeWindow'];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Url of controller.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $ajaxController;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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();
|
||||||
|
|
||||||
|
if (! check_acl($config['id_user'], 0, 'AR')) {
|
||||||
|
db_pandora_audit(
|
||||||
|
'ACL Violation',
|
||||||
|
'Trying to access event viewer'
|
||||||
|
);
|
||||||
|
|
||||||
|
if (is_ajax()) {
|
||||||
|
echo json_encode(['error' => 'noaccess']);
|
||||||
|
}
|
||||||
|
|
||||||
|
include 'general/noaccess.php';
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
return in_array($method, $this->AJAXMethods);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor.
|
||||||
|
*
|
||||||
|
* @param string $ajax_controller Controller.
|
||||||
|
*
|
||||||
|
* @return object
|
||||||
|
*/
|
||||||
|
public function __construct($ajax_controller)
|
||||||
|
{
|
||||||
|
$this->ajaxController = $ajax_controller;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Main method.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function run()
|
||||||
|
{
|
||||||
|
ui_require_css_file('new_installation_welcome_window');
|
||||||
|
|
||||||
|
echo '<div id="welcome_modal_window" style="display: none"; >';
|
||||||
|
?>
|
||||||
|
<script type="text/javascript">
|
||||||
|
load_modal({
|
||||||
|
target: $('#welcome_modal_window'),
|
||||||
|
url: '<?php echo ui_get_full_url('ajax.php', false, false, false); ?>',
|
||||||
|
ajax_callback: function() {
|
||||||
|
console.log("se dispara callback");
|
||||||
|
},
|
||||||
|
modal: {
|
||||||
|
title: "<?php echo __('Welcome to Pandora FMS'); ?>",
|
||||||
|
ok: '<?php echo __('OK'); ?>',
|
||||||
|
},
|
||||||
|
onshow: {
|
||||||
|
page: '<?php echo $this->ajaxController; ?>',
|
||||||
|
method: 'loadWelcomeWindow'
|
||||||
|
},
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
echo '</div>';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Loads a welcome window form
|
||||||
|
*
|
||||||
|
* @return string HTML code for form.
|
||||||
|
*
|
||||||
|
* @return Function loadWelcomeWindow.
|
||||||
|
*/
|
||||||
|
public function loadWelcomeWindow()
|
||||||
|
{
|
||||||
|
global $config;
|
||||||
|
|
||||||
|
$form = [
|
||||||
|
'action' => '#',
|
||||||
|
'id' => 'welcome_form',
|
||||||
|
'onsubmit' => 'this.dialog("close");',
|
||||||
|
'class' => 'modal',
|
||||||
|
];
|
||||||
|
|
||||||
|
$inputs = [
|
||||||
|
[
|
||||||
|
'wrapper' => 'div',
|
||||||
|
'block_id' => 'div_configure_mail',
|
||||||
|
'class' => 'content_position',
|
||||||
|
'direct' => 1,
|
||||||
|
'block_content' => [
|
||||||
|
[
|
||||||
|
'label' => 'Set up your Email',
|
||||||
|
'arguments' => [
|
||||||
|
'class' => 'first_lbl',
|
||||||
|
'name' => 'lbl_create_agent',
|
||||||
|
'id' => 'lbl_create_agent',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'arguments' => [
|
||||||
|
'label' => __(''),
|
||||||
|
'type' => 'button',
|
||||||
|
'attributes' => 'class="btn_email_conf"',
|
||||||
|
'name' => 'btn_email_conf',
|
||||||
|
'id' => 'btn_email_conf',
|
||||||
|
'script' => 'configureEmail()"',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
],
|
||||||
|
],[
|
||||||
|
'wrapper' => 'div',
|
||||||
|
'block_id' => 'div_create_agent',
|
||||||
|
'class' => 'content_position',
|
||||||
|
'direct' => 1,
|
||||||
|
'block_content' => [
|
||||||
|
[
|
||||||
|
'label' => 'Create an agent',
|
||||||
|
'arguments' => [
|
||||||
|
'class' => 'first_lbl',
|
||||||
|
'name' => 'lbl_create_agent',
|
||||||
|
'id' => 'lbl_create_agent',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'arguments' => [
|
||||||
|
'label' => __(''),
|
||||||
|
'type' => 'button',
|
||||||
|
'attributes' => 'class="btn_agent"',
|
||||||
|
'name' => 'btn_create_agent',
|
||||||
|
'id' => 'btn_create_agent',
|
||||||
|
'script' => 'createNewAgent()"',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
],
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'label' => 'Learn to monitor',
|
||||||
|
'arguments' => [
|
||||||
|
'class' => 'class="lbl_learn"',
|
||||||
|
'name' => 'lbl_learn',
|
||||||
|
'id' => 'lbl_learn',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'wrapper' => 'div',
|
||||||
|
'block_id' => 'div_monitor_actions',
|
||||||
|
'class' => 'learn_content_position',
|
||||||
|
'direct' => 1,
|
||||||
|
'block_content' => [
|
||||||
|
[
|
||||||
|
'label' => 'Check if an agent is online',
|
||||||
|
'arguments' => [
|
||||||
|
'class' => 'second_lbl',
|
||||||
|
'name' => 'lbl_check_agent',
|
||||||
|
'id' => 'lbl_check_agent',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'arguments' => [
|
||||||
|
'label' => __(''),
|
||||||
|
'type' => 'button',
|
||||||
|
'attributes' => 'class="btn_agent_online"',
|
||||||
|
'name' => 'btn_check_agent',
|
||||||
|
'id' => 'btn_check_agent',
|
||||||
|
'script' => 'checkAgentOnline()',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
],
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'wrapper' => 'div',
|
||||||
|
'block_id' => 'div_monitor_actions',
|
||||||
|
'class' => 'learn_content_position',
|
||||||
|
'direct' => 1,
|
||||||
|
'block_content' => [
|
||||||
|
[
|
||||||
|
'label' => 'Create an alert on a module',
|
||||||
|
'arguments' => [
|
||||||
|
'class' => 'second_lbl',
|
||||||
|
'name' => 'lbl_create_alert',
|
||||||
|
'id' => 'lbl_create_alert',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'arguments' => [
|
||||||
|
'label' => __(''),
|
||||||
|
'type' => 'button',
|
||||||
|
'attributes' => 'class="btn_alert_module"',
|
||||||
|
'name' => 'btn_create_alert',
|
||||||
|
'id' => 'btn_create_alert',
|
||||||
|
'script' => 'createAlertModule()',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
],
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'wrapper' => 'div',
|
||||||
|
'block_id' => 'div_monitor_actions',
|
||||||
|
'class' => 'learn_content_position',
|
||||||
|
'direct' => 1,
|
||||||
|
'block_content' => [
|
||||||
|
[
|
||||||
|
'label' => 'Monitor remote commmands',
|
||||||
|
'arguments' => [
|
||||||
|
'class' => 'lbl_monitor_commands',
|
||||||
|
'name' => 'lbl_monitor_commands',
|
||||||
|
'id' => 'lbl_monitor_commands',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'arguments' => [
|
||||||
|
'label' => __(''),
|
||||||
|
'type' => 'button',
|
||||||
|
'attributes' => 'class="btn_remote-command"',
|
||||||
|
'name' => 'btn_monitor_commmands',
|
||||||
|
'id' => 'btn_monitor_commmands',
|
||||||
|
'script' => 'monitorRemoteCommands()',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
],
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'wrapper' => 'div',
|
||||||
|
'block_id' => 'div_discover',
|
||||||
|
'class' => 'content_position',
|
||||||
|
'direct' => 1,
|
||||||
|
'block_content' => [
|
||||||
|
[
|
||||||
|
'label' => 'Discover hosts and devices in your network',
|
||||||
|
'arguments' => [
|
||||||
|
'class' => 'first_lbl',
|
||||||
|
'name' => 'lbl_discover_devices',
|
||||||
|
'id' => 'lbl_discover_devices',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'arguments' => [
|
||||||
|
'label' => __(''),
|
||||||
|
'type' => 'button',
|
||||||
|
'attributes' => 'class="btn_discover"',
|
||||||
|
'name' => 'btn_discover_devices',
|
||||||
|
'id' => 'btn_discover_devices',
|
||||||
|
'script' => 'discoverDevicesNetwork()',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
],
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'wrapper' => 'div',
|
||||||
|
'block_id' => 'div_not_working',
|
||||||
|
'class' => 'content_position',
|
||||||
|
'direct' => 1,
|
||||||
|
'block_content' => [
|
||||||
|
[
|
||||||
|
'label' => 'If something is not working as expected... Report!',
|
||||||
|
'arguments' => [
|
||||||
|
'class' => 'first_lbl',
|
||||||
|
'name' => 'lbl_not_working',
|
||||||
|
'id' => 'lbl_not_working',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'arguments' => [
|
||||||
|
'label' => __(''),
|
||||||
|
'type' => 'button',
|
||||||
|
'attributes' => 'class="btn_is_not_ok"',
|
||||||
|
'name' => 'btn_not_working',
|
||||||
|
'id' => 'btn_not_working',
|
||||||
|
'script' => 'reportIsNotWorking()',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
],
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
$output = $this->printForm(
|
||||||
|
[
|
||||||
|
'form' => $form,
|
||||||
|
'inputs' => $inputs,
|
||||||
|
],
|
||||||
|
true
|
||||||
|
);
|
||||||
|
|
||||||
|
$output .= $this->loadJS();
|
||||||
|
echo $output;
|
||||||
|
|
||||||
|
// Ajax methods does not continue.
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function loadJS()
|
||||||
|
{
|
||||||
|
ob_start();
|
||||||
|
?>
|
||||||
|
<script type="text/javascript">
|
||||||
|
|
||||||
|
function createNewAgent()
|
||||||
|
{
|
||||||
|
window.open('<?php echo ui_get_full_url('index.php?sec=gagente&sec2=godmode/agentes/configurar_agente'); ?>');
|
||||||
|
document.getElementById("button-btn_create_agent").className = "btn_agent_ok";
|
||||||
|
}
|
||||||
|
|
||||||
|
function checkAgentOnline()
|
||||||
|
{
|
||||||
|
window.open('<?php echo ui_get_full_url('index.php?sec=gagente&sec2=godmode/agentes/configurar_agente'); ?>');
|
||||||
|
document.getElementById("button-btn_check_agent").className = "btn_agent_online_ok";
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function createAlertModule()
|
||||||
|
{
|
||||||
|
window.open('<?php echo ui_get_full_url('index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente=2&tab=module&edit_module=1&id_agent_module=10'); ?>');
|
||||||
|
document.getElementById("button-btn_create_alert").className = "btn_alert_module_ok";
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function monitorRemoteCommands()
|
||||||
|
{
|
||||||
|
window.open('<?php echo ui_get_full_url(''); ?>');
|
||||||
|
document.getElementById("button-btn_monitor_commmands").className = "btn_remote-command_ok";
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function discoverDevicesNetwork()
|
||||||
|
{
|
||||||
|
|
||||||
|
window.open('<?php echo ui_get_full_url('index.php?sec=gservers&sec2=godmode/servers/discovery&wiz=hd&mode=netscan'); ?>');
|
||||||
|
document.getElementById("button-btn_discover_devices").className = "btn_discover_ok";
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function reportIsNotWorking()
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function configureEmail() {
|
||||||
|
window.open('<?php echo ui_get_full_url('index.php?sec=general&sec2=godmode/setup/setup§ion=general#table3'); ?>');
|
||||||
|
|
||||||
|
document.getElementById("button-btn_email_conf").className = "btn_email_conf_ok";
|
||||||
|
}
|
||||||
|
btn_email_conf
|
||||||
|
|
||||||
|
</script>
|
||||||
|
<?php
|
||||||
|
return ob_get_clean();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -1900,6 +1900,74 @@ function load_modal(settings) {
|
|||||||
})
|
})
|
||||||
.show();
|
.show();
|
||||||
|
|
||||||
|
var required_buttons = [];
|
||||||
|
if (settings.modal.cancel != undefined) {
|
||||||
|
required_buttons.push({
|
||||||
|
class:
|
||||||
|
"ui-widget ui-state-default ui-corner-all ui-button-text-only sub upd submit-cancel",
|
||||||
|
text: settings.modal.cancel,
|
||||||
|
click: function() {
|
||||||
|
$(this).dialog("close");
|
||||||
|
if (typeof settings.cleanup == "function") {
|
||||||
|
settings.cleanup();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (settings.modal.ok != undefined) {
|
||||||
|
required_buttons.push({
|
||||||
|
class:
|
||||||
|
"ui-widget ui-state-default ui-corner-all ui-button-text-only sub ok submit-next",
|
||||||
|
text: settings.modal.ok,
|
||||||
|
click: function() {
|
||||||
|
// No form in modal, simpler.
|
||||||
|
if (settings.onsubmit == undefined) {
|
||||||
|
$(this).dialog("close");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (AJAX_RUNNING) return;
|
||||||
|
AJAX_RUNNING = 1;
|
||||||
|
if (settings.onsubmit.preaction != undefined) {
|
||||||
|
settings.onsubmit.preaction();
|
||||||
|
}
|
||||||
|
var formdata = new FormData();
|
||||||
|
if (settings.extradata) {
|
||||||
|
settings.extradata.forEach(function(item) {
|
||||||
|
if (item.value != undefined) formdata.append(item.name, item.value);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
formdata.append("page", settings.onsubmit.page);
|
||||||
|
formdata.append("method", settings.onsubmit.method);
|
||||||
|
|
||||||
|
$("#" + settings.form + " :input").each(function() {
|
||||||
|
if (this.type == "file") {
|
||||||
|
if ($(this).prop("files")[0]) {
|
||||||
|
formdata.append(this.name, $(this).prop("files")[0]);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
formdata.append(this.name, $(this).val());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
method: "post",
|
||||||
|
url: settings.url,
|
||||||
|
processData: false,
|
||||||
|
contentType: false,
|
||||||
|
data: formdata,
|
||||||
|
success: function(data) {
|
||||||
|
if (settings.ajax_callback != undefined) {
|
||||||
|
settings.ajax_callback(data);
|
||||||
|
}
|
||||||
|
AJAX_RUNNING = 0;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
method: "post",
|
method: "post",
|
||||||
url: settings.url,
|
url: settings.url,
|
||||||
@ -1921,64 +1989,7 @@ function load_modal(settings) {
|
|||||||
opacity: 0.5,
|
opacity: 0.5,
|
||||||
background: "black"
|
background: "black"
|
||||||
},
|
},
|
||||||
buttons: [
|
buttons: required_buttons,
|
||||||
{
|
|
||||||
class:
|
|
||||||
"ui-widget ui-state-default ui-corner-all ui-button-text-only sub upd submit-cancel",
|
|
||||||
text: settings.modal.cancel,
|
|
||||||
click: function() {
|
|
||||||
$(this).dialog("close");
|
|
||||||
if (typeof settings.cleanup == "function") {
|
|
||||||
settings.cleanup();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
class:
|
|
||||||
"ui-widget ui-state-default ui-corner-all ui-button-text-only sub ok submit-next",
|
|
||||||
text: settings.modal.ok,
|
|
||||||
click: function() {
|
|
||||||
if (AJAX_RUNNING) return;
|
|
||||||
AJAX_RUNNING = 1;
|
|
||||||
if (settings.onsubmit.preaction != undefined) {
|
|
||||||
settings.onsubmit.preaction();
|
|
||||||
}
|
|
||||||
var formdata = new FormData();
|
|
||||||
if (settings.extradata) {
|
|
||||||
settings.extradata.forEach(function(item) {
|
|
||||||
if (item.value != undefined)
|
|
||||||
formdata.append(item.name, item.value);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
formdata.append("page", settings.onsubmit.page);
|
|
||||||
formdata.append("method", settings.onsubmit.method);
|
|
||||||
|
|
||||||
$("#" + settings.form + " :input").each(function() {
|
|
||||||
if (this.type == "file") {
|
|
||||||
if ($(this).prop("files")[0]) {
|
|
||||||
formdata.append(this.name, $(this).prop("files")[0]);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
formdata.append(this.name, $(this).val());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
$.ajax({
|
|
||||||
method: "post",
|
|
||||||
url: settings.url,
|
|
||||||
processData: false,
|
|
||||||
contentType: false,
|
|
||||||
data: formdata,
|
|
||||||
success: function(data) {
|
|
||||||
if (settings.ajax_callback != undefined) {
|
|
||||||
settings.ajax_callback(data);
|
|
||||||
}
|
|
||||||
AJAX_RUNNING = 0;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
closeOnEscape: false,
|
closeOnEscape: false,
|
||||||
open: function() {
|
open: function() {
|
||||||
$(".ui-dialog-titlebar-close").hide();
|
$(".ui-dialog-titlebar-close").hide();
|
||||||
|
@ -0,0 +1,144 @@
|
|||||||
|
/*
|
||||||
|
// 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
label {
|
||||||
|
font-family: "lato-lighter", "Open Sans", sans-serif;
|
||||||
|
letter-spacing: 0.03pt;
|
||||||
|
font-size: 8pt;
|
||||||
|
font-weight: 800;
|
||||||
|
}
|
||||||
|
.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_position {
|
||||||
|
display: flex;
|
||||||
|
margin-left: 50px;
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn_email_conf {
|
||||||
|
background-image: url(../../images/darrowright.png);
|
||||||
|
margin-left: 461px;
|
||||||
|
width: 25px;
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn_agent {
|
||||||
|
background-image: url(../../images/darrowright.png);
|
||||||
|
margin-left: 469px;
|
||||||
|
width: 25px;
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
|
.btn_agent_online {
|
||||||
|
background-image: url(../../images/darrowright.png);
|
||||||
|
margin-left: 314px;
|
||||||
|
width: 25px;
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
|
.btn_alert_module {
|
||||||
|
background-image: url(../../images/darrowright.png);
|
||||||
|
margin-left: 304px;
|
||||||
|
width: 25px;
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
|
.btn_remote-command {
|
||||||
|
background-image: url(../../images/darrowright.png);
|
||||||
|
margin-left: 297px;
|
||||||
|
width: 25px;
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn_discover {
|
||||||
|
background-image: url(../../images/darrowright.png);
|
||||||
|
margin-left: 321px;
|
||||||
|
width: 25px;
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn_is_not_ok {
|
||||||
|
background-image: url(../../images/icono_warning.png);
|
||||||
|
margin-left: 288px;
|
||||||
|
width: 25px;
|
||||||
|
border: none;
|
||||||
|
background-size: 20px;
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn_agent_ok {
|
||||||
|
background-image: url(../../images/input_tick.png);
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
margin-left: 469px;
|
||||||
|
width: 20px;
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn_agent_online_ok {
|
||||||
|
background-image: url(../../images/input_tick.png);
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
margin-left: 314px;
|
||||||
|
width: 20px;
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn_alert_module_ok {
|
||||||
|
background-image: url(../../images/input_tick.png);
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
margin-left: 304px;
|
||||||
|
width: 20px;
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn_remote-command_ok {
|
||||||
|
background-image: url(../../images/input_tick.png);
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
margin-left: 297px;
|
||||||
|
width: 20px;
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn_discover_ok {
|
||||||
|
background-image: url(../../images/input_tick.png);
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
margin-left: 321px;
|
||||||
|
width: 25px;
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn_email_conf_ok {
|
||||||
|
background-image: url(../../images/input_tick.png);
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
margin-left: 461px;
|
||||||
|
width: 20px;
|
||||||
|
border: none;
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user