From e5b789693e224cab697ccf0cbaebec41fc7f64b6 Mon Sep 17 00:00:00 2001 From: Alexandros Sigalas Date: Sat, 27 Jan 2024 12:53:45 +0200 Subject: [PATCH] Add my account to Top Menu, only show when user is allowed to maintain his own data --- api/src/Framework.php | 19 ++++++++++++++++++- pixelegg/css/pixelegg.css | 6 ++++++ pixelegg/css/pixelegg.less | 6 ++++++ 3 files changed, 30 insertions(+), 1 deletion(-) diff --git a/api/src/Framework.php b/api/src/Framework.php index cbc19e2bc0..ed25dd85fa 100644 --- a/api/src/Framework.php +++ b/api/src/Framework.php @@ -1244,7 +1244,7 @@ abstract class Framework extends Framework\Extra } // array of topmenu preferences items (orders of the items matter) - $topmenu_preferences = ['darkmode','prefs', 'acl', 'cats', 'security']; + $topmenu_preferences = ['darkmode','prefs', 'acl','useraccount', 'cats', 'security']; // set topmenu preferences items if($GLOBALS['egw_info']['user']['apps']['preferences']) @@ -1307,6 +1307,10 @@ abstract class Framework extends Framework\Extra 'title' => 'Access', 'hook' => 'acl_rights', ), + 'useraccount' => array( + 'title' => 'My Account', + 'hook' => 'user_account', + ), 'cats' => array( 'title' => 'Categories', 'hook' => 'categories', @@ -1363,6 +1367,18 @@ abstract class Framework extends Framework\Extra )); } break; + case 'useraccount': + $config = Config::read('phpgwapi'); + if ($config['own_account_acl'] && is_array($config['own_account_acl']) && count($config['own_account_acl'])>0){ + $this->_add_topmenu_item(array( + 'id' => $type, + 'name' => 'useraccount', + 'title' => lang($types[$type]['title']), + 'url' => "javascript:egw.open_link('". + self::link('/index.php?menuaction=addressbook.addressbook_ui.edit&account_id='.$GLOBALS['egw_info']['user']['account_id'])."','_blank','850x580')", + )); + } + break; default: $this->_add_topmenu_item(array( 'id' => $type, @@ -1371,6 +1387,7 @@ abstract class Framework extends Framework\Extra 'url' => "javascript:egw.show_preferences(\"$type\",".json_encode($apps).')', )); } + } /** diff --git a/pixelegg/css/pixelegg.css b/pixelegg/css/pixelegg.css index b8d045bb54..239e93d1f8 100644 --- a/pixelegg/css/pixelegg.css +++ b/pixelegg/css/pixelegg.css @@ -7116,6 +7116,12 @@ table.egwGridView_grid img.et2_appicon { #egw_fw_header #egw_fw_topmenu #egw_fw_topmenu_items ul a#topmenu_acl { background-image: url(../../api/templates/default/images/topmenu_items/access.svg); } +#egw_fw_header #egw_fw_topmenu #egw_fw_topmenu_items ul a#topmenu_useraccount { + background-image: url(../../api/templates/default/images/accounts.svg); + background-repeat: no-repeat; + background-size: 18px; + background-position-x: -2px; +} #egw_fw_header #egw_fw_topmenu #egw_fw_topmenu_items ul a#topmenu_calls { background-image: url(../../api/templates/default/images/phone.svg); background-repeat: no-repeat; diff --git a/pixelegg/css/pixelegg.less b/pixelegg/css/pixelegg.less index ccd17f5bd3..c5f946012e 100644 --- a/pixelegg/css/pixelegg.less +++ b/pixelegg/css/pixelegg.less @@ -365,6 +365,12 @@ ul a#topmenu_acl { background-image: url(../../api/templates/default/images/topmenu_items/access.svg); } + ul a#topmenu_useraccount { + background-image: url(../../api/templates/default/images/accounts.svg); + background-repeat: no-repeat; + background-size: 18px; + background-position-x: -2px; + } ul a#topmenu_calls { background-image: url(../../api/templates/default/images/phone.svg); background-repeat: no-repeat;