From 64ac219b509df82cddd28cf472e43f3b11def776 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Mon, 19 May 2014 16:13:37 +0000 Subject: [PATCH] * Admin/Mail: allow admins to set vacation notice for a user --- mail/inc/class.mail_hooks.inc.php | 35 +++++++++++++++++++++++++++++++ mail/setup/setup.inc.php | 1 + 2 files changed, 36 insertions(+) diff --git a/mail/inc/class.mail_hooks.inc.php b/mail/inc/class.mail_hooks.inc.php index 50f26740e4..13e84c48ea 100644 --- a/mail/inc/class.mail_hooks.inc.php +++ b/mail/inc/class.mail_hooks.inc.php @@ -16,6 +16,41 @@ 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 * * @param array/string $location location and other parameters (not used) diff --git a/mail/setup/setup.inc.php b/mail/setup/setup.inc.php index ab8e430d53..1180c0c611 100644 --- a/mail/setup/setup.inc.php +++ b/mail/setup/setup.inc.php @@ -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']['verify_settings'] = 'mail_bo::forcePrefReload'; $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';