mirror of https://github.com/MISP/MISP
chg: [attribute row] to_ids flag edition is done with a checkbox +
prompt. Previously, was a select.pull/4237/head
parent
ecc8c5f2bf
commit
3f292458ec
|
@ -3284,6 +3284,12 @@ class AttributesController extends AppController
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function toggleToIDS($id)
|
||||||
|
{
|
||||||
|
return $this->fetchEditForm($id, 'to_ids');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public function checkAttachments()
|
public function checkAttachments()
|
||||||
{
|
{
|
||||||
$attributes = $this->Attribute->find(
|
$attributes = $this->Attribute->find(
|
||||||
|
|
|
@ -1,20 +1,39 @@
|
||||||
<?php
|
<div class="confirmation">
|
||||||
echo $this->Form->create('Attribute', array('class' => 'inline-form inline-field-form', 'id' => 'Attribute' . '_' . $object['id'] . '_to_ids_form', 'url' => '/attributes/editField/' . $object['id']));
|
<?php
|
||||||
?>
|
echo $this->Form->create('Attribute', array('style' => 'margin:0px;', 'id' => 'PromptForm', 'url' => '/attributes/editField/' . $object['id']));
|
||||||
<div class='inline-input inline-input-container'>
|
|
||||||
<div class="inline-input-accept inline-input-button inline-input-passive"><span class = "icon-ok" role="button" tabindex="0" aria-label="<?php echo __('Accept change'); ?>"></span></div>
|
|
||||||
<div class="inline-input-decline inline-input-button inline-input-passive"><span class = "icon-remove" role="button" tabindex="0" aria-label="<?php echo __('Discard change'); ?>"></span></div>
|
|
||||||
<?php
|
|
||||||
$current = 0;
|
|
||||||
if ($object['to_ids']) $current = 1;
|
|
||||||
echo $this->Form->input('to_ids', array(
|
echo $this->Form->input('to_ids', array(
|
||||||
'options' => array(0 => 'No', 1 => 'Yes'),
|
'options' => array(0 => 'No', 1 => 'Yes'),
|
||||||
'label' => false,
|
'label' => false,
|
||||||
'selected' => $current,
|
'selected' => !$object['to_ids'],
|
||||||
'class' => 'inline-input',
|
'class' => 'hidden',
|
||||||
'id' => 'Attribute' . '_' . $object['id'] . '_to_ids_field',
|
'id' => 'Attribute' . '_' . $object['id'] . '_to_ids_field',
|
||||||
'div' => false
|
'div' => false
|
||||||
));
|
));
|
||||||
echo $this->Form->end();
|
?>
|
||||||
?>
|
<legend><?php echo __('Toggle IDS flag %s ', !$object['to_ids'] ? __('on') : __('off'));?></legend>
|
||||||
|
<div style="padding-left:5px;padding-right:5px;padding-bottom:5px;">
|
||||||
|
<p>
|
||||||
|
<?php
|
||||||
|
if (!$object['to_ids']) {
|
||||||
|
echo __('Set the IDS flag for this attribute.');
|
||||||
|
} else {
|
||||||
|
echo __('Unset the IDS flag for this attribute.');
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</p>
|
||||||
|
<table>
|
||||||
|
<tr>
|
||||||
|
<td style="vertical-align:top">
|
||||||
|
|
||||||
|
<span id="PromptYesButton" title="<?php echo __('Toggle IDS flag for attribute'); ?>" role="button" tabindex="0" aria-label="<?php echo __('Toggle IDS flag for attribute'); ?>" class="btn btn-primary" onClick="toggleToIDS(<?php echo h($object['id']); ?>, 1);"><?php echo __('Yes'); ?></span>
|
||||||
|
</td>
|
||||||
|
<td style="width:540px;">
|
||||||
|
</td>
|
||||||
|
<td style="vertical-align:top;">
|
||||||
|
<span class="btn btn-inverse" title="<?php echo __('Cancel'); ?>" role="button" tabindex="0" aria-label="<?php echo __('Cancel'); ?>" id="PromptNoButton" onClick="cancelPrompt();"><?php echo __('No'); ?></span>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
<?php echo $this->Form->end(); ?>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -180,6 +180,11 @@ $(document).ready(function () {
|
||||||
getPopup(attribute_id, 'attributes', 'toggleCorrelation', '', '#confirmation_box');
|
getPopup(attribute_id, 'attributes', 'toggleCorrelation', '', '#confirmation_box');
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
$('.toids-toggle').click(function() {
|
||||||
|
var attribute_id = $(this).data('attribute-id');
|
||||||
|
getPopup(attribute_id, 'attributes', 'toggleToIDS', '', '#confirmation_box');
|
||||||
|
return false;
|
||||||
|
});
|
||||||
popoverStartup();
|
popoverStartup();
|
||||||
$(document).on('click', function (e) {
|
$(document).on('click', function (e) {
|
||||||
//did not click a popover toggle or popover
|
//did not click a popover toggle or popover
|
||||||
|
|
|
@ -304,10 +304,10 @@
|
||||||
?>
|
?>
|
||||||
</ul>
|
</ul>
|
||||||
</td>
|
</td>
|
||||||
<td class="short" onmouseenter="quickEditHover(this, '<?php echo $editScope; ?>', '<?php echo $object['id']; ?>', 'to_ids', <?php echo $event['Event']['id'];?>);">
|
<td class="short">
|
||||||
<div id = "Attribute_<?php echo $object['id']; ?>_to_ids_placeholder" class = "inline-field-placeholder"></div>
|
<div id = "Attribute_<?php echo $object['id']; ?>_to_ids_placeholder" class = "inline-field-placeholder"></div>
|
||||||
<div id = "Attribute_<?php echo $object['id']; ?>_to_ids_solid" class="inline-field-solid">
|
<div id = "Attribute_<?php echo $object['id']; ?>_to_ids_solid" class="inline-field-solid">
|
||||||
<input type="checkbox" <?php echo $object['to_ids'] ? 'checked' : ''; ?> disabled></input>
|
<input type="checkbox" class="toids-toggle" id="toids_toggle_<?php echo h($object['id']); ?>" data-attribute-id="<?php echo h($object['id']); ?>" <?php echo $object['to_ids'] ? 'checked' : ''; ?> ></input>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td class="short" onmouseenter="quickEditHover(this, '<?php echo $editScope; ?>', '<?php echo $object['id']; ?>', 'distribution', <?php echo $event['Event']['id'];?>);">
|
<td class="short" onmouseenter="quickEditHover(this, '<?php echo $editScope; ?>', '<?php echo $object['id']; ?>', 'distribution', <?php echo $event['Event']['id'];?>);">
|
||||||
|
|
|
@ -296,6 +296,11 @@ attributes or the appropriate distribution level. If you think there is a mistak
|
||||||
getPopup(attribute_id, 'attributes', 'toggleCorrelation', '', '#confirmation_box');
|
getPopup(attribute_id, 'attributes', 'toggleCorrelation', '', '#confirmation_box');
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
$('.toids-toggle').click(function() {
|
||||||
|
var attribute_id = $(this).data('attribute-id');
|
||||||
|
getPopup(attribute_id, 'attributes', 'toggleToIDS', '', '#confirmation_box');
|
||||||
|
return false;
|
||||||
|
});
|
||||||
$('.screenshot').click(function() {
|
$('.screenshot').click(function() {
|
||||||
screenshotPopup($(this).attr('src'), $(this).attr('title'));
|
screenshotPopup($(this).attr('src'), $(this).attr('title'));
|
||||||
});
|
});
|
||||||
|
|
|
@ -324,6 +324,30 @@ function toggleCorrelation(id, skip_reload) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function toggleToIDS(id, skip_reload) {
|
||||||
|
if (typeof skip_reload === "undefined") {
|
||||||
|
skip_reload = false;
|
||||||
|
}
|
||||||
|
$.ajax({
|
||||||
|
beforeSend: function (XMLHttpRequest) {
|
||||||
|
$(".loading").show();
|
||||||
|
},
|
||||||
|
data: $('#PromptForm').serialize(),
|
||||||
|
success:function (data, textStatus) {
|
||||||
|
handleGenericAjaxResponse(data, skip_reload);
|
||||||
|
$("#toids_toggle_" + id).prop('checked', !$("#toids_toggle_" + id).is(':checked'));
|
||||||
|
},
|
||||||
|
complete:function() {
|
||||||
|
$(".loading").hide();
|
||||||
|
$("#confirmation_box").fadeOut();
|
||||||
|
$("#gray_out").fadeOut();
|
||||||
|
},
|
||||||
|
type:"post",
|
||||||
|
cache: false,
|
||||||
|
url:'/attributes/editField/' + id ,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
function eventUnpublish() {
|
function eventUnpublish() {
|
||||||
$('.publishButtons').show();
|
$('.publishButtons').show();
|
||||||
$('.exportButtons').hide();
|
$('.exportButtons').hide();
|
||||||
|
|
Loading…
Reference in New Issue