* Admin/Mail: allow admins to set vacation notice for a user

This commit is contained in:
Ralf Becker 2014-05-19 16:13:37 +00:00
parent f14384baff
commit 64ac219b50
2 changed files with 36 additions and 0 deletions

View File

@ -16,6 +16,41 @@
class mail_hooks class mail_hooks
{ {
/** /**
* Hook to add context menu entries to user list
*
* @param array $data
*/
static function edit_user($data)
{
unset($data); // not used, but required by function signature
$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'])
{
$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
{
$user_actions[] = array (
'id' => 'mail_vacation',
'caption' => 'Vacation notice',
'popup' => '750x420',
'url' => 'menuaction=mail.mail_sieve.editVacation&account_id=$id',
);
}
return $user_actions;
}
/**
* Hook called by link-class to include mail in the appregistry of the linkage * Hook called by link-class to include mail in the appregistry of the linkage
* *
* @param array/string $location location and other parameters (not used) * @param array/string $location location and other parameters (not used)

View File

@ -35,6 +35,7 @@ $setup_info['mail']['hooks']['sidebox_menu'] = 'mail_hooks::sidebox_menu';
$setup_info['mail']['hooks']['session_creation'] = 'mail_bo::resetConnectionErrorCache'; $setup_info['mail']['hooks']['session_creation'] = 'mail_bo::resetConnectionErrorCache';
$setup_info['mail']['hooks']['verify_settings'] = 'mail_bo::forcePrefReload'; $setup_info['mail']['hooks']['verify_settings'] = 'mail_bo::forcePrefReload';
$setup_info['mail']['hooks']['check_notify'] = 'mail_hooks::notification_check_mailbox'; $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'][] = 'home'; $setup_info['mail']['hooks'][] = 'home';