eHorus user-login settings
Former-commit-id: e62be3b137ef5583fbd29186a834a86b075e78fb
This commit is contained in:
parent
44b14debdc
commit
c527435a0e
|
@ -54,7 +54,6 @@ $table_enable->style['name'] = 'font-weight: bold';
|
||||||
$row = [];
|
$row = [];
|
||||||
$row['name'] = ('Enable eHorus');
|
$row['name'] = ('Enable eHorus');
|
||||||
$row['control'] = html_print_checkbox_switch('ehorus_enabled', 1, $config['ehorus_enabled'], true);
|
$row['control'] = html_print_checkbox_switch('ehorus_enabled', 1, $config['ehorus_enabled'], true);
|
||||||
$row['button'] = html_print_submit_button(__('Update'), 'update_button', false, 'class="sub upd"', true);
|
|
||||||
$table_enable->data['ehorus_enabled'] = $row;
|
$table_enable->data['ehorus_enabled'] = $row;
|
||||||
|
|
||||||
// Remote config table.
|
// Remote config table.
|
||||||
|
@ -71,8 +70,8 @@ $table_remote->style['name'] = 'font-weight: bold';
|
||||||
// Enable eHorus user configuration.
|
// Enable eHorus user configuration.
|
||||||
$row = [];
|
$row = [];
|
||||||
$row['name'] = ('Enable eHorus user configuration');
|
$row['name'] = ('Enable eHorus user configuration');
|
||||||
$row['control'] = html_print_checkbox_switch('ehorus-user-login', 1, $config['ehorus-user-login'], true);
|
$row['control'] = html_print_checkbox_switch('ehorus_user_login', 1, $config['ehorus_user_login'], true);
|
||||||
$table_remote->data['ehorus-user-login'] = $row;
|
$table_remote->data['ehorus_user_login'] = $row;
|
||||||
// User.
|
// User.
|
||||||
$row = [];
|
$row = [];
|
||||||
$row['name'] = __('User');
|
$row['name'] = __('User');
|
||||||
|
@ -145,35 +144,40 @@ if ($config['ehorus_enabled'] && !$custom_field_exists) {
|
||||||
ui_print_error_message($error_message);
|
ui_print_error_message($error_message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
hd($_POST);
|
||||||
|
echo '<form id="conf_ehorus" method="post">';
|
||||||
|
|
||||||
// Form enable.
|
// Form enable.
|
||||||
echo '<form id="form_enable" method="post">';
|
echo '<div id="conf_enable">';
|
||||||
html_print_input_hidden('update_config', 1);
|
html_print_input_hidden('update_config', 1);
|
||||||
html_print_table($table_enable);
|
html_print_table($table_enable);
|
||||||
echo '</form>';
|
echo '</div>';
|
||||||
|
|
||||||
// Form remote.
|
// Form remote.
|
||||||
if ($config['ehorus_enabled']) {
|
echo '<div id="conf_remote">';
|
||||||
echo '<form id="form_remote" method="post">';
|
|
||||||
echo '<fieldset>';
|
echo '<fieldset>';
|
||||||
echo '<legend>'.__('eHorus API').'</legend>';
|
echo '<legend>'.__('eHorus API').'</legend>';
|
||||||
html_print_input_hidden('update_config', 1);
|
html_print_input_hidden('update_config', 1);
|
||||||
html_print_table($table_remote);
|
html_print_table($table_remote);
|
||||||
|
echo '</div>';
|
||||||
|
echo '</fieldset>';
|
||||||
echo '<div class="action-buttons" style="width: '.$table_remote->width.'">';
|
echo '<div class="action-buttons" style="width: '.$table_remote->width.'">';
|
||||||
html_print_submit_button(__('Update'), 'update_button', false, 'class="sub upd"');
|
html_print_submit_button(__('Update'), 'update_button', false, 'class="sub upd"');
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
echo '</fieldset>';
|
|
||||||
|
|
||||||
echo '</form>';
|
echo '</form>';
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
$('form#form_enable').css('margin-bottom','20px');
|
$('#conf_enable').css('margin-bottom','20px');
|
||||||
var showFields = function () {
|
var showFields = function () {
|
||||||
$('form#form_remote').show();
|
$('#conf_remote').show();
|
||||||
}
|
}
|
||||||
var hideFields = function () {
|
var hideFields = function () {
|
||||||
$('form#form_remote').hide();
|
$('#conf_remote').hide();
|
||||||
}
|
}
|
||||||
var handleEnable = function (event) {
|
var handleEnable = function (event) {
|
||||||
var is_checked = $('input:checkbox[name="ehorus_enabled"]').is(':checked');
|
var is_checked = $('input:checkbox[name="ehorus_enabled"]').is(':checked');
|
||||||
|
@ -187,6 +191,15 @@ if ($config['ehorus_enabled']) {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if($('input:checkbox[name="ehorus_enabled"]').is(':checked'))
|
||||||
|
{
|
||||||
|
showFields();
|
||||||
|
}else
|
||||||
|
{
|
||||||
|
hideFields();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
$('input:checkbox[name="ehorus_enabled"]').change(handleEnable);
|
$('input:checkbox[name="ehorus_enabled"]').change(handleEnable);
|
||||||
|
|
||||||
var handleTest = function (event) {
|
var handleTest = function (event) {
|
||||||
|
|
|
@ -291,6 +291,8 @@ if ($update_user) {
|
||||||
$values['timezone'] = (string) get_parameter('timezone');
|
$values['timezone'] = (string) get_parameter('timezone');
|
||||||
$values['default_event_filter'] = (int) get_parameter('default_event_filter');
|
$values['default_event_filter'] = (int) get_parameter('default_event_filter');
|
||||||
$values['default_custom_view'] = (int) get_parameter('default_custom_view');
|
$values['default_custom_view'] = (int) get_parameter('default_custom_view');
|
||||||
|
$values['ehorus_user_login_user'] = get_parameter('ehorus_user_login_user', $user_info['ehorus_user_login_user']);
|
||||||
|
$values['ehorus_user_login_pass'] = get_parameter('ehorus_user_login_pass', $user_info['ehorus_user_login_pass']);
|
||||||
$dashboard = get_parameter('dashboard', '');
|
$dashboard = get_parameter('dashboard', '');
|
||||||
$visual_console = get_parameter('visual_console', '');
|
$visual_console = get_parameter('visual_console', '');
|
||||||
|
|
||||||
|
|
|
@ -1353,7 +1353,7 @@ function config_update_config()
|
||||||
$error_update[] = __('Enable eHorus');
|
$error_update[] = __('Enable eHorus');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!config_update_value('ehorus-user-login', (int) get_parameter('ehorus-user-login', 0))) {
|
if (!config_update_value('ehorus_user_login', (int) get_parameter('ehorus_user_login', 0))) {
|
||||||
$error_update[] = __('eHorus user login');
|
$error_update[] = __('eHorus user login');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -32,6 +32,7 @@ global $config;
|
||||||
// Load the header.
|
// Load the header.
|
||||||
require $config['homedir'].'/operation/users/user_edit_header.php';
|
require $config['homedir'].'/operation/users/user_edit_header.php';
|
||||||
|
|
||||||
|
hd($_POST);
|
||||||
if (!is_metaconsole()) {
|
if (!is_metaconsole()) {
|
||||||
date_default_timezone_set('UTC');
|
date_default_timezone_set('UTC');
|
||||||
include 'include/javascript/timezonepicker/includes/parser.inc';
|
include 'include/javascript/timezonepicker/includes/parser.inc';
|
||||||
|
@ -101,6 +102,9 @@ if (isset($_GET['modified']) && !$view_mode) {
|
||||||
}
|
}
|
||||||
|
|
||||||
$upd_info['time_autorefresh'] = (int) get_parameter('time_autorefresh', 0);
|
$upd_info['time_autorefresh'] = (int) get_parameter('time_autorefresh', 0);
|
||||||
|
$upd_info['ehorus_user_login_user'] = get_parameter('ehorus_user_login_user', $user_info['ehorus_user_login_user']);
|
||||||
|
$upd_info['ehorus_user_login_pass'] = get_parameter('ehorus_user_login_pass', $user_info['ehorus_user_login_pass']);
|
||||||
|
|
||||||
|
|
||||||
$is_admin = db_get_value('is_admin', 'tusuario', 'id_user', $id);
|
$is_admin = db_get_value('is_admin', 'tusuario', 'id_user', $id);
|
||||||
|
|
||||||
|
@ -614,8 +618,46 @@ if (!is_metaconsole()) {
|
||||||
<div class="edit_user_comments">'.$comments.'</div>
|
<div class="edit_user_comments">'.$comments.'</div>
|
||||||
</div>
|
</div>
|
||||||
</div>';
|
</div>';
|
||||||
if ($config['ehorus_enabled'] && $config['ehorus-user-login']) {
|
if ($config['ehorus_enabled'] && $config['ehorus_user_login']) {
|
||||||
ehorus_user_login_conf();
|
// eHorus user login
|
||||||
|
$table_remote = new StdClass();
|
||||||
|
$table_remote->data = [];
|
||||||
|
$table_remote->width = '100%';
|
||||||
|
$table_remote->styleTable = 'margin-bottom: 10px;';
|
||||||
|
$table_remote->id = 'ehorus_user_login';
|
||||||
|
$table_remote->class = 'ehorus_user_login white_box';
|
||||||
|
$table_remote->size['name'] = '30%';
|
||||||
|
$table_remote->style['name'] = 'font-weight: bold';
|
||||||
|
|
||||||
|
// User.
|
||||||
|
$row = [];
|
||||||
|
$row['name'] = __('User');
|
||||||
|
$row['control'] = html_print_input_text('ehorus_user_login_user', $user_info['ehorus_user_login_user'], '', 30, 100, true);
|
||||||
|
$table_remote->data['ehorus_user_login_user'] = $row;
|
||||||
|
|
||||||
|
// Pass.
|
||||||
|
$row = [];
|
||||||
|
$row['name'] = __('Password');
|
||||||
|
$row['control'] = html_print_input_password('ehorus_user_login_pass', io_output_password($user_info['ehorus_user_login_pass']), '', 30, 100, true);
|
||||||
|
$table_remote->data['ehorus_user_login_pass'] = $row;
|
||||||
|
|
||||||
|
// Test.
|
||||||
|
$ehorus_port = db_get_value('value', 'tconfig', 'token', 'ehorus_port');
|
||||||
|
$ehorus_host = db_get_value('value', 'tconfig', 'token', 'ehorus_hostname');
|
||||||
|
|
||||||
|
$row = [];
|
||||||
|
$row['name'] = __('Test');
|
||||||
|
$row['control'] = html_print_button(__('Start'), 'test-ehorus', false, 'ehorus_connection_test("'.$ehorus_host.'",'.$ehorus_port.')', 'class="sub next"', true);
|
||||||
|
$row['control'] .= '<span id="test-ehorus-spinner" style="display:none;"> '.html_print_image('images/spinner.gif', true).'</span>';
|
||||||
|
$row['control'] .= '<span id="test-ehorus-success" style="display:none;"> '.html_print_image('images/status_sets/default/severity_normal.png', true).'</span>';
|
||||||
|
$row['control'] .= '<span id="test-ehorus-failure" style="display:none;"> '.html_print_image('images/status_sets/default/severity_critical.png', true).'</span>';
|
||||||
|
$row['control'] .= '<span id="test-ehorus-message" style="display:none;"></span>';
|
||||||
|
$table_remote->data['ehorus_test'] = $row;
|
||||||
|
|
||||||
|
echo '<div class="ehorus_user_acces white_box">';
|
||||||
|
html_print_input_hidden('update_config', 1);
|
||||||
|
html_print_table($table_remote);
|
||||||
|
echo '</div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -727,58 +769,16 @@ if (!defined('METACONSOLE')) {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
// Include OpenLayers and timezone user map library.
|
// Include OpenLayers and timezone user map library.
|
||||||
echo '<script type="text/javascript" src="'.ui_get_full_url('include/javascript/timezonepicker/lib/jquery.timezone-picker.min.js').'"></script>'."\n\t";
|
echo '<script type="text/javascript" src="'.ui_get_full_url('include/javascript/timezonepicker/lib/jquery.timezone-picker.min.js').'"></script>'."\n\t";
|
||||||
echo '<script type="text/javascript" src="'.ui_get_full_url('include/javascript/timezonepicker/lib/jquery.maphilight.min.js').'"></script>'."\n\t";
|
echo '<script type="text/javascript" src="'.ui_get_full_url('include/javascript/timezonepicker/lib/jquery.maphilight.min.js').'"></script>'."\n\t";
|
||||||
// Closes no meta condition.
|
// Closes no meta condition.
|
||||||
}function ehorus_user_login_conf()
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function ehorus_user_login_conf()
|
||||||
{
|
{
|
||||||
// eHorus user login
|
|
||||||
$table_remote = new StdClass();
|
|
||||||
$table_remote->data = [];
|
|
||||||
$table_remote->width = '100%';
|
|
||||||
$table_remote->styleTable = 'margin-bottom: 10px;';
|
|
||||||
$table_remote->id = 'ehorus-user-login';
|
|
||||||
$table_remote->class = 'ehorus-user-login white_box';
|
|
||||||
$table_remote->size['name'] = '30%';
|
|
||||||
$table_remote->style['name'] = 'font-weight: bold';
|
|
||||||
|
|
||||||
// User.
|
|
||||||
$row = [];
|
|
||||||
$row['name'] = __('User');
|
|
||||||
$row['control'] = html_print_input_text('ehorus_user', $config['ehorus_user'], '', 30, 100, true);
|
|
||||||
$table_remote->data['ehorus_user'] = $row;
|
|
||||||
|
|
||||||
// Pass.
|
|
||||||
$row = [];
|
|
||||||
$row['name'] = __('Password');
|
|
||||||
$row['control'] = html_print_input_password('ehorus_pass', io_output_password($config['ehorus_pass']), '', 30, 100, true);
|
|
||||||
$table_remote->data['ehorus_pass'] = $row;
|
|
||||||
|
|
||||||
// Test.
|
|
||||||
$ehorus_port = db_get_value('value', 'tconfig', 'token', 'ehorus_port');
|
|
||||||
$ehorus_host = db_get_value('value', 'tconfig', 'token', 'ehorus_hostname');
|
|
||||||
|
|
||||||
$row = [];
|
|
||||||
$row['name'] = __('Test');
|
|
||||||
$row['control'] = html_print_button(__('Start'), 'test-ehorus', false, 'ehorus_connection_test('.$ehorus_host.','.$ehorus_port.')', 'class="sub next"', true);
|
|
||||||
$row['control'] .= '<span id="test-ehorus-spinner" style="display:none;"> '.html_print_image('images/spinner.gif', true).'</span>';
|
|
||||||
$row['control'] .= '<span id="test-ehorus-success" style="display:none;"> '.html_print_image('images/status_sets/default/severity_normal.png', true).'</span>';
|
|
||||||
$row['control'] .= '<span id="test-ehorus-failure" style="display:none;"> '.html_print_image('images/status_sets/default/severity_critical.png', true).'</span>';
|
|
||||||
$row['control'] .= ' <span id="test-ehorus-message" style="display:none;"></span>';
|
|
||||||
$table_remote->data['ehorus_test'] = $row;
|
|
||||||
|
|
||||||
echo ' <div class="ehorus-userlogin white_box">
|
|
||||||
|
|
||||||
<p class="edit_user_labels">'._('eHorus login').ui_print_help_tip(
|
|
||||||
__('This will activate autorefresh in selected pages'),
|
|
||||||
true
|
|
||||||
).'</p>';
|
|
||||||
html_print_input_hidden('update_config', 1);
|
|
||||||
html_print_table($table_remote);
|
|
||||||
echo '</div>';
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1109,40 +1109,40 @@ function show_double_auth_deactivation () {
|
||||||
}
|
}
|
||||||
|
|
||||||
function ehorus_connection_test(host, port) {
|
function ehorus_connection_test(host, port) {
|
||||||
var user = $('input#text-ehorus_user').val();
|
var user = $('input#text-ehorus_user_login_user').val();
|
||||||
var pass = $('input#password-ehorus_pass').val();
|
var pass = $('input#password-ehorus_user_login_pass').val();
|
||||||
|
|
||||||
|
|
||||||
|
debugger;
|
||||||
var badRequestMessage = '<?php echo __('Empty user or password'); ?>';
|
var badRequestMessage = '<?php echo __('Empty user or password'); ?>';
|
||||||
var notFoundMessage = '<?php echo __('User not found'); ?>';
|
var notFoundMessage = '<?php echo __('User not found'); ?>';
|
||||||
var invalidPassMessage = '<?php echo __('Invalid password'); ?>';
|
var invalidPassMessage = '<?php echo __('Invalid password'); ?>';
|
||||||
|
|
||||||
var hideLoadingImage = function () {
|
var hideLoadingImage = function () {
|
||||||
$('span#test-ehorus-spinner').hide();
|
$('#test-ehorus-spinner').hide();
|
||||||
}
|
}
|
||||||
var showLoadingImage = function () {
|
var showLoadingImage = function () {
|
||||||
$('span#test-ehorus-spinner').show();
|
$('#test-ehorus-spinner').show();
|
||||||
}
|
}
|
||||||
var hideSuccessImage = function () {
|
var hideSuccessImage = function () {
|
||||||
$('span#test-ehorus-success').hide();
|
$('#test-ehorus-success').hide();
|
||||||
}
|
}
|
||||||
var showSuccessImage = function () {
|
var showSuccessImage = function () {
|
||||||
$('span#test-ehorus-success').show();
|
$('#test-ehorus-success').show();
|
||||||
}
|
}
|
||||||
var hideFailureImage = function () {
|
var hideFailureImage = function () {
|
||||||
$('span#test-ehorus-failure').hide();
|
$('#test-ehorus-failure').hide();
|
||||||
}
|
}
|
||||||
var showFailureImage = function () {
|
var showFailureImage = function () {
|
||||||
$('span#test-ehorus-failure').show();
|
$('#test-ehorus-failure').show();
|
||||||
}
|
}
|
||||||
var hideMessage = function () {
|
var hideMessage = function () {
|
||||||
$('span#test-ehorus-message').hide();
|
$('#test-ehorus-message').hide();
|
||||||
}
|
}
|
||||||
var showMessage = function () {
|
var showMessage = function () {
|
||||||
$('span#test-ehorus-message').show();
|
$('#test-ehorus-message').show();
|
||||||
}
|
}
|
||||||
var changeTestMessage = function (message) {
|
var changeTestMessage = function (message) {
|
||||||
$('span#test-ehorus-message').text(message);
|
$('#test-ehorus-message').text(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
hideSuccessImage();
|
hideSuccessImage();
|
||||||
|
@ -1154,7 +1154,6 @@ function ehorus_connection_test (host, port) {
|
||||||
url: 'https://' + host + ':' + port + '/login',
|
url: 'https://' + host + ':' + port + '/login',
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
timeout: timeout ? timeout * 1000 : 0,
|
|
||||||
data: {
|
data: {
|
||||||
user: user,
|
user: user,
|
||||||
pass: pass
|
pass: pass
|
||||||
|
@ -1187,5 +1186,4 @@ function ehorus_connection_test (host, port) {
|
||||||
hideLoadingImage();
|
hideLoadingImage();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
$('input#button-test-ehorus').click(handleTest);
|
|
||||||
</script>
|
</script>
|
||||||
|
|
Loading…
Reference in New Issue