minor fixes after internal meeting

This commit is contained in:
fbsanchez 2019-10-30 18:33:33 +01:00
parent 72b1fb2b16
commit 3eb0a6bb95
3 changed files with 151 additions and 157 deletions

View File

@ -142,7 +142,8 @@ class WelcomeWindow extends Wizard
url: '<?php echo ui_get_full_url('ajax.php', false, false, false); ?>', url: '<?php echo ui_get_full_url('ajax.php', false, false, false); ?>',
modal: { modal: {
title: "<?php echo __('Welcome to Pandora FMS'); ?>", title: "<?php echo __('Welcome to Pandora FMS'); ?>",
cancel: '<?php echo __('Cancel'); ?>', cancel: '<?php echo __('Ignore'); ?>',
ok: '<?php echo __('Cancel'); ?>'
}, },
onshow: { onshow: {
page: '<?php echo $this->ajaxController; ?>', page: '<?php echo $this->ajaxController; ?>',
@ -251,11 +252,11 @@ class WelcomeWindow extends Wizard
public function loadWelcomeWindow() public function loadWelcomeWindow()
{ {
global $config; global $config;
$btn_configure_mail_class = ''; $btn_configure_mail_class = 'pending';
$btn_create_agent_class = ''; $btn_create_agent_class = 'pending';
$btn_create_module_class = ''; $btn_create_module_class = '';
$btn_create_alert_class = ''; $btn_create_alert_class = '';
$btn_create_discovery_class = ''; $btn_create_discovery_class = 'pending';
switch ($this->step) { switch ($this->step) {
case W_CREATE_AGENT: case W_CREATE_AGENT:
@ -455,7 +456,14 @@ class WelcomeWindow extends Wizard
], ],
], ],
[ [
'label' => html_print_image('images/feedback-header.png', true), 'label' => html_print_image(
'images/feedback-header.png',
true,
[
'onclick' => '$(\'#feedback-header\').click()',
'style' => 'cursor: pointer;',
]
),
], ],
], ],
@ -490,25 +498,23 @@ class WelcomeWindow extends Wizard
{ {
global $config; global $config;
if (isset($config['welcome_state']) === false) {
$this->setStep(W_CONFIGURE_MAIL);
}
// Check current page.
$sec2 = get_parameter('sec2', '');
if ($must_run === false if ($must_run === false
|| (isset($config['welcome_state']) === true || $config['welcome_state'] === WELCOME_FINISHED
&& $config['welcome_state'] === WELCOME_FINISHED)
) { ) {
// Do not start unless not finished. // Do not show if finished.
return false; return false;
} }
$sec2 = get_parameter('sec2', '');
$this->step = $this->getStep(); $this->step = $this->getStep();
$this->agent = $this->getWelcomeAgent(); $this->agent = $this->getWelcomeAgent();
if ($sec2 === '') {
// Unless finished.
if ($this->step !== WELCOME_FINISHED) {
return true;
}
}
/* /*
* Configure mail. Control current flow. * Configure mail. Control current flow.
* *
@ -530,8 +536,8 @@ class WelcomeWindow extends Wizard
) { ) {
// Mail configuration is being processed. // Mail configuration is being processed.
return false; return false;
} else { } else if (empty($sec2) === true) {
// Any other page, show welcome. // If at main page, show welcome.
return true; return true;
} }
} }
@ -561,8 +567,8 @@ class WelcomeWindow extends Wizard
} else if ($sec2 === 'godmode/agentes/configurar_agente') { } else if ($sec2 === 'godmode/agentes/configurar_agente') {
// Agent is being created. // Agent is being created.
return false; return false;
} else { } else if (empty($sec2) === true) {
// Any other page, show welcome. // If at main page, show welcome.
return true; return true;
} }
} }
@ -589,8 +595,8 @@ class WelcomeWindow extends Wizard
) { ) {
// Module is being created. // Module is being created.
return false; return false;
} else { } else if (empty($sec2) === true) {
// Any other page, show welcome. // If at main page, show welcome.
return true; return true;
} }
} }
@ -617,8 +623,8 @@ class WelcomeWindow extends Wizard
) { ) {
// Alert is being created. // Alert is being created.
return false; return false;
} else { } else if (empty($sec2) === true) {
// Any other page, show welcome. // If at main page, show welcome.
return true; return true;
} }
} }
@ -645,8 +651,8 @@ class WelcomeWindow extends Wizard
} else if ($sec2 == 'godmode/servers/discovery') { } else if ($sec2 == 'godmode/servers/discovery') {
// Discovery task is being created. // Discovery task is being created.
return false; return false;
} else { } else if (empty($sec2) === true) {
// Any other page, show welcome. // If at main page, show welcome.
return true; return true;
} }
} }
@ -675,59 +681,46 @@ class WelcomeWindow extends Wizard
?> ?>
<script type="text/javascript"> <script type="text/javascript">
<?php <?php
switch ($this->step) { if ($this->step > W_CREATE_AGENT) {
case W_CONFIGURE_MAIL: switch ($this->step) {
?> case W_CREATE_MODULE:
document.getElementById("button-btn_email_conf").setAttribute( ?>
'onclick',
'configureEmail()'
);
<?php
break;
case W_CREATE_AGENT:
?>
document.getElementById("button-btn_create_agent").setAttribute(
'onclick',
'createNewAgent()'
);
<?php
break;
case W_CREATE_MODULE:
?>
document.getElementById("button-btn_create_module").setAttribute( document.getElementById("button-btn_create_module").setAttribute(
'onclick', 'onclick',
'checkAgentOnline()' 'checkAgentOnline()'
); );
<?php <?php
break; break;
case W_CREATE_ALERT: case W_CREATE_ALERT:
?> ?>
document.getElementById("button-btn_create_alert").setAttribute( document.getElementById("button-btn_create_alert").setAttribute(
'onclick', 'onclick',
'createAlertModule()' 'createAlertModule()'
); );
<?php <?php
break; break;
case W_CREATE_TASK: default:
?> // Ignore.
document.getElementById("button-btn_discover_devices").setAttribute( break;
'onclick', }
'discoverDevicesNetwork()'
);
<?php
break;
case WELCOME_FINISHED:
default:
// Do not enable anything.
break;
} }
?> ?>
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()'
);
function configureEmail() { function configureEmail() {
window.location = '<?php echo ui_get_full_url('index.php?sec=general&sec2=godmode/setup/setup&section=general#table3'); ?>'; window.location = '<?php echo ui_get_full_url('index.php?sec=general&sec2=godmode/setup/setup&section=general#table3'); ?>';
} }

View File

@ -1946,6 +1946,8 @@ function load_modal(settings) {
} else if (settings.oncancel != undefined) { } else if (settings.oncancel != undefined) {
cancelModal(); cancelModal();
} }
} else {
$(this).dialog("close");
} }
} }
}); });
@ -1958,73 +1960,80 @@ function load_modal(settings) {
text: settings.modal.ok, text: settings.modal.ok,
click: function() { click: function() {
if (AJAX_RUNNING) return; if (AJAX_RUNNING) return;
AJAX_RUNNING = 1;
if (settings.onsubmit.preaction != undefined) {
settings.onsubmit.preaction();
}
if (settings.onsubmit.dataType == undefined) {
settings.onsubmit.dataType = "html";
}
var formdata = new FormData(); if (settings.onsubmit != undefined) {
if (settings.extradata) { if (settings.onsubmit.preaction != undefined) {
settings.extradata.forEach(function(item) { settings.onsubmit.preaction();
if (item.value != undefined) formdata.append(item.name, item.value); }
}); AJAX_RUNNING = 1;
} if (settings.onsubmit.dataType == undefined) {
formdata.append("page", settings.onsubmit.page); settings.onsubmit.dataType = "html";
formdata.append("method", settings.onsubmit.method);
var flagError = false;
$("#" + settings.form + " :input").each(function() {
if (this.checkValidity() === false) {
$(this).prop("title", this.validationMessage);
$(this).tooltip({
tooltipClass: "uitooltip",
position: { my: "right bottom", at: "right bottom" },
show: { duration: 200 }
});
$(this).tooltip("open");
flagError = true;
} }
if (this.type == "file") { var formdata = new FormData();
if ($(this).prop("files")[0]) { if (settings.extradata) {
formdata.append(this.name, $(this).prop("files")[0]); 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);
var flagError = false;
$("#" + settings.form + " :input").each(function() {
if (this.checkValidity() === false) {
$(this).prop("title", this.validationMessage);
$(this).tooltip({
tooltipClass: "uitooltip",
position: { my: "right bottom", at: "right bottom" },
show: { duration: 200 }
});
$(this).tooltip("open");
flagError = true;
} }
} else {
if ($(this).attr("type") == "checkbox") { if (this.type == "file") {
if (this.checked) { if ($(this).prop("files")[0]) {
formdata.append(this.name, "on"); formdata.append(this.name, $(this).prop("files")[0]);
} }
} else { } else {
formdata.append(this.name, $(this).val()); if ($(this).attr("type") == "checkbox") {
} if (this.checked) {
} formdata.append(this.name, "on");
});
if (flagError === false) {
$.ajax({
method: "post",
url: settings.url,
processData: false,
contentType: false,
data: formdata,
dataType: settings.onsubmit.dataType,
success: function(data) {
if (settings.ajax_callback != undefined) {
if (settings.idMsgCallback != undefined) {
settings.ajax_callback(data, settings.idMsgCallback);
} else {
settings.ajax_callback(data);
} }
} else {
formdata.append(this.name, $(this).val());
} }
AJAX_RUNNING = 0;
} }
}); });
if (flagError === false) {
$.ajax({
method: "post",
url: settings.url,
processData: false,
contentType: false,
data: formdata,
dataType: settings.onsubmit.dataType,
success: function(data) {
if (settings.ajax_callback != undefined) {
if (settings.idMsgCallback != undefined) {
settings.ajax_callback(data, settings.idMsgCallback);
} else {
settings.ajax_callback(data);
}
}
AJAX_RUNNING = 0;
}
});
} else {
AJAX_RUNNING = 0;
}
} else { } else {
AJAX_RUNNING = 0; // No onsumbit configured. Directly close.
$(this).dialog("close");
} }
}, },
error: function(data) { error: function(data) {

View File

@ -1,21 +1,3 @@
/*
// 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 { .modal {
overflow: hidden; overflow: hidden;
} }
@ -23,41 +5,51 @@
.welcome_modal_window { .welcome_modal_window {
overflow: hidden; overflow: hidden;
} }
label {
#welcome_modal_window {
/*
max-height: 100%;
height: 100%;
border-left: 1em solid #82b92f;
margin-bottom: -59px;
padding-bottom: 100px;
margin-left: -1px;
*/
}
#welcome_form ul.wizard li {
padding: 1em;
padding-bottom: 0;
padding-top: 1em;
}
#welcome_form label {
font-family: "lato-lighter", "Open Sans", sans-serif; font-family: "lato-lighter", "Open Sans", sans-serif;
letter-spacing: 0.03pt; font-weight: normal;
font-size: 8pt;
font-weight: 900;
} }
.content_position { .content_position {
display: flex; display: flex;
margin-top: 5px; margin-top: 5px;
font-family: "lato-lighter", "Open Sans", sans-serif; font-family: "lato-lighter", "Open Sans", sans-serif;
letter-spacing: 0.03pt; font-weight: normal;
font-size: 8pt;
font-weight: 800;
} }
.learn_content_indented { .learn_content_indented {
margin-top: 0.5em; text-indent: 1.5em;
text-indent: 2em;
font-family: "lato-lighter", "Open Sans", sans-serif; font-family: "lato-lighter", "Open Sans", sans-serif;
letter-spacing: 0.03pt; font-weight: normal;
font-size: 8pt;
font-weight: 800;
} }
#lbl_learn { #lbl_learn {
font-family: "lato-lighter", "Open Sans", sans-serif; font-family: "lato-lighter", "Open Sans", sans-serif;
letter-spacing: 0.03pt; font-weight: normal;
font-size: 8pt;
font-weight: 800;
} }
.go { .go {
background-repeat: no-repeat; background-repeat: no-repeat;
width: 25px; background-size: cover;
height: 25px; width: 20px;
height: 20px;
border: none; border: none;
} }