Skip to content

Commit

Permalink
Add my account to Top Menu, only show when user is allowed to maintai…
Browse files Browse the repository at this point in the history
…n his own data
  • Loading branch information
asig2016 authored and ralfbecker committed Jan 29, 2024
1 parent cb7cc5a commit e5b7896
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 1 deletion.
19 changes: 18 additions & 1 deletion api/src/Framework.php
Original file line number Diff line number Diff line change
Expand Up @@ -1244,7 +1244,7 @@ function topmenu(array $vars,array $apps)
}

// 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'])
Expand Down Expand Up @@ -1307,6 +1307,10 @@ protected function add_preferences_topmenu($type='prefs')
'title' => 'Access',
'hook' => 'acl_rights',
),
'useraccount' => array(
'title' => 'My Account',
'hook' => 'user_account',
),
'cats' => array(
'title' => 'Categories',
'hook' => 'categories',
Expand Down Expand Up @@ -1363,6 +1367,18 @@ protected function add_preferences_topmenu($type='prefs')
));
}
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,
Expand All @@ -1371,6 +1387,7 @@ protected function add_preferences_topmenu($type='prefs')
'url' => "javascript:egw.show_preferences(\"$type\",".json_encode($apps).')',
));
}

}

/**
Expand Down
6 changes: 6 additions & 0 deletions pixelegg/css/pixelegg.css
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 6 additions & 0 deletions pixelegg/css/pixelegg.less
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit e5b7896

Please sign in to comment.