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)) {
|
||||
$contributorsContent = '';
|
||||
$contributorsContent = [];
|
||||
foreach ($contributors as $organisationId => $name) {
|
||||
$contributorsContent .= sprintf(
|
||||
'<a href="%s">%s</a>',
|
||||
$baseurl . "/logs/event_index/" . $event['Event']['id'] . '/' . h($name),
|
||||
$this->OrgImg->getOrgImg(array('name' => $name, 'id' => $organisationId, 'size' => 24), true, true)
|
||||
);
|
||||
$org = ['Organisation' => ['id' => $organisationId, 'name' => $name]];
|
||||
$link = $baseurl . "/logs/event_index/" . $event['Event']['id'] . '/' . h($name);
|
||||
$contributorsContent[] = $this->OrgImg->getNameWithImg($org, $link);
|
||||
}
|
||||
$table_data[] = array(
|
||||
'key' => __('Contributors'),
|
||||
'html' => $contributorsContent
|
||||
'html' => implode("<br>", $contributorsContent),
|
||||
);
|
||||
}
|
||||
if (isset($event['User']['email'])) {
|
||||
|
|
|
@ -6,7 +6,7 @@ class OrgImgHelper extends AppHelper
|
|||
{
|
||||
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'])) {
|
||||
return '';
|
||||
|
@ -14,7 +14,9 @@ class OrgImgHelper extends AppHelper
|
|||
|
||||
$orgImgName = $this->findOrgImage($organisation['Organisation']);
|
||||
$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) {
|
||||
$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']));
|
||||
|
|
Loading…
Reference in New Issue