Fix a double entity
[platal.git] / templates / emails / send.tpl
index cca3488..9219ee2 100644 (file)
@@ -1,6 +1,6 @@
 {**************************************************************************}
 {*                                                                        *}
-{*  Copyright (C) 2003-2007 Polytechnique.org                             *}
+{*  Copyright (C) 2003-2008 Polytechnique.org                             *}
 {*  http://opensource.polytechnique.org/                                  *}
 {*                                                                        *}
 {*  This program is free software; you can redistribute it and/or modify  *}
     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);
     }
       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}
     </div>
     <div id="preview">
       <div id="preview_pv" style="display: none">
-        <strong>Aperçu du mail :</strong>
+        <strong>Aperçu du mail&nbsp;:</strong>
         <div id="mail_preview">
         </div>
         <div class="center">