fix: Some fixes with the automatic publish/unpublish feedback

- automatically set the event to unpublished in the view when adding/removing tags
- officially the keep @RichieB2B happy patch ;)
pull/1784/head
iglocska 2016-12-22 17:46:52 +01:00
parent 4aec4e4beb
commit 672a681819
3 changed files with 5 additions and 6 deletions

View File

@ -4121,11 +4121,10 @@ class EventsController extends AppController {
}
public function checkPublishedStatus($id) {
$event = $this->Event->fetchEvent($this->Auth->user(), array('metadata' => 1, 'event_id' => $id));
$event = $this->Event->fetchEvent($this->Auth->user(), array('metadata' => 1, 'eventid' => $id));
if (empty($event)) {
throw new NotFoundException('Invalid event');
}
$this->set('current_event_published', $event[0]['Event']['published'] ? 1 : 0);
$this->set('_serialize', 'current_event_published');
return new CakeResponse(array('body'=> h($event[0]['Event']['published']), 'status'=>200));
}
}

View File

@ -52,8 +52,8 @@
if (isset($event['Event']['published']) && 0 == $event['Event']['published'] && ($isSiteAdmin || (isset($mayPublish) && $mayPublish))) $publishButtons = "";
if (isset($event['Event']['published']) && $event['Event']['published']) $exportButtons = "";
?>
<li<?php echo $publishButtons; ?> class="publishButtons"><a href="#" onClick="publishPopup('<?php echo h($event['Event']['id']); ?>', 'alert')">Publish Event</a></li>
<li<?php echo $publishButtons; ?> class="publishButtons"><a href="#" onClick="publishPopup('<?php echo h($event['Event']['id']); ?>', 'publish')">Publish (no email)</a></li>
<li<?php echo $publishButtons; ?> class="publishButtons not-published"><a href="#" onClick="publishPopup('<?php echo h($event['Event']['id']); ?>', 'alert')">Publish Event</a></li>
<li<?php echo $publishButtons; ?> class="publishButtons not-published"><a href="#" onClick="publishPopup('<?php echo h($event['Event']['id']); ?>', 'publish')">Publish (no email)</a></li>
<?php if (Configure::read('MISP.delegation')):?>
<?php if ((Configure::read('MISP.unpublishedprivate') || (isset($event['Event']['distribution']) && $event['Event']['distribution'] == 0)) && (!isset($delegationRequest) || !$delegationRequest) && ($isSiteAdmin || (isset($isAclDelegate) && $isAclDelegate))): ?>
<li id='lidelegateEvent'><a href="#" onClick="delegatePopup('<?php echo h($event['Event']['id']); ?>');">Delegate Publishing</a></li>

View File

@ -2721,7 +2721,7 @@ function quickSubmitGalaxyForm(event_id, cluster_id) {
function checkAndSetPublishedInfo() {
var id = $('#hiddenSideMenuData').data('event-id');
$.get( "/events/checkPublishedStatus/" + id + '.json', function(data) {
$.get( "/events/checkPublishedStatus/" + id, function(data) {
if (data == 1) {
$('.published').show();
$('.not-published').hide();