mirror of https://github.com/MISP/MISP
wip: [enrichment view] Made IDS, comment and distribution changeable
- Applied on each attribute and object attribute returned as part of the module resultspull/4370/head
parent
ec2baacd73
commit
ecbe782709
|
@ -5110,6 +5110,8 @@ class EventsController extends AppController
|
|||
if (empty($attributes) && empty($objects)) {
|
||||
$this->__handleSimplifiedFormat($attribute, $module, $options, $result, $type);
|
||||
} else {
|
||||
$this->set('attributeValue', $attribute[0]['Attribute']['value']);
|
||||
$this->set('module', $module);
|
||||
$event = array('Event' => $attribute[0]['Event']);
|
||||
$event['Attribute'] = $attributes;
|
||||
$event['Object'] = $objects;
|
||||
|
|
|
@ -13,11 +13,14 @@
|
|||
$scope .= __('simplified attributes and');
|
||||
}
|
||||
$scope .= !empty($objects_array) ? join(' and ', $objects_array) : 'simplified attributes';
|
||||
if (!isset($importComment)) {
|
||||
$importComment = $attributeValue . ': Enriched via the ' . $module . ' module';
|
||||
}
|
||||
?>
|
||||
<p><?php echo __('Below you can see the %s that are to be created, from the results of the enrichment module.', $scope);?></p>
|
||||
<div style="margin-bottom:20px;">
|
||||
<?php
|
||||
$attributeFields = array('category', 'type', 'value', 'to_ids', 'comment', 'uuid', 'distribution');
|
||||
$attributeFields = array('category', 'type', 'value', 'uuid');
|
||||
$defaultDistribution = 5;
|
||||
if (!empty(Configure::read('MISP.default_attribute_distribution'))) {
|
||||
$defaultDistribution = Configure::read('MISP.default_attribute_distribution');
|
||||
|
@ -31,7 +34,7 @@
|
|||
<h3><?php echo __('Objects'); ?></h3>
|
||||
</table>
|
||||
<?php
|
||||
foreach ($event['Object'] as $object) {
|
||||
foreach ($event['Object'] as $o => $object) {
|
||||
?>
|
||||
<table class="table table-condensed table-stripped">
|
||||
<tbody>
|
||||
|
@ -46,15 +49,15 @@
|
|||
<th><?php echo __('Category');?></th>
|
||||
<th><?php echo __('Type');?></th>
|
||||
<th><?php echo __('Value');?></th>
|
||||
<th><?php echo __('UUID');?></th>
|
||||
<th><?php echo __('To IDS');?></th>
|
||||
<th><?php echo __('Comment');?></th>
|
||||
<th><?php echo __('UUID');?></th>
|
||||
<th><?php echo __('Distribution');?></th>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
if (!empty($object['Attribute'])) {
|
||||
foreach ($object['Attribute'] as $attribute) {
|
||||
foreach ($object['Attribute'] as $a => $attribute) {
|
||||
echo '<tr>';
|
||||
echo '<td>' . h($attribute['object_relation']) . '</td>';
|
||||
if (isset($attribute['distribution'])) {
|
||||
|
@ -66,9 +69,6 @@
|
|||
} else {
|
||||
$attribute['distribution'] = $distributions[$defaultDistribution];
|
||||
}
|
||||
if (isset($attribute['to_ids'])) {
|
||||
$attribute['to_ids'] = ($attribute['to_ids'] ? __('Yes') : __('No'));
|
||||
}
|
||||
foreach ($attributeFields as $field) {
|
||||
if (isset($attribute[$field])) {
|
||||
echo '<td>' . h($attribute[$field]) . '</td>';
|
||||
|
@ -76,6 +76,23 @@
|
|||
echo '<td></td>';
|
||||
}
|
||||
}
|
||||
?>
|
||||
<td class="short" style="width:40px;text-align:center;">
|
||||
<input type="checkbox" id="<?php echo 'Object' . $o . 'Attribute' . $a . 'To_ids'; ?>" <?php if (isset($attribute['to_ids']) && $attribute['to_ids']) echo 'checked'; ?> class="idsCheckbox"/>
|
||||
</td>
|
||||
<td class="short">
|
||||
<input type="text" class="freetextCommentField" id="<?php echo 'Object' . $o . 'Attribute' . $a . 'Comment'; ?>" style="padding:0px;height:20px;margin-bottom:0px;" placeholder="<?php echo h($importComment); ?>" <?php if (isset($attribute['comment']) && $attribute['comment'] !== false) echo 'value="' . h($attribute['comment']) . '"';?>/>
|
||||
</td>
|
||||
<td class="short" style="width:40px;text-align:center;">
|
||||
<select id="<?php echo 'Object' . $o . 'Attribute' . $a . 'Distribution'; ?>" class='distributionToggle' style='padding:0px;height:20px;margin-bottom:0px;'>
|
||||
<?php
|
||||
foreach ($distributions as $distKey => $distValue) {
|
||||
echo '<option value="' . $distKey . '" ' . ($distValue == $attribute['distribution'] ? 'selected="selected"' : '') . '>' . $distValue . '</option>';
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</td>
|
||||
<?php
|
||||
echo '</tr>';
|
||||
}
|
||||
}
|
||||
|
@ -96,23 +113,20 @@
|
|||
<th><?php echo __('Category');?></th>
|
||||
<th><?php echo __('Type');?></th>
|
||||
<th><?php echo __('Value');?></th>
|
||||
<th><?php echo __('UUID');?></th>
|
||||
<th><?php echo __('To IDS');?></th>
|
||||
<th><?php echo __('Comment');?></th>
|
||||
<th><?php echo __('UUID');?></th>
|
||||
<th><?php echo __('Distribution');?></th>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
foreach ($event['Attribute'] as $attribute) {
|
||||
foreach ($event['Attribute'] as $a => $attribute) {
|
||||
echo '<tr>';
|
||||
if (isset($attribute['distribution'])) {
|
||||
$attribute['distribution'] = ($attribute['distribution'] != 4 ? $distributions[$attribute['distribution']] : $sgs[$attribute['sharing_group_id']]);
|
||||
} else {
|
||||
$attribute['distribution'] = $distributions[$defaultDistribution];
|
||||
}
|
||||
if (isset($attribute['to_ids'])) {
|
||||
$attribute['to_ids'] = ($attribute['to_ids'] ? __('Yes') : _('No'));
|
||||
}
|
||||
foreach ($attributeFields as $field) {
|
||||
if (isset($attribute[$field])) {
|
||||
echo '<td>' . h($attribute[$field]) . '</td>';
|
||||
|
@ -120,6 +134,23 @@
|
|||
echo '<td></td>';
|
||||
}
|
||||
}
|
||||
?>
|
||||
<td class="short" style="width:40px;text-align:center;">
|
||||
<input type="checkbox" id="<?php echo 'Attribute' . $a . 'To_ids'; ?>" <?php if (isset($attribute['to_ids']) && $attribute['to_ids']) echo 'checked'; ?> class='idsCheckbox'/>
|
||||
</td>
|
||||
<td class="short">
|
||||
<input type="text" class="freetextCommentField" id="<?php echo 'Attribute' . $a . 'Comment'; ?>" style="padding:0px;height:20px;margin-bottom:0px;" placeholder="<?php echo h($importComment); ?>" <?php if (isset($attribute['comment']) && $attribute['comment'] !== false) echo 'value="' . h($attribute['comment']) . '"';?>/>
|
||||
</td>
|
||||
<td class="short" style="width:40px;text-align:center;">
|
||||
<select id="<?php echo 'Attribute' . $a . 'Distribution'; ?>" class='distributionToggle' style='padding:0px;height:20px;margin-bottom:0px;'>
|
||||
<?php
|
||||
foreach ($distributions as $distKey => $distValue) {
|
||||
echo '<option value="' . $distKey . '" ' . ($distValue == $attribute['distribution'] ? 'selected="selected"' : '') . '>' . $distValue . '</option>';
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</td>
|
||||
<?php
|
||||
echo '</tr>';
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue