Better quickshell integration and fixes

This commit is contained in:
fbsanchez 2019-12-13 11:46:44 +01:00
parent bb093482a7
commit 3b5ebd0bf7
3 changed files with 27 additions and 29 deletions

View File

@ -65,17 +65,13 @@ function quickShell()
ui_require_css_file('discovery');
// Settings.
// WebSocket host, where to connect.
if (isset($config['ws_host']) === false) {
config_update_value('ws_host', $_SERVER['SERVER_ADDR']);
}
// WebSocket host, where client should connect.
if (isset($config['ws_port']) === false) {
config_update_value('ws_port', 8080);
}
if (empty($config['ws_proxy_url']) === true) {
$ws_url = 'http://'.$config['ws_host'].':'.$config['ws_port'];
$ws_url = 'http://'.$_SERVER['SERVER_ADDR'].':'.$config['ws_port'];
} else {
preg_match('/\/\/(.*)/', $config['ws_proxy_url'], $matches);
if (isset($_SERVER['HTTPS']) === true) {
@ -381,14 +377,6 @@ function quickShellSettings()
}
}
// Interface.
ui_print_page_header(
__('QuickShell settings'),
'',
false,
'quickshell_settings'
);
if ($changes > 0) {
$msg = __('%d Updated', $changes);
if ($critical > 0) {
@ -523,19 +511,4 @@ if (empty($agent_id) === false
}
}
extensions_add_godmode_menu_option(
// Name.
__('QuickShell settings'),
// Acl.
'PM',
// FatherId.
'gextensions',
// Icon.
'images/ehorus/terminal.png',
// Version.
'N/A',
// SubfatherId.
null
);
extensions_add_godmode_function('quickShellSettings');

View File

@ -316,6 +316,13 @@ if (check_acl($config['id_user'], 0, 'PM')) {
$sub2['godmode/setup/setup&section=notifications']['text'] = __('Notifications');
$sub2['godmode/setup/setup&section=notifications']['refr'] = 0;
// Enable only if quickshell is enabled.
if (function_exists('quickShellSettings') === true) {
$sub2['godmode/setup/setup&section=quickshell']['text'] = __('QuickShell');
$sub2['godmode/setup/setup&section=quickshell']['refr'] = 0;
}
if ($config['activate_gis']) {
$sub2['godmode/setup/gis']['text'] = __('Map conections GIS');
}

View File

@ -133,6 +133,14 @@ $buttons['notifications'] = [
'text' => '<a href="'.ui_get_full_url('index.php?sec=gsetup&sec2=godmode/setup/setup&section=notifications').'">'.html_print_image('images/alerts_template.png', true, ['title' => __('Notifications')]).'</a>',
];
// Enable only if quickshell is enabled.
if (function_exists('quickShellSettings') === true) {
$buttons['quickshell'] = [
'active' => false,
'text' => '<a href="'.ui_get_full_url('index.php?sec=gsetup&sec2=godmode/setup/setup&section=quickshell').'">'.html_print_image('images/ehorus/terminal.png', true, ['title' => __('Quickshell')]).'</a>',
];
}
$help_header = '';
if (enterprise_installed()) {
$subpage = setup_enterprise_add_subsection_main($section, $buttons, $help_header);
@ -183,6 +191,12 @@ switch ($section) {
$subpage = ' &raquo '.__('Notifications');
break;
case 'quickshell':
$buttons['quickshell']['active'] = true;
$subpage = ' &raquo '.__('QuickShell');
$help_header = 'quickshell_settings';
break;
case 'enterprise':
$buttons['enterprise']['active'] = true;
$subpage = ' &raquo '.__('Enterprise');
@ -247,6 +261,10 @@ switch ($section) {
include_once $config['homedir'].'/godmode/setup/setup_notifications.php';
break;
case 'quickshell':
quickShellSettings();
break;
default:
enterprise_hook('setup_enterprise_select_tab', [$section]);
break;