2014-01-06 05:15:47 +01:00
<?php
2015-04-20 11:46:55 +02:00
$mayModify = (($isAclModify && $event['Event']['user_id'] == $me['id'] && $event['Event']['orgc_id'] == $me['org_id']) || ($isAclModifyOrg && $event['Event']['orgc_id'] == $me['org_id']));
2015-09-29 02:54:25 +02:00
$mayPublish = ($isAclPublish && $event['Event']['orgc_id'] == $me['org_id']);
2014-01-06 05:15:47 +01:00
?>
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'
));
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',
2015-12-10 10:54:31 +01:00
'default' => $event['Event']['distribution'],
2013-06-07 02:44:03 +02:00
));
2015-07-24 16:02:31 +02:00
?>
<div id="SGContainer" style="display:none;">
<?php
2015-08-03 14:18:02 +02:00
if (!empty($sharingGroups)) {
2015-07-24 16:02:31 +02:00
echo $this->Form->input('sharing_group_id', array(
'options' => array($sharingGroups),
'label' => 'Sharing Group',
2015-12-10 10:54:31 +01:00
'default' => $event['Event']['sharing_group_id'],
2015-07-24 16:02:31 +02:00
));
2015-08-03 14:18:02 +02:00
}
2015-07-24 16:02:31 +02:00
?>
</div>
<?php
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',
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-02 12:44:11 +02:00
));
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();
?>
2014-08-21 13:52:36 +02:00
<div id="confirmation_box" class="confirmation_box"></div>
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() {
2015-08-31 02:32:37 +02:00
if ($('#EventDistribution').val() == 4) $('#SGContainer').show();
else $('#SGContainer').hide();
2015-07-24 16:02:31 +02:00
$('#EventDistribution').change(function() {
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
}
});
// 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();