From a22b8f3dc73555800caf55768f04a7a2ce4af7f2 Mon Sep 17 00:00:00 2001 From: Frederic Guillot Date: Sat, 11 Mar 2017 15:24:34 -0500 Subject: Make user actions available from contextual menu --- app/Template/avatar_file/show.php | 2 +- app/Template/twofactor/show.php | 10 +++- app/Template/user_api_access/show.php | 4 +- app/Template/user_credential/authentication.php | 8 +-- app/Template/user_credential/password.php | 8 +-- app/Template/user_list/dropdown.php | 77 +++++++++++++++++++++++++ app/Template/user_list/user_icons.php | 2 +- app/Template/user_modification/show.php | 8 +-- app/Template/user_view/notifications.php | 6 +- app/Template/user_view/sessions.php | 2 +- app/Template/user_view/share.php | 4 +- app/Template/user_view/sidebar.php | 2 +- 12 files changed, 99 insertions(+), 34 deletions(-) (limited to 'app/Template') 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 @@
- url->link(t('Remove my image'), 'AvatarFileController', 'remove', array('user_id' => $user['id']), true, 'btn btn-red') ?> + url->link(t('Remove my image'), 'AvatarFileController', 'remove', array('user_id' => $user['id']), true, 'btn btn-red js-modal-replace') ?>
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 @@

+app->isAjax()): ?> + app->flashMessage() ?> + +
@@ -16,13 +20,13 @@

+
form->csrf() ?> form->label(t('Code'), 'code') ?> form->text('code', array(), array(), array('placeholder="123456"', 'autofocus'), 'form-numeric') ?> -
- -
+ modal->submitButtons(array('submitLabel' => t('Check my code'))) ?>
+
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 @@

