Moves config file to its own page

main
Yasen Pramatarov 2024-10-29 13:15:14 +02:00
parent ced3ac484d
commit 15798b08a7
3 changed files with 111 additions and 86 deletions

View File

@ -109,20 +109,32 @@ if ($_SERVER['REQUEST_METHOD'] == 'POST') {
// no form submitted, show the templates // no form submitted, show the templates
} else { } else {
// $item - config.js and interface_config.js are special case; remote loaded files
switch ($item) { switch ($item) {
case 'configjs': case 'platforms':
$mode = $_REQUEST['mode'] ?? ''; $mode = $_REQUEST['mode'] ?? '';
$raw = ($mode === 'raw'); $raw = ($mode === 'raw');
$platformConfigjs = $configObject->getPlatformConfigjs($platformDetails[0]['jitsi_url'], $raw); $platformConfigjs = $configObject->getPlatformConfigjs($platformDetails[0]['jitsi_url'], $raw);
include '../app/templates/config-list-configjs.php'; include '../app/templates/config-list-configjs.php';
break; break;
case 'interfaceconfigjs': case 'hosts':
$mode = $_REQUEST['mode'] ?? ''; $mode = $_REQUEST['mode'] ?? '';
$raw = ($mode === 'raw'); $raw = ($mode === 'raw');
$platformInterfaceConfigjs = $configObject->getPlatformInterfaceConfigjs($platformDetails[0]['jitsi_url'], $raw); $platformInterfaceConfigjs = $configObject->getPlatformInterfaceConfigjs($platformDetails[0]['jitsi_url'], $raw);
include '../app/templates/config-list-interfaceconfigjs.php'; include '../app/templates/config-list-interfaceconfigjs.php';
break; break;
case 'endpoints':
$mode = $_REQUEST['mode'] ?? '';
$raw = ($mode === 'raw');
$platformInterfaceConfigjs = $configObject->getPlatformInterfaceConfigjs($platformDetails[0]['jitsi_url'], $raw);
include '../app/templates/config-list-interfaceconfigjs.php';
break;
case 'config_file':
if ($userObject->hasRight($user_id, 'view config file')) {
include '../app/templates/config-configfile.php';
} else {
include '../app/templates/error-unauthorized.php';
}
break;
// if there is no $item, we work on the local config DB // if there is no $item, we work on the local config DB
default: default:
@ -153,12 +165,6 @@ if ($_SERVER['REQUEST_METHOD'] == 'POST') {
include '../app/templates/config-delete-platform.php'; include '../app/templates/config-delete-platform.php';
} }
break; break;
default:
if ($userObject->hasRight($user_id, 'view config file')) {
include '../app/templates/config-list.php';
} else {
include '../app/templates/error-unauthorized.php';
}
} }
} }
} }

View File

@ -9,9 +9,6 @@ require '../app/classes/agent.php';
$configObject = new Config(); $configObject = new Config();
$agentObject = new Agent($dbWeb); $agentObject = new Agent($dbWeb);
// no form submitted, show the templates
// $item - config.js and interface_config.js are special case; remote loaded files
switch ($item) { switch ($item) {
case 'graphs': case 'graphs':

View File

@ -0,0 +1,22 @@
<!-- widget "config" -->
<div class="card text-center w-75 mx-lef">
<p class="h4 card-header">Jilo configuration</p>
<p class="h6 card-header">
<span class="btn btn-outline-primary btn-sm active" aria-pressed="true" style="cursor: default;">platforms</span>
<a href="" class="btn btn-outline-primary btn-sm">hosts</a>
<a href="" class="btn btn-outline-primary btn-sm">endpoints</a>
&nbsp;&nbsp;
<a href="" class="btn btn-outline-primary btn-sm">config file</a>
</p>
<div class="card-body">
<p class="card-text">main variables</p>
<?php
include '../app/helpers/render.php';
renderConfig($config, '0');
echo "\n";
?>
</div>
</div>
<!-- /widget "config" -->