forked from extern/egroupware
Restructuring of sidebox menus in mail
This commit is contained in:
parent
d3043c2a45
commit
196176ff9c
@ -388,90 +388,76 @@ class mail_hooks
|
||||
{
|
||||
unset($hook_data); // not used, but required by function signature
|
||||
|
||||
//error_log(__METHOD__);
|
||||
// always show the side bar
|
||||
unset($GLOBALS['egw_info']['user']['preferences']['common']['auto_hide_sidebox']);
|
||||
$appname = 'mail';
|
||||
$menu_title = $GLOBALS['egw_info']['apps'][$appname]['title'] . ' '. lang('Menu');
|
||||
/*
|
||||
$file = array();
|
||||
$profileID = 0;
|
||||
if (isset($GLOBALS['egw_info']['user']['preferences']['mail']['ActiveProfileID']))
|
||||
$profileID = (int)$GLOBALS['egw_info']['user']['preferences']['mail']['ActiveProfileID'];
|
||||
try
|
||||
{
|
||||
$mail_bo = Mail::getInstance(true,$profileID);
|
||||
$profileID = $GLOBALS['egw_info']['user']['preferences']['mail']['ActiveProfileID'] = $mail_bo->profileID;
|
||||
} catch (Exception $e) {
|
||||
//error_log(__METHOD__."()" . $e->getMessage());
|
||||
$profileID = Mail\Account::get_default_acc_id();
|
||||
}
|
||||
|
||||
$preferences =& $mail_bo->mailPreferences;
|
||||
$serverCounter = $sieveEnabledServerCounter = 0;
|
||||
// account select box
|
||||
$selectedID = $profileID;
|
||||
$allAccountData = Mail\Account::search($only_current_user=true, $just_name=false, $order_by=null);
|
||||
if ($allAccountData) {
|
||||
$rememberFirst=$selectedFound=null;
|
||||
foreach ($allAccountData as $tmpkey => $icServers)
|
||||
{
|
||||
if (is_null($rememberFirst)) $rememberFirst = $tmpkey;
|
||||
if ($tmpkey == $selectedID) $selectedFound=true;
|
||||
//error_log(__METHOD__.__LINE__.' Key:'.$tmpkey.'->'.array2string($icServers->acc_imap_host));
|
||||
$host = $icServers->acc_sieve_host;
|
||||
if (empty($host)) continue;
|
||||
if ($icServers->acc_sieve_enabled && $icServers->acc_sieve_port) $sieveEnabledServerCounter++;
|
||||
$serverCounter++;
|
||||
//error_log(__METHOD__.__LINE__.' Key:'.$tmpkey.'->'.array2string($identities[$icServers->acc_id]));
|
||||
}
|
||||
}
|
||||
*/
|
||||
$file=array();
|
||||
// Destination div for folder tree
|
||||
$file[] = array(
|
||||
// Mail sidebox menus
|
||||
$menus = array(
|
||||
array(
|
||||
'title' => $GLOBALS['egw_info']['apps'][$appname]['title'],
|
||||
'enable' => true,
|
||||
'items' => array(
|
||||
array(
|
||||
'no_lang' => true,
|
||||
'text'=>'<span id="mail-index_buttonmailcreate" class="button" />',
|
||||
'link'=>false,
|
||||
'icon' => false
|
||||
);
|
||||
$file[] = array(
|
||||
),
|
||||
array(
|
||||
'no_lang' => true,
|
||||
'text'=>'<span id="mail-tree_target" class="dtree" />',
|
||||
'link'=>false,
|
||||
'icon' => false
|
||||
);
|
||||
|
||||
$linkData = array(
|
||||
'menuaction' => 'mail.mail_ui.importMessage',
|
||||
);
|
||||
|
||||
$file += array(
|
||||
'import message' => "javascript:egw_openWindowCentered2('".Egw::link('/index.php', $linkData,false)."','importMessageDialog',600,100,'no','$appname');",
|
||||
);
|
||||
|
||||
|
||||
// create account wizard
|
||||
if (self::access('createaccount'))
|
||||
{
|
||||
$file += array(
|
||||
'create new account' => "javascript:egw_openWindowCentered2('" .
|
||||
)
|
||||
)
|
||||
),
|
||||
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')",
|
||||
);
|
||||
}
|
||||
// display them all
|
||||
display_sidebox($appname,$menu_title,$file);
|
||||
|
||||
if ($GLOBALS['egw_info']['user']['apps']['admin'] && !Api\Header\UserAgent::mobile())
|
||||
{
|
||||
$file = Array(
|
||||
),
|
||||
)
|
||||
),
|
||||
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),
|
||||
)
|
||||
)
|
||||
);
|
||||
display_sidebox($appname,lang('Admin'),$file);
|
||||
}
|
||||
Api\Hooks::pgp_encryption_menu('mail');
|
||||
|
||||
// Menu generator
|
||||
foreach ($menus as &$menu)
|
||||
{
|
||||
foreach ($menu['items'] as &$item)
|
||||
{
|
||||
if (array_key_exists('enable', $item) && !$item['enable']) {
|
||||
unset($item);
|
||||
}
|
||||
}
|
||||
if (!(array_key_exists('enable', $menu) && !$menu['enable']))
|
||||
{
|
||||
display_sidebox($appname,$menu['title'],$menu['items']);
|
||||
}
|
||||
}
|
||||
|
||||
// add pgp encryption menu at the end
|
||||
Api\Hooks::pgp_encryption_menu('mail');
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user