index : flyspray | |
Archlinux32 customized Flyspray installation | gitolite user |
summaryrefslogtreecommitdiff |
author | Andreas Baumann <mail@andreasbaumann.cc> | 2020-02-01 09:05:48 +0100 |
---|---|---|
committer | Andreas Baumann <mail@andreasbaumann.cc> | 2020-02-01 09:05:48 +0100 |
commit | 6854cb3f4d8219cf1829e32122eb2502a916eae9 (patch) | |
tree | 350feb504587d932e02837a1442b059759927646 /themes/CleanFS/templates/common.editattachments.tpl |
-rw-r--r-- | themes/CleanFS/templates/common.editattachments.tpl | 46 |
diff --git a/themes/CleanFS/templates/common.editattachments.tpl b/themes/CleanFS/templates/common.editattachments.tpl new file mode 100644 index 0000000..5cff7d2 --- /dev/null +++ b/themes/CleanFS/templates/common.editattachments.tpl @@ -0,0 +1,46 @@ + <?php if ($attachments): ?> + <table class="attachments"> + <thead><tr><th><?php echo Filters::noXSS(L('file')); ?></th><th<?php echo $user->perms('delete_attachments') ? '':' style="color:#999"'; ?>><?php echo Filters::noXSS(L('size')); ?></th><th><?php echo Filters::noXSS(L('delete')); ?></th></tr></thead> + <?php foreach ($attachments as $attachment): ?> + <tr> + <td> + <?php if (file_exists(BASEDIR . '/attachments/' . $attachment['file_name'])): ?> + <a href="<?php echo Filters::noXSS($_SERVER['SCRIPT_NAME']); ?>?getfile=<?php echo Filters::noXSS($attachment['attachment_id']); ?>" title="<?php echo Filters::noXSS($attachment['file_type']); ?>"> + <?php else: ?> + <del> + <?php endif; ?> + <?php + // Strip the mimetype to get the icon image name + list($main) = explode('/', $attachment['file_type']); + $imgdir = BASEDIR . "/themes/".Filters::noXSS($proj->prefs['theme_style'])."/mime/"; + $imgpath = Filters::noXSS($baseurl)."themes/".Filters::noXSS($proj->prefs['theme_style'])."/mime/"; + if (file_exists($imgdir.$attachment['file_type'] . '.png')): + ?> + <img src="<?php echo Filters::noXSS($imgpath); ?><?php echo Filters::noXSS($attachment['file_type']); ?>.png" alt="(<?php echo Filters::noXSS($attachment['file_type']); ?>)" title="<?php echo Filters::noXSS($attachment['file_type']); ?>" /> + <?php else: ?> + <img src="<?php echo Filters::noXSS($imgpath); ?><?php echo Filters::noXSS($main); ?>.png" alt="" title="<?php echo Filters::noXSS($attachment['file_type']); ?>" /> + <?php endif; ?> + <?php echo Filters::noXSS($attachment['orig_name']); ?> + + <?php if (file_exists(BASEDIR . '/attachments/' . $attachment['file_name'])): ?> + </a> + <?php else: ?> + </del> + <?php endif; ?> + </td> + <td> + <?php if ($attachment['file_size'] < 1000000): ?> + <?php echo Filters::noXSS(round($attachment['file_size']/1024,1)); ?> <?php echo Filters::noXSS(L('KiB')); ?> + + <?php else: ?> + <?php echo Filters::noXSS(round($attachment['file_size']/1024/1024,2)); ?> <?php echo Filters::noXSS(L('MiB')); ?> + + <?php endif; ?> + </td> + <td> + <input type="checkbox" <?php echo tpl_disableif(!$user->perms('delete_attachments')); ?> name="delete_att[]" value="<?php echo Filters::noXSS($attachment['attachment_id']); ?>" /> + </td> + </tr> + <?php endforeach; ?> + </table> + <?php endif; ?> |