diff --git a/application/controllers/ProcessController.php b/application/controllers/ProcessController.php index 098f96e..2301dba 100644 --- a/application/controllers/ProcessController.php +++ b/application/controllers/ProcessController.php @@ -2,10 +2,27 @@ use Icinga\Module\Businessprocess\Controller; use Icinga\Module\Businessprocess\Storage\LegacyStorage; -use Exception; +use \Exception; class Businessprocess_ProcessController extends Controller { + public function downloadAction() + { + $bp = $this->loadBp(); + header( + sprintf( + 'Content-Disposition: attachment; filename="%s.conf";', + $bp->getName() + ) + ); + header('Content-Type: text/plain'); + + echo $bp->toLegacyConfigString(); + // Didn't have time to lookup how to correctly disable our renderers + // TODO: no exit :) + exit; + } + public function showAction() { if ($this->getRequest()->isPost()) { diff --git a/application/views/scripts/downloadlink.phtml b/application/views/scripts/downloadlink.phtml new file mode 100644 index 0000000..4575343 --- /dev/null +++ b/application/views/scripts/downloadlink.phtml @@ -0,0 +1,4 @@ + icon('download') ?> + diff --git a/application/views/scripts/process/show.phtml b/application/views/scripts/process/show.phtml index ed8562e..b51d1d7 100644 --- a/application/views/scripts/process/show.phtml +++ b/application/views/scripts/process/show.phtml @@ -5,6 +5,7 @@ icon('dashboard') ?> render('simulationlink.phtml') ?> render('editlink.phtml') ?> + render('downloadlink.phtml') ?> diff --git a/application/views/scripts/process/toplevel.phtml b/application/views/scripts/process/toplevel.phtml index 2589e15..126e349 100644 --- a/application/views/scripts/process/toplevel.phtml +++ b/application/views/scripts/process/toplevel.phtml @@ -13,10 +13,12 @@ if ($count < 20) { ?> compact): ?>
+tabs ?>

escape($this->title) ?> icon('sitemap') ?> render('simulationlink.phtml') ?> render('editlink.phtml') ?> + render('downloadlink.phtml') ?>