From: x2000habouzit Date: Sun, 8 Feb 2004 12:21:32 +0000 (+0000) Subject: validation evenements X-Git-Tag: xorg/old~1887 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=a78bb9bda4aac8bff6e63972662c355341c36cfc;p=platal.git validation evenements --- diff --git a/configs/mails.conf b/configs/mails.conf index 01980f3..ba897ca 100644 --- a/configs/mails.conf +++ b/configs/mails.conf @@ -17,3 +17,7 @@ cc=Equipe Polytechnique.org [valid_photos] from=Equipe Polytechnique.org cc=Equipe Polytechnique.org + +[valid_evts] +from=Equipe Polytechnique.org +cc=Equipe Polytechnique.org diff --git a/include/valid_evts.inc.php b/include/valid_evts.inc.php index e23cba8..2f0a67b 100644 --- a/include/valid_evts.inc.php +++ b/include/valid_evts.inc.php @@ -35,100 +35,32 @@ class EvtReq extends Validate { return false; //non unique } - function formu() { - return <<<________EOF -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Événement
- Posté par - {$this->prenom} {$this->nom} (X{$this->promo}) - - [lui écrire]" -
Titre{$this->titre}
Texte{$this->texte}
Péremption{$this->peremption}
Promos{$this->pmin} - {$this->pmax}
Commentaire{$this->comment}
- - - -
-
-________EOF; - } + function formu() { return 'include/form.valid.evts.tpl'; } function handle_formu() { if (isset($_POST['action'])) { - require("diogenes.mailer.inc.php"); - $mymail = new DiogenesMailer('Equipe Polytechnique.org ' - .'', - $this->username."@polytechnique.org", - "[Polytechnique.org/EVENEMENTS] Proposition d'événement", - false, "validation+evts@m4x.org"); - - $message = "Cher(e) camarade,\n\n"; + require("tpl.mailer.inc.php"); + $mymail = new TplMailer('valid.evts.tpl'); + $mymail->assign('username',$this->username); + $mymail->assign('titre',$this->titre); if($_REQUEST['action']=="Valider") { - $req="UPDATE evenements SET creation_date = " - ."creation_date, validation_user_id =".$_SESSION['uid'] - .", validation_date = NULL, flags = CONCAT(flags," - ."',valide') WHERE id='{$this->evtid}' LIMIT 1"; - $result = mysql_query ($req); - $message .= "L'annonce que tu avais proposée (" - .strip_tags($this->titre).") vient d'être validée."; + mysql_query("UPDATE evenements + SET creation_date = creation_date, validation_user_id = {$_SESSION['uid']}, + validation_date = NULL, flags = CONCAT(flags,',valide') + WHERE id='{$this->evtid}' LIMIT 1"); + $mymail->assign('answer','yes'); } if($_REQUEST['action']=="Invalider") { - $req="UPDATE evenements SET creation_date = " - ."creation_date, validation_user_id =".$_SESSION['uid'] - .", validation_date = NULL, flags = REPLACE(flags," - ."'valide','') WHERE id='{$this->evtid}' LIMIT 1"; - $result = mysql_query ($req); - $message .= "L'annonce que tu avais proposée (" - .strip_tags($this->titre).") a été refusée."; + mysql_query("UPDATE evenements + SET creation_date = creation_date, validation_user_id = {$_SESSION['uid']}, + validation_date = NULL, flags = REPLACE(flags,'valide','') + WHERE id='{$this->evtid}' LIMIT 1"); + $mymail->assign('answer', 'no'); } if($_REQUEST['action']=="Supprimer") { - $req="DELETE from evenements WHERE id='{$this->evtid}'" - ." LIMIT 1"; - $result = mysql_query ($req); + mysql_query("DELETE from evenements WHERE id='{$this->evtid}' LIMIT 1"); } - $message .= - "\n". - "Cordialement,\n". - "L'équipe X.org"; - $message = wordwrap($message,78); - $mymail->setBody($message); if ($_POST['action']!="Supprimer") $mymail->send(); $this->clean(); diff --git a/templates/include/form.valid.evts.tpl b/templates/include/form.valid.evts.tpl new file mode 100644 index 0000000..873de59 --- /dev/null +++ b/templates/include/form.valid.evts.tpl @@ -0,0 +1,53 @@ +{* $Id: form.valid.evts.tpl,v 1.1 2004-02-08 12:21:33 x2000habouzit Exp $ *} + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Événement
+ Posté par username"|url}"> + {$valid->prenom} {$valid->nom} (X{$valid->promo}) + + [lui écrire]" +
Titre{$valid->titre}
Texte{$valid->texte}
Péremption{$valid->peremption}
Promos{$valid->pmin} - {$valid->pmax}
Commentaire{$valid->comment}
+ + + +
+
+ +{* vim:set et sw=2 sts=2 sws=2: *} diff --git a/templates/mails/valid.evts.tpl b/templates/mails/valid.evts.tpl new file mode 100644 index 0000000..f251347 --- /dev/null +++ b/templates/mails/valid.evts.tpl @@ -0,0 +1,23 @@ +{* $Id: valid.evts.tpl,v 1.1 2004-02-08 12:21:33 x2000habouzit Exp $ *} +{config_load file="mails.conf" section="valid_evts"} +{subject text="[Polytechnique.org/EVENEMENTS] Proposition d'événement"} +{from full=#from#} +{to addr="$username@polytechnique.org"} +{cc full=#cc#} +{if $answer eq "yes"} +Cher(e) camarade, + + L'annonce que tu avais proposée ({$titre|strip_tags}) vient d'être validée. + +Cordialement, +L'équipe X.org +{elseif $answer eq 'no'} + +Cher(e) camarade, + + L'annonce que tu avais proposée ({$titre|strip_tags}) a été refusée. + +Cordialement, +L'équipe X.org +{/if} +{* vim:set nocindent noautoindent textwidth=0: *}