Skip to content

Commit 622ce65

Browse files
committed
List attachments with their download link
1 parent e7272d2 commit 622ce65

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/templates/Document/View.phtml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ require("./header.inc.phtml");
6464
<section>
6565
<table><thead><th>Filename</th><th>Size</th><th>Upload Date</th><th>Author</th></thead><tbody>
6666
<?php foreach ($attachments as $a) {
67+
$a_url = Common::relativeUrlToAbsolute("/attachment/download?id=" . rawurlencode($a->getId()));
6768
$a_filename = htmlentities($a->getFilename(), ENT_HTML5, "UTF-8");
6869
$a_size = $a->getContentSize(true);
6970
$a_uploaddate = $a->getCreatedDateTime()->format("l, F j, Y");
@@ -72,7 +73,7 @@ require("./header.inc.phtml");
7273
$a_author_url = Common::relativeUrlToAbsolute("/user/" . $a_author_id . "/" . Common::sanitizeForUrl($a_author_name, true));
7374
$a_author_avatar = "https:" . (new Gravatar($a->getUser()->getEmail()))->getUrl(22, "identicon");
7475
?>
75-
<tr><td><?php echo $a_filename; ?></td><td><?php echo $a_size; ?></td><td><?php echo $a_uploaddate; ?></td><td><a href="<?php echo $a_author_url; ?>"><img class="avatar" src="<?php echo $a_author_avatar; ?>"/> <?php echo htmlspecialchars($a_author_name, ENT_HTML5, "UTF-8"); ?></a></td></tr>
76+
<tr><td><a href="<?php echo $a_url; ?>"><?php echo $a_filename; ?></a></td><td><?php echo $a_size; ?></td><td><?php echo $a_uploaddate; ?></td><td><a href="<?php echo $a_author_url; ?>"><img class="avatar" src="<?php echo $a_author_avatar; ?>"/> <?php echo htmlspecialchars($a_author_name, ENT_HTML5, "UTF-8"); ?></a></td></tr>
7677
<?php } ?>
7778
</tbody></table>
7879
</section>

0 commit comments

Comments
 (0)