Some UI changes and reattached the regexp for the admin validation tool

- org only events have a redish background in the event index

- org only events and attributes have their distribution level marked in
red
pull/217/head
iglocska 2013-07-11 16:38:39 +02:00
parent b8dcc4d00a
commit 53675fe3a3
4 changed files with 46 additions and 25 deletions

View File

@ -404,10 +404,6 @@ class AppController extends Controller {
if (!self::_isSiteAdmin()) throw new NotFoundException();
print ("<h2>Listing invalid attribute validations</h2>");
$this->loadModel('Attribute');
// first remove executing some Behaviors because of Noud's crappy code
$this->Attribute->Behaviors->detach('Regexp');
$this->Attribute->Behaviors->detach('Blacklist');
// for efficiency reasons remove the unique requirement
$this->Attribute->validator()->remove('value', 'unique');

View File

@ -196,7 +196,7 @@
</tr>
<?php foreach ($events as $event):?>
<tr>
<tr <?php if($event['Event']['distribution'] == 0) echo 'class = "privateRed"'?>>
<td class="short" onclick="document.location.href ='/events/view/<?php echo $event['Event']['id'];?>'">
<?php
if ($event['Event']['published'] == 1) {
@ -255,7 +255,7 @@
<?php echo nl2br(h($event['Event']['info'])); ?>&nbsp;
</td>
<?php if ('true' == Configure::read('CyDefSIG.sync')): ?>
<td class="short" onclick="location.href ='/events/view/<?php echo $event['Event']['id'];?>'">
<td class="short <?php if ($event['Event']['distribution'] == 0) echo 'privateRedText';?>" onclick="location.href ='/events/view/<?php echo $event['Event']['id'];?>'">
<?php echo $event['Event']['distribution'] != 3 ? $distributionLevels[$event['Event']['distribution']] : 'All';?>
</td>
<?php endif; ?>

View File

@ -97,7 +97,7 @@ $mayPublish = ($isAclPublish && $event['Event']['orgc'] == $me['org']);
&nbsp;
</dd>
<dt>Distribution</dt>
<dd>
<dd <?php if($event['Event']['distribution'] == 0) echo 'class = "privateRedText"';?>>
<?php echo h($distributionLevels[$event['Event']['distribution']] . ', ' . strtolower(substr(($distributionDescriptions[$event['Event']['distribution']]['formdesc']), 0, 1)) . substr($distributionDescriptions[$event['Event']['distribution']]['formdesc'], 1) . '.'); ?>
&nbsp;
</dd>
@ -219,15 +219,24 @@ if (!empty($event['Attribute'])):?>
?>&nbsp;
</td>
<td class="short <?php echo $extra; ?>"><?php echo $attribute['to_ids'] ? 'Yes' : 'No';?></td>
<td class="short <?php echo $extra; ?>"><?php echo $attribute['distribution'] != 3 ? $distributionLevels[$attribute['distribution']] : 'All';?></td>
<td class="short action-links <?php echo $extra;?>">
<td class="short
<?php
if ($isSiteAdmin || $mayModify) {
echo $this->Html->link('', array('controller' => 'attributes', 'action' => 'edit', $attribute['id']), array('class' => 'icon-edit', 'title' => 'Edit'));
echo $this->Form->postLink('', array('controller' => 'attributes', 'action' => 'delete', $attribute['id']), array('class' => 'icon-trash', 'title' => 'Delete'), __('Are you sure you want to delete this attribute? Keep in mind that this will also delete this attribute on remote MISP instances.'));
} else {
echo $this->Html->link('', array('controller' => 'shadow_attributes', 'action' => 'edit', $attribute['id']), array('class' => 'icon-edit', 'title' => 'Propose Edit'));
}
echo $extra;
if ($attribute['distribution'] == 0) echo 'privateRedText';
?>
">
<?php echo $attribute['distribution'] != 3 ? $distributionLevels[$attribute['distribution']] : 'All';?>
</td>
<td class="short action-links
<?php echo $extra;?>
">
<?php
if ($isSiteAdmin || $mayModify) {
echo $this->Html->link('', array('controller' => 'attributes', 'action' => 'edit', $attribute['id']), array('class' => 'icon-edit', 'title' => 'Edit'));
echo $this->Form->postLink('', array('controller' => 'attributes', 'action' => 'delete', $attribute['id']), array('class' => 'icon-trash', 'title' => 'Delete'), __('Are you sure you want to delete this attribute? Keep in mind that this will also delete this attribute on remote MISP instances.'));
} else {
echo $this->Html->link('', array('controller' => 'shadow_attributes', 'action' => 'edit', $attribute['id']), array('class' => 'icon-edit', 'title' => 'Propose Edit'));
}
?>
</td>
</tr>
@ -236,13 +245,14 @@ if (!empty($event['Attribute'])):?>
// $extra is used for extra style code added to cells that have a highlighting border around them.
$extra = null;
$extra = 'highlight2';
foreach ($attribute['ShadowAttribute'] as $shadowAttribute):
?>
foreach ($attribute['ShadowAttribute'] as $shadowAttribute): ?>
<tr class="highlight2">
<td class="short highlight2" title="<?php if('' != $shadowAttribute['category']) echo $categoryDefinitions[$shadowAttribute['category']]['desc'];?>">
<?php
if ($shadowAttribute['category'] != $attribute['category']) echo h($shadowAttribute['category']);
?>
<td class="short highlight2" title="
<?php if('' != $shadowAttribute['category']) echo $categoryDefinitions[$shadowAttribute['category']]['desc'];?>
">
<?php
if ($shadowAttribute['category'] != $attribute['category']) echo h($shadowAttribute['category']);
?>
</td>
<td class="short highlight2" title="
<?php
@ -253,7 +263,8 @@ if (!empty($event['Attribute'])):?>
if ($shadowAttribute['type'] != $attribute['type']) echo h($shadowAttribute['type']);
?>
</td>
<td class="showspaces highlight2"><?php
<td class="showspaces highlight2">
<?php
if ($shadowAttribute['value'] != $attribute['value']) {
$sigDisplay = $shadowAttribute['value'];
if ('attachment' == $shadowAttribute['type'] || 'malware-sample' == $shadowAttribute['type'] ) {
@ -279,13 +290,15 @@ if (!empty($event['Attribute'])):?>
echo h($sigDisplay);
}
}
?></td>
?>
</td>
<td class="short highlight2">
</td>
<td class="short highlight2">
<?php
if ($shadowAttribute['to_ids'] != $attribute['to_ids']) echo $shadowAttribute['to_ids'] ? 'Yes' : 'No';
?></td>
?>
</td>
<td class="short highlight2"></td>
<td class="short action-links highlight2">
<?php
@ -294,7 +307,7 @@ if (!empty($event['Attribute'])):?>
}
echo $this->Html->link('', array('controller' => 'shadow_attributes', 'action' => 'discard', $shadowAttribute['id']), array('class' => 'icon-trash', 'title' => 'Discard'));
?>
</td>
</td>
</tr>
<?php
endforeach;

View File

@ -424,4 +424,16 @@ dd {
text-align:center;
z-index:1;
}
.table-striped tbody > tr:nth-child(odd).privateRed > td, .table-striped tbody > tr:nth-child(odd).privateRed > th {
background-color: #FFDDDD !important;
}
.table-striped tbody > tr:nth-child(even).privateRed > td, .table-striped tbody > tr:nth-child(even).privateRed > th {
background-color: #FFCCCC !important;
}
.privateRedText {
color: #FF0000 !important;
font-weight:bold !important;
}