Move the platform editing to config page
parent
d2213ca3e9
commit
1ba32d86f7
|
@ -1,10 +1,16 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
// render config variables array
|
// render config variables array
|
||||||
function renderConfig($config, $indent) {
|
function renderConfig($config, $indent, $platform=false) {
|
||||||
|
global $app_root;
|
||||||
|
if (isset($platform) && $platform === true) {
|
||||||
|
?>
|
||||||
|
<div class="border bg-light" style="padding-left: <?= $indent ?>px; padding-bottom: 20px; padding-top: 20px;">
|
||||||
|
<?php } else {
|
||||||
?>
|
?>
|
||||||
<div style="padding-left: <?= $indent ?>px; padding-bottom: 20px;">
|
<div style="padding-left: <?= $indent ?>px; padding-bottom: 20px;">
|
||||||
<?php
|
<?php
|
||||||
|
}
|
||||||
foreach ($config as $config_item => $config_value) {
|
foreach ($config as $config_item => $config_value) {
|
||||||
?>
|
?>
|
||||||
<div class="row mb-1" style="padding-left: <?= $indent ?>px;">
|
<div class="row mb-1" style="padding-left: <?= $indent ?>px;">
|
||||||
|
@ -12,18 +18,35 @@ function renderConfig($config, $indent) {
|
||||||
<?= htmlspecialchars($config_item) ?>:
|
<?= htmlspecialchars($config_item) ?>:
|
||||||
</div>
|
</div>
|
||||||
<?php
|
<?php
|
||||||
if (is_array($config_value)) {
|
if (isset($platform) && $platform === true) { ?>
|
||||||
?>
|
<div class="col-md-8 text-start">
|
||||||
|
<a class="btn btn-secondary" style="padding: 2px;" href="<?= $app_root ?>?platform=<?= htmlspecialchars($config_item) ?>&page=config&action=edit">edit</a>
|
||||||
<?php
|
<?php
|
||||||
|
// we don't delete the last platform
|
||||||
|
if (count($config) <= 1) { ?>
|
||||||
|
<span class="btn btn-light" style="padding: 2px;" href="#" data-toggle="tooltip" data-placement="right" data-offset="30.0" title="can't delete the last platform">delete</span>
|
||||||
|
<?php } else { ?>
|
||||||
|
<a class="btn btn-danger" style="padding: 2px;" href="<?= $app_root ?>?platform=<?= htmlspecialchars($config_item) ?>&page=config&action=delete">delete</a>
|
||||||
|
<?php } ?>
|
||||||
|
</div>
|
||||||
|
<?php }
|
||||||
|
|
||||||
|
if (is_array($config_value)) {
|
||||||
|
if ($config_item === 'platforms') {
|
||||||
|
$platform = true;
|
||||||
|
} else {
|
||||||
|
$platform = false;
|
||||||
|
}
|
||||||
// here we render recursively nested arrays
|
// here we render recursively nested arrays
|
||||||
$indent = $indent + 50;
|
$indent = $indent + 50;
|
||||||
renderConfig($config_value, $indent);
|
renderConfig($config_value, $indent, $platform);
|
||||||
$indent = 0;
|
$indent = 0;
|
||||||
} else {
|
} else {
|
||||||
// if it's not array, just display it
|
// if it's not array, just display it
|
||||||
?>
|
?>
|
||||||
<div class="border col-md-8 text-start">
|
<div class="border col-md-8 text-start">
|
||||||
<?= htmlspecialchars($config_value ?? '')?>
|
<?= htmlspecialchars($config_value ?? '')?>
|
||||||
|
<?= $platform ?>
|
||||||
</div>
|
</div>
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
</div>
|
</div>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
<br /> <br />
|
<br /> <br />
|
||||||
|
<a class="btn btn-secondary" href="<?= $app_root ?>?platform=<?= htmlspecialchars($platform_id) ?>&page=config" />Cancel</a>
|
||||||
<input type="submit" class="btn btn-primary" value="Save" />
|
<input type="submit" class="btn btn-primary" value="Save" />
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
|
|
||||||
<!-- widget "config" -->
|
<!-- widget "config" -->
|
||||||
<div class="card text-center w-50 mx-lef">
|
<div class="card text-center w-75 mx-lef">
|
||||||
<p class="h4 card-header">Jilo web configuration</p>
|
<p class="h4 card-header">Jilo web configuration</p>
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<p class="card-text">platform variables</p>
|
<p class="card-text">platform variables</p>
|
||||||
|
|
|
@ -11,21 +11,12 @@
|
||||||
<li class="font-weight-light text-uppercase" style="font-size: 0.5em; color: whitesmoke; margin-right: 70px; align-content: center;">version <?php echo $config['version']; ?></li>
|
<li class="font-weight-light text-uppercase" style="font-size: 0.5em; color: whitesmoke; margin-right: 70px; align-content: center;">version <?php echo $config['version']; ?></li>
|
||||||
|
|
||||||
<?php if ( isset($_SESSION['username']) ) { ?>
|
<?php if ( isset($_SESSION['username']) ) { ?>
|
||||||
<!--li><a href="?page=config">config</a></li>
|
|
||||||
<li><a href="?page=conferences">conferences</a></li>
|
|
||||||
<li><a href="?page=participants">participants</a></li>
|
|
||||||
<li><a href="?page=components">components</a></li-->
|
|
||||||
|
|
||||||
<li style="margin-right: 0px;">
|
<li style="margin-right: 3px;">
|
||||||
<a style="background-color: #111;" href="?platform=<?= htmlspecialchars(array_keys($config['platforms'])[$platform_id]) ?>&page=front">
|
<a style="background-color: #111;" href="?platform=<?= htmlspecialchars(array_keys($config['platforms'])[$platform_id]) ?>&page=front">
|
||||||
<?= htmlspecialchars($config['platforms'][$platform_id]['name']) ?>
|
<?= htmlspecialchars($config['platforms'][$platform_id]['name']) ?>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li style="margin: 0px; padding: 0px;">
|
|
||||||
<a style="background-color: #555; padding-left: 3px; padding-right: 3px;" href="?platform=<?= htmlspecialchars(array_keys($config['platforms'])[$platform_id]) ?>&page=config&action=edit">
|
|
||||||
<i class="fas fa-wrench" data-toggle="tooltip" data-placement="right" data-offset="30.0" title="configure platform "<?= htmlspecialchars($config['platforms'][$platform_id]['name']) ?>""></i>
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
|
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
Loading…
Reference in New Issue