mirror of https://github.com/MISP/MISP
new: [attackMatrix] Skeleton of multiple galaxy picking
parent
7ca59a852f
commit
4730938e5f
|
@ -156,6 +156,16 @@ class GalaxiesController extends AppController {
|
|||
$this->redirect($this->referer());
|
||||
}
|
||||
|
||||
public function attachMultipleClusters($target_id, $target_type = 'event') {
|
||||
$cluster_ids = json_decode($this->request->data['Galaxy']['target_ids'], true);
|
||||
$result = ""; // temp
|
||||
foreach($cluster_ids as $cluster_id) {
|
||||
$result .= $this->Galaxy->attachCluster($this->Auth->user(), $target_type, $target_id, $cluster_id);
|
||||
}
|
||||
$this->Flash->info($result);
|
||||
$this->redirect($this->referer());
|
||||
}
|
||||
|
||||
public function viewGraph($id) {
|
||||
$cluster = $this->Galaxy->GalaxyCluster->find('first', array(
|
||||
'conditions' => array('GalaxyCluster.id' => $id),
|
||||
|
|
|
@ -186,6 +186,7 @@ class Galaxy extends AppModel{
|
|||
),
|
||||
'recursive' => -1
|
||||
));
|
||||
debug(array('attribute_id' => $target_id, 'tag_id' => $tag_id, 'event_id' => $attribute['Attribute']['event_id']));
|
||||
$result = $this->Tag->AttributeTag->save(array('attribute_id' => $target_id, 'tag_id' => $tag_id, 'event_id' => $attribute['Attribute']['event_id']));
|
||||
}
|
||||
if ($result) {
|
||||
|
|
|
@ -280,7 +280,7 @@ attributes or the appropriate distribution level. If you think there is a mistak
|
|||
var deleted = <?php echo (isset($deleted) && $deleted) ? 'true' : 'false';?>;
|
||||
$(document).ready(function() {
|
||||
$('.addGalaxy').click(function() {
|
||||
addGalaxyListener();
|
||||
addGalaxyListener(this);
|
||||
});
|
||||
<?php
|
||||
if ($focusedRow !== false):
|
||||
|
|
|
@ -10,8 +10,10 @@ foreach($attackTactic as $tactic):
|
|||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="attack-matrix-options matrix-div-search">
|
||||
<input type="text" id="pick-matrix-elem" placeholder="Pick item" style="margin-right: 0px;">
|
||||
<!--<div class="attack-matrix-options matrix-div-search">-->
|
||||
<div class="attack-matrix-options matrix-div-submit">
|
||||
<!--<input type="text" id="pick-matrix-elem" placeholder="<?php echo _('Highlight item'); ?>" style="margin-right: 0px;">-->
|
||||
<span class="btn btn-inverse btn-matrix-submit" role="button" style="padding: 1px 5px !important;font-size: 12px !important;font-weight: bold;"><?php echo _('Submit'); ?></span>
|
||||
</div>
|
||||
|
||||
<div class="attack-matrix-options">
|
||||
|
@ -30,8 +32,8 @@ foreach($attackTactic as $tactic):
|
|||
<?php if($pickingMode): ?>
|
||||
<div class="hidden">
|
||||
<?php
|
||||
echo $this->Form->create('Galaxy', array('url' => '/galaxies/attachCluster/' . $target_id . '/' . (empty($target_type) ? 'attribute' : $target_type), 'style' => 'margin:0px;'));
|
||||
echo $this->Form->input('target_id', array('type' => 'text'));
|
||||
echo $this->Form->create('Galaxy', array('url' => '/galaxies/attachMultipleClusters/' . $target_id . '/' . (empty($target_type) ? 'attribute' : $target_type), 'style' => 'margin:0px;'));
|
||||
echo $this->Form->input('target_ids', array('type' => 'text'));
|
||||
echo $this->Form->end();
|
||||
?>
|
||||
</div>
|
||||
|
|
|
@ -33,6 +33,13 @@ td.matrix-interaction:hover {
|
|||
color: white;
|
||||
}
|
||||
|
||||
td.matrix-interaction.cell-picked {
|
||||
border: solid #a00b03;
|
||||
background-color: #6f6f6f;
|
||||
color: white;
|
||||
}
|
||||
|
||||
|
||||
.fixed-table-container-inner {
|
||||
overflow-x: hidden;
|
||||
overflow-y: auto;
|
||||
|
@ -154,3 +161,11 @@ li.tactic.active {
|
|||
padding-right: 1px;
|
||||
display: none;
|
||||
}
|
||||
|
||||
.matrix-div-submit {
|
||||
left: 50%;
|
||||
padding-left: 1px;
|
||||
right: unset;
|
||||
padding-right: 1px;
|
||||
display: none;
|
||||
}
|
||||
|
|
|
@ -21,14 +21,35 @@
|
|||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
var pickedGalaxies = [];
|
||||
|
||||
$('#attack-matrix-tabscontroller span').off('click.tab').on('click.tab', function (e) {
|
||||
$(this).tab('show');
|
||||
})
|
||||
|
||||
// form
|
||||
$('.ajax_popover_form .cell-picking input').off('click.picking').on('click.picking', function(event) {
|
||||
event.stopPropagation();
|
||||
});
|
||||
$('.ajax_popover_form .cell-picking').off('click.picking').on('click.picking', function() {
|
||||
// sumbit galaxy
|
||||
$('#GalaxyTargetId').val($(this).data('cluster-id'));
|
||||
if (!$(this).hasClass('cell-picked')) {
|
||||
pickedGalaxies.push($(this).data('cluster-id'));
|
||||
$(this).addClass('cell-picked');
|
||||
} else { // remove class and data from array
|
||||
var i = pickedGalaxies.indexOf($(this).data('cluster-id'));
|
||||
if (i > -1) {
|
||||
pickedGalaxies.splice(i, 1);
|
||||
}
|
||||
$(this).removeClass('cell-picked');
|
||||
}
|
||||
//$('#GalaxyTargetId').val($(this).data('cluster-id'));
|
||||
//$('#GalaxyViewMitreAttackMatrixForm').submit();
|
||||
//cancelPopoverForm('#popover_form_large');
|
||||
});
|
||||
$('.ajax_popover_form .matrix-div-submit').css('display', 'block');
|
||||
$('.ajax_popover_form .btn-matrix-submit').click(function() {
|
||||
$('#GalaxyTargetIds').val(JSON.stringify(pickedGalaxies));
|
||||
$('#GalaxyViewMitreAttackMatrixForm').submit();
|
||||
cancelPopoverForm('#popover_form_large');
|
||||
});
|
||||
|
@ -38,7 +59,7 @@
|
|||
scoredCells.hover(function() { enteringScoredCell($(this), '.ajax_popover_form'); }, function() { leavingScoredCell('.ajax_popover_form'); });
|
||||
$('.ajax_popover_form #checkbox_attackMatrix_showAll').off('click.showAll').on('click.showAll', function() { toggleAttackMatrixCells('.ajax_popover_form'); });
|
||||
$('#pick-matrix-elem').typeahead(typeaheadOptionMatrix);
|
||||
$('.ajax_popover_form .matrix-div-search').show()
|
||||
//$('.ajax_popover_form .matrix-div-search').show()
|
||||
|
||||
// info container
|
||||
$('.info_container_eventgraph_network .matrix-interaction').off('click.interaction').on('click.interaction', function(event) {
|
||||
|
|
|
@ -3088,9 +3088,10 @@ $('.galaxy-toggle-button').click(function() {
|
|||
}
|
||||
});
|
||||
|
||||
function addGalaxyListener() {
|
||||
var target_type = $(this).data('target-type');
|
||||
var target_id = $(this).data('target-id');
|
||||
function addGalaxyListener(that) {
|
||||
that = (that !== undefined) ? that : this;
|
||||
var target_type = $(that).data('target-type');
|
||||
var target_id = $(that).data('target-id');
|
||||
getPopup(target_type + '/' + target_id, 'galaxies', 'selectGalaxyNamespace');
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue