mirror of https://github.com/MISP/MISP
chg: [UI] Small refactor of the event add/edit views
- added new flag to form elements for the generator: stayInLine:1 - skip linebreak after field - removed edit view - modified add view to work as both add/editpull/5404/head
parent
222dd10977
commit
936a7faca0
|
@ -2423,6 +2423,7 @@ class EventsController extends AppController
|
|||
$this->set('fieldDesc', $fieldDesc);
|
||||
$this->set('eventDescriptions', $this->Event->fieldDescriptions);
|
||||
$this->set('event', $this->Event->data);
|
||||
$this->render('add');
|
||||
}
|
||||
|
||||
public function delete($id = null)
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
}
|
||||
}
|
||||
echo sprintf(
|
||||
'<span id = "%sInfoPopover" class="icon-info-sign" data-toggle="popover" data-trigger="hover" ></span>',
|
||||
'<span id = "%sInfoPopover" class="icon-info-sign" data-toggle="popover" data-trigger="hover" style="margin-left:2px;"></span>',
|
||||
h($field['field'])
|
||||
);
|
||||
?>
|
||||
|
|
|
@ -58,7 +58,9 @@
|
|||
} else {
|
||||
$fieldsString .= $fieldData;
|
||||
}
|
||||
$fieldsString .= '<div class="clear"></div>';
|
||||
if (empty($fieldData['stayInLine'])) {
|
||||
$fieldsString .= '<div class="clear"></div>';
|
||||
}
|
||||
}
|
||||
}
|
||||
$metaFieldString = '';
|
||||
|
|
|
@ -15,13 +15,15 @@
|
|||
array(
|
||||
'field' => 'date',
|
||||
'class' => 'datepicker',
|
||||
'type' => 'text'
|
||||
'type' => 'text',
|
||||
'stayInLine' => 1
|
||||
),
|
||||
array(
|
||||
'field' => 'distribution',
|
||||
'class' => 'input',
|
||||
'options' => $distributionLevels,
|
||||
'default' => $initialDistribution
|
||||
'default' => isset($event['Event']['distribution']) ? $event['Event']['distribution'] : $initialDistribution,
|
||||
'stayInLine' => 1
|
||||
),
|
||||
array(
|
||||
'field' => 'sharing_group_id',
|
||||
|
@ -33,7 +35,8 @@
|
|||
'field' => 'threat_level_id',
|
||||
'class' => 'input',
|
||||
'options' => $threatLevels,
|
||||
'label' => __("Threat Level")
|
||||
'label' => __("Threat Level"),
|
||||
'stayInLine' => 1
|
||||
),
|
||||
array(
|
||||
'field' => 'analysis',
|
||||
|
@ -43,13 +46,13 @@
|
|||
array(
|
||||
'field' => 'info',
|
||||
'label' => __('Event Info'),
|
||||
'class' => 'input-xxlarge',
|
||||
'class' => 'input span6',
|
||||
'type' => 'text',
|
||||
'placeholder' => __('Quick Event Description or Tracking Info')
|
||||
),
|
||||
array(
|
||||
'field' => 'extends_uuid',
|
||||
'class' => 'input-xxlarge',
|
||||
'class' => 'input span6',
|
||||
'placeholder' => __('Event UUID or ID. Leave blank if not applicable.'),
|
||||
'label' => __("Extends Event")
|
||||
)
|
||||
|
@ -59,7 +62,7 @@
|
|||
)
|
||||
)
|
||||
));
|
||||
echo $this->element('/genericElements/SideMenu/side_menu', array('menuList' => 'event-collection', 'menuItem' => 'add'));
|
||||
echo $this->element('/genericElements/SideMenu/side_menu', array('menuList' => 'event-collection', 'menuItem' => $this->action === 'add' ? 'add' : 'editEvent'));
|
||||
?>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
|
|
@ -1,83 +0,0 @@
|
|||
<?php
|
||||
$mayModify = (($isAclModify && $event['Event']['user_id'] == $me['id'] && $event['Event']['orgc_id'] == $me['org_id']) || ($isAclModifyOrg && $event['Event']['orgc_id'] == $me['org_id']));
|
||||
$mayPublish = ($isAclPublish && $event['Event']['orgc_id'] == $me['org_id']);
|
||||
$modelForForm = 'Event';
|
||||
echo $this->element('genericElements/Form/genericForm', array(
|
||||
'form' => $this->Form,
|
||||
'data' => array(
|
||||
'title' => __('Edit Event'),
|
||||
'model' => $modelForForm,
|
||||
'fields' => array(
|
||||
array(
|
||||
'field' => 'event_id',
|
||||
'type' => 'text',
|
||||
'hidden' => true
|
||||
),
|
||||
array(
|
||||
'field' => 'date',
|
||||
'class' => 'datepicker',
|
||||
'type' => 'text'
|
||||
),
|
||||
array(
|
||||
'field' => 'distribution',
|
||||
'class' => 'input',
|
||||
'options' => $distributionLevels,
|
||||
'default' => $event['Event']['distribution']
|
||||
),
|
||||
array(
|
||||
'field' => 'sharing_group_id',
|
||||
'class' => 'input',
|
||||
'options' => $sharingGroups,
|
||||
'default' => $event['Event']['sharing_group_id'],
|
||||
'label' => __("Sharing Group")
|
||||
),
|
||||
array(
|
||||
'field' => 'threat_level_id',
|
||||
'class' => 'input',
|
||||
'options' => $threatLevels,
|
||||
'default' => $event['Event']['threat_level_id'],
|
||||
'label' => __("Threat Level")
|
||||
),
|
||||
array(
|
||||
'field' => 'analysis',
|
||||
'class' => 'input',
|
||||
'options' => $analysisLevels,
|
||||
'default' => $event['Event']['analysis']
|
||||
),
|
||||
array(
|
||||
'field' => 'info',
|
||||
'label' => __('Event Info'),
|
||||
'class' => 'input-xxlarge',
|
||||
'type' => 'text',
|
||||
'placeholder' => __('Quick Event Description or Tracking Info')
|
||||
),
|
||||
array(
|
||||
'field' => 'extends_uuid',
|
||||
'class' => 'input-xxlarge',
|
||||
'placeholder' => __('Event UUID or ID. Leave blank if not applicable.'),
|
||||
'label' => __("Extends Event")
|
||||
)
|
||||
),
|
||||
'submit' => array(
|
||||
'action' => $this->request->params['action']
|
||||
)
|
||||
)
|
||||
));
|
||||
echo $this->element('/genericElements/SideMenu/side_menu', array('menuList' => 'event', 'menuItem' => 'editEvent', 'mayModify' => $mayModify, 'mayPublish' => $mayPublish));
|
||||
?>
|
||||
|
||||
<script type="text/javascript">
|
||||
$('#EventDistribution').change(function() {
|
||||
checkSharingGroup('Event');
|
||||
});
|
||||
|
||||
$("#EventExtendsUuid").keyup(function() {
|
||||
previewEventBasedOnUuids();
|
||||
});
|
||||
|
||||
$(document).ready(function() {
|
||||
checkSharingGroup('Event');
|
||||
previewEventBasedOnUuids();
|
||||
});
|
||||
</script>
|
||||
<?php echo $this->Js->writeBuffer();
|
Loading…
Reference in New Issue