MISP/app/View/Events/add.ctp

111 lines
3.6 KiB
Plaintext
Raw Normal View History

<div class="events form">
<?php echo $this->Form->create('', array('type' => 'file'));?>
<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-06-01 11:05:15 +02:00
if ('true' == Configure::read('CyDefSIG.sync')) {
echo $this->Form->input('distribution', array(
2013-06-10 20:34:05 +02:00
'options' => array($distributionLevels),
2013-06-01 11:05:15 +02:00
'label' => 'Distribution',
'selected' => '3'
2013-06-01 11:05:15 +02:00
));
}
echo $this->Form->input('risk', array(
'div' => 'input clear'
));
echo $this->Form->input('analysis', array(
'options' => array($analysisLevels),
));
echo $this->Form->input('info', array(
'div' => 'clear',
'class' => 'input-xxlarge'
));
echo $this->Form->input('Event.submittedgfi', array(
'label' => '<b>GFI sandbox</b>',
'type' => 'file',
'div' => 'clear'
));
?>
</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>
<div class="actions">
<ul class="nav nav-list">
2013-06-10 17:57:20 +02:00
<li><a href="/events/index">List Events</a></li>
2013-06-01 11:05:15 +02:00
<?php if ($isAclAdd): ?>
2013-06-10 17:57:20 +02:00
<li class="active"><a href="/events/add">Add Event</a></li>
2013-06-01 11:05:15 +02:00
<?php endif; ?>
<li class="divider"></li>
2013-06-10 17:57:20 +02:00
<li><a href="/attributes/index">List Attributes</a></li>
<li><a href="/attributes/search">Search Attributes</a></li>
2013-06-01 11:05:15 +02:00
<li class="divider"></li>
2013-06-10 17:57:20 +02:00
<li><a href="/events/export">Export</a></li>
2013-06-01 11:05:15 +02:00
<?php if ($isAclAuth): ?>
2013-06-10 17:57:20 +02:00
<li><a href="/events/automation">Automation</a></li>
2013-06-01 11:05:15 +02:00
<?php endif;?>
</ul>
</div>
<script type="text/javascript">
//
//Generate tooltip information
//
var formInfoValues = new Array();
<?php
foreach ($distributionDescriptions as $type => $def) {
$info = isset($def['formdesc']) ? $def['formdesc'] : $def['desc'];
echo "formInfoValues['" . addslashes($type) . "'] = \"" . addslashes($info) . "\";\n"; // as we output JS code we need to add slashes
}
foreach ($riskDescriptions as $type => $def) {
$info = isset($def['formdesc']) ? $def['formdesc'] : $def['desc'];
echo "formInfoValues['" . addslashes($type) . "'] = \"" . addslashes($info) . "\";\n"; // as we output JS code we need to add slashes
}
foreach ($analysisDescriptions as $type => $def) {
$info = isset($def['formdesc']) ? $def['formdesc'] : $def['desc'];
echo "formInfoValues['" . addslashes($type) . "'] = \"" . addslashes($info) . "\";\n"; // as we output JS code we need to add slashes
}
?>
2013-06-06 16:36:28 +02:00
$(document).ready(function() {
$("#EventAnalysis, #EventRisk, #EventDistribution").on('mouseleave', function(e) {
$('#'+e.currentTarget.id).popover('destroy');
});
$("#EventAnalysis, #EventRisk, #EventDistribution").on('mouseover', function(e) {
var $e = $(e.target);
if ($e.is('option')) {
$('#'+e.currentTarget.id).popover('destroy');
$('#'+e.currentTarget.id).popover({
trigger: 'manual',
placement: 'right',
content: formInfoValues[$e.val()],
}).popover('show');
}
2013-06-06 16:36:28 +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.
$("#EventAnalysis, #EventRisk, #EventDistribution").on('change', function(e) {
var $e = $(e.target);
$('#'+e.currentTarget.id).popover('destroy');
$('#'+e.currentTarget.id).popover({
trigger: 'manual',
placement: 'right',
content: formInfoValues[$e.val()],
}).popover('show');
});
2013-06-06 16:36:28 +02:00
});
</script>
<?php echo $this->Js->writeBuffer();