UI changes and more work on the sync

- updated the side menu
pull/217/head
Iglocska 2013-06-11 01:20:27 +02:00
parent 60f6b7b133
commit a3edc6a4ee
5 changed files with 34 additions and 62 deletions

View File

@ -228,12 +228,9 @@ class AttributesController extends AppController {
$this->set('categories', compact('categories'));
$this->loadModel('Event');
$events = $this->Event->findById($eventId);
$events = $this->Event->findById($eventId);
$this->set('maxDist', $events['Event']['distribution']);
// combobox for distribution
$distributionLevelsCut = array_slice($this->Event->distributionLevels, 0, $events['Event']['distribution']+1);
$this->set('distributionLevels', $distributionLevelsCut);
$this->set('distributionLevels', $this->Attribute->distributionLevels);
$this->set('currentDist', $events['Event']['distribution']);
// tooltip for distribution
$this->set('distributionDescriptions', $this->Attribute->distributionDescriptions);
@ -388,8 +385,7 @@ class AttributesController extends AppController {
$this->request->data['Attribute']['event_id'] = $eventId;
$this->loadModel('Event');
$events = $this->Event->findById($eventId);
$maxDist = $events['Event']['distribution'];
$this->set('maxDist', $maxDist);
$this->set('currentDist', $events['Event']['distribution']);
}
// combobos for categories
@ -421,22 +417,10 @@ class AttributesController extends AppController {
$this->set('uploadDefinitions', $this->Attribute->uploadDefinitions);
// combobox for distribution
if (isset($maxDist)) {
$distributionsBeforeCut = array_keys($this->Attribute->distributionDescriptions);
$count = 0;
foreach ($distributionsBeforeCut as $current) {
$distributions[$count] = $current;
if ($distributions[$count] == $maxDist)break;
$count++;
}
} else {
$distributions = array_keys($this->Attribute->distributionDescriptions);
}
$distributions = $this->_arrayToValuesIndexArray($distributions);
$this->set('distributions', $distributions);
// tooltip for distribution
$this->set('distributionDescriptions', $this->Attribute->distributionDescriptions);
$this->set('distributionLevels', $this->Event->distributionLevels);
$events = $this->Event->findById($eventId);
$this->set('currentDist', $events['Event']['distribution']);
}
/**
@ -548,12 +532,9 @@ class AttributesController extends AppController {
array_pop($categories); // remove that last empty/space option
$categories = $this->_arrayToValuesIndexArray($categories);
$this->set('categories', $categories);
$events = $this->Event->findById($eventId);
$this->set('maxDist', $events['Event']['distribution']);
$this->set('currentDist', $this->Event->data['Event']['distribution']);
// combobox for distribution
$distributionLevelsCut = array_slice($this->Event->distributionLevels, 0, $events['Event']['distribution']+1);
$this->set('distributionLevels', $distributionLevelsCut);
$this->set('distributionLevels', $this->Attribute->distributionLevels);
// tooltip for distribution
$this->set('distributionDescriptions', $this->Attribute->distributionDescriptions);
$this->set('attrDescriptions', $this->Attribute->fieldDescriptions);

View File

@ -14,7 +14,7 @@
echo $this->Form->input('distribution', array(
'options' => array($distributionLevels),
'label' => 'Distribution',
'selected' => $maxDist,
'selected' => $currentDist,
));
}
echo $this->Form->input('value', array(

View File

@ -8,7 +8,10 @@
'after' => $this->Html->div('forminfo', '', array('id' => 'AttributeCategoryDiv')),
));
if ('true' == Configure::read('CyDefSIG.sync')) {
echo $this->Form->input('distribution', array('label' => 'Distribution', 'selected' => $maxDist,
echo $this->Form->input('distribution', array(
'options' => $distributionLevels,
'label' => 'Distribution',
'selected' => $currentDist,
'after' => $this->Html->div('forminfo', '', array('id' => 'AttributeDistributionDiv')),
));
//'before' => $this->Html->div('forminfo', isset($attrDescriptions['distribution']['formdesc']) ? $attrDescriptions['distribution']['formdesc'] : $attrDescriptions['distribution']['desc']),));

View File

@ -16,28 +16,22 @@ echo $this->Form->end();
</div>
<div class="actions">
<ul class="nav nav-list">
<li><a href="/events/view/<?php echo $this->request->data['Event']['id'];?>">View Event</a></li>
<li><a href="/events/view/<?php echo $id;?>">View Event</a></li>
<?php if ($isSiteAdmin || $mayModify): ?>
<li><a href="/events/edit/<?php echo $this->request->data['Event']['id'];?>">Edit Event</a></li>
<li><?php echo $this->Form->postLink('Delete Event', array('action' => 'delete', $this->request->data['Event']['id']), null, __('Are you sure you want to delete # %s?', $this->request->data['Event']['id'])); ?></li>
<li><a href="/events/edit/<?php echo $id;?>">Edit Event</a></li>
<li><?php echo $this->Form->postLink('Delete Event', array('action' => 'delete', $id), null, __('Are you sure you want to delete # %s?', $id)); ?></li>
<li class="divider"></li>
<li><a href="/attributes/add/<?php echo $this->request->data['Event']['id'];?>">Add Attribute</a></li>
<li><a href="/attributes/add_attachment/<?php echo $this->request->data['Event']['id'];?>">Add Attachment</a></li>
<li class="active"><a href="/events/addIOC/<?php echo $this->request->data['Event']['id'];?>">Populate from IOC</a></li>
<li><a href="/attributes/add/<?php echo $id;?>">Add Attribute</a></li>
<li><a href="/attributes/add_attachment/<?php echo $id;?>">Add Attachment</a></li>
<li class="active"><a href="/events/addIOC/<?php echo $id;?>">Populate from IOC</a></li>
<?php else: ?>
<li><a href="/shadow_attributes/add/<?php echo $this->request->data['Event']['id'];?>">Propose Attribute</a></li>
<li><a href="/shadow_attributes/add_attachment/<?php echo $this->request->data['Event']['id'];?>">Propose Attachment</a></li>
<li><a href="/shadow_attributes/add/<?php echo $id;?>">Propose Attribute</a></li>
<li><a href="/shadow_attributes/add_attachment/<?php echo $id;?>">Propose Attachment</a></li>
<?php endif; ?>
<li class="divider"></li>
<?php if ( 0 == $this->request->data['Event']['published'] && ($isAdmin || $mayPublish)): ?>
<li><?php echo $this->Form->postLink('Publish Event', array('action' => 'alert', $this->request->data['Event']['id']), null, 'Are you sure this event is complete and everyone should be informed?'); ?></li>
<li><?php echo $this->Form->postLink('Publish (no email)', array('action' => 'publish', $this->request->data['Event']['id']), null, 'Publish but do NOT send alert email? Only for minor changes!'); ?></li>
<?php else: ?>
<!-- ul><li>Alert already sent</li></ul -->
<?php endif; ?>
<li><a href="/events/contact/<?php echo $this->request->data['Event']['id'];?>">Contact Reporter</a></li>
<li><a href="/events/xml/download/<?php echo $this->request->data['Event']['id'];?>">Download as XML</a></li>
<li><a href="/events/downloadOpenIOCEvent/<?php echo $this->request->data['Event']['id'];?>">Download as IOC</a></li>
<li><a href="/events/contact/<?php echo $id;?>">Contact Reporter</a></li>
<li><a href="/events/xml/download/<?php echo $id;?>">Download as XML</a></li>
<li><a href="/events/downloadOpenIOCEvent/<?php echo $id;?>">Download as IOC</a></li>
<li class="divider"></li>
<li><a href="/events/index">List Events</a></li>
<?php if ($isAclAdd): ?>

View File

@ -35,28 +35,22 @@ $mayPublish = ($isAclPublish && $this->request->data['Event']['orgc'] == $me['or
</div>
<div class="actions">
<ul class="nav nav-list">
<li><a href="/events/view/<?php echo $event['Event']['id'];?>">View Event</a></li>
<li><a href="/events/view/<?php echo $this->data['Event']['id'];?>">View Event</a></li>
<?php if ($isSiteAdmin || $mayModify): ?>
<li><a href="/events/edit/<?php echo $event['Event']['id'];?>">Edit Event</a></li>
<li><?php echo $this->Form->postLink('Delete Event', array('action' => 'delete', $event['Event']['id']), null, __('Are you sure you want to delete # %s?', $event['Event']['id'])); ?></li>
<li><a href="/events/edit/<?php echo $this->data['Event']['id'];?>">Edit Event</a></li>
<li><?php echo $this->Form->postLink('Delete Event', array('action' => 'delete', $this->data['Event']['id']), null, __('Are you sure you want to delete # %s?', $this->data['Event']['id'])); ?></li>
<li class="divider"></li>
<li><a href="/attributes/add/<?php echo $event['Event']['id'];?>">Add Attribute</a></li>
<li><a href="/attributes/add_attachment/<?php echo $event['Event']['id'];?>">Add Attachment</a></li>
<li><a href="/events/addIOC/<?php echo $event['Event']['id'];?>">Populate from IOC</a></li>
<li><a href="/attributes/add/<?php echo $this->data['Event']['id'];?>">Add Attribute</a></li>
<li><a href="/attributes/add_attachment/<?php echo $this->data['Event']['id'];?>">Add Attachment</a></li>
<li><a href="/events/addIOC/<?php echo $this->data['Event']['id'];?>">Populate from IOC</a></li>
<?php else: ?>
<li><a href="/shadow_attributes/add/<?php echo $event['Event']['id'];?>">Propose Attribute</a></li>
<li><a href="/shadow_attributes/add_attachment/<?php echo $event['Event']['id'];?>">Propose Attachment</a></li>
<li><a href="/shadow_attributes/add/<?php echo $this->data['Event']['id'];?>">Propose Attribute</a></li>
<li><a href="/shadow_attributes/add_attachment/<?php echo $this->data['Event']['id'];?>">Propose Attachment</a></li>
<?php endif; ?>
<li class="divider"></li>
<?php if ( 0 == $event['Event']['published'] && ($isAdmin || $mayPublish)): ?>
<li><?php echo $this->Form->postLink('Publish Event', array('action' => 'alert', $event['Event']['id']), null, 'Are you sure this event is complete and everyone should be informed?'); ?></li>
<li><?php echo $this->Form->postLink('Publish (no email)', array('action' => 'publish', $event['Event']['id']), null, 'Publish but do NOT send alert email? Only for minor changes!'); ?></li>
<?php else: ?>
<!-- ul><li>Alert already sent</li></ul -->
<?php endif; ?>
<li class="active"><a href="/events/contact/<?php echo $event['Event']['id'];?>">Contact Reporter</a></li>
<li><a href="/events/xml/download/<?php echo $event['Event']['id'];?>">Download as XML</a></li>
<li><a href="/events/downloadOpenIOCEvent/<?php echo $event['Event']['id'];?>">Download as IOC</a></li>
<li class="active"><a href="/events/contact/<?php echo $this->data['Event']['id'];?>">Contact Reporter</a></li>
<li><a href="/events/xml/download/<?php echo $this->data['Event']['id'];?>">Download as XML</a></li>
<li><a href="/events/downloadOpenIOCEvent/<?php echo $this->data['Event']['id'];?>">Download as IOC</a></li>
<li class="divider"></li>
<li><a href="/events/index">List Events</a></li>
<?php if ($isAclAdd): ?>