0.7.0: after_action setting (stay on page with job status vs jump to log), settings UI
This commit is contained in:
1 parent
642a11f505
commit
cbf899b94b
6 files changed
+110
-5
No files matched your search
@@ -6,6 +6,16 @@
|
||||
require_once 'vmmngr-boot.inc';
|
||||
require_once 'vmmngr-config-lib.inc';
|
||||
|
||||
if (strtoupper((string)($_SERVER['REQUEST_METHOD'] ?? '')) === 'POST' && ($_POST['act'] ?? '') === 'save_settings') {
|
||||
$conf = vmm_config();
|
||||
$conf['after_action'] = ($_POST['after_action'] ?? 'stay') === 'log' ? 'log' : 'stay';
|
||||
$conf['vm_source'] = in_array($_POST['vm_source'] ?? '', ['auto', 'system', 'bundle'], true) ? $_POST['vm_source'] : 'auto';
|
||||
vmm_save_config($conf);
|
||||
$_SESSION['vmmngr_error'] = gettext('Settings saved.');
|
||||
header('Location: vmmngr_config.php');
|
||||
exit;
|
||||
}
|
||||
|
||||
if (strtoupper((string)($_SERVER['REQUEST_METHOD'] ?? '')) === 'POST' && ($_POST['act'] ?? '') === 'register') {
|
||||
$added = vmm_register_boot();
|
||||
$_SESSION['vmmngr_error'] = $added === []
|
||||
@@ -30,6 +40,36 @@ vmm_nav('config'); ?>
|
||||
<?php print_info_box(vmm_h((string)$_SESSION['vmmngr_error'])); unset($_SESSION['vmmngr_error']); ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php $bs = vmm_boot_state(); $conf = vmm_config(); ?>
|
||||
<table class="area_data_settings" style="width:100%;border-collapse:collapse;">
|
||||
<colgroup><col class="area_data_settings_col_tag"><col class="area_data_settings_col_data"></colgroup>
|
||||
<thead><?php html_separator2(); html_titleline2(gettext('Behaviour'), 2); ?></thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="celltag"><?=gettext('After an action');?></td>
|
||||
<td class="celldata">
|
||||
<select name="after_action">
|
||||
<option value="stay" <?=($conf['after_action'] ?? 'stay') === 'stay' ? 'selected' : '';?>><?=gettext('stay on the page, show job status');?></option>
|
||||
<option value="log" <?=($conf['after_action'] ?? 'stay') === 'log' ? 'selected' : '';?>><?=gettext('jump to the job log');?></option>
|
||||
</select>
|
||||
<button type="submit" class="formbtn" name="act" value="save_settings" style="margin-left:8px;"><?=gettext('Save');?></button>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="celltag">vm_source</td>
|
||||
<td class="celldata">
|
||||
<select name="vm_source">
|
||||
<?php foreach (['auto', 'system', 'bundle'] as $src): ?>
|
||||
<option value="<?=$src;?>" <?=($conf['vm_source'] ?? 'auto') === $src ? 'selected' : '';?>><?=$src;?></option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<br />
|
||||
|
||||
<?php $bs = vmm_boot_state(); ?>
|
||||
<table class="area_data_settings" style="width:100%;border-collapse:collapse;">
|
||||
<colgroup><col class="area_data_settings_col_tag"><col class="area_data_settings_col_data"></colgroup>
|
||||
|
||||
Reference in new issue
Block a user