mirror of https://github.com/MISP/MISP
new: [variable tags] Added the ability to load and display variable tags
- as requested by Siemenspull/3725/head
parent
d437040b00
commit
07376b1a9e
|
@ -69,7 +69,7 @@ class AppModel extends Model
|
|||
public $db_changes = array(
|
||||
1 => false, 2 => false, 3 => false, 4 => true, 5 => false, 6 => false,
|
||||
7 => false, 8 => false, 9 => false, 10 => false, 11 => false, 12 => false,
|
||||
13 => false, 14 => false, 15 => false, 16 => false, 17 => false
|
||||
13 => false, 14 => false, 15 => false, 16 => false, 17 => false, 21 => false
|
||||
);
|
||||
|
||||
public function afterSave($created, $options = array())
|
||||
|
@ -1031,6 +1031,11 @@ class AppModel extends Model
|
|||
case '17':
|
||||
$sqlArray[] = 'ALTER TABLE `taxonomies` ADD COLUMN exclusive tinyint(1) DEFAULT 0;';
|
||||
break;
|
||||
case 21:
|
||||
$sqlArray[] = 'ALTER TABLE `tags` ADD COLUMN numerical_value int(11) NULL;';
|
||||
$sqlArray[] = 'ALTER TABLE `taxonomy_predicates` ADD COLUMN numerical_value int(11) NULL;';
|
||||
$sqlArray[] = 'ALTER TABLE `taxonomy_entries` ADD COLUMN numerical_value int(11) NULL;';
|
||||
break;
|
||||
case 'fixNonEmptySharingGroupID':
|
||||
$sqlArray[] = 'UPDATE `events` SET `sharing_group_id` = 0 WHERE `distribution` != 4;';
|
||||
$sqlArray[] = 'UPDATE `attributes` SET `sharing_group_id` = 0 WHERE `distribution` != 4;';
|
||||
|
|
|
@ -147,6 +147,9 @@ class Taxonomy extends AppModel
|
|||
if (isset($entry['colour']) && !empty($entry['colour'])) {
|
||||
$temp['colour'] = $entry['colour'];
|
||||
}
|
||||
if (isset($entry['numerical_value']) && $entry['numerical_value'] !== null) {
|
||||
$temp['numerical_value'] = $entry['numerical_value'];
|
||||
}
|
||||
$entries[] = $temp;
|
||||
}
|
||||
} else {
|
||||
|
@ -155,6 +158,9 @@ class Taxonomy extends AppModel
|
|||
if (isset($predicate['colour']) && !empty($predicate['colour'])) {
|
||||
$temp['colour'] = $predicate['colour'];
|
||||
}
|
||||
if (isset($predicate['numerical_value']) && $predicate['numerical_value'] !== null) {
|
||||
$temp['numerical_value'] = $predicate['numerical_value'];
|
||||
}
|
||||
$entries[] = $temp;
|
||||
}
|
||||
}
|
||||
|
@ -267,13 +273,20 @@ class Taxonomy extends AppModel
|
|||
foreach ($taxonomy['entries'] as $k => $entry) {
|
||||
if (isset($tags[strtoupper($entry['tag'])])) {
|
||||
$temp = $tags[strtoupper($entry['tag'])];
|
||||
if ((in_array('colour', $skipUpdateFields) && $temp['Tag']['colour'] != $colours[$k]) || (in_array('name', $skipUpdateFields) && $temp['Tag']['name'] !== $entry['tag'])) {
|
||||
if (
|
||||
(!in_array('colour', $skipUpdateFields) && $temp['Tag']['colour'] != $colours[$k]) ||
|
||||
(!in_array('name', $skipUpdateFields) && $temp['Tag']['name'] !== $entry['tag']) ||
|
||||
(!in_array('numerical_value', $skipUpdateFields) && isset($entry['numerical_value']) && isset($temp['Tag']['numerical_value']) && $temp['Tag']['numerical_value'] !== $entry['numerical_value'])
|
||||
) {
|
||||
if (!in_array('colour', $skipUpdateFields)) {
|
||||
$temp['Tag']['colour'] = (isset($entry['colour']) && !empty($entry['colour'])) ? $entry['colour'] : $colours[$k];
|
||||
}
|
||||
if (!in_array('name', $skipUpdateFields)) {
|
||||
$temp['Tag']['name'] = $entry['tag'];
|
||||
}
|
||||
if (!in_array('numerical_value', $skipUpdateFields)) {
|
||||
$temp['Tag']['numerical_value'] = $entry['numerical_value'];
|
||||
}
|
||||
$this->Tag->save($temp['Tag']);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -72,6 +72,7 @@
|
|||
<?php endif;?>
|
||||
<th><?php echo $this->Paginator->sort('tag');?></th>
|
||||
<th><?php echo $this->Paginator->sort('expanded');?></th>
|
||||
<th><?php echo $this->Paginator->sort('numerical_value');?></th>
|
||||
<th><?php echo $this->Paginator->sort('events');?></th>
|
||||
<th><?php echo $this->Paginator->sort('attributes');?></th>
|
||||
<th><?php echo $this->Paginator->sort('tag');?></th>
|
||||
|
@ -86,6 +87,7 @@
|
|||
<?php endif; ?>
|
||||
<td id="tag_<?php echo h($k); ?>" class="short"><?php echo h($item['tag']); ?></td>
|
||||
<td><?php echo h($item['expanded']); ?> </td>
|
||||
<td class="short"><?php echo isset($item['numerical_value']) ? h($item['numerical_value']) : ''; ?> </td>
|
||||
<td class="short">
|
||||
<?php
|
||||
if ($item['existing_tag']) {
|
||||
|
|
Loading…
Reference in New Issue