Add tab for create, update and remove user

refs #5543
This commit is contained in:
Eric Lippmann 2015-10-01 09:39:21 +02:00
parent cb46af8e9c
commit 631f5d8071
4 changed files with 37 additions and 35 deletions

View File

@ -162,8 +162,7 @@ class UserController extends AuthBackendController
$form->setRepository($backend);
$form->add()->handleRequest();
$this->view->form = $form;
$this->render('form');
$this->renderForm($form, $this->translate('New User'));
}
/**
@ -185,8 +184,7 @@ class UserController extends AuthBackendController
$this->httpNotFound(sprintf($this->translate('User "%s" not found'), $userName));
}
$this->view->form = $form;
$this->render('form');
$this->renderForm($form, $this->translate('Update User'));
}
/**
@ -208,8 +206,7 @@ class UserController extends AuthBackendController
$this->httpNotFound(sprintf($this->translate('User "%s" not found'), $userName));
}
$this->view->form = $form;
$this->render('form');
$this->renderForm($form, $this->translate('Remove User'));
}
/**

View File

@ -2,5 +2,5 @@
<?= $tabs ?>
</div>
<div class="content">
<?= $form->setTitle(null) ?>
<?= $form->create()->setTitle(null) // @TODO(el): create() has to be called because the UserForm is setting the title there ?>
</div>

View File

@ -29,11 +29,17 @@ $extensible = $this->hasPermission('config/authentication/users/add') && $backen
$reducible = $this->hasPermission('config/authentication/users/remove') && $backend instanceof Reducible;
?>
<?php if ($extensible): ?>
<?= $this->qlink($this->translate('Add a new user'), 'user/add', array('backend' => $backend->getName()), array(
'icon' => 'plus',
<?= $this->qlink(
$this->translate('Add a New User') ,
'user/add',
array('backend' => $backend->getName()),
array(
'class' => 'button-link',
'data-base-target' => '_next',
'class' => 'action-link button'
)) ?>
'icon' => 'plus',
'title' => $this->translate('Create a new user')
)
) ?>
<?php endif ?>
<table class="action-table listing-table" data-base-target="_next">
<thead>
@ -59,7 +65,7 @@ $reducible = $this->hasPermission('config/authentication/users/remove') && $back
)
) ?></td>
<?php if ($reducible): ?>
<td><?= $this->qlink(
<td class="icon-col"><?= $this->qlink(
null,
'user/remove',
array(
@ -67,8 +73,9 @@ $reducible = $this->hasPermission('config/authentication/users/remove') && $back
'user' => $user->user_name
),
array(
'title' => sprintf($this->translate('Remove user %s'), $user->user_name),
'icon' => 'cancel'
'class' => 'action-link',
'icon' => 'cancel',
'title' => sprintf($this->translate('Remove user %s'), $user->user_name)
)
) ?></td>
<?php endif ?>

View File

@ -26,8 +26,8 @@ if ($this->hasPermission('config/authentication/users/edit') && $backend instanc
<?php if (! $this->compact): ?>
<?= $tabs; ?>
<?php endif ?>
<h1><?= $this->escape($user->user_name); ?><span class="pull-right"><?= $editLink; ?></span></h1>
<table class="avp user-header">
<h2 class="clearfix"><?= $this->escape($user->user_name) ?><span class="pull-right"><?= $editLink ?></span></h2>
<table class="name-value-table">
<tr>
<th><?= $this->translate('State'); ?></th>
<td><?= $user->is_active === null ? '-' : ($user->is_active ? $this->translate('Active') : $this->translate('Inactive')); ?></td>
@ -52,13 +52,26 @@ if ($this->hasPermission('config/authentication/users/edit') && $backend instanc
<?php endif ?>
</div>
<div class="content memberships">
<?php if ($showCreateMembershipLink): ?>
<?= $this->qlink(
$this->translate('Add User to Group') ,
'user/createmembership',
array('backend' => $backend->getName()),
array(
'class' => 'button-link',
'data-base-target' => '_next',
'icon' => 'plus',
'title' => $this->translate('Add user to user group')
)
) ?>
<?php endif ?>
<?php
// @TODO(el): Remove that $firstRow thingy
$firstRow = true;
foreach ($memberships as $membership): ?>
<?php if ($firstRow): ?>
<?php $firstRow = false; ?>
<table data-base-target="_next" class="action membership-list alternating">
<table data-base-target="_next" class="action-table listing-table">
<thead>
<tr>
<th class="membership-group"><?= $this->translate('Group'); ?></th>
@ -98,19 +111,4 @@ foreach ($memberships as $membership): ?>
<?php else: ?>
<p><?= $this->translate('No memberships found matching the filter'); ?></p>
<?php endif ?>
<?php if ($showCreateMembershipLink): ?>
<?= $this->qlink(
$this->translate('Create New Membership'),
'user/createmembership',
array(
'backend' => $backend->getName(),
'user' => $user->user_name
),
array(
'icon' => 'plus',
'data-base-target' => '_next',
'class' => 'membership-create'
)
); ?>
<?php endif ?>
</div>