mirror of https://github.com/MISP/MISP
Merge branch '2.4' of github.com:MISP/MISP into 2.4
commit
9e46340b74
|
@ -3284,6 +3284,12 @@ class AttributesController extends AppController
|
|||
}
|
||||
}
|
||||
|
||||
public function toggleToIDS($id)
|
||||
{
|
||||
return $this->fetchEditForm($id, 'to_ids');
|
||||
}
|
||||
|
||||
|
||||
public function checkAttachments()
|
||||
{
|
||||
$attributes = $this->Attribute->find(
|
||||
|
|
|
@ -1223,6 +1223,7 @@ class EventsController extends AppController
|
|||
$emptyEvent = (empty($event['Object']) && empty($event['Attribute']));
|
||||
$this->set('emptyEvent', $emptyEvent);
|
||||
$attributeCount = isset($event['Attribute']) ? count($event['Attribute']) : 0;
|
||||
$objectCount = isset($event['Object']) ? count($event['Object']) : 0;
|
||||
if (!empty($event['Object'])) {
|
||||
foreach ($event['Object'] as $k => $object) {
|
||||
if (!empty($object['Attribute'])) {
|
||||
|
@ -1231,6 +1232,7 @@ class EventsController extends AppController
|
|||
}
|
||||
}
|
||||
$this->set('attribute_count', $attributeCount);
|
||||
$this->set('object_count', $objectCount);
|
||||
// set the data for the contributors / history field
|
||||
$org_ids = $this->Event->ShadowAttribute->getEventContributors($event['Event']['id']);
|
||||
$contributors = $this->Event->Org->find('list', array('fields' => array('Org.name'), 'conditions' => array('Org.id' => $org_ids)));
|
||||
|
|
|
@ -1,20 +1,39 @@
|
|||
<?php
|
||||
echo $this->Form->create('Attribute', array('class' => 'inline-form inline-field-form', 'id' => 'Attribute' . '_' . $object['id'] . '_to_ids_form', 'url' => '/attributes/editField/' . $object['id']));
|
||||
?>
|
||||
<div class='inline-input inline-input-container'>
|
||||
<div class="inline-input-accept inline-input-button inline-input-passive"><span class = "icon-ok" role="button" tabindex="0" aria-label="<?php echo __('Accept change'); ?>"></span></div>
|
||||
<div class="inline-input-decline inline-input-button inline-input-passive"><span class = "icon-remove" role="button" tabindex="0" aria-label="<?php echo __('Discard change'); ?>"></span></div>
|
||||
<?php
|
||||
$current = 0;
|
||||
if ($object['to_ids']) $current = 1;
|
||||
<div class="confirmation">
|
||||
<?php
|
||||
echo $this->Form->create('Attribute', array('style' => 'margin:0px;', 'id' => 'PromptForm', 'url' => '/attributes/editField/' . $object['id']));
|
||||
echo $this->Form->input('to_ids', array(
|
||||
'options' => array(0 => 'No', 1 => 'Yes'),
|
||||
'label' => false,
|
||||
'selected' => $current,
|
||||
'class' => 'inline-input',
|
||||
'id' => 'Attribute' . '_' . $object['id'] . '_to_ids_field',
|
||||
'div' => false
|
||||
'options' => array(0 => 'No', 1 => 'Yes'),
|
||||
'label' => false,
|
||||
'selected' => !$object['to_ids'],
|
||||
'class' => 'hidden',
|
||||
'id' => 'Attribute' . '_' . $object['id'] . '_to_ids_field',
|
||||
'div' => false
|
||||
));
|
||||
echo $this->Form->end();
|
||||
?>
|
||||
?>
|
||||
<legend><?php echo __('Toggle IDS flag %s ', !$object['to_ids'] ? __('on') : __('off'));?></legend>
|
||||
<div style="padding-left:5px;padding-right:5px;padding-bottom:5px;">
|
||||
<p>
|
||||
<?php
|
||||
if (!$object['to_ids']) {
|
||||
echo __('Set the IDS flag for this attribute.');
|
||||
} else {
|
||||
echo __('Unset the IDS flag for this attribute.');
|
||||
}
|
||||
?>
|
||||
</p>
|
||||
<table>
|
||||
<tr>
|
||||
<td style="vertical-align:top">
|
||||
|
||||
<span id="PromptYesButton" title="<?php echo __('Toggle IDS flag for attribute'); ?>" role="button" tabindex="0" aria-label="<?php echo __('Toggle IDS flag for attribute'); ?>" class="btn btn-primary" onClick="toggleToIDS(<?php echo h($object['id']); ?>, 1);"><?php echo __('Yes'); ?></span>
|
||||
</td>
|
||||
<td style="width:540px;">
|
||||
</td>
|
||||
<td style="vertical-align:top;">
|
||||
<span class="btn btn-inverse" title="<?php echo __('Cancel'); ?>" role="button" tabindex="0" aria-label="<?php echo __('Cancel'); ?>" id="PromptNoButton" onClick="cancelPrompt();"><?php echo __('No'); ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<?php echo $this->Form->end(); ?>
|
||||
</div>
|
||||
|
|
|
@ -180,6 +180,11 @@ $(document).ready(function () {
|
|||
getPopup(attribute_id, 'attributes', 'toggleCorrelation', '', '#confirmation_box');
|
||||
return false;
|
||||
});
|
||||
$('.toids-toggle').click(function() {
|
||||
var attribute_id = $(this).data('attribute-id');
|
||||
getPopup(attribute_id, 'attributes', 'toggleToIDS', '', '#confirmation_box');
|
||||
return false;
|
||||
});
|
||||
popoverStartup();
|
||||
$(document).on('click', function (e) {
|
||||
//did not click a popover toggle or popover
|
||||
|
|
|
@ -304,10 +304,10 @@
|
|||
?>
|
||||
</ul>
|
||||
</td>
|
||||
<td class="short" onmouseenter="quickEditHover(this, '<?php echo $editScope; ?>', '<?php echo $object['id']; ?>', 'to_ids', <?php echo $event['Event']['id'];?>);">
|
||||
<td class="short">
|
||||
<div id = "Attribute_<?php echo $object['id']; ?>_to_ids_placeholder" class = "inline-field-placeholder"></div>
|
||||
<div id = "Attribute_<?php echo $object['id']; ?>_to_ids_solid" class="inline-field-solid">
|
||||
<input type="checkbox" <?php echo $object['to_ids'] ? 'checked' : ''; ?> disabled></input>
|
||||
<input type="checkbox" class="toids-toggle" id="toids_toggle_<?php echo h($object['id']); ?>" data-attribute-id="<?php echo h($object['id']); ?>" <?php echo $object['to_ids'] ? 'checked' : ''; ?> ></input>
|
||||
</div>
|
||||
</td>
|
||||
<td class="short" onmouseenter="quickEditHover(this, '<?php echo $editScope; ?>', '<?php echo $object['id']; ?>', 'distribution', <?php echo $event['Event']['id'];?>);">
|
||||
|
|
|
@ -296,6 +296,11 @@ attributes or the appropriate distribution level. If you think there is a mistak
|
|||
getPopup(attribute_id, 'attributes', 'toggleCorrelation', '', '#confirmation_box');
|
||||
return false;
|
||||
});
|
||||
$('.toids-toggle').click(function() {
|
||||
var attribute_id = $(this).data('attribute-id');
|
||||
getPopup(attribute_id, 'attributes', 'toggleToIDS', '', '#confirmation_box');
|
||||
return false;
|
||||
});
|
||||
$('.screenshot').click(function() {
|
||||
screenshotPopup($(this).attr('src'), $(this).attr('title'));
|
||||
});
|
||||
|
|
|
@ -50,7 +50,7 @@
|
|||
$use_select = count($items) > $select_threshold;
|
||||
$countThresholdReached = count($items) > 1000;
|
||||
$option_templates = array();
|
||||
$option_additionalData = array();
|
||||
$options_additionalData = array();
|
||||
?>
|
||||
|
||||
<script>
|
||||
|
@ -224,7 +224,7 @@ function submitFunction(clicked, callback) {
|
|||
$option_templates[h($param['value'])] = $template;
|
||||
}
|
||||
if (isset($param['additionalData'])) {
|
||||
$additionalData = json_encode($param['additionalData']);
|
||||
$additionalData = $param['additionalData'];
|
||||
$options_additionalData[h($param['value'])] = $additionalData;
|
||||
}
|
||||
}
|
||||
|
@ -242,7 +242,7 @@ function submitFunction(clicked, callback) {
|
|||
if (isset($param['isPill']) && $param['isPill']) {
|
||||
echo $this->GenericPicker->add_pill($param, $defaults);
|
||||
if (isset($param['additionalData'])) {
|
||||
$additionalData = json_encode($param['additionalData']);
|
||||
$additionalData = $param['additionalData'];
|
||||
$options_additionalData[h($param['value'])] = $additionalData;
|
||||
}
|
||||
}
|
||||
|
@ -264,7 +264,7 @@ function submitFunction(clicked, callback) {
|
|||
foreach ($items as $k => $param) {
|
||||
echo $this->GenericPicker->add_pill($param, $defaults);
|
||||
if (isset($param['additionalData'])) {
|
||||
$additionalData = json_encode($param['additionalData']);
|
||||
$additionalData = $param['additionalData'];
|
||||
$options_additionalData[h($param['value'])] = $additionalData;
|
||||
}
|
||||
}
|
||||
|
@ -282,7 +282,7 @@ function submitFunction(clicked, callback) {
|
|||
var options_additionalData = {}
|
||||
}
|
||||
options_templates['<?php echo $select_id; ?>'] = <?php echo json_encode($option_templates); ?>;
|
||||
options_additionalData['<?php echo $select_id; ?>'] = <?php echo json_encode($option_additionalData); ?>;
|
||||
options_additionalData['<?php echo $select_id; ?>'] = <?php echo json_encode($options_additionalData); ?>;
|
||||
</script>
|
||||
|
||||
</div>
|
||||
|
|
|
@ -167,9 +167,11 @@
|
|||
'class_value' => ($event['Event']['published'] == 0) ? '' : 'green',
|
||||
'html' => ($event['Event']['published'] == 0) ? 'No' : '<span class="green bold">Yes</span>' . ((empty($event['Event']['publish_timestamp'])) ? 'N/A' : ' (' . date('Y-m-d H:i:s', ($event['Event']['publish_timestamp'])) . ')')
|
||||
);
|
||||
$attribute_text = $attribute_count;
|
||||
$attribute_text .= $object_count > 1 ? sprintf(' (%s Objects)', h($object_count)) : sprintf(' (%s Object)', h($object_count));
|
||||
$table_data[] = array(
|
||||
'key' => __('#Attributes'),
|
||||
'value' => $attribute_count
|
||||
'value' => $attribute_text
|
||||
);
|
||||
$table_data[] = array(
|
||||
'key' => __('First recorded change'),
|
||||
|
|
|
@ -63,7 +63,7 @@ class GenericPickerHelper extends AppHelper {
|
|||
foreach ($param as $paramName => $paramValue) {
|
||||
if ($paramName === 'value') {
|
||||
$param_html .= sprintf('value="%s" ', h($paramValue));
|
||||
} else if ($paramName === 'template') {
|
||||
} else if ($paramName === 'template' || $paramName === 'additionalData') {
|
||||
continue;
|
||||
} else {
|
||||
$param_html .= sprintf('data-%s="%s" ', h($paramName), h($paramValue));
|
||||
|
|
|
@ -966,6 +966,11 @@ a.pill-pre-picker {
|
|||
color: #fff;
|
||||
line-height: 13px;
|
||||
}
|
||||
li .generic-picker-item-element-check {
|
||||
margin-top: -3px;
|
||||
margin-left: 5px;
|
||||
}
|
||||
|
||||
.generic-picker-item-element-check .fa:before {
|
||||
margin-right: 0px;
|
||||
}
|
||||
|
@ -2203,7 +2208,7 @@ table tr:hover .down-expand-button {
|
|||
.quick-edit-row-div {
|
||||
line-height: normal;
|
||||
display: inline-block;
|
||||
position: relative;
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
#attackmatrix_div {
|
||||
|
|
|
@ -324,6 +324,30 @@ function toggleCorrelation(id, skip_reload) {
|
|||
});
|
||||
}
|
||||
|
||||
function toggleToIDS(id, skip_reload) {
|
||||
if (typeof skip_reload === "undefined") {
|
||||
skip_reload = false;
|
||||
}
|
||||
$.ajax({
|
||||
beforeSend: function (XMLHttpRequest) {
|
||||
$(".loading").show();
|
||||
},
|
||||
data: $('#PromptForm').serialize(),
|
||||
success:function (data, textStatus) {
|
||||
handleGenericAjaxResponse(data, skip_reload);
|
||||
$("#toids_toggle_" + id).prop('checked', !$("#toids_toggle_" + id).is(':checked'));
|
||||
},
|
||||
complete:function() {
|
||||
$(".loading").hide();
|
||||
$("#confirmation_box").fadeOut();
|
||||
$("#gray_out").fadeOut();
|
||||
},
|
||||
type:"post",
|
||||
cache: false,
|
||||
url:'/attributes/editField/' + id ,
|
||||
});
|
||||
}
|
||||
|
||||
function eventUnpublish() {
|
||||
$('.publishButtons').show();
|
||||
$('.exportButtons').hide();
|
||||
|
|
Loading…
Reference in New Issue