mirror of https://github.com/MISP/MISP
improve UI of event index filtering
parent
0cafc7ec6b
commit
3ed50e2aef
|
@ -87,6 +87,9 @@ class EventsController extends AppController {
|
||||||
public function index() {
|
public function index() {
|
||||||
// list the events
|
// list the events
|
||||||
|
|
||||||
|
// TODO information exposure vulnerability - as we don't limit the filter depending on the CyDefSIG.showorg parameter
|
||||||
|
// this filter will work if showorg=false and users will be able to perform the filtering and see what events were posted by what org.
|
||||||
|
// same goes for orgc in all cases
|
||||||
//transform POST into GET
|
//transform POST into GET
|
||||||
if($this->request->is("post")) {
|
if($this->request->is("post")) {
|
||||||
$url = array('action'=>'index');
|
$url = array('action'=>'index');
|
||||||
|
|
|
@ -13,49 +13,56 @@
|
||||||
'before' => '$(".progress").show()',
|
'before' => '$(".progress").show()',
|
||||||
'complete' => '$(".progress").hide()',
|
'complete' => '$(".progress").hide()',
|
||||||
));
|
));
|
||||||
|
|
||||||
echo $this->Paginator->prev('« ' . __('previous'), array('tag' => 'li', 'escape' => false), null, array('tag' => 'li', 'class' => 'prev disabled', 'escape' => false, 'disabledTag' => 'span'));
|
echo $this->Paginator->prev('« ' . __('previous'), array('tag' => 'li', 'escape' => false), null, array('tag' => 'li', 'class' => 'prev disabled', 'escape' => false, 'disabledTag' => 'span'));
|
||||||
echo $this->Paginator->numbers(array('modulus' => 20, 'separator' => '', 'tag' => 'li', 'currentClass' => 'active', 'currentTag' => 'span'));
|
echo $this->Paginator->numbers(array('modulus' => 20, 'separator' => '', 'tag' => 'li', 'currentClass' => 'active', 'currentTag' => 'span'));
|
||||||
echo $this->Paginator->next(__('next') . ' »', array('tag' => 'li', 'escape' => false), null, array('tag' => 'li', 'class' => 'next disabled', 'escape' => false, 'disabledTag' => 'span'));
|
echo $this->Paginator->next(__('next') . ' »', array('tag' => 'li', 'escape' => false), null, array('tag' => 'li', 'class' => 'next disabled', 'escape' => false, 'disabledTag' => 'span'));
|
||||||
?>
|
?>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<?php echo $this->Form->create('', array('action' => 'index', 'style' => 'margin-bottom:0px')); ?>
|
<?php
|
||||||
<div class="input-prepend input-append" style="margin-bottom:0px;">
|
echo $this->Form->create('', array('action' => 'index', 'style' => 'margin-bottom:0px'));
|
||||||
<div id = "searchcancel" class="add-on span" style="margin-left:0px; margin-top:25px">
|
?>
|
||||||
<div><a href=# onClick='resetForm()'><div class="icon-remove" style = "margin-top:3px"></div></a></div>
|
<!-- div class="input-prepend input-append" style="margin-bottom:0px;">
|
||||||
|
<div id="searchcancel" class="add-on span" style="margin-left:0px; margin-top:25px">
|
||||||
|
<div><a href="#" onClick='resetForm()'><div class="icon-remove" style = "margin-top:3px"></div></a></div>
|
||||||
</div>
|
</div>
|
||||||
<div id = "searchinfo" class="span" style="width:220px; margin-left:0px">
|
<div id="searchinfo" class="span" style="width:220px; margin-left:0px">
|
||||||
<?php
|
<?php
|
||||||
echo $this->Form->input('searchinfo', array('value' => $this->passedArgs['searchinfo'], 'label' => 'Info'));
|
//echo $this->Form->input('searchinfo', array('value' => $this->passedArgs['searchinfo'], 'label' => 'Info'));
|
||||||
?>
|
|
||||||
</div><div id = "searchorgc" class="span" style="margin-left:0px; width:220px">
|
|
||||||
<?php
|
|
||||||
echo $this->Form->input('searchorgc', array('value' => $this->passedArgs['searchorgc'], 'label' => 'Org'));
|
|
||||||
?>
|
|
||||||
</div><div id = "searchpublished" class="span" style="margin-left:0px; width:220px">
|
|
||||||
<?php
|
|
||||||
echo $this->Form->input('searchpublished', array('options' => array('0' => 'No', '1' => 'Yes', '2' => 'Any'), 'default' => 2, 'label' => 'Published'));
|
|
||||||
?>
|
|
||||||
</div><div id = "searchfrom" class="span" style="margin-left:0px; width:110px">
|
|
||||||
<?php
|
|
||||||
echo $this->Form->input('searchDatefrom', array('value' => $this->passedArgs['searchDatefrom'], 'label' => 'From', 'style' => 'width:96px; margin-top: 0px;', 'class' => 'datepicker'));
|
|
||||||
?>
|
|
||||||
</div><div id = "searchuntil" class="span" style="margin-left:0px; width:110px">
|
|
||||||
<?php
|
|
||||||
echo $this->Form->input('searchDateuntil', array('value' => $this->passedArgs['searchDateuntil'], 'label' => 'Until', 'style' => 'width:96px; margin-top: 0px;', 'class' => 'datepicker'));
|
|
||||||
?>
|
|
||||||
</div><div id = "searchbutton" class="span" style="margin-left:0px; margin-top:25px">
|
|
||||||
<?php
|
|
||||||
echo $this->Form->button('Go', array('class' => 'btn'));
|
|
||||||
?>
|
?>
|
||||||
</div>
|
</div>
|
||||||
|
<div id="searchorgc" class="span" style="margin-left:0px; width:220px">
|
||||||
|
<?php
|
||||||
|
//echo $this->Form->input('searchorgc', array('value' => $this->passedArgs['searchorgc'], 'label' => 'Org'));
|
||||||
|
?>
|
||||||
</div>
|
</div>
|
||||||
|
<div id="searchpublished" class="span" style="margin-left:0px; width:220px">
|
||||||
|
<?php
|
||||||
|
//echo $this->Form->input('searchpublished', array('options' => array('0' => 'No', '1' => 'Yes', '2' => 'Any'), 'default' => 2, 'label' => 'Published'));
|
||||||
|
?>
|
||||||
|
</div>
|
||||||
|
<div id="searchfrom" class="span" style="margin-left:0px; width:110px">
|
||||||
|
<?php
|
||||||
|
//echo $this->Form->input('searchDatefrom', array('value' => $this->passedArgs['searchDatefrom'], 'label' => 'From', 'style' => 'width:96px; margin-top: 0px;', 'class' => 'datepicker'));
|
||||||
|
?>
|
||||||
|
</div>
|
||||||
|
<div id="searchuntil" class="span" style="margin-left:0px; width:110px">
|
||||||
|
<?php
|
||||||
|
//echo $this->Form->input('searchDateuntil', array('value' => $this->passedArgs['searchDateuntil'], 'label' => 'Until', 'style' => 'width:96px; margin-top: 0px;', 'class' => 'datepicker'));
|
||||||
|
?>
|
||||||
|
</div>
|
||||||
|
<div id="searchbutton">
|
||||||
|
<?php
|
||||||
|
//echo $this->Form->submit();
|
||||||
|
?>
|
||||||
|
</div>
|
||||||
|
</div -->
|
||||||
<?php
|
<?php
|
||||||
// Let's output a small label of each filter
|
// Let's output a small label of each filter
|
||||||
$count = 0;
|
$count = 0;
|
||||||
?>
|
?>
|
||||||
<table><tr>
|
<table>
|
||||||
|
<tr>
|
||||||
<?php
|
<?php
|
||||||
foreach ($this->passedArgs as $k => $v) {
|
foreach ($this->passedArgs as $k => $v) {
|
||||||
if ((substr($k, 0, 6) === 'search')) {
|
if ((substr($k, 0, 6) === 'search')) {
|
||||||
|
@ -79,58 +86,127 @@
|
||||||
$value = $v;
|
$value = $v;
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
<td class="<?php echo (($count < 1) ? 'searchLabelFirst' : 'searchLabel');?>"><?php echo $searchTerm; ?> : <?php echo $value; ?></td>
|
<td class="<?php echo (($count < 1) ? 'searchLabelFirst' : 'searchLabel');?>">
|
||||||
|
<?php echo $searchTerm; ?> : <?php echo $value; ?>
|
||||||
|
</td>
|
||||||
<?php
|
<?php
|
||||||
$count++;
|
$count++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($count > 0) {
|
if ($count > 0) {
|
||||||
?>
|
?>
|
||||||
<td class="searchLabelCancel"><?php echo $this->Html->link('', array('controller' => 'events', 'action' => 'index'), array('class' => 'icon-remove', 'title' => 'Remove filters'));?></td>
|
<td class="searchLabelCancel">
|
||||||
|
<?php echo $this->Html->link('', array('controller' => 'events', 'action' => 'index'), array('class' => 'icon-remove', 'title' => 'Remove filters'));?>
|
||||||
|
</td>
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
</tr></table>
|
</tr>
|
||||||
<?php
|
</table>
|
||||||
echo $this->Form->end();
|
<input type="submit" style="visibility:collapse;" />
|
||||||
?>
|
|
||||||
<table class="table table-striped table-hover table-condensed">
|
<table class="table table-striped table-hover table-condensed">
|
||||||
<tr>
|
<tr>
|
||||||
<th><?php echo $this->Paginator->sort('published', 'Valid.');?><a href=# onClick='enableField("searchpublished")'><br /><div class="icon-search"></div></a></th>
|
<th class="filter">
|
||||||
|
<?php echo $this->Paginator->sort('published', 'Valid.');?>
|
||||||
|
<a onclick="$('#searchpublished').toggle();" class="icon-search"></a>
|
||||||
|
<span id="searchpublished"><br/>
|
||||||
|
<?php
|
||||||
|
// on change jquery will submit the form
|
||||||
|
echo $this->Form->input('searchpublished', array(
|
||||||
|
'options' => array('0' => 'No', '1' => 'Yes', '2' => 'Any'),
|
||||||
|
'default' => 2,
|
||||||
|
'label' => '',
|
||||||
|
'class' => 'input-mini',
|
||||||
|
'onchange' => "$('#EventIndexForm').submit()"
|
||||||
|
));
|
||||||
|
?>
|
||||||
|
</span>
|
||||||
|
</th>
|
||||||
<?php
|
<?php
|
||||||
if ('true' == Configure::read('CyDefSIG.showorg') || $isAdmin) {
|
if ('true' == Configure::read('CyDefSIG.showorg') || $isAdmin) {
|
||||||
if ($isSiteAdmin) { ?>
|
if ($isSiteAdmin) { ?>
|
||||||
<th><?php echo $this->Paginator->sort('org'); ?></th>
|
<th><?php echo $this->Paginator->sort('org'); ?></th>
|
||||||
<?php
|
<?php
|
||||||
} else { ?>
|
} else { ?>
|
||||||
<th><?php echo $this->Paginator->sort('org'); ?><a href=# onClick='enableField("searchorgc")'><br /><div class="icon-search"></div></a></th></th>
|
<th class="filter"><?php echo $this->Paginator->sort('org'); ?>
|
||||||
|
<a onclick="toggleField('#searchorg')" class="icon-search"></a>
|
||||||
|
</th>
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
<?php if ($isSiteAdmin): ?>
|
<?php if ($isSiteAdmin): ?>
|
||||||
<th><?php echo $this->Paginator->sort('owner org');?><a href=# onClick='enableField("searchorgc")'><br /><div class="icon-search"></div></a></th>
|
<th class="filter">
|
||||||
|
<?php echo $this->Paginator->sort('owner org');?>
|
||||||
|
<a onclick="toggleField('#searchorgc')" class="icon-search"></a>
|
||||||
|
<span id="searchorgc"><br/>
|
||||||
|
<?php
|
||||||
|
echo $this->Form->input('searchorgc', array(
|
||||||
|
'value' => $this->passedArgs['searchorgc'],
|
||||||
|
'label' => '',
|
||||||
|
'class' => 'input-mini'));
|
||||||
|
?>
|
||||||
|
</span>
|
||||||
|
</th>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<th><?php echo $this->Paginator->sort('id');?></th>
|
<th><?php echo $this->Paginator->sort('id');?></th>
|
||||||
<th><?php echo $this->Paginator->sort('attribute_count', '#Attr.');?></th>
|
<th><?php echo $this->Paginator->sort('attribute_count', '#Attr.');?></th>
|
||||||
<?php if ($isAdmin): ?>
|
<?php if ($isAdmin): ?>
|
||||||
<th><?php echo $this->Paginator->sort('user_id', 'Email');?></th>
|
<th><?php echo $this->Paginator->sort('user_id', 'Email');?></th>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<th><?php echo $this->Paginator->sort('date');?><a href=# onClick='enableDate()'><br /><div class="icon-search"></div></a></th>
|
<th class="filter">
|
||||||
|
<?php echo $this->Paginator->sort('date');?>
|
||||||
|
<a onclick="toggleField('#searchdate')" class="icon-search"></a>
|
||||||
|
<br/>
|
||||||
|
<div id="searchdate" class="input-append input-prepend">
|
||||||
|
<?php
|
||||||
|
echo $this->Form->input('searchDatefrom', array(
|
||||||
|
'value' => $this->passedArgs['searchDatefrom'],
|
||||||
|
'label' => false,
|
||||||
|
'div' => false,
|
||||||
|
'class' => 'span1 datepicker',
|
||||||
|
));
|
||||||
|
?>
|
||||||
|
<input type="submit" class="btn" value=">"/>
|
||||||
|
<?php
|
||||||
|
echo $this->Form->input('searchDateuntil', array(
|
||||||
|
'value' => $this->passedArgs['searchDateuntil'],
|
||||||
|
'label' => false,
|
||||||
|
'class' => 'span1 datepicker',
|
||||||
|
'div' => false
|
||||||
|
));
|
||||||
|
?>
|
||||||
|
</div>
|
||||||
|
</th>
|
||||||
<th title="<?php echo $eventDescriptions['risk']['desc'];?>">
|
<th title="<?php echo $eventDescriptions['risk']['desc'];?>">
|
||||||
<?php echo $this->Paginator->sort('risk');?>
|
<?php echo $this->Paginator->sort('risk');?>
|
||||||
</th>
|
</th>
|
||||||
<th title="<?php echo $eventDescriptions['analysis']['desc'];?>">
|
<th title="<?php echo $eventDescriptions['analysis']['desc'];?>">
|
||||||
<?php echo $this->Paginator->sort('analysis');?>
|
<?php echo $this->Paginator->sort('analysis');?>
|
||||||
</th>
|
</th>
|
||||||
<th><?php echo $this->Paginator->sort('info');?><a href=# onClick='enableField("searchinfo")'><br /><div class="icon-search"></div></a></th>
|
<th class="filter">
|
||||||
|
<?php echo $this->Paginator->sort('info');?>
|
||||||
|
<a onclick="toggleField('#searchinfo')" class="icon-search"></a>
|
||||||
|
<span id="searchinfo"><br/>
|
||||||
|
<?php
|
||||||
|
echo $this->Form->input('searchinfo', array(
|
||||||
|
'value' => $this->passedArgs['searchinfo'],
|
||||||
|
'label' => '',
|
||||||
|
'class' => 'input-large'));
|
||||||
|
?>
|
||||||
|
</span>
|
||||||
|
</th>
|
||||||
<?php if ('true' == Configure::read('CyDefSIG.sync')): ?>
|
<?php if ('true' == Configure::read('CyDefSIG.sync')): ?>
|
||||||
<th title="<?php echo $eventDescriptions['distribution']['desc'];?>">
|
<th title="<?php echo $eventDescriptions['distribution']['desc'];?>">
|
||||||
<?php echo $this->Paginator->sort('distribution');?>
|
<?php echo $this->Paginator->sort('distribution');?>
|
||||||
</th>
|
</th>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<th class="actions"><?php echo __('Actions');?></th>
|
<th class="actions">Actions</th>
|
||||||
|
|
||||||
</tr>
|
</tr>
|
||||||
|
<?php
|
||||||
|
echo $this->Form->end();
|
||||||
|
?>
|
||||||
<?php foreach ($events as $event):?>
|
<?php foreach ($events as $event):?>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="short" onclick="document.location ='<?php echo $this->Html->url(array('action' => 'view', $event['Event']['id']), true);?>';">
|
<td class="short" onclick="document.location ='<?php echo $this->Html->url(array('action' => 'view', $event['Event']['id']), true);?>';">
|
||||||
|
@ -239,37 +315,19 @@
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<script>
|
<script>
|
||||||
$(document).ready(disableAll());
|
$(document).ready( function () {
|
||||||
|
// onload hide all buttons
|
||||||
|
$('#searchinfo').hide();
|
||||||
|
$('#searchorgc').hide();
|
||||||
|
$('#searchdate').hide();
|
||||||
|
$('#searchpublished').hide();
|
||||||
|
|
||||||
function resetForm() {
|
});
|
||||||
document.getElementById('EventSearchinfo').value=null;
|
|
||||||
document.getElementById('EventSearchorgc').value=null;
|
function toggleField(field) {
|
||||||
document.getElementById('EventSearchpublished').value=2;
|
$(field).toggle();
|
||||||
disableAll();
|
$(field +" input").focus();
|
||||||
}
|
}
|
||||||
|
|
||||||
function disableAll() {
|
|
||||||
disableField('searchinfo');
|
|
||||||
disableField('searchorgc');
|
|
||||||
disableField('searchfrom');
|
|
||||||
disableField('searchuntil');
|
|
||||||
disableField('searchpublished');
|
|
||||||
disableField('searchbutton');
|
|
||||||
disableField('searchcancel');
|
|
||||||
}
|
|
||||||
|
|
||||||
function disableField(field) {
|
|
||||||
document.getElementById(field).style.display="none";
|
|
||||||
}
|
|
||||||
function enableField(field) {
|
|
||||||
document.getElementById(field).style.display="";
|
|
||||||
document.getElementById('searchbutton').style.display="";
|
|
||||||
document.getElementById('searchcancel').style.display="";
|
|
||||||
}
|
|
||||||
|
|
||||||
function enableDate() {
|
|
||||||
enableField('searchfrom');
|
|
||||||
enableField('searchuntil');
|
|
||||||
}
|
|
||||||
|
|
||||||
</script>
|
</script>
|
|
@ -11,7 +11,7 @@ $mayPublish = ($isAclPublish && $event['Event']['orgc'] == $me['org']);
|
||||||
<li class="divider"></li>
|
<li class="divider"></li>
|
||||||
<li><?php echo $this->Html->link('Add Attribute', array('controller' => 'attributes', 'action' => 'add', $event['Event']['id']));?> </li>
|
<li><?php echo $this->Html->link('Add Attribute', array('controller' => 'attributes', 'action' => 'add', $event['Event']['id']));?> </li>
|
||||||
<li><?php echo $this->Html->link('Add Attachment', array('controller' => 'attributes', 'action' => 'add_attachment', $event['Event']['id']));?> </li>
|
<li><?php echo $this->Html->link('Add Attachment', array('controller' => 'attributes', 'action' => 'add_attachment', $event['Event']['id']));?> </li>
|
||||||
<li><?php echo $this->Html->link('Populate event from IOC', array('controller' => 'events', 'action' => 'addIOC', $event['Event']['id']));?> </li>
|
<li><?php echo $this->Html->link('Populate from IOC', array('controller' => 'events', 'action' => 'addIOC', $event['Event']['id']));?> </li>
|
||||||
<?php else: ?>
|
<?php else: ?>
|
||||||
<li><?php echo $this->Html->link('Propose Attribute', array('controller' => 'shadow_attributes', 'action' => 'add', $event['Event']['id']));?> </li>
|
<li><?php echo $this->Html->link('Propose Attribute', array('controller' => 'shadow_attributes', 'action' => 'add', $event['Event']['id']));?> </li>
|
||||||
<li><?php echo $this->Html->link('Propose Attachment', array('controller' => 'shadow_attributes', 'action' => 'add_attachment', $event['Event']['id']));?> </li>
|
<li><?php echo $this->Html->link('Propose Attachment', array('controller' => 'shadow_attributes', 'action' => 'add_attachment', $event['Event']['id']));?> </li>
|
||||||
|
|
Loading…
Reference in New Issue