From 440a32c3e349b4c6ce487af285dacf11731eafb7 Mon Sep 17 00:00:00 2001 From: Florent Bruneau Date: Thu, 20 Sep 2007 14:06:56 +0200 Subject: [PATCH] Improves my previous commit by saving the mail during edition Signed-off-by: Florent Bruneau --- ChangeLog | 2 +- templates/emails/send.tpl | 44 ++++++++++++++++++++++++-------------------- 2 files changed, 25 insertions(+), 21 deletions(-) diff --git a/ChangeLog b/ChangeLog index a540d5b..d41f469 100644 --- a/ChangeLog +++ b/ChangeLog @@ -38,7 +38,7 @@ Bug/Wish: - #687: Don't lose authentication when editing a long mail -FRU - #688: From name in the sending form -FRU - #703: Fix management of mail adresses containing '+' -ALK - - #720: Save not sent mail at exit -FRU + - #720: Save not sent mail -FRU * Lists: - #700: Fix several encoding issues -FRU diff --git a/templates/emails/send.tpl b/templates/emails/send.tpl index cca3488..1e81a6b 100644 --- a/templates/emails/send.tpl +++ b/templates/emails/send.tpl @@ -56,6 +56,28 @@ return true; } + function saveMessage() { + var form = document.forms.form_mail; + var toc = ""; + var ccc = ""; + for (var i = 0 ; i < form['to_contacts[]'].length ; ++i) { + toc += form['to_contacts[]'].options[i].value + ";"; + } + for (var i = 0 ; i < form['cc_contacts[]'].length ; ++i) { + ccc += form['cc_contacts[]'].options[i].value + ";"; + } + $.post(platal_baseurl + "emails/send", + { save: true, + from: form.from.value, + to_contacts: toc, + cc_contacts: ccc, + contenu: form.contenu.value, + to: form.to.value, + sujet: form.sujet.value, + cc: form.cc.value, + bcc: form.bcc.value }); + } + var doAuth = true; function _keepAuth() { doAuth = true; @@ -63,7 +85,7 @@ function keepAuth() { if (doAuth) { - Ajax.update_html(null, "login", null); + saveMessage(); doAuth = false; setTimeout("_keepAuth()", 10000); } @@ -125,25 +147,7 @@ if (sent) { return true; } - var form = document.forms.form_mail; - var toc = ""; - var ccc = ""; - for (var i = 0 ; i < form['to_contacts[]'].length ; ++i) { - toc += form['to_contacts[]'].options[i].value + ";"; - } - for (var i = 0 ; i < form['cc_contacts[]'].length ; ++i) { - ccc += form['cc_contacts[]'].options[i].value + ";"; - } - $.post(platal_baseurl + "emails/send", - { save: true, - from: form.from.value, - to_contacts: toc, - cc_contacts: ccc, - contenu: form.contenu.value, - to: form.to.value, - sujet: form.sujet.value, - cc: form.cc.value, - bcc: form.bcc.value }); + saveMessage(); return true; }); {/literal} -- 2.1.4