fix: fixed various minor issues and a potential more serious bug

- various UI issues prevented the freetext/csv feed related fields from being hidden when adding a new MISP feed
- issue that potentially prevented new feeds from being saved if no target event is set (cannot reproduce)
pull/1610/head
Iglocska 2016-10-10 18:23:59 +02:00
parent 1ea37f7fa5
commit 9082e9b090
2 changed files with 18 additions and 7 deletions

View File

@ -62,7 +62,7 @@ class FeedsController extends AppController {
$this->request->data['Feed']['settings'] = array();
}
$this->request->data['Feed']['settings'] = json_encode($this->request->data['Feed']['settings']);
$this->request->data['Feed']['event_id'] = $this->request->data['Feed']['fixed_event'] ? $this->request->data['Feed']['target_event'] : 0;
$this->request->data['Feed']['event_id'] = !empty($this->request->data['Feed']['fixed_event']) ? $this->request->data['Feed']['target_event'] : 0;
if (!$error) {
$result = $this->Feed->save($this->request->data);
if ($result) {

View File

@ -27,7 +27,7 @@
'class' => 'form-control span6'
));
?>
<div id="TargetDiv">
<div id="TargetDiv" class="optionalField">
<?php
echo $this->Form->input('fixed_event', array(
'label' => 'Target Event',
@ -37,7 +37,7 @@
));
?>
</div>
<div id="TargetEventDiv">
<div id="TargetEventDiv" class="optionalField">
<?php
echo $this->Form->input('target_event', array(
'label' => 'Target Event ID',
@ -47,7 +47,18 @@
));
?>
</div>
<div id="PublishDiv" class="input clear">
<div id="settingsCsvValueDiv" class="optionalField">
<?php
echo $this->Form->input('Feed.settings.csv.value', array(
'label' => 'Value field(s) in the CSV',
'title' => 'Select one or several fields that should be parsed by the CSV parser and converted into MISP attributes',
'div' => 'input clear',
'placeholder' => '2,3,4 (column position separated by commas)',
'class' => 'form-control span6'
));
?>
</div>
<div id="PublishDiv" class="input clear optionalField">
<?php
echo $this->Form->input('publish', array(
'label' => 'Auto Publish',
@ -57,7 +68,7 @@
));
?>
</div>
<div id="OverrideIdsDiv" class="input clear">
<div id="OverrideIdsDiv" class="input clear optionalField">
<?php
echo $this->Form->input('override_ids', array(
'label' => 'Override IDS Flag',
@ -67,7 +78,7 @@
));
?>
</div>
<div id="DeltaMergeDiv" class="input clear">
<div id="DeltaMergeDiv" class="input clear optionalField">
<?php
echo $this->Form->input('delta_merge', array(
'label' => 'Delta Merge',
@ -140,7 +151,7 @@ $(document).ready(function() {
feedFormUpdate();
});
$("#FeedSourceFormat, #FeedTarget").change(function() {
$("#FeedSourceFormat, #FeedFixedEvent").change(function() {
feedFormUpdate();
});
</script>