new: Tell users about our lord and saviour, MISP-objects if they try to add a composite attribute

pull/2850/head
iglocska 2018-01-18 11:59:26 +01:00
parent 444b24ac73
commit 55f19fa260
2 changed files with 9 additions and 0 deletions

View File

@ -303,6 +303,7 @@ class AttributesController extends AppController {
}
$types = $this->_arrayToValuesIndexArray($types);
$this->set('types', $types);
$this->set('compositeTypes', $this->Attribute->getCompositeTypes());
// combobox for categories
$categories = array_keys($this->Attribute->categoryDefinitions);
$categories = $this->_arrayToValuesIndexArray($categories);

View File

@ -5,6 +5,7 @@
<fieldset>
<legend><?php echo __('Add Attribute'); ?></legend>
<div id="formWarning" class="message ajaxMessage"></div>
<div id="compositeWarning" class="message <?php echo !empty($ajax) ? 'ajaxMessage' : '';?>" style="display:none;">Did you consider adding an object instead of a composite attribute?</div>
<div class="add_attribute_fields">
<?php
echo $this->Form->hidden('event_id');
@ -140,6 +141,8 @@ var category_type_mapping = new Array();
}
?>
var composite_types = <?php echo json_encode($compositeTypes); ?>;
$(document).ready(function() {
initPopoverContent('Attribute');
$('#AttributeDistribution').change(function() {
@ -164,6 +167,11 @@ $(document).ready(function() {
var start = $("#AttributeType").val();
initPopoverContent('Attribute');
$("#AttributeType").val(start);
if ($.inArray(start, composite_types) > -1) {
$('#compositeWarning').show();
} else {
$('#compositeWarning').hide();
}
});
<?php if ($ajax): ?>
$('#cancel_attribute_add').click(function() {