mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-24 15:49:06 +01:00
first stage of allowing mail app to display further actions in emailadmin edit: Folder ACL and Vacation notice for now
This commit is contained in:
parent
c07c550e7a
commit
a0ba88621c
@ -18,40 +18,48 @@ class mail_hooks
|
||||
/**
|
||||
* Hook to add context menu entries to user list
|
||||
*
|
||||
* @param array $data
|
||||
* @param array $data values for keys account_id and acc_id
|
||||
*/
|
||||
static function edit_user($data)
|
||||
static function emailadmin_edit($data)
|
||||
{
|
||||
unset($data); // not used, but required by function signature
|
||||
$actions = array();
|
||||
|
||||
$have_imap_admin_and_sieve = false;
|
||||
// list all mail accounts
|
||||
foreach(emailadmin_account::search(false, 'params', null, false, 0, false) as $params)
|
||||
{
|
||||
// check if account is valid for multiple users, has admin credentials and sieve enabled
|
||||
if (emailadmin_account::is_multiple($params) &&
|
||||
$params['acc_imap_admin_username'] && $params['acc_sieve_enabled'] ||
|
||||
$params['acc_imap_type'] == 'managementserver_imap')
|
||||
{
|
||||
$have_imap_admin_and_sieve = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
$user_actions = array();
|
||||
|
||||
if ($have_imap_admin_and_sieve) // add action to set vacation notice for a user
|
||||
$account = emailadmin_account::read($data['acc_id'], $data['account_id']);
|
||||
if (emailadmin_account::is_multiple($account) && $account['acc_imap_admin_username'] ||
|
||||
$account['acc_imap_type'] == 'managementserver_imap')
|
||||
{
|
||||
translation::add_app('mail');
|
||||
|
||||
$user_actions[] = array (
|
||||
'id' => 'mail_vacation',
|
||||
'caption' => 'Vacation notice',
|
||||
'popup' => '750x420',
|
||||
'url' => 'menuaction=mail.mail_sieve.editVacation&account_id=$id',
|
||||
'allowMultiple' => false,
|
||||
);
|
||||
if (true /* ToDo check ACL available */ || $account['acc_imap_type'] == 'managementserver_imap')
|
||||
{
|
||||
$actions[] = array (
|
||||
'id' => 'mail_acl',
|
||||
'caption' => 'Folder ACL',
|
||||
'icon' => 'lock',
|
||||
'popup' => '750x420',
|
||||
'url' => array(
|
||||
'menuaction' => 'mail.mail_acl.edit',
|
||||
'acc_id' => $data['acc_id'],
|
||||
'account_id' => $data['account_id'],
|
||||
),
|
||||
);
|
||||
}
|
||||
if ($account['acc_sieve_enabled'] || $account['acc_imap_type'] == 'managementserver_imap')
|
||||
{
|
||||
$actions[] = array (
|
||||
'id' => 'mail_vacation',
|
||||
'caption' => 'Vacation notice',
|
||||
'icon' => 'mail/navbar',
|
||||
'popup' => '750x420',
|
||||
'url' => array(
|
||||
'menuaction' => 'mail.mail_sieve.editVacation',
|
||||
'acc_id' => $data['acc_id'],
|
||||
'account_id' => $data['account_id'],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
return $user_actions;
|
||||
return $actions;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -36,7 +36,7 @@ $setup_info['mail']['hooks']['session_creation'] = 'mail_bo::resetConnectionErro
|
||||
$setup_info['mail']['hooks']['verify_settings'] = 'mail_bo::forcePrefReload';
|
||||
$setup_info['mail']['hooks']['clear_cache'] = 'mail_bo::unsetCachedObjects';
|
||||
$setup_info['mail']['hooks']['check_notify'] = 'mail_hooks::notification_check_mailbox';
|
||||
$setup_info['mail']['hooks']['edit_user'] = 'mail_hooks::edit_user';
|
||||
$setup_info['mail']['hooks']['emailadmin_edit'] = 'mail_hooks::emailadmin_edit';
|
||||
|
||||
/*
|
||||
$setup_info['mail']['hooks'][] = 'home';
|
||||
|
Loading…
Reference in New Issue
Block a user