2013-05-30 11:14:00 +02:00
<div class="events form">
2013-06-04 17:41:27 +02:00
<?php echo $this->Form->create('', array('type' => 'file'));?>
2013-05-30 11:14:00 +02:00
<fieldset>
2013-06-01 11:05:15 +02:00
<legend>Add Event</legend>
<?php
echo $this->Form->input('date', array(
'type' => 'text',
'class' => 'datepicker'
2013-05-30 11:14:00 +02:00
));
2013-08-06 11:53:12 +02:00
$initialDistribution = 3;
if (Configure::read('MISP.default_event_distribution') != null) {
$initialDistribution = Configure::read('MISP.default_event_distribution');
}
2014-09-10 09:43:22 +02:00
echo $this->Form->input('distribution', array(
'options' => array($distributionLevels),
2015-04-09 17:27:34 +02:00
'div' => 'input clear',
2014-09-10 09:43:22 +02:00
'label' => 'Distribution',
'selected' => $initialDistribution,
));
2015-04-09 17:27:34 +02:00
?>
<div id="SGContainer" style="display:none;">
<?php
2015-08-03 14:18:02 +02:00
if (!empty($sharingGroups)) {
echo $this->Form->input('sharing_group_id', array(
'options' => array($sharingGroups),
'label' => 'Sharing Group',
));
}
2015-04-09 17:27:34 +02:00
?>
</div>
<?php
2013-11-17 17:54:15 +01:00
echo $this->Form->input('threat_level_id', array(
2016-02-04 14:19:41 +01:00
'div' => 'input clear',
'selected' => Configure::read('MISP.default_event_threat_level') ? Configure::read('MISP.default_event_threat_level') : '1',
2013-06-01 11:05:15 +02:00
));
echo $this->Form->input('analysis', array(
'options' => array($analysisLevels),
));
echo $this->Form->input('info', array(
2014-03-06 17:21:57 +01:00
'label' => 'Event Description',
'div' => 'clear',
'type' => 'text',
'class' => 'form-control span6',
'placeholder' => 'Quick Event Description or Tracking Info'
2013-06-01 11:05:15 +02:00
));
echo $this->Form->input('Event.submittedgfi', array(
'label' => '<b>GFI sandbox</b>',
'type' => 'file',
'div' => 'clear'
));
?>
2013-05-30 11:14:00 +02:00
</fieldset>
2013-06-01 11:05:15 +02:00
<?php
echo $this->Form->button('Add', array('class' => 'btn btn-primary'));
echo $this->Form->end();
?>
</div>
2013-11-17 17:54:15 +01:00
<?php
2013-10-24 10:33:34 +02:00
echo $this->element('side_menu', array('menuList' => 'event-collection', 'menuItem' => 'add'));
?>
2013-05-30 11:14:00 +02:00
<script type="text/javascript">
//
//Generate tooltip information
//
2013-06-10 23:56:35 +02:00
var formInfoValues = {
'EventDistribution' : new Array(),
2013-11-17 17:54:15 +01:00
'EventThreatLevelId' : new Array(),
2013-06-10 23:56:35 +02:00
'EventAnalysis' : new Array()
};
2013-05-30 11:14:00 +02:00
<?php
foreach ($distributionDescriptions as $type => $def) {
$info = isset($def['formdesc']) ? $def['formdesc'] : $def['desc'];
2013-06-10 23:56:35 +02:00
echo "formInfoValues['EventDistribution']['" . addslashes($type) . "'] = \"" . addslashes($info) . "\";\n"; // as we output JS code we need to add slashes
2013-05-30 11:14:00 +02:00
}
foreach ($riskDescriptions as $type => $def) {
2013-11-17 17:54:15 +01:00
echo "formInfoValues['EventThreatLevelId']['" . addslashes($type) . "'] = \"" . addslashes($def) . "\";\n"; // as we output JS code we need to add slashes
2013-05-30 11:14:00 +02:00
}
foreach ($analysisDescriptions as $type => $def) {
$info = isset($def['formdesc']) ? $def['formdesc'] : $def['desc'];
2013-06-10 23:56:35 +02:00
echo "formInfoValues['EventAnalysis']['" . addslashes($type) . "'] = \"" . addslashes($info) . "\";\n"; // as we output JS code we need to add slashes
2013-05-30 11:14:00 +02:00
}
?>
2015-04-09 17:27:34 +02:00
$('#EventDistribution').change(function() {
if ($('#EventDistribution').val() == 4) $('#SGContainer').show();
else $('#SGContainer').hide();
});
2013-06-06 16:36:28 +02:00
$(document).ready(function() {
2015-08-31 02:32:37 +02:00
if ($('#EventDistribution').val() == 4) $('#SGContainer').show();
else $('#SGContainer').hide();
2013-11-17 17:54:15 +01:00
$("#EventAnalysis, #EventThreatLevelId, #EventDistribution").on('mouseover', function(e) {
2013-06-06 16:36:28 +02:00
var $e = $(e.target);
if ($e.is('option')) {
$('#'+e.currentTarget.id).popover('destroy');
$('#'+e.currentTarget.id).popover({
2013-10-15 10:28:43 +02:00
trigger: 'focus',
2013-06-06 16:36:28 +02:00
placement: 'right',
2013-06-10 23:56:35 +02:00
content: formInfoValues[e.currentTarget.id][$e.val()],
2013-06-06 16:36:28 +02:00
}).popover('show');
2013-06-10 23:56:35 +02:00
}
2013-06-06 16:36:28 +02:00
});
2013-06-10 10:41:29 +02:00
// workaround for browsers like IE and Chrome that do now have an onmouseover on the 'options' of a select.
// disadvangate is that user needs to click on the item to see the tooltip.
// no solutions exist, except to generate the select completely using html.
2013-11-17 17:54:15 +01:00
$("#EventAnalysis, #EventThreatLevelId, #EventDistribution").on('change', function(e) {
2013-06-10 10:41:29 +02:00
var $e = $(e.target);
$('#'+e.currentTarget.id).popover('destroy');
$('#'+e.currentTarget.id).popover({
2013-10-15 10:28:43 +02:00
trigger: 'focus',
2013-06-10 10:41:29 +02:00
placement: 'right',
2013-06-10 23:56:35 +02:00
content: formInfoValues[e.currentTarget.id][$e.val()],
2013-06-10 10:41:29 +02:00
}).popover('show');
});
2013-06-06 16:36:28 +02:00
});
2013-05-30 11:14:00 +02:00
</script>
<?php echo $this->Js->writeBuffer();