From: x2000habouzit Date: Sat, 7 Feb 2004 18:04:55 +0000 (+0000) Subject: mls en tpl X-Git-Tag: xorg/old~1890 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=bde317a9c61dc196112e8453c7e7c2124a24939b;p=platal.git mls en tpl --- diff --git a/configs/mails.conf b/configs/mails.conf index cca4383..49f8363 100644 --- a/configs/mails.conf +++ b/configs/mails.conf @@ -9,3 +9,7 @@ cc=Equipe Polytechnique.org [valid_epouses] from=Equipe Polytechnique.org cc=Equipe Polytechnique.org + +[valid_ml] +from=Equipe Polytechnique.org +cc=Equipe Polytechnique.org diff --git a/include/valid_ml.inc.php b/include/valid_ml.inc.php index c991dd4..702df86 100644 --- a/include/valid_ml.inc.php +++ b/include/valid_ml.inc.php @@ -38,19 +38,12 @@ class MListReq extends Validate { } function formu() { - $comment = nl2br($this->comment); - - $pub = $this->publique ? "checked=\"checked\" " : ""; - $lib = $this->libre ? "checked=\"checked\" " : ""; - $fre = $this->freeins ? "checked=\"checked\" " : ""; - $arc = $this->archive ? "checked=\"checked\" " : ""; - $sql = mysql_query("SELECT username FROM auth_user_md5" ." WHERE user_id IN ({$this->moderos})" ." ORDER BY nom, prenom"); $tab = array(); while(list($username) = mysql_fetch_row($sql)) $tab[] = $username; - $modero = implode(', ', $tab); + $this->moderos_txt = implode(', ', $tab); mysql_free_result($sql); $sql = mysql_query("SELECT username FROM auth_user_md5" @@ -58,71 +51,9 @@ class MListReq extends Validate { ." ORDER BY nom, prenom"); $tab = array(); while(list($username) = mysql_fetch_row($sql)) $tab[] = $username; - $membres = implode(', ', $tab); + $this->membres_txt = implode(', ', $tab); mysql_free_result($sql); - - return <<<________EOF -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Demandeur : - {$this->prenom} {$this->nom} - -
Motif :{$comment} -
- Alias : - - @polytechnique.org -
Topic : -
Propriétés : - Publique - Libre - Freeins - Archive -
Modéros :$moderos
Membres :$membres
- -

- -
-

Explication complémentaire (refus ou changement de config, ...)

- -
-
-________EOF; + return 'include/form.valid.ml.tpl'; } function handle_formu () { @@ -143,45 +74,23 @@ ________EOF; $this->clean(); $this->submit(); - require_once("diogenes.mailer.inc.php"); + require_once("tpl.mailer.inc.php"); - $mymail = new DiogenesMailer('Equipe Polytechnique.org ', - $this->username."@polytechnique.org", - "[Polytechnique.org/LISTES] Demande de la liste {$this->alias} par ".$this->username, - false, "validation+listes@m4x.org"); - - $message = - "Cher(e) camarade,\n". - "\n"; + $mymail = new TplMailer(); + $mymail->assign('username',$this->username); + $mymail->assign('alias',$this->alias); + $mymail->assign('motif',stripslashes($_REQUEST['motif'])); if($_REQUEST['submit']=="Accepter") { - if($this->commit()) { - $message .= - " La mailing list {$this->alias} que tu avais demandée vient". - " d'être créée\n"; - if (!empty($_REQUEST["motif"])) - $message .= "\nInformations complémentaires :\n". - stripslashes($_REQUEST["motif"])."\n"; - } else { - echo "

Aucun mail envoyé, erreur !

\n"; - return false; + $mymail->assign('answer', 'yes'); + if(!$this->commit()) { + return "

Aucun mail envoyé, erreur !

\n"; } } else { - $message .= - "La demande que tu avais faite pour la mailing list ". - $this->alias." a été refusée.\n"; - if (!empty($_REQUEST["motif"])) - $message .= "\nLa raison de ce refus est : \n". - stripslashes($_REQUEST["motif"])."\n"; + $mymail->assign('answer', 'no'); $this->clean(); } - $message .= - "\n". - "Cordialement,\n". - "L'équipe X.org"; - $message = wordwrap($message,78); - $mymail->setBody($message); $mymail->send(); return "Mail envoyé"; } diff --git a/templates/include/form.valid.ml.tpl b/templates/include/form.valid.ml.tpl new file mode 100644 index 0000000..a00779b --- /dev/null +++ b/templates/include/form.valid.ml.tpl @@ -0,0 +1,65 @@ +{* $Id: form.valid.ml.tpl,v 1.1 2004-02-07 18:04:56 x2000habouzit Exp $ *} + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Demandeur : + + {$valid->prenom} {$valid->nom} + +
Motif :{$valid->comment|escape:"html"|nl2br} +
+ Alias : + + @polytechnique.org +
Topic : +
Propriétés : + publique}checked="checked"{/if} />Publique + libre}checked="checked"{/if} />Libre + freeins}checked="checked"{/if} />Freeins + archive}checked="checked"{/if} />Archive +
Modéros :{$valid->moderos_txt}
Membres :{$valid->membres_txt}
+ +

+ +
+

Explication complémentaire (refus ou changement de config, ...)

+ +
+
+ +{* vim:set et sw=2 sts=2 sws=2: *} diff --git a/templates/mails/valid.ml.tpl b/templates/mails/valid.ml.tpl new file mode 100644 index 0000000..f1ca81b --- /dev/null +++ b/templates/mails/valid.ml.tpl @@ -0,0 +1,28 @@ +{* $Id: valid.ml.tpl,v 1.1 2004-02-07 18:04:56 x2000habouzit Exp $ *} +{config_load file="mails.conf" section="valid_ml"} +{subject text="[Polytechnique.org/LISTES] Demande de la liste $alias par $username"} +{from full=#from#} +{to addr="$username@polytechnique.org"} +{cc full=#cc#} +{if $answer eq "yes"} +Cher(e) camarade, + + La mailing list {$alias} que tu avais demandée vient d'être créée. +{if $motif} +Informations complémentaires: +{$motif} +{/if} + +Cordialement, +L'équipe X.org +{elseif $answer eq 'no'} +Cher(e) camarade, + + La demande que tu avais faite pour la mailing list {$alias} a été refusée. +La raison de ce refus est : +{$motif} + +Cordialement, +L'équipe X.org +{/if} +{* vim:set nocindent noautoindent textwidth=0: *}