Updated admin page
This commit is contained in:
parent
fcc1b18e4c
commit
cbd7995a31
6 changed files with 284 additions and 10 deletions
75
modules/steam_workshop/views/admin/index.php
Normal file
75
modules/steam_workshop/views/admin/index.php
Normal file
|
|
@ -0,0 +1,75 @@
|
|||
<?php
|
||||
declare(strict_types=1);
|
||||
/** @var array $lang */
|
||||
/** @var array $gameKeys */
|
||||
/** @var array $mappings */
|
||||
/** @var array $adapterOptions */
|
||||
/** @var array $adapters */
|
||||
?>
|
||||
<div class="sw-admin">
|
||||
<h3><?php echo htmlspecialchars($lang['admin_heading_game_mapping'] ?? 'Game type adapter mapping'); ?></h3>
|
||||
<p><?php echo htmlspecialchars($lang['admin_subheading_game_mapping'] ?? 'Select which adapter will manage Steam Workshop installs for each supported game.'); ?></p>
|
||||
|
||||
<form method="post" class="sw-form">
|
||||
<table class="table sw-mods__table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><?php echo htmlspecialchars($lang['admin_col_game_key'] ?? 'Game Key'); ?></th>
|
||||
<th><?php echo htmlspecialchars($lang['admin_col_adapter'] ?? 'Adapter'); ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php if (empty($gameKeys)): ?>
|
||||
<tr>
|
||||
<td colspan="2"><?php echo htmlspecialchars($lang['admin_no_game_keys'] ?? 'No game definitions were found in modules/config_games/server_configs.'); ?></td>
|
||||
</tr>
|
||||
<?php else: ?>
|
||||
<?php foreach ($gameKeys as $gameKey): ?>
|
||||
<tr>
|
||||
<td><?php echo htmlspecialchars($gameKey); ?></td>
|
||||
<td>
|
||||
<select name="mapping[<?php echo htmlspecialchars($gameKey); ?>]">
|
||||
<option value="">--</option>
|
||||
<?php foreach ($adapterOptions as $key => $label): ?>
|
||||
<option value="<?php echo htmlspecialchars($key); ?>" <?php echo (isset($mappings[$gameKey]) && $mappings[$gameKey] === $key) ? 'selected' : ''; ?>>
|
||||
<?php echo htmlspecialchars($label); ?>
|
||||
</option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
<?php endif; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="sw-form__actions">
|
||||
<button class="btn primary" type="submit"><?php echo htmlspecialchars($lang['button_save']); ?></button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<h3><?php echo htmlspecialchars($lang['admin_heading_adapters'] ?? 'Available adapters'); ?></h3>
|
||||
<table class="table sw-mods__table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><?php echo htmlspecialchars($lang['admin_col_key'] ?? 'Key'); ?></th>
|
||||
<th><?php echo htmlspecialchars($lang['summary_adapter']); ?></th>
|
||||
<th>Steam App ID</th>
|
||||
<th><?php echo htmlspecialchars($lang['admin_col_mods_dir'] ?? 'Mods Dir'); ?></th>
|
||||
<th><?php echo htmlspecialchars($lang['summary_hot_reload']); ?></th>
|
||||
<th><?php echo htmlspecialchars($lang['admin_col_notes'] ?? 'Notes'); ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($adapters as $adapter): ?>
|
||||
<tr>
|
||||
<td><?php echo htmlspecialchars($adapter['key']); ?></td>
|
||||
<td><?php echo htmlspecialchars($adapter['name']); ?></td>
|
||||
<td><?php echo htmlspecialchars($adapter['steam_app_id']); ?></td>
|
||||
<td><?php echo htmlspecialchars($adapter['mods_dir']); ?></td>
|
||||
<td><?php echo !empty($adapter['supports_hot_reload']) ? htmlspecialchars($lang['status_hot_reload']) : htmlspecialchars($lang['status_restart_required']); ?></td>
|
||||
<td><?php echo htmlspecialchars($adapter['notes']); ?></td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
|
@ -3,6 +3,7 @@ declare(strict_types=1);
|
|||
/** @var array $formConfig */
|
||||
/** @var array $adapterOptions */
|
||||
/** @var array $lang */
|
||||
/** @var bool $adapterLocked */
|
||||
$enabled = !empty($formConfig['workshop_enabled']);
|
||||
$interval = (int)$formConfig['update_interval_minutes'];
|
||||
$stagingDir = htmlspecialchars($formConfig['staging_dir']);
|
||||
|
|
@ -10,6 +11,7 @@ $postInstall = htmlspecialchars($formConfig['post_install_script']);
|
|||
$rawDefinition = htmlspecialchars($formConfig['raw_definition']);
|
||||
$installStrategy = $formConfig['install_strategy'];
|
||||
$onUpdateAction = $formConfig['on_update_action'];
|
||||
$currentAdapterName = $adapterOptions[$formConfig['adapter_key']] ?? strtoupper($formConfig['adapter_key']);
|
||||
?>
|
||||
<div class="sw-form__grid">
|
||||
<label class="sw-toggle">
|
||||
|
|
@ -19,13 +21,18 @@ $onUpdateAction = $formConfig['on_update_action'];
|
|||
|
||||
<label>
|
||||
<span><?php echo htmlspecialchars($lang['label_adapter']); ?></span>
|
||||
<select name="workshop[adapter_key]">
|
||||
<?php foreach ($adapterOptions as $key => $label): ?>
|
||||
<option value="<?php echo htmlspecialchars($key); ?>" <?php echo $formConfig['adapter_key'] === $key ? 'selected' : ''; ?>>
|
||||
<?php echo htmlspecialchars($label); ?>
|
||||
</option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
<?php if ($adapterLocked): ?>
|
||||
<input type="text" value="<?php echo htmlspecialchars($currentAdapterName); ?>" disabled />
|
||||
<small><?php echo htmlspecialchars($lang['adapter_locked_note'] ?? 'This adapter is managed by the administrator.'); ?></small>
|
||||
<?php else: ?>
|
||||
<select name="workshop[adapter_key]">
|
||||
<?php foreach ($adapterOptions as $key => $label): ?>
|
||||
<option value="<?php echo htmlspecialchars($key); ?>" <?php echo $formConfig['adapter_key'] === $key ? 'selected' : ''; ?>>
|
||||
<?php echo htmlspecialchars($label); ?>
|
||||
</option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
<?php endif; ?>
|
||||
</label>
|
||||
|
||||
<label>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue