From 211f29c0f95391ce1f10c8c4007cf7aab50d5583 Mon Sep 17 00:00:00 2001
From: Jose Gonzalez <jose.gonzalez@pandorafms.com>
Date: Thu, 16 Mar 2023 17:49:57 +0100
Subject: [PATCH] Websocket engine and quickshell

---
 pandora_console/extensions/quick_shell.php    | 121 ++++++++++--------
 .../godmode/setup/setup_websocket_engine.php  |  84 ++++++------
 2 files changed, 109 insertions(+), 96 deletions(-)

diff --git a/pandora_console/extensions/quick_shell.php b/pandora_console/extensions/quick_shell.php
index 3f8170e3c2..21e41cb63a 100644
--- a/pandora_console/extensions/quick_shell.php
+++ b/pandora_console/extensions/quick_shell.php
@@ -441,84 +441,95 @@ function quickShellSettings()
     }
 
     // Form. Using old style.
-    echo '<fieldset>';
+    echo '<fieldset class="margin-bottom-10">';
     echo '<legend>'.__('Quickshell').'</legend>';
 
     $t = new StdClass();
     $t->data = [];
     $t->width = '100%';
-    $t->class = 'databox filters';
+    $t->class = 'filter-table-adv';
     $t->data = [];
     $t->style = [];
-    $t->style[0] = 'font-weight: bold; width: 40%;';
+    $t->style[0] = 'width: 50%;';
 
