- Form->hidden('event_id');
- echo $this->Form->input('category', array(
- 'empty' => __('(choose one)'),
- 'label' => __('Category ') . $this->element('formInfo', array('type' => 'category')),
- ));
- echo $this->Form->input('type', array(
- 'empty' => __('(first choose category)'),
- 'label' => __('Type ') . $this->element('formInfo', array('type' => 'type')),
- ));
-
- $initialDistribution = 5;
- if (Configure::read('MISP.default_attribute_distribution') != null) {
- if (Configure::read('MISP.default_attribute_distribution') === 'event') {
- $initialDistribution = 5;
- } else {
- $initialDistribution = Configure::read('MISP.default_attribute_distribution');
- }
- }
-
- ?>
-
- array($distributionLevels),
- 'label' => __('Distribution ') . $this->element('formInfo', array('type' => 'distribution')),
- );
-
- if ($action == 'add') {
- $distArray['selected'] = $initialDistribution;
- }
-
- echo $this->Form->input('distribution', $distArray);
- ?>
-
- Form->input('sharing_group_id', array(
- 'options' => array($sharingGroups),
- 'label' => __('Sharing Group'),
- ));
- }
- ?>
-
- Form->input('value', array(
- 'type' => 'textarea',
- 'error' => array('escape' => false),
- 'div' => 'input clear',
- 'class' => 'input-xxlarge'
- ));
- ?>
-
- Form->input('comment', array(
+ $modelForForm = 'Attribute';
+ echo $this->element('genericElements/Form/genericForm', array(
+ 'form' => $this->Form,
+ 'data' => array(
+ 'title' => $action === 'add' ? __('Add Attribute') : __('Edit Attribute'),
+ 'model' => $modelForForm,
+ 'fields' => array(
+ array(
+ 'field' => 'event_id',
+ 'class' => 'org-id-picker-hidden-field',
'type' => 'text',
- 'label' => __('Contextual Comment'),
- 'error' => array('escape' => false),
+ 'hidden' => true
+ ),
+ array(
+ 'field' => 'category',
+ 'class' => 'input',
+ 'empty' => __('(choose one)'),
+ 'options' => $categories,
+ 'stayInLine' => 1
+ ),
+ array(
+ 'field' => 'type',
+ 'class' => 'input',
+ 'empty' => __('(choose category first)'),
+ 'options' => $types
+ ),
+ array(
+ 'field' => 'distribution',
+ 'class' => 'input',
+ 'options' => $distributionLevels,
+ 'default' => isset($attribute['Attribute']['distribution']) ? $attribute['Attribute']['distribution'] : $initialDistribution,
+ 'stayInLine' => 1
+ ),
+ array(
+ 'field' => 'sharing_group_id',
+ 'class' => 'input',
+ 'options' => $sharingGroups,
+ 'label' => __("Sharing Group")
+ ),
+ array(
+ 'field'=> 'value',
+ 'type' => 'textarea',
+ 'class' => 'input span6',
+ 'div' => 'input clear'
+ ),
+ array(
+ 'field' => 'comment',
+ 'type' => 'text',
+ 'class' => 'input span6',
'div' => 'input clear',
- 'class' => 'input-xxlarge'
- ));
- ?>
-
- Form->input('to_ids', array(
- 'label' => __('for Intrusion Detection System'),
- 'type' => 'checkbox'
- ));
- echo $this->Form->input('batch_import', array(
+ 'label' => __("Contextual Comment")
+ ),
+ array(
+ 'field' => 'to_ids',
+ 'type' => 'checkbox',
+ 'label' => __("for Intrusion Detection System"),
+ //'stayInLine' => 1
+ ),
+ array(
+ 'field' => 'batch_import',
'type' => 'checkbox'
- ));
- echo '
';
- echo $this->Form->input('disable_correlation', array(
+ ),
+ array(
+ 'field' => 'disable_correlation',
'type' => 'checkbox'
- ));
- ?>
-
-