From 39e99554c9c1162b78bff7c184361732ae0dd901 Mon Sep 17 00:00:00 2001 From: iglocska Date: Wed, 26 Jun 2013 17:20:56 +0200 Subject: [PATCH] Views updated to include CSV in the menues - CSV and also IOC downloads on events are now hidden if the event is not published --- app/Controller/AttributesController.php | 2 ++ app/Controller/EventsController.php | 4 ++++ app/Controller/LogsController.php | 7 ++++--- app/View/Attributes/add.ctp | 5 ++++- app/View/Attributes/add_attachment.ctp | 5 ++++- app/View/Events/add_i_o_c.ctp | 3 +++ app/View/Events/contact.ctp | 3 +++ app/View/Events/edit.ctp | 3 +++ app/View/Events/view.ctp | 3 +++ app/View/Logs/event_index.ctp | 3 +++ 10 files changed, 33 insertions(+), 5 deletions(-) diff --git a/app/Controller/AttributesController.php b/app/Controller/AttributesController.php index c7f77388c..ef2d51206 100755 --- a/app/Controller/AttributesController.php +++ b/app/Controller/AttributesController.php @@ -237,6 +237,7 @@ class AttributesController extends AppController { $this->set('attrDescriptions', $this->Attribute->fieldDescriptions); $this->set('typeDefinitions', $this->Attribute->typeDefinitions); $this->set('categoryDefinitions', $this->Attribute->categoryDefinitions); + $this->set('published', $events['Event']['published']); } public function download($id = null) { @@ -439,6 +440,7 @@ class AttributesController extends AppController { $this->set('distributionLevels', $this->Event->distributionLevels); $events = $this->Event->findById($eventId); $this->set('currentDist', $events['Event']['distribution']); + $this->set('published', $events['Event']['published']); } /** diff --git a/app/Controller/EventsController.php b/app/Controller/EventsController.php index a940de33e..138c0b82e 100755 --- a/app/Controller/EventsController.php +++ b/app/Controller/EventsController.php @@ -422,6 +422,10 @@ class EventsController extends AppController { // set the id $this->set('id', $id); + $this->Event->recursive = -1; + $this->Event->read(null, $id); + // set whether it is published or not + $this->set('published', $this->Event->data['Event']['published']); // tooltip for risk $this->set('riskDescriptions', $this->Event->riskDescriptions); diff --git a/app/Controller/LogsController.php b/app/Controller/LogsController.php index 87436832f..ae07e4246 100755 --- a/app/Controller/LogsController.php +++ b/app/Controller/LogsController.php @@ -63,11 +63,11 @@ class LogsController extends AppController { // check if the user has access to this event... $mayModify = false; $mineOrAdmin = false; + $this->loadModel('Event'); + $this->Event->recursive = -1; + $this->Event->read(null, $id); // send unauthorised people away. Only site admins and users of the same org may see events that are "your org only". Everyone else can proceed for all other levels of distribution if ($this->Auth->user('org') != 'ADMIN') { - $this->loadModel('Event'); - $this->Event->recursive = -1; - $this->Event->read(null, $id); if ($this->Event->data['Event']['distribution'] == 0) { if ($this->Event->data['Event']['org'] != $this->Auth->user('org')) { $this->Session->setFlash(__('You don\'t have access to view this event.')); @@ -79,6 +79,7 @@ class LogsController extends AppController { } else { $mineOrAdmin = true; } + $this->set('published', $this->Event->data['Event']['published']); if ($mineOrAdmin && $this->checkAction('perm_modify')) $mayModify = true; // get a list of the attributes that belong to the event $this->loadModel('Attribute'); diff --git a/app/View/Attributes/add.ctp b/app/View/Attributes/add.ctp index 4bdfe9ec3..531d113ed 100755 --- a/app/View/Attributes/add.ctp +++ b/app/View/Attributes/add.ctp @@ -58,7 +58,10 @@ echo $this->Form->end();
  • Contact Reporter
  • Download as XML
  • -
  • Download as IOC
  • + +
  • Download as IOC
  • +
  • Download as CSV
  • +
  • List Events
  • diff --git a/app/View/Attributes/add_attachment.ctp b/app/View/Attributes/add_attachment.ctp index 6b14636bb..3f447689c 100755 --- a/app/View/Attributes/add_attachment.ctp +++ b/app/View/Attributes/add_attachment.ctp @@ -56,7 +56,10 @@ echo $this->Form->end();
  • Contact Reporter
  • Download as XML
  • -
  • Download as IOC
  • + +
  • Download as IOC
  • +
  • Download as CSV
  • +
  • List Events
  • diff --git a/app/View/Events/add_i_o_c.ctp b/app/View/Events/add_i_o_c.ctp index 0e30ca87b..7f1bba69a 100644 --- a/app/View/Events/add_i_o_c.ctp +++ b/app/View/Events/add_i_o_c.ctp @@ -32,7 +32,10 @@ echo $this->Form->end();
  • Contact Reporter
  • Download as XML
  • +
  • Download as IOC
  • +
  • Download as CSV
  • +
  • List Events
  • diff --git a/app/View/Events/contact.ctp b/app/View/Events/contact.ctp index 75f330e00..4a50a80bb 100755 --- a/app/View/Events/contact.ctp +++ b/app/View/Events/contact.ctp @@ -51,7 +51,10 @@ $mayPublish = ($isAclPublish && $this->request->data['Event']['orgc'] == $me['or
  • Contact Reporter
  • Download as XML
  • + data['Event']['published']): ?>
  • Download as IOC
  • +
  • Download as CSV
  • +
  • List Events
  • diff --git a/app/View/Events/edit.ctp b/app/View/Events/edit.ctp index d84486f08..29c06c160 100755 --- a/app/View/Events/edit.ctp +++ b/app/View/Events/edit.ctp @@ -46,7 +46,10 @@ echo $this->Form->end();
  • Contact Reporter
  • Download as XML
  • + request->data['Event']['published']): ?>
  • Download as IOC
  • +
  • Download as CSV
  • +
  • List Events
  • diff --git a/app/View/Events/view.ctp b/app/View/Events/view.ctp index 374de6a54..607d2ab0b 100755 --- a/app/View/Events/view.ctp +++ b/app/View/Events/view.ctp @@ -26,7 +26,10 @@ $mayPublish = ($isAclPublish && $event['Event']['orgc'] == $me['org']);
  • Contact Reporter
  • Download as XML
  • +
  • Download as IOC
  • +
  • Download as CSV
  • +
  • List Events
  • diff --git a/app/View/Logs/event_index.ctp b/app/View/Logs/event_index.ctp index cd925c840..717cd8893 100644 --- a/app/View/Logs/event_index.ctp +++ b/app/View/Logs/event_index.ctp @@ -67,7 +67,10 @@
  • Contact reporter
  • Download as XML
  • +
  • Download as IOC
  • +
  • Download as CSV
  • +
  • List Events