From b442c52acb7a02d5f7c8a21eb057e98cb3708864 Mon Sep 17 00:00:00 2001 From: Manfred Hoffmann <48651533+manne65-hd@users.noreply.github.com> Date: Sun, 5 Apr 2020 20:20:12 +0200 Subject: [PATCH] Show group memberships in a tooltip --- app/Helper/UserHelper.php | 25 +++++++++++++++++++++---- app/Locale/bs_BA/translations.php | 2 ++ app/Locale/ca_ES/translations.php | 2 ++ app/Locale/cs_CZ/translations.php | 2 ++ app/Locale/da_DK/translations.php | 4 +++- app/Locale/de_DE/translations.php | 4 +++- app/Locale/el_GR/translations.php | 2 ++ app/Locale/es_ES/translations.php | 2 ++ app/Locale/es_VE/translations.php | 2 ++ app/Locale/fa_IR/translations.php | 2 ++ app/Locale/fi_FI/translations.php | 2 ++ app/Locale/fr_FR/translations.php | 3 ++- app/Locale/hr_HR/translations.php | 2 ++ app/Locale/hu_HU/translations.php | 2 ++ app/Locale/id_ID/translations.php | 2 ++ app/Locale/it_IT/translations.php | 2 ++ app/Locale/ja_JP/translations.php | 2 ++ app/Locale/ko_KR/translations.php | 2 ++ app/Locale/my_MY/translations.php | 2 ++ app/Locale/nb_NO/translations.php | 2 ++ app/Locale/nl_NL/translations.php | 2 ++ app/Locale/pl_PL/translations.php | 2 ++ app/Locale/pt_BR/translations.php | 2 ++ app/Locale/pt_PT/translations.php | 2 ++ app/Locale/ro_RO/translations.php | 2 ++ app/Locale/ru_RU/translations.php | 2 ++ app/Locale/sk_SK/translations.php | 2 ++ app/Locale/sr_Latn_RS/translations.php | 2 ++ app/Locale/sv_SE/translations.php | 2 ++ app/Locale/th_TH/translations.php | 2 ++ app/Locale/tr_TR/translations.php | 2 ++ app/Locale/uk_UA/translations.php | 2 ++ app/Locale/vi_VN/translations.php | 2 ++ app/Locale/zh_CN/translations.php | 2 ++ app/Locale/zh_TW/translations.php | 2 ++ app/Template/user_list/user_details.php | 8 ++++++-- app/Template/user_view/show.php | 2 +- app/constants.php | 8 ++++++++ config.default.php | 8 ++++++++ 39 files changed, 114 insertions(+), 10 deletions(-) diff --git a/app/Helper/UserHelper.php b/app/Helper/UserHelper.php index 7edcba9c7..15357e729 100644 --- a/app/Helper/UserHelper.php +++ b/app/Helper/UserHelper.php @@ -110,15 +110,32 @@ class UserHelper extends Base } /** - * Get group names(as a comma-separated list) for a given user + * Get group names for a given user and return an associative array: + * ['full_list'] = a comma-separated list of all group-memberships + * ['limited_list'] = a comma-separated list limited to N groups depending on value of SHOW_GROUP_MEMBERSHIPS_IN_USERLIST_WITH_LIMIT + * ['has_groups'] = boolean TRUE if user is member of at least one group ... else FALSE * * @access public * @param integer $user_id User id - * @return string + * @return array */ - public function getGroupNames($user_id) + public function getUsersGroupNames($user_id) { - return implode(', ', array_column($this->groupMemberModel->getGroups($user_id), 'name')); + $groups_list = array_column($this->groupMemberModel->getGroups($user_id), 'name'); + $full_list = implode(', ', $groups_list); + + // let's reduce the array to the limit + $limited_list = ( SHOW_GROUP_MEMBERSHIPS_IN_USERLIST_WITH_LIMIT == 0 ) ? $groups_list : array_slice($groups_list, 0 , SHOW_GROUP_MEMBERSHIPS_IN_USERLIST_WITH_LIMIT); + // if limiting had any effect ... let's add a hint to the list, to inform the user there are more group-memberships for that user + $limited_list = ( $groups_list == $limited_list ) ? implode(', ', $limited_list) : implode(', ', $limited_list) . ' ( >> ' . t('hover mouse over group-icon, to show all group-memberships') . ' )'; + + $has_groups = (count($groups_list)) ? true : false; + + return array( + 'full_list' => $full_list, + 'limited_list' => $limited_list, + 'has_groups' => $has_groups + ); } /** diff --git a/app/Locale/bs_BA/translations.php b/app/Locale/bs_BA/translations.php index 7a2cfbc1c..6fd5cbfb2 100644 --- a/app/Locale/bs_BA/translations.php +++ b/app/Locale/bs_BA/translations.php @@ -1417,4 +1417,6 @@ return array( // 'Do you really want to make the tag "%s" global?' => '', // 'Enable global tags for this project' => '', // 'Group membership(s):' => '', + // 'hover mouse over group-icon, to show all group-memberships' => '', + // '%s is a member of the following group(s):' => '', ); diff --git a/app/Locale/ca_ES/translations.php b/app/Locale/ca_ES/translations.php index f58701c79..c4243b11b 100644 --- a/app/Locale/ca_ES/translations.php +++ b/app/Locale/ca_ES/translations.php @@ -1417,4 +1417,6 @@ return array( // 'Do you really want to make the tag "%s" global?' => '', // 'Enable global tags for this project' => '', // 'Group membership(s):' => '', + // 'hover mouse over group-icon, to show all group-memberships' => '', + // '%s is a member of the following group(s):' => '', ); diff --git a/app/Locale/cs_CZ/translations.php b/app/Locale/cs_CZ/translations.php index f59bd070a..1304e4c5a 100644 --- a/app/Locale/cs_CZ/translations.php +++ b/app/Locale/cs_CZ/translations.php @@ -1417,4 +1417,6 @@ return array( // 'Do you really want to make the tag "%s" global?' => '', // 'Enable global tags for this project' => '', // 'Group membership(s):' => '', + // 'hover mouse over group-icon, to show all group-memberships' => '', + // '%s is a member of the following group(s):' => '', ); diff --git a/app/Locale/da_DK/translations.php b/app/Locale/da_DK/translations.php index 408f465db..c461c3902 100644 --- a/app/Locale/da_DK/translations.php +++ b/app/Locale/da_DK/translations.php @@ -1416,5 +1416,7 @@ return array( 'Change to global tag' => 'Ændre til globalt mærke', 'Do you really want to make the tag "%s" global?' => 'Skal mærket "%s" gøres globalt?', // 'Enable global tags for this project' => '', - // 'Group membership(s):' => '', + // 'Group membership(s):' => ':', + // 'hover mouse over group-icon, to show all group-memberships' => '', + // '%s is a member of the following group(s):' => '', ); diff --git a/app/Locale/de_DE/translations.php b/app/Locale/de_DE/translations.php index 859d1317c..0493b0a07 100644 --- a/app/Locale/de_DE/translations.php +++ b/app/Locale/de_DE/translations.php @@ -1416,5 +1416,7 @@ return array( 'Change to global tag' => 'Zu globalem Schlagwort machen', 'Do you really want to make the tag "%s" global?' => 'Das Schlagwort "%s" wirklich global machen?', 'Enable global tags for this project' => 'Globale Schlagworte für dieses Projekt aktivieren', - // 'Group membership(s):' => '', + 'Group membership(s):' => 'Gruppen-Mitgliedschaft(en):', + 'hover mouse over group-icon, to show all group-memberships' => 'Mauszeiger über das Gruppensymbol halten, um alle Gruppenmitgliedschaften anzuzeigen', + '%s is a member of the following group(s):' => '%s ist Mitglied in der/den folgenden Gruppe(n):', ); diff --git a/app/Locale/el_GR/translations.php b/app/Locale/el_GR/translations.php index 1a361afa3..4454b4e41 100644 --- a/app/Locale/el_GR/translations.php +++ b/app/Locale/el_GR/translations.php @@ -1417,4 +1417,6 @@ return array( // 'Do you really want to make the tag "%s" global?' => '', // 'Enable global tags for this project' => '', // 'Group membership(s):' => '', + // 'hover mouse over group-icon, to show all group-memberships' => '', + // '%s is a member of the following group(s):' => '', ); diff --git a/app/Locale/es_ES/translations.php b/app/Locale/es_ES/translations.php index 474799a44..8a3310d6b 100644 --- a/app/Locale/es_ES/translations.php +++ b/app/Locale/es_ES/translations.php @@ -1417,4 +1417,6 @@ return array( // 'Do you really want to make the tag "%s" global?' => '', // 'Enable global tags for this project' => '', // 'Group membership(s):' => '', + // 'hover mouse over group-icon, to show all group-memberships' => '', + // '%s is a member of the following group(s):' => '', ); diff --git a/app/Locale/es_VE/translations.php b/app/Locale/es_VE/translations.php index a0b5cc2e3..a6f487edc 100644 --- a/app/Locale/es_VE/translations.php +++ b/app/Locale/es_VE/translations.php @@ -1417,4 +1417,6 @@ return array( // 'Do you really want to make the tag "%s" global?' => '', // 'Enable global tags for this project' => '', // 'Group membership(s):' => '', + // 'hover mouse over group-icon, to show all group-memberships' => '', + // '%s is a member of the following group(s):' => '', ); diff --git a/app/Locale/fa_IR/translations.php b/app/Locale/fa_IR/translations.php index 63ad49efe..c3a353144 100644 --- a/app/Locale/fa_IR/translations.php +++ b/app/Locale/fa_IR/translations.php @@ -1417,4 +1417,6 @@ return array( // 'Do you really want to make the tag "%s" global?' => '', // 'Enable global tags for this project' => '', // 'Group membership(s):' => '', + // 'hover mouse over group-icon, to show all group-memberships' => '', + // '%s is a member of the following group(s):' => '', ); diff --git a/app/Locale/fi_FI/translations.php b/app/Locale/fi_FI/translations.php index ee1c8a4b9..efc17038c 100644 --- a/app/Locale/fi_FI/translations.php +++ b/app/Locale/fi_FI/translations.php @@ -1417,4 +1417,6 @@ return array( // 'Do you really want to make the tag "%s" global?' => '', // 'Enable global tags for this project' => '', // 'Group membership(s):' => '', + // 'hover mouse over group-icon, to show all group-memberships' => '', + // '%s is a member of the following group(s):' => '', ); diff --git a/app/Locale/fr_FR/translations.php b/app/Locale/fr_FR/translations.php index 9a2eb2742..7bda0e13e 100644 --- a/app/Locale/fr_FR/translations.php +++ b/app/Locale/fr_FR/translations.php @@ -838,7 +838,6 @@ return array( 'Remove group' => 'Supprimer le groupe', 'Group removed successfully.' => 'Groupe supprimé avec succès.', 'Unable to remove this group.' => 'Impossible de supprimer ce groupe.', - // 'Group membership(s):' => '', 'Project Permissions' => 'Permissions du projet', 'Manager' => 'Gestionnaire', 'Project Manager' => 'Chef de projet', @@ -1418,4 +1417,6 @@ return array( 'Do you really want to make the tag "%s" global?' => 'Voulez-vous vraiment rendre le libellé « %s » global ?', 'Enable global tags for this project' => 'Activer les libellés globaux pour ce projet', 'Group membership(s):' => 'Membre des groupes :', + // 'hover mouse over group-icon, to show all group-memberships' => '', + // '%s is a member of the following group(s):' => '', ); diff --git a/app/Locale/hr_HR/translations.php b/app/Locale/hr_HR/translations.php index 6046ffd3f..ee6c3dd10 100644 --- a/app/Locale/hr_HR/translations.php +++ b/app/Locale/hr_HR/translations.php @@ -1417,4 +1417,6 @@ return array( // 'Do you really want to make the tag "%s" global?' => '', // 'Enable global tags for this project' => '', // 'Group membership(s):' => '', + // 'hover mouse over group-icon, to show all group-memberships' => '', + // '%s is a member of the following group(s):' => '', ); diff --git a/app/Locale/hu_HU/translations.php b/app/Locale/hu_HU/translations.php index be6996cb7..a9ea50e09 100644 --- a/app/Locale/hu_HU/translations.php +++ b/app/Locale/hu_HU/translations.php @@ -1417,4 +1417,6 @@ return array( 'Do you really want to make the tag "%s" global?' => 'Valóban globálissá szeretné tenni a(z) „%s” címkét?', // 'Enable global tags for this project' => '', // 'Group membership(s):' => '', + // 'hover mouse over group-icon, to show all group-memberships' => '', + // '%s is a member of the following group(s):' => '', ); diff --git a/app/Locale/id_ID/translations.php b/app/Locale/id_ID/translations.php index 04ec0ed7d..1cee426d7 100644 --- a/app/Locale/id_ID/translations.php +++ b/app/Locale/id_ID/translations.php @@ -1417,4 +1417,6 @@ return array( // 'Do you really want to make the tag "%s" global?' => '', // 'Enable global tags for this project' => '', // 'Group membership(s):' => '', + // 'hover mouse over group-icon, to show all group-memberships' => '', + // '%s is a member of the following group(s):' => '', ); diff --git a/app/Locale/it_IT/translations.php b/app/Locale/it_IT/translations.php index fab5dca8b..646efb653 100644 --- a/app/Locale/it_IT/translations.php +++ b/app/Locale/it_IT/translations.php @@ -1417,4 +1417,6 @@ return array( // 'Do you really want to make the tag "%s" global?' => '', // 'Enable global tags for this project' => '', // 'Group membership(s):' => '', + // 'hover mouse over group-icon, to show all group-memberships' => '', + // '%s is a member of the following group(s):' => '', ); diff --git a/app/Locale/ja_JP/translations.php b/app/Locale/ja_JP/translations.php index e35e0fd48..8053abb63 100644 --- a/app/Locale/ja_JP/translations.php +++ b/app/Locale/ja_JP/translations.php @@ -1417,4 +1417,6 @@ return array( // 'Do you really want to make the tag "%s" global?' => '', // 'Enable global tags for this project' => '', // 'Group membership(s):' => '', + // 'hover mouse over group-icon, to show all group-memberships' => '', + // '%s is a member of the following group(s):' => '', ); diff --git a/app/Locale/ko_KR/translations.php b/app/Locale/ko_KR/translations.php index 16deb074a..71a2e7024 100644 --- a/app/Locale/ko_KR/translations.php +++ b/app/Locale/ko_KR/translations.php @@ -1417,4 +1417,6 @@ return array( // 'Do you really want to make the tag "%s" global?' => '', // 'Enable global tags for this project' => '', // 'Group membership(s):' => '', + // 'hover mouse over group-icon, to show all group-memberships' => '', + // '%s is a member of the following group(s):' => '', ); diff --git a/app/Locale/my_MY/translations.php b/app/Locale/my_MY/translations.php index f81b405c9..37fae6a31 100644 --- a/app/Locale/my_MY/translations.php +++ b/app/Locale/my_MY/translations.php @@ -1417,4 +1417,6 @@ return array( // 'Do you really want to make the tag "%s" global?' => '', // 'Enable global tags for this project' => '', // 'Group membership(s):' => '', + // 'hover mouse over group-icon, to show all group-memberships' => '', + // '%s is a member of the following group(s):' => '', ); diff --git a/app/Locale/nb_NO/translations.php b/app/Locale/nb_NO/translations.php index 6bee90be5..f01856dc0 100644 --- a/app/Locale/nb_NO/translations.php +++ b/app/Locale/nb_NO/translations.php @@ -1417,4 +1417,6 @@ return array( // 'Do you really want to make the tag "%s" global?' => '', // 'Enable global tags for this project' => '', // 'Group membership(s):' => '', + // 'hover mouse over group-icon, to show all group-memberships' => '', + // '%s is a member of the following group(s):' => '', ); diff --git a/app/Locale/nl_NL/translations.php b/app/Locale/nl_NL/translations.php index 399631169..16bbe760e 100644 --- a/app/Locale/nl_NL/translations.php +++ b/app/Locale/nl_NL/translations.php @@ -1417,4 +1417,6 @@ return array( // 'Do you really want to make the tag "%s" global?' => '', // 'Enable global tags for this project' => '', // 'Group membership(s):' => '', + // 'hover mouse over group-icon, to show all group-memberships' => '', + // '%s is a member of the following group(s):' => '', ); diff --git a/app/Locale/pl_PL/translations.php b/app/Locale/pl_PL/translations.php index 085220804..7e9dc59df 100644 --- a/app/Locale/pl_PL/translations.php +++ b/app/Locale/pl_PL/translations.php @@ -1417,4 +1417,6 @@ return array( // 'Do you really want to make the tag "%s" global?' => '', // 'Enable global tags for this project' => '', // 'Group membership(s):' => '', + // 'hover mouse over group-icon, to show all group-memberships' => '', + // '%s is a member of the following group(s):' => '', ); diff --git a/app/Locale/pt_BR/translations.php b/app/Locale/pt_BR/translations.php index 03fd2b9b8..1d4bb9519 100644 --- a/app/Locale/pt_BR/translations.php +++ b/app/Locale/pt_BR/translations.php @@ -1417,4 +1417,6 @@ return array( 'Do you really want to make the tag "%s" global?' => 'Você realmente deseja transformar a etiqueta "%s" em etiqueta global?', // 'Enable global tags for this project' => '', // 'Group membership(s):' => '', + // 'hover mouse over group-icon, to show all group-memberships' => '', + // '%s is a member of the following group(s):' => '', ); diff --git a/app/Locale/pt_PT/translations.php b/app/Locale/pt_PT/translations.php index f2a0753ee..ea8bf9fc6 100644 --- a/app/Locale/pt_PT/translations.php +++ b/app/Locale/pt_PT/translations.php @@ -1417,4 +1417,6 @@ return array( 'Do you really want to make the tag "%s" global?' => 'Tem a certeza que pretende por a etiqueta "%s" como global?', // 'Enable global tags for this project' => '', // 'Group membership(s):' => '', + // 'hover mouse over group-icon, to show all group-memberships' => '', + // '%s is a member of the following group(s):' => '', ); diff --git a/app/Locale/ro_RO/translations.php b/app/Locale/ro_RO/translations.php index 44bba9fbd..f71affb33 100644 --- a/app/Locale/ro_RO/translations.php +++ b/app/Locale/ro_RO/translations.php @@ -1417,4 +1417,6 @@ return array( // 'Do you really want to make the tag "%s" global?' => '', // 'Enable global tags for this project' => '', // 'Group membership(s):' => '', + // 'hover mouse over group-icon, to show all group-memberships' => '', + // '%s is a member of the following group(s):' => '', ); diff --git a/app/Locale/ru_RU/translations.php b/app/Locale/ru_RU/translations.php index 5a3b879bc..58bbf976c 100644 --- a/app/Locale/ru_RU/translations.php +++ b/app/Locale/ru_RU/translations.php @@ -1417,4 +1417,6 @@ return array( 'Do you really want to make the tag "%s" global?' => 'Вы действительно хотите сделать метку "%s" глобальной?', // 'Enable global tags for this project' => '', // 'Group membership(s):' => '', + // 'hover mouse over group-icon, to show all group-memberships' => '', + // '%s is a member of the following group(s):' => '', ); diff --git a/app/Locale/sk_SK/translations.php b/app/Locale/sk_SK/translations.php index f56059581..97f6472f0 100644 --- a/app/Locale/sk_SK/translations.php +++ b/app/Locale/sk_SK/translations.php @@ -1417,4 +1417,6 @@ return array( // 'Do you really want to make the tag "%s" global?' => '', // 'Enable global tags for this project' => '', // 'Group membership(s):' => '', + // 'hover mouse over group-icon, to show all group-memberships' => '', + // '%s is a member of the following group(s):' => '', ); diff --git a/app/Locale/sr_Latn_RS/translations.php b/app/Locale/sr_Latn_RS/translations.php index 04c98c958..e1cef7447 100644 --- a/app/Locale/sr_Latn_RS/translations.php +++ b/app/Locale/sr_Latn_RS/translations.php @@ -1417,4 +1417,6 @@ return array( // 'Do you really want to make the tag "%s" global?' => '', // 'Enable global tags for this project' => '', // 'Group membership(s):' => '', + // 'hover mouse over group-icon, to show all group-memberships' => '', + // '%s is a member of the following group(s):' => '', ); diff --git a/app/Locale/sv_SE/translations.php b/app/Locale/sv_SE/translations.php index 5f2d775dd..c2632bb18 100644 --- a/app/Locale/sv_SE/translations.php +++ b/app/Locale/sv_SE/translations.php @@ -1417,4 +1417,6 @@ return array( // 'Do you really want to make the tag "%s" global?' => '', // 'Enable global tags for this project' => '', // 'Group membership(s):' => '', + // 'hover mouse over group-icon, to show all group-memberships' => '', + // '%s is a member of the following group(s):' => '', ); diff --git a/app/Locale/th_TH/translations.php b/app/Locale/th_TH/translations.php index 9b9d55616..36ee37e6e 100644 --- a/app/Locale/th_TH/translations.php +++ b/app/Locale/th_TH/translations.php @@ -1417,4 +1417,6 @@ return array( // 'Do you really want to make the tag "%s" global?' => '', // 'Enable global tags for this project' => '', // 'Group membership(s):' => '', + // 'hover mouse over group-icon, to show all group-memberships' => '', + // '%s is a member of the following group(s):' => '', ); diff --git a/app/Locale/tr_TR/translations.php b/app/Locale/tr_TR/translations.php index 1688aebfb..d164cc327 100644 --- a/app/Locale/tr_TR/translations.php +++ b/app/Locale/tr_TR/translations.php @@ -1417,4 +1417,6 @@ return array( // 'Do you really want to make the tag "%s" global?' => '', // 'Enable global tags for this project' => '', // 'Group membership(s):' => '', + // 'hover mouse over group-icon, to show all group-memberships' => '', + // '%s is a member of the following group(s):' => '', ); diff --git a/app/Locale/uk_UA/translations.php b/app/Locale/uk_UA/translations.php index 0284b9395..68354537d 100644 --- a/app/Locale/uk_UA/translations.php +++ b/app/Locale/uk_UA/translations.php @@ -1417,4 +1417,6 @@ return array( // 'Do you really want to make the tag "%s" global?' => '', // 'Enable global tags for this project' => '', // 'Group membership(s):' => '', + // 'hover mouse over group-icon, to show all group-memberships' => '', + // '%s is a member of the following group(s):' => '', ); diff --git a/app/Locale/vi_VN/translations.php b/app/Locale/vi_VN/translations.php index f55832bab..e2c3d9fb2 100644 --- a/app/Locale/vi_VN/translations.php +++ b/app/Locale/vi_VN/translations.php @@ -1417,4 +1417,6 @@ return array( // 'Do you really want to make the tag "%s" global?' => '', // 'Enable global tags for this project' => '', // 'Group membership(s):' => '', + // 'hover mouse over group-icon, to show all group-memberships' => '', + // '%s is a member of the following group(s):' => '', ); diff --git a/app/Locale/zh_CN/translations.php b/app/Locale/zh_CN/translations.php index 2a03f57c8..4adb15fbb 100644 --- a/app/Locale/zh_CN/translations.php +++ b/app/Locale/zh_CN/translations.php @@ -1417,4 +1417,6 @@ return array( // 'Do you really want to make the tag "%s" global?' => '', // 'Enable global tags for this project' => '', // 'Group membership(s):' => '', + // 'hover mouse over group-icon, to show all group-memberships' => '', + // '%s is a member of the following group(s):' => '', ); diff --git a/app/Locale/zh_TW/translations.php b/app/Locale/zh_TW/translations.php index 14d8453a1..50571a9f6 100644 --- a/app/Locale/zh_TW/translations.php +++ b/app/Locale/zh_TW/translations.php @@ -1417,4 +1417,6 @@ return array( // 'Do you really want to make the tag "%s" global?' => '', // 'Enable global tags for this project' => '', // 'Group membership(s):' => '', + // 'hover mouse over group-icon, to show all group-memberships' => '', + // '%s is a member of the following group(s):' => '', ); diff --git a/app/Template/user_list/user_details.php b/app/Template/user_list/user_details.php index ae266ba36..4cce320b8 100644 --- a/app/Template/user_list/user_details.php +++ b/app/Template/user_list/user_details.php @@ -11,7 +11,11 @@ = $this->text->e($user['email']) ?> - user->getGroupNames($user['id'])) ): ?> - = $this->user->getGroupNames($user['id']) ?> + + user->getUsersGroupNames($user['id']); ?> + + + = $users_group_names['limited_list'] ?> + diff --git a/app/Template/user_view/show.php b/app/Template/user_view/show.php index 322c056db..759449ec8 100644 --- a/app/Template/user_view/show.php +++ b/app/Template/user_view/show.php @@ -14,7 +14,7 @@