diff options
Diffstat (limited to 'src/application/views/view_topic_start.php')
-rw-r--r-- | src/application/views/view_topic_start.php | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/src/application/views/view_topic_start.php b/src/application/views/view_topic_start.php index 35befc7..da8c0cd 100644 --- a/src/application/views/view_topic_start.php +++ b/src/application/views/view_topic_start.php @@ -55,6 +55,60 @@ $canDelete = ($GLOBALS["currentUser"]?->id === $topicAuthor->id && $topicAuthor- }); }); </script> +<?php else: ?> + <div class="modal fade" tabindex="-1" role="dialog" id="diag-image-attachment"> + <div class="modal-dialog" role="document"> + <div class="modal-content"> + <div class="modal-header"> + <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> + <h4 class="modal-title"><?= __("Attachment") ?></h4> + </div> + <div class="modal-body"> + <img class="image-attachment-view attachment-view" id="image-attachment-view" alt=""> + </div> + <div class="modal-footer"> + <a href="" download id="image-attachment-dl-btn" class="btn btn-default"><span class="glyphicon glyphicon-download-alt" aria-hidden="true"></span> <?= __("Download") ?></a> + </div> + </div> + </div> + </div> + <div class="modal fade" tabindex="-1" role="dialog" id="diag-video-attachment"> + <div class="modal-dialog" role="document"> + <div class="modal-content"> + <div class="modal-header"> + <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> + <h4 class="modal-title"><?= __("Attachment") ?></h4> + </div> + <div class="modal-body"> + <video class="video-attachment-view attachment-view" id="video-attachment-view" controls></video> + </div> + <div class="modal-footer"> + <a href="" download id="video-attachment-dl-btn" class="btn btn-default"><span class="glyphicon glyphicon-download-alt" aria-hidden="true"></span> <?= __("Download") ?></a> + </div> + </div> + </div> + </div> + <script> + $(function() { + $(".image-attachment:not(.video-attachment)").click(function(e) { + e.preventDefault(); + var attUrl = "?_action=attachment&attachment=" + encodeURIComponent($(this).attr("data-attachment-id")); + $("#image-attachment-view").attr("src", attUrl); + $("#image-attachment-dl-btn").attr("href", attUrl); + $("#diag-image-attachment").modal(); + }); + $(".image-attachment.video-attachment").click(function(e) { + e.preventDefault(); + var attUrl = "?_action=attachment&attachment=" + encodeURIComponent($(this).attr("data-attachment-id")); + $("#video-attachment-view").attr("src", attUrl); + $("#video-attachment-dl-btn").attr("href", attUrl); + $("#diag-video-attachment").modal(); + }); + $("#diag-video-attachment").on("hide.bs.modal", function() { + $("#video-attachment-view")[0].pause(); + }); + }); + </script> <?php endif; ?> <div class="page-header margin-top-0 clearfix"> |