mirror of https://github.com/MISP/MISP
Explanation messages implemenented for forms and for list views (using
"title" html element)pull/61/head
parent
c426537c73
commit
51dbbcfa13
|
@ -54,7 +54,13 @@ class AttributesController extends AppController {
|
|||
*/
|
||||
public function index() {
|
||||
$this->Attribute->recursive = 0;
|
||||
$this->set('attr_descriptions', $this->Attribute->field_descriptions);
|
||||
$this->set('attributes', $this->paginate());
|
||||
|
||||
$this->set('attr_descriptions', $this->Attribute->field_descriptions);
|
||||
$this->set('type_definitions', $this->Attribute->type_definitions);
|
||||
$this->set('category_definitions', $this->Attribute->category_definitions);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -145,6 +151,10 @@ class AttributesController extends AppController {
|
|||
$categories = $this->Attribute->validate['category']['rule'][1];
|
||||
$categories = $this->_arrayToValuesIndexArray($categories);
|
||||
$this->set('categories',compact('categories'));
|
||||
|
||||
$this->set('attr_descriptions', $this->Attribute->field_descriptions);
|
||||
$this->set('type_definitions', $this->Attribute->type_definitions);
|
||||
$this->set('category_definitions', $this->Attribute->category_definitions);
|
||||
}
|
||||
|
||||
|
||||
|
@ -282,6 +292,11 @@ class AttributesController extends AppController {
|
|||
$categories = $this->Attribute->validate['category']['rule'][1];
|
||||
$categories = $this->_arrayToValuesIndexArray($categories);
|
||||
$this->set('categories',compact('categories'));
|
||||
|
||||
$this->set('attr_descriptions', $this->Attribute->field_descriptions);
|
||||
$this->set('type_definitions', $this->Attribute->type_definitions);
|
||||
$this->set('category_definitions', $this->Attribute->category_definitions);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -336,6 +351,10 @@ class AttributesController extends AppController {
|
|||
$categories = $this->Attribute->validate['category']['rule'][1];
|
||||
$categories = $this->_arrayToValuesIndexArray($categories);
|
||||
$this->set('categories',compact('categories'));
|
||||
|
||||
$this->set('attr_descriptions', $this->Attribute->field_descriptions);
|
||||
$this->set('type_definitions', $this->Attribute->type_definitions);
|
||||
$this->set('category_definitions', $this->Attribute->category_definitions);
|
||||
}
|
||||
|
||||
|
||||
|
@ -407,6 +426,9 @@ class AttributesController extends AppController {
|
|||
$categories = array_merge($categories, $this->Attribute->validate['category']['rule'][1]);
|
||||
$categories = $this->_arrayToValuesIndexArray($categories);
|
||||
$this->set('categories',compact('categories'));
|
||||
|
||||
$this->set('type_definitions', $this->Attribute->type_definitions);
|
||||
$this->set('category_definitions', $this->Attribute->category_definitions);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -13,6 +13,17 @@ class Event extends AppModel {
|
|||
* @var string
|
||||
*/
|
||||
public $displayField = 'id';
|
||||
/**
|
||||
* Description field
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
|
||||
public $field_descriptions = array(
|
||||
'risk' => array('desc' => 'Risk levels: *low* means mass-malware, *medium* means APT malware, *high* means sophisticated APT malware or 0-day attack', 'formdesc' => 'Risk levels:<br/>low: mass-malware<br/>medium: APT malware<br/>high: sophisticated APT malware or 0-day attack'),
|
||||
'private' => array('desc' => 'This field tells if the event should be shared with other CyDefSIG servers')
|
||||
);
|
||||
|
||||
/**
|
||||
* Validation rules
|
||||
*
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<legend><?php echo __('Add Attachment'); ?></legend>
|
||||
<?php
|
||||
echo $this->Form->hidden('event_id');
|
||||
echo $this->Form->input('category');
|
||||
echo $this->Form->input('category', array('between' => $this->Html->div('forminfo', '', array('id'=> 'AttributeCategoryDiv'))));
|
||||
echo $this->Form->file('value', array(
|
||||
'error' => array('escape' => false),
|
||||
));
|
||||
|
@ -15,8 +15,11 @@
|
|||
));
|
||||
if ('true' == Configure::read('CyDefSIG.sync')) {
|
||||
echo $this->Form->input('private', array(
|
||||
'before' => $this->Html->div('forminfo', 'Prevent upload of this <em>complete Event</em> to other CyDefSIG servers.<br/>Otherwise you can still prevent specific Attributes to be uploaded.'),));
|
||||
'before' => $this->Html->div('forminfo', isset($attr_descriptions['private']['formdesc']) ? $attr_descriptions['private']['formdesc'] : $attr_descriptions['private']['desc']),));
|
||||
}
|
||||
// link an onchange event to the form elements
|
||||
$this->Js->get('#AttributeType')->event('change', 'showFormInfo("#AttributeType")');
|
||||
$this->Js->get('#AttributeCategory')->event('change', 'showFormInfo("#AttributeCategory")');
|
||||
?>
|
||||
</fieldset>
|
||||
<?php echo $this->Form->end(__('Upload'));?>
|
||||
|
@ -26,3 +29,31 @@
|
|||
<?php echo $this->element('actions_menu'); ?>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
var formInfoValues = new Array();
|
||||
<?php
|
||||
foreach ($category_definitions as $category => $def) {
|
||||
$info = isset($def['formdesc']) ? $def['formdesc'] : $def['desc'];
|
||||
echo "formInfoValues['$category'] = \"$info\";\n";
|
||||
}
|
||||
?>
|
||||
|
||||
function showFormInfo(id) {
|
||||
idDiv = id+'Div';
|
||||
// LATER use nice animations
|
||||
//$(idDiv).hide('fast');
|
||||
// change the content
|
||||
var value = $(id).val(); // get the selected value
|
||||
$(idDiv).html(formInfoValues[value]); // search in a lookup table
|
||||
|
||||
// show it again
|
||||
$(idDiv).fadeIn('slow');
|
||||
}
|
||||
|
||||
// hide the formInfo things
|
||||
$('#AttributeTypeDiv').hide();
|
||||
$('#AttributeCategoryDiv').hide();
|
||||
|
||||
</script>
|
||||
<?php echo $this->Js->writeBuffer(); // Write cached scripts ?>
|
||||
|
|
|
@ -4,20 +4,20 @@
|
|||
<legend><?php echo __('Edit Attribute'); ?></legend>
|
||||
<?php
|
||||
echo $this->Form->input('id');
|
||||
echo $this->Form->input('category');
|
||||
echo $this->Form->input('category', array('between' => $this->Html->div('forminfo', '', array('id'=> 'AttributeCategoryDiv'))));
|
||||
if($attachment) {
|
||||
echo $this->Form->hidden('type');
|
||||
echo $this->Form->hidden('type', array('between' => $this->Html->div('forminfo', '', array('id'=> 'AttributeTypeDiv'))));
|
||||
echo "<BR>Type: ".$this->Form->value('Attribute.type');
|
||||
} else {
|
||||
echo $this->Form->input('type');
|
||||
echo $this->Form->input('type', array('between' => $this->Html->div('forminfo', '', array('id'=> 'AttributeTypeDiv'))));
|
||||
}
|
||||
if ('true' == Configure::read('CyDefSIG.sync')) {
|
||||
echo $this->Form->input('private', array(
|
||||
'before' => $this->Html->div('forminfo', 'Prevent upload of this <em>single Attribute</em> to other CyDefSIG servers.<br/>Only use when the Event is NOT set as Private.'),
|
||||
'before' => $this->Html->div('forminfo', isset($attr_descriptions['private']['formdesc']) ? $attr_descriptions['private']['formdesc'] : $attr_descriptions['private']['desc']),
|
||||
));
|
||||
}
|
||||
echo $this->Form->input('to_ids', array(
|
||||
'before' => $this->Html->div('forminfo', 'Can we make an IDS signature based on this attribute ?'),
|
||||
'before' => $this->Html->div('forminfo', isset($attr_descriptions['signature']['formdesc']) ? $attr_descriptions['private']['formdesc'] : $attr_descriptions['private']['desc']),
|
||||
'label' => 'IDS Signature?'
|
||||
));
|
||||
if($attachment) {
|
||||
|
@ -29,7 +29,9 @@
|
|||
'error' => array('escape' => false),
|
||||
));
|
||||
}
|
||||
?>
|
||||
$this->Js->get('#AttributeType')->event('change', 'showFormInfo("#AttributeType")');
|
||||
$this->Js->get('#AttributeCategory')->event('change', 'showFormInfo("#AttributeCategory")');
|
||||
?>
|
||||
</fieldset>
|
||||
<?php echo $this->Form->end(__('Submit'));?>
|
||||
</div>
|
||||
|
@ -41,3 +43,38 @@
|
|||
</ul>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
|
||||
|
||||
var formInfoValues = new Array();
|
||||
<?php
|
||||
foreach ($type_definitions as $type => $def) {
|
||||
$info = isset($def['formdesc']) ? $def['formdesc'] : $def['desc'];
|
||||
echo "formInfoValues['$type'] = \"$info\";\n";
|
||||
}
|
||||
|
||||
foreach ($category_definitions as $category => $def) {
|
||||
$info = isset($def['formdesc']) ? $def['formdesc'] : $def['desc'];
|
||||
echo "formInfoValues['$category'] = \"$info\";\n";
|
||||
}
|
||||
?>
|
||||
|
||||
function showFormInfo(id) {
|
||||
idDiv = id+'Div';
|
||||
// LATER use nice animations
|
||||
//$(idDiv).hide('fast');
|
||||
// change the content
|
||||
var value = $(id).val(); // get the selected value
|
||||
$(idDiv).html(formInfoValues[value]); // search in a lookup table
|
||||
|
||||
// show it again
|
||||
$(idDiv).fadeIn('slow');
|
||||
}
|
||||
|
||||
// hide the formInfo things
|
||||
$('#AttributeTypeDiv').hide();
|
||||
$('#AttributeCategoryDiv').hide();
|
||||
|
||||
</script>
|
||||
<?php echo $this->Js->writeBuffer(); // Write cached scripts ?>
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
<th><?php echo $this->Paginator->sort('category');?></th>
|
||||
<th><?php echo $this->Paginator->sort('type');?></th>
|
||||
<th><?php echo $this->Paginator->sort('value');?></th>
|
||||
<th>IDS Signature</th>
|
||||
<th<?php echo ' title="' . $attr_descriptions['signature']['desc'] . '"';?>><?php echo $this->Paginator->sort('signature');?></th>
|
||||
<th class="actions"><?php echo __('Actions');?></th>
|
||||
</tr>
|
||||
<?php
|
||||
|
@ -15,9 +15,9 @@
|
|||
<td class="short" onclick="document.location ='<?php echo $this->Html->url(array('controller' => 'events', 'action' => 'view', $attribute['Attribute']['event_id']), true) ;?>';">
|
||||
<?php echo $this->Html->link($attribute['Event']['id'], array('controller' => 'events', 'action' => 'view', $attribute['Event']['id'])); ?>
|
||||
</td>
|
||||
<td class="short" onclick="document.location ='<?php echo $this->Html->url(array('controller' => 'events', 'action' => 'view', $attribute['Attribute']['event_id']), true) ;?>';">
|
||||
<td title="<?php echo $category_definitions[$attribute['Attribute']['category']]['desc'];?>" class="short" onclick="document.location ='<?php echo $this->Html->url(array('controller' => 'events', 'action' => 'view', $attribute['Attribute']['event_id']), true) ;?>';">
|
||||
<?php echo h($attribute['Attribute']['category']); ?> </td>
|
||||
<td class="short" onclick="document.location ='<?php echo $this->Html->url(array('controller' => 'events', 'action' => 'view', $attribute['Attribute']['event_id']), true) ;?>';">
|
||||
<td title="<?php echo $type_definitions[$attribute['Attribute']['type']]['desc'];?>" class="short" onclick="document.location ='<?php echo $this->Html->url(array('controller' => 'events', 'action' => 'view', $attribute['Attribute']['event_id']), true) ;?>';">
|
||||
<?php echo h($attribute['Attribute']['type']); ?> </td>
|
||||
<td onclick="document.location ='<?php echo $this->Html->url(array('controller' => 'events', 'action' => 'view', $attribute['Attribute']['event_id']), true) ;?>';">
|
||||
<?php
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
<legend><?php echo __('Search Attribute'); ?></legend>
|
||||
<?php
|
||||
echo $this->Form->input('keyword');
|
||||
echo $this->Form->input('type');
|
||||
echo $this->Form->input('category');
|
||||
echo $this->Form->input('type', array('between' => $this->Html->div('forminfo', '', array('id'=> 'AttributeTypeDiv'))));
|
||||
echo $this->Form->input('category', array('between' => $this->Html->div('forminfo', '', array('id'=> 'AttributeCategoryDiv'))));
|
||||
?>
|
||||
</fieldset>
|
||||
<?php echo $this->Form->end(__('Search', true));?>
|
||||
|
@ -14,4 +14,41 @@
|
|||
<ul>
|
||||
<?php echo $this->element('actions_menu'); ?>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
|
||||
var formInfoValues = new Array();
|
||||
<?php
|
||||
foreach ($type_definitions as $type => $def) {
|
||||
$info = isset($def['formdesc']) ? $def['formdesc'] : $def['desc'];
|
||||
echo "formInfoValues['$type'] = \"$info\";\n";
|
||||
}
|
||||
|
||||
foreach ($category_definitions as $category => $def) {
|
||||
$info = isset($def['formdesc']) ? $def['formdesc'] : $def['desc'];
|
||||
echo "formInfoValues['$category'] = \"$info\";\n";
|
||||
}
|
||||
$this->Js->get('#AttributeType')->event('change', 'showFormInfo("#AttributeType")');
|
||||
$this->Js->get('#AttributeCategory')->event('change', 'showFormInfo("#AttributeCategory")');
|
||||
?>
|
||||
|
||||
formInfoValues['ALL'] = '';
|
||||
|
||||
function showFormInfo(id) {
|
||||
idDiv = id+'Div';
|
||||
// LATER use nice animations
|
||||
//$(idDiv).hide('fast');
|
||||
// change the content
|
||||
var value = $(id).val(); // get the selected value
|
||||
$(idDiv).html(formInfoValues[value]); // search in a lookup table
|
||||
|
||||
// show it again
|
||||
$(idDiv).fadeIn('slow');
|
||||
}
|
||||
|
||||
// hide the formInfo things
|
||||
$('#AttributeTypeDiv').hide();
|
||||
$('#AttributeCategoryDiv').hide();
|
||||
|
||||
</script>
|
||||
<?php echo $this->Js->writeBuffer(); // Write cached scripts ?>
|
||||
|
|
|
@ -5,10 +5,11 @@
|
|||
<?php
|
||||
echo $this->Form->input('id');
|
||||
echo $this->Form->input('date');
|
||||
echo $this->Form->input('risk');
|
||||
echo $this->Form->input('risk', array(
|
||||
'before' => $this->Html->div('forminfo', isset($event_descriptions['risk']['formdesc']) ? $event_descriptions['risk']['formdesc'] : $event_descriptions['risk']['desc'])));
|
||||
if ('true' == Configure::read('CyDefSIG.sync')) {
|
||||
echo $this->Form->input('private', array(
|
||||
'before' => $this->Html->div('forminfo', 'Prevent upload of this <em>complete Event</em> to other CyDefSIG servers.<br/>Otherwise you can still prevent specific Attributes to be uploaded.'),));
|
||||
'before' => $this->Html->div('forminfo', isset($event_descriptions['private']['formdesc']) ? $event_descriptions['private']['formdesc'] : $event_descriptions['private']['desc']),));
|
||||
}
|
||||
echo $this->Form->input('info');
|
||||
?>
|
||||
|
|
|
@ -7,10 +7,10 @@
|
|||
<th><?php echo $this->Paginator->sort('org');?></th>
|
||||
<?php endif; ?>
|
||||
<th><?php echo $this->Paginator->sort('date');?></th>
|
||||
<th><?php echo $this->Paginator->sort('risk');?></th>
|
||||
<th<?php echo ' title="' . $event_descriptions['risk']['desc'] . '"';?>><?php echo $this->Paginator->sort('risk');?></th>
|
||||
<th><?php echo $this->Paginator->sort('info');?></th>
|
||||
<?php if ('true' == Configure::read('CyDefSIG.sync')): ?>
|
||||
<th><?php echo $this->Paginator->sort('private');?></th>
|
||||
<th<?php echo ' title="' . $event_descriptions['private']['desc'] . '"';?>><?php echo $this->Paginator->sort('private');?></th>
|
||||
<?php endif; ?>
|
||||
<th class="actions"><?php echo __('Actions');?></th>
|
||||
</tr>
|
||||
|
|
Loading…
Reference in New Issue