diff options
Diffstat (limited to 'src/application/views')
-rw-r--r-- | src/application/views/form_addpost.php | 2 | ||||
-rw-r--r-- | src/application/views/form_delete_topic_confirm.php | 22 | ||||
-rw-r--r-- | src/application/views/nav_guest.php | 4 | ||||
-rw-r--r-- | src/application/views/nav_logged_in.php | 2 | ||||
-rw-r--r-- | src/application/views/view_topic_start.php | 39 |
5 files changed, 62 insertions, 7 deletions
diff --git a/src/application/views/form_addpost.php b/src/application/views/form_addpost.php index 88eda27..88648b4 100644 --- a/src/application/views/form_addpost.php +++ b/src/application/views/form_addpost.php @@ -20,7 +20,7 @@ if (($_formError = RequestUtils::getAndClearFormError()) !== null) { <textarea class="form-control" id="i_message" name="message" required rows="12" cols="60" style="resize:vertical;max-height:499px"></textarea> </div> <div class="form-group"> - <label for="i_files">Attachments: <small>(max. 4 files, max. 2 MiB each)</small></label> + <label for="i_files">Attachments: <small>(max. <?= htmlentities(MAX_ATTACHMENT_COUNT) ?> files, max. <?= htmlentities(MAX_ATTACHMENT_SIZE >> 20) ?> MiB each)</small></label> <input type="file" name="files[]" id="i_files" multiple accept="*/*"> </div> <button type="submit" class="btn btn-success">Post reply</button> diff --git a/src/application/views/form_delete_topic_confirm.php b/src/application/views/form_delete_topic_confirm.php new file mode 100644 index 0000000..d38ffaa --- /dev/null +++ b/src/application/views/form_delete_topic_confirm.php @@ -0,0 +1,22 @@ +<div class="panel panel-danger"> + <div class="panel-heading"> + <h3 class="panel-title">Do you want to delete this topic?</h3> + </div> + <div class="panel-body"> + Are you sure you want to delete the topic <strong><em><?= htmlentities($topic->title) ?></em></strong> <strong>including all posts and attachments</strong>?<br> + </div> + <div class="panel-footer"> + <div class="text-right"> + <form action="." method="get" class="seamless-inline"> + <input type="hidden" name="_action" value="viewtopic"> + <input type="hidden" name="topic" value="<?= htmlentities($topic->id) ?>"> + <button class="btn btn-default">Keep topic</button> + </form> + <form action="?_action=deletetopic" method="post" class="seamless-inline"> + <input type="hidden" name="topic" value="<?= htmlentities($topic->id) ?>"> + <input type="hidden" name="confirm" value="<?= htmlentities(base64_encode(hash("sha256", "confirm" . $topic->id, true))); ?>"> + <button class="btn btn-danger">Delete topic & posts</button> + </form> + </div> + </div> +</div> diff --git a/src/application/views/nav_guest.php b/src/application/views/nav_guest.php index 433c487..f897763 100644 --- a/src/application/views/nav_guest.php +++ b/src/application/views/nav_guest.php @@ -1,6 +1,6 @@ <ul class="nav navbar-nav navbar-right"> -<li<?= $GLOBALS["action"] === "auth" ? ' class="active"' : '' ?>><a href="?_action=auth">Log in</a></li> +<li<?= $GLOBALS["action"] === "auth" ? ' class="active"' : '' ?>><a href="?_action=auth&next=<?= htmlentities(urlencode($_SERVER["REQUEST_URI"])) ?>">Log in</a></li> <?php if (REGISTRATION_ENABLED): ?> -<li<?= $GLOBALS["action"] === "register" ? ' class="active"' : '' ?>><a href="?_action=register">Register</a></li> +<li<?= $GLOBALS["action"] === "register" ? ' class="active"' : '' ?>><a href="?_action=register&next=<?= htmlentities(urlencode($_SERVER["REQUEST_URI"])) ?>">Register</a></li> <?php endif; ?> </ul>
\ No newline at end of file diff --git a/src/application/views/nav_logged_in.php b/src/application/views/nav_logged_in.php index fd46d6e..f899ad8 100644 --- a/src/application/views/nav_logged_in.php +++ b/src/application/views/nav_logged_in.php @@ -10,5 +10,5 @@ use mystic\forum\orm\User; <?php endif; ?> </p></li> <li><a href="?_action=viewuser&user=<?= htmlentities(urlencode($user->id)) ?>"><span class="glyphicon glyphicon-user" aria-hidden="true"><span class="sr-only">View profile</span></a></li> -<li><a href="?_action=logout"><span class="glyphicon glyphicon-log-out" aria-hidden="true"><span class="sr-only">Log out</span></a></li> +<li><a href="?_action=logout&next=<?= htmlentities(urlencode($_SERVER["REQUEST_URI"])) ?>"><span class="glyphicon glyphicon-log-out" aria-hidden="true"><span class="sr-only">Log out</span></a></li> </ul> diff --git a/src/application/views/view_topic_start.php b/src/application/views/view_topic_start.php index 84a29de..4006982 100644 --- a/src/application/views/view_topic_start.php +++ b/src/application/views/view_topic_start.php @@ -3,13 +3,19 @@ use mystic\forum\orm\UserPermissions; $canReply = $GLOBALS["currentUser"]?->hasPermission(UserPermissions::CREATE_OWN_POST) ?? false; +$canEdit = ($GLOBALS["currentUser"]?->id === $topicAuthor->id && $topicAuthor->hasPermission(UserPermissions::EDIT_OWN_TOPIC)) + || ($GLOBALS["currentUser"]?->hasPermission(UserPermissions::EDIT_OTHER_TOPIC)); + $canDelete = ($GLOBALS["currentUser"]?->id === $topicAuthor->id && $topicAuthor->hasPermission(UserPermissions::DELETE_OWN_TOPIC)) || ($GLOBALS["currentUser"]?->hasPermission(UserPermissions::DELETE_OTHER_TOPIC)); ?> -<div class="page-header margin-top-0"> - <div role="heading" class="h1 margin-top-0"> +<div class="page-header margin-top-0 clearfix"> + <div role="heading" class="h1 margin-top-0" id="displayHeading"> <?= htmlentities($topic->title) ?> <div class="pull-right"> + <?php if ($canEdit): ?> + <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; ?> @@ -21,6 +27,20 @@ $canDelete = ($GLOBALS["currentUser"]?->id === $topicAuthor->id && $topicAuthor- <?php endif; ?> </div> </div> + <?php if ($canEdit): ?> + <form action="?_action=updatetopic" method="post" id="editHeading" style="display: none;" class="form-inline seamless-inline" style="display: block"> + <input type="hidden" name="topic" value="<?= htmlentities(urlencode($topic->id)) ?>"> + <div class="row"> + <div class="col-md-8"> + <input type="text" class="form-control" name="title" id="i_edit_title" value="<?= htmlentities($topic->title) ?>" style="box-sizing: border-box; width: 100%"> + </div> + <div class="col-md-4 text-right"> + <button type="button" id="topicTitleEditCancel" class="btn btn-default"><span class="glyphicon glyphicon-remove" aria-hidden="true"></span> Cancel</button> + <button type="submit" class="btn btn-success"><span class="glyphicon glyphicon-floppy-disk" aria-hidden="true"></span> Save changes</button> + </div> + </div> + </form> + <?php endif; ?> </div> <p> Started by @@ -31,8 +51,21 @@ Started by <?php endif; ?> on <span class="_time"><?= htmlentities($topic->creationDate->format("c")) ?></span> </p> -<?php if ($canReply): ?> <script> +<?php if ($canEdit): ?> +$(function() { + $("#btn-edit-title").click(function() { + $("#displayHeading").hide(); + $("#editHeading").show(); + $("#i_edit_title").focus(); + }); + $("#topicTitleEditCancel").click(function() { + $("#displayHeading").show(); + $("#editHeading").hide(); + }); +}); +<?php endif; ?> +<?php if ($canReply): ?> $(function() { function focusReplyBox() { var msgInput = $("#i_message"); |