config/modules: prepare new view scripts

The controller is still pointing to the former view script, it will
soon be replaced by this ones. As soon as I created two forms handling
enable/disable requests this will be completed.

refs #4095
This commit is contained in:
Thomas Gelf 2014-05-26 14:38:03 +00:00
parent af41ae875d
commit 4f1b7f16e4
2 changed files with 97 additions and 0 deletions

View File

@ -0,0 +1,56 @@
<div class="controls">
<?= $this->tabs ?>
</div>
<div class="content">
<?php if (! $module): ?>
<?= $this->translate('There is no such module installed.') ?>
<? return; endif ?>
<?php
$dependencies = $module->getDependencies();
$restrictions = $module->getProvidedRestrictions();
$permissions = $module->getProvidedPermissions();
?>
<h1><?= $this->escape($module->getTitle()) ?></h1>
<table class="avp">
<tr>
<th><?= $this->escape('Name') ?></th>
<td><?= $this->escape($module->getName()) ?></td>
</tr>
<tr>
<th><?= $this->escape('Version') ?></th>
<td><?= $this->escape($module->getVersion()) ?></td></tr>
<tr>
<th><?= $this->escape('Description') ?></th>
<td><?= nl2br($this->escape($module->getDescription())) ?></td>
</tr>
<tr>
<th><?= $this->escape('Dependencies') ?></th>
<td><?php
if (empty($dependencies)):
echo $this->translate('This module has no dependencies');
else: foreach ($dependencies as $name => $versionString): ?>
<strong><?= $this->escape($name) ?></strong><?php if ($versionString !== true): ?>: <?= $this->escape($versionString) ?><?php endif ?><br />
<?php endforeach; endif ?></td>
</tr>
<?php if (! empty($permissions)): ?>
<tr>
<th><?= $this->escape('Permissions') ?></th>
<td><?php foreach ($permissions as $permission): ?>
<strong><?= $this->escape($permission->name) ?></strong>: <?= $this->escape($permission->description) ?><br />
<?php endforeach ?></td>
</tr>
<?php endif ?>
<?php if (! empty($restrictions)): ?>
<tr>
<th><?= $this->escape('Restrictions') ?></th>
<td><?php foreach ($restrictions as $restriction): ?>
<strong><?= $this->escape($restriction->name) ?></strong>: <?= $this->escape($restriction->description) ?><br />
<?php endforeach ?></td>
</tr>
<?php endif ?>
</table>
</div>

View File

@ -0,0 +1,41 @@
<?php
use Icinga\Web\Url;
$this->modules->limit(10);
$modules = $this->modules->paginate();
?>
<div class="controls">
<?= $this->tabs->render($this); ?>
</div>
<div class="content">
<h3>Installed Modules</h3>
<?php if (isset($this->messageBox)): ?>
<?= $this->messageBox->render() ?>
<?php endif ?>
<?= $this->paginationControl($modules, null, null, array(
'preserve' => $this->preserve
));
?>
<table class="action" data-base-target="_next">
<tbody>
<?php foreach ($modules as $module): ?>
<tr>
<td>
<?php if ($module->enabled): ?>
<?= $this->icon('success.png', 'Module is enabled') ?>
<?php else: ?>
<?= $this->icon('remove.png', 'Module is disabled') ?>
<? endif ?>
<a href="<?= $this->url('config/module/', array('name' => $module->name)) ?>"><?= $this->escape($module->name); ?></a>
(<?=
$module->enabled ? ($module->loaded ? 'enabled' : 'failed') : 'disabled' ?>)
</td>
</tr>
<? endforeach ?>
</tbody>
</table>
</div>