- url->link(t('Remove your token'), 'UserApiAccessController', 'remove', array('user_id' => $user['id']), true, 'btn btn-red') ?> + url->link(t('Remove your token'), 'UserApiAccessController', 'remove', array('user_id' => $user['id']), true, 'btn btn-red js-modal-replace') ?> -url->link(t('Generate a new token'), 'UserApiAccessController', 'generate', array('user_id' => $user['id']), true, 'btn btn-blue') ?> +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 @@
form->csrf() ?> @@ -14,11 +14,7 @@ form->checkbox('disable_login_form', t('Disallow login form'), 1, isset($values['disable_login_form']) && $values['disable_login_form'] == 1) ?> -
- - - url->link(t('cancel'), 'UserViewController', 'show', array('user_id' => $user['id'])) ?> -
+ modal->submitButtons() ?>
    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 @@
    form->label(t('Current password for the user "%s"', $this->user->getFullname()), 'current_password') ?> - form->password('current_password', $values, $errors) ?> + form->password('current_password', $values, $errors, array('autofocus')) ?> form->label(t('New password for the user "%s"', $this->user->getFullname($user)), 'password') ?> form->password('password', $values, $errors) ?> @@ -17,9 +17,5 @@ form->password('confirmation', $values, $errors) ?>
    -
    - - - url->link(t('cancel'), 'UserViewController', 'show', array('user_id' => $user['id'])) ?> -
    + modal->submitButtons() ?> 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 @@
  • url->icon('user', t('View profile'), 'UserViewController', 'show', array('user_id' => $user['id'])) ?>
  • + user->hasAccess('UserModificationController', 'show')): ?> +
  • + modal->medium('edit', t('Edit'), 'UserModificationController', 'show', array('user_id' => $user['id'])) ?> +
  • +
  • + modal->medium('smile-o', t('Avatar'), 'AvatarFileController', 'show', array('user_id' => $user['id'])) ?> +
  • + + user->hasAccess('UserCredentialController', 'changePassword')): ?> +
  • + modal->medium('key', t('Change password'), 'UserCredentialController', 'changePassword', array('user_id' => $user['id'])) ?> +
  • + + user->isCurrentUser($user['id']) && $this->user->hasAccess('TwoFactorController', 'index')): ?> +
  • + modal->medium('shield', t('Two factor authentication'), 'TwoFactorController', 'index', array('user_id' => $user['id'])) ?> +
  • + user->hasAccess('TwoFactorController', 'disable') && $user['twofactor_activated'] == 1): ?> +
  • + modal->medium('shield', t('Two factor authentication'), 'TwoFactorController', 'disable', array('user_id' => $user['id'])) ?> +
  • + + user->hasAccess('UserViewController', 'share')): ?> +
  • + modal->medium('share-alt', t('Public access'), 'UserViewController', 'share', array('user_id' => $user['id'])) ?> +
  • + + user->hasAccess('UserViewController', 'notifications')): ?> +
  • + modal->medium('bell-o', t('Notifications'), 'UserViewController', 'notifications', array('user_id' => $user['id'])) ?> +
  • + + user->hasAccess('UserViewController', 'external')): ?> +
  • + modal->medium('user-circle-o', t('External accounts'), 'UserViewController', 'external', array('user_id' => $user['id'])) ?> +
  • + + user->hasAccess('UserViewController', 'integrations')): ?> +
  • + modal->medium('rocket', t('Integrations'), 'UserViewController', 'integrations', array('user_id' => $user['id'])) ?> +
  • + + user->hasAccess('UserApiAccessController', 'show')): ?> +
  • + modal->medium('cloud', t('API Access'), 'UserApiAccessController', 'show', array('user_id' => $user['id'])) ?> +
  • + + + user->isAdmin()): ?> +
  • + url->icon('dashboard', t('User dashboard'), 'DashboardController', 'show', array('user_id' => $user['id'])) ?> +
  • + + + user->isAdmin() || $this->user->isCurrentUser($user['id'])): ?> + user->hasAccess('UserViewController', 'timesheet')): ?> +
  • + modal->medium('clock-o',t('Time tracking'), 'UserViewController', 'timesheet', array('user_id' => $user['id'])) ?> +
  • + + user->hasAccess('UserViewController', 'lastLogin')): ?> +
  • + modal->medium('id-badge', t('Last logins'), 'UserViewController', 'lastLogin', array('user_id' => $user['id'])) ?> +
  • + + user->hasAccess('UserViewController', 'sessions')): ?> +
  • + modal->medium('database', t('Persistent connections'), 'UserViewController', 'sessions', array('user_id' => $user['id'])) ?> +
  • + + user->hasAccess('UserViewController', 'passwordReset')): ?> +
  • + modal->medium('legal', t('Password reset history'), 'UserViewController', 'passwordReset', array('user_id' => $user['id'])) ?> +
  • + + + user->hasAccess('UserStatusController', 'disable') && ! $this->user->isCurrentUser($user['id'])): ?>
  • 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 @@ - + 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 @@
    form->label(t('Username'), 'username') ?> - form->text('username', $values, $errors, array('required', isset($values['is_ldap_user']) && $values['is_ldap_user'] == 1 ? 'readonly' : '', 'maxlength="50"')) ?> + form->text('username', $values, $errors, array('autofocus', 'required', isset($values['is_ldap_user']) && $values['is_ldap_user'] == 1 ? 'readonly' : '', 'maxlength="50"')) ?> form->label(t('Name'), 'name') ?> form->text('name', $values, $errors, array($this->user->hasAccess('UserModificationController', 'show/edit_name') ? '' : 'readonly')) ?> @@ -34,9 +34,5 @@
    -
    - - - url->link(t('cancel'), 'UserViewController', 'show', array('user_id' => $user['id'])) ?> -
    + modal->submitButtons() ?> 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 @@ form->checkboxes('notification_projects', $projects, $notifications) ?> -
    - - - url->link(t('cancel'), 'UserViewController', 'show', array('user_id' => $user['id'])) ?> -
    + modal->submitButtons() ?> 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 @@ dt->datetime($session['expiration']) ?> text->e($session['ip']) ?> text->e($session['user_agent']) ?> - url->link(t('Remove'), 'UserViewController', 'removeSession', array('user_id' => $user['id'], 'id' => $session['id']), true) ?> + url->link(t('Remove'), 'UserViewController', 'removeSession', array('user_id' => $user['id'], 'id' => $session['id']), true, 'js-modal-replace') ?> 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 @@
  • url->icon('calendar', t('iCal feed'), 'ICalendarController', 'user', array('token' => $user['token']), false, '', '', true) ?>
- url->link(t('Disable public access'), 'UserViewController', 'share', array('user_id' => $user['id'], 'switch' => 'disable'), true, 'btn btn-red') ?> + url->link(t('Disable public access'), 'UserViewController', 'share', array('user_id' => $user['id'], 'switch' => 'disable'), true, 'btn btn-red js-modal-replace') ?> - url->link(t('Enable public access'), 'UserViewController', 'share', array('user_id' => $user['id'], 'switch' => 'enable'), true, 'btn btn-blue') ?> + url->link(t('Enable public access'), 'UserViewController', 'share', array('user_id' => $user['id'], 'switch' => 'enable'), true, 'btn btn-blue js-modal-replace') ?> 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 @@
  • app->checkMenuSelection('UserModificationController', 'show') ?>> url->link(t('Edit profile'), 'UserModificationController', 'show', array('user_id' => $user['id'])) ?>
  • -
  • app->checkMenuSelection('AvatarFile') ?>> +
  • app->checkMenuSelection('AvatarFileController') ?>> url->link(t('Avatar'), 'AvatarFileController', 'show', array('user_id' => $user['id'])) ?>
  • -- cgit v1.2.3