summaryrefslogtreecommitdiff
path: root/app/Template
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2017-03-11 15:24:34 -0500
committerFrederic Guillot <fred@kanboard.net>2017-03-11 15:24:34 -0500
commita22b8f3dc73555800caf55768f04a7a2ce4af7f2 (patch)
tree60257cb9b508da83be5a9477c434fb53cc3c6f6d /app/Template
parent469112918d0cfa6a43a7fdb829cd19bdf85cfcbe (diff)
Make user actions available from contextual menu
Diffstat (limited to 'app/Template')
-rw-r--r--app/Template/avatar_file/show.php2
-rw-r--r--app/Template/twofactor/show.php10
-rw-r--r--app/Template/user_api_access/show.php4
-rw-r--r--app/Template/user_credential/authentication.php8
-rw-r--r--app/Template/user_credential/password.php8
-rw-r--r--app/Template/user_list/dropdown.php77
-rw-r--r--app/Template/user_list/user_icons.php2
-rw-r--r--app/Template/user_modification/show.php8
-rw-r--r--app/Template/user_view/notifications.php6
-rw-r--r--app/Template/user_view/sessions.php2
-rw-r--r--app/Template/user_view/share.php4
-rw-r--r--app/Template/user_view/sidebar.php2
12 files changed, 99 insertions, 34 deletions
diff --git a/app/Template/avatar_file/show.php b/app/Template/avatar_file/show.php
index 37c56cec..1766cb3f 100644
--- a/app/Template/avatar_file/show.php
+++ b/app/Template/avatar_file/show.php
@@ -6,7 +6,7 @@
<div class="form-actions">
<?php if (! empty($user['avatar_path'])): ?>
- <?= $this->url->link(t('Remove my image'), 'AvatarFileController', 'remove', array('user_id' => $user['id']), true, 'btn btn-red') ?>
+ <?= $this->url->link(t('Remove my image'), 'AvatarFileController', 'remove', array('user_id' => $user['id']), true, 'btn btn-red js-modal-replace') ?>
<?php endif ?>
</div>
diff --git a/app/Template/twofactor/show.php b/app/Template/twofactor/show.php
index 412077b9..80f1e244 100644
--- a/app/Template/twofactor/show.php
+++ b/app/Template/twofactor/show.php
@@ -2,6 +2,10 @@
<h2><?= t('Two factor authentication') ?></h2>
</div>
+<?php if ($this->app->isAjax()): ?>
+ <?= $this->app->flashMessage() ?>
+<?php endif ?>
+
<?php if (! empty($secret) || ! empty($key_url)): ?>
<div class="panel">
<?php if (! empty($secret)): ?>
@@ -16,13 +20,13 @@
<?php endif ?>
<h3><?= t('Test your device') ?></h3>
+<div class="panel">
<form method="post" action="<?= $this->url->href('TwoFactorController', 'test', array('user_id' => $user['id'])) ?>" autocomplete="off">
<?= $this->form->csrf() ?>
<?= $this->form->label(t('Code'), 'code') ?>
<?= $this->form->text('code', array(), array(), array('placeholder="123456"', 'autofocus'), 'form-numeric') ?>
- <div class="form-actions">
- <button type="submit" class="btn btn-blue"><?= t('Check my code') ?></button>
- </div>
+ <?= $this->modal->submitButtons(array('submitLabel' => t('Check my code'))) ?>
</form>
+</div>
diff --git a/app/Template/user_api_access/show.php b/app/Template/user_api_access/show.php
index 3d58e0d5..39bf354a 100644
--- a/app/Template/user_api_access/show.php
+++ b/app/Template/user_api_access/show.php
@@ -11,7 +11,7 @@
</p>
<?php if (! empty($user['api_access_token'])): ?>
- <?= $this->url->link(t('Remove your token'), 'UserApiAccessController', 'remove', array('user_id' => $user['id']), true, 'btn btn-red') ?>
+ <?= $this->url->link(t('Remove your token'), 'UserApiAccessController', 'remove', array('user_id' => $user['id']), true, 'btn btn-red js-modal-replace') ?>
<?php endif ?>
-<?= $this->url->link(t('Generate a new token'), 'UserApiAccessController', 'generate', array('user_id' => $user['id']), true, 'btn btn-blue') ?>
+<?= $this->url->link(t('Generate a new token'), 'UserApiAccessController', 'generate', array('user_id' => $user['id']), true, 'btn btn-blue js-modal-replace') ?>
diff --git a/app/Template/user_credential/authentication.php b/app/Template/user_credential/authentication.php
index 98c0d758..32371bd8 100644
--- a/app/Template/user_credential/authentication.php
+++ b/app/Template/user_credential/authentication.php
@@ -1,5 +1,5 @@
<div class="page-header">
- <h2><?= t('Edit Authentication') ?></h2>
+ <h2><?= t('Authentication Parameters') ?></h2>
</div>
<form method="post" action="<?= $this->url->href('UserCredentialController', 'saveAuthentication', array('user_id' => $user['id'])) ?>" autocomplete="off">
<?= $this->form->csrf() ?>
@@ -14,11 +14,7 @@
<?= $this->form->checkbox('disable_login_form', t('Disallow login form'), 1, isset($values['disable_login_form']) && $values['disable_login_form'] == 1) ?>
</fieldset>
- <div class="form-actions">
- <button type="submit" class="btn btn-blue"><?= t('Save') ?></button>
- <?= t('or') ?>
- <?= $this->url->link(t('cancel'), 'UserViewController', 'show', array('user_id' => $user['id'])) ?>
- </div>
+ <?= $this->modal->submitButtons() ?>
<div class="alert alert-info">
<ul>
diff --git a/app/Template/user_credential/password.php b/app/Template/user_credential/password.php
index bd7a47da..a71ba825 100644
--- a/app/Template/user_credential/password.php
+++ b/app/Template/user_credential/password.php
@@ -8,7 +8,7 @@
<fieldset>
<?= $this->form->label(t('Current password for the user "%s"', $this->user->getFullname()), 'current_password') ?>
- <?= $this->form->password('current_password', $values, $errors) ?>
+ <?= $this->form->password('current_password', $values, $errors, array('autofocus')) ?>
<?= $this->form->label(t('New password for the user "%s"', $this->user->getFullname($user)), 'password') ?>
<?= $this->form->password('password', $values, $errors) ?>
@@ -17,9 +17,5 @@
<?= $this->form->password('confirmation', $values, $errors) ?>
</fieldset>
- <div class="form-actions">
- <button type="submit" class="btn btn-blue"><?= t('Save') ?></button>
- <?= t('or') ?>
- <?= $this->url->link(t('cancel'), 'UserViewController', 'show', array('user_id' => $user['id'])) ?>
- </div>
+ <?= $this->modal->submitButtons() ?>
</form>
diff --git a/app/Template/user_list/dropdown.php b/app/Template/user_list/dropdown.php
index 20d17aea..9f89d807 100644
--- a/app/Template/user_list/dropdown.php
+++ b/app/Template/user_list/dropdown.php
@@ -4,6 +4,83 @@
<li>
<?= $this->url->icon('user', t('View profile'), 'UserViewController', 'show', array('user_id' => $user['id'])) ?>
</li>
+ <?php if ($user['is_active'] == 1 && $this->user->hasAccess('UserModificationController', 'show')): ?>
+ <li>
+ <?= $this->modal->medium('edit', t('Edit'), 'UserModificationController', 'show', array('user_id' => $user['id'])) ?>
+ </li>
+ <li>
+ <?= $this->modal->medium('smile-o', t('Avatar'), 'AvatarFileController', 'show', array('user_id' => $user['id'])) ?>
+ </li>
+ <?php endif ?>
+ <?php if ($user['is_ldap_user'] == 0 && $this->user->hasAccess('UserCredentialController', 'changePassword')): ?>
+ <li>
+ <?= $this->modal->medium('key', t('Change password'), 'UserCredentialController', 'changePassword', array('user_id' => $user['id'])) ?>
+ </li>
+ <?php endif ?>
+ <?php if ($this->user->isCurrentUser($user['id']) && $this->user->hasAccess('TwoFactorController', 'index')): ?>
+ <li>
+ <?= $this->modal->medium('shield', t('Two factor authentication'), 'TwoFactorController', 'index', array('user_id' => $user['id'])) ?>
+ </li>
+ <?php elseif ($this->user->hasAccess('TwoFactorController', 'disable') && $user['twofactor_activated'] == 1): ?>
+ <li>
+ <?= $this->modal->medium('shield', t('Two factor authentication'), 'TwoFactorController', 'disable', array('user_id' => $user['id'])) ?>
+ </li>
+ <?php endif ?>
+ <?php if ($this->user->hasAccess('UserViewController', 'share')): ?>
+ <li>
+ <?= $this->modal->medium('share-alt', t('Public access'), 'UserViewController', 'share', array('user_id' => $user['id'])) ?>
+ </li>
+ <?php endif ?>
+ <?php if ($this->user->hasAccess('UserViewController', 'notifications')): ?>
+ <li>
+ <?= $this->modal->medium('bell-o', t('Notifications'), 'UserViewController', 'notifications', array('user_id' => $user['id'])) ?>
+ </li>
+ <?php endif ?>
+ <?php if ($this->user->hasAccess('UserViewController', 'external')): ?>
+ <li>
+ <?= $this->modal->medium('user-circle-o', t('External accounts'), 'UserViewController', 'external', array('user_id' => $user['id'])) ?>
+ </li>
+ <?php endif ?>
+ <?php if ($this->user->hasAccess('UserViewController', 'integrations')): ?>
+ <li>
+ <?= $this->modal->medium('rocket', t('Integrations'), 'UserViewController', 'integrations', array('user_id' => $user['id'])) ?>
+ </li>
+ <?php endif ?>
+ <?php if ($this->user->hasAccess('UserApiAccessController', 'show')): ?>
+ <li>
+ <?= $this->modal->medium('cloud', t('API Access'), 'UserApiAccessController', 'show', array('user_id' => $user['id'])) ?>
+ </li>
+ <?php endif ?>
+
+ <?php if ($this->user->isAdmin()): ?>
+ <li>
+ <?= $this->url->icon('dashboard', t('User dashboard'), 'DashboardController', 'show', array('user_id' => $user['id'])) ?>
+ </li>
+ <?php endif ?>
+
+ <?php if ($this->user->isAdmin() || $this->user->isCurrentUser($user['id'])): ?>
+ <?php if ($this->user->hasAccess('UserViewController', 'timesheet')): ?>
+ <li>
+ <?= $this->modal->medium('clock-o',t('Time tracking'), 'UserViewController', 'timesheet', array('user_id' => $user['id'])) ?>
+ </li>
+ <?php endif ?>
+ <?php if ($this->user->hasAccess('UserViewController', 'lastLogin')): ?>
+ <li>
+ <?= $this->modal->medium('id-badge', t('Last logins'), 'UserViewController', 'lastLogin', array('user_id' => $user['id'])) ?>
+ </li>
+ <?php endif ?>
+ <?php if ($this->user->hasAccess('UserViewController', 'sessions')): ?>
+ <li>
+ <?= $this->modal->medium('database', t('Persistent connections'), 'UserViewController', 'sessions', array('user_id' => $user['id'])) ?>
+ </li>
+ <?php endif ?>
+ <?php if ($this->user->hasAccess('UserViewController', 'passwordReset')): ?>
+ <li>
+ <?= $this->modal->medium('legal', t('Password reset history'), 'UserViewController', 'passwordReset', array('user_id' => $user['id'])) ?>
+ </li>
+ <?php endif ?>
+ <?php endif ?>
+
<?php if ($user['is_active'] == 1 && $this->user->hasAccess('UserStatusController', 'disable') && ! $this->user->isCurrentUser($user['id'])): ?>
<li>
<?= $this->modal->confirm('times', t('Disable'), 'UserStatusController', 'confirmDisable', array('user_id' => $user['id'])) ?>
diff --git a/app/Template/user_list/user_icons.php b/app/Template/user_list/user_icons.php
index 532526bb..a110e557 100644
--- a/app/Template/user_list/user_icons.php
+++ b/app/Template/user_list/user_icons.php
@@ -13,7 +13,7 @@
<?php if ($user['twofactor_activated'] == 1): ?>
<span title="<?= t('Two factor authentication enabled') ?>">
- <i class="fa fa-key" aria-hidden="true"></i>
+ <i class="fa fa-shield" aria-hidden="true"></i>
</span>
<?php endif ?>
diff --git a/app/Template/user_modification/show.php b/app/Template/user_modification/show.php
index d3f3e0cc..fd90d915 100644
--- a/app/Template/user_modification/show.php
+++ b/app/Template/user_modification/show.php
@@ -8,7 +8,7 @@
<fieldset>
<legend><?= t('Profile') ?></legend>
<?= $this->form->label(t('Username'), 'username') ?>
- <?= $this->form->text('username', $values, $errors, array('required', isset($values['is_ldap_user']) && $values['is_ldap_user'] == 1 ? 'readonly' : '', 'maxlength="50"')) ?>
+ <?= $this->form->text('username', $values, $errors, array('autofocus', 'required', isset($values['is_ldap_user']) && $values['is_ldap_user'] == 1 ? 'readonly' : '', 'maxlength="50"')) ?>
<?= $this->form->label(t('Name'), 'name') ?>
<?= $this->form->text('name', $values, $errors, array($this->user->hasAccess('UserModificationController', 'show/edit_name') ? '' : 'readonly')) ?>
@@ -34,9 +34,5 @@
</fieldset>
<?php endif ?>
- <div class="form-actions">
- <button type="submit" class="btn btn-blue"><?= t('Save') ?></button>
- <?= t('or') ?>
- <?= $this->url->link(t('cancel'), 'UserViewController', 'show', array('user_id' => $user['id'])) ?>
- </div>
+ <?= $this->modal->submitButtons() ?>
</form>
diff --git a/app/Template/user_view/notifications.php b/app/Template/user_view/notifications.php
index 84ca1282..0f4e59d1 100644
--- a/app/Template/user_view/notifications.php
+++ b/app/Template/user_view/notifications.php
@@ -18,9 +18,5 @@
<?= $this->form->checkboxes('notification_projects', $projects, $notifications) ?>
<?php endif ?>
- <div class="form-actions">
- <button type="submit" class="btn btn-blue"><?= t('Save') ?></button>
- <?= t('or') ?>
- <?= $this->url->link(t('cancel'), 'UserViewController', 'show', array('user_id' => $user['id'])) ?>
- </div>
+ <?= $this->modal->submitButtons() ?>
</form>
diff --git a/app/Template/user_view/sessions.php b/app/Template/user_view/sessions.php
index 10497e4f..dec11752 100644
--- a/app/Template/user_view/sessions.php
+++ b/app/Template/user_view/sessions.php
@@ -19,7 +19,7 @@
<td><?= $this->dt->datetime($session['expiration']) ?></td>
<td><?= $this->text->e($session['ip']) ?></td>
<td><?= $this->text->e($session['user_agent']) ?></td>
- <td><?= $this->url->link(t('Remove'), 'UserViewController', 'removeSession', array('user_id' => $user['id'], 'id' => $session['id']), true) ?></td>
+ <td><?= $this->url->link(t('Remove'), 'UserViewController', 'removeSession', array('user_id' => $user['id'], 'id' => $session['id']), true, 'js-modal-replace') ?></td>
</tr>
<?php endforeach ?>
</table>
diff --git a/app/Template/user_view/share.php b/app/Template/user_view/share.php
index 318d98ea..784e0ebd 100644
--- a/app/Template/user_view/share.php
+++ b/app/Template/user_view/share.php
@@ -9,7 +9,7 @@
<li><strong><?= $this->url->icon('calendar', t('iCal feed'), 'ICalendarController', 'user', array('token' => $user['token']), false, '', '', true) ?></strong></li>
</ul>
</div>
- <?= $this->url->link(t('Disable public access'), 'UserViewController', 'share', array('user_id' => $user['id'], 'switch' => 'disable'), true, 'btn btn-red') ?>
+ <?= $this->url->link(t('Disable public access'), 'UserViewController', 'share', array('user_id' => $user['id'], 'switch' => 'disable'), true, 'btn btn-red js-modal-replace') ?>
<?php else: ?>
- <?= $this->url->link(t('Enable public access'), 'UserViewController', 'share', array('user_id' => $user['id'], 'switch' => 'enable'), true, 'btn btn-blue') ?>
+ <?= $this->url->link(t('Enable public access'), 'UserViewController', 'share', array('user_id' => $user['id'], 'switch' => 'enable'), true, 'btn btn-blue js-modal-replace') ?>
<?php endif ?>
diff --git a/app/Template/user_view/sidebar.php b/app/Template/user_view/sidebar.php
index ef494e42..1542396a 100644
--- a/app/Template/user_view/sidebar.php
+++ b/app/Template/user_view/sidebar.php
@@ -49,7 +49,7 @@
<li <?= $this->app->checkMenuSelection('UserModificationController', 'show') ?>>
<?= $this->url->link(t('Edit profile'), 'UserModificationController', 'show', array('user_id' => $user['id'])) ?>
</li>
- <li <?= $this->app->checkMenuSelection('AvatarFile') ?>>
+ <li <?= $this->app->checkMenuSelection('AvatarFileController') ?>>
<?= $this->url->link(t('Avatar'), 'AvatarFileController', 'show', array('user_id' => $user['id'])) ?>
</li>
<?php endif ?>