Merge branch 'ent-4766-feedback-de-ayudas' into 'develop'
add feedback See merge request artica/pandorafms!2813
This commit is contained in:
commit
f844c660af
|
@ -0,0 +1,77 @@
|
|||
<?php
|
||||
/**
|
||||
* Credential store
|
||||
*
|
||||
* @category HelperFeedBack
|
||||
* @package Pandora FMS
|
||||
* @subpackage Help Feedback
|
||||
* @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 HelpFeedBack.
|
||||
*/
|
||||
|
||||
global $config;
|
||||
|
||||
require_once $config['homedir'].'/include/class/HelpFeedBack.class.php';
|
||||
|
||||
$ajaxPage = 'general/help_feedback';
|
||||
|
||||
// Control call flow.
|
||||
try {
|
||||
// User access and validation is being processed on class constructor.
|
||||
$helpfeedback = new HelpFeedBack($ajaxPage);
|
||||
} catch (Exception $e) {
|
||||
if (is_ajax()) {
|
||||
echo json_encode(['error' => '[HelpFeedBack]'.$e->getMessage() ]);
|
||||
exit;
|
||||
} else {
|
||||
echo '[HelpFeedBack]'.$e->getMessage();
|
||||
}
|
||||
|
||||
// Stop this execution, but continue 'globally'.
|
||||
return;
|
||||
}
|
||||
|
||||
// Ajax controller.
|
||||
if (is_ajax()) {
|
||||
$method = get_parameter('method', '');
|
||||
|
||||
if (method_exists($helpfeedback, $method) === true) {
|
||||
if ($helpfeedback->ajaxMethod($method) === true) {
|
||||
$helpfeedback->{$method}();
|
||||
} else {
|
||||
$helpfeedback->error('Unavailable method.');
|
||||
}
|
||||
} else {
|
||||
$helpfeedback->error('Method not found. ['.$method.']');
|
||||
}
|
||||
|
||||
|
||||
// Stop any execution.
|
||||
exit;
|
||||
} else {
|
||||
// Run.
|
||||
$helpfeedback->run();
|
||||
}
|
|
@ -404,13 +404,42 @@ class Wizard
|
|||
|
||||
/**
|
||||
* 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 boolean $return Return as string or direct output.
|
||||
*
|
||||
* @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 = '';
|
||||
if ($input['hidden'] == 1) {
|
||||
|
@ -424,33 +453,47 @@ class Wizard
|
|||
}
|
||||
|
||||
if (is_array($input['block_content']) === true) {
|
||||
$not_direct = (bool) $input['direct'];
|
||||
|
||||
// Print independent block of inputs.
|
||||
$output .= '<li id="li-'.$input['block_id'].'" class="'.$class.'">';
|
||||
|
||||
if ($input['wrapper']) {
|
||||
$output .= '<li id="li-'.$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) {
|
||||
$output .= $this->printBlock($input, $return);
|
||||
$output .= $this->printBlock($input, $return, (bool) $not_direct);
|
||||
}
|
||||
|
||||
// Close block.
|
||||
if ($input['wrapper']) {
|
||||
$output .= '</ul></'.$input['wrapper'].'>';
|
||||
} else {
|
||||
$output .= '</ul></li>';
|
||||
if (!$not_direct) {
|
||||
$output .= '</ul>';
|
||||
}
|
||||
|
||||
if ($input['wrapper']) {
|
||||
$output .= '</'.$input['wrapper'].'>';
|
||||
}
|
||||
|
||||
$output .= '</li>';
|
||||
} else {
|
||||
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 .= $this->printInput($input['arguments']);
|
||||
// Allow dynamic content.
|
||||
$output .= $input['extra'];
|
||||
$output .= '</li>';
|
||||
if (!$not_direct) {
|
||||
$output .= '</li>';
|
||||
}
|
||||
} else {
|
||||
$output .= $this->printInput($input['arguments']);
|
||||
// Allow dynamic content.
|
||||
|
|
|
@ -0,0 +1,390 @@
|
|||
<?php
|
||||
/**
|
||||
* Credential store
|
||||
*
|
||||
* @category Class
|
||||
* @package Pandora FMS
|
||||
* @subpackage Help Feedback
|
||||
* @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 HelpFeedBack.
|
||||
*/
|
||||
class HelpFeedBack extends Wizard
|
||||
{
|
||||
|
||||
/**
|
||||
* Allowed methods to be called using AJAX request.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $AJAXMethods = [
|
||||
'loadFeedbackForm',
|
||||
'sendMailMethod',
|
||||
];
|
||||
|
||||
/**
|
||||
* 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)
|
||||
{
|
||||
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('discovery');
|
||||
ui_require_css_file('help_feedback');
|
||||
|
||||
$help_url = get_parameter('url', null);
|
||||
if ($help_url === null) {
|
||||
echo __('Page not found');
|
||||
} else {
|
||||
?>
|
||||
<iframe width="100%" height="100%" frameBorder="0"
|
||||
src="<?php echo $help_url; ?>">
|
||||
<?php echo __('Browser not compatible.'); ?>
|
||||
</iframe>
|
||||
<?php
|
||||
}
|
||||
|
||||
$hidden = '<input type="hidden" value="'.$help_url.'" ';
|
||||
$hidden .= ' form="feedback_form" name="help_url" />';
|
||||
|
||||
echo $hidden;
|
||||
|
||||
echo '<div class="help_feedback">';
|
||||
// Load feedback form.
|
||||
echo $this->loadFeedbackForm();
|
||||
echo '</div><div id="back" style="display: none"></div>';
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Loads a feedback form
|
||||
*
|
||||
* @return string HTML code for form.
|
||||
*
|
||||
* @return Function loadFeedbackForm.
|
||||
*/
|
||||
public function loadFeedbackForm()
|
||||
{
|
||||
global $config;
|
||||
|
||||
$form = [
|
||||
'action' => '#',
|
||||
'id' => 'feedback_form',
|
||||
'onsubmit' => 'return false;',
|
||||
];
|
||||
|
||||
$inputs = [
|
||||
[
|
||||
'wrapper' => 'div',
|
||||
'block_id' => 'flex-row-baseline w100p',
|
||||
'class' => 'flex-row-baseline w100p',
|
||||
'direct' => 1,
|
||||
'block_content' => [
|
||||
[
|
||||
'arguments' => [
|
||||
'label' => __('Sugesstion'),
|
||||
'type' => 'radio_button',
|
||||
'attributes' => 'class="btn"',
|
||||
'name' => 'suggestion',
|
||||
'id' => 'suggestion',
|
||||
'script' => 'disableRadio(\'report\')',
|
||||
'return' => true,
|
||||
],
|
||||
],
|
||||
[
|
||||
'arguments' => [
|
||||
'label' => __('Something is not quite right'),
|
||||
'type' => 'radio_button',
|
||||
'attributes' => 'class="btn"',
|
||||
'name' => 'report',
|
||||
'id' => 'report',
|
||||
'script' => 'disableRadio(\'suggestion\')',
|
||||
'return' => true,
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
[
|
||||
|
||||
'label' => __('What happened?'),
|
||||
'class' => 'explain',
|
||||
'arguments' => [
|
||||
'class' => 'textarea_feedback',
|
||||
'id' => 'feedback_text',
|
||||
'type' => 'textarea',
|
||||
'name' => 'feedback_text',
|
||||
],
|
||||
],
|
||||
[
|
||||
'label' => __('Your Email'),
|
||||
'arguments' => [
|
||||
'id' => 'feedback_email',
|
||||
'name' => 'feedback_email',
|
||||
'input_class' => 'email_feedback',
|
||||
'class' => 'email_feedback',
|
||||
'type' => 'email',
|
||||
'required' => true,
|
||||
],
|
||||
],
|
||||
[
|
||||
'arguments' => [
|
||||
'button_class' => 'btn_submit',
|
||||
'class' => 'btn_submit',
|
||||
'attributes' => 'class="sub next btn_submit_feed_back"',
|
||||
'type' => 'submit',
|
||||
'id' => 'submit_feedback',
|
||||
'label' => __('Submit'),
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
$output = ui_print_toggle(
|
||||
[
|
||||
'id' => 'toggle_help_feedback',
|
||||
'content' => $this->printForm(
|
||||
[
|
||||
'form' => $form,
|
||||
'inputs' => $inputs,
|
||||
],
|
||||
true
|
||||
),
|
||||
'name' => __('Feedback'),
|
||||
'return' => true,
|
||||
'class' => 'no-border',
|
||||
'img_a' => 'images/arrow_down_white.png',
|
||||
'img_b' => 'images/arrow_up_white.png',
|
||||
|
||||
]
|
||||
);
|
||||
|
||||
$output .= $this->loadJS();
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Function send_mail_method,we use send_email_attachment method
|
||||
* from functions_cron.php.
|
||||
*
|
||||
* @param string $feedback_option type fo mail.
|
||||
* @param string $feedback_text text mail.
|
||||
* @param string $feedback_mail costumer mail.
|
||||
*
|
||||
* @return void.
|
||||
*/
|
||||
public function sendMailMethod()
|
||||
{
|
||||
$suggestion = get_parameter('type', 'false');
|
||||
$feedback_text = get_parameter('feedback_text', null);
|
||||
$feedback_mail = get_parameter('feedback_email', null);
|
||||
$help_url = get_parameter('help_url', 'unknown');
|
||||
|
||||
$section = explode('title=', $help_url, 2);
|
||||
|
||||
$subject = '';
|
||||
if (is_array($section) === true && isset($section[1]) === true) {
|
||||
$subject = '['.$section[1].']';
|
||||
}
|
||||
|
||||
if ($suggestion !== 'false') {
|
||||
$subject .= __('[pandorafms wiki] New suggestion');
|
||||
} else {
|
||||
$subject .= __('[pandorafms wiki] New report');
|
||||
}
|
||||
|
||||
if (empty($feedback_mail) === true) {
|
||||
$error = [
|
||||
'error' => __(
|
||||
'Please provide your email address, we promise not to bother you'
|
||||
),
|
||||
];
|
||||
}
|
||||
|
||||
if (empty($feedback_text) === true) {
|
||||
if ($suggestion !== 'false') {
|
||||
$msg = 'Please provide some feedback. Write something awesome!';
|
||||
} else {
|
||||
$msg = 'Please provide some feedback. We\'ll appreciate it!';
|
||||
}
|
||||
|
||||
$error = [
|
||||
'error' => __($msg),
|
||||
];
|
||||
}
|
||||
|
||||
if ($error !== null) {
|
||||
echo json_encode($error);
|
||||
exit;
|
||||
}
|
||||
|
||||
enterprise_include_once('include/functions_cron.php');
|
||||
|
||||
$uid = $config['pandora_uid'];
|
||||
if (empty($uid) === true) {
|
||||
$uid = 'not registered';
|
||||
}
|
||||
|
||||
$body = '<ul><li><b>User mail</b> '.$feedback_mail.'</li>';
|
||||
$body .= '<li><b>Console</b> <i>'.$uid.'</i></li>';
|
||||
$body .= '<li><b>URL</b> '.$help_url.'</li></ul>';
|
||||
$body .= '<h2>Message</h2>';
|
||||
$body .= '<p>'.$feedback_text.'</p>';
|
||||
|
||||
$res = enterprise_hook(
|
||||
'send_email_attachment',
|
||||
[
|
||||
'feedback@artica.es',
|
||||
$body,
|
||||
$subject,
|
||||
]
|
||||
);
|
||||
|
||||
// Response.
|
||||
if ($res == 1) {
|
||||
$r = ['error' => ''];
|
||||
} else {
|
||||
$r = ['error' => __('Something went wrong while sending the report.')];
|
||||
}
|
||||
|
||||
echo json_encode($r);
|
||||
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Load extra JS.
|
||||
*
|
||||
* @return string JS content.
|
||||
*/
|
||||
public function loadJS()
|
||||
{
|
||||
ob_start();
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
function disableRadio(id) {
|
||||
$('#'+id).prop('checked', false)
|
||||
}
|
||||
|
||||
// Set values to data.
|
||||
$("#feedback_form").on('submit', function() {
|
||||
// Make the AJAX call to send mails.
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "ajax.php",
|
||||
dataType: "json",
|
||||
data: {
|
||||
page: "<?php echo $this->ajaxController; ?>",
|
||||
method: 'sendMailMethod',
|
||||
type: $('#suggestion').prop('checked'),
|
||||
feedback_text: $("textarea[name=feedback_text]").val(),
|
||||
feedback_email: $("input[name=feedback_email]").val(),
|
||||
help_url: $("input[name=help_url]").val(),
|
||||
},
|
||||
success: function (data) {
|
||||
var title;
|
||||
var content;
|
||||
var failed = 0;
|
||||
var className='submit-next';
|
||||
|
||||
if (data.error != "") {
|
||||
title = '<?php echo __('Failed'); ?>';
|
||||
content = data.error;
|
||||
failed = 1;
|
||||
className='submit-cancel';
|
||||
} else {
|
||||
title = '<?php echo __('Success'); ?>';
|
||||
content = '<?php echo __('Your report had been successfully sent to Artica.').'<br>'.__('Thank you!'); ?>';
|
||||
}
|
||||
$('#back').html(content);
|
||||
$('#back').dialog({
|
||||
title: title,
|
||||
buttons: [
|
||||
{
|
||||
class:
|
||||
"ui-widget ui-state-default ui-corner-all ui-button-text-only sub upd " + className,
|
||||
text: '<?php echo __('OK'); ?>',
|
||||
click: function() {
|
||||
$(this).dialog("close");
|
||||
if (failed == 0) {
|
||||
$('#toggle_help_feedback').empty();
|
||||
}
|
||||
}
|
||||
},
|
||||
]
|
||||
})
|
||||
},
|
||||
error: function (data) {
|
||||
console.error("Fatal error in AJAX call to send help feedback mail")
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
</script>
|
||||
<?php
|
||||
return ob_get_clean();
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -1535,6 +1535,89 @@ function html_print_input_text($name, $value, $alt='', $size=50, $maxlength=255,
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Render an input email element.
|
||||
*
|
||||
* @param array $settings Array with attributes input.
|
||||
* only name is necessary.
|
||||
*
|
||||
* @return string Html input.
|
||||
*/
|
||||
function html_print_input_email(array $settings):string
|
||||
{
|
||||
// TODO: const.
|
||||
$valid_attrs = [
|
||||
'accept',
|
||||
'disabled',
|
||||
'maxlength',
|
||||
'name',
|
||||
'readonly',
|
||||
'placeholder',
|
||||
'size',
|
||||
'value',
|
||||
'accesskey',
|
||||
'class',
|
||||
'dir',
|
||||
'id',
|
||||
'lang',
|
||||
'style',
|
||||
'tabindex',
|
||||
'title',
|
||||
'xml:lang',
|
||||
'onfocus',
|
||||
'onblur',
|
||||
'onselect',
|
||||
'onchange',
|
||||
'onclick',
|
||||
'ondblclick',
|
||||
'onmousedown',
|
||||
'onmouseup',
|
||||
'onmouseover',
|
||||
'onmousemove',
|
||||
'onmouseout',
|
||||
'onkeypress',
|
||||
'onkeydown',
|
||||
'onkeyup',
|
||||
'required',
|
||||
'pattern',
|
||||
'autocomplete',
|
||||
];
|
||||
|
||||
$output = '';
|
||||
if (isset($settings) === true && is_array($settings) === true) {
|
||||
// Check Name is necessary.
|
||||
if (isset($settings['name']) === true) {
|
||||
$output = '<input type="email" ';
|
||||
|
||||
// Check Max length.
|
||||
if (isset($settings['maxlength']) === false) {
|
||||
$settings['maxlength'] = 255;
|
||||
}
|
||||
|
||||
// Check Size.
|
||||
if (isset($settings['size']) === false
|
||||
|| $settings['size'] === 0
|
||||
) {
|
||||
$settings['size'] = 255;
|
||||
}
|
||||
|
||||
foreach ($settings as $attribute => $attr_value) {
|
||||
// Check valid attribute.
|
||||
if (in_array($attribute, $valid_attrs) === false) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$output .= $attribute.'="'.$attr_value.'" ';
|
||||
}
|
||||
|
||||
$output .= $function.'/>';
|
||||
}
|
||||
}
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Render an input image element.
|
||||
*
|
||||
|
@ -2189,33 +2272,47 @@ function html_print_table(&$table, $return=false)
|
|||
|
||||
|
||||
/**
|
||||
* Render a radio button input. Extended version, use html_print_radio_button() to simplify.
|
||||
* Render a radio button input. Extended version, use html_print_input()
|
||||
* to simplify.
|
||||
*
|
||||
* @param string Input name.
|
||||
* @param string Input value.
|
||||
* @param string Set the button to be marked (optional, unmarked by default).
|
||||
* @param bool Disable the button (optional, button enabled by default).
|
||||
* @param string Script to execute when onClick event is triggered (optional).
|
||||
* @param string Optional HTML attributes. It's a free string which will be
|
||||
inserted into the HTML tag, use it carefully (optional).
|
||||
* @param bool Whether to return an output string or echo now (optional, echo by default).
|
||||
* @param string $name Input name.
|
||||
* @param string $value Input value.
|
||||
* @param string $label Set the button to be marked (optional, unmarked by default).
|
||||
* @param string $checkedvalue Checked value.
|
||||
* @param string $disabled Disable the button (optional, button enabled by default).
|
||||
* @param string $script Script to execute when onClick event is triggered (optional).
|
||||
* @param string $attributes Optional HTML attributes. It's a free string which will be inserted tag, use it carefully (optional).
|
||||
* @param string $returnparam Whether to return an output string or echo now (optional, echo by default).
|
||||
* @param string $modalparam Modal param.
|
||||
* @param string $message Message.
|
||||
* @param string $id Use custom id.
|
||||
*
|
||||
* @return string HTML code if return parameter is true.
|
||||
*/
|
||||
/*
|
||||
Hello there! :)
|
||||
We added some of what seems to be "buggy" messages to the openSource version recently. This is not to force open-source users to move to the enterprise version, this is just to inform people using Pandora FMS open source that it requires skilled people to maintain and keep it running smoothly without professional support. This does not imply open-source version is limited in any way. If you check the recently added code, it contains only warnings and messages, no limitations except one: we removed the option to add custom logo in header. In the Update Manager section, it warns about the 'danger’ of applying automated updates without a proper backup, remembering in the process that the Enterprise version comes with a human-tested package. Maintaining an OpenSource version with more than 500 agents is not so easy, that's why someone using a Pandora with 8000 agents should consider asking for support. It's not a joke, we know of many setups with a huge number of agents, and we hate to hear that “its becoming unstable and slow” :(
|
||||
You can of course remove the warnings, that's why we include the source and do not use any kind of trick. And that's why we added here this comment, to let you know this does not reflect any change in our opensource mentality of does the last 14 years.
|
||||
*/
|
||||
|
||||
function html_print_radio_button_extended($name, $value, $label, $checkedvalue, $disabled, $script, $attributes, $return=false, $modal=false, $message='visualmodal')
|
||||
{
|
||||
function html_print_radio_button_extended(
|
||||
$name,
|
||||
$value,
|
||||
$label,
|
||||
$checkedvalue,
|
||||
$disabled,
|
||||
$script,
|
||||
$attributes,
|
||||
$return=false,
|
||||
$modal=false,
|
||||
$message='visualmodal',
|
||||
$id=null
|
||||
) {
|
||||
static $idcounter = 0;
|
||||
|
||||
$output = '';
|
||||
|
||||
$output = '<input type="radio" name="'.$name.'" value="'.$value.'"';
|
||||
$htmlid = 'radiobtn'.sprintf('%04d', ++$idcounter);
|
||||
if (empty($id) === false) {
|
||||
$htmlid = $id;
|
||||
} else {
|
||||
$htmlid = 'radiobtn'.sprintf('%04d', ++$idcounter);
|
||||
}
|
||||
|
||||
$output .= ' id="'.$htmlid.'"';
|
||||
|
||||
if ($value == $checkedvalue) {
|
||||
|
@ -3369,6 +3466,26 @@ function html_print_input($data, $wrapper='div', $input_only=false)
|
|||
);
|
||||
break;
|
||||
|
||||
case 'radio_button':
|
||||
$output .= html_print_radio_button_extended(
|
||||
$data['name'],
|
||||
$data['value'],
|
||||
$data['label'],
|
||||
((isset($data['checkedvalue']) === true) ? $data['checkedvalue'] : 1),
|
||||
((isset($data['disabled']) === true) ? $data['disabled'] : ''),
|
||||
((isset($data['script']) === true) ? $data['script'] : ''),
|
||||
((isset($data['attributes']) === true) ? $data['attributes'] : true),
|
||||
((isset($data['return']) === true) ? $data['return'] : false),
|
||||
((isset($data['modal']) === true) ? $data['modal'] : false),
|
||||
((isset($data['message']) === true) ? $data['message'] : 'visualmodal'),
|
||||
((isset($data['id']) === true) ? $data['id'] : null)
|
||||
);
|
||||
break;
|
||||
|
||||
case 'email':
|
||||
$output .= html_print_input_email($data);
|
||||
break;
|
||||
|
||||
default:
|
||||
// Ignore.
|
||||
break;
|
||||
|
|
|
@ -1411,7 +1411,7 @@ function ui_print_help_icon(
|
|||
[
|
||||
'class' => 'img_help',
|
||||
'title' => __('Help'),
|
||||
'onclick' => "open_help ('".$url."')",
|
||||
'onclick' => "open_help ('".ui_get_full_url('index.php?sec=view&sec2=general/help_feedback&pure=1&url='.$url)."')",
|
||||
'id' => $id,
|
||||
],
|
||||
false,
|
||||
|
@ -3523,6 +3523,8 @@ function ui_print_event_priority(
|
|||
* @param string $toggle_class Toggle class.
|
||||
* @param string $container_class Container class.
|
||||
* @param string $main_class Main object class.
|
||||
* @param string $img_a Image (closed).
|
||||
* @param string $img_b Image (opened).
|
||||
*
|
||||
* @return string HTML.
|
||||
*/
|
||||
|
@ -3535,20 +3537,22 @@ function ui_toggle(
|
|||
$return=false,
|
||||
$toggle_class='',
|
||||
$container_class='white-box-content',
|
||||
$main_class='box-shadow white_table_graph'
|
||||
$main_class='box-shadow white_table_graph',
|
||||
$img_a='images/arrow_down_green.png',
|
||||
$img_b='images/arrow_right_green.png'
|
||||
) {
|
||||
// Generate unique Id.
|
||||
$uniqid = uniqid('');
|
||||
|
||||
$image_a = html_print_image('images/arrow_down_green.png', true, false, true);
|
||||
$image_b = html_print_image('images/arrow_right_green.png', true, false, true);
|
||||
$image_a = html_print_image($img_a, true, false, true);
|
||||
$image_b = html_print_image($img_b, true, false, true);
|
||||
// Options.
|
||||
if ($hidden_default) {
|
||||
$style = 'display:none';
|
||||
$original = 'images/arrow_right_green.png';
|
||||
$original = $img_b;
|
||||
} else {
|
||||
$style = '';
|
||||
$original = 'images/arrow_down_green.png';
|
||||
$original = $img_a;
|
||||
}
|
||||
|
||||
// Link to toggle.
|
||||
|
@ -3601,6 +3605,31 @@ function ui_toggle(
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Simplified way of ui_toggle ussage.
|
||||
*
|
||||
* @param array $data Arguments.
|
||||
*
|
||||
* @return string HTML code with toggle content.
|
||||
*/
|
||||
function ui_print_toggle($data)
|
||||
{
|
||||
return ui_toggle(
|
||||
$data['content'],
|
||||
$data['name'],
|
||||
(isset($data['title']) === true) ? $data['title'] : '',
|
||||
(isset($data['id']) === true) ? $data['id'] : '',
|
||||
(isset($data['hidden_default']) === true) ? $data['hidden_default'] : true,
|
||||
(isset($data['return']) === true) ? $data['return'] : false,
|
||||
(isset($data['toggle_class']) === true) ? $data['toggle_class'] : '',
|
||||
(isset($data['container_class']) === true) ? $data['container_class'] : 'white-box-content',
|
||||
(isset($data['main_class']) === true) ? $data['main_class'] : 'box-shadow white_table_graph',
|
||||
(isset($data['img_a']) === true) ? $data['img_a'] : 'images/arrow_down_green.png',
|
||||
(isset($data['img_b']) === true) ? $data['img_b'] : 'images/arrow_right_green.png'
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Construct and return the URL to be used in order to refresh the current page correctly.
|
||||
*
|
||||
|
|
|
@ -206,6 +206,7 @@ label {
|
|||
|
||||
li > input[type="text"],
|
||||
li > input[type="password"],
|
||||
li > input[type="email"],
|
||||
.discovery_text_input > input[type="password"],
|
||||
.discovery_text_input > input[type="text"],
|
||||
#interval_manual > input[type="text"] {
|
||||
|
|
|
@ -0,0 +1,77 @@
|
|||
html,
|
||||
body {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
div#main_pure {
|
||||
background-color: #fefefe;
|
||||
text-align: left;
|
||||
margin-bottom: 0px;
|
||||
margin-top: 0px;
|
||||
margin-left: 0px;
|
||||
margin-right: 0px;
|
||||
width: 100%;
|
||||
position: static;
|
||||
}
|
||||
|
||||
div.help_feedback {
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
height: auto;
|
||||
background-color: #fff;
|
||||
right: 3em;
|
||||
}
|
||||
|
||||
.help_feedback label {
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
.help_feedback * {
|
||||
font-family: "lato", "courier", sans-serif;
|
||||
font-size: 8pt;
|
||||
}
|
||||
|
||||
.help_feedback .white_table_graph_header {
|
||||
background: #82b92e;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.help_feedback .white_table_graph {
|
||||
margin-bottom: 0;
|
||||
box-shadow: 0px 5px 6px 2px #888;
|
||||
}
|
||||
|
||||
.help_feedback .white-box-content form {
|
||||
margin-bottom: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.help_feedback .explain {
|
||||
margin: 10px auto;
|
||||
}
|
||||
|
||||
.textarea_feedback {
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
.email_feedback {
|
||||
max-width: 200px;
|
||||
margin-left: 39px;
|
||||
margin-top: 10px;
|
||||
margin-bottom: 10px;
|
||||
font-weight: bolder;
|
||||
}
|
||||
|
||||
.btn_submit_feed_back {
|
||||
margin: 15px 0 0 0;
|
||||
}
|
||||
|
||||
.btn {
|
||||
margin: 0 auto;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.flex-row-baseline.w100p label {
|
||||
cursor: pointer;
|
||||
}
|
Loading…
Reference in New Issue