fix: add type dropdown in all generic forms.

pull/7520/head
Luciano Righetti 2021-06-24 16:01:56 +02:00
parent c947b5556c
commit 1bc44f5b0d
16 changed files with 56 additions and 30 deletions

View File

@ -17,26 +17,30 @@
'class' => 'input',
'empty' => __('(choose one)'),
'options' => $categories,
'stayInLine' => 1
'stayInLine' => 1,
'type' => 'dropdown'
),
array(
'field' => 'type',
'class' => 'input',
'empty' => __('(choose category first)'),
'options' => $types
'options' => $types,
'type' => 'dropdown'
),
array(
'field' => 'distribution',
'class' => 'input',
'options' => $distributionLevels,
'default' => isset($attribute['Attribute']['distribution']) ? $attribute['Attribute']['distribution'] : $initialDistribution,
'stayInLine' => 1
'stayInLine' => 1,
'type' => 'dropdown'
),
array(
'field' => 'sharing_group_id',
'class' => 'input',
'options' => $sharingGroups,
'label' => __("Sharing Group")
'label' => __("Sharing Group"),
'type' => 'dropdown'
),
array(
'field'=> 'value',

View File

@ -17,10 +17,10 @@ $fields = [
[
'field' => 'org_id',
'label' => 'Owner Organisation',
'type' => 'select',
'options' => $dropdownData['org_id'],
'class' => 'span6',
'searchable' => 1
'searchable' => 1,
'type' => 'dropdown'
],
[
'field' => 'description',

View File

@ -20,7 +20,8 @@
array(
'field' => 'widget',
'class' => 'input span6',
'options' => Hash::combine($data['widget_options'], '{s}.widget', '{s}.title')
'options' => Hash::combine($data['widget_options'], '{s}.widget', '{s}.title'),
'type' => 'dropdown'
),
array(
'field' => 'width',

View File

@ -26,7 +26,8 @@
'class' => 'input span6',
'div' => 'input clear',
'label' => __('Restrict to organisation'),
'requirements' => $isSiteAdmin
'requirements' => $isSiteAdmin,
'type' => 'dropdown'
),
array(
'field' => 'restrict_to_role_id',
@ -34,7 +35,8 @@
'class' => 'input span6',
'div' => 'input clear',
'label' => __('Restrict to role'),
'requirements' => $isSiteAdmin
'requirements' => $isSiteAdmin,
'type' => 'dropdown'
),
array(
'field' => 'restrict_to_permission_flag',
@ -42,7 +44,8 @@
'class' => 'input span6',
'div' => 'input clear',
'label' => __('Restrict to role permission flag'),
'requirements' => $isSiteAdmin
'requirements' => $isSiteAdmin,
'type' => 'dropdown'
),
array(
'field' => 'selectable',

View File

@ -48,7 +48,8 @@ if (!empty($data['fields'])) {
[
'fieldData' => $fieldData,
'form' => $this->Form,
'simpleFieldWhitelist' => $simpleFieldAllowedlist
'simpleFieldWhitelist' => $simpleFieldAllowedlist,
'modelForForm' => $modelForForm
]
);

View File

@ -16,13 +16,15 @@
'class' => 'input',
'options' => $distributionLevels,
'default' => isset($attribute['Attribute']['distribution']) ? $attribute['Attribute']['distribution'] : $initialDistribution,
'stayInLine' => 1
'stayInLine' => 1,
'type' => 'dropdown'
),
array(
'field' => 'sharing_group_id',
'class' => 'input',
'options' => $sharingGroups,
'label' => __("Sharing Group")
'label' => __("Sharing Group"),
'type' => 'dropdown'
),
array(
'field' => 'content',

View File

@ -24,25 +24,30 @@
'class' => 'input',
'options' => $distributionLevels,
'default' => isset($event['Event']['distribution']) ? $event['Event']['distribution'] : $initialDistribution,
'stayInLine' => 1
'stayInLine' => 1,
'type' => 'dropdown'
),
array(
'field' => 'sharing_group_id',
'class' => 'input',
'options' => $sharingGroups,
'label' => __("Sharing Group")
'label' => __("Sharing Group"),
'type' => 'dropdown'
),
array(
'field' => 'threat_level_id',
'class' => 'input',
'options' => $threatLevels,
'label' => __("Threat Level"),
'stayInLine' => 1
'stayInLine' => 1,
'type' => 'dropdown'
),
array(
'field' => 'analysis',
'class' => 'input',
'options' => $analysisLevels
'options' => $analysisLevels,
'stayInLine' => 1,
'type' => 'dropdown'
),
array(
'field' => 'info',

View File

@ -1,11 +1,9 @@
<?php
$modelForForm = 'Feeds';
$edit = $this->request->params['action'] === 'edit' ? true : false;
echo $this->element('genericElements/Form/genericForm', [
'data' => [
'title' => $edit ? __('Edit MISP feed') : __('Add MISP feed'),
'description' => __('Add a new MISP feed source.'),
'model' => 'Feed',
'fields' => [
[
'field' => 'enabled',

View File

@ -10,7 +10,8 @@ echo $this->element('genericElements/Form/genericForm', array(
'label' => '<strong>' . __("Clusters' distribution:") . '</strong>',
'options' => $distributionLevels,
'selected' => array(1, 2, 3),
'multiple' => 'checkbox',
'multiple' => 'checkbox',
'type' => 'dropdown'
),
'<br />',
array(

View File

@ -29,12 +29,14 @@
'field' => 'distribution',
'options' => $distributionLevels,
'default' => isset($cluster['GalaxyCluster']['distribution']) ? $cluster['GalaxyCluster']['distribution'] : $initialDistribution,
'stayInLine' => 1
'stayInLine' => 1,
'type' => 'dropdown'
),
array(
'field' => 'sharing_group_id',
'options' => $sharingGroups,
'label' => __("Sharing Group")
'label' => __("Sharing Group"),
'type' => 'dropdown'
),
array(
'field' => 'referenced_galaxy_cluster_type',

View File

@ -32,12 +32,14 @@
'field' => 'distribution',
'options' => $distributionLevels,
'default' => isset($cluster['GalaxyCluster']['distribution']) ? $cluster['GalaxyCluster']['distribution'] : $initialDistribution,
'stayInLine' => 1
'stayInLine' => 1,
'type' => 'dropdown'
),
array(
'field' => 'sharing_group_id',
'options' => $sharingGroups,
'label' => __("Sharing Group")
'label' => __("Sharing Group"),
'type' => 'dropdown'
),
!isset($forkedClusterMeta) ? '' : sprintf('<div id="fork_galaxy_preview" class="panel-container fork-cluster-preview"><h5>%s %s</h5>%s</div>',
__('Forked Cluster data'),

View File

@ -57,6 +57,7 @@ echo $this->element('genericElements/Form/genericForm', [
'options' => $countries,
'class' => 'span4',
'stayInLine' => 1,
'type' => 'dropdown'
],
[
'field' => 'sector',

View File

@ -14,7 +14,7 @@ $fields = [
[
'field' => 'permission',
'label' => __('Permissions'),
'type' => 'select',
'type' => 'dropdown',
'options' => $dropdownData['options'],
'value' => '3',
'class' => 'span3'

View File

@ -16,13 +16,15 @@ echo $this->element('genericElements/Form/genericForm', array(
'class' => 'input',
'empty' => __('(choose one)'),
'options' => $categories,
'stayInLine' => 1
'stayInLine' => 1,
'type' => 'dropdown'
),
array(
'field' => 'type',
'class' => 'input',
'empty' => __('(choose category first)'),
'options' => $types
'options' => $types,
'type' => 'dropdown'
),
array(
'field'=> 'value',

View File

@ -65,14 +65,16 @@
'class' => 'input-xxlarge',
'required' => 1,
'options' => $orgs,
'default' => empty($suggestedOrg[0]) ? false : $suggestedOrg[0]
'default' => empty($suggestedOrg[0]) ? false : $suggestedOrg[0],
'type' => 'dropdown'
),
array(
'field' => 'role_id',
'label' => __('Role'),
'class' => 'input-xxlarge',
'required' => 1,
'options' => $roles
'options' => $roles,
'type' => 'dropdown'
)
),
'submit' => array(

View File

@ -19,16 +19,18 @@ echo $this->element('genericElements/Form/genericForm', array(
'field' => 'type',
'class' => 'input',
'options' => $possibleTypes,
'type' => 'dropdown'
),
array(
'field' => 'category',
'class' => 'input',
'options' => $possibleCategories,
'type' => 'dropdown'
),
array(
'label' => __('Accepted attribute types'),
'field' => 'matching_attributes',
'type' => 'select',
'type' => 'dropdown',
'multiple' => 'multiple',
),
array(