1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
|
<?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><a href="/<?= $memberData["name"] ?>"><?= $memberData["display_name"] ?? $memberData["name"] ?></a></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>Primary interest (keep it short):</b><br>
<input name="interest" class="form-control" style="filter: invert(1) hue-rotate(180deg);" type="text" value="<?= $metadata["interest"] ?? "" ?>">
</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>
<p>
<b>Member code:</b><br>
<input name="membc" class="form-control" style="filter: invert(1) hue-rotate(180deg);" type="text" value="<?= $metadata["code"] ?? "" ?>">
</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'; ?>
|