From: Michael M Slusarz Date: Thu, 19 Nov 2009 21:03:41 +0000 (-0700) Subject: Auto-determine correct recipient when clicking on Base reply button X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=b821d067b0e30206e6acfdaff8ac860a49754814;p=horde.git Auto-determine correct recipient when clicking on Base reply button --- diff --git a/imp/compose-dimp.php b/imp/compose-dimp.php index 84fa93e42..fe0fdd60a 100644 --- a/imp/compose-dimp.php +++ b/imp/compose-dimp.php @@ -210,7 +210,7 @@ $folder = Horde_Util::getFormData('folder'); $show_editor = false; $title = _("New Message"); -if (in_array($type, array('reply', 'reply_all', 'reply_list', 'forward', 'resume'))) { +if (in_array($type, array('reply', 'reply_all', 'reply_auto', 'reply_list', 'forward', 'resume'))) { if (!$uid || !$folder) { $type = 'new'; } @@ -227,11 +227,13 @@ if (in_array($type, array('reply', 'reply_all', 'reply_list', 'forward', 'resume switch ($type) { case 'reply': case 'reply_all': +case 'reply_auto': case 'reply_list': $reply_msg = $imp_compose->replyMessage($type, $imp_contents, Horde_Util::getFormData('to')); $msg = $reply_msg['body']; $header = $reply_msg['headers']; $header['replytype'] = 'reply'; + $type = $reply_msg['type']; if ($type == 'reply') { $title = _("Reply:"); diff --git a/imp/compose.php b/imp/compose.php index 61d8fdc67..8570ca1fb 100644 --- a/imp/compose.php +++ b/imp/compose.php @@ -93,6 +93,7 @@ if ($actionID) { case 'draft': case 'reply': case 'reply_all': + case 'reply_auto': case 'reply_list': case 'forward': case 'redirect_compose': @@ -305,6 +306,7 @@ case 'redirect_expand_addr': case 'reply': case 'reply_all': +case 'reply_auto': case 'reply_list': if (!($imp_contents = _getIMPContents($uid, $thismailbox))) { break; @@ -314,6 +316,7 @@ case 'reply_list': $msg = $reply_msg['body']; $header = $reply_msg['headers']; $format = $reply_msg['format']; + $actionID = $reply_msg['type']; if (!is_null($rtemode)) { $rtemode = $rtemode || $format == 'html'; diff --git a/imp/js/DimpBase.js b/imp/js/DimpBase.js index 5c78ea741..997ebbf32 100644 --- a/imp/js/DimpBase.js +++ b/imp/js/DimpBase.js @@ -1765,7 +1765,7 @@ var DimpBase = { case 'button_forward': case 'button_reply': - this.composeMailbox(id == 'button_reply' ? 'reply' : 'forward'); + this.composeMailbox(id == 'button_reply' ? 'reply_auto' : 'forward'); break; case 'button_ham': diff --git a/imp/lib/Compose.php b/imp/lib/Compose.php index 32a7a349f..4c9caa4c5 100644 --- a/imp/lib/Compose.php +++ b/imp/lib/Compose.php @@ -1230,8 +1230,8 @@ class IMP_Compose /** * Determines the reply text and headers for a message. * - * @param string $actionID The reply action (reply, reply_all, - * reply_list or *). + * @param string $type The reply type (reply, reply_all, + * reply_auto, reply_list, or *). * @param IMP_Contents $contents An IMP_Contents object. * @param string $to The recipient of the reply. Overrides * the automatically determined value. @@ -1246,7 +1246,7 @@ class IMP_Compose * message's addresses. * */ - public function replyMessage($actionID, $contents, $to = null) + public function replyMessage($type, $contents, $to = null) { global $prefs; @@ -1260,6 +1260,7 @@ class IMP_Compose $h = $contents->getHeaderOb(); $match_identity = $this->_getMatchingIdentity($h); + $reply_type = 'reply'; $this->_metadata['mailbox'] = $contents->getMailbox(); $this->_metadata['reply_type'] = 'reply'; @@ -1283,16 +1284,16 @@ class IMP_Compose ? 'Re: ' : 'Re: ' . $GLOBALS['imp_imap']->ob()->utils->getBaseSubject($subject, array('keepblob' => true)); - if (in_array($actionID, array('reply', '*'))) { + if (in_array($type, array('reply', 'reply_auto', '*'))) { ($header['to'] = $to) || ($header['to'] = Horde_Mime_Address::addrArray2String($h->getOb('reply-to'))) || ($header['to'] = Horde_Mime_Address::addrArray2String($h->getOb('from'))); - if ($actionID == '*') { + if ($type == '*') { $all_headers['reply'] = $header; } } - if (in_array($actionID, array('reply_all', '*'))) { + if (in_array($type, array('reply_all', '*'))) { /* Filter out our own address from the addresses we reply to. */ $identity = Identity::singleton(array('imp', 'imp')); $all_addrs = array_keys($identity->getAllFromAddresses(true)); @@ -1338,32 +1339,37 @@ class IMP_Compose /* Build the Bcc: header. */ $header['bcc'] = Horde_Mime_Address::addrArray2String($h->getOb('bcc') + $identity->getBccAddresses(), array('filter' => $all_addrs)); - if ($actionID == '*') { + if ($type == '*') { $all_headers['reply_all'] = $header; } + + $reply_type = 'reply_all'; } - if (in_array($actionID, array('reply_list', '*'))) { + if (in_array($type, array('reply_auto', 'reply_list', '*'))) { $imp_ui = new IMP_UI_Message(); $list_info = $imp_ui->getListInformation($h); if ($list_info['exists']) { $header['to'] = $list_info['reply_list']; - if ($actionID == '*') { + if ($type == '*') { $all_headers['reply_list'] = $header; } } + + $reply_type = 'reply_list'; } - if ($actionID == '*') { + if ($type == '*') { $header = $all_headers; } if (!$prefs->getValue('reply_quote')) { return array( 'body' => '', - 'headers' => $header, 'format' => 'text', - 'identity' => $match_identity + 'headers' => $header, + 'identity' => $match_identity, + 'type' => $reply_type ); } @@ -1410,9 +1416,10 @@ class IMP_Compose return array( 'body' => $msg . "\n", 'encoding' => $msg_text['encoding'], - 'headers' => $header, 'format' => $msg_text['mode'], - 'identity' => $match_identity + 'headers' => $header, + 'identity' => $match_identity, + 'type' => $reply_type ); } diff --git a/imp/message.php b/imp/message.php index e520a3e8c..9e3de7f85 100644 --- a/imp/message.php +++ b/imp/message.php @@ -474,7 +474,7 @@ if (!$readonly) { $disable_compose = !IMP::canCompose(); if (!$disable_compose) { - $a_template->set('reply', Horde::widget(IMP::composeLink(array(), array('actionID' => 'reply') + $compose_params), _("Reply"), 'widget hasmenu', '', '', _("_Reply"), true)); + $a_template->set('reply', Horde::widget(IMP::composeLink(array(), array('actionID' => 'reply_auto') + $compose_params), _("Reply"), 'widget hasmenu', '', '', _("_Reply"), true)); $a_template->set('reply_sender', Horde::widget(IMP::composeLink(array(), array('actionID' => 'reply') + $compose_params), _("To Sender"), 'widget', '', '', _("To Sender"), true)); if ($list_info['reply_list']) {