Move the platform editing to config page
parent
d2213ca3e9
commit
1ba32d86f7
|
@ -1,37 +1,60 @@
|
|||
<?php
|
||||
|
||||
// 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;">
|
||||
<?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="col-md-4 text-end">
|
||||
<?= htmlspecialchars($config_item) ?>:
|
||||
</div>
|
||||
<?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
|
||||
// here we render recursively nested arrays
|
||||
$indent = $indent + 50;
|
||||
renderConfig($config_value, $indent);
|
||||
$indent = 0;
|
||||
} else {
|
||||
// if it's not array, just display it
|
||||
// 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
|
||||
$indent = $indent + 50;
|
||||
renderConfig($config_value, $indent, $platform);
|
||||
$indent = 0;
|
||||
} else {
|
||||
// if it's not array, just display it
|
||||
?>
|
||||
<div class="border col-md-8 text-start">
|
||||
<?= htmlspecialchars($config_value ?? '')?>
|
||||
<?= $platform ?>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
echo '</div>';
|
||||
}
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
</div>
|
||||
<?php } ?>
|
||||
<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" />
|
||||
</form>
|
||||
</div>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
<!-- 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>
|
||||
<div class="card-body">
|
||||
<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>
|
||||
|
||||
<?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">
|
||||
<?= htmlspecialchars($config['platforms'][$platform_id]['name']) ?>
|
||||
</a>
|
||||
</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 } ?>
|
||||
</ul>
|
||||
|
|
Loading…
Reference in New Issue