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-05-28 11:15:21 +02:00
if ('true' == Configure::read('CyDefSIG.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-06-02 12:44:11 +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'
));
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-07-04 13:35:04 +02:00
<div class="actions <?php echo $debugMode;?>">
2013-06-02 12:44:11 +02:00
<ul class="nav nav-list">
2013-06-10 17:57:20 +02:00
<li><a href="/events/view/<?php echo $this->request->data['Event']['id'];?>">View Event</a></li>
2013-06-18 12:27:59 +02:00
<li><a href="/logs/event_index/<?php echo $this->request->data['Event']['id'];?>">View Event History</a></li>
2013-06-10 17:57:20 +02:00
<li class="active"><a href="/events/edit/<?php echo $this->request->data['Event']['id'];?>">Edit Event</a></li>
2013-06-03 10:48:38 +02:00
<li><?php echo $this->Form->postLink('Delete Event', array('action' => 'delete', $this->request->data['Event']['id']), null, __('Are you sure you want to delete # %s?', $this->request->data['Event']['id'])); ?></li>
2013-06-02 12:44:11 +02:00
<li class="divider"></li>
2013-06-10 17:57:20 +02:00
<li><a href="/events/index">List Events</a></li>
2013-06-03 10:48:38 +02:00
<?php if ($isAclAdd): ?>
2013-06-10 17:57:20 +02:00
<li><a href="/events/add">Add Event</a></li>
2013-06-03 10:48:38 +02:00
<?php endif; ?>
2013-05-28 11:15:21 +02:00
</ul>
</div>
<script type="text/javascript">
//
//Generate tooltip information
//
2013-06-10 23:56:35 +02:00
var formInfoValues = {
'EventDistribution' : new Array(),
'EventRisk' : new Array(),
'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) {
$info = isset($def['formdesc']) ? $def['formdesc'] : $def['desc'];
2013-06-10 23:56:35 +02:00
echo "formInfoValues['EventRisk']['" . addslashes($type) . "'] = \"" . addslashes($info) . "\";\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() {
$("#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({
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.
$("#EventAnalysis, #EventRisk, #EventDistribution").on('change', function(e) {
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();