summaryrefslogtreecommitdiff
path: root/pages/docs.inc
diff options
context:
space:
mode:
authorMinteck <contact@minteck.org>2022-10-18 08:59:09 +0200
committerMinteck <contact@minteck.org>2022-10-18 08:59:09 +0200
commit2c4ae43e688a9873e86211ea0e7aeb9ba770dd77 (patch)
tree17848d95522dab25d3cdeb9c4a6450e2a234861f /pages/docs.inc
parent108525534c28013cfe1897c30e4565f9893f3766 (diff)
downloadpluralconnect-2c4ae43e688a9873e86211ea0e7aeb9ba770dd77.tar.gz
pluralconnect-2c4ae43e688a9873e86211ea0e7aeb9ba770dd77.tar.bz2
pluralconnect-2c4ae43e688a9873e86211ea0e7aeb9ba770dd77.zip
Update
Diffstat (limited to 'pages/docs.inc')
-rw-r--r--pages/docs.inc30
1 files changed, 25 insertions, 5 deletions
diff --git a/pages/docs.inc b/pages/docs.inc
index f893e95..0322f32 100644
--- a/pages/docs.inc
+++ b/pages/docs.inc
@@ -57,6 +57,12 @@ require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc';
ยท <span id="editor-save-status" class="text-muted">Saved</span>
</p>
+ <?php $timeDiff = round((1800 - (time() - $data["last"]["date"])) / 60); if ($timeDiff >= 0 && $data["last"]["author"] !== $_PROFILE["login"]): ?>
+ <div class="alert alert-warning">
+ <b>This document is currently in use by <?= $data["last"]["author"] === "raindrops" ? "the Raindrops System" : "the Cloudburst System" ?>.</b> It has been open in read-only to prevent conflicts with the changes they make. If they stopped editing the document, it will become editable for you after you refresh the page in <?= $timeDiff ?> minute<?= $timeDiff > 1 ? "s" : "" ?>.
+ </div>
+ <?= $data["contents"] ?>
+ <?php else: ?>
<textarea id="editor"><?= $data["contents"] ?></textarea>
<script src="/assets/editor/editor.js"></script>
@@ -112,6 +118,10 @@ require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc';
.ck-editor__editable {
border-color: transparent !important;
}
+
+ .ck.ck-sticky-panel__content_sticky {
+ top: 59px !important;
+ }
</style>
<script>
@@ -189,6 +199,7 @@ require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc';
}, 100)
</script>
+ <?php endif; ?>
</div><?php else: ?>
<h2>Documents</h2>
<div id="list">
@@ -210,11 +221,12 @@ require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc';
return strip_tags($i["contents"]) !== "/delete";
}));
+ $categoryFirst = [];
$unsorted = [];
$categories = [];
foreach ($unsorted_pre as $item) {
if (isset($item["category"])) {
- $existing_categories = array_keys($categories);
+ $existing_categories = [...array_keys($categories), ...array_keys($categoryFirst)];
$matched_category = null;
foreach ($existing_categories as $existing_category) {
@@ -224,8 +236,14 @@ require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc';
}
$selected_category = $matched_category ?? $item["category"];
- if (!isset($categories[$selected_category])) $categories[$selected_category] = [];
- $categories[$selected_category][] = $item;
+
+ if (str_starts_with($item["category"], ".")) {
+ if (!isset($categoryFirst[$selected_category])) $categoryFirst[$selected_category] = [];
+ $categoryFirst[$selected_category][] = $item;
+ } else {
+ if (!isset($categories[$selected_category])) $categories[$selected_category] = [];
+ $categories[$selected_category][] = $item;
+ }
} else {
$unsorted[] = $item;
}
@@ -239,10 +257,12 @@ require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc';
return $b["last"]["date"] - $a["last"]["date"];
});
+ $fullList = [...$categoryFirst, ...$categories];
+
?>
- <?php foreach ($categories as $category => $items): ?>
- <h4><?= $category ?></h4><div class="list-group">
+ <?php foreach ($fullList as $category => $items): ?>
+ <h4><?= str_starts_with($category, ".") ? substr($category, 1) : $category ?></h4><div class="list-group">
<?php foreach ($items as $item): ?>
<a href="/-/docs/<?= $item["id"] ?>" id="document-<?= $item["id"] ?>" class="list-group-item list-group-item-action document-listing <?php if (strip_tags($item["contents"]) === "/delete"): ?>opacity-75<?php endif; ?>">
<?= $item["name"] ?>&nbsp;