emploi passé sur la conf+TplMailer
authorx2000habouzit <x2000habouzit>
Sat, 7 Feb 2004 14:42:06 +0000 (14:42 +0000)
committerx2000habouzit <x2000habouzit>
Sat, 7 Feb 2004 14:42:06 +0000 (14:42 +0000)
configs/mails.conf
configs/valid.conf.php
include/valid_emploi.inc.php
templates/mails/valid.emploi.tpl [new file with mode: 0644]

index fd86546..c3c0762 100644 (file)
@@ -1,3 +1,7 @@
 [valid_alias]
 from=Equipe Polytechnique.org <validation+melix@polytechnique.org>
 cc=Equipe Polytechnique.org <validation+melix@polytechnique.org>
+
+[valid_emploi]
+from=Equipe Polytechnique.org <validation+emploi@polytechnique.org>
+cc=Equipe Polytechnique.org <validation+emploi@polytechnique.org>
index 5e5858e..1a74e98 100644 (file)
@@ -1,43 +1,7 @@
 <?
 /*** Validation des offres d'emploi ***/
 
-function from_mail_valid_emploi() {
-    global $globals ;
-    return "Equipe Polytechnique.org <".$globals->addr_mail_valid_emploi.">" ; 
-}
-
-function subject_mail_valid_emploi ($nomEntreprise) {
-    global $globals ;
-    return "[Polytechnique.org/EMPLOI] Annonce emploi : ".$nomEntreprise ;
-}
-
-function cc_mail_valid_emploi() {
-    global $globals ;
-    return $globals->addr_mail_valid_emploi ;
-}
-
-function msg_valid_emploi_OK ($titre) {
-    $msg =  "Bonjour,\n".
-            "\n".
-            "L'annonce << {$titre} >> ".
-            "a été acceptée par les modérateurs. Elle apparaîtra ".
-            "dans le forum emploi du site\n\n".
-            "Nous vous remercions d'avoir proposé cette annonce.\n";
-            "\n".
-            "Cordialement,\n".
-            "L'équipe X.org" ;
-    return $msg ;
-}
-
 function msg_valid_emploi_NON ($titre) {
-    $msg =  "Bonjour,\n".
-            "\n".
-            "L'annonce << {$titre} >> ".
-            "a été refusée par les modérateurs.\n".
-            "\n".
-            "Cordialement,\n".
-            "L'équipe X.org" ;
-    return $msg ;
 }
 
 function from_post_emploi() {
index a7de1a1..dc255d6 100644 (file)
@@ -60,17 +60,15 @@ ________EOF;
 
     function handle_formu() {
         if (isset($_POST['submit'])) {
-            require("diogenes.mailer.inc.php");
-            $mymail = new DiogenesMailer(
-                from_mail_valid_emploi(),
-                $this->mail,
-                subject_mail_valid_emploi($this->entreprise),
-                false,
-                cc_mail_valid_emploi());
+            require("tpl.mailer.inc.php");
+            $mymail = new TplMailer('valid.emploi.tpl');
+            $mymail->assign('entreprise', $this->entreprise);
+            $mymail->assign('titre', $this->titre);
+            $mymail->_to = $this->mail;
 
             if($_REQUEST['submit']=="Accepter") {
-                require("nntp.inc.php");
-                require("poster.inc.php");
+                require("nntp.inc.php");   # FIXME
+                require("poster.inc.php"); # FIXME : old includes
                 $post = new poster(
                     from_post_emploi(),
                     to_post_emploi(),
@@ -84,13 +82,10 @@ ________EOF;
 
                 $post->setbody( msg_post_emploi($this) ) ;
                 $post->post();
-                $message = msg_valid_emploi_OK( $this->titre ) ;
+                $mymail->assign('answer','yes');
             } else {
-                $message = msg_valid_emploi_NON( $this->titre ) ;
+                $mymail->assign('answer','no');
             }
-
-            $message = wordwrap($message,78);  
-            $mymail->setBody($message);
             $mymail->send();
             $this->clean();
             return "Mail envoyé";
diff --git a/templates/mails/valid.emploi.tpl b/templates/mails/valid.emploi.tpl
new file mode 100644 (file)
index 0000000..0533ada
--- /dev/null
@@ -0,0 +1,23 @@
+{* $Id: valid.emploi.tpl,v 1.1 2004-02-07 14:42:07 x2000habouzit Exp $ *}
+{config_load file="mails.conf" section="valid_emploi"}
+{subject text="[Polytechnique.org/EMPLOI] Annonce emploi $entreprise"}
+{from full=#from#}
+{cc full=#cc#}
+{if $answer eq "yes"}
+Bonjour,
+
+L'annonce « {$titre} » a été acceptée par les modérateurs. Elle apparaîtra dans le forum emploi du site.
+
+Nous vous remercions d'avoir proposé cette annonce
+
+Cordialement,
+L'équipe Polytechnique.org
+{elseif $answer eq 'no'}
+Bonjour,
+
+L'annonce « {$titre} » a été refusée par les modérateurs.
+
+Cordialement,
+L'équipe Polytechnique.org
+{/if}
+{* vim:set nocindent noautoindent textwidth=0: *}