Use better icons for resource and auth views

refs #9908
This commit is contained in:
Matthias Jentsch 2015-08-17 11:27:41 +02:00
parent 93f8297344
commit d51ecc3d72
6 changed files with 53 additions and 9 deletions

View File

@ -332,7 +332,7 @@ class ConfigController extends Controller
public function resourceAction() public function resourceAction()
{ {
$this->assertPermission('config/application/resources'); $this->assertPermission('config/application/resources');
$this->view->resources = Config::app('resources', true)->keys(); $this->view->resources = Config::app('resources', true);
$this->createApplicationTabs()->activate('resource'); $this->createApplicationTabs()->activate('resource');
} }

View File

@ -35,7 +35,7 @@ class UsergroupbackendController extends Controller
*/ */
public function listAction() public function listAction()
{ {
$this->view->backendNames = Config::app('groups')->keys(); $this->view->backendNames = Config::app('groups');
$this->createListTabs()->activate('usergroupbackend'); $this->createListTabs()->activate('usergroupbackend');
} }

View File

@ -3,6 +3,7 @@
namespace Icinga\Forms\Config; namespace Icinga\Forms\Config;
use Icinga\Application\Config;
use Icinga\Forms\ConfigForm; use Icinga\Forms\ConfigForm;
use Icinga\Exception\NotFoundError; use Icinga\Exception\NotFoundError;
use Icinga\Web\Notification; use Icinga\Web\Notification;
@ -28,6 +29,16 @@ class UserBackendReorderForm extends ConfigForm
return $this->config->keys(); return $this->config->keys();
} }
/**
* Return the ordered backend configuration
*
* @return Config
*/
public function getConfig()
{
return $this->config;
}
/** /**
* Create and add elements to this form * Create and add elements to this form
* *

View File

@ -11,15 +11,38 @@
<th style="width: 5em"><?= $this->translate('Remove'); ?></th> <th style="width: 5em"><?= $this->translate('Remove'); ?></th>
</thead> </thead>
<tbody> <tbody>
<?php foreach ($this->resources as $name): ?> <?php foreach ($this->resources as $name => $value): ?>
<tr> <tr>
<td> <td>
<?php
switch ($value->type) {
case 'db':
$icon = 'database';
break;
case 'ldap':
$icon = 'sitemap';
break;
case 'livestatus':
$icon = 'flash';
break;
case 'ssh':
$icon = 'user';
break;
case 'file':
case 'ini':
$icon = 'doc-text';
break;
default:
$icon = 'edit';
break;
}
?>
<?= $this->qlink( <?= $this->qlink(
$name, $name,
'config/editresource', 'config/editresource',
array('resource' => $name), array('resource' => $name),
array( array(
'icon' => 'edit', 'icon' => $icon,
'title' => sprintf($this->translate('Edit resource %s'), $name) 'title' => sprintf($this->translate('Edit resource %s'), $name)
) )
); ?> ); ?>

View File

@ -6,8 +6,12 @@
<th style="width: 5em"><?= $this->translate('Order'); ?></th> <th style="width: 5em"><?= $this->translate('Order'); ?></th>
</thead> </thead>
<tbody> <tbody>
<?php $backendNames = $form->getBackendOrder(); ?> <?php
<?php for ($i = 0; $i < count($backendNames); $i++): ?> $backendNames = $form->getBackendOrder();
$backendConfigs = $form->getConfig();
for ($i = 0; $i < count($backendNames); $i++):
$type = $backendConfigs->getSection($backendNames[$i])->get('backend');
?>
<tr> <tr>
<td class="action"> <td class="action">
<?= $this->qlink( <?= $this->qlink(
@ -15,7 +19,8 @@
'config/edituserbackend', 'config/edituserbackend',
array('backend' => $backendNames[$i]), array('backend' => $backendNames[$i]),
array( array(
'icon' => 'edit', 'icon' => $type === 'external' ?
'magic' : ($type === 'ldap' || $type === 'msldap' ? 'sitemap' : 'database'),
'class' => 'rowaction', 'class' => 'rowaction',
'title' => sprintf($this->translate('rEdit user backend %s'), $backendNames[$i]) 'title' => sprintf($this->translate('rEdit user backend %s'), $backendNames[$i])
) )

View File

@ -19,14 +19,19 @@
<tr> <tr>
</thead> </thead>
<tbody> <tbody>
<?php foreach ($backendNames as $backendName): ?> <?php foreach ($backendNames as $backendName => $config):
$type = $config->get('backend');
?>
<tr> <tr>
<td class="backend-name"> <td class="backend-name">
<?= $this->qlink( <?= $this->qlink(
$backendName, $backendName,
'usergroupbackend/edit', 'usergroupbackend/edit',
array('backend' => $backendName), array('backend' => $backendName),
array('title' => sprintf($this->translate('Edit user group backend %s'), $backendName)) array(
'icon' => $type === 'external' ? 'magic' : ($type === 'ldap' || $type === 'msldap' ? 'sitemap' : 'database'),
'title' => sprintf($this->translate('Edit user group backend %s'), $backendName)
)
); ?> ); ?>
</td> </td>
<td class="backend-remove"><?= $this->qlink( <td class="backend-remove"><?= $this->qlink(