-    $t->data[0][0] = __('Gotty path');
-    $t->data[0][1] = html_print_input_text(
-        'gotty',
-        $config['gotty'],
-        '',
-        30,
-        100,
-        true
+    $t->data[0][] = html_print_label_input_block(
+        __('Gotty path'),
+        html_print_input_text(
+            'gotty',
+            $config['gotty'],
+            '',
+            30,
+            100,
+            true
+        )
     );
 
-    $t->data[1][0] = __('Gotty host');
-    $t->data[1][1] = html_print_input_text(
-        'gotty_host',
-        $config['gotty_host'],
-        '',
-        30,
-        100,
-        true
+    $t->data[0][] = html_print_label_input_block(
+        __('Gotty host'),
+        html_print_input_text(
+            'gotty_host',
+            $config['gotty_host'],
+            '',
+            30,
+            100,
+            true
+        )
     );
 
-    $t->data[2][0] = __('Gotty ssh port');
-    $t->data[2][1] = html_print_input_text(
-        'gotty_ssh_port',
-        $config['gotty_ssh_port'],
-        '',
-        30,
-        100,
-        true
+    $t->data[1][] = html_print_label_input_block(
+        __('Gotty ssh port'),
+        html_print_input_text(
+            'gotty_ssh_port',
+            $config['gotty_ssh_port'],
+            '',
+            30,
+            100,
+            true
+        )
     );
 
-    $t->data[3][0] = __('Gotty telnet port');
-    $t->data[3][1] = html_print_input_text(
-        'gotty_telnet_port',
-        $config['gotty_telnet_port'],
-        '',
-        30,
-        100,
-        true
+    $t->data[1][] = html_print_label_input_block(
+        __('Gotty telnet port'),
+        html_print_input_text(
+            'gotty_telnet_port',
+            $config['gotty_telnet_port'],
+            '',
+            30,
+            100,
+            true
+        )
     );
 
-    $hidden = new StdClass();
+    $hidden = new stdClass();
     $hidden->data = [];
     $hidden->width = '100%';
-    $hidden->class = 'databox filters';
+    $hidden->class = 'filter-table-adv';
     $hidden->data = [];
-    $hidden->style[0] = 'font-weight: bold;width: 40%;';
+    $hidden->style[0] = 'width: 50%;';
 
-    $hidden->data[0][0] = __('Gotty user');
-    $hidden->data[0][1] = html_print_input_text(
-        'gotty_user',
-        $config['gotty_user'],
-        '',
-        30,
-        100,
-        true
+    $hidden->data[0][] = html_print_label_input_block(
+        __('Gotty user'),
+        html_print_input_text(
+            'gotty_user',
+            $config['gotty_user'],
+            '',
+            30,
+            100,
+            true
+        )
     );
 
-    $hidden->data[1][0] = __('Gotty password');
-    $hidden->data[1][1] = html_print_input_password(
-        'gotty_pass',
-        io_output_password($config['gotty_pass']),
-        '',
-        30,
-        100,
-        true
+    $hidden->data[0][] = html_print_label_input_block(
+        __('Gotty password'),
+        html_print_input_password(
+            'gotty_pass',
+            io_output_password($config['gotty_pass']),
+            '',
+            30,
+            100,
+            true
+        )
     );
-    $hidden->data[1][1] .= ui_print_reveal_password('gotty_pass', true);
 
     html_print_table($t);
 
diff --git a/pandora_console/godmode/setup/setup_websocket_engine.php b/pandora_console/godmode/setup/setup_websocket_engine.php
index f6e05c09de..e042ae7788 100644
--- a/pandora_console/godmode/setup/setup_websocket_engine.php
+++ b/pandora_console/godmode/setup/setup_websocket_engine.php
@@ -14,7 +14,7 @@
  * |___|   |___._|__|__|_____||_____|__| |___._| |___|   |__|_|__|_______|
  *
  * ============================================================================
- * Copyright (c) 2005-2021 Artica Soluciones Tecnologicas
+ * Copyright (c) 2005-2023 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
@@ -32,68 +32,70 @@ $url = ui_get_full_url(
     'index.php?sec=gsetup&sec2=godmode/setup/setup&amp;section=websocket_engine&amp;pure='.$config['pure']
 );
 
-echo '<form id="form_setup" method="post" action="'.$url.'">';
+echo '<form class="max_floating_element_size" id="form_setup" method="post" action="'.$url.'">';
 
-echo '<fieldset>';
+echo '<fieldset class="margin-bottom-10">';
 echo '<legend>'.__('WebSocket settings').'</legend>';
 
 $t = new StdClass();
 $t->data = [];
 $t->width = '100%';
-$t->class = 'databox filters';
+$t->class = 'databox filter-table-adv';
 $t->data = [];
-$t->style[0] = 'font-weight: bold';
 
-$t->data[0][0] = __('Bind address');
-$t->data[0][1] = html_print_input_text(
-    'ws_bind_address',
-    $config['ws_bind_address'],
-    '',
-    30,
-    100,
-    true
+$t->data[0][] = html_print_label_input_block(
+    __('Bind address'),
+    html_print_input_text(
+        'ws_bind_address',
+        $config['ws_bind_address'],
+        '',
+        30,
+        100,
+        true
+    )
 );
 
-$t->data[1][0] = __('Bind port');
-$t->data[1][2] = html_print_input_text(
-    'ws_port',
-    $config['ws_port'],
-    '',
-    30,
-    100,
-    true
+$t->data[0][] = html_print_label_input_block(
+    __('Bind port'),
+    html_print_input_text(
+        'ws_port',
+        $config['ws_port'],
+        '',
+        30,
+        100,
+        true
+    )
 );
 
-$t->data[2][0] = __('WebSocket proxy url');
-$t->data[2][2] = html_print_input_text(
-    'ws_proxy_url',
-    $config['ws_proxy_url'],
-    '',
-    30,
-    100,
-    true
+$t->data[1][] = html_print_label_input_block(
+    __('WebSocket proxy url'),
+    html_print_input_text(
+        'ws_proxy_url',
+        $config['ws_proxy_url'],
+        '',
+        30,
+        100,
+        true
+    )
 );
 
 html_print_input_hidden('update_config', 1);
 html_print_table($t);
 
-
 echo '</fieldset>';
 
 if (function_exists('quickShellSettings') === true) {
     quickShellSettings();
 }
 
-html_print_div(
-    [
-        'class'   => 'action-buttons w100p',
-        'content' => html_print_submit_button(
-            __('Update'),
-            'update_button',
-            false,
-            [ 'icon' => 'update' ],
-            true
-        ),
-    ]
+html_print_action_buttons(
+    html_print_submit_button(
+        __('Update'),
+        'update_button',
+        false,
+        [ 'icon' => 'update' ],
+        true
+    )
 );
+
 echo '</form>';