* Filemanager: Fix sharing menu completely disappears when user has no rights to mail app

This commit is contained in:
Hadi Nategh 2018-03-12 11:11:13 +01:00
parent fbf63bf65c
commit e8d67952b9

View File

@ -176,7 +176,7 @@ class filemanager_ui
'onExecute' => Api\Header\UserAgent::mobile()?'javaScript:app.filemanager.viewEntry':'javaScript:app.filemanager.editprefs', 'onExecute' => Api\Header\UserAgent::mobile()?'javaScript:app.filemanager.viewEntry':'javaScript:app.filemanager.editprefs',
'mobileViewTemplate' => 'file?'.filemtime(Api\Etemplate\Widget\Template::rel2path('/filemanager/templates/mobile/file.xet')) 'mobileViewTemplate' => 'file?'.filemtime(Api\Etemplate\Widget\Template::rel2path('/filemanager/templates/mobile/file.xet'))
), ),
'mail' => array( 'share' => array(
'caption' => lang('Share files'), 'caption' => lang('Share files'),
'icon' => 'filemanager/mail_post_to', 'icon' => 'filemanager/mail_post_to',
'group' => $group, 'group' => $group,
@ -285,15 +285,11 @@ class filemanager_ui
'onExecute' => 'javaScript:app.filemanager.drop' 'onExecute' => 'javaScript:app.filemanager.drop'
) )
); );
if (!isset($GLOBALS['egw_info']['user']['apps']['mail']))
{ if (isset($GLOBALS['egw_info']['user']['apps']['mail'])) {
unset($actions['mail']);
}
else
{
foreach(Vfs\Sharing::$modes as $mode => $data) foreach(Vfs\Sharing::$modes as $mode => $data)
{ {
$actions['mail']['children']['mail_'.$mode] = array( $actions['share']['children']['mail_'.$mode] = array(
'caption' => $data['label'], 'caption' => $data['label'],
'hint' => $data['title'], 'hint' => $data['title'],
'group' => 2, 'group' => 2,
@ -301,10 +297,11 @@ class filemanager_ui
); );
if ($mode == Vfs\Sharing::ATTACH || $mode == Vfs\Sharing::LINK) if ($mode == Vfs\Sharing::ATTACH || $mode == Vfs\Sharing::LINK)
{ {
$actions['mail']['children']['mail_'.$mode]['disableClass'] = 'isDir'; $actions['share']['children']['mail_'.$mode]['disableClass'] = 'isDir';
} }
} }
} }
// This would be done automatically, but we're overriding // This would be done automatically, but we're overriding
foreach($actions as $action_id => $action) foreach($actions as $action_id => $action)
{ {
@ -979,7 +976,7 @@ class filemanager_ui
{ {
$row['class'] .= 'noEdit '; $row['class'] .= 'noEdit ';
} }
$row['class'] .= !$dir_is_writable[$dir] ? 'noDelete' : ''; $row['class'] .= !$dir_is_writable[$dir] ? 'noDelete' : '';
$row['download_url'] = Vfs::download_url($path); $row['download_url'] = Vfs::download_url($path);
$row['gid'] = -abs($row['gid']); // gid are positive, but we use negagive account_id for groups internal $row['gid'] = -abs($row['gid']); // gid are positive, but we use negagive account_id for groups internal