chg: [DecayingTool] Added list of available Object Attribute

pull/5032/head
mokaddem 2019-03-19 16:04:47 +01:00
parent 5558b7e44a
commit e192f2909b
3 changed files with 35 additions and 3 deletions

View File

@ -135,6 +135,13 @@ class DecayingModelController extends AppController
// $types = array_filter($types, function($v, $k) {
// return $v['to_ids'] == 1;
// }, ARRAY_FILTER_USE_BOTH);
$this->loadModel('ObjectTemplateElement');
$objectTypes = $this->ObjectTemplateElement->getAllAvailableTypes();
array_walk($objectTypes, function(&$key) {
$key["isObject"] = true;
$key["default_category"] = $key["category"];
});
$types = array_merge($types, $objectTypes);
ksort($types);
$savedDecayingModels = $this->DecayingModel->fetchAllowedModels($this->Auth->user());

View File

@ -41,4 +41,21 @@ class ObjectTemplateElement extends AppModel
}
return true;
}
public function getAllAvailableTypes() {
$temp = $this->find('all', array(
'recursive' => -1,
'fields' => array('object_relation as type', 'description AS desc', 'categories'),
'group' => 'type'
));
$res = array();
foreach ($temp as $type) {
$res[$type['ObjectTemplateElement']['type']] = array(
'desc' => $type['ObjectTemplateElement']['desc'],
'category' => implode(' / ', $type['ObjectTemplateElement']['categories'])
);
}
return $res;
}
}

View File

@ -28,7 +28,7 @@
$class = 'hidden ';
if (isset($info['isObject']) && $info['isObject']) {
$class .= 'isObject';
} else if ($info['to_ids'] != 1) {
} else if (isset($info['to_ids']) && $info['to_ids'] != 1) {
$class .= 'isNotToIDS';
} else {
$class = "";
@ -36,7 +36,15 @@
?>
<tr class="<?php echo $class; ?>">
<td><input type="checkbox"></input></td>
<td class="useCursorPointer"><?php echo h($type); ?></td>
<td class="useCursorPointer">
<?php if(isset($info['isObject']) && $info['isObject']): ?>
<it class="fa fa-cube" title="<?php echo __('Belong to a MISP Object'); ?>"></it>
<?php endif; ?>
<span title="<?php echo isset($info['desc']) ? $info['desc'] : ''; ?>"><?php echo h($type); ?></span>
<?php if(isset($info['to_ids']) && $info['to_ids'] == 1): ?>
<it class="fa fa-flag fa-pull-right" title="<?php echo __('To IDS flag set'); ?>"></it>
<?php endif; ?>
</td>
<td class="useCursorPointer"><?php echo h($info['default_category']); ?></td>
<td></td>
</tr>
@ -53,7 +61,7 @@
<div class="span6" style="margin-bottom: 20px;">
<?php foreach ($parameters as $param => $config): ?>
<div class="input-prepend input-append">
<span class="add-on" data-toggle="tooltip" data-placement="left" style="min-width: 70px;" title="<?php echo isset($config['info']) ? h($config['info']) : ''?>">
<span class="add-on" data-toggle="tooltip" data-placement="left" style="min-width: 100px;" title="<?php echo isset($config['info']) ? h($config['info']) : ''?>">
<?php echo h($config['name']) . (isset($config['greek']) ? ' <strong>'.h($config['greek']).'</strong>' : ''); ?>
</span>
<input id="input_<?php echo h($param); ?>" class="input-mini" type="number" min=0 step=<?php echo h($config['step']); ?> value=<?php echo h($config['value']); ?> oninput="refreshGraph(this);" ></input>