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); ?>',
modal: {
title: "<?php echo __('Welcome to Pandora FMS'); ?>",
cancel: '<?php echo __('Cancel'); ?>',
cancel: '<?php echo __('Ignore'); ?>',
ok: '<?php echo __('Cancel'); ?>'
},
onshow: {
page: '<?php echo $this->ajaxController; ?>',
@ -251,11 +252,11 @@ class WelcomeWindow extends Wizard
public function loadWelcomeWindow()
{
global $config;
$btn_configure_mail_class = '';
$btn_create_agent_class = '';
$btn_configure_mail_class = 'pending';
$btn_create_agent_class = 'pending';
$btn_create_module_class = '';
$btn_create_alert_class = '';
$btn_create_discovery_class = '';
$btn_create_discovery_class = 'pending';
switch ($this->step) {
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;
if (isset($config['welcome_state']) === false) {
$this->setStep(W_CONFIGURE_MAIL);
}
// Check current page.
$sec2 = get_parameter('sec2', '');
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;
}
$sec2 = get_parameter('sec2', '');
$this->step = $this->getStep();
$this->agent = $this->getWelcomeAgent();
if ($sec2 === '') {
// Unless finished.
if ($this->step !== WELCOME_FINISHED) {
return true;
}
}
/*
* Configure mail. Control current flow.
*
@ -530,8 +536,8 @@ class WelcomeWindow extends Wizard
) {
// Mail configuration is being processed.
return false;
} else {
// Any other page, show welcome.
} else if (empty($sec2) === true) {
// If at main page, show welcome.
return true;
}
}
@ -561,8 +567,8 @@ class WelcomeWindow extends Wizard
} else if ($sec2 === 'godmode/agentes/configurar_agente') {
// Agent is being created.
return false;
} else {
// Any other page, show welcome.
} else if (empty($sec2) === true) {
// If at main page, show welcome.
return true;
}
}
@ -589,8 +595,8 @@ class WelcomeWindow extends Wizard
) {
// Module is being created.
return false;
} else {
// Any other page, show welcome.
} else if (empty($sec2) === true) {
// If at main page, show welcome.
return true;
}
}
@ -617,8 +623,8 @@ class WelcomeWindow extends Wizard
) {
// Alert is being created.
return false;
} else {
// Any other page, show welcome.
} else if (empty($sec2) === true) {
// If at main page, show welcome.
return true;
}
}
@ -645,8 +651,8 @@ class WelcomeWindow extends Wizard
} else if ($sec2 == 'godmode/servers/discovery') {
// Discovery task is being created.
return false;
} else {
// Any other page, show welcome.
} else if (empty($sec2) === true) {
// If at main page, show welcome.
return true;
}
}
@ -675,59 +681,46 @@ class WelcomeWindow extends Wizard
?>
<script type="text/javascript">
<?php
switch ($this->step) {
case W_CONFIGURE_MAIL:
?>
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:
?>
if ($this->step > W_CREATE_AGENT) {
switch ($this->step) {
case W_CREATE_MODULE:
?>
document.getElementById("button-btn_create_module").setAttribute(
'onclick',
'checkAgentOnline()'
);
<?php
break;
<?php
break;
case W_CREATE_ALERT:
?>
case W_CREATE_ALERT:
?>
document.getElementById("button-btn_create_alert").setAttribute(
'onclick',
'createAlertModule()'
);
<?php
break;
<?php
break;
case W_CREATE_TASK:
?>
document.getElementById("button-btn_discover_devices").setAttribute(
'onclick',
'discoverDevicesNetwork()'
);
<?php
break;
case WELCOME_FINISHED:
default:
// Do not enable anything.
break;
default:
// Ignore.
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() {
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) {
cancelModal();
}
} else {
$(this).dialog("close");
}
}
});
@ -1958,73 +1960,80 @@ function load_modal(settings) {
text: settings.modal.ok,
click: function() {
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.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);
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 (settings.onsubmit != undefined) {
if (settings.onsubmit.preaction != undefined) {
settings.onsubmit.preaction();
}
AJAX_RUNNING = 1;
if (settings.onsubmit.dataType == undefined) {
settings.onsubmit.dataType = "html";
}
if (this.type == "file") {
if ($(this).prop("files")[0]) {
formdata.append(this.name, $(this).prop("files")[0]);
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);
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.checked) {
formdata.append(this.name, "on");
if (this.type == "file") {
if ($(this).prop("files")[0]) {
formdata.append(this.name, $(this).prop("files")[0]);
}
} else {
formdata.append(this.name, $(this).val());
}
}
});
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);
if ($(this).attr("type") == "checkbox") {
if (this.checked) {
formdata.append(this.name, "on");
}
} 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 {
AJAX_RUNNING = 0;
// No onsumbit configured. Directly close.
$(this).dialog("close");
}
},
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 {
overflow: hidden;
}
@ -23,41 +5,51 @@
.welcome_modal_window {
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;
letter-spacing: 0.03pt;
font-size: 8pt;
font-weight: 900;
font-weight: normal;
}
.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;
font-weight: normal;
}
.learn_content_indented {
margin-top: 0.5em;
text-indent: 2em;
text-indent: 1.5em;
font-family: "lato-lighter", "Open Sans", sans-serif;
letter-spacing: 0.03pt;
font-size: 8pt;
font-weight: 800;
font-weight: normal;
}
#lbl_learn {
font-family: "lato-lighter", "Open Sans", sans-serif;
letter-spacing: 0.03pt;
font-size: 8pt;
font-weight: 800;
font-weight: normal;
}
.go {
background-repeat: no-repeat;
width: 25px;
height: 25px;
background-size: cover;
width: 20px;
height: 20px;
border: none;
}