process/show: provide a download link

refs #8578
This commit is contained in:
Thomas Gelf 2015-03-03 17:38:40 +01:00
parent e6f04c0e2a
commit b089509f03
4 changed files with 25 additions and 1 deletions

View file

@ -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()) {

View file

@ -0,0 +1,4 @@
<a href="<?= $this->url('businessprocess/process/download', array(
'process' => $this->processName
)) ?>" target="_self" title="<?= $this->escape('Download process configuration') ?>"><?= $this->icon('download') ?></a>

View file

@ -5,6 +5,7 @@
<a href="<?= $this->url()->with('mode', 'toplevel') ?>" title="<?= $this->escape('Switch to toplevel view') ?>"><?= $this->icon('dashboard') ?></a>
<?= $this->render('simulationlink.phtml') ?>
<?= $this->render('editlink.phtml') ?>
<?= $this->render('downloadlink.phtml') ?>
</h1>
</div>
<?php endif ?>

View file

@ -13,10 +13,12 @@ if ($count < 20) {
?>
<?php if (! $this->compact): ?>
<div class="controls">
<?= $this->tabs ?>
<h1><?= $this->escape($this->title) ?>
<a href="<?= $this->url()->without('mode') ?>" title="<?= $this->escape('Switch to tree view') ?>" style="float: right"><?= $this->icon('sitemap') ?></a>
<?= $this->render('simulationlink.phtml') ?>
<?= $this->render('editlink.phtml') ?>
<?= $this->render('downloadlink.phtml') ?>
</h1>
</div>
<?php endif ?>