if (count($_POST)) {
$result = new stdClass;
$result->action = $action;
- $result->success = false;
+ $result->success = 0;
/* Update the file attachment information. */
if ($action == 'add_attachment') {
if ($_SESSION['imp']['file_upload'] &&
$imp_compose->addFilesFromUpload('file_')) {
$info = DIMP::getAttachmentInfo($imp_compose);
- $result->success = true;
+ $result->success = 1;
$result->info = end($info);
$result->imp_compose = $imp_compose->getCacheId();
}
/* Save the draft. */
try {
$res = $imp_compose->saveDraft($header, Util::getFormData('message', ''), NLS::getCharset(), Util::getFormData('html'));
- $result->success = true;
+ $result->success = 1;
/* Delete existing draft. */
_removeAutoSaveDraft(Util::getFormData('draft_index'));
$message = Util::getFormData('message');
$html = Util::getFormData('html');
- $result->reply_type = Util::getFormData('reply_type');
- $result->index = Util::getFormData('index');
- $result->reply_folder = Util::getFormData('folder');
+ $result->index = intval(Util::getFormData('index'));
+ if ($reply_type = Util::getFormData('reply_type')) {
+ $result->reply_folder = Util::getFormData('folder');
+ $result->reply_type = $reply_type;
+ }
/* Use IMP_Tree to determine whether the sent mail folder was
* created. */
$imptree->eltDiffStart();
$options = array(
+ 'readreceipt' => Util::getFormData('request_read_receipt'),
+ 'reply_index' => $result->index . IMP::IDX_SEP . $result->reply_folder,
+ 'reply_type' => $reply_type,
+ 'save_attachments' => Util::getFormData('save_attachments_select'),
'save_sent' => (($prefs->isLocked('save_sent_mail'))
? $identity->getValue('save_sent_mail')
: (bool)Util::getFormData('save_sent_mail')),
'sent_folder' => $identity->getValue('sent_mail_folder'),
- 'save_attachments' => Util::getFormData('save_attachments_select'),
- 'reply_type' => $result->reply_type,
- 'reply_index' => $result->index . IMP::IDX_SEP . $result->reply_folder,
- 'readreceipt' => Util::getFormData('request_read_receipt')
);
try {
$notification->push($e->getMessage(), 'horde.error');
break;
}
- $result->success = true;
+ $result->success = 1;
/* Remove any auto-saved drafts. */
if ($prefs->getValue('auto_save_drafts') ||
$prefs->getValue('auto_delete_drafts')) {
_removeAutoSaveDraft(Util::getFormData('draft_index'));
- $result->draft_delete = true;
+ $result->draft_delete = 1;
}
if ($sent && $prefs->getValue('compose_confirm')) {
$notification->push(_("Message sent successfully."), 'horde.success');
}
+ /* Update maillog information. */
+ if (!empty($header['in_reply_to']) &&
+ !empty($GLOBALS['conf']['maillog']['use_maillog'])) {
+ $result->log = array();
+ foreach (IMP_Maillog::parseLog($header['in_reply_to']) as $val) {
+ $result->log[] = htmlspecialchars($val['msg']);
+ }
+ }
+
$res = DIMP::getFolderResponse($imptree);
if (!empty($res)) {
$result->folder = $res['a'][0];
return;
}
this.pp = data;
- pp_uid = data.imapuid + data.view;
+ pp_uid = this._getPPId(data.imapuid, data.view);
if (this.ppfifo.indexOf(pp_uid) != -1) {
// There is a chance that the message may have been marked
}
// Store in cache.
- ppuid = r.index + r.folder;
+ ppuid = this._getPPId(r.index, r.folder);
this._expirePPCache([ ppuid ]);
this.ppcache[ppuid] = resp;
this.ppfifo.push(ppuid);
// Add message information
if (r.log) {
- $('msgInfo').show();
- $('infolist_col').show();
- $('infolist_exp').hide();
-
- tmp = '';
- r.log.each(function(entry) {
- tmp += '<tr><td>' + entry + '</td></tr>';
- });
- $('infolist').down('TABLE').update(tmp);
+ this.updateMsgInfo(r.log);
} else {
$('msgInfo').hide();
}
this._addHistory('msg:' + row.view + ':' + row.imapuid);
},
+ // opts = index, mailbox
+ updateMsgInfo: function(log, opts)
+ {
+ var tmp = '';
+
+ if (!opts ||
+ (this.pp.imapuid == opts.index &&
+ this.pp.view == opts.mailbox)) {
+ $('msgInfo').show();
+
+ if (opts) {
+ $('infolist_col').show();
+ $('infolist_exp').hide();
+ }
+
+ log.each(function(entry) {
+ tmp += '<tr><td>' + entry + '</td></tr>';
+ });
+
+ $('infolist').down('TABLE').update(tmp);
+ }
+
+ if (opts) {
+ tmp = this._getPPId(opts.index, opts.mailbox);
+ if (this.ppcache[tmp]) {
+ this.ppcache[tmp].response.log = log;
+ }
+ }
+ },
+
initPreviewPane: function()
{
var sel = this.viewport.getSelected();
}
},
+ _getPPId: function(index, mailbox)
+ {
+ return index + '|' + mailbox;
+ },
+
// Labeling functions
updateSeenUID: function(r, setflag)
{