<?php global $system; global $systemCommonName; global $systemID; global $member; global $memberData; global $memberCommonName; global $memberID; $title = "Editing metadata for " . $memberCommonName . " · " . $systemCommonName; require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/metadata/" . $memberID . ".json")) { $metadata = parseMetadata(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/metadata/" . $memberID . ".json"), true)); } ?> <br> <div class="container" id="page-content"> <h2><?= $memberData["display_name"] ?? $memberData["name"] ?></h2> <?php if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/metadata/" . $memberID . ".json")): ?> <form> <input name="submit" type="hidden"> <p> <b>File</b><br> <?= $_SERVER['DOCUMENT_ROOT'] . "/includes/data/metadata/" . $memberID . ".json" ?> </p> <p> <b>Bitset</b><br> <code id="bitset-text"><?= $metadata["bitset"] ?></code> · <a data-bs-toggle="modal" data-bs-target="#bitset" href="#">Edit...</a> <input name="bitset" id="bitset-value" type="hidden" value="<?= $metadata["bitset"] ?>"> </p> <p> <b>Marefriends (full IDs, comma-separated):</b><br> <input name="marefriends" class="form-control" style="filter: invert(1) hue-rotate(180deg);" type="text" value="<?= implode(", ", $metadata["marefriends"]) ?>"> </p> <p> <b>Sisters (full IDs, comma-separated):</b><br> <input name="sisters" class="form-control" style="filter: invert(1) hue-rotate(180deg);" type="text" value="<?= implode(", ", $metadata["sisters"]) ?>"> </p> <p> <b>Caretakers (full IDs, comma-separated):</b><br> <input name="caretakers" class="form-control" style="filter: invert(1) hue-rotate(180deg);" type="text" value="<?= implode(", ", $metadata["caretakers"]) ?>"> </p> <p> <b>Age regressed version (local ID):</b><br> <input name="regressed" class="form-control" style="filter: invert(1) hue-rotate(180deg);" type="text" value="<?= $metadata["regressed"] ?? "" ?>"> </p> <p> <b>Birth date (use January 1<sup>st</sup> for none):</b><br> <input name="birth" class="form-control" style="filter: invert(1) hue-rotate(180deg);" type="date" value="<?= $metadata["birth"]["year"] ?? "" ?>-<?= $metadata["birth"]["date"] ?? "" ?>"> </p> <p> <b>Age (for ponies with fixed age):</b><br> <input name="age" class="form-control" style="filter: invert(1) hue-rotate(180deg);" type="number" value="<?= $metadata["birth"]["age"] ?? "" ?>"> </p> <input name="submit" class="btn btn-outline-primary" value="Save and quit" type="submit"> </form> <?php else: ?> <div class="alert alert-warning"> This member does not have a metadata file. This file needs to be initially created by an administrator before it can be edited using this page. </div> <?php endif; ?> </div> <div class="modal fade" id="bitset"> <div class="modal-dialog modal-xl"> <div class="modal-content"> <div class="modal-header"> <h4 class="modal-title"> <img src="/assets/icons/bitset.svg" style="filter: invert(1); vertical-align: middle; height: 32px; margin-right: 10px;"> <span style="vertical-align: middle;">Bitset editor</span> </h4> <button type="button" class="btn-close" data-bs-dismiss="modal"></button> </div> <div class="modal-body"> <iframe src="/-/bitset?embed=<?= $metadata["bitset"] ?>"></iframe> <script> setInterval(() => { try { document.getElementById("bitset-text").innerText = document.getElementById("bitset-value").value = document.getElementsByTagName("iframe")[0].contentDocument.getElementById("output-dec").innerText; } catch (e) {} }) </script> </div> </div> </div> </div> <style> .modal-header { border-bottom: 1px solid #353738; } .modal-content { border: 1px solid rgba(255, 255, 255, .2); background-color: #111; } .btn-close { filter: invert(1); } iframe { width: calc(100% + 2rem); min-height: calc(100% + 2rem); border-bottom-left-radius: .3rem; border-bottom-right-radius: .3rem; height: 60vh; margin: -1rem -1rem calc(-1rem - 6px); } </style> <?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/footer.inc'; ?>