From 3ed50e2aeffa424e665f25a761d4bf8e6045bf06 Mon Sep 17 00:00:00 2001 From: Christophe Vandeplas Date: Mon, 10 Jun 2013 17:24:41 +0200 Subject: [PATCH] improve UI of event index filtering --- app/Controller/EventsController.php | 3 + app/View/Events/index.ctp | 274 +++++++++++++++++----------- app/View/Events/view.ctp | 2 +- 3 files changed, 170 insertions(+), 109 deletions(-) diff --git a/app/Controller/EventsController.php b/app/Controller/EventsController.php index d1376b387..856824932 100755 --- a/app/Controller/EventsController.php +++ b/app/Controller/EventsController.php @@ -87,6 +87,9 @@ class EventsController extends AppController { public function index() { // 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 if($this->request->is("post")) { $url = array('action'=>'index'); diff --git a/app/View/Events/index.ctp b/app/View/Events/index.ctp index 5671b96e9..ec58b9a72 100755 --- a/app/View/Events/index.ctp +++ b/app/View/Events/index.ctp @@ -7,130 +7,206 @@ - Form->create('', array('action' => 'index', 'style' => 'margin-bottom:0px')); ?> -
-
-
+ Form->create('', array('action' => 'index', 'style' => 'margin-bottom:0px')); + ?> + - - passedArgs as $k => $v) { - if ((substr($k, 0, 6) === 'search')) { - $searchTerm = substr($k, 6); - if ($searchTerm === 'published') { - switch ($v) { - case '0' : - $value = 'No'; - break; - case '1' : - $value = 'Yes'; - break; - case '2' : - continue 2; - break; - } - } else { - if (!$v) { - continue; - } - $value = $v; - } - ?> - +
:
+ passedArgs as $k => $v) { + if ((substr($k, 0, 6) === 'search')) { + $searchTerm = substr($k, 6); + if ($searchTerm === 'published') { + switch ($v) { + case '0' : + $value = 'No'; + break; + case '1' : + $value = 'Yes'; + break; + case '2' : + continue 2; + break; + } + } else { + if (!$v) { + continue; + } + $value = $v; + } + ?> + + 0) { - ?> - - -
+ : + Html->link('', array('controller' => 'events', 'action' => 'index'), array('class' => 'icon-remove', 'title' => 'Remove filters'));?>
- Form->end(); - ?> + if ($count > 0) { + ?> + + Html->link('', array('controller' => 'events', 'action' => 'index'), array('class' => 'icon-remove', 'title' => 'Remove filters'));?> + + + + + - + + if ('true' == Configure::read('CyDefSIG.showorg') || $isAdmin) { + if ($isSiteAdmin) { ?> - + - + - + - + - + + + Form->end(); + ?>
Paginator->sort('published', 'Valid.');?>
+ Paginator->sort('published', 'Valid.');?> + +
+ Form->input('searchpublished', array( + 'options' => array('0' => 'No', '1' => 'Yes', '2' => 'Any'), + 'default' => 2, + 'label' => '', + 'class' => 'input-mini', + 'onchange' => "$('#EventIndexForm').submit()" + )); + ?> +
+
Paginator->sort('org'); ?> Paginator->sort('org'); ?>
Paginator->sort('org'); ?> + + Paginator->sort('owner org');?>
+ Paginator->sort('owner org');?> + +
+ Form->input('searchorgc', array( + 'value' => $this->passedArgs['searchorgc'], + 'label' => '', + 'class' => 'input-mini')); + ?> +
+
Paginator->sort('id');?> Paginator->sort('attribute_count', '#Attr.');?> Paginator->sort('user_id', 'Email');?> Paginator->sort('date');?>
+ Paginator->sort('date');?> + +
+
+ Form->input('searchDatefrom', array( + 'value' => $this->passedArgs['searchDatefrom'], + 'label' => false, + 'div' => false, + 'class' => 'span1 datepicker', + )); + ?> + + Form->input('searchDateuntil', array( + 'value' => $this->passedArgs['searchDateuntil'], + 'label' => false, + 'class' => 'span1 datepicker', + 'div' => false + )); + ?> +
+
Paginator->sort('risk');?> Paginator->sort('analysis');?> Paginator->sort('info');?>
+ Paginator->sort('info');?> + +
+ Form->input('searchinfo', array( + 'value' => $this->passedArgs['searchinfo'], + 'label' => '', + 'class' => 'input-large')); + ?> +
+
Paginator->sort('distribution');?> Actions
@@ -239,37 +315,19 @@ \ No newline at end of file diff --git a/app/View/Events/view.ctp b/app/View/Events/view.ctp index 4c0ec7de3..3f4560054 100755 --- a/app/View/Events/view.ctp +++ b/app/View/Events/view.ctp @@ -11,7 +11,7 @@ $mayPublish = ($isAclPublish && $event['Event']['orgc'] == $me['org']);
  • Html->link('Add Attribute', array('controller' => 'attributes', 'action' => 'add', $event['Event']['id']));?>
  • Html->link('Add Attachment', array('controller' => 'attributes', 'action' => 'add_attachment', $event['Event']['id']));?>
  • -
  • Html->link('Populate event from IOC', array('controller' => 'events', 'action' => 'addIOC', $event['Event']['id']));?>
  • +
  • Html->link('Populate from IOC', array('controller' => 'events', 'action' => 'addIOC', $event['Event']['id']));?>
  • Html->link('Propose Attribute', array('controller' => 'shadow_attributes', 'action' => 'add', $event['Event']['id']));?>
  • Html->link('Propose Attachment', array('controller' => 'shadow_attributes', 'action' => 'add_attachment', $event['Event']['id']));?>