mirror of https://github.com/MISP/MISP
Merge pull request #7081 from JakubOnderka/galaxy-view-new
New galaxy view for eventspull/7231/head
commit
a4c6c38cf1
|
@ -181,6 +181,7 @@ class ServersController extends AppController
|
|||
|
||||
$this->loadModel('Event');
|
||||
$params = $this->Event->rearrangeEventForView($event, $this->passedArgs, $all);
|
||||
$this->__removeGalaxyClusterTags($event);
|
||||
$this->params->params['paging'] = array('Server' => $params);
|
||||
$this->set('event', $event);
|
||||
$this->set('server', $server);
|
||||
|
@ -205,6 +206,26 @@ class ServersController extends AppController
|
|||
$this->set('title_for_layout', __('Remote event preview'));
|
||||
}
|
||||
|
||||
private function __removeGalaxyClusterTags(array &$event)
|
||||
{
|
||||
$galaxyTagIds = [];
|
||||
foreach ($event['Galaxy'] as $galaxy) {
|
||||
foreach ($galaxy['GalaxyCluster'] as $galaxyCluster) {
|
||||
$galaxyTagIds[$galaxyCluster['tag_id']] = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($galaxyTagIds)) {
|
||||
return;
|
||||
}
|
||||
|
||||
foreach ($event['Tag'] as $k => $eventTag) {
|
||||
if (isset($galaxyTagIds[$eventTag['id']])) {
|
||||
unset($event['Tag'][$k]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function compareServers()
|
||||
{
|
||||
list($servers, $overlap) = $this->Server->serverEventsOverlap();
|
||||
|
|
|
@ -55,11 +55,11 @@
|
|||
?>
|
||||
<td class="short" id="attribute_<?php echo h($object['id']); ?>_galaxy">
|
||||
<?php
|
||||
echo $this->element('galaxyQuickViewMini', array(
|
||||
echo $this->element('galaxyQuickViewNew', array(
|
||||
'mayModify' => false,
|
||||
'isSiteAdmin' => false, // prevent add button
|
||||
'isAclTagger' => false,
|
||||
'data' => (!empty($object['Galaxy']) ? $object['Galaxy'] : array()),
|
||||
'data' => !empty($object['Galaxy']) ? $object['Galaxy'] : array(),
|
||||
'target_id' => $object['id'],
|
||||
'target_type' => 'attribute'
|
||||
));
|
||||
|
|
|
@ -162,13 +162,12 @@ $quickEdit = function($fieldName) use ($editScope, $object, $event) {
|
|||
<?php $rowId = sprintf('attribute_%s_galaxy', h($objectId)); ?>
|
||||
<td class="short" id="<?= $rowId ?>">
|
||||
<?php
|
||||
echo $this->element('galaxyQuickViewMini', array(
|
||||
echo $this->element('galaxyQuickViewNew', array(
|
||||
'mayModify' => $mayModify,
|
||||
'isAclTagger' => $isAclTagger,
|
||||
'data' => (!empty($object['Galaxy']) ? $object['Galaxy'] : array()),
|
||||
'target_id' => $object['id'],
|
||||
'target_type' => 'attribute',
|
||||
'rowId' => $rowId,
|
||||
));
|
||||
?>
|
||||
</td>
|
||||
|
|
|
@ -106,7 +106,7 @@
|
|||
unset($galaxy_cluster['Galaxy']);
|
||||
$galaxies[$galaxy_id]['GalaxyCluster'][] = $galaxy_cluster;
|
||||
}
|
||||
echo $this->element('galaxyQuickViewMini', array(
|
||||
echo $this->element('galaxyQuickViewNew', array(
|
||||
'mayModify' => false,
|
||||
'isAclTagger' => false,
|
||||
'data' => $galaxies,
|
||||
|
|
|
@ -31,7 +31,6 @@
|
|||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<br />
|
||||
<div id="attributeList" class="attributeListContainer">
|
||||
<table class="table table-striped table-condensed">
|
||||
<tr>
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
</td>
|
||||
<td class="shortish">
|
||||
<?php
|
||||
echo $this->element('galaxyQuickViewMini', array(
|
||||
echo $this->element('galaxyQuickViewNew', array(
|
||||
'mayModify' => ($isSiteAdmin || $me['org_id'] == $item['TagCollection']['org_id']),
|
||||
'isAclTagger' => $me['Role']['perm_tagger'],
|
||||
'data' => $item['Galaxy'],
|
||||
|
|
|
@ -1,160 +0,0 @@
|
|||
<?php
|
||||
$fixed_fields = array('synonyms', 'description', 'meta', 'authors', 'source');
|
||||
foreach ($data as $galaxy) {
|
||||
$cluster_data = '';
|
||||
foreach ($galaxy['GalaxyCluster'] as $cluster) {
|
||||
$cluster_fields = array();
|
||||
if (isset($cluster['description'])) {
|
||||
$cluster_fields[] = array('key' => 'description', 'value' => $cluster['description']);
|
||||
}
|
||||
if (isset($cluster['meta']['synonyms'])) {
|
||||
$cluster_fields[] = array('key' => 'synonyms', 'value' => $cluster['meta']['synonyms']);
|
||||
}
|
||||
if (isset($cluster['source'])) {
|
||||
$cluster_fields[] = array('key' => 'source', 'value' => $cluster['source']);
|
||||
}
|
||||
if (isset($cluster['authors'])) {
|
||||
$cluster_fields[] = array('key' => 'authors', 'value' => $cluster['authors']);
|
||||
}
|
||||
if (!empty($cluster['meta'])) {
|
||||
foreach ($cluster['meta'] as $metaKey => $metaField) {
|
||||
if ($metaKey != 'synonyms') {
|
||||
$cluster_fields[] = array('key' => $metaKey, 'value' => $metaField);
|
||||
}
|
||||
}
|
||||
}
|
||||
$data = '';
|
||||
foreach ($cluster_fields as $cluster_field) {
|
||||
$dataKey = h(ucfirst($cluster_field['key']));
|
||||
$dataValue = '';
|
||||
if (is_array($cluster_field['value'])) {
|
||||
if ($cluster_field['key'] == 'refs') {
|
||||
$value = array();
|
||||
foreach ($cluster_field['value'] as $k => $v) {
|
||||
$v_name = strlen($v) > 30 ? substr($v, 0, 30) . '...' : $v;
|
||||
$value[$k] = sprintf('<a href="%s" title="%s">%s</a>', h($v), h($v), h($v_name));
|
||||
}
|
||||
$dataValue .= nl2br(implode("\n", $value));
|
||||
} else if($cluster_field['key'] == 'country') {
|
||||
$value = array();
|
||||
foreach ($cluster_field['value'] as $k => $v) {
|
||||
$value[] = $this->Icon->countryFlag($v) . ' ' . h($v);
|
||||
}
|
||||
$dataValue .= nl2br(implode("\n", $value));
|
||||
} else {
|
||||
$dataValue .= nl2br(h(implode("\n", $cluster_field['value'])));
|
||||
}
|
||||
} else {
|
||||
if ($cluster_field['key'] == 'source' && filter_var($cluster_field['value'], FILTER_VALIDATE_URL)) {
|
||||
$dataValue .= '<a href="' . h($cluster_field['value']) . '">' . h($cluster_field['value']) . '</a>';;
|
||||
} else {
|
||||
$dataValue .= h($cluster_field['value']);
|
||||
}
|
||||
}
|
||||
$data .= sprintf(
|
||||
'<div class="blue galaxy_data">%s</div>',
|
||||
sprintf(
|
||||
'<div class="row-fluid cluster_%s">%s%s</div>',
|
||||
h($cluster_field['key']),
|
||||
sprintf('<div class="span3 info_container_key">%s</div>', $dataKey),
|
||||
sprintf('<div class="span9 info_container_value">%s</div>', $dataValue)
|
||||
)
|
||||
);
|
||||
}
|
||||
$cluster_data .= sprintf(
|
||||
'<div class="large-left-margin"><span class="bold blue expandContainer">%s %s %s %s %s %s</span></div>',
|
||||
'<span class="collapse-status-container useCursorPointer"><span class="collapse-status">+</span></span>',
|
||||
sprintf(
|
||||
'<span class="clusterName useCursorPointer" data-clusterid="%s"><i class="fas fa-%s"></i> %s</span>',
|
||||
h($cluster['id']),
|
||||
$cluster['local'] ? 'user' : 'globe-americas',
|
||||
h($cluster['value'])
|
||||
),
|
||||
sprintf(
|
||||
'<a href="%s/galaxy_clusters/view/%s" class="fa fa-search" title="%s" aria-label="%s"></a> ',
|
||||
$baseurl,
|
||||
h($cluster['id']),
|
||||
__('View details about this cluster'),
|
||||
__('View cluster')
|
||||
),
|
||||
sprintf(
|
||||
'<a href="%s/events/index/searchtag:%s" class="fa fa-list" title="%s" aria-label="%s"></a>',
|
||||
$baseurl,
|
||||
h($cluster['tag_id']),
|
||||
__('View all events containing this cluster.'),
|
||||
__('View all events containing this cluster.')
|
||||
),
|
||||
!$isSiteAdmin && (!$mayModify || !$isAclTagger) ? '' : sprintf(
|
||||
'%s%s%s',
|
||||
$this->Form->create(
|
||||
false,
|
||||
array(
|
||||
'url' => $baseurl . '/galaxy_clusters/detach/' . ucfirst(h($target_id)) . '/' . h($target_type) . '/' . $cluster['tag_id'],
|
||||
'style' => 'display: inline-block; margin: 0px;'
|
||||
)
|
||||
),
|
||||
sprintf(
|
||||
'<it href="#" class="fa fa-trash useCursorPointer" role="button" tabindex="0" aria-label="%s" title="%s" onclick="popoverConfirm(this)"></it>',
|
||||
__('detach'),
|
||||
__('Are you sure you want to detach %s from this event?', h($cluster['value']))
|
||||
),
|
||||
$this->Form->end()
|
||||
),
|
||||
$data
|
||||
);
|
||||
}
|
||||
echo sprintf(
|
||||
'<div class="large-left-margin"><span title="%s" class="bold blue" style="%s">%s %s%s</span></div>',
|
||||
isset($galaxy['description']) ? h($galaxy['description']) : h($galaxy['name']),
|
||||
'font-size:14px;',
|
||||
h($galaxy['name']),
|
||||
sprintf(
|
||||
'<a href="%s/galaxies/view/%s" class="fa fa-search" title="%s" aria-label="%s"></a>',
|
||||
$baseurl,
|
||||
h($galaxy['id']),
|
||||
__('View details about this galaxy'),
|
||||
__('View galaxy')
|
||||
),
|
||||
$cluster_data
|
||||
);
|
||||
}
|
||||
if ($isSiteAdmin || ($mayModify && $isAclTagger)) {
|
||||
echo sprintf(
|
||||
'<button class="%s" data-target-type="%s" data-target-id="%s" data-local="false" role="button" tabindex="0" aria-label="' . __('Add new cluster') . '" title="' . __('Add a tag') . '" style="%s">%s</button>',
|
||||
'useCursorPointer btn btn-inverse addGalaxy',
|
||||
h($target_type),
|
||||
h($target_id),
|
||||
'line-height:10px; padding: 2px; margin-right:5px;',
|
||||
'<i class="fas fa-globe-americas"></i> +'
|
||||
);
|
||||
}
|
||||
if (
|
||||
(!isset($local_tag_off) || !$local_tag_off) &&
|
||||
($isSiteAdmin || ($isAclTagger && Configure::read('MISP.host_org_id') == $me['org_id']))
|
||||
) {
|
||||
echo sprintf(
|
||||
'<button class="%s" data-target-type="%s" data-target-id="%s" data-local="true" role="button" tabindex="0" aria-label="' . __('Add new local cluster') . '" title="' . __('Add a local tag') . '" style="%s">%s</button>',
|
||||
'useCursorPointer btn btn-inverse addGalaxy',
|
||||
h($target_type),
|
||||
h($target_id),
|
||||
'line-height:10px; padding: 2px;',
|
||||
'<i class="fas fa-user"></i> +'
|
||||
);
|
||||
}
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function () {
|
||||
$('.collapse-status-container').click(function() {
|
||||
$(this).parent().children('.galaxy_data').toggle();
|
||||
if ($(this).parent().children('.collapse-status-container').children('.collapse-status').html() == '+') {
|
||||
$(this).parent().children('.collapse-status-container').children('.collapse-status').html('-');
|
||||
} else {
|
||||
$(this).parent().children('.collapse-status-container').children('.collapse-status').html('+');
|
||||
}
|
||||
});
|
||||
|
||||
$('.clusterName').on('click', function() {
|
||||
loadClusterRelations($(this).data('clusterid'));
|
||||
})
|
||||
});
|
||||
</script>
|
|
@ -1,120 +0,0 @@
|
|||
<?php
|
||||
$fixed_fields = array('synonyms', 'description', 'meta', 'authors', 'source');
|
||||
foreach ($data as $galaxy):
|
||||
?>
|
||||
<div>
|
||||
<span title="<?php echo isset($galaxy['description']) ? h($galaxy['description']) : h($galaxy['name']);?>" class="bold blue" style="font-size:14px;">
|
||||
<?php echo h($galaxy['name']); ?>
|
||||
</span>
|
||||
<?php
|
||||
foreach ($galaxy['GalaxyCluster'] as $cluster):
|
||||
$cluster_fields = array();
|
||||
if (!empty($cluster['description'])) {
|
||||
$cluster_fields[] = array('key' => 'description', 'value' => $cluster['description']);
|
||||
}
|
||||
if (isset($cluster['meta']['synonyms'])) {
|
||||
$cluster_fields[] = array('key' => 'synonyms', 'value' => $cluster['meta']['synonyms']);
|
||||
}
|
||||
if (isset($cluster['source'])) {
|
||||
$cluster_fields[] = array('key' => 'source', 'value' => $cluster['source']);
|
||||
}
|
||||
if (!empty($cluster['meta'])) {
|
||||
foreach ($cluster['meta'] as $metaKey => $metaField) {
|
||||
if (!in_array($metaKey, ['synonyms', 'refs'], true)) {
|
||||
$cluster_fields[] = array('key' => $metaKey, 'value' => $metaField);
|
||||
}
|
||||
}
|
||||
}
|
||||
$popover_data = '<h4 class="blue bold">' . h($cluster['value']) . '</h4>';
|
||||
foreach ($cluster_fields as $cluster_field) {
|
||||
$key = sprintf('<span class="blue bold">%s</span>', Inflector::humanize(h($cluster_field['key'])));
|
||||
if (is_array($cluster_field['value'])) {
|
||||
if ($cluster_field['key'] === 'country') {
|
||||
$value = array();
|
||||
foreach ($cluster_field['value'] as $k => $v) {
|
||||
$value[] = $this->Icon->countryFlag($v) . ' ' . h($v);
|
||||
}
|
||||
$value_contents = implode("<br>", $value);
|
||||
} else {
|
||||
$value_contents = nl2br(h(implode("\n", $cluster_field['value'])), false);
|
||||
}
|
||||
} else {
|
||||
$value_contents = h($cluster_field['value']);
|
||||
}
|
||||
$value = sprintf('<span class="black">%s</span>', $value_contents);
|
||||
$popover_data .= "<span>$key: $value</span><br>";
|
||||
}
|
||||
echo sprintf(
|
||||
'<div class="large-left-margin">%s %s %s %s</div>',
|
||||
sprintf(
|
||||
'<span class="bold blue expandable useCursorPointer" data-content="%s" data-clusterid="%s">%s</span>',
|
||||
h($popover_data),
|
||||
h($cluster['id']),
|
||||
sprintf(
|
||||
'<span><i class="fas fa-%s"></i> %s</span>',
|
||||
$cluster['local'] ? 'user' : 'globe-americas',
|
||||
h($cluster['value'])
|
||||
)
|
||||
),
|
||||
sprintf(
|
||||
'<a href="%s/galaxy_clusters/view/%s" class="black fas fa-search" title="%s" aria-label="%s"></a>',
|
||||
$baseurl,
|
||||
h($cluster['id']),
|
||||
__('View details about this cluster'),
|
||||
__('View cluster')
|
||||
),
|
||||
sprintf(
|
||||
'<a href="%s/events/index/searchtag:%s" class="black fas fa-list" title="%s" aria-label="%s"></a>',
|
||||
$baseurl,
|
||||
h($cluster['tag_id']),
|
||||
__('View all events containing this cluster.'),
|
||||
__('View all events containing this cluster.')
|
||||
),
|
||||
(!empty($static_tags_only) || (!$isSiteAdmin && (!$mayModify || !$isAclTagger))) ? '' : sprintf(
|
||||
'%s%s%s',
|
||||
$this->Form->create(
|
||||
false,
|
||||
array(
|
||||
'url' => $baseurl . '/galaxy_clusters/detach/' . ucfirst(h($target_id)) . '/' . h($target_type) . '/' . h($cluster['tag_id']),
|
||||
'style' => 'display: inline-block; margin: 0px;'
|
||||
)
|
||||
),
|
||||
sprintf(
|
||||
'<span href="#" class="fa fa-trash useCursorPointer" title="%s" onclick="popoverConfirm(this)"></span>',
|
||||
__('Are you sure you want to detach %s from this %s?', h($cluster['value']), h($target_type))
|
||||
),
|
||||
$this->Form->end()
|
||||
)
|
||||
);
|
||||
endforeach;
|
||||
?>
|
||||
</div>
|
||||
<?php
|
||||
endforeach;
|
||||
?>
|
||||
<?php
|
||||
if (empty($static_tags_only)) {
|
||||
if ($isSiteAdmin || ($mayModify && $isAclTagger)) {
|
||||
echo sprintf(
|
||||
'<button class="%s" data-target-type="%s" data-target-id="%s" data-local="false" role="button" tabindex="0" aria-label="' . __('Add new cluster') . '" title="' . __('Add a tag') . '" style="%s">%s</button>',
|
||||
'useCursorPointer btn btn-inverse addGalaxy',
|
||||
h($target_type),
|
||||
h($target_id),
|
||||
'line-height:10px; padding: 2px; margin-right:5px;',
|
||||
'<i class="fas fa-globe-americas"></i> +'
|
||||
);
|
||||
}
|
||||
if (
|
||||
(!isset($local_tag_off) || !$local_tag_off) &&
|
||||
($isSiteAdmin || ($mayModify && $isAclTagger) || ($isAclTagger && Configure::read('MISP.host_org_id') == $me['org_id']))
|
||||
) {
|
||||
echo sprintf(
|
||||
'<button class="%s" data-target-type="%s" data-target-id="%s" data-local="true" role="button" tabindex="0" aria-label="' . __('Add new local cluster') . '" title="' . __('Add a local tag') . '" style="%s">%s</button>',
|
||||
'useCursorPointer btn btn-inverse addGalaxy',
|
||||
h($target_type),
|
||||
h($target_id),
|
||||
'line-height:10px; padding: 2px;',
|
||||
'<i class="fas fa-user"></i> +'
|
||||
);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,140 @@
|
|||
<?php
|
||||
// When viewing remote server or feed event
|
||||
if (isset($preview) && $preview) {
|
||||
$mayModify = false;
|
||||
$isAclTagger = false;
|
||||
$static_tags_only = true;
|
||||
} else {
|
||||
$preview = false;
|
||||
}
|
||||
|
||||
$editButtonsEnabled = !(isset($static_tags_only) && $static_tags_only);
|
||||
|
||||
$sortClusters = function (array $clusters) {
|
||||
usort($clusters, function (array $a, array $b) {
|
||||
$aExternalId = isset($a['meta']['external_id'][0]) ? $a['meta']['external_id'][0] : null;
|
||||
$bExternalId = isset($b['meta']['external_id'][0]) ? $b['meta']['external_id'][0] : null;
|
||||
if ($aExternalId && $bExternalId) {
|
||||
return strcmp($aExternalId, $bExternalId);
|
||||
}
|
||||
return strcmp($a['value'], $b['value']);
|
||||
});
|
||||
return $clusters;
|
||||
};
|
||||
|
||||
$normalizeKey = function ($key) {
|
||||
$key = str_replace('-', '_', $key);
|
||||
$key = Inflector::humanize($key);
|
||||
$key = str_replace('Id', 'ID', $key);
|
||||
$key = str_replace('Mitre', 'MITRE', $key);
|
||||
$key = str_replace('Cfr', 'CFR', $key);
|
||||
return $key;
|
||||
};
|
||||
|
||||
$generatePopover = function (array $cluster) use ($normalizeKey) {
|
||||
$clusterFields = [];
|
||||
if (!empty($cluster['description'])) {
|
||||
$clusterFields[] = ['key' => 'description', 'value' => $this->Markdown->toText($cluster['description'])];
|
||||
}
|
||||
if (isset($cluster['meta']['synonyms'])) {
|
||||
$clusterFields[] = ['key' => 'synonyms', 'value' => $cluster['meta']['synonyms']];
|
||||
}
|
||||
if (isset($cluster['source'])) {
|
||||
$clusterFields[] = ['key' => 'source', 'value' => $cluster['source']];
|
||||
}
|
||||
if (!empty($cluster['meta'])) {
|
||||
foreach ($cluster['meta'] as $metaKey => $metaField) {
|
||||
if (!in_array($metaKey, ['synonyms', 'refs'], true)) {
|
||||
$clusterFields[] = ['key' => $metaKey, 'value' => $metaField];
|
||||
}
|
||||
}
|
||||
}
|
||||
$popover = '<h4 class="blue" style="white-space: nowrap">' . h($cluster['value']) . '</h4>';
|
||||
foreach ($clusterFields as $clusterField) {
|
||||
$key = '<span class="blue bold">' . h($normalizeKey($clusterField['key'])) . '</span>';
|
||||
if (is_array($clusterField['value'])) {
|
||||
if ($clusterField['key'] === 'country') {
|
||||
$value = [];
|
||||
foreach ($clusterField['value'] as $v) {
|
||||
$value[] = $this->Icon->countryFlag($v) . ' ' . h($v);
|
||||
}
|
||||
$valueContents = implode("<br>", $value);
|
||||
} else {
|
||||
if (count($clusterField['value']) < 4) {
|
||||
$valueContents = h(implode(", ", $clusterField['value']));
|
||||
} else {
|
||||
$valueContents = nl2br("\n" . h(implode("\n", $clusterField['value'])), false);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$valueContents = h($clusterField['value']);
|
||||
}
|
||||
$popover .= "$key: $valueContents<br>";
|
||||
}
|
||||
return $popover;
|
||||
}
|
||||
?>
|
||||
<?php if (!empty($data)): ?>
|
||||
<div class="galaxyQuickView">
|
||||
<?php foreach ($data as $galaxy): ?>
|
||||
<h3 title="<?= isset($galaxy['description']) ? h($galaxy['description']) : h($galaxy['name']) ?>">
|
||||
<?= h($galaxy['name']) ?>
|
||||
<?php if (!$preview): ?>
|
||||
<a href="<?= $baseurl ?>/galaxies/view/<?= h($galaxy['id']) ?>" class="black fa fa-search" title="<?= __('View details about this galaxy') ?>" aria-label="<?= __('View galaxy') ?>"></a>
|
||||
<?php endif ;?>
|
||||
</h3>
|
||||
<ul>
|
||||
<?php foreach ($sortClusters($galaxy['GalaxyCluster']) as $cluster): ?>
|
||||
<li>
|
||||
<b <?php if (!$preview): ?>class="useCursorPointer" data-clusterid="<?= h($cluster['id']) ?>"<?php endif; ?> data-content="<?= h($generatePopover($cluster)) ?>">
|
||||
<i class="fas fa-<?= $cluster['local'] ? 'user' : 'globe-americas' ?>" title="<?= $cluster['local'] ? __('Local galaxy') : __('Global galaxy') ?>"></i>
|
||||
<?= h($cluster['value']) ?>
|
||||
</b>
|
||||
<?php if (!$preview): ?>
|
||||
<a href="<?= $baseurl ?>/galaxy_clusters/view/<?= h($cluster['id']) ?>" class="black fa fa-search" title="<?= __('View details about this cluster') ?>" aria-label="<?= __('View cluster') ?>"></a>
|
||||
<a href="<?= $baseurl ?>/events/index/searchtag:<?= h($cluster['tag_id']) ?>" class="black fa fa-list" title="<?= __('View all events containing this cluster') ?>" aria-label="<?= __('View all events containing this cluster') ?>"></a>
|
||||
<?php endif ;?>
|
||||
<?php if ($editButtonsEnabled && ($isSiteAdmin || ($mayModify && $isAclTagger))) {
|
||||
echo $this->Form->create(false, [
|
||||
'id' => false, // prevent duplicate ids
|
||||
'url' => $baseurl . '/galaxy_clusters/detach/' . ucfirst(h($target_id)) . '/' . h($target_type) . '/' . $cluster['tag_id'],
|
||||
'style' => 'display: inline-block; margin: 0px;'
|
||||
]);
|
||||
echo sprintf(
|
||||
'<a href="#" class="black fa fa-trash useCursorPointer" role="button" tabindex="0" aria-label="%s" title="%s" onclick="popoverConfirm(this);"></a>',
|
||||
__('Detach'),
|
||||
__('Are you sure you want to detach %s from this event?', h($cluster['value']))
|
||||
);
|
||||
echo $this->Form->end();
|
||||
}
|
||||
?>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php
|
||||
if ($editButtonsEnabled && ($isSiteAdmin || ($mayModify && $isAclTagger))) {
|
||||
echo sprintf(
|
||||
'<button class="%s" data-target-type="%s" data-target-id="%s" data-local="false" role="button" tabindex="0" aria-label="' . __('Add new cluster') . '" title="' . __('Add new cluster') . '">%s</button>',
|
||||
'useCursorPointer btn btn-inverse addGalaxy',
|
||||
h($target_type),
|
||||
h($target_id),
|
||||
'<i class="fas fa-globe-americas"></i> <i class="fas fa-plus"></i>'
|
||||
);
|
||||
}
|
||||
|
||||
if (
|
||||
$editButtonsEnabled &&
|
||||
(!isset($local_tag_off) || !$local_tag_off) &&
|
||||
($isSiteAdmin || ($isAclTagger && $hostOrgUser))
|
||||
) {
|
||||
echo sprintf(
|
||||
'<button class="%s" data-target-type="%s" data-target-id="%s" data-local="true" role="button" tabindex="0" aria-label="' . __('Add new local cluster') . '" title="' . __('Add new local cluster') . '">%s</button>',
|
||||
'useCursorPointer btn btn-inverse addGalaxy',
|
||||
h($target_type),
|
||||
h($target_id),
|
||||
'<i class="fas fa-user"></i> <i class="fas fa-plus"></i>'
|
||||
);
|
||||
}
|
|
@ -1,24 +1,19 @@
|
|||
<?php
|
||||
$mayModify = (
|
||||
($isAclModify && $object['Event']['orgc_id'] == $me['org_id'])
|
||||
);
|
||||
if ($scope == 'event') {
|
||||
echo sprintf('<h4 class="blue">%s</h4>', __('Galaxies'));
|
||||
$element = 'galaxyQuickView';
|
||||
} else if ($scope == 'attribute') {
|
||||
$element = 'galaxyQuickViewMini';
|
||||
}
|
||||
echo $this->element($element, array(
|
||||
'mayModify' => $mayModify,
|
||||
'isAclTagger' => $isAclTagger,
|
||||
'data' => $object['Galaxy'],
|
||||
'target_id' => $scope == 'event' ? $object['Event']['id'] : $object['Attribute']['id'],
|
||||
'target_type' => $scope
|
||||
));
|
||||
$mayModify = ($isAclModify && $object['Event']['orgc_id'] == $me['org_id']);
|
||||
if ($scope === 'event') {
|
||||
echo '<span class="title-section">' . __('Galaxies') . '</span>';
|
||||
}
|
||||
echo $this->element('galaxyQuickViewNew', [
|
||||
'mayModify' => $mayModify,
|
||||
'isAclTagger' => $isAclTagger,
|
||||
'data' => $object['Galaxy'],
|
||||
'target_id' => $scope == 'event' ? $object['Event']['id'] : $object['Attribute']['id'],
|
||||
'target_type' => $scope
|
||||
]);
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
var showContext = false;
|
||||
$(document).ready(function () {
|
||||
$(function () {
|
||||
$('.addGalaxy').click(function() {
|
||||
addGalaxyListener(this);
|
||||
});
|
||||
|
|
|
@ -530,9 +530,15 @@
|
|||
<div id="pivots_div">
|
||||
<?php if (sizeOf($allPivots) > 1) echo $this->element('pivot'); ?>
|
||||
</div>
|
||||
<div id="galaxies_div" class="info_container">
|
||||
<h4 class="blue"><?php echo __('Galaxies');?></h4>
|
||||
<?php echo $this->element('galaxyQuickView', array('mayModify' => $mayModify, 'isAclTagger' => $isAclTagger, 'data' => $event['Galaxy'], 'target_id' => $event['Event']['id'], 'target_type' => 'event')); ?>
|
||||
<div id="galaxies_div">
|
||||
<span class="title-section"><?= __('Galaxies') ?></span>
|
||||
<?= $this->element('galaxyQuickViewNew', [
|
||||
'mayModify' => $mayModify,
|
||||
'isAclTagger' => $isAclTagger,
|
||||
'data' => $event['Galaxy'],
|
||||
'target_id' => $event['Event']['id'],
|
||||
'target_type' => 'event'
|
||||
]); ?>
|
||||
</div>
|
||||
<div id="eventgraph_div" class="info_container_eventgraph_network" style="display: none;" data-fullscreen="false">
|
||||
<?php echo $this->element('view_event_graph'); ?>
|
||||
|
|
|
@ -93,6 +93,15 @@ $tableData[] = [
|
|||
<?php endif; ?>
|
||||
</div>
|
||||
<br />
|
||||
<?php if (!empty($event['Galaxy'])): ?>
|
||||
<div id="galaxies_div">
|
||||
<span class="title-section"><?= __('Galaxies') ?></span>
|
||||
<?= $this->element('galaxyQuickViewNew', [
|
||||
'data' => $event['Galaxy'],
|
||||
'preview' => true,
|
||||
]); ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<div id="attributes_div">
|
||||
<?php echo $this->element('Servers/eventattribute'); ?>
|
||||
</div>
|
||||
|
|
|
@ -1980,15 +1980,63 @@ a.discrete {
|
|||
margin-top: 15px;
|
||||
}
|
||||
|
||||
.info_container {
|
||||
border: 1px solid #0088cc;
|
||||
border-radius: 7px;
|
||||
box-shadow: 0px 0px 6px #B2B2B2;
|
||||
padding-left:10px;
|
||||
padding-right:10px;
|
||||
padding-bottom:10px;
|
||||
width: 400px;
|
||||
height: 100%;
|
||||
#galaxies_div {
|
||||
position: relative;
|
||||
padding: 35px 15px 15px 15px;
|
||||
background-color: #fff;
|
||||
border: 1px solid #ddd;
|
||||
border-radius: 3px;
|
||||
width: 40em;
|
||||
}
|
||||
|
||||
#galaxies_div > .title-section {
|
||||
position: absolute;
|
||||
top: -1px;
|
||||
left: -1px;
|
||||
padding: 3px 7px;
|
||||
font-weight: bold;
|
||||
background-color: #f5f5f5;
|
||||
border: 1px solid #ddd;
|
||||
color: #6b6b6b;
|
||||
border-radius: 3px 0 3px 0;
|
||||
}
|
||||
|
||||
#galaxies_div .galaxyQuickView ul {
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.galaxyQuickView {
|
||||
padding-bottom: 4px;
|
||||
}
|
||||
|
||||
.galaxyQuickView h3 {
|
||||
font-size: 14px;
|
||||
color: #0088cc;
|
||||
margin-bottom: 0;
|
||||
margin-top: 2px;
|
||||
}
|
||||
|
||||
.galaxyQuickView ul {
|
||||
list-style: none;
|
||||
color: #0088cc;
|
||||
margin: 0 0 0 8px;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.galaxyQuickView ul a, .galaxyQuickView h3 a {
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
button.addGalaxy {
|
||||
line-height: 10px;
|
||||
padding: 2px;
|
||||
margin-right: 5px;
|
||||
margin-top: 1px;
|
||||
}
|
||||
|
||||
button.addGalaxy .fa-plus {
|
||||
font-size: 11px;
|
||||
line-height: 13px;
|
||||
}
|
||||
|
||||
.info_container_form {
|
||||
|
@ -2001,20 +2049,6 @@ a.discrete {
|
|||
margin-bottom:10px;
|
||||
}
|
||||
|
||||
.info_container_key {
|
||||
vertical-align:text-top;
|
||||
width:100px;
|
||||
padding-bottom:10px;
|
||||
}
|
||||
|
||||
.info_container_value {
|
||||
vertical-align:text-top;
|
||||
display:inline-block;
|
||||
width:300px;
|
||||
padding-bottom:10px;
|
||||
word-wrap:break-word;
|
||||
}
|
||||
|
||||
.bottomGap {
|
||||
margin-bottom:5px;
|
||||
}
|
||||
|
|
|
@ -1827,6 +1827,8 @@ function popoverPopup(clicked, id, context, target, admin) {
|
|||
|
||||
// create a confirm popover on the clicked html node.
|
||||
function popoverConfirm(clicked, message, placement) {
|
||||
event.preventDefault();
|
||||
|
||||
var $clicked = $(clicked);
|
||||
var popoverContent = '<div>';
|
||||
popoverContent += message === undefined ? '' : '<p>' + message + '</p>';
|
||||
|
@ -4710,15 +4712,18 @@ $(document).ready(function() {
|
|||
}
|
||||
});
|
||||
|
||||
// For galaxyQuickViewMini.ctp
|
||||
$('.expandable[data-clusterid]')
|
||||
.on('click', function() {
|
||||
loadClusterRelations($(this).data('clusterid'));
|
||||
})
|
||||
.popover({
|
||||
html: true,
|
||||
trigger: 'hover'
|
||||
});
|
||||
// For galaxyQuickViewNew.ctp
|
||||
$(document.body).on('click', '*[data-clusterid]', function() {
|
||||
loadClusterRelations($(this).data('clusterid'));
|
||||
});
|
||||
$(document.body).popover({
|
||||
selector: '.galaxyQuickView ul li b',
|
||||
html: true,
|
||||
trigger: 'hover',
|
||||
container: 'body',
|
||||
}).on('shown', function() {
|
||||
$('.tooltip').not(":last").remove();
|
||||
});
|
||||
|
||||
if ($('.alert').text().indexOf("$flashErrorMessage") >= 0) {
|
||||
var flashMessageLink = '<span class="useCursorPointer underline bold" onClick="flashErrorPopover();">here</span>';
|
||||
|
|
Loading…
Reference in New Issue