diff options
Diffstat (limited to 'includes/titlebar.inc')
-rw-r--r-- | includes/titlebar.inc | 106 |
1 files changed, 67 insertions, 39 deletions
diff --git a/includes/titlebar.inc b/includes/titlebar.inc index c49f7b2..e3e6c0c 100644 --- a/includes/titlebar.inc +++ b/includes/titlebar.inc @@ -1,4 +1,4 @@ -<?php global $toplevel; global $system; global $isLoggedIn; global $lang; global $pages; $pages = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/pages.json"), true); global $lang; global $pages; ?> +<?php global $toplevel; global $system; global $isLoggedIn; global $lang; global $isLowerLoggedIn; global $pages; $pages = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/pages.json"), true); global $lang; global $pages; global $app; ?> <span> <?php @@ -66,18 +66,33 @@ if (isset($pages[$name])) { $actionsProfile = "system"; $part1 = "Raindrops System"; } +} elseif ($name === $app["other"]["slug"]) { + if (isset($parts[2])) { + $part2 = "<a class='title-bar-backlink' href='/" . $app["other"]["slug"] . "'>" . $app["other"]["name"] . "</a>"; + + $part1 = $pages["s:" . $parts[2]]['name'][$lang["_name"]] ?? $parts[2]; + } else { + $actionsProfile = "system"; + $part1 = $app["other"]["name"]; + } } else { $member = getMemberFromName($name); $actionsProfile = "member"; + if ($member["_system"] === $app["other"]["id"]) { + $actionsProfile = "member-other"; + } + if (isset($member)) { $memberName = $member["display_name"] ?? $member["name"]; $part1 = "$memberName"; if ($member["_system"] === "gdapd") { $part2 = "<a class='title-bar-backlink' href='/raindrops'>Raindrops System</a>"; - } else { + } elseif ($member["_system"] === "ynmuc") { $part2 = "<a class='title-bar-backlink' href='/cloudburst'>Cloudburst System</a>"; + } else { + $part2 = "<a class='title-bar-backlink' href='/" . $app["other"]["slug"] . "'>" . $app["other"]["name"] . "</a>"; } } else { $part1 = "$name"; @@ -167,24 +182,6 @@ $links = [ "invert" => true ], [ - "name" => "Screens", - "link" => [ - "type" => "url", - "text" => "#screens" - ], - "icon" => "/assets/icons/computers-screens.svg", - "invert" => true - ], - [ - "name" => "Windows", - "link" => [ - "type" => "url", - "text" => "#windows" - ], - "icon" => "/assets/icons/computers-windows.svg", - "invert" => true - ], - [ "name" => $lang["titlebar"]["top"], "link" => [ "type" => "js", @@ -323,6 +320,36 @@ $links = [ "invert" => true ] ], + "member-other" => [ + [ + "name" => $lang["titlebar"]["member"], + "link" => [ + "type" => "url", + "text" => "/$system" + ], + "icon" => "/assets/icons/parent.svg", + "invert" => true + ], + [ + "name" => $pages["edit"]["name"][$lang["_name"]], + "link" => [ + "type" => "url", + "text" => "/-/edit/$system/$name" + ], + "icon" => "/assets/icons/edit.svg", + "invert" => true, + "show" => $isLoggedIn + ], + [ + "name" => $lang["titlebar"]["top"], + "link" => [ + "type" => "js", + "text" => "document.body.scrollTop = 0; document.documentElement.scrollTop = 0;" + ], + "icon" => "/assets/icons/up.svg", + "invert" => true + ] + ], "subsystem" => [ [ "name" => $lang["titlebar"]["subsystem"], @@ -551,24 +578,6 @@ $links = [ "invert" => true ], [ - "name" => $pages["s:tree"]["name"][$lang["_name"]], - "link" => [ - "type" => "url", - "text" => "/$name/-/tree" - ], - "icon" => "/assets/icons/tree.svg", - "invert" => true - ], - [ - "name" => $pages["s:species"]["name"][$lang["_name"]], - "link" => [ - "type" => "url", - "text" => "/$name/-/species" - ], - "icon" => "/assets/icons/species.svg", - "invert" => true - ], - [ "name" => $pages["edit"]["name"][$lang["_name"]], "link" => [ "type" => "url", @@ -602,11 +611,30 @@ if ($_SERVER['HTTP_HOST'] !== "fr.equestria.horse") { ]); } +if ($isLowerLoggedIn || $isLoggedIn) { + $links["home"][] = [ + "name" => $app["other"]["name"], + "link" => [ + "type" => "url", + "text" => "/" . $app["other"]["slug"] + ], + "icon" => "/assets/avatars/" . str_replace("-", "", $app["other"]["uuid"]) . ".webp", + "invert" => false + ]; + + $links["home"] = [ + array_values(array_filter($links["home"], function ($i) { return $i["name"] === "Cloudburst System"; }))[0], + array_values(array_filter($links["home"], function ($i) { return $i["name"] === "Raindrops System"; }))[0], + array_values(array_filter($links["home"], function ($i) use ($app) { return $i["name"] === $app["other"]["name"]; }))[0], + array_values(array_filter($links["home"], function ($i) { return $i["link"]["type"] === "js"; }))[0] + ]; +} + $linksList = $links[isset($links[$actionsProfile]) ? $actionsProfile : "default"]; ?><!-- (<code><?= $actionsProfile ?></code>)--><!--<pre><?php var_dump($parts); ?></pre>--> <span id="title-bar-actions"> - <?php foreach ($linksList as $index => $link): if (!(isset($link["show"]) && !$link["show"])): ?><a style="display: inline-block; padding: 4px;" id="title-bar-action-<?= $index ?>" <?php if ($link["link"]["type"] === "url"): ?>href<?php else: ?>onclick<?php endif; ?>="<?= $link["link"]["text"] ?>" title="<?= $link["name"] ?>" data-bs-toggle="tooltip" class="title-bar-action tooltip-nohelp"><img src="<?= $link["icon"] ?>" <?php if ($link["invert"]): ?>class="dropdown-icon"<?php endif; ?> alt="" style="width:24px;vertical-align: middle;"></a><?php endif; endforeach; ?> + <?php foreach ($linksList as $index => $link): if (!(isset($link["show"]) && !$link["show"])): ?><a style="height: 33px; display: inline-block; padding: 4px;" id="title-bar-action-<?= $index ?>" <?php if ($link["link"]["type"] === "url"): ?>href<?php else: ?>onclick<?php endif; ?>="<?= $link["link"]["text"] ?>" title="<?= $link["name"] ?>" data-bs-toggle="tooltip" class="title-bar-action tooltip-nohelp"><img src="<?= $link["icon"] ?>" <?php if ($link["invert"]): ?>class="dropdown-icon"<?php endif; ?> alt="" style="width:24px;vertical-align: middle;"></a><?php endif; endforeach; ?> </span> </span> |