diff options
author | Jonas Kohl | 2024-09-19 14:19:35 +0200 |
---|---|---|
committer | Jonas Kohl | 2024-09-19 14:19:35 +0200 |
commit | 95bfdb59b6a1e04e474551c23c7caef619c79839 (patch) | |
tree | 0fe7bf17c5767df5084dac05c61b4167781b9b1b /src/application/views/view_topic_start.php | |
parent | d7faf7053803aaa9eb8ae85a864ea1b2cccaa586 (diff) |
Topic locking
Diffstat (limited to 'src/application/views/view_topic_start.php')
-rw-r--r-- | src/application/views/view_topic_start.php | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/src/application/views/view_topic_start.php b/src/application/views/view_topic_start.php index da8c0cd..fe85afa 100644 --- a/src/application/views/view_topic_start.php +++ b/src/application/views/view_topic_start.php @@ -1,5 +1,6 @@ <?php use mystic\forum\orm\UserPermissions; +use mystic\forum\utils\RequestUtils; $canReply = $GLOBALS["currentUser"]?->hasPermission(UserPermissions::CREATE_OWN_POST) ?? false; @@ -111,17 +112,45 @@ $canDelete = ($GLOBALS["currentUser"]?->id === $topicAuthor->id && $topicAuthor- </script> <?php endif; ?> +<?php +if (($_formError = RequestUtils::getAndClearFormError("updatetopic")) !== null) { + _view("alert_error", ["message" => $_formError]); +} + +if (($_formError = RequestUtils::getAndClearFormError("locktopic")) !== null) { + _view("alert_error", ["message" => $_formError]); +} +?> + <div class="page-header margin-top-0 clearfix"> <div id="displayHeading"> <div role="heading" class="h1 seamless-inline"> + <?php if ($topic->isLocked): ?> + <span class="glyphicon glyphicon-lock text-muted" aria-hidden="true"></span> + <?php endif; ?> <?= htmlentities($topic->title) ?> <div class="pull-right text-normal"> - <?php if ($canEdit): ?> + <?php if ($canEdit && !$topic->isLocked): ?> <button id="btn-edit-title" class="btn btn-default js-only"><span class="glyphicon glyphicon-pencil" aria-hidden="true"></span> <?= __("Edit title") ?></button> <?php endif; ?> <?php if ($canReply): ?> <button id="btn-reply" class="btn btn-default js-only"><span class="glyphicon glyphicon-share-alt" aria-hidden="true"></span> <?= __("Reply") ?></button> <?php endif; ?> + <?php if ($canEdit): ?> + <?php if ($topic->isLocked): ?> + <form action="?_action=locktopic" method="post" class="seamless-inline"> + <input type="hidden" name="topic" value="<?= htmlentities($topic->id) ?>"> + <input type="hidden" name="locked" value="false"> + <button type="submit" class="btn btn-success"><span class="glyphicon glyphicon-lock" aria-hidden="true"></span> <?= __("Unlock topic") ?></button> + </form> + <?php else: ?> + <form action="?_action=locktopic" method="post" class="seamless-inline"> + <input type="hidden" name="topic" value="<?= htmlentities($topic->id) ?>"> + <input type="hidden" name="locked" value="true"> + <button type="submit" class="btn btn-warning"><span class="glyphicon glyphicon-lock" aria-hidden="true"></span> <?= __("Lock topic") ?></button> + </form> + <?php endif; ?> + <?php endif; ?> <?php if ($canDelete): ?> <form action="?_action=deletetopic" method="post" class="seamless-inline"> <input type="hidden" name="topic" value="<?= htmlentities($topic->id) ?>"> |