98 lines
3.8 KiB
PHP
98 lines
3.8 KiB
PHP
<?php
|
|
global $thisstaff, $cfg;
|
|
$timeFormat = null;
|
|
if ($thisstaff && !strcasecmp($thisstaff->datetime_format, 'relative')) {
|
|
$timeFormat = function($datetime) {
|
|
return Format::relativeTime(Misc::db2gmtime($datetime));
|
|
};
|
|
}
|
|
|
|
$entryTypes = array('M'=>'message', 'R'=>'response', 'N'=>'note');
|
|
$user = $entry->getUser() ?: $entry->getStaff();
|
|
$name = $user ? $user->getName() : $entry->poster;
|
|
$avatar = '';
|
|
if ($user && $cfg->isAvatarsEnabled())
|
|
$avatar = $user->getAvatar();
|
|
?>
|
|
<div class="thread-entry <?php
|
|
echo $entry->isSystem() ? 'system' : $entryTypes[$entry->type]; ?> <?php if ($avatar) echo 'avatar'; ?>">
|
|
<?php if ($avatar) { ?>
|
|
<span class="<?php echo ($entry->type == 'M') ? 'pull-right' : 'pull-left'; ?> avatar">
|
|
<?php echo $avatar; ?>
|
|
</span>
|
|
<?php } ?>
|
|
<div class="header">
|
|
<div class="pull-right">
|
|
|
|
<span class="textra light">
|
|
<?php if ($entry->flags & ThreadEntry::FLAG_EDITED) { ?>
|
|
<span class="label label-bare" title="<?php
|
|
echo sprintf(__('Edited on %s by %s'), Format::datetime($entry->updated),
|
|
($editor = $entry->getEditor()) ? $editor->getName() : '');
|
|
?>"><?php echo __('Edited'); ?></span>
|
|
<?php }
|
|
if ($entry->flags & ThreadEntry::FLAG_RESENT) { ?>
|
|
<span class="label label-bare"><?php echo __('Resent'); ?></span>
|
|
<?php }
|
|
if ($entry->flags & ThreadEntry::FLAG_COLLABORATOR) { ?>
|
|
<span class="label label-bare"><?php echo __('Collaborator'); ?></span>
|
|
<?php } ?>
|
|
</span>
|
|
|
|
</div>
|
|
<?php
|
|
echo sprintf(__('<b>%s</b> attached following files at %s'), $name,
|
|
sprintf('<a name="entry-%d" href="#entry-%1$s"><time %s
|
|
datetime="%s" data-toggle="tooltip" title="%s">%s</time></a>',
|
|
$entry->id,
|
|
$timeFormat ? 'class="relative"' : '',
|
|
date(DateTime::W3C, Misc::db2gmtime($entry->created)),
|
|
Format::daydatetime($entry->created),
|
|
$timeFormat ? $timeFormat($entry->created) : Format::datetime($entry->created)
|
|
)
|
|
); ?>
|
|
<span style="max-width:400px" class="faded title truncate"><?php
|
|
echo $entry->title; ?></span>
|
|
</span>
|
|
</div>
|
|
<div class="thread-body no-pjax" style="margin-top:-1.9em;">
|
|
<!--<div><?php echo $entry->getBody()->toHtml(); ?></div>
|
|
<div class="clear"></div>-->
|
|
<?php
|
|
// The strangeness here is because .has_attachments is an annotation from
|
|
// Thread::getEntries(); however, this template may be used in other
|
|
// places such as from thread entry editing
|
|
$atts = isset($thread_attachments) ? $thread_attachments[$entry->id] : $entry->attachments;
|
|
if (isset($atts) && $atts) {
|
|
?>
|
|
<div class="attachments"><?php
|
|
foreach ($atts as $A) {
|
|
if ($A->inline)
|
|
continue;
|
|
$size = '';
|
|
if ($A->file->size)
|
|
$size = sprintf('<small class="filesize faded">%s</small>', Format::file_size($A->file->size));
|
|
?>
|
|
<span class="attachment-info">
|
|
<i class="icon-paperclip icon-flip-horizontal"></i>
|
|
<a class="no-pjax truncate filename" href="<?php echo $A->file->getDownloadUrl();
|
|
?>" download="<?php echo Format::htmlchars($A->getFilename()); ?>"
|
|
target="_blank"><?php echo Format::htmlchars($A->getFilename());
|
|
?></a><?php echo $size;?>
|
|
</span>
|
|
<?php }
|
|
echo '</div>';
|
|
}
|
|
?>
|
|
</div>
|
|
<?php
|
|
if (!isset($thread_attachments) && ($urls = $entry->getAttachmentUrls())) { ?>
|
|
<script type="text/javascript">
|
|
$('#thread-entry-<?php echo $entry->getId(); ?>')
|
|
.data('urls', <?php
|
|
echo JsonDataEncoder::encode($urls); ?>)
|
|
.data('id', <?php echo $entry->getId(); ?>);
|
|
</script>
|
|
<?php
|
|
} ?>
|
|
</div>
|