$msg = $reply_msg['body'];
$header = $reply_msg['headers'];
$header['replytype'] = 'reply';
-
if ($vars->type == 'reply_auto') {
- switch ($reply_msg['type']) {
- case 'reply_all':
- $fillform_opts['reply_auto'] = 'all';
- break;
-
- case 'reply_list':
- $fillform_opts['reply_auto'] = 'list';
- break;
- }
+ $fillform_opts['auto'] = $reply_msg['type'];
}
-
$vars->type = $reply_msg['type'];
if ($vars->type == 'reply') {
if ($fwd_msg['format'] == 'html') {
$show_editor = true;
}
+ if ($vars->type == 'forward_auto') {
+ $fillform_opts['auto'] = $fwd_msg['type'];
+ }
$vars->type = 'forward';
if (!$prefs->isLocked('default_identity') &&
v5.0-git
--------
+[mms] Add chance to switch between forward options on compose page when using
+ auto-forward (DIMP).
[mms] Add chance to switch reply type to single recipient on compose page when
using auto-reply (DIMP).
[mms] Fix printing multipage HTML messages in Mozilla browsers (Bug #8708).
case 'AddAttachment':
this.uploading = false;
if (d.success) {
- this.addAttach(d.info.number, d.info.name, d.info.type, d.info.size);
+ this.addAttach(d.atc.num, d.atc.name, d.atc.type, d.atc.size);
} else {
this.setDisabled(false);
}
}
},
- // opts = focus, noupdate, reply_auto
+ // opts = auto, focus, fwd_list, noupdate
fillForm: function(msg, header, opts)
{
// On IE, this can get loaded before DOM:loaded. Check for an init
}
var bcc_add,
- identity = this.getIdentity($F('last_identity')),
- msgval = $('composeMessage');
+ identity = this.getIdentity($F('last_identity'));
opts = opts || {};
// Set auto-save-drafts now if not already active.
if (DIMP.conf_compose.auto_save_interval_val &&
!this.auto_save_interval) {
this.auto_save_interval = new PeriodicalExecuter(function() {
- var curr_hash = MD5.hash($('to', 'cc', 'bcc', 'subject').invoke('getValue').join('\0') + (this.editor_on ? this.rte.getData() : $F(msgval)));
+ var curr_hash = MD5.hash($('to', 'cc', 'bcc', 'subject').invoke('getValue').join('\0') + (this.editor_on ? this.rte.getData() : $F('composeMessage')));
if (this.last_msg && curr_hash != this.last_msg) {
this.uniqueSubmit('AutoSaveDraft');
}
this.auto_save_interval.execute();
}
- if (this.editor_on) {
- this.rte.setData(msg);
- } else {
- msgval.setValue(msg);
- this.setCursorPosition(msgval);
- }
+ this.setBodyText(msg, true);
$('to').setValue(header.to);
this.resizeto.resizeNeeded();
}
$('subject').setValue(header.subject);
+ this.processFwdList(opts.fwd_list);
+
Field.focus(opts.focus || 'to');
this.resizeMsgArea();
- switch (opts.reply_auto) {
- case 'all':
+ switch (opts.auto) {
+ case 'forward_attach':
+ $('noticerow', 'fwdattachnotice').invoke('show');
+ break
+
+ case 'forward_body':
+ $('noticerow', 'fwdbodynotice').invoke('show');
+ break
+
+ case 'reply_all':
$('noticerow', 'replyallnotice').invoke('show');
break
- case 'list':
+ case 'reply_list':
$('noticerow', 'replylistnotice').invoke('show');
break;
}
}
},
+ setBodyText: function(msg)
+ {
+ var msgval;
+
+ if (this.editor_on) {
+ this.rte.setData(msg);
+ } else {
+ msgval = $('composeMessage');
+ msgval.setValue(msg);
+ this.setCursorPosition(msgval);
+ }
+ },
+
+ processFwdList: function(f)
+ {
+ if (f && f.size()) {
+ f.each(function(ptr) {
+ this.addAttach(ptr.num, ptr.name, ptr.type, ptr.size);
+ }, this);
+ }
+ },
+
swapToAddressCallback: function(r)
{
if (r.response.header) {
$('to_loading_img').hide();
},
+ forwardAddCallback: function(r)
+ {
+ if (r.response.type) {
+ switch (r.response.type) {
+ case 'forward_attach':
+ this.processFwdList(r.response.opts.fwd_list);
+ break;
+
+ case 'forward_body':
+ this.setBodyText(r.response.body);
+ break;
+ }
+ }
+ },
+
focusEditor: function()
{
try {
case 'replyallnotice':
case 'replylistnotice':
+ case 'fwdattachnotice':
+ case 'fwdbodynotice':
elt.fade({
afterFinish: function() {
elt.up('TR').hide();
}.bind(this),
duration: 0.4
});
- $('to_loading_img').show();
- DimpCore.doAction('GetReplyData', { headeronly: 1, imp_compose: $F('composeCache'), type: 'reply' }, { callback: this.swapToAddressCallback.bind(this) });
+ if (id.startsWith('reply')) {
+ $('to_loading_img').show();
+ DimpCore.doAction('GetReplyData', { headeronly: 1, imp_compose: $F('composeCache'), type: 'reply' }, { callback: this.swapToAddressCallback.bind(this) });
+ } else {
+ DimpCore.doAction('GetForwardData', { dataonly: 1, imp_compose: $F('composeCache'), type: (id == 'fwdattachnotice' ? 'forward_body' : 'forward_attach') }, { callback: this.forwardAddCallback.bind(this) });
+ }
e.stop();
return;
}
DimpCompose.fillForm((i.id[2]) ? ("\n" + i.sig + r.body) : (r.body + "\n" + i.sig), r.header, r.opts);
- if (r.fwd_list && r.fwd_list.length) {
- r.fwd_list.each(function(ptr) {
- DimpCompose.addAttach(ptr.number, ptr.name, ptr.type, ptr.size);
- });
- }
-
if (editor_on) {
DimpCompose.toggleHtmlEditor(true);
}
* _checkUidvalidity(). Additional variables
* used:
* <pre>
+ * 'dataonly' - (boolean) Only return data information (DEFAULT:
+ * false).
* 'imp_compose' - (string) The IMP_Compose cache identifier.
* 'type' - (string) See IMP_Compose::forwardMessage().
* 'uid' - (string) Indices of the messages to forward (IMAP sequence
* 'header' - (array) The headers of the message.
* 'identity' - (integer) The identity ID to use for this message.
* 'imp_compose'- (string) The IMP_Compose cache identifier.
+ * 'opts' - (array) Additional options needed for DimpCompose.fillForm().
+ * 'type' - (string) The input 'type' value.
* 'ViewPort' - (object) See _viewPortData().
* </pre>
*/
public function GetForwardData($vars)
{
- $header = array();
- $msg = $header = null;
- $indices = $GLOBALS['imp_imap']->ob()->utils->fromSequenceString($vars->uid);
-
- $i = each($indices);
-
try {
- $imp_contents = IMP_Contents::singleton(reset($i['value']) . IMP::IDX_SEP . $i['key']);
$imp_compose = IMP_Compose::singleton($vars->imp_compose);
+ if (!($imp_contents = $imp_compose->getContentsOb())) {
+ $indices = $GLOBALS['imp_imap']->ob()->utils->fromSequenceString($vars->uid);
+ $i = each($indices);
+ $imp_contents = IMP_Contents::singleton(reset($i['value']) . IMP::IDX_SEP . $i['key']);
+ }
+
$fwd_msg = $imp_compose->forwardMessage($vars->type, $imp_contents);
- $header = $fwd_msg['headers'];
- $header['replytype'] = 'forward';
- $result = new stdClass;
/* Can't open session read-only since we need to store the message
* cache id. */
- $result->imp_compose = $imp_compose->getCacheId();
- $result->fwd_list = IMP_Dimp::getAttachmentInfo($imp_compose);
+ $result = new stdClass;
+ $result->opts = new stdClass;
+ $result->opts->fwd_list = IMP_Dimp::getAttachmentInfo($imp_compose);
$result->body = $fwd_msg['body'];
- $result->header = $header;
- $result->format = $fwd_msg['format'];
- $result->identity = $fwd_msg['identity'];
+ $result->type = $vars->type;
+ if (!$vars->dataonly) {
+ $result->format = $fwd_msg['format'];
+ $fwd_msg['headers']['replytype'] = 'forward';
+ $result->header = $fwd_msg['headers'];
+ $result->identity = $fwd_msg['identity'];
+ $result->imp_compose = $imp_compose->getCacheId();
+ if ($vars->type == 'forward_auto') {
+ $result->opts->auto = $fwd_msg['type'];
+ }
+ }
} catch (Horde_Exception $e) {
$GLOBALS['notification']->push($e, 'horde.error');
$result = $this->_checkUidvalidity($vars);
$i = each($indices);
$imp_contents = IMP_Contents::singleton(reset($i['value']) . IMP::IDX_SEP . $i['key']);
}
+
$reply_msg = $imp_compose->replyMessage($vars->type, $imp_contents);
- $header = $reply_msg['headers'];
- $header['replytype'] = 'reply';
+ $reply_msg['headers']['replytype'] = 'reply';
+ /* Can't open session read-only since we need to store the message
+ * cache id. */
$result = new stdClass;
- $result->header = $header;
+ $result->header = $reply_msg['headers'];
if (!$vars->headeronly) {
$result->body = $reply_msg['body'];
$result->format = $reply_msg['format'];
$result->identity = $reply_msg['identity'];
$result->imp_compose = $imp_compose->getCacheId();
if ($vars->type == 'reply_auto') {
- switch ($reply_msg['type']) {
- case 'reply_all':
- $result->opts = array('reply_auto' => 'all');
- break;
-
- case 'reply_list':
- $result->opts = array('reply_auto' => 'list');
- break;
- }
+ $result->opts = array('auto' => $reply_msg['type']);
}
}
} catch (Horde_Exception $e) {
*
* @return object An object with the following entries:
* <pre>
+ * 'atc' - TODO
* 'error' - (string) An error message.
+ * 'imp_compose' - TODO
* 'success' - (integer) 1 on success, 0 on failure.
* </pre>
*/
if ($_SESSION['imp']['file_upload'] &&
$imp_compose->addFilesFromUpload('file_')) {
- $info = IMP_Dimp::getAttachmentInfo($imp_compose);
+ $result->atc = end(IMP_Dimp::getAttachmentInfo($imp_compose));
$result->success = 1;
- $result->info = end($info);
$result->imp_compose = $imp_compose->getCacheId();
}
* <pre>
* 'body' - The text of the body part
* 'encoding' - The guessed charset to use for the reply
- * 'headers' - The headers of the message to use for the reply
* 'format' - The format of the body message
+ * 'headers' - The headers of the message to use for the reply
* 'identity' - The identity to use for the reply based on the original
* message's addresses.
+ * 'type' - The forward type used (either 'forward_attach',
+ * 'forward_body', or 'forward_both').
* </pre>
*/
public function forwardMessage($type, $contents, $attach = true)
'encoding' => isset($msg_text) ? $msg_text['encoding'] : Horde_Nls::getCharset(),
'format' => $format,
'headers' => $header,
- 'identity' => $this->_getMatchingIdentity($h)
+ 'identity' => $this->_getMatchingIdentity($h),
+ 'type' => $type
);
}
*
* @return array An array of arrays with the following keys:
* <pre>
- * 'number' - The current attachment number
+ * 'num' - The current attachment number
* 'name' - The HTML encoded attachment name
* 'type' - The MIME type of the attachment
* 'size' - The size of the attachment in KB (string)
$mime = $data['part'];
$fwd_list[] = array(
- 'number' => $atc_num,
'name' => htmlspecialchars($mime->getName(true)),
+ 'num' => $atc_num,
'type' => $mime->getType(),
'size' => $mime->getSize()
);
<ul class="notices">
<li id="replyallnotice" style="display:none"><?php echo _("You are currently replying to ALL recipients. Click here to reply to the original sender instead.") ?></li>
<li id="replylistnotice" style="display:none"><?php echo _("You are currently replying to the mailing list. Click here to reply to the original sender instead.") ?></li>
+ <li id="fwdattachnotice" style="display:none"><?php echo _("Click here to add the original message text to the body.") ?></li>
+ <li id="fwdbodynotice" style="display:none"><?php echo _("Click here to add the original message as an attachment.") ?></li>
</ul>
</td>
</tr>
}
/* Fixes broken inline-block. */
-div.msgStatus div, #msgHeadersContent .subject span, span.iconImg, span.contextImg, span.spellcheckPopdownImg, span.popdownImg, #qsearch_icon, #qsearch_close, #upload_wait {
+div.msgStatus div, #msgHeadersContent .subject span, span.iconImg, span.contextImg, span.spellcheckPopdownImg, span.popdownImg, #qsearch_icon, #qsearch_close, #upload_wait, #noticerow .notices li {
zoom: 1;
*display: inline;
}
}
/* Fixes broken inline-block. */
-div.msgStatus div, #msgHeadersContent .subject span, span.iconImg, span.contextImg, span.spellcheckPopdownImg, span.popdownImg, #qsearch_icon, #qsearch_close, #upload_wait {
+div.msgStatus div, #msgHeadersContent .subject span, span.iconImg, span.contextImg, span.spellcheckPopdownImg, span.popdownImg, #qsearch_icon, #qsearch_close, #upload_wait, #noticerow .notices li {
zoom: 1;
*display: inline;
}
padding: 1px;
}
+#noticerow .notices li {
+ display: -moz-inline-stack;
+ display: inline-block;
+}
+
#composeMessageParent {
background: #fff url("graphics/backhead_shadow.png") top repeat-x;
border-left: 1px silver solid;