mirror of https://github.com/MISP/MISP
Publish button now loads a popover similar to the attribute delete buttons
parent
03e43e9824
commit
2b85d1861d
|
@ -1235,6 +1235,10 @@ class EventsController extends AppController {
|
|||
$this->Session->setFlash(__('Job queued.'));
|
||||
}
|
||||
$this->redirect(array('action' => 'view', $id));
|
||||
} else {
|
||||
$this->set('id', $id);
|
||||
$this->set('type', 'publish');
|
||||
$this->render('ajax/eventPublishConfirmationForm');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1293,6 +1297,10 @@ class EventsController extends AppController {
|
|||
$this->Session->setFlash(__('Sending of email failed', true), 'default', array(), 'error');
|
||||
}
|
||||
$this->redirect(array('action' => 'view', $id));
|
||||
} else {
|
||||
$this->set('id', $id);
|
||||
$this->set('type', 'alert');
|
||||
$this->render('ajax/eventPublishConfirmationForm');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -39,8 +39,8 @@
|
|||
if (isset($event['Event']['published']) && 0 == $event['Event']['published'] && ($isAdmin || (isset($mayPublish) && $mayPublish))) $publishButtons = "";
|
||||
if (isset($event['Event']['published']) && $event['Event']['published']) $exportButtons = "";
|
||||
?>
|
||||
<li<?php echo $publishButtons; ?> class="publishButtons"><?php echo $this->Form->postLink('Publish Event', array('controller' => 'events', 'action' => 'alert', $event['Event']['id']), null, 'Are you sure this event is complete and everyone should be informed?'); ?></li>
|
||||
<li<?php echo $publishButtons; ?> class="publishButtons"><?php echo $this->Form->postLink('Publish (no email)', array('controller' => 'events', 'action' => 'publish', $event['Event']['id']), null, 'Publish but do NOT send alert email? Only for minor changes!'); ?></li>
|
||||
<li<?php echo $publishButtons; ?> class="publishButtons"><a href="#" onClick="publishPopup('<?php echo $event['Event']['id']; ?>', 'alert')">Publish Event</a></li>
|
||||
<li<?php echo $publishButtons; ?> class="publishButtons"><a href="#" onClick="publishPopup('<?php echo $event['Event']['id']; ?>', 'publish')">Publish (no email)</a></li>
|
||||
|
||||
<li <?php if ($menuItem === 'contact') echo '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>
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
<div class="confirmation">
|
||||
<?php
|
||||
echo $this->Form->create('Event', array('style' => 'margin:0px;', 'id' => 'PromptForm', 'url' => '/events/' . $type . '/' . $id));
|
||||
$extraTitle = "";
|
||||
if ($type == 'publish') $extraTitle = ' (no email)';
|
||||
?>
|
||||
<legend>Publish Event<?php echo $extraTitle; ?></legend>
|
||||
<div style="padding-left:5px;padding-right:5px;padding-bottom:5px;">
|
||||
<?php if ($type == 'alert'): ?>
|
||||
<p>Are you sure this event is complete and everyone should be informed?</p>
|
||||
<?php else: ?>
|
||||
<p>Publish but do NOT send alert email? Only for minor changes!</p>
|
||||
<?php endif; ?>
|
||||
<table>
|
||||
<tr>
|
||||
<td style="vertical-align:top">
|
||||
<span id="PromptYesButton" class="btn btn-primary" onClick="submitPublish()">Yes</span>
|
||||
</td>
|
||||
<td style="width:540px;">
|
||||
</td>
|
||||
<td style="vertical-align:top;">
|
||||
<span class="btn btn-inverse" id="PromptNoButton" onClick="cancelPrompt();">No</span>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<?php
|
||||
echo $this->Form->end();
|
||||
?>
|
||||
</div>
|
|
@ -9,6 +9,21 @@ function deleteObject(type, action, id, event) {
|
|||
});
|
||||
}
|
||||
|
||||
function publishPopup(id, type) {
|
||||
var action = "alert";
|
||||
if (type == "publish") action = "publish";
|
||||
var destination = 'attributes';
|
||||
$.get( "/events/" + action + "/" + id, function(data) {
|
||||
$("#confirmation_box").fadeIn();
|
||||
$("#gray_out").fadeIn();
|
||||
$("#confirmation_box").html(data);
|
||||
});
|
||||
}
|
||||
|
||||
function submitPublish(id, type) {
|
||||
$("#PromptForm").submit();
|
||||
}
|
||||
|
||||
function editTemplateElement(type, id) {
|
||||
$.get( "/template_elements/edit/" + type + "/" + id, function(data) {
|
||||
$("#popover_form").fadeIn();
|
||||
|
|
Loading…
Reference in New Issue