Add my account to Top Menu, only show when user is allowed to maintain his own data

This commit is contained in:
Alexandros Sigalas 2024-01-27 12:53:45 +02:00 committed by Ralf Becker
parent cb7cc5a71d
commit e5b789693e
3 changed files with 30 additions and 1 deletions

View File

@ -1244,7 +1244,7 @@ abstract class Framework extends Framework\Extra
} }
// array of topmenu preferences items (orders of the items matter) // 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 // set topmenu preferences items
if($GLOBALS['egw_info']['user']['apps']['preferences']) if($GLOBALS['egw_info']['user']['apps']['preferences'])
@ -1307,6 +1307,10 @@ abstract class Framework extends Framework\Extra
'title' => 'Access', 'title' => 'Access',
'hook' => 'acl_rights', 'hook' => 'acl_rights',
), ),
'useraccount' => array(
'title' => 'My Account',
'hook' => 'user_account',
),
'cats' => array( 'cats' => array(
'title' => 'Categories', 'title' => 'Categories',
'hook' => 'categories', 'hook' => 'categories',
@ -1363,6 +1367,18 @@ abstract class Framework extends Framework\Extra
)); ));
} }
break; 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: default:
$this->_add_topmenu_item(array( $this->_add_topmenu_item(array(
'id' => $type, 'id' => $type,
@ -1371,6 +1387,7 @@ abstract class Framework extends Framework\Extra
'url' => "javascript:egw.show_preferences(\"$type\",".json_encode($apps).')', 'url' => "javascript:egw.show_preferences(\"$type\",".json_encode($apps).')',
)); ));
} }
} }
/** /**

View File

@ -7116,6 +7116,12 @@ table.egwGridView_grid img.et2_appicon {
#egw_fw_header #egw_fw_topmenu #egw_fw_topmenu_items ul a#topmenu_acl { #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); 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 { #egw_fw_header #egw_fw_topmenu #egw_fw_topmenu_items ul a#topmenu_calls {
background-image: url(../../api/templates/default/images/phone.svg); background-image: url(../../api/templates/default/images/phone.svg);
background-repeat: no-repeat; background-repeat: no-repeat;

View File

@ -365,6 +365,12 @@
ul a#topmenu_acl { ul a#topmenu_acl {
background-image: url(../../api/templates/default/images/topmenu_items/access.svg); 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 { ul a#topmenu_calls {
background-image: url(../../api/templates/default/images/phone.svg); background-image: url(../../api/templates/default/images/phone.svg);
background-repeat: no-repeat; background-repeat: no-repeat;