Fix mail sidebox does not show mail tree and Mail Menu items

This commit is contained in:
Hadi Nategh 2016-08-02 16:03:56 +02:00
parent b96a40f49f
commit e192ed4bbd

View File

@ -388,77 +388,60 @@ class mail_hooks
{ {
unset($hook_data); // not used, but required by function signature unset($hook_data); // not used, but required by function signature
//error_log(__METHOD__);
// always show the side bar // always show the side bar
unset($GLOBALS['egw_info']['user']['preferences']['common']['auto_hide_sidebox']); unset($GLOBALS['egw_info']['user']['preferences']['common']['auto_hide_sidebox']);
$appname = 'mail'; $appname = 'mail';
$menu_title = $GLOBALS['egw_info']['apps'][$appname]['title'];
// Mail sidebox menus $file=array();
$menus = array( // Destination div for folder tree
array( $file[] = array(
'title' => $GLOBALS['egw_info']['apps'][$appname]['title'], 'no_lang' => true,
'enable' => true, 'text'=>'<span id="mail-index_buttonmailcreate" class="button" />',
'items' => array( 'link'=>false,
array( 'icon' => false
'no_lang' => true, );
'text'=>'<span id="mail-index_buttonmailcreate" class="button" />', $file[] = array(
'link'=>false, 'no_lang' => true,
'icon' => false 'text'=>'<span id="mail-tree_target" class="dtree" />',
), 'link'=>false,
array( 'icon' => false
'no_lang' => true, );
'text'=>'<span id="mail-tree_target" class="dtree" />', // display Mail Tree
'link'=>false, display_sidebox($appname,$menu_title,$file);
'icon' => false
) $linkData = array(
) 'menuaction' => 'mail.mail_ui.importMessage',
),
array (
'title' => lang('Mail Menu'),
'enable' => true,
'items' => array (
'menuOpened' => false,
array (
'text' => 'import message',
'link' => "javascript:egw_openWindowCentered2('".
Egw::link('/index.php', array('menuaction' => 'mail.mail_ui.importMessage') ,false).
"','importMessageDialog',600,100,'no','$appname');"
),
array (
'enable' => self::access('createaccount'),
'text'=>'create new account',
'link'=> "javascript:egw_openWindowCentered2('" .
Egw::link('/index.php', array('menuaction' => 'mail.mail_wizard.add'), '').
"','_blank',640,480,'yes')",
),
)
),
array (
'title' => lang('Admin'),
'enable' => $GLOBALS['egw_info']['user']['apps']['admin'] && !Api\Header\UserAgent::mobile(),
'items' => array (
'Site Configuration' => Egw::link('/index.php','menuaction=admin.uiconfig.index&appname=' . $appname),
)
)
); );
// Menu generator $file = array(
foreach ($menus as &$menu) 'import message' => "javascript:egw_openWindowCentered2('".Egw::link('/index.php', $linkData,false)."','importMessageDialog',600,100,'no','$appname');",
);
// create account wizard
if (self::access('createaccount'))
{ {
foreach ($menu['items'] as &$item) $file += array(
{ 'create new account' => "javascript:egw_openWindowCentered2('" .
if (!is_array($item)) continue; Egw::link('/index.php', array('menuaction' => 'mail.mail_wizard.add'), '').
if (array_key_exists('enable', $item) && !$item['enable']) { "','_blank',640,480,'yes')",
unset($item); );
} }
} // display Mail Menu
if (!(array_key_exists('enable', $menu) && !$menu['enable'])) display_sidebox($appname,$GLOBALS['egw_info']['apps'][$appname]['title'].' '.lang('Menu'),$file);
{
display_sidebox($appname,$menu['title'],$menu['items']); if ($GLOBALS['egw_info']['user']['apps']['admin'] && !Api\Header\UserAgent::mobile())
} {
$file = Array(
'Site Configuration' => Egw::link('/index.php','menuaction=admin.uiconfig.index&appname=' . $appname),
);
display_sidebox($appname,lang('Admin'),$file);
} }
// add pgp encryption menu at the end // add pgp encryption menu at the end
Api\Hooks::pgp_encryption_menu('mail'); Api\Hooks::pgp_encryption_menu('mail');
} }
/** /**