2016-06-04 01:10:45 +02:00
|
|
|
<?php
|
2019-12-10 10:48:15 +01:00
|
|
|
$modelForForm = 'Attribute';
|
|
|
|
echo $this->element('genericElements/Form/genericForm', array(
|
|
|
|
'form' => $this->Form,
|
|
|
|
'data' => array(
|
|
|
|
'title' => $action === 'add' ? __('Add Attribute') : __('Edit Attribute'),
|
|
|
|
'model' => $modelForForm,
|
|
|
|
'fields' => array(
|
|
|
|
array(
|
|
|
|
'field' => 'event_id',
|
|
|
|
'class' => 'org-id-picker-hidden-field',
|
|
|
|
'type' => 'text',
|
|
|
|
'hidden' => true
|
|
|
|
),
|
|
|
|
array(
|
|
|
|
'field' => 'category',
|
|
|
|
'class' => 'input',
|
|
|
|
'empty' => __('(choose one)'),
|
|
|
|
'options' => $categories,
|
|
|
|
'stayInLine' => 1
|
|
|
|
),
|
|
|
|
array(
|
|
|
|
'field' => 'type',
|
|
|
|
'class' => 'input',
|
|
|
|
'empty' => __('(choose category first)'),
|
|
|
|
'options' => $types
|
|
|
|
),
|
|
|
|
array(
|
|
|
|
'field' => 'distribution',
|
|
|
|
'class' => 'input',
|
|
|
|
'options' => $distributionLevels,
|
|
|
|
'default' => isset($attribute['Attribute']['distribution']) ? $attribute['Attribute']['distribution'] : $initialDistribution,
|
|
|
|
'stayInLine' => 1
|
|
|
|
),
|
|
|
|
array(
|
|
|
|
'field' => 'sharing_group_id',
|
|
|
|
'class' => 'input',
|
|
|
|
'options' => $sharingGroups,
|
|
|
|
'label' => __("Sharing Group")
|
|
|
|
),
|
|
|
|
array(
|
|
|
|
'field'=> 'value',
|
2018-07-20 09:29:50 +02:00
|
|
|
'type' => 'textarea',
|
2019-12-10 10:48:15 +01:00
|
|
|
'class' => 'input span6',
|
|
|
|
'div' => 'input clear'
|
|
|
|
),
|
|
|
|
array(
|
|
|
|
'field' => 'comment',
|
2018-07-20 09:29:50 +02:00
|
|
|
'type' => 'text',
|
2019-12-10 10:48:15 +01:00
|
|
|
'class' => 'input span6',
|
2018-07-20 09:29:50 +02:00
|
|
|
'div' => 'input clear',
|
2019-12-10 10:48:15 +01:00
|
|
|
'label' => __("Contextual Comment")
|
|
|
|
),
|
|
|
|
array(
|
|
|
|
'field' => 'to_ids',
|
|
|
|
'type' => 'checkbox',
|
|
|
|
'label' => __("for Intrusion Detection System"),
|
|
|
|
//'stayInLine' => 1
|
|
|
|
),
|
|
|
|
array(
|
|
|
|
'field' => 'batch_import',
|
2018-07-20 09:29:50 +02:00
|
|
|
'type' => 'checkbox'
|
2019-12-10 10:48:15 +01:00
|
|
|
),
|
|
|
|
array(
|
|
|
|
'field' => 'disable_correlation',
|
2019-01-17 07:57:23 +01:00
|
|
|
'type' => 'checkbox'
|
2019-12-10 10:48:15 +01:00
|
|
|
),
|
|
|
|
'<div id="extended_event_preview" style="width:446px;"></div>'
|
|
|
|
),
|
|
|
|
'submit' => array(
|
|
|
|
'action' => $action,
|
|
|
|
'ajaxSubmit' => sprintf(
|
|
|
|
'submitPopoverForm(%s, %s)',
|
|
|
|
"'" . ($action == 'add' ? h($event_id) : h($attribute['Attribute']['id'])) . "'",
|
|
|
|
"'" . h($action) . "'"
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
));
|
2018-07-20 09:29:50 +02:00
|
|
|
if (!$ajax) {
|
2019-12-10 10:48:15 +01:00
|
|
|
echo $this->element('/genericElements/SideMenu/side_menu', array('menuList' => 'event-collection', 'menuItem' => $this->action === 'add' ? 'add' : 'editEvent'));
|
2018-07-20 09:29:50 +02:00
|
|
|
}
|
2013-10-24 10:33:34 +02:00
|
|
|
?>
|
2019-12-10 10:48:15 +01:00
|
|
|
|
2013-05-30 11:14:00 +02:00
|
|
|
<script type="text/javascript">
|
2019-12-10 10:48:15 +01:00
|
|
|
var notice_list_triggers = <?php echo $notice_list_triggers; ?>;
|
|
|
|
var composite_types = <?php echo json_encode($compositeTypes); ?>;
|
|
|
|
var category_type_mapping = new Array();
|
2016-10-02 12:46:30 +02:00
|
|
|
|
2019-12-10 10:48:15 +01:00
|
|
|
<?php
|
2018-07-20 09:29:50 +02:00
|
|
|
foreach ($categoryDefinitions as $category => $def) {
|
|
|
|
echo "category_type_mapping['" . addslashes($category) . "'] = {";
|
|
|
|
$first = true;
|
|
|
|
foreach ($def['types'] as $type) {
|
2019-12-10 10:48:15 +01:00
|
|
|
if ($first) {
|
|
|
|
$first = false;
|
|
|
|
} else {
|
|
|
|
echo ', ';
|
|
|
|
}
|
2018-07-20 09:29:50 +02:00
|
|
|
echo "'" . addslashes($type) . "' : '" . addslashes($type) . "'";
|
|
|
|
}
|
|
|
|
echo "}; \n";
|
|
|
|
}
|
|
|
|
?>
|
2019-12-10 10:48:15 +01:00
|
|
|
|
2018-07-20 09:29:50 +02:00
|
|
|
$('#AttributeDistribution').change(function() {
|
2019-12-10 10:48:15 +01:00
|
|
|
checkSharingGroup('Attribute');
|
2018-07-20 09:29:50 +02:00
|
|
|
});
|
2015-04-14 18:11:51 +02:00
|
|
|
|
2019-12-10 10:48:15 +01:00
|
|
|
$('#AttributeCategory').change(function() {
|
2018-07-20 09:29:50 +02:00
|
|
|
formCategoryChanged('Attribute');
|
|
|
|
if ($(this).val() === 'Internal reference') {
|
|
|
|
$("#AttributeDistribution").val('0');
|
2019-12-10 10:48:15 +01:00
|
|
|
checkSharingGroup('Attribute');
|
2018-07-20 09:29:50 +02:00
|
|
|
}
|
|
|
|
});
|
2017-01-28 23:28:13 +01:00
|
|
|
|
2018-07-20 09:29:50 +02:00
|
|
|
$("#AttributeCategory, #AttributeType").change(function() {
|
|
|
|
checkNoticeList('attribute');
|
|
|
|
});
|
2018-05-07 10:43:21 +02:00
|
|
|
|
2019-12-10 10:48:15 +01:00
|
|
|
$(document).ready(function() {
|
|
|
|
<?php
|
|
|
|
if ($action == 'edit'):
|
|
|
|
?>
|
|
|
|
checkNoticeList('attribute');
|
|
|
|
<?php
|
|
|
|
endif;
|
|
|
|
?>
|
|
|
|
checkSharingGroup('Attribute');
|
2018-07-20 09:29:50 +02:00
|
|
|
});
|
2013-05-30 11:14:00 +02:00
|
|
|
</script>
|
2016-06-06 10:09:55 +02:00
|
|
|
<?php echo $this->Js->writeBuffer(); // Write cached scripts
|