Skip to content
Snippets Groups Projects
Commit d5090171 authored by Peter Rotich's avatar Peter Rotich
Browse files

Flag SYSTEM thread entries

This is necessary to differentiate true system notes vs. notes made by a
deleted agent or collaborator.
parent 1aaa3139
No related branches found
No related tags found
No related merge requests found
......@@ -594,6 +594,7 @@ implements TemplateVariable {
const FLAG_COLLABORATOR = 0x0020; // Message from collaborator
const FLAG_BALANCED = 0x0040; // HTML does not need to be balanced on ::display()
const FLAG_SYSTEM = 0x0080; // Entry is a system note.
const PERM_EDIT = 'thread.edit';
......@@ -871,6 +872,10 @@ implements TemplateVariable {
return $this->set('flags', $this->get('flags') | $flag);
}
function isSystem() {
return $this->hasFlag(self::FLAG_SYSTEM);
}
//Web uploads - caller is expected to format, validate and set any errors.
function uploadFiles($files) {
......@@ -1361,6 +1366,10 @@ implements TemplateVariable {
// The current codebase properly balances html
$entry->flags |= self::FLAG_BALANCED;
// Flag system messages
if (!($vars['staffId'] || $vars['userId']))
$entry->flags |= self::FLAG_SYSTEM;
if (!isset($vars['attachments']) || !$vars['attachments'])
// Otherwise, body will be configured in a block below (after
// inline attachments are saved and updated in the database)
......
......@@ -5,9 +5,9 @@ $name = $user ? $user->getName() : $entry->poster;
$avatar = '';
if ($user)
$avatar = $user->getAvatar();
?>
<div class="thread-entry <?php echo $entryTypes[$entry->type]; ?> <?php if ($avatar) echo 'avatar'; ?>">
<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; ?>
......@@ -51,7 +51,8 @@ if ($user)
</span>
</div>
<?php
echo sprintf(__('<b>%s</b> posted %s'), $name,
echo sprintf(__('<b>%s</b> posted %s'),
$entry->isSystem() ? __('SYSTEM') : $name,
sprintf('<a name="entry-%d" href="#entry-%1$s"><time class="relative" datetime="%s" title="%s">%s</time></a>',
$entry->id,
date(DateTime::W3C, Misc::db2gmtime($entry->created)),
......
......@@ -995,9 +995,10 @@ img.avatar {
border-left: none;
border-right: 8px solid #CCC;
}
.thread-entry.note:not(.avatar) .header {
.thread-entry.system .header {
background-color: #f4f4f4;
}
.thread-entry.avatar.response .header:before {
border-right-color: #ccb3af;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment