mirror of https://github.com/MISP/MISP
fix: [UI] Quick edit of distribution
parent
38513b7060
commit
e32971df5a
|
@ -1989,7 +1989,7 @@ class AttributesController extends AppController
|
|||
$attribute = $attribute[0];
|
||||
$result = $attribute['Attribute'][$field];
|
||||
if ($field === 'distribution') {
|
||||
$result = $this->Attribute->shortDist[$result];
|
||||
$this->set('shortDist', $this->Attribute->shortDist);
|
||||
} elseif ($field === 'value') {
|
||||
$this->loadModel('Warninglist');
|
||||
$attribute['Attribute'] = $this->Warninglist->checkForWarning($attribute['Attribute']);
|
||||
|
|
|
@ -595,7 +595,7 @@ class ObjectsController extends AppController
|
|||
$object = $object[0];
|
||||
$result = $object['Object'][$field];
|
||||
if ($field === 'distribution') {
|
||||
$result = $this->MispObject->shortDist[$result];
|
||||
$this->set('shortDist', $this->Attribute->shortDist);
|
||||
}
|
||||
$this->set('value', $result);
|
||||
$this->set('field', $field);
|
||||
|
@ -632,7 +632,7 @@ class ObjectsController extends AppController
|
|||
throw new NotFoundException(__('Invalid object'));
|
||||
}
|
||||
$this->layout = false;
|
||||
if ($field == 'distribution') {
|
||||
if ($field === 'distribution') {
|
||||
$distributionLevels = $this->MispObject->shortDist;
|
||||
unset($distributionLevels[4]);
|
||||
$this->set('distributionLevels', $distributionLevels);
|
||||
|
|
|
@ -3,6 +3,12 @@ if ($field === 'value') {
|
|||
echo $this->element('Events/View/value_field', ['object' => $object['Attribute']]);
|
||||
} elseif ($field === 'timestamp') {
|
||||
echo $this->Time->date($value);
|
||||
} elseif ($field === 'distribution') {
|
||||
if ($value == 0) {
|
||||
echo '<span class="red">' . $shortDist[$value] . '</span>';
|
||||
} else {
|
||||
echo $shortDist[$value];
|
||||
}
|
||||
} else {
|
||||
echo nl2br(h($value), false);
|
||||
}
|
||||
|
|
|
@ -289,14 +289,18 @@
|
|||
<input type="checkbox" class="toids-toggle" id="toids_toggle_<?= $objectId ?>" aria-label="<?= __('Toggle IDS flag') ?>" title="<?= __('Toggle IDS flag') ?>"<?= $object['to_ids'] ? ' checked' : ''; ?><?= $mayModify ? '' : ' disabled' ?>>
|
||||
</td>
|
||||
<td class="short"<?= $quickEdit('distribution') ?>>
|
||||
<div class="inline-field-solid<?= $object['distribution'] == 0 ? ' red' : '' ?>">
|
||||
<div class="inline-field-solid">
|
||||
<?php
|
||||
if ($object['distribution'] == 4):
|
||||
?>
|
||||
<a href="<?php echo $baseurl;?>/sharing_groups/view/<?php echo h($object['sharing_group_id']); ?>"><?php echo h($object['SharingGroup']['name']);?></a>
|
||||
<?php
|
||||
else:
|
||||
echo h($shortDist[$object['distribution']]);
|
||||
if ($object['distribution'] == 0) {
|
||||
echo '<span class="red">' . h($shortDist[$object['distribution']]) . '</span>';
|
||||
} else {
|
||||
echo h($shortDist[$object['distribution']]);
|
||||
}
|
||||
endif;
|
||||
?>
|
||||
</div>
|
||||
|
|
|
@ -83,14 +83,18 @@ $objectId = intval($object['id']);
|
|||
</td>
|
||||
<td colspan="4"></td>
|
||||
<td class="shortish"<?= $quickEdit('distribution') ?>>
|
||||
<div class="inline-field-solid<?= $object['distribution'] == 0 ? ' red' : '' ?>">
|
||||
<div class="inline-field-solid">
|
||||
<?php
|
||||
if ($object['distribution'] == 4):
|
||||
?>
|
||||
<a href="<?php echo $baseurl; ?>/sharing_groups/view/<?php echo h($object['sharing_group_id']); ?>"><?php echo h($object['SharingGroup']['name']);?></a>
|
||||
<?php
|
||||
else:
|
||||
echo h($shortDist[$object['distribution']]);
|
||||
if ($object['distribution'] == 0) {
|
||||
echo '<span class="red">' . h($shortDist[$object['distribution']]) . '</span>';
|
||||
} else {
|
||||
echo h($shortDist[$object['distribution']]);
|
||||
}
|
||||
endif;
|
||||
?>
|
||||
</div>
|
||||
|
|
|
@ -1,6 +1,12 @@
|
|||
<?php
|
||||
if ($field === 'timestamp') {
|
||||
echo $this->Time->date($value);
|
||||
} elseif ($field === 'distribution') {
|
||||
if ($value == 0) {
|
||||
echo '<span class="red">' . $shortDist[$value] . '</span>';
|
||||
} else {
|
||||
echo $shortDist[$value];
|
||||
}
|
||||
} else {
|
||||
echo nl2br(h($value), false);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue