Stripped from the internal repo: per-box deploy trees, Go services (nodelist/astmeta/proxy/svxdr), deploy/sync scripts and all secrets. Config templates for nginx, PHP-FPM, Redis and tmpfiles live in install/ with CHANGEME placeholders. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
70 lines
4.0 KiB
PHP
70 lines
4.0 KiB
PHP
<?php
|
|
declare(strict_types=1);
|
|
require __DIR__ . '/lib.php';
|
|
start_session();
|
|
$uuid = $_SESSION['uid'] ?? null;
|
|
if (!is_string($uuid) || $uuid === '') { header('Location: /'); exit; }
|
|
// Any logged-in user may open the page — add/edit/delete rights are enforced
|
|
// per-row by tglist_api.php (admin = all; owner = own TGs). Non-owners just see
|
|
// a read-only table.
|
|
$lvl = acct_admin_level($uuid);
|
|
|
|
$page_title = 'TG List — SvxPortal';
|
|
require __DIR__ . '/header.php';
|
|
?>
|
|
<div class="container py-4" style="max-width:1000px;">
|
|
<div id="page-tglist">
|
|
<div class="panel">
|
|
<div class="d-flex justify-content-between align-items-center mb-3 flex-wrap gap-2">
|
|
<h5 class="mb-0">TG List <span id="tglRoBadge" class="badge bg-secondary ms-2 small" style="display:none;">read-only</span></h5>
|
|
<div class="d-flex gap-2">
|
|
<button class="btn btn-outline-secondary btn-sm" id="btnTglRefresh">Refresh</button>
|
|
<button class="btn btn-outline-success btn-sm" id="btnTglAdd" style="display:none;">+ Add TG</button>
|
|
</div>
|
|
</div>
|
|
<p class="small text-secondary mb-3">Canonical TG → name list. Every box/program reads it from <span class="mono">/tglist.php</span>. Admins manage all entries and assign an owner; an owner (matching callsign) may edit their own TG's name / system / AllStar / mode.</p>
|
|
|
|
<div class="d-flex gap-2 mb-3 flex-wrap align-items-center">
|
|
<input type="text" class="form-control form-control-sm mono" id="tglSearch" placeholder="search tg / name / system … (regex ok)" style="max-width:320px;">
|
|
<select class="form-select form-select-sm" id="tglSortKey" style="width:auto;">
|
|
<option value="tg">Sort: TG</option>
|
|
<option value="name">Sort: Name</option>
|
|
<option value="system">Sort: System</option>
|
|
</select>
|
|
<button class="btn btn-outline-secondary btn-sm" id="tglSortDir" data-dir="asc" title="Toggle sort direction">▲ asc</button>
|
|
<span class="small text-secondary ms-auto" id="tglCount"></span>
|
|
</div>
|
|
|
|
<!-- Add / edit form (hidden until Add or Edit) -->
|
|
<div id="tglForm" class="mb-3 p-3" style="display:none; border:1px solid var(--line); border-radius:6px;">
|
|
<div class="row g-2">
|
|
<div class="col-6 col-md-2"><label class="small">TG</label><input id="tglfTg" type="number" class="form-control form-control-sm mono"></div>
|
|
<div class="col-6 col-md-3"><label class="small">Name</label><input id="tglfName" class="form-control form-control-sm" maxlength="64"></div>
|
|
<div class="col-6 col-md-3"><label class="small">System</label><input id="tglfSystem" class="form-control form-control-sm" maxlength="64"></div>
|
|
<div class="col-4 col-md-2"><label class="small">AllStar</label><input id="tglfAllstar" class="form-control form-control-sm mono" maxlength="10"></div>
|
|
<div class="col-4 col-md-2"><label class="small">Mode</label><input id="tglfMode" class="form-control form-control-sm" maxlength="16" placeholder="AllStar / DMR"></div>
|
|
<div class="col-4 col-md-3"><label class="small">Owner (callsign)</label><input id="tglfOwner" class="form-control form-control-sm mono" maxlength="12" style="text-transform:uppercase;"></div>
|
|
</div>
|
|
<div class="d-flex gap-2 mt-2">
|
|
<button class="btn btn-success btn-sm" id="tglfSave">Save</button>
|
|
<button class="btn btn-outline-secondary btn-sm" id="tglfCancel">Cancel</button>
|
|
</div>
|
|
</div>
|
|
|
|
<div style="overflow-x:auto;">
|
|
<table class="data-table">
|
|
<thead><tr>
|
|
<th>TG</th><th>Name</th><th>System</th><th>AllStar</th><th>Mode</th><th>Owner</th><th>Actions</th>
|
|
</tr></thead>
|
|
<tbody id="tglBody"></tbody>
|
|
</table>
|
|
</div>
|
|
<div id="tglMsg" class="small mt-2" style="display:none;"></div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<?php
|
|
$extra_scripts = '<script>var ADMIN_LEVEL = ' . $lvl . ';</script><script src="/auth/admin_tglist.js?v=' . @filemtime(__DIR__ . '/admin_tglist.js') . '"></script>';
|
|
require __DIR__ . '/footer.php';
|
|
?>
|