mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-22 23:00:56 +01:00
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
|
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'] . ' '. 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;
|
// Mail sidebox menus
|
||||||
$serverCounter = $sieveEnabledServerCounter = 0;
|
$menus = array(
|
||||||
// account select box
|
array(
|
||||||
$selectedID = $profileID;
|
'title' => $GLOBALS['egw_info']['apps'][$appname]['title'],
|
||||||
$allAccountData = Mail\Account::search($only_current_user=true, $just_name=false, $order_by=null);
|
'enable' => true,
|
||||||
if ($allAccountData) {
|
'items' => array(
|
||||||
$rememberFirst=$selectedFound=null;
|
array(
|
||||||
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(
|
|
||||||
'no_lang' => true,
|
'no_lang' => true,
|
||||||
'text'=>'<span id="mail-index_buttonmailcreate" class="button" />',
|
'text'=>'<span id="mail-index_buttonmailcreate" class="button" />',
|
||||||
'link'=>false,
|
'link'=>false,
|
||||||
'icon' => false
|
'icon' => false
|
||||||
);
|
),
|
||||||
$file[] = array(
|
array(
|
||||||
'no_lang' => true,
|
'no_lang' => true,
|
||||||
'text'=>'<span id="mail-tree_target" class="dtree" />',
|
'text'=>'<span id="mail-tree_target" class="dtree" />',
|
||||||
'link'=>false,
|
'link'=>false,
|
||||||
'icon' => false
|
'icon' => false
|
||||||
);
|
)
|
||||||
|
)
|
||||||
$linkData = array(
|
),
|
||||||
'menuaction' => 'mail.mail_ui.importMessage',
|
array (
|
||||||
);
|
'title' => lang('Mail Menu'),
|
||||||
|
'enable' => true,
|
||||||
$file += array(
|
'items' => array (
|
||||||
'import message' => "javascript:egw_openWindowCentered2('".Egw::link('/index.php', $linkData,false)."','importMessageDialog',600,100,'no','$appname');",
|
'menuOpened' => false,
|
||||||
);
|
array (
|
||||||
|
'text' => 'import message',
|
||||||
|
'link' => "javascript:egw_openWindowCentered2('".
|
||||||
// create account wizard
|
Egw::link('/index.php', array('menuaction' => 'mail.mail_ui.importMessage') ,false).
|
||||||
if (self::access('createaccount'))
|
"','importMessageDialog',600,100,'no','$appname');"
|
||||||
{
|
),
|
||||||
$file += array(
|
array (
|
||||||
'create new account' => "javascript:egw_openWindowCentered2('" .
|
'enable' => self::access('createaccount'),
|
||||||
|
'text'=>'create new account',
|
||||||
|
'link'=> "javascript:egw_openWindowCentered2('" .
|
||||||
Egw::link('/index.php', array('menuaction' => 'mail.mail_wizard.add'), '').
|
Egw::link('/index.php', array('menuaction' => 'mail.mail_wizard.add'), '').
|
||||||
"','_blank',640,480,'yes')",
|
"','_blank',640,480,'yes')",
|
||||||
);
|
),
|
||||||
}
|
)
|
||||||
// display them all
|
),
|
||||||
display_sidebox($appname,$menu_title,$file);
|
array (
|
||||||
|
'title' => lang('Admin'),
|
||||||
if ($GLOBALS['egw_info']['user']['apps']['admin'] && !Api\Header\UserAgent::mobile())
|
'enable' => $GLOBALS['egw_info']['user']['apps']['admin'] && !Api\Header\UserAgent::mobile(),
|
||||||
{
|
'items' => array (
|
||||||
$file = Array(
|
|
||||||
'Site Configuration' => Egw::link('/index.php','menuaction=admin.uiconfig.index&appname=' . $appname),
|
'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