From 209356b8ade1920b50d1d3a1a5e121c6623d167b Mon Sep 17 00:00:00 2001 From: Minteck Date: Fri, 11 Nov 2022 23:47:49 +0100 Subject: Update --- includes/titlebar.inc | 476 ++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 465 insertions(+), 11 deletions(-) (limited to 'includes/titlebar.inc') diff --git a/includes/titlebar.inc b/includes/titlebar.inc index de58549..5166f08 100644 --- a/includes/titlebar.inc +++ b/includes/titlebar.inc @@ -1,7 +1,10 @@ - + Dashboard"; $part2 = "" . $pages[$name]['name'] . ""; if ($name === "docs") { $actionsProfile = "docs-item"; $part1 = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/docs/" . $parts[2] . ".json"), true)["name"]; + } elseif ($name === "computers") { + $part1 = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/computers/metadata/" . $parts[2] . ".json"), true)["host"]; } else { $actionsProfile = "$name-item"; $list = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/" . ($name === "toys" ? "toys/toys" : "actions/actions") . ".json"), true); @@ -104,6 +109,13 @@ if ($actionsProfile === "default") { $actionsProfile = "docs"; break; + case "edit": + case "edit-private": + if (count($parts) === 3) $actionsProfile = "editor-system"; + if (count($parts) > 3 && in_array($parts[3], $membersNames)) $actionsProfile = "editor-member"; + if (count($parts) > 3 && !in_array($parts[3], $membersNames)) $actionsProfile = "editor-subsystem"; + break; + case "debug": $actionsProfile = "debug"; break; @@ -112,13 +124,14 @@ if ($actionsProfile === "default") { $actionsProfile = "bitset"; break; - case "parser": - case "prefix": - $actionsProfile = "parser-prefix"; + case "computers": + if (count($parts) === 3) $actionsProfile = "computers"; + if (count($parts) === 4) $actionsProfile = "computers-remote"; break; } } +echo(""); if (isset($part3)) { echo "$part3 > $part2 > $part1"; } elseif (isset($part2)) { @@ -126,6 +139,10 @@ if (isset($part3)) { } else { echo "$part1"; } +echo(""); +echo(""); $links = [ "default" => [ @@ -138,18 +155,455 @@ $links = [ "icon" => "/assets/icons/up.svg", "invert" => true ] + ], + "computers" => [ + [ + "name" => "Remote control", + "link" => [ + "type" => "url", + "text" => "/-/computers/" . ($parts[2] ?? null) . "/control" + ], + "icon" => "/assets/icons/computers-remote.svg", + "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" => "Go back to top", + "link" => [ + "type" => "js", + "text" => "document.body.scrollTop = 0; document.documentElement.scrollTop = 0;" + ], + "icon" => "/assets/icons/up.svg", + "invert" => true + ] + ], + "computers-remote" => [ + [ + "name" => "Enable controlling", + "link" => [ + "type" => "js", + "text" => "enableControl();" + ], + "icon" => "/assets/icons/computers-on.svg", + "invert" => true + ], + [ + "name" => "Disable controlling", + "link" => [ + "type" => "js", + "text" => "disableControl();" + ], + "icon" => "/assets/icons/computers-off.svg", + "invert" => true + ], + [ + "name" => "Back to computer info", + "link" => [ + "type" => "url", + "text" => "/-/computers/" . ($parts[2] ?? null) + ], + "icon" => "/assets/icons/up.svg", + "invert" => true + ] + ], + "editor-member" => [ + [ + "name" => "View page", + "link" => [ + "type" => "url", + "text" => "/" . ($parts[3] ?? null) + ], + "icon" => "/assets/icons/view.svg", + "invert" => true + ], + [ + "name" => "Go back to top", + "link" => [ + "type" => "js", + "text" => "document.body.scrollTop = 0; document.documentElement.scrollTop = 0;" + ], + "icon" => "/assets/icons/up.svg", + "invert" => true + ] + ], + "editor-system" => [ + [ + "name" => "View page", + "link" => [ + "type" => "url", + "text" => "/" . ($parts[2] ?? null) + ], + "icon" => "/assets/icons/view.svg", + "invert" => true + ], + [ + "name" => "Go back to top", + "link" => [ + "type" => "js", + "text" => "document.body.scrollTop = 0; document.documentElement.scrollTop = 0;" + ], + "icon" => "/assets/icons/up.svg", + "invert" => true + ] + ], + "editor-subsystem" => [ + [ + "name" => "View page", + "link" => [ + "type" => "url", + "text" => "/" . ($parts[2] ?? null) . "/-/subsystem" . ($parts[3] ?? null) + ], + "icon" => "/assets/icons/view.svg", + "invert" => true + ], + [ + "name" => "Go back to top", + "link" => [ + "type" => "js", + "text" => "document.body.scrollTop = 0; document.documentElement.scrollTop = 0;" + ], + "icon" => "/assets/icons/up.svg", + "invert" => true + ] + ], + "member" => [ + [ + "name" => "System", + "link" => [ + "type" => "url", + "text" => "/$system" + ], + "icon" => "/assets/icons/parent.svg", + "invert" => true + ], + [ + "name" => $pages["edit-private"]["name"], + "link" => [ + "type" => "url", + "text" => "/-/edit-private/$system/$name" + ], + "icon" => "/assets/icons/edit-private.svg", + "invert" => true, + "show" => $isLoggedIn + ], + [ + "name" => $pages["edit"]["name"], + "link" => [ + "type" => "url", + "text" => "/-/edit/$system/$name" + ], + "icon" => "/assets/icons/edit.svg", + "invert" => true, + "show" => $isLoggedIn + ], + [ + "name" => "Go back to top", + "link" => [ + "type" => "js", + "text" => "document.body.scrollTop = 0; document.documentElement.scrollTop = 0;" + ], + "icon" => "/assets/icons/up.svg", + "invert" => true + ] + ], + "subsystem" => [ + [ + "name" => "Parent system", + "link" => [ + "type" => "url", + "text" => "/$parts[0]" + ], + "icon" => "/assets/icons/parent.svg", + "invert" => true + ], + [ + "name" => $pages["edit"]["name"], + "link" => [ + "type" => "url", + "text" => "/-/edit/$system/" . ($parts[3] ?? null) + ], + "icon" => "/assets/icons/edit.svg", + "invert" => true, + "show" => $isLoggedIn + ], + [ + "name" => "Go back to top", + "link" => [ + "type" => "js", + "text" => "document.body.scrollTop = 0; document.documentElement.scrollTop = 0;" + ], + "icon" => "/assets/icons/up.svg", + "invert" => true + ] + ], + "home" => [ + [ + "name" => "Cloudburst System", + "link" => [ + "type" => "url", + "text" => "/cloudburst" + ], + "icon" => "/assets/avatars/ade46823206b4b0cad3ccaae934a5f3b.webp", + "invert" => false + ], + [ + "name" => "Raindrops System", + "link" => [ + "type" => "url", + "text" => "/raindrops" + ], + "icon" => "/assets/avatars/7d9f543ef74240f69d0786c3f2983124.webp", + "invert" => false + ], + [ + "name" => "Go back to top", + "link" => [ + "type" => "js", + "text" => "document.body.scrollTop = 0; document.documentElement.scrollTop = 0;" + ], + "icon" => "/assets/icons/up.svg", + "invert" => true + ] + ], + "planner" => [ + [ + "name" => "Add in the Cloudburst System", + "link" => [ + "type" => "js", + "text" => "document.getElementById('planner-add-link-cloudburst-0').click()" + ], + "icon" => "https://static.equestria.horse/ponies/icons/add-cloudburst.svg", + "invert" => false + ], + [ + "name" => "Add in the Raindrops System", + "link" => [ + "type" => "js", + "text" => "document.getElementById('planner-add-link-raindrops-0').click()" + ], + "icon" => "https://static.equestria.horse/ponies/icons/add-raindrops.svg", + "invert" => false + ] + ], + "actions-or-toys" => [ + [ + "name" => "Search", + "link" => [ + "type" => "js", + "text" => "document.body.scrollTop = 0; document.documentElement.scrollTop = 0; document.getElementById('search').focus();" + ], + "icon" => "/assets/icons/search.svg", + "invert" => true + ], + [ + "name" => "Add", + "link" => [ + "type" => "js", + "text" => "(new bootstrap.Modal(document.getElementById('creator'))).show(); setInterval(() => { document.getElementById('creator-title').focus(); }, 500);" + ], + "icon" => "/assets/icons/add.svg", + "invert" => true + ] + ], + "docs" => [ + [ + "name" => "Marked for deletion", + "link" => [ + "type" => "url", + "text" => "#deletable" + ], + "icon" => "/assets/icons/delete.svg", + "invert" => true + ], + [ + "name" => "Create new", + "link" => [ + "type" => "url", + "text" => "/-/docs/add" + ], + "icon" => "/assets/icons/add.svg", + "invert" => true + ], + [ + "name" => "Go back to top", + "link" => [ + "type" => "js", + "text" => "document.body.scrollTop = 0; document.documentElement.scrollTop = 0;" + ], + "icon" => "/assets/icons/up.svg", + "invert" => true + ] + ], + "docs-item" => [ + [ + "name" => "Save", + "link" => [ + "type" => "js", + "text" => "save();" + ], + "icon" => "/assets/icons/save.svg", + "invert" => true + ], + [ + "name" => "Go back to top", + "link" => [ + "type" => "js", + "text" => "document.body.scrollTop = 0; document.documentElement.scrollTop = 0;" + ], + "icon" => "/assets/icons/up.svg", + "invert" => true + ] + ], + "debug" => [ + [ + "name" => "Reported failures", + "link" => [ + "type" => "url", + "text" => "#failures" + ], + "icon" => "/assets/icons/failures.svg", + "invert" => true + ], + [ + "name" => "Processing times", + "link" => [ + "type" => "url", + "text" => "#times" + ], + "icon" => "/assets/icons/time.svg", + "invert" => true + ], + [ + "name" => "Go back to top", + "link" => [ + "type" => "js", + "text" => "document.body.scrollTop = 0; document.documentElement.scrollTop = 0;" + ], + "icon" => "/assets/icons/up.svg", + "invert" => true + ] + ], + "bitset" => [ + [ + "name" => "Copy bitset", + "link" => [ + "type" => "js", + "text" => "navigator.clipboard.writeText(document.getElementById('input').value);" + ], + "icon" => "/assets/icons/copy.svg", + "invert" => true + ], + [ + "name" => "Reset", + "link" => [ + "type" => "js", + "text" => "document.getElementById('input').value = '2048'; calculateInput();" + ], + "icon" => "/assets/icons/reset.svg", + "invert" => true + ] + ], + "alert" => [ + [ + "name" => "Turn alert on", + "link" => [ + "type" => "js", + "text" => "if (document.getElementById('btn-on').style.display === 'block') (new bootstrap.Modal(document.getElementById('turn-on'))).show();" + ], + "icon" => "/assets/icons/alert-on.svg", + "invert" => true + ], + [ + "name" => "Turn alert off", + "link" => [ + "type" => "js", + "text" => "if (document.getElementById('btn-off').style.display === 'block') (new bootstrap.Modal(document.getElementById('turn-off'))).show();" + ], + "icon" => "/assets/icons/alert-off.svg", + "invert" => true + ] + ], + "system" => [ + [ + "name" => $pages["s:history"]["name"], + "link" => [ + "type" => "url", + "text" => "/$name/-/history" + ], + "icon" => "/assets/icons/history.svg", + "invert" => true + ], + [ + "name" => $pages["s:compare"]["name"], + "link" => [ + "type" => "url", + "text" => "/$name/-/compare" + ], + "icon" => "/assets/icons/compare.svg", + "invert" => true + ], + [ + "name" => $pages["s:tree"]["name"], + "link" => [ + "type" => "url", + "text" => "/$name/-/tree" + ], + "icon" => "/assets/icons/tree.svg", + "invert" => true + ], + [ + "name" => $pages["s:species"]["name"], + "link" => [ + "type" => "url", + "text" => "/$name/-/species" + ], + "icon" => "/assets/icons/species.svg", + "invert" => true + ], + [ + "name" => $pages["edit"]["name"], + "link" => [ + "type" => "url", + "text" => "/-/edit/$name" + ], + "icon" => "/assets/icons/edit.svg", + "invert" => true, + "show" => $isLoggedIn + ], + [ + "name" => "Go back to top", + "link" => [ + "type" => "js", + "text" => "document.body.scrollTop = 0; document.documentElement.scrollTop = 0;" + ], + "icon" => "/assets/icons/up.svg", + "invert" => true + ] ] ]; $linksList = $links[isset($links[$actionsProfile]) ? $actionsProfile : "default"]; -?> () +?> - $link): ?> - hrefonclick="" title="" data-bs-toggle="tooltip" class="title-bar-action tooltip-nohelp"> - " class="dropdown-icon" alt="" style="width:24px;vertical-align: middle;"> - - + $link): if (!(isset($link["show"]) && !$link["show"])): ?>hrefonclick="" title="" data-bs-toggle="tooltip" class="title-bar-action tooltip-nohelp">" class="dropdown-icon" alt="" style="width:24px;vertical-align: middle;"> -- cgit