2014-01-06 05:15:47 +01:00
<?php
$mayModify = (($isAclModify && $event['Event']['user_id'] == $me['id'] && $event['Event']['orgc'] == $me['org']) || ($isAclModifyOrg && $event['Event']['orgc'] == $me['org']));
$mayPublish = ($isAclPublish && $event['Event']['orgc'] == $me['org']);
?>
2013-05-28 11:15:21 +02:00
<div class="events form">
<?php echo $this->Form->create('Event');?>
<fieldset>
2013-06-10 23:56:35 +02:00
<legend>Edit Event</legend>
2013-05-28 11:15:21 +02:00
<?php
2013-06-02 12:44:11 +02:00
echo $this->Form->input('id');
echo $this->Form->input('date', array(
'type' => 'text',
'class' => 'datepicker'
));
2014-02-05 15:01:26 +01:00
if ('true' == Configure::read('MISP.sync')) {
2013-06-07 02:44:03 +02:00
echo $this->Form->input('distribution', array(
2013-06-10 20:49:31 +02:00
'options' => array($distributionLevels),
2013-06-07 02:44:03 +02:00
'label' => 'Distribution',
));
2013-05-28 11:15:21 +02:00
}
2013-11-17 17:54:15 +01:00
echo $this->Form->input('threat_level_id', array(
2013-06-02 12:44:11 +02:00
'div' => 'input clear'
));
echo $this->Form->input('analysis', array(
'options' => array($analysisLevels),
));
echo $this->Form->input('info', array(
'div' => 'clear',
'class' => 'input-xxlarge'
));
2013-05-28 11:15:21 +02:00
?>
</fieldset>
2013-06-02 12:44:11 +02:00
<?php
2013-08-02 11:53:17 +02:00
echo $this->Form->button('Submit', array('class' => 'btn btn-primary'));
2013-06-02 12:44:11 +02:00
echo $this->Form->end();
?>
2013-05-28 11:15:21 +02:00
</div>
2013-11-17 17:54:15 +01:00
<?php
2014-01-06 05:15:47 +01:00
echo $this->element('side_menu', array('menuList' => 'event', 'menuItem' => 'editEvent', 'mayModify' => $mayModify, 'mayPublish' => $mayPublish));
2013-10-24 10:33:34 +02:00
?>
2013-05-28 11:15:21 +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-28 11:15:21 +02:00
<?php
2013-06-10 23:56:35 +02:00
foreach ($distributionDescriptions as $type => $def) {
$info = isset($def['formdesc']) ? $def['formdesc'] : $def['desc'];
echo "formInfoValues['EventDistribution']['" . addslashes($type) . "'] = \"" . addslashes($info) . "\";\n"; // as we output JS code we need to add slashes
2013-05-28 11:15:21 +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-28 11:15:21 +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-28 11:15:21 +02:00
}
?>
2013-06-06 16:36:28 +02:00
$(document).ready(function() {
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
}
});
// 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 23:56:35 +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 23:56:35 +02:00
placement: 'right',
content: formInfoValues[e.currentTarget.id][$e.val()],
}).popover('show');
});
});
2013-05-28 11:15:21 +02:00
</script>
2012-10-23 11:28:39 +02:00
<?php echo $this->Js->writeBuffer();