Re-add ability to choose between the different kinds of forwarding.
However, lock the ability to choose by default - continue to default to
forwarding entire message as message/rfc822.
$show_editor = false;
$title = _("New Message");
-if (in_array($type, array('reply', 'reply_all', 'reply_auto', 'reply_list', 'forward', 'resume'))) {
+if (in_array($type, array('reply', 'reply_all', 'reply_auto', 'reply_list', 'forward_attach', 'forward_auto', 'forward_body', 'forward_both', 'resume'))) {
if (!$uid || !$folder) {
$type = 'new';
}
}
break;
-case 'forward':
- $fwd_msg = $imp_ui->getForwardData($imp_compose, $imp_contents, $uid . IMP::IDX_SEP . $folder);
+case 'forward_attach':
+case 'forward_auto':
+case 'forward_body':
+case 'forward_both':
+ $fwd_msg = $imp_compose->forwardMessage($type, $imp_contents);
$msg = $fwd_msg['body'];
$header = $fwd_msg['headers'];
$header['replytype'] = 'forward';
if (!($imp_contents = $imp_ui->getIMPContents($uid, $thismailbox))) {
break;
}
- $fwd_msg = $imp_compose->forwardMessage($imp_contents);
+ $fwd_msg = $imp_compose->forwardMessage('forward_attach', $imp_contents, false);
$header = $fwd_msg['headers'];
$notification->push(_("Forwarded message will be automatically added to your outgoing message."), 'horde.message');
break;
case 'forward':
- $fwd_msg = $imp_compose->forwardMessage($imp_contents);
+ $fwd_msg = $imp_compose->forwardMessage('forward_attach', $imp_contents);
$msg = $fwd_msg['body'];
$message .= "\n" . $msg;
- $imp_compose->attachIMAPMessage(array($uid . IMP::IDX_SEP . $thismailbox), $header);
break;
}
}
case 'reply_all':
case 'reply_auto':
case 'reply_list':
- case 'forward':
+ case 'forward_attach':
+ case 'forward_auto':
+ case 'forward_body':
+ case 'forward_both':
case 'redirect_compose':
case 'fwd_digest':
// These are all safe actions that might be invoked without a token.
$encoding = empty($charset) ? $reply_msg['encoding'] : $charset;
break;
-case 'forward':
+case 'forward_attach':
+case 'forward_auto':
+case 'forward_body':
+case 'forward_both':
if (!($imp_contents = $imp_ui->getIMPContents($uid, $thismailbox))) {
break;
}
- $fwd_msg = $imp_ui->getForwardData($imp_compose, $imp_contents, $uid . IMP::IDX_SEP . $thismailbox);
+ $fwd_msg = $imp_compose->forwardMessage($actionID, $imp_contents);
$msg = $fwd_msg['body'];
$header = $fwd_msg['headers'];
$format = $fwd_msg['format'];
$indices = Horde_Util::getFormData('fwddigest');
if (!empty($indices)) {
$msglist = unserialize(urldecode($indices));
- $subject_header = $imp_compose->attachIMAPMessage($msglist);
- if ($subject_header !== false) {
+ if (($subject_header = $imp_compose->attachIMAPMessage($msglist)) !== false) {
$header['subject'] = $subject_header;
}
}
$prefGroups['compose']['members'] = array_merge($prefGroups['compose']['members'], array('disposition_request_read'));
}
-$prefGroups['reply_forward'] = array(
+$prefGroups['reply'] = array(
'column' => _("Message Options"),
- 'label' => _("Message Replies/Forwards"),
- 'desc' => _("Configure how you reply to or forward mail."),
- 'members' => array('reply_quote', 'reply_format', 'forward_bodytext',
- 'reply_headers', 'attrib_text')
+ 'label' => _("Message Replies"),
+ 'desc' => _("Configure how you reply to mail."),
+ 'members' => array('reply_quote', 'reply_format', 'reply_headers',
+ 'attrib_text')
+);
+
+$prefGroups['forward'] = array(
+ 'column' => _("Message Options"),
+ 'label' => _("Message Forwards"),
+ 'desc' => _("Configure how you forward mail."),
+ 'members' => array('forward_bodytext')
);
$prefGroups['drafts'] = array(
// End Message Composition preferences
-// Message Replies/Forwards preferences
+// Message Replies preferences
// Should the original message be included?
$_prefs['reply_quote'] = array(
'type' => 'checkbox',
'desc' => _("Include original message in a reply?"));
-// When replying/forwarding to a message, should we use the same format as the
+// When replying to a message, should we use the same format as the
// original message?
$_prefs['reply_format'] = array(
'value' => 0,
'locked' => false,
'shared' => false,
'type' => 'checkbox',
- 'desc' => _("When replying/forwarding to a message, should we use the same format as the original message?"));
-
-// Should the original message be included?
-$_prefs['forward_bodytext'] = array(
- 'value' => 0,
- 'locked' => false,
- 'shared' => false,
- 'type' => 'checkbox',
- 'desc' => _("Include body text in forward message by default?"));
+ 'desc' => _("When replying to a message, should we use the same format as the original message?"));
// Reply to header summary - leave a brief summary of the header inside
// the message.
'desc' => _("How to attribute quoted lines in a reply"),
'help' => 'prefs-attrib_text');
-// End Message Replies/Forwards preferences
+// End Message Replies preferences
+
+
+// Message Forwards preferences
+
+// Should the body text of the original message be included?
+// If this preference is locked, the user will not be able to select the
+// forward method.
+$_prefs['forward_default'] = array(
+ 'value' => 'attach',
+ // Locked by default
+ 'locked' => true,
+ 'shared' => false,
+ 'type' => 'enum',
+ 'enum' => array(
+ 'attach' => _("As attachment"),
+ 'body' => _("In the body text"),
+ 'both' => _("As both body text and an attachment")
+ ),
+ 'desc' => _("How should messages be forwarded by default?"));
+
+// When forwarding a message, should we use the same format as the
+// original message (for the body text)?
+$_prefs['forward_format'] = array(
+ 'value' => 0,
+ // Locked by default
+ 'locked' => true,
+ 'shared' => false,
+ 'type' => 'checkbox',
+ 'desc' => _("When forwarding a message in the body text, should we use the same format as the original message?"));
+
+// End Message Forwards preferences
// Message Drafts preferences
v5.0-git
--------
+[mms] Improved forwarding options.
[mms] Add support for LIST-STATUS IMAP extension.
[mms] Add hook to allow determination of compose attachments MIME type.
[mms] Move AJAX processing framework to Horde (Request #4561).
[mms] Implement spellcheck on send in DIMP.
[mms] Sanity check - don't do message operations reliant on UID list if
UIDVALIDITY of mailbox has changed.
-[mms] Simplify forwarding - always attach entire message.
[mms] Remember splitbar position on login/refresh (DIMP).
[mms] Disable advanced functions if using POP3 driver (caching, on-demand
filtering, searching, sorting) because it is too resource intensive.
'alternative_display'
'attachment_display'
- 'forward_default'
+ 'forward_bodytext'
Hooks
break;
case 'ctx_message_forward':
- this.composeMailbox('forward');
+ case 'ctx_message_reply':
+ this.composeMailbox(id == 'ctx_message_forward' ? 'forward_auto' : 'reply_auto');
break;
case 'ctx_message_source':
this.composeMailbox(id.substring(10));
break;
+ case 'ctx_forward_attach':
+ case 'ctx_forward_body':
+ case 'ctx_forward_both':
+ this.composeMailbox(id.substring(4));
+ break;
+
case 'oa_preview_hide':
DIMP.conf.preview_pref_old = DIMP.conf.preview_pref;
this.togglePreviewPane('');
case 'button_forward':
case 'button_reply':
- this.composeMailbox(id == 'button_reply' ? 'reply_auto' : 'forward');
+ this.composeMailbox(id == 'button_reply' ? 'reply_auto' : 'forward_auto');
break;
case 'button_ham':
this._addMouseEvents({ id: 'folderopts', type: 'folderopts' }, $('folderopts').down(1));
DM.addSubMenu('ctx_message_reply', 'ctx_reply');
+ if ($('ctx_forward')) {
+ DM.addSubMenu('ctx_message_forward', 'ctx_forward');
+ }
[ 'ctx_message_', 'oa_', 'ctx_draft_' ].each(function(i) {
if ($(i + 'setflag')) {
DM.addSubMenu(i + 'setflag', 'ctx_flag');
} else {
this._addMouseEvents({ id: 'button_reply', type: 'reply' }, $('button_reply'));
DM.disable('button_reply_img', true, true);
+
+ this._addMouseEvents({ id: 'button_forward', type: 'forward' }, $('button_forward'));
+ DM.disable('button_forward_img', true, true);
}
new Drop('dropbase', this._folderDropConfig);
switch (type) {
case 'reply':
case 'reply_all':
+ case 'reply_auto':
case 'reply_list':
func = 'GetReplyData';
break;
- case 'forward':
+ case 'forward_auto':
+ case 'forward_attach':
+ case 'forward_body':
+ case 'forward_both':
func = 'GetForwardData';
break;
}
case 'forward_link':
case 'reply_link':
- this.quickreply(id == 'reply_link' ? 'reply' : 'forward');
+ this.quickreply(id == 'reply_link' ? 'reply_auto' : 'forward_auto');
e.stop();
return;
this.quickreply(id.substring(10));
break;
+ case 'ctx_forward_attach':
+ case 'ctx_forward_body':
+ case 'ctx_forward_both':
+ this.quickreply(id.substring(4));
+ break;
+
default:
parentfunc(e);
break;
tmp = $('reply_link', 'forward_link').compact().invoke('up', 'SPAN').concat([ $('ctx_contacts_new') ]).compact().invoke('remove');
} else {
this.addPopdown('reply_link', 'replypopdown');
+ if ($('ctx_forwardpopdown')) {
+ this.addPopdown('forward_link', 'forwardpopdown');
+ }
}
/* Set up address linking. */
* used:
* <pre>
* 'imp_compose' - (string) The IMP_Compose cache identifier.
+ * 'type' - (string) See IMP_Compose::forwardMessage().
* 'uid' - (string) Indices of the messages to forward (IMAP sequence
* string).
* </pre>
$indices = $GLOBALS['imp_imap']->ob()->utils->fromSequenceString($vars->uid);
$i = each($indices);
- $idx_string = reset($i['value']) . IMP::IDX_SEP . $i['key'];
try {
- $imp_contents = IMP_Contents::singleton($idx_string);
+ $imp_contents = IMP_Contents::singleton(reset($i['value']) . IMP::IDX_SEP . $i['key']);
$imp_compose = IMP_Compose::singleton($vars->imp_compose);
- $imp_ui = new IMP_Ui_Compose();
- $fwd_msg = $imp_ui->getForwardData($imp_compose, $imp_contents, $idx_string);
+ $fwd_msg = $imp_compose->forwardMessage($vars->type, $imp_contents);
$header = $fwd_msg['headers'];
$header['replytype'] = 'forward';
{
$indices = $GLOBALS['imp_imap']->ob()->utils->fromSequenceString($vars->uid);
$i = each($indices);
- $idx_string = reset($i['value']) . IMP::IDX_SEP . $i['key'];
try {
- $imp_contents = IMP_Contents::singleton($idx_string);
+ $imp_contents = IMP_Contents::singleton(reset($i['value']) . IMP::IDX_SEP . $i['key']);
$imp_compose = IMP_Compose::singleton($vars->imp_compose);
$reply_msg = $imp_compose->replyMessage($vars->type, $imp_contents);
$header = $reply_msg['headers'];
/**
* Determine the text and headers for a forwarded message.
*
+ * @param string $type The forward type (forward_attach,
+ * forward_body, forward_both,
+ * forward_auto).
* @param IMP_Contents $contents An IMP_Contents object.
+ * @param boolean $attach Attach the forwarded message?
*
* @return array An array with the following keys:
* <pre>
* message's addresses.
* </pre>
*/
- public function forwardMessage($contents)
+ public function forwardMessage($type, $contents, $attach = true)
{
/* The headers of the message. */
$header = array(
'subject' => ''
);
+ if ($GLOBALS['prefs']->isLocked('forward_default') ||
+ ($type == 'forward_auto')) {
+ if (!($type = $GLOBALS['prefs']->getValue('forward_default'))) {
+ $type = 'attach';
+ }
+ $type = 'forward_' . $type;
+ }
+
$h = $contents->getHeaderOb();
$format = 'text';
$msg = '';
$header['subject'] = 'Fwd:';
}
- if ($GLOBALS['prefs']->getValue('forward_bodytext')) {
+ if (in_array($type, array('forward_body', 'forward_both'))) {
$from = Horde_Mime_Address::addrArray2String($h->getOb('from'));
$msg_pre = "\n----- " .
$compose_html = (($_SESSION['imp']['view'] != 'mimp') && $GLOBALS['prefs']->getValue('compose_html'));
$msg_text = $this->_getMessageText($contents, array(
- 'html' => ($GLOBALS['prefs']->getValue('reply_format') || $compose_html),
+ 'html' => ($GLOBALS['prefs']->getValue('forward_format') || $compose_html),
'type' => 'forward'
));
}
}
+ if ($attach &&
+ in_array($type, array('forward_attach', 'forward_both'))) {
+ $this->attachIMAPMessage(array($contents->getUid() . IMP::IDX_SEP . $contents->getMailbox()));
+ }
+
return array(
'body' => $msg,
'encoding' => isset($msg_text) ? $msg_text['encoding'] : Horde_Nls::getCharset(),
if ($update) {
$GLOBALS['prefs']->setValue('sortpref', serialize($sortpref));
}
+
+ switch ($GLOBALS['prefs']->getValue('forward_default')) {
+ case 'forward_attachments':
+ $GLOBALS['prefs']->setValue('forward_default', 'both');
+ break;
+
+ case 'forward_all':
+ $GLOBALS['prefs']->setValue('forward_default', 'attach');
+ break;
+
+ case 'forward_body':
+ $GLOBALS['prefs']->setValue('forward_default', 'body');
+ break;
+
+ case 'attach':
+ case 'body':
+ case 'both':
+ // Ignore - already converted.
+ break;
+
+ default:
+ $GLOBALS['prefs']->setValue('forward_default', 'attach');
+ $GLOBALS['prefs']->setDefault('forward_default', true);
+ break;
+ }
}
/**
/**
*/
- public function getForwardData(&$imp_compose, &$imp_contents, $index)
- {
- $fwd_msg = $imp_compose->forwardMessage($imp_contents);
- $subject_header = $imp_compose->attachIMAPMessage(array($index), $fwd_msg['headers']);
- if ($subject_header !== false) {
- $fwd_msg['headers']['subject'] = $subject_header;
- }
-
- return $fwd_msg;
- }
-
- /**
- */
public function attachAutoCompleter($fields)
{
/* Attach autocompleters to the compose form elements. */
if (!isset($options)) {
$options = array();
}
- Horde::addInlineScript(Horde::popupJs(Horde::applicationUrl('compose.php'), array('params' => array_merge(array('popup' => 1), $options, IMP::getComposeArgs()))), 'dom');
+ Horde::addInlineScript(array(
+ Horde::popupJs(Horde::applicationUrl('compose.php'), array('params' => array_merge(array('popup' => 1), $options, IMP::getComposeArgs())))
+ ), 'dom');
}
if (!empty($newmsgs)) {
$a_template->set('show_reply_all', Horde::widget(IMP::composeLink(array(), array('actionID' => 'reply_all') + $compose_params), _("To All"), 'widget', '', '', _("To _All"), true));
}
- $a_template->set('forward', Horde::widget(IMP::composeLink(array(), array('actionID' => 'forward') + $compose_params), _("Forward"), 'widget', '', '', _("Fo_rward"), true));
+ $fwd_locked = $prefs->isLocked('forward_default');
+ $a_template->set('forward', Horde::widget(IMP::composeLink(array(), array('actionID' => 'forward_auto') + $compose_params), _("Forward"), 'widget' . ($fwd_locked ? '' : ' hasmenu'), '', '', _("Fo_rward"), true));
+ if (!$fwd_locked) {
+ $a_template->set('forward_attach', Horde::widget(IMP::composeLink(array(), array('actionID' => 'forward_attach') + $compose_params), _("As Attachment"), 'widget', '', '', _("As Attachment"), true));
+ $a_template->set('forward_body', Horde::widget(IMP::composeLink(array(), array('actionID' => 'forward_body') + $compose_params), _("In Body Text"), 'widget', '', '', _("In Body Text"), true));
+ $a_template->set('forward_both', Horde::widget(IMP::composeLink(array(), array('actionID' => 'forward_both') + $compose_params), _("Attachment and Body Text"), 'widget', '', '', _("Attachment and Body Text"), true));
+ }
$a_template->set('redirect', Horde::widget(IMP::composeLink(array(), array('actionID' => 'redirect_compose') + $compose_params), _("Redirect"), 'widget', '', '', _("Redirec_t"), true));
}
<div class="dimpActions dimpActionsMsg">
<div class="headercloseimg closeImg" id="windowclose" title="X"></div>
<div><?php echo IMP_Dimp::actionButton(array('class' => 'hasmenu', 'icon' => 'Reply', 'id' => 'reply_link', 'title' => _("Reply"))) ?></div>
- <div><?php echo IMP_Dimp::actionButton(array('icon' => 'Forward', 'id' => 'forward_link', 'title' => _("Forward"))) ?></div>
+ <div><?php echo IMP_Dimp::actionButton(array('class' => 'hasmenu', 'icon' => 'Forward', 'id' => 'forward_link', 'title' => _("Forward"))) ?></div>
<?php if (!empty($conf['spam']['reporting']) && (!$conf['spam']['spamfolder'] || ($folder != IMP::folderPref($prefs->getValue('spam_folder'), true)))): ?>
<div><?php echo IMP_Dimp::actionButton(array('icon' => 'Spam', 'id' => 'button_spam', 'title' => _("Spam"))) ?></div>
<?php endif; ?>
<a id="ctx_reply_reply_list"><span class="contextImg"></span><?php echo _("To List") ?></a>
<?php endif; ?>
</div>
+
+<?php if (!$prefs->isLocked('forward_default')): ?>
+<div class="context" id="ctx_forwardpopdown" style="display:none;">
+ <a id="ctx_forward_attach"><span class="contextImg"></span><?php echo _("As Attachment") ?></a>
+ <a id="ctx_forward_body"><span class="contextImg"></span><?php echo _("In Body Text") ?></a>
+ <a id="ctx_forward_both"><span class="contextImg"></span><?php echo _("Attachment and Body Text") ?></a>
+</div>
+<?php endif; ?>
<?php endif; ?>
<div class="context" id="ctx_contacts" style="display:none">
<a id="ctx_reply_reply_list"><span class="contextImg"></span><?php echo _("To List") ?></a>
</div>
+<?php if (!$prefs->isLocked('forward_default')): ?>
+<div class="context" id="ctx_forward" style="display:none;">
+ <a id="ctx_forward_attach"><span class="contextImg"></span><?php echo _("As Attachment") ?></a>
+ <a id="ctx_forward_body"><span class="contextImg"></span><?php echo _("In Body Text") ?></a>
+ <a id="ctx_forward_both"><span class="contextImg"></span><?php echo _("Attachment and Body Text") ?></a>
+</div>
+<?php endif; ?>
+
<div class="context" id="ctx_otheractions" style="display:none">
<a id="oa_preview_hide"><span class="contextImg"></span><?php echo _("Hide Preview") ?></a>
<a id="oa_preview_show"><span class="contextImg"></span><?php echo _("Show Preview") ?></a>
<if:show_reply_all><li><tag:show_reply_all /></li></if:show_reply_all>
</ul>
</li>
- <li><tag:forward /></li>
+ <li><tag:forward />
+<if:forward_attach>
+ <ul>
+ <li><tag:forward_attach /></li>
+ <li><tag:forward_body /></li>
+ <li><tag:forward_both /></li>
+ </ul>
+</if:forward_attach>
+ </li>
<li><tag:redirect /></li>
</if:reply>
<if:show_thread><li><tag:show_thread /></li></if:show_thread>
#ctx_reply_reply span.contextImg, #ctx_reply_reply_all span.contextImg, #ctx_reply_reply_list span.contextImg {
background-image: url("graphics/replyall.png");
}
-#ctx_message_forward span.contextImg {
+#ctx_message_forward span.contextImg, #ctx_forward_attach span.contextImg, #ctx_forward_body span.contextImg, #ctx_forward_both span.contextImg {
background-image: url("graphics/forward.png");
}
#ctx_folder_empty span.contextImg, #ctx_message_deleted span.contextImg, #ctx_draft_deleted span.contextImg, #oa_purge_deleted span.contextImg {
#ctx_reply_reply span.contextImg, #ctx_reply_reply_all span.contextImg, #ctx_reply_reply_list span.contextImg {
background-image: url("graphics/replyall.png");
}
-#ctx_message_forward span.contextImg {
+#ctx_message_forward span.contextImg, #ctx_forward_attach span.contextImg, #ctx_forward_body span.contextImg, #ctx_forward_both span.contextImg {
background-image: url("graphics/forward.png");
}
#ctx_folder_empty span.contextImg, #ctx_message_deleted span.contextImg, #ctx_draft_deleted span.contextImg, #oa_purge_deleted span.contextImg {