diff options
38 files changed, 410 insertions, 127 deletions
@@ -1,6 +1,10 @@ CHANGELOG RoundCube Webmail --------------------------- +2006/06/19 +---------- +- Added Drafts support (Feature #1326839) (richs) + 2006/06/02 ---------- - Updated Estonian localization and moved from ee to et diff --git a/config/main.inc.php.dist b/config/main.inc.php.dist index 1224215ec..9c72bbe86 100644 --- a/config/main.inc.php.dist +++ b/config/main.inc.php.dist @@ -117,6 +117,10 @@ $rcmail_config['product_name'] = 'RoundCube Webmail'; // only list folders within this path $rcmail_config['imap_root'] = ''; +// store draft message is this mailbox +// leave blank if draft messages should not be stored +$rcmail_config['drafts_mbox'] = 'Drafts'; + // store sent message is this mailbox // leave blank if sent messages should not be stored $rcmail_config['sent_mbox'] = 'Sent'; @@ -202,4 +206,4 @@ $rcmail_config['javascript_config'] = array('read_when_deleted', 'flag_for_delet // end of config file -?>
\ No newline at end of file +?> diff --git a/program/include/rcube_imap.inc b/program/include/rcube_imap.inc index e579c88a0..26fd545a7 100644 --- a/program/include/rcube_imap.inc +++ b/program/include/rcube_imap.inc @@ -1840,14 +1840,14 @@ class rcube_imap return array_merge($a_defaults, $a_out); } - function get_id($uid) + function get_id($uid, $mbox_name=NULL) { - return $this->_uid2id($uid); + return $this->_uid2id($uid, $mbox_name); } - function get_uid($id) + function get_uid($id,$mbox_name=NULL) { - return $this->_id2uid($id); + return $this->_id2uid($id, $mbox_name); } function _uid2id($uid, $mbox_name=NULL) @@ -2086,4 +2086,4 @@ function quoted_printable_encode($input="", $line_max=76, $space_conv=false) return trim($output); } -?>
\ No newline at end of file +?> diff --git a/program/js/app.js b/program/js/app.js index 98a30d330..c0dac3fed 100644 --- a/program/js/app.js +++ b/program/js/app.js @@ -146,6 +146,8 @@ function rcube_webmail() this.enable_command('add-attachment', 'send-attachment', 'send', true); if (this.env.spellcheck) this.enable_command('spellcheck', true); + if (this.env.drafts_mailbox) + this.enable_command('savedraft', true); } if (this.env.messagecount) @@ -676,7 +678,17 @@ function rcube_webmail() { var uid = this.get_single_uid(); if (uid && (!this.env.uid || uid != this.env.uid)) - this.show_message(uid); + { + if (this.env.mailbox==this.env.drafts_mailbox) + { + this.set_busy(true); + location.href = this.env.comm_path+'&_action=compose&_draft_uid='+uid+'&_mbox='+escape(this.env.mailbox); + } + else + { + this.show_message(uid); + } + } } else if (this.task=='addressbook') { @@ -833,9 +845,14 @@ function rcube_webmail() case 'compose': var url = this.env.comm_path+'&_action=compose'; - + + if (this.task=='mail' && this.env.mailbox==this.env.drafts_mailbox) + { + var uid = this.get_single_uid(); + url += '&_draft_uid='+uid+'&_mbox='+escape(this.env.mailbox); + } // modify url if we're in addressbook - if (this.task=='addressbook') + else if (this.task=='addressbook') { url = this.get_task_url('mail', url); var a_cids = new Array(); @@ -886,6 +903,19 @@ function rcube_webmail() this.env.spellcheck.spellCheck(this.env.spellcheck.check_link); break; + case 'savedraft': + if (!this.gui_objects.messageform) + break; + + // if saving Drafts is disabled in main.inc.php + if (!this.env.drafts_mailbox) + break; + + this.set_busy(true, 'savingmessage'); + var form = this.gui_objects.messageform; + form.submit(); + break; + case 'send': if (!this.gui_objects.messageform) break; @@ -896,6 +926,7 @@ function rcube_webmail() // all checks passed, send message this.set_busy(true, 'sendingmessage'); var form = this.gui_objects.messageform; + form._draft.value=''; form.submit(); break; @@ -1171,7 +1202,15 @@ function rcube_webmail() // row was double clicked if (this.task=='mail' && this.list_rows && this.list_rows[id].clicked && this.in_selection(id)) { - this.show_message(id); + if (this.env.mailbox==this.env.drafts_mailbox) + { + this.set_busy(true); + location.href = this.env.comm_path+'&_action=compose&_draft_uid='+id+'&_mbox='+escape(this.env.mailbox); + } + else + { + this.show_message(id); + } return false; } else if (this.task=='addressbook') @@ -1293,8 +1332,18 @@ function rcube_webmail() // enable/disable commands for message if (this.task=='mail') { - this.enable_command('show', 'reply', 'reply-all', 'forward', 'print', selected); - this.enable_command('delete', 'moveto', this.selection.length>0 ? true : false); + if (this.env.mailbox==this.env.drafts_mailbox) + { + //alert(this.env.mailbox); + //this.disable_command('reply', 'reply-all', 'forward', 'print', 'moveto'); + this.enable_command('show', selected); + this.enable_command('delete', this.selection.length>0 ? true : false); + } + else + { + this.enable_command('show', 'reply', 'reply-all', 'forward', 'print', selected); + this.enable_command('delete', 'moveto', this.selection.length>0 ? true : false); + } } else if (this.task=='addressbook') { @@ -1907,12 +1956,15 @@ function rcube_webmail() var message = input_message ? input_message.value : ''; var sig, p; + if (!this.env.identity) + this.env.identity = id + // remove the 'old' signature if (this.env.identity && this.env.signatures && this.env.signatures[this.env.identity]) { sig = this.env.signatures[this.env.identity]; - if (sig.indexOf('-- ')!=0) - sig = '-- \n'+sig; + if (sig.indexOf('--')!=0) + sig = '--\n'+sig; p = message.lastIndexOf(sig); if (p>=0) @@ -1923,8 +1975,8 @@ function rcube_webmail() if (this.env.signatures && this.env.signatures[id]) { sig = this.env.signatures[id]; - if (sig.indexOf('-- ')!=0) - sig = '-- \n'+sig; + if (sig.indexOf('--')!=0) + sig = '--\n'+sig; message += '\n'+sig; } diff --git a/program/localization/cn/labels.inc b/program/localization/cn/labels.inc index e1cbcc469..bf7773457 100644 --- a/program/localization/cn/labels.inc +++ b/program/localization/cn/labels.inc @@ -33,6 +33,7 @@ $labels['addressbook'] = '地址薄'; // mailbox names $labels['inbox'] = '收件箱'; +$labels['drafts'] = '草稿'; $labels['sent'] = '发件箱'; $labels['trash'] = '垃圾桶'; $labels['drafts'] = '草稿'; @@ -113,6 +114,7 @@ $labels['quota'] = '空间使用'; // message compose $labels['compose'] = '写新邮件'; +$labels['savemessage'] = '保存这份草稿'; $labels['sendmessage'] = '立刻发送邮件'; $labels['addattachment'] = '添加附件'; diff --git a/program/localization/cn/messages.inc b/program/localization/cn/messages.inc index 067c3a5ae..edbe707f9 100644 --- a/program/localization/cn/messages.inc +++ b/program/localization/cn/messages.inc @@ -41,6 +41,10 @@ $messages['sendingmessage'] = '正在发送邮件...'; $messages['messagesent'] = '邮件发送成功'; +$messages['savingmessage'] = '挽救消息...'; + +$messages['messagesaved'] = '消息被保存对草稿'; + $messages['successfullysaved'] = '保存成功'; $messages['addedsuccessfully'] = '联系信息成功增加到地址薄'; diff --git a/program/localization/de_CH/labels.inc b/program/localization/de_CH/labels.inc index fa3a727fe..9fa6c048c 100644 --- a/program/localization/de_CH/labels.inc +++ b/program/localization/de_CH/labels.inc @@ -34,6 +34,7 @@ $labels['addressbook'] = 'Adressbuch'; // mailbox names // E-Mail-Ordnernamen $labels['inbox'] = 'Posteingang'; +$labels['drafts'] = 'Entwürfe'; $labels['sent'] = 'Gesendet'; $labels['trash'] = 'Gelöscht'; $labels['drafts'] = 'Vorlagen'; @@ -120,6 +121,7 @@ $labels['resetsearch'] = 'Löschen'; // message compose // Nachrichten erstellen $labels['compose'] = 'Neue Nachricht verfassen'; +$labels['savemessage'] = 'Außer diesem Entwurf'; $labels['sendmessage'] = 'Nachricht jetzt senden'; $labels['addattachment'] = 'Datei anfügen'; $labels['charset'] = 'Zeichensatz'; diff --git a/program/localization/de_CH/messages.inc b/program/localization/de_CH/messages.inc index db9670d0b..767b54f60 100644 --- a/program/localization/de_CH/messages.inc +++ b/program/localization/de_CH/messages.inc @@ -38,6 +38,10 @@ $messages['sendingmessage'] = 'Nachricht wird gesendet...'; $messages['messagesent'] = 'Nachricht erfolgreich gesendet'; +$messages['savingmessage'] = 'Einsparunganzeige...'; + +$messages['messagesaved'] = 'Anzeige gespeichert zu den Entwürfen'; + $messages['successfullysaved'] = 'Erfolgreich gespeichert'; $messages['addedsuccessfully'] = 'Kontakt zum Adressbuch hinzugefügt'; diff --git a/program/localization/de_DE/labels.inc b/program/localization/de_DE/labels.inc index ce36168b5..00052c079 100644 --- a/program/localization/de_DE/labels.inc +++ b/program/localization/de_DE/labels.inc @@ -35,6 +35,7 @@ $labels['addressbook'] = 'Adressbuch'; // mailbox names // E-Mail-Ordnernamen $labels['inbox'] = 'Posteingang'; +$labels['drafts'] = 'Entwürfe'; $labels['sent'] = 'Gesendet'; $labels['trash'] = 'Gelöscht'; $labels['drafts'] = 'Entwürfe'; @@ -121,6 +122,7 @@ $labels['resetsearch'] = 'Löschen'; // message compose // Nachrichten erstellen $labels['compose'] = 'Neue Nachricht verfassen'; +$labels['savemessage'] = 'Außer diesem Entwurf'; $labels['sendmessage'] = 'Nachricht jetzt senden'; $labels['addattachment'] = 'Datei anfügen'; $labels['charset'] = 'Zeichensatz'; diff --git a/program/localization/de_DE/messages.inc b/program/localization/de_DE/messages.inc index 4a6409c32..7eb90f9f7 100644 --- a/program/localization/de_DE/messages.inc +++ b/program/localization/de_DE/messages.inc @@ -40,6 +40,10 @@ $messages['sendingmessage'] = 'Nachricht wird gesendet...'; $messages['messagesent'] = 'Nachricht erfolgreich gesendet'; +$messages['savingmessage'] = 'Einsparunganzeige...'; + +$messages['messagesaved'] = 'Anzeige gespeichert zu den Entwürfen'; + $messages['successfullysaved'] = 'Erfolgreich gespeichert'; $messages['addedsuccessfully'] = 'Kontakt zum Adressbuch hinzugefügt'; diff --git a/program/localization/el/labels.inc b/program/localization/el/labels.inc index d5e927006..37b42c1ef 100755 --- a/program/localization/el/labels.inc +++ b/program/localization/el/labels.inc @@ -34,6 +34,7 @@ $labels['addressbook'] = 'Βιβλίο διευθύνσεων'; // mailbox names $labels['inbox'] = 'Εισερχόμενα'; +$labels['drafts'] = 'Σχέδια'; $labels['sent'] = 'Απεσταλμένα'; $labels['trash'] = 'Κάδος αχρήστων'; $labels['drafts'] = 'Προσχέδια'; @@ -113,6 +114,7 @@ $labels['unread'] = 'Αδιάβαστα'; // message compose $labels['compose'] = 'Σύνθεση μηνύματος'; +$labels['savemessage'] = 'Εκτός από αυτό το σχέδιο'; $labels['sendmessage'] = 'Αποστολή του μηνύματος τώρα'; $labels['addattachment'] = 'Επισύναψη αρχείου'; $labels['attachments'] = 'Συνημμένα'; diff --git a/program/localization/el/messages.inc b/program/localization/el/messages.inc index edd0da856..0d01054b0 100755 --- a/program/localization/el/messages.inc +++ b/program/localization/el/messages.inc @@ -42,6 +42,10 @@ $messages['sendingmessage'] = 'Αποστολή μηνύματος...'; $messages['messagesent'] = 'Το μήνυμα στάλθηκε επιτυχώς'; +$messages['savingmessage'] = 'Μήνυμα αποταμίευσης...'; + +$messages['messagesaved'] = 'Μήνυμα που σώζεται στα σχέδια'; + $messages['successfullysaved'] = 'Αποθηκεύτηκε επιτυχώς'; $messages['addedsuccessfully'] = 'Η επαφή προστέθηκε επιτυχώς στο βιβλίο διευθύνσεων'; diff --git a/program/localization/en_GB/labels.inc b/program/localization/en_GB/labels.inc index 77990d12e..3365f926c 100644 --- a/program/localization/en_GB/labels.inc +++ b/program/localization/en_GB/labels.inc @@ -33,6 +33,7 @@ $labels['addressbook'] = 'Address Book'; // mailbox names $labels['inbox'] = 'Inbox'; +$labels['drafts'] = 'Drafts'; $labels['sent'] = 'Sent'; $labels['trash'] = 'Deleted Items'; $labels['drafts'] = 'Drafts'; @@ -115,6 +116,7 @@ $labels['quota'] = 'Disk usage'; // message compose $labels['compose'] = 'Compose a message'; +$labels['savemessage'] = 'Save this draft'; $labels['sendmessage'] = 'Send the message now'; $labels['addattachment'] = 'Attach a file'; $labels['charset'] = 'Charset'; diff --git a/program/localization/en_GB/messages.inc b/program/localization/en_GB/messages.inc index 8773be589..de4e90114 100644 --- a/program/localization/en_GB/messages.inc +++ b/program/localization/en_GB/messages.inc @@ -38,6 +38,10 @@ $messages['loadingdata'] = 'Loading data...'; $messages['messagesent'] = 'Message sent successfully'; +$messages['savingmessage'] = 'Saving message...'; + +$messages['messagesaved'] = 'Message saved to Drafts'; + $messages['successfullysaved'] = 'Successfully saved'; $messages['addedsuccessfully'] = 'Contact added successfully to address book'; diff --git a/program/localization/en_US/labels.inc b/program/localization/en_US/labels.inc index ba6d3d53c..c5cbaa453 100644 --- a/program/localization/en_US/labels.inc +++ b/program/localization/en_US/labels.inc @@ -33,9 +33,9 @@ $labels['addressbook'] = 'Address Book'; // mailbox names $labels['inbox'] = 'Inbox'; +$labels['drafts'] = 'Drafts'; $labels['sent'] = 'Sent'; $labels['trash'] = 'Trash'; -$labels['drafts'] = 'Drafts'; $labels['junk'] = 'Junk'; // message listing @@ -120,6 +120,7 @@ $labels['resetsearch'] = 'Reset search'; // message compose $labels['compose'] = 'Compose a message'; +$labels['savemessage'] = 'Save this draft'; $labels['sendmessage'] = 'Send the message now'; $labels['addattachment'] = 'Attach a file'; $labels['charset'] = 'Charset'; diff --git a/program/localization/en_US/messages.inc b/program/localization/en_US/messages.inc index f12dc40f4..d4f3643ae 100644 --- a/program/localization/en_US/messages.inc +++ b/program/localization/en_US/messages.inc @@ -40,6 +40,10 @@ $messages['sendingmessage'] = 'Sending message...'; $messages['messagesent'] = 'Message sent successfully'; +$messages['savingmessage'] = 'Saving message...'; + +$messages['messagesaved'] = 'Message saved to Drafts'; + $messages['successfullysaved'] = 'Successfully saved'; $messages['addedsuccessfully'] = 'Contact added successfully to address book'; diff --git a/program/localization/es/labels.inc b/program/localization/es/labels.inc index ca083491a..1b648d5c1 100644 --- a/program/localization/es/labels.inc +++ b/program/localization/es/labels.inc @@ -37,6 +37,7 @@ $labels['addressbook'] = 'Contactos'; // mailbox names $labels['inbox'] = 'Entrada'; +$labels['drafts'] = 'Bosquejos'; $labels['sent'] = 'Enviados'; $labels['trash'] = 'Papelera'; $labels['drafts'] = 'Borradores'; @@ -118,6 +119,7 @@ $labels['quota'] = 'Uso de disco'; // message compose $labels['compose'] = 'Escribir un mensaje'; +$labels['savemessage'] = 'Excepto este bosquejo'; $labels['sendmessage'] = 'Enviar ahora el mensaje'; $labels['addattachment'] = 'Añadir un fichero'; $labels['charset'] = 'Codigo'; diff --git a/program/localization/es/messages.inc b/program/localization/es/messages.inc index 6d1912e9a..551ee75dd 100644 --- a/program/localization/es/messages.inc +++ b/program/localization/es/messages.inc @@ -47,6 +47,10 @@ $messages['sendingmessage'] = 'Enviando mensaje...'; $messages['messagesent'] = 'Mensaje enviado correctamente'; +$messages['savingmessage'] = 'Mensaje del ahorro...'; + +$messages['messagesaved'] = 'Mensaje ahorrado a los bosquejos'; + $messages['successfullysaved'] = 'guardado correctamente'; $messages['addedsuccessfully'] = 'Contacto añadido correctamente a la libreta de direcciones'; diff --git a/program/localization/fr/labels.inc b/program/localization/fr/labels.inc index 84be53880..27a4f50dc 100644 --- a/program/localization/fr/labels.inc +++ b/program/localization/fr/labels.inc @@ -33,6 +33,7 @@ $labels['addressbook'] = 'Carnet d\'adresses'; // mailbox names $labels['inbox'] = 'Boîte de réception'; +$labels['drafts'] = 'Ébauches'; $labels['sent'] = 'Messages envoyés'; $labels['trash'] = 'Corbeille'; $labels['drafts'] = 'Brouillons'; @@ -115,6 +116,7 @@ $labels['quota'] = 'Utilisation Disque'; // message compose $labels['compose'] = 'Composer un nouveau message'; +$labels['savemessage'] = 'Économiser cette ébauche'; $labels['sendmessage'] = 'Envoyer le message maintenant'; $labels['addattachment'] = 'Joindre un fichier'; $labels['charset'] = 'Encodage'; diff --git a/program/localization/fr/messages.inc b/program/localization/fr/messages.inc index 16b93a732..b8c2475ce 100644 --- a/program/localization/fr/messages.inc +++ b/program/localization/fr/messages.inc @@ -40,6 +40,10 @@ $messages['sendingmessage'] = 'Message en cours d\'envoi...'; $messages['messagesent'] = 'Message envoyé'; +$messages['savingmessage'] = 'Message d\'économie...'; + +$messages['messagesaved'] = 'Message sauvé aux ébauches'; + $messages['successfullysaved'] = 'Sauvegarde effectuée'; $messages['addedsuccessfully'] = 'Contact ajouté dans le carnet d\'adresses'; diff --git a/program/localization/it/labels.inc b/program/localization/it/labels.inc index b95c2e79d..b2d272685 100644 --- a/program/localization/it/labels.inc +++ b/program/localization/it/labels.inc @@ -33,6 +33,7 @@ $labels['addressbook'] = 'Rubrica'; // mailbox names $labels['inbox'] = 'Posta in arrivo'; +$labels['drafts'] = 'Brutte copie'; $labels['sent'] = 'Inviata'; $labels['trash'] = 'Cestino'; $labels['drafts'] = 'Bozze'; @@ -115,6 +116,7 @@ $labels['quota'] = 'Utilizzo spazio'; // message compose $labels['compose'] = 'Componi un messaggio'; +$labels['savemessage'] = 'Risparmi questa brutta copia'; $labels['sendmessage'] = 'Invia il messaggio adesso'; $labels['addattachment'] = 'Allega un file'; $labels['charset'] = 'Set di caratteri'; diff --git a/program/localization/it/messages.inc b/program/localization/it/messages.inc index ef7deed1a..7afec1ca9 100644 --- a/program/localization/it/messages.inc +++ b/program/localization/it/messages.inc @@ -40,6 +40,10 @@ $messages['sendingmessage'] = 'Invio messaggio in corso...'; $messages['messagesent'] = 'Messaggio inviato correttamente'; +$messages['savingmessage'] = 'Messaggio di Saving...'; + +$messages['messagesaved'] = 'Messaggio conservato alle brutte copie'; + $messages['successfullysaved'] = 'Salvato correttamente'; $messages['addedsuccessfully'] = 'Contatto aggiunto alla rubrica'; diff --git a/program/localization/ja/labels.inc b/program/localization/ja/labels.inc index 4ef50fed2..11a50aeed 100644 --- a/program/localization/ja/labels.inc +++ b/program/localization/ja/labels.inc @@ -33,6 +33,7 @@ $labels['addressbook'] = 'アドレス帳'; // mailbox names $labels['inbox'] = '受信箱'; +$labels['drafts'] = '草案'; $labels['sent'] = '送信箱'; $labels['trash'] = 'ごみ箱'; $labels['drafts'] = '草稿'; @@ -115,6 +116,7 @@ $labels['quota'] = 'ディスク使用量'; // message compose $labels['compose'] = 'メッセージを作成する'; +$labels['savemessage'] = 'この草案を救いなさい'; $labels['sendmessage'] = 'メッセージを今すぐ送信する'; $labels['addattachment'] = 'ファイルを添付する'; $labels['charset'] = '文字エンコード'; diff --git a/program/localization/ja/messages.inc b/program/localization/ja/messages.inc index 184a059ad..3dcca721a 100644 --- a/program/localization/ja/messages.inc +++ b/program/localization/ja/messages.inc @@ -40,6 +40,10 @@ $messages['sendingmessage'] = 'メッセージの送信中です...'; $messages['messagesent'] = 'メッセージの送信に成功しました。'; +$messages['savingmessage'] = 'セービングメッセージ...'; + +$messages['messagesaved'] = 'メッセージは草案に救った'; + $messages['successfullysaved'] = '保存に成功しました。'; $messages['addedsuccessfully'] = '連絡先をアドレス帳への追加に成功しました。'; diff --git a/program/localization/pt_BR/labels.inc b/program/localization/pt_BR/labels.inc index 75e487255..a396b6492 100644 --- a/program/localization/pt_BR/labels.inc +++ b/program/localization/pt_BR/labels.inc @@ -32,6 +32,7 @@ $labels['addressbook'] = 'Catálogo de endereços'; // Nome das pastas de correio $labels['inbox'] = 'Caixa de entrada'; +$labels['drafts'] = 'Esboços'; $labels['sent'] = 'Enviados'; $labels['trash'] = 'Lixeira'; $labels['drafts'] = 'Rascunhos'; @@ -114,6 +115,7 @@ $labels['quota'] = 'Utilização'; // message compose $labels['compose'] = 'Escrever mensagem'; +$labels['savemessage'] = 'Excepto este esboço'; $labels['sendmessage'] = 'Enviar'; $labels['addattachment'] = 'Anexar'; $labels['charset'] = 'Charset'; diff --git a/program/localization/pt_BR/messages.inc b/program/localization/pt_BR/messages.inc index 0b34d600b..ae3b70270 100644 --- a/program/localization/pt_BR/messages.inc +++ b/program/localization/pt_BR/messages.inc @@ -36,6 +36,10 @@ $messages['loadingdata'] = 'Carregando informações...'; $messages['messagesent'] = 'Mensagem enviada'; +$messages['savingmessage'] = 'Mensagem do Saving...'; + +$messages['messagesaved'] = 'Mensagem conservada aos esboços'; + $messages['successfullysaved'] = 'Salvo com sucesso'; $messages['addedsuccessfully'] = 'Contato incluído com sucesso'; diff --git a/program/localization/pt_PT/labels.inc b/program/localization/pt_PT/labels.inc index ba107ac70..e69221001 100644 --- a/program/localization/pt_PT/labels.inc +++ b/program/localization/pt_PT/labels.inc @@ -31,6 +31,7 @@ $labels['addressbook'] = 'Catálogo de endereços'; // Nome das pastas de correio $labels['inbox'] = 'Caixa de entrada'; +$labels['drafts'] = 'Esboços'; $labels['sent'] = 'Enviados'; $labels['trash'] = 'Lixeira'; $labels['drafts'] = 'Rascunhos'; @@ -113,6 +114,7 @@ $labels['quota'] = 'Quota de espaço'; // message compose $labels['compose'] = 'Escrever mensagem'; +$labels['savemessage'] = 'Excepto este esboço'; $labels['sendmessage'] = 'Enviar'; $labels['addattachment'] = 'Anexar'; $labels['charset'] = 'Charset'; diff --git a/program/localization/pt_PT/messages.inc b/program/localization/pt_PT/messages.inc index 051ab0b3d..377f9659f 100644 --- a/program/localization/pt_PT/messages.inc +++ b/program/localization/pt_PT/messages.inc @@ -39,6 +39,10 @@ $messages['sendingmessage'] = 'A enviar mensagem...'; $messages['messagesent'] = 'Mensagem enviada'; +$messages['savingmessage'] = 'Mensagem do Saving...'; + +$messages['messagesaved'] = 'Mensagem conservada aos esboços'; + $messages['successfullysaved'] = 'Ficheiro gravado'; $messages['addedsuccessfully'] = 'Contacto adicionado ao catálogo de endereços'; diff --git a/program/localization/ru/labels.inc b/program/localization/ru/labels.inc index 3622c7f6b..a434b0550 100755 --- a/program/localization/ru/labels.inc +++ b/program/localization/ru/labels.inc @@ -33,6 +33,7 @@ $labels['addressbook'] = 'Контакты'; // mailbox names $labels['inbox'] = 'Входящие'; +$labels['drafts'] = 'Проекты'; $labels['sent'] = 'Отправленные'; $labels['trash'] = 'Корзина'; $labels['drafts'] = 'Черновики'; @@ -120,6 +121,7 @@ $labels['resetsearch'] = 'Сброс'; // message compose $labels['compose'] = 'Написать сообщение'; +$labels['savemessage'] = 'За исключением этого проекта'; $labels['sendmessage'] = 'Отправить сейчас'; $labels['addattachment'] = 'Добавить вложение'; $labels['charset'] = 'Кодировка'; diff --git a/program/localization/ru/messages.inc b/program/localization/ru/messages.inc index 73f49ce85..393d24627 100755 --- a/program/localization/ru/messages.inc +++ b/program/localization/ru/messages.inc @@ -40,6 +40,10 @@ $messages['sendingmessage'] = 'Отправка сообщения...'; $messages['messagesent'] = 'Сообщение отправлено'; +$messages['savingmessage'] = 'Сообщение сбережения...'; + +$messages['messagesaved'] = 'Сообщение сохраненное к проектам'; + $messages['successfullysaved'] = 'Сохранено'; $messages['addedsuccessfully'] = 'Контакт добавлен в список контактов'; diff --git a/program/steps/mail/compose.inc b/program/steps/mail/compose.inc index 139af6556..ba80a54f1 100644 --- a/program/steps/mail/compose.inc +++ b/program/steps/mail/compose.inc @@ -26,6 +26,7 @@ require_once('Mail/mimeDecode.php'); $MESSAGE_FORM = NULL; $REPLY_MESSAGE = NULL; $FORWARD_MESSAGE = NULL; +$DRAFT_MESSAGE = NULL; if (!is_array($_SESSION['compose'])) @@ -33,12 +34,12 @@ if (!is_array($_SESSION['compose'])) // add some labels to client -rcube_add_label('nosubject', 'norecipientwarning', 'nosubjectwarning', 'nobodywarning', 'sendingmessage', 'notsentwarning'); +rcube_add_label('nosubject', 'norecipientwarning', 'nosubjectwarning', 'nobodywarning', 'notsentwarning', 'savingmessage', 'savingmessage', 'messagesaved'); -if ($_GET['_reply_uid'] || $_GET['_forward_uid']) +if ($_GET['_reply_uid'] || $_GET['_forward_uid'] || $_GET['_draft_uid']) { - $msg_uid = $_GET['_reply_uid'] ? $_GET['_reply_uid'] : $_GET['_forward_uid']; + $msg_uid = ($_GET['_reply_uid'] ? $_GET['_reply_uid'] : ($_GET['_forward_uid'] ? $_GET['_forward_uid'] : $_GET['_draft_uid'])); // similar as in program/steps/mail/show.inc $MESSAGE = array(); @@ -53,7 +54,7 @@ if ($_GET['_reply_uid'] || $_GET['_forward_uid']) $MESSAGE['subject'] = $IMAP->decode_header($MESSAGE['headers']->subject); $MESSAGE['parts'] = $mmd->getMimeNumbers($MESSAGE['structure']); - + if ($_GET['_reply_uid']) { $REPLY_MESSAGE = &$MESSAGE; @@ -65,22 +66,27 @@ if ($_GET['_reply_uid'] || $_GET['_forward_uid']) if ($_GET['_all']) $REPLY_MESSAGE['reply_all'] = 1; + } - else + else if ($_GET['_forward_uid']) { $FORWARD_MESSAGE = $MESSAGE; $_SESSION['compose']['forward_uid'] = $_GET['_forward_uid']; } - } - + else + { + $DRAFT_MESSAGE = $MESSAGE; + $_SESSION['compose']['draft_uid'] = $_GET['_draft_uid']; + } + } /****** compose mode functions ********/ function rcmail_compose_headers($attrib) { - global $IMAP, $REPLY_MESSAGE, $DB; + global $IMAP, $REPLY_MESSAGE, $DRAFT_MESSAGE, $DB; static $sa_recipients = array(); list($form_start, $form_end) = get_form_tags($attrib); @@ -139,8 +145,7 @@ function rcmail_compose_headers($attrib) break; } - - + if ($fname && !empty($_POST[$fname])) $fvalue = get_input_value($fname, RCUBE_INPUT_POST, TRUE); else if ($header && is_object($REPLY_MESSAGE['headers'])) @@ -182,6 +187,19 @@ function rcmail_compose_headers($attrib) } } } + else if ($header && is_object($DRAFT_MESSAGE['headers'])) + { + // get drafted headers + if ($header=='to' && $DRAFT_MESSAGE['headers']->to) + $fvalue = $IMAP->decode_header($DRAFT_MESSAGE['headers']->to); + + if ($header=='cc' && $DRAFT_MESSAGE['headers']->cc) + $fvalue = $IMAP->decode_header($DRAFT_MESSAGE['headers']->cc); + + if ($header=='bcc' && $DRAFT_MESSAGE['headers']->bcc) + $fvalue = $IMAP->decode_header($DRAFT_MESSAGE['headers']->bcc); + + } if ($fname && $field_type) @@ -199,7 +217,7 @@ function rcmail_compose_headers($attrib) if ($form_start) $out = $form_start.$out; - + return $out; } @@ -207,7 +225,7 @@ function rcmail_compose_headers($attrib) function rcmail_compose_header_from($attrib) { - global $IMAP, $REPLY_MESSAGE, $DB, $OUTPUT, $JS_OBJECT_NAME; + global $IMAP, $REPLY_MESSAGE, $DRAFT_MESSAGE, $DB, $OUTPUT, $JS_OBJECT_NAME; // pass the following attributes to the form class $field_attrib = array('name' => '_from'); @@ -269,6 +287,10 @@ function rcmail_compose_header_from($attrib) if ($REPLY_MESSAGE && is_array($REPLY_MESSAGE['FROM'])) $REPLY_MESSAGE['FROM'][] = $sql_arr['email']; + + if (strstr($DRAFT_MESSAGE['headers']->from,$sql_arr['email'])) + $from_id = $sql_arr['identity_id']; + } // overwrite identity selection with post parameter @@ -286,7 +308,7 @@ function rcmail_compose_header_from($attrib) $input_from = new textfield($field_attrib); $out = $input_from->show($_POST['_from']); } - + if ($form_start) $out = $form_start.$out; @@ -297,7 +319,7 @@ function rcmail_compose_header_from($attrib) function rcmail_compose_body($attrib) { - global $CONFIG, $OUTPUT, $REPLY_MESSAGE, $FORWARD_MESSAGE, $JS_OBJECT_NAME; + global $CONFIG, $OUTPUT, $REPLY_MESSAGE, $FORWARD_MESSAGE, $DRAFT_MESSAGE, $JS_OBJECT_NAME; list($form_start, $form_end) = get_form_tags($attrib); unset($attrib['form']); @@ -329,8 +351,32 @@ function rcmail_compose_body($attrib) if (strlen($body)) $body = rcmail_create_forward_body($body); } + + // forward message body inline + else if (is_array($DRAFT_MESSAGE['parts'])) + { + $body = rcmail_first_text_part($DRAFT_MESSAGE['parts']); + if (strlen($body)) + $body = rcmail_create_draft_body($body); + } $out = $form_start ? "$form_start\n" : ''; + + // Check if a previous save was done so we can delete it upon the next save + if (!empty($_POST['_draft_newsaveid'])) + $saveid = new hiddenfield(array('name' => '_draft_saveid', 'value' => $_POST['_draft_newsaveid'])); + else if (strlen($DRAFT_MESSAGE['headers']->messageID) > 6) + $saveid = new hiddenfield(array('name' => '_draft_saveid', 'value' => str_replace(array('<','>'),"",$DRAFT_MESSAGE['headers']->messageID) )); + + if ($saveid) + $out .= $saveid->show(); + + $newsaveid = new hiddenfield(array('name' => '_draft_newsaveid', 'value' => sprintf('%s@%s', md5(uniqid('rcmail'.rand(),true)), $_SESSION['imap_host']) )); + $out .= $newsaveid->show(); + + $drafttoggle = new hiddenfield(array('name' => '_draft', 'value' => 'yes')); + $out .= $drafttoggle->show(); + $out .= $textarea->show($body); $out .= $form_end ? "\n$form_end" : ''; @@ -456,11 +502,57 @@ function rcmail_create_forward_body($body) return $prefix.$body; } +function rcmail_create_draft_body($body) + { + global $IMAP, $DRAFT_MESSAGE; + + // add attachments + if (!isset($_SESSION['compose']['forward_attachments']) && is_array($DRAFT_MESSAGE['parts']) && sizeof($DRAFT_MESSAGE['parts'])>1) + { + $temp_dir = rcmail_create_compose_tempdir(); + + if (!is_array($_SESSION['compose']['attachments'])) + $_SESSION['compose']['attachments'] = array(); + + foreach ($DRAFT_MESSAGE['parts'] as $part) + { + if ($part->disposition=='attachment' || $part->disposition=='inline' || $part->headers['content-id'] || + (empty($part->disposition) && ($part->d_parameters['filename'] || $part->ctype_parameters['name']))) + { + $tmp_path = tempnam($temp_dir, 'rcmAttmnt'); + if ($fp = fopen($tmp_path, 'w')) + { + fwrite($fp, $IMAP->mime_decode($part->body, $part->headers['content-transfer-encoding'])); + fclose($fp); + + if ($part->d_parameters['filename']) + $_SESSION['compose']['attachments'][] = array('name' => $part->d_parameters['filename'], + 'mimetype' => $part->ctype_primary . '/' . $part->ctype_secondary, + 'path' => $tmp_path); + + else if ($part->ctype_parameters['name']) + $_SESSION['compose']['attachments'][] = array('name' => $part->ctype_parameters['name'], + 'mimetype' => $part->ctype_primary . '/' . $part->ctype_secondary, + 'path' => $tmp_path); + + else if ($part->headers['content-description']) + $_SESSION['compose']['attachments'][] = array('name' => $part->headers['content-description'], + 'mimetype' => $part->ctype_primary . '/' . $part->ctype_secondary, + 'path' => $tmp_path); + } + } + } + + $_SESSION['compose']['forward_attachments'] = TRUE; + } + + return $body; + } function rcmail_compose_subject($attrib) { - global $CONFIG, $REPLY_MESSAGE, $FORWARD_MESSAGE; + global $CONFIG, $REPLY_MESSAGE, $FORWARD_MESSAGE, $DRAFT_MESSAGE; list($form_start, $form_end) = get_form_tags($attrib); unset($attrib['form']); @@ -492,6 +584,9 @@ function rcmail_compose_subject($attrib) $subject = 'Fwd: '.$FORWARD_MESSAGE['subject']; } + // creeate a draft-subject + else if (isset($DRAFT_MESSAGE['subject'])) + $subject = $DRAFT_MESSAGE['subject']; $out = $form_start ? "$form_start\n" : ''; $out .= $textfield->show($subject); @@ -619,7 +714,7 @@ function get_form_tags($attrib) { $hiddenfields = new hiddenfield(array('name' => '_task', 'value' => $GLOBALS['_task'])); $hiddenfields->add(array('name' => '_action', 'value' => 'send')); - + $form_start = empty($attrib['form']) ? '<form name="form" action="./" method="post">' : ''; $form_start .= "\n$SESS_HIDDEN_FIELD\n"; $form_start .= $hiddenfields->show(); @@ -675,4 +770,4 @@ if ($DB->num_rows($sql_result)) parse_template('compose'); -?>
\ No newline at end of file +?> diff --git a/program/steps/mail/func.inc b/program/steps/mail/func.inc index 1be690a0b..8eff11c06 100644 --- a/program/steps/mail/func.inc +++ b/program/steps/mail/func.inc @@ -64,6 +64,9 @@ $OUTPUT->add_script(sprintf("%s.set_env('mailbox', '%s');", $JS_OBJECT_NAME, $IM if ($CONFIG['trash_mbox']) $OUTPUT->add_script(sprintf("%s.set_env('trash_mailbox', '%s');", $JS_OBJECT_NAME, $CONFIG['trash_mbox'])); +if ($CONFIG['drafts_mbox']) + $OUTPUT->add_script(sprintf("%s.set_env('drafts_mailbox', '%s');", $JS_OBJECT_NAME, $CONFIG['drafts_mbox'])); + // return the mailboxlist in HTML @@ -1484,4 +1487,4 @@ function rcmail_compose_cleanup() } -?>
\ No newline at end of file +?> diff --git a/program/steps/mail/sendmail.inc b/program/steps/mail/sendmail.inc index 65365ea7a..68e9fadd6 100644 --- a/program/steps/mail/sendmail.inc +++ b/program/steps/mail/sendmail.inc @@ -62,8 +62,16 @@ function rcmail_get_identity($id) return FALSE; } - - +if (strlen($_POST['_draft_saveid']) > 3) { + $olddraftmessageid = $_POST['_draft_saveid']; +} +if (strlen($_POST['_draft_newsaveid']) > 3) { + $newdraftmessageid = $_POST['_draft_newsaveid']; +} +if ($_POST['_draft']) { + $savedraft = 1; +} + /****** check submission and compose message ********/ @@ -94,8 +102,12 @@ $from = $identity_arr['mailto']; $first_to = is_array($to_address_arr[0]) ? $to_address_arr[0]['mailto'] : $mailto; -// create unique message-id -$message_id = sprintf('<%s@%s>', md5(uniqid('rcmail')), $_SESSION['imap_host']); +// try the message-id submitted by the compose form +if ($newdraftmessageid) { + $message_id = sprintf('<%s>',$newdraftmessageid); +} else { + $message_id = sprintf('<%s@%s>', md5(uniqid('rcmail'.rand(),true)), $_SESSION['imap_host']); +} // compose headers array @@ -213,119 +225,142 @@ $msg_subject = $headers['Subject']; if ($MBSTRING && function_exists("mb_encode_mimeheader")) $headers['Subject'] = mb_encode_mimeheader($headers['Subject'], $message_charset); -// send thru SMTP server using cusotm SMTP library -if ($CONFIG['smtp_server']) - { - // generate list of recipients - $a_recipients = array($mailto); - - if (strlen($headers['Cc'])) - $a_recipients[] = $headers['Cc']; - if (strlen($headers['Bcc'])) - $a_recipients[] = $headers['Bcc']; - - // clean Bcc from header for recipients - $send_headers = $headers; - unset($send_headers['Bcc']); - - // generate message headers - $header_str = $MAIL_MIME->txtHeaders($send_headers); - - // send message - $sent = smtp_mail($from, $a_recipients, $header_str, $msg_body); +// Begin SMTP Delivery Block +if (!$savedraft) { - // log error - if (!$sent) + // send thru SMTP server using custom SMTP library + if ($CONFIG['smtp_server']) { - raise_error(array('code' => 800, - 'type' => 'smtp', - 'line' => __LINE__, - 'file' => __FILE__, - 'message' => "SMTP error: $SMTP_ERROR"), TRUE, FALSE); + // generate list of recipients + $a_recipients = array($mailto); + + if (strlen($headers['Cc'])) + $a_recipients[] = $headers['Cc']; + if (strlen($headers['Bcc'])) + $a_recipients[] = $headers['Bcc']; + + // clean Bcc from header for recipients + $send_headers = $headers; + unset($send_headers['Bcc']); + + // generate message headers + $header_str = $MAIL_MIME->txtHeaders($send_headers); + + // send message + $sent = smtp_mail($from, $a_recipients, $header_str, $msg_body); + + // log error + if (!$sent) + { + raise_error(array('code' => 800, + 'type' => 'smtp', + 'line' => __LINE__, + 'file' => __FILE__, + 'message' => "SMTP error: $SMTP_ERROR"), TRUE, FALSE); + } } - } - -// send mail using PHP's mail() function -else - { - // unset some headers because they will be added by the mail() function - $headers_enc = $MAIL_MIME->headers($headers); - $headers_php = $MAIL_MIME->_headers; - unset($headers_php['To'], $headers_php['Subject']); - // reset stored headers and overwrite - $MAIL_MIME->_headers = array(); - $header_str = $MAIL_MIME->txtHeaders($headers_php); - - if (ini_get('safe_mode')) - $sent = mail($headers_enc['To'], $headers_enc['Subject'], $msg_body, $header_str); + // send mail using PHP's mail() function else - $sent = mail($headers_enc['To'], $headers_enc['Subject'], $msg_body, $header_str, "-f$from"); - } - - -// return to compose page if sending failed -if (!$sent) - { - show_message("sendingfailed", 'error'); - rcmail_overwrite_action('compose'); - return; - } - + { + // unset some headers because they will be added by the mail() function + $headers_enc = $MAIL_MIME->headers($headers); + $headers_php = $MAIL_MIME->_headers; + unset($headers_php['To'], $headers_php['Subject']); + + // reset stored headers and overwrite + $MAIL_MIME->_headers = array(); + $header_str = $MAIL_MIME->txtHeaders($headers_php); + + if (ini_get('safe_mode')) + $sent = mail($headers_enc['To'], $headers_enc['Subject'], $msg_body, $header_str); + else + $sent = mail($headers_enc['To'], $headers_enc['Subject'], $msg_body, $header_str, "-f$from"); + } + + + // return to compose page if sending failed + if (!$sent) + { + show_message("sendingfailed", 'error'); + rcmail_overwrite_action('compose'); + return; + } + + + // set repliead flag + if ($_SESSION['compose']['reply_uid']) + $IMAP->set_flag($_SESSION['compose']['reply_uid'], 'ANSWERED'); -// set repliead flag -if ($_SESSION['compose']['reply_uid']) - $IMAP->set_flag($_SESSION['compose']['reply_uid'], 'ANSWERED'); + } // End of SMTP Delivery Block +// Determine which folder to save message +if ($savedraft) { + $store_target = 'drafts_mbox'; +} else { + $store_target = 'sent_mbox'; +} -// copy message to sent folder -if ($CONFIG['sent_mbox']) +if ($CONFIG[$store_target]) { // create string of complete message headers $header_str = $MAIL_MIME->txtHeaders($headers); // check if mailbox exists - if (!in_array_nocase($CONFIG['sent_mbox'], $IMAP->list_mailboxes())) - $sent_folder = $IMAP->create_mailbox($CONFIG['sent_mbox'], TRUE); + if (!in_array_nocase($CONFIG[$store_target], $IMAP->list_mailboxes())) + $store_folder = $IMAP->create_mailbox($CONFIG[$store_target], TRUE); else - $sent_folder = TRUE; + $store_folder = TRUE; // append message to sent box - if ($sent_folder) - $saved = $IMAP->save_message($CONFIG['sent_mbox'], $header_str."\r\n".$msg_body); + if ($store_folder) + $saved = $IMAP->save_message($CONFIG[$store_target], $header_str."\r\n".$msg_body); // raise error if saving failed if (!$saved) raise_error(array('code' => 800, 'type' => 'imap', 'file' => __FILE__, - 'message' => "Could not save message in $CONFIG[sent_mbox]"), TRUE, FALSE); + 'message' => "Could not save message in $CONFIG[$store_target]"), TRUE, FALSE); + + if ($olddraftmessageid) { + // delete previous saved draft + $a_deleteid = $IMAP->search($CONFIG['drafts_mbox'],'HEADER Message-ID',$olddraftmessageid); + $deleted = $IMAP->delete_message($IMAP->get_uid($a_deleteid[0],$CONFIG['drafts_mbox']),$CONFIG['drafts_mbox']); + + if (!$deleted) + raise_error(array('code' => 800, + 'type' => 'imap', + 'file' => __FILE__, + 'message' => "Could not delete message from ".$CONFIG['drafts_mbox']), TRUE, FALSE); + } } - -// log mail sending -if ($CONFIG['smtp_log']) +if ($savedraft) + { + show_message('messagesaved', 'confirmation'); + rcmail_overwrite_action('compose'); + } +else { - $log_entry = sprintf("[%s] User: %d on %s; Message for %s; Subject: %s\n", - date("d-M-Y H:i:s O", mktime()), - $_SESSION['user_id'], - $_SERVER['REMOTE_ADDR'], - $mailto, - $msg_subject); - - if ($fp = @fopen($CONFIG['log_dir'].'/sendmail', 'a')) + if ($CONFIG['smtp_log']) { - fwrite($fp, $log_entry); - fclose($fp); + $log_entry = sprintf("[%s] User: %d on %s; Message for %s; Subject: %s\n", + date("d-M-Y H:i:s O", mktime()), + $_SESSION['user_id'], + $_SERVER['REMOTE_ADDR'], + $mailto, + $msg_subject); + + if ($fp = @fopen($CONFIG['log_dir'].'/sendmail', 'a')) + { + fwrite($fp, $log_entry); + fclose($fp); + } } + show_message('messagesent', 'confirmation'); + rcmail_compose_cleanup(); } -// show confirmation -show_message('messagesent', 'confirmation'); - - -// kill compose entry from session -rcmail_compose_cleanup(); - -?>
\ No newline at end of file +?> diff --git a/skins/default/images/buttons/drafts_act.png b/skins/default/images/buttons/drafts_act.png Binary files differnew file mode 100644 index 000000000..3fc718a7f --- /dev/null +++ b/skins/default/images/buttons/drafts_act.png diff --git a/skins/default/images/buttons/drafts_pas.png b/skins/default/images/buttons/drafts_pas.png Binary files differnew file mode 100644 index 000000000..424709e77 --- /dev/null +++ b/skins/default/images/buttons/drafts_pas.png diff --git a/skins/default/images/icons/folder-drafts.png b/skins/default/images/icons/folder-drafts.png Binary files differnew file mode 100644 index 000000000..d828b5687 --- /dev/null +++ b/skins/default/images/icons/folder-drafts.png diff --git a/skins/default/mail.css b/skins/default/mail.css index 3bdbf6d16..808ab6ccb 100644 --- a/skins/default/mail.css +++ b/skins/default/mail.css @@ -225,6 +225,11 @@ background-image: url(images/icons/folder-inbox.png); } +#mailboxlist li.drafts +{ + background-image: url(images/icons/folder-drafts.png); +} + #mailboxlist li.sent { background-image: url(images/icons/folder-sent.png); @@ -674,14 +679,14 @@ div.message-part pre #priority-selector { position: absolute; - left: 220px; + left: 280px; top: 10px; } #receipt-selector { position: absolute; - left: 390px; + left: 450px; top: 10px; } diff --git a/skins/default/templates/compose.html b/skins/default/templates/compose.html index e2f41a007..0544d7ab6 100644 --- a/skins/default/templates/compose.html +++ b/skins/default/templates/compose.html @@ -20,6 +20,13 @@ function rcmail_toggle_display(id) return false; } +function rcmail_auto_save() + { + rcmail.command('savedraft','',this); + self.setTimeout('rcmail_auto_save()',300000); + } +self.setTimeout('rcmail_auto_save()',300000); + //--> </script> </head> @@ -36,6 +43,7 @@ function rcmail_toggle_display(id) <!--<roundcube:button command="contacts" imageAct="/images/buttons/contacts_act.png" imagePas="/images/buttons/contacts_pas.png" width="32" height="32" title="addressbook" />--> <roundcube:button command="spellcheck" imageAct="/images/buttons/spellcheck_act.png" imagePas="/images/buttons/spellcheck_pas.png" width="32" height="32" title="checkspelling" /> <roundcube:button command="add-attachment" imageAct="/images/buttons/attach_act.png" imagePas="/images/buttons/attach_pas.png" width="32" height="32" title="addattachment" /> +<roundcube:button command="savedraft" imageAct="/images/buttons/drafts_act.png" imagePas="/images/buttons/drafts_pas.png" width="32" height="32" title="savemessage" /> <div id="priority-selector"> <roundcube:label name="priority" />: <roundcube:object name="prioritySelector" form="form" /> |