From 4313b57675edae35b4cfa3edf2522fbf1df153c3 Mon Sep 17 00:00:00 2001 From: Hadi Nategh Date: Fri, 22 Jun 2018 16:04:50 +0200 Subject: [PATCH] W.I.P. of mail toggled on actions preferences --- mail/inc/class.mail_compose.inc.php | 6 ++-- mail/inc/class.mail_hooks.inc.php | 45 +++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+), 3 deletions(-) diff --git a/mail/inc/class.mail_compose.inc.php b/mail/inc/class.mail_compose.inc.php index 6ee005e13a..e84be02aea 100644 --- a/mail/inc/class.mail_compose.inc.php +++ b/mail/inc/class.mail_compose.inc.php @@ -112,7 +112,7 @@ class mail_compose * * @return array an array of actions */ - function getToolbarActions($content) + static function getToolbarActions($content) { $group = 0; $actions = array( @@ -215,7 +215,7 @@ class mail_compose ), ); - $acc_smime = Mail\Smime::get_acc_smime($this->mail_bo->profileID); + $acc_smime = Mail\Smime::get_acc_smime($content['mailaccount']); if ($acc_smime['acc_smime_password']) { $actions = array_merge($actions, array( @@ -1274,7 +1274,7 @@ class mail_compose //$GLOBALS['egw_info']['flags']['currentapp'] = 'mail';//should not be needed $etpl = new Etemplate('mail.compose'); - $etpl->setElementAttribute('composeToolbar', 'actions', $this->getToolbarActions($_content)); + $etpl->setElementAttribute('composeToolbar', 'actions', self::getToolbarActions($content)); if ($content['mimeType']=='html') { //mode="$cont[rtfEditorFeatures]" validation_rules="$cont[validation_rules]" base_href="$cont[upload_dir]" diff --git a/mail/inc/class.mail_hooks.inc.php b/mail/inc/class.mail_hooks.inc.php index a7d3d95a39..e4f43ab29f 100644 --- a/mail/inc/class.mail_hooks.inc.php +++ b/mail/inc/class.mail_hooks.inc.php @@ -181,6 +181,44 @@ class mail_hooks // modify folderlist, add a none entry, to be able to force the regarding settings, if no folders apply $folderList['none'] = lang('no folders'); + // Build toogled on actions sel options + $allActions = array_merge(mail_compose::getToolbarActions(array( + 'priority' => true, + 'mailaccount' => $GLOBALS['egw_info']['user']['preferences']['mail']['ActiveProfileID'] + ))); + $toggledOnActions = array ( + 'mail_compose.cc_expander' => array ( + 'id' => 'mail_compose.cc_expander', + 'label' => lang('Cc'), + ), + 'mail_compose.bcc_expander' => array ( + 'id' => 'mail_compose.bcc_expander', + 'label' => lang('Bcc') + ), + 'mail_compose.folder_expander' => array( + 'id' => 'mail_compose.folder_expander', + 'label' => lang('Folder') + ), + 'mail_compose.replyto_expander' => array( + 'id' => 'mail_compose.replyto_expander', + 'label' => lang('Reply to') + ) + ); + + foreach($allActions as $name => $action) + { + if ($action['checkbox']) + { + $toggledOnActions['mail_compose.'.$name] = array( + 'id' => 'mail_compose.'.$name, + 'label' => lang($action['caption']), + 'title' => lang($action['hint']), + 'icon' => $action['icon'], + 'app' => 'mail' + ); + } + } + /* Settings array for this app */ $settingsArray = array( array( @@ -368,6 +406,13 @@ class mail_hooks ), 'default' => 'vertical' ), + 'toggledOnActions' => array( + 'type' => 'taglist', + 'label' => 'Toggled on actions', + 'help' => 'List of actions to be switched/activated on by default', + 'name' => 'toggledOnActions', + 'values' => $toggledOnActions + ) ); if (!$GLOBALS['egw_info']['apps']['stylite']) unset($settingsArray['attachVCardAtCompose']); return $settingsArray;