mirror of https://github.com/MISP/MISP
chg: [UI] Normalize delete event popup
parent
0feeefdc20
commit
ac4b195088
|
@ -2,10 +2,10 @@
|
|||
<tr>
|
||||
<?php if ($isSiteAdmin): ?>
|
||||
<th>
|
||||
<input class="select_all select" type="checkbox" title="<?php echo __('Select all');?>" role="button" tabindex="0" aria-label="<?php echo __('Select all events on current page');?>" onClick="toggleAllCheckboxes();" />
|
||||
<input class="select_all select" type="checkbox" title="<?php echo __('Select all');?>" role="button" tabindex="0" aria-label="<?php echo __('Select all events on current page');?>" onClick="toggleAllCheckboxes();">
|
||||
</th>
|
||||
<?php else: ?>
|
||||
<th style="padding-left:0px;padding-right:0px;"> </th>
|
||||
<th style="padding-left:0;padding-right:0;"> </th>
|
||||
<?php endif;?>
|
||||
<th class="filter">
|
||||
<?php echo $this->Paginator->sort('published');?>
|
||||
|
@ -49,7 +49,7 @@
|
|||
<tr id="event_<?= $eventId ?>">
|
||||
<?php if ($isSiteAdmin || ($event['Event']['orgc_id'] == $me['org_id'])):?>
|
||||
<td style="width:10px;">
|
||||
<input class="select" type="checkbox" data-id="<?= $eventId ?>" />
|
||||
<input class="select" type="checkbox" data-id="<?= $eventId ?>">
|
||||
</td>
|
||||
<?php else: ?>
|
||||
<td style="padding-left:0;padding-right:0;"></td>
|
||||
|
@ -171,12 +171,12 @@
|
|||
</td>
|
||||
<?php if (in_array('timestamp', $columns, true)): ?>
|
||||
<td class="short dblclickElement">
|
||||
<?= $this->Time->time($event['Event']['timestamp']) ?>
|
||||
<?= $this->Time->time($event['Event']['timestamp']) ?>
|
||||
</td>
|
||||
<?php endif; ?>
|
||||
<?php if (in_array('publish_timestamp', $columns, true)): ?>
|
||||
<td class="short dblclickElement">
|
||||
<?= $this->Time->time($event['Event']['publish_timestamp']) ?>
|
||||
<?= $this->Time->time($event['Event']['publish_timestamp']) ?>
|
||||
</td>
|
||||
<?php endif; ?>
|
||||
<td class="dblclickElement">
|
||||
|
@ -210,7 +210,7 @@
|
|||
?>
|
||||
<a href="<?php echo $baseurl."/events/edit/".$eventId ?>" title="<?php echo __('Edit');?>" aria-label="<?php echo __('Edit');?>"><i class="black fa fa-edit"></i></a>
|
||||
<?php
|
||||
echo sprintf('<a class="useCursorPointer fa fa-trash" title="%s" aria-label="%s" onclick="deleteEvent(%s)"></a>', __('Delete'), __('Delete'), $eventId);
|
||||
echo sprintf('<a class="useCursorPointer fa fa-trash" title="%s" aria-label="%s" onclick="deleteEventPopup(%s)"></a>', __('Delete'), __('Delete'), $eventId);
|
||||
endif;
|
||||
?>
|
||||
<a href="<?php echo $baseurl."/events/view/".$eventId ?>" title="<?php echo __('View');?>" aria-label="<?php echo __('View');?>"><i class="fa black fa-eye"></i></a>
|
||||
|
@ -239,15 +239,4 @@
|
|||
});
|
||||
});
|
||||
});
|
||||
|
||||
function deleteEvent(id) {
|
||||
var message = "<?= __('Are you sure you want to delete #') ?>" + id + "?"
|
||||
var url = '<?= $baseurl ?>/events/delete/' + id
|
||||
if (confirm(message)) {
|
||||
fetchFormDataAjax(url, function(formData) {
|
||||
$('body').append($('<div id="temp" class="hidden"/>').html(formData));
|
||||
$('#temp form').submit()
|
||||
})
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -98,10 +98,13 @@ $divider = $this->element('/genericElements/SideMenu/side_menu_divider');
|
|||
'url' => $baseurl . '/events/edit/' . $eventId,
|
||||
'text' => __('Edit Event')
|
||||
));
|
||||
echo $this->element('/genericElements/SideMenu/side_menu_post_link', array(
|
||||
echo $this->element('/genericElements/SideMenu/side_menu_link', array(
|
||||
'url' => $baseurl . '/events/delete/' . $eventId,
|
||||
'text' => __('Delete Event'),
|
||||
'message' => __('Are you sure you want to delete event #%s?', $eventId)
|
||||
'onClick' => array(
|
||||
'function' => 'deleteEventPopup',
|
||||
'params' => [$eventId]
|
||||
),
|
||||
));
|
||||
echo $this->element('/genericElements/SideMenu/side_menu_link', array(
|
||||
'element_id' => 'addAttribute',
|
||||
|
|
|
@ -899,10 +899,11 @@ function multiSelectDeleteEvents() {
|
|||
}
|
||||
}
|
||||
});
|
||||
$.get(baseurl + "/events/delete/" + JSON.stringify(selected), function(data) {
|
||||
$("#confirmation_box").html(data);
|
||||
openPopup("#confirmation_box");
|
||||
}).fail(xhrFailCallback);
|
||||
deleteEventPopup(JSON.stringify(selected));
|
||||
}
|
||||
|
||||
function deleteEventPopup(eventId) {
|
||||
$.get(baseurl + "/events/delete/" + eventId, openConfirmation).fail(xhrFailCallback);
|
||||
}
|
||||
|
||||
function multiSelectExportEvents() {
|
||||
|
@ -1673,6 +1674,12 @@ function templateElementFileCategoryChange(category) {
|
|||
}
|
||||
}
|
||||
|
||||
function openConfirmation(data) {
|
||||
var $box = $("#confirmation_box");
|
||||
$box.html(data);
|
||||
openPopup($box);
|
||||
}
|
||||
|
||||
function openPopup(id, adjust_layout, callback) {
|
||||
var $id = $(id);
|
||||
adjust_layout = adjust_layout === undefined ? true : adjust_layout;
|
||||
|
|
Loading…
Reference in New Issue