mirror of https://github.com/MISP/MISP
fix: [UI] Correctly show contributors in event view
parent
2a3d49921c
commit
aa27703d02
|
@ -74,17 +74,15 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!empty($contributors)) {
|
if (!empty($contributors)) {
|
||||||
$contributorsContent = '';
|
$contributorsContent = [];
|
||||||
foreach ($contributors as $organisationId => $name) {
|
foreach ($contributors as $organisationId => $name) {
|
||||||
$contributorsContent .= sprintf(
|
$org = ['Organisation' => ['id' => $organisationId, 'name' => $name]];
|
||||||
'<a href="%s">%s</a>',
|
$link = $baseurl . "/logs/event_index/" . $event['Event']['id'] . '/' . h($name);
|
||||||
$baseurl . "/logs/event_index/" . $event['Event']['id'] . '/' . h($name),
|
$contributorsContent[] = $this->OrgImg->getNameWithImg($org, $link);
|
||||||
$this->OrgImg->getOrgImg(array('name' => $name, 'id' => $organisationId, 'size' => 24), true, true)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
$table_data[] = array(
|
$table_data[] = array(
|
||||||
'key' => __('Contributors'),
|
'key' => __('Contributors'),
|
||||||
'html' => $contributorsContent
|
'html' => implode("<br>", $contributorsContent),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (isset($event['User']['email'])) {
|
if (isset($event['User']['email'])) {
|
||||||
|
|
|
@ -6,7 +6,7 @@ class OrgImgHelper extends AppHelper
|
||||||
{
|
{
|
||||||
const IMG_PATH = APP . WEBROOT_DIR . DS . 'img' . DS . 'orgs' . DS;
|
const IMG_PATH = APP . WEBROOT_DIR . DS . 'img' . DS . 'orgs' . DS;
|
||||||
|
|
||||||
public function getNameWithImg(array $organisation)
|
public function getNameWithImg(array $organisation, $link = null)
|
||||||
{
|
{
|
||||||
if (!isset($organisation['Organisation'])) {
|
if (!isset($organisation['Organisation'])) {
|
||||||
return '';
|
return '';
|
||||||
|
@ -14,7 +14,9 @@ class OrgImgHelper extends AppHelper
|
||||||
|
|
||||||
$orgImgName = $this->findOrgImage($organisation['Organisation']);
|
$orgImgName = $this->findOrgImage($organisation['Organisation']);
|
||||||
$baseurl = $this->_View->viewVars['baseurl'];
|
$baseurl = $this->_View->viewVars['baseurl'];
|
||||||
$link = $baseurl . '/organisations/view/' . (empty($organisation['Organisation']['id']) ? h($organisation['Organisation']['name']) : h($organisation['Organisation']['id']));
|
if (!$link) {
|
||||||
|
$link = $baseurl . '/organisations/view/' . (empty($organisation['Organisation']['id']) ? h($organisation['Organisation']['name']) : h($organisation['Organisation']['id']));
|
||||||
|
}
|
||||||
if ($orgImgName) {
|
if ($orgImgName) {
|
||||||
$orgImgUrl = $baseurl . '/img/orgs/' . $orgImgName;
|
$orgImgUrl = $baseurl . '/img/orgs/' . $orgImgName;
|
||||||
return sprintf('<a href="%s" style="background-image: url(\'%s\')" class="orgImg">%s</a>', $link, $orgImgUrl, h($organisation['Organisation']['name']));
|
return sprintf('<a href="%s" style="background-image: url(\'%s\')" class="orgImg">%s</a>', $link, $orgImgUrl, h($organisation['Organisation']['name']));
|
||||||
|
|
Loading…
Reference in New Issue