fix: [UI] Tags were not shortened correctly on the event index since the refactor, fixes #4932

pull/4939/head
iglocska 2019-07-29 10:54:30 +02:00
parent 2105ad8691
commit 83072d2c92
No known key found for this signature in database
GPG Key ID: BEA224F1FEF113AC
2 changed files with 23 additions and 4 deletions

View File

@ -141,7 +141,8 @@
'tagAccess' => false,
'required_taxonomies' => false,
'columnised' => true,
'static_tags_only' => true
'static_tags_only' => 1,
'tag_display_style' => Configure::read('MISP.full_tags_on_event_index')
)
)
);

View File

@ -46,7 +46,24 @@
}
$aStyle = 'background-color:' . h($tag['Tag']['colour']) . ';color:' . $this->TextColour->getTextColour($tag['Tag']['colour']) . ';';
$aClass = 'tag nowrap';
$aText = h($tag['Tag']['name']);
$aText = trim($tag['Tag']['name']);
if (!empty($tag_display_style) || is_numeric($tag_display_style)) {
if ($tag_display_style == 0) {
$separator_pos = strpos($aText, ':');
if ($separator_pos !== false) {
$aTextModified = substr($aText, $separator_pos + 1);
$value_pos = strpos($aTextModified, '=');
if ($value_pos !== false) {
$aTextModified = substr($aTextModified, $value_pos + 1);
$aTextModified = trim($aTextModified, '"');
}
}
$aTextModified = h($aTextModified);
} else if ($tag_display_style == 2) {
$aTextModified = ' ';
}
}
$aText = h($aText);
$span_scope = sprintf(
'<span class="%s" title="%s" aria-label="%s"><i class="fas fa-%s"></i></span>',
'black-white tag',
@ -56,7 +73,7 @@
);
if (!empty($tag['Tag']['id'])) {
$span_tag = sprintf(
'<a href="%s" style="%s" class="%s">%s</a>',
'<a href="%s" style="%s" class="%s" title="%s">%s</a>',
sprintf(
'%s%s%s',
$baseurl,
@ -65,7 +82,8 @@
),
$aStyle,
$aClass,
$aText
$aText,
isset($aTextModified) ? $aTextModified : $aText
);
} else {
$span_tag = sprintf(