mirror of https://github.com/MISP/MISP
Visual changes to the attribute list / search Fixes #162
- org shown for each attribute - performance improvement (only necessary fields loaded for the event)pull/217/head
parent
22c8105f58
commit
4776b91f98
|
@ -80,6 +80,7 @@ class AttributesController extends AppController {
|
|||
*/
|
||||
public function index() {
|
||||
$this->Attribute->recursive = 0;
|
||||
$this->Attribute->contain = array('Event.id', 'Event.orgc', 'Event.org');
|
||||
$this->set('isSearch', 0);
|
||||
$this->set('attributes', $this->paginate());
|
||||
$this->set('attrDescriptions', $this->Attribute->fieldDescriptions);
|
||||
|
@ -963,7 +964,8 @@ class AttributesController extends AppController {
|
|||
$this->paginate = array(
|
||||
'limit' => 60,
|
||||
'maxLimit' => 9999, // LATER we will bump here on a problem once we have more than 9999 attributes?
|
||||
'conditions' => $conditions
|
||||
'conditions' => $conditions,
|
||||
'contain' => array('Event.orgc', 'Event.id', 'Event.org')
|
||||
);
|
||||
if (!$this->_isSiteAdmin()) {
|
||||
// merge in private conditions
|
||||
|
|
|
@ -29,6 +29,9 @@ if ($isSearch == 1) {
|
|||
<table class="table table-striped table-hover table-condensed">
|
||||
<tr>
|
||||
<th><?php echo $this->Paginator->sort('event_id');?></th>
|
||||
<?php if ('true' == Configure::read('MISP.showorg') || $isAdmin): ?>
|
||||
<th><?php echo $this->Paginator->sort('orgc', 'Org');?></th>
|
||||
<?php endif; ?>
|
||||
<th><?php echo $this->Paginator->sort('category');?></th>
|
||||
<th><?php echo $this->Paginator->sort('type');?></th>
|
||||
<th><?php echo $this->Paginator->sort('value');?></th>
|
||||
|
@ -58,15 +61,26 @@ foreach ($attributes as $attribute):
|
|||
<div onclick="document.location='/events/view/<?php echo $attribute['Event']['id'];?>';">
|
||||
<?php
|
||||
if ($attribute['Event']['orgc'] == $me['org']) {
|
||||
$class='class="SameOrgLink"';
|
||||
$style='style="color:red;"';
|
||||
} else {
|
||||
$class='';
|
||||
$style='';
|
||||
}
|
||||
$currentCount++;
|
||||
?>
|
||||
<a href="/events/view/<?php echo $attribute['Event']['id'];?>" <?php echo $class;?>><?php echo $attribute['Event']['id'];?></a>
|
||||
<a href="/events/view/<?php echo $attribute['Event']['id'];?>" <?php echo $style;?>><?php echo $attribute['Event']['id'];?></a>
|
||||
</div>
|
||||
</td>
|
||||
<?php if ('true' == Configure::read('MISP.showorg') || $isAdmin): ?>
|
||||
<td class="short" onclick="document.location.href ='/events/view/<?php echo $attribute['Event']['id'];?>'">
|
||||
<?php
|
||||
$imgRelativePath = 'orgs' . DS . h($attribute['Event']['orgc']) . '.png';
|
||||
$imgAbsolutePath = APP . WEBROOT_DIR . DS . 'img' . DS . $imgRelativePath;
|
||||
if (file_exists($imgAbsolutePath)) echo $this->Html->image('orgs/' . h($attribute['Event']['orgc']) . '.png', array('alt' => h($attribute['Event']['orgc']), 'title' => h($attribute['Event']['orgc']), 'style' => 'width:24px; height:24px'));
|
||||
else echo $this->Html->tag('span', h($attribute['Event']['orgc']), array('class' => 'welcome', 'style' => 'float:left;'));
|
||||
?>
|
||||
|
||||
</td>
|
||||
<?php endif;?>
|
||||
<td title="<?php echo $categoryDefinitions[$attribute['Attribute']['category']]['desc'];?>" class="short" onclick="document.location='/events/view/<?php echo $attribute['Event']['id'];?>';">
|
||||
<?php echo $attribute['Attribute']['category']; ?> </td>
|
||||
<td title="<?php echo $typeDefinitions[$attribute['Attribute']['type']]['desc'];?>" class="short" onclick="document.location='/events/view/<?php echo $attribute['Event']['id'];?>';">
|
||||
|
|
Loading…
Reference in New Issue