From: x2000habouzit Date: Tue, 27 Jan 2004 09:08:55 +0000 (+0000) Subject: correction (non totalement testée) des valid_* X-Git-Tag: xorg/old~1937 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=d914e5c5c38adee1262f340a2e458b30cb2cd12c;p=platal.git correction (non totalement testée) des valid_* implémentation de la validation si la page utilise popwin, c'est dit dans new_*_page (modif de l'API) --- diff --git a/htdocs/admin/valider.php b/htdocs/admin/valider.php new file mode 100644 index 0000000..f54e838 --- /dev/null +++ b/htdocs/admin/valider.php @@ -0,0 +1,22 @@ +assign('mail', $req->handle_formu()); +} + +$it = new ValidateIterator (); + +$valids = Array(); +while($valids[] = $it->next()); +array_pop($valids); + +$page->assign_by_ref('valids', $valids); + +$page->display(); +?> diff --git a/htdocs/login.php b/htdocs/login.php index aa0327c..94915d3 100644 --- a/htdocs/login.php +++ b/htdocs/login.php @@ -1,6 +1,6 @@ assign('has_cookie', $has_cookie); diff --git a/include/auto.prepend.inc.php b/include/auto.prepend.inc.php index b779a10..c2e0852 100644 --- a/include/auto.prepend.inc.php +++ b/include/auto.prepend.inc.php @@ -2,7 +2,7 @@ ini_set('include_path', ".:..:/home/x2000habouzit/dev/public/include:/home/x2000habouzit/dev/diogenes/lib/:/home/x2000habouzit/dev/smarty/"); require("xorg.common.inc.php"); -function _new_page($type, $tpl_name, $tpl_head, $min_auth, $admin=false) { +function _new_page($type, $tpl_name, $tpl_head, $min_auth, $popup=false, $admin=false) { global $page,$globals; require("xorg.page.inc.php"); if(!empty($admin)) { @@ -25,21 +25,23 @@ function _new_page($type, $tpl_name, $tpl_head, $min_auth, $admin=false) { $page->assign('xorg_head', $tpl_head); $page->assign('xorg_tpl', $tpl_name); + if($popup) + $page->assign('popup_enable', true); $page->compile_check=true; $page->caching=true; } -function new_skinned_page($tpl_name, $min_auth, $tpl_head="") { - _new_page(SKINNED, $tpl_name, $tpl_head, $min_auth); +function new_skinned_page($tpl_name, $min_auth, $popup=false, $tpl_head="") { + _new_page(SKINNED, $tpl_name, $tpl_head, $min_auth, $popup); } -function new_popup_page($tpl_name, $min_auth, $tpl_head="") { - _new_page(SKINNED, $tpl_name, $tpl_head, $min_auth); +function new_popup_page($tpl_name, $min_auth, $popup=false, $tpl_head="") { + _new_page(SKINNED, $tpl_name, $tpl_head, $min_auth, $popup); } -function new_admin_page($tpl_name, $tpl_head="") { - _new_page(SKINNED, $tpl_name, $tpl_head, AUTH_MDP, true); +function new_admin_page($tpl_name, $popup=false, $tpl_head="") { + _new_page(SKINNED, $tpl_name, $tpl_head, AUTH_MDP, $popup, true); } ?> diff --git a/include/valid_aliases.inc.php b/include/valid_aliases.inc.php index d82a8c3..ab546e5 100644 --- a/include/valid_aliases.inc.php +++ b/include/valid_aliases.inc.php @@ -25,30 +25,30 @@ class AliasReq extends Validate { return parent::get_unique_request($uid,'alias'); } - function echo_formu() { - require_once("popwin.inc.php"); -?> -
- - - + function formu() { + $old = $this->old ? "({$this->old})" : ""; + $raison = nl2br(stripslashes(htmlentities($this->raison))); + return <<<________EOF + + + + - - + @@ -64,7 +64,7 @@ class AliasReq extends Validate {
Demandeur : prenom." ".$this->nom;?> - old)) echo "({$this->old})";?> + + {$this->prenom} {$this->nom} $old
Nouvel alias :alias;?>@melix.net{$this->alias}@melix.net
Motif : - raison);?> + $raison
-alias."@melix.net"; $mxorg = $this->alias."@melix.org"; - $mymail = new mailer('Equipe Polytechnique.org ', + $mymail = new DiogenesMailer('Equipe Polytechnique.org ', $this->username."@polytechnique.org", "[Polytechnique.org/MELIX] Demande de l'alias $mxnet par ".$this->username, false, "validation+melix@m4x.org"); @@ -108,9 +108,9 @@ class AliasReq extends Validate { $message = wordwrap($message,78); $mymail->setBody($message); $mymail->send(); - echo "
Mail envoyé"; //Suppression de la demande $this->clean(); + return "Mail envoyé"; } function commit () { diff --git a/include/valid_emploi.inc.php b/include/valid_emploi.inc.php index 30e20b8..fb86d5f 100644 --- a/include/valid_emploi.inc.php +++ b/include/valid_emploi.inc.php @@ -18,59 +18,50 @@ class EmploiReq extends Validate { return false; // non unique } - function echo_formu() { -?> -
- - - - - - - - - - + function formu() { + $ent = htmlentities($this->entreprise); + $mail = htmlentities($this->mail); + $titre = htmlentities($this->titre); + $texte = wordwrap($this->text, 80); + return <<<________EOF + + + + +
- Offre d'emploi -
+ + + + + + - - + + - - + + - + - + - -
Offre d'emploi
- Demandeur - - entreprise). - " (".htmlentities($this->mail).")";?> - Demandeur$ent ($mail)
- Titre du post - - titre);?> - Titre du post$titre
-
text;?>
-
{$texte}
- - - + + +
-
- + + +________EOF; } function handle_formu() { if (isset($_POST['submit'])) { - require("mailer.inc.php"); - $mymail = new mailer('Equipe Polytechnique.org ' + require("diogenes.mailer.inc.php"); + $mymail = new DiogenesMailer('Equipe Polytechnique.org ' .'', $this->mail, "[Polytechnique.org/EMPLOI] Annonce emploi : ".$this->entreprise, @@ -120,6 +111,7 @@ class EmploiReq extends Validate { $mymail->setBody($message); $mymail->send(); $this->clean(); + return "Mail envoyé"; } } diff --git a/include/valid_epouses.inc.php b/include/valid_epouses.inc.php index 85a77e7..e154904 100644 --- a/include/valid_epouses.inc.php +++ b/include/valid_epouses.inc.php @@ -38,45 +38,43 @@ class EpouseReq extends Validate { return parent::get_unique_request($uid,'epouse'); } - function echo_formu() { - require_once("popwin.inc.php"); -?> -
- - - + function formu() { + $old_line = $this->oldepouse ? "({$this->oldepouse} - {$this->oldalias})" : ""; + $homonyme = ""; + + if (!empty($this->homonyme)) $homonyme = <<<________EOF + + + Probleme d'homonymie ! + {$this->homonyme} + + + +________EOF; + + return <<<________EOF + + + + - - + - + -homonyme)) { -?> - - - - + $homonyme
Demandeur : - prenom." ".$this->nom;?> + + {$this->prenom} {$this->nom} - oldepouse) echo "({$this->oldepouse} - {$this->oldalias})";?> + $oldline
Épouse :epouse;?>{$this->epouse}
Nouvel alias :alias;?>{$this->alias}
- Probleme d'homonymie ! - - homonyme;?> - - -
@@ -90,7 +88,7 @@ class EpouseReq extends Validate {
-', + require_once("diogenes.mailer.inc.php"); + $mymail = new DiogenesMailer('Equipe Polytechnique.org ', $this->username."@polytechnique.org", "[Polytechnique.org/EPOUSE] Changement de nom de mariage de ".$this->username, false, "validation+epouse@m4x.org"); $mymail->setBody($message); $mymail->send(); - echo "
Mail envoyé"; $this->clean(); + return "Mail envoyé"; } function commit () { diff --git a/include/valid_evts.inc.php b/include/valid_evts.inc.php index e8d7d64..e935129 100644 --- a/include/valid_evts.inc.php +++ b/include/valid_evts.inc.php @@ -35,88 +35,64 @@ class EvtReq extends Validate { return false; //non unique } - function echo_formu() { - require("popwin.inc.php"); -?> -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- Événement -
- Posté par username}')\">" - ."{$this->prenom} {$this->nom} (X{$this->promo}) " - ."[username}@polytechnique.org\">lui " - ."écrire]"; ?> -
- Titre - - titre; ?> -
- Texte - - texte; ?> -
- Péremption - - peremption ?> -
- Promos - - pmin; ?> - pmax; ?> -
- Commentaire - - comment; ?> -
- - - -
-
- + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
É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 handle_formu() { if (isset($_POST['action'])) { - require("mailer.inc.php"); - $mymail = new mailer('Equipe Polytechnique.org ' + require("diogenes.mailer.inc.php"); + $mymail = new DiogenesMailer('Equipe Polytechnique.org ' .'', $this->username."@polytechnique.org", "[Polytechnique.org/EVENEMENTS] Proposition d'événement", @@ -153,7 +129,7 @@ class EvtReq extends Validate { "L'équipe X.org"; $message = wordwrap($message,78); $mymail->setBody($message); - if ($_POST['action']!="Supprimer") + if ($_POST['action']!="Supprimer") $mymail->send(); $this->clean(); } diff --git a/include/valid_ml.inc.php b/include/valid_ml.inc.php index fd3c4e2..8e9204b 100644 --- a/include/valid_ml.inc.php +++ b/include/valid_ml.inc.php @@ -37,24 +37,46 @@ class MListReq extends Validate { return false; // ben oui, c pas un objet unique !!! } - function echo_formu() { - require_once("popwin.inc.php"); -?> -
- - - + 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); + mysql_free_result($sql); + + $sql = mysql_query("SELECT username FROM auth_user_md5" + ." WHERE user_id IN ({$this->membres})" + ." ORDER BY nom, prenom"); + $tab = array(); + while(list($username) = mysql_fetch_row($sql)) $tab[] = $username; + $membres = implode(', ', $tab); + mysql_free_result($sql); + + return <<<________EOF + + + + - - @@ -62,61 +84,30 @@ class MListReq extends Validate { Alias : - - - + + - +
Demandeur : - prenom." ".$this->nom;?> + + {$this->prenom} {$this->nom}
Motif :comment);?> + {$comment}
- @polytechnique.org + @polytechnique.org
Topic : +
Propriétés : - publique?"checked=\"checked\"":"") - ?>/>Publique - libre?"checked=\"checked\"":"") - ?>/>Libre - freeins?"checked=\"checked\"":"") - ?>/>Freeins - archive?"checked=\"checked\"":"") - ?>/>Archive + Publique + Libre + Freeins + Archive
- Modéros : - -moderos})" - ." ORDER BY nom, prenom"); - $tab = array(); - while(list($username) = mysql_fetch_row($sql)) - $tab[] = $username; - echo implode(', ', $tab); - mysql_free_result($sql); -?> - Modéros :$moderos
Membres :membres})" - ." ORDER BY nom, prenom"); - $tab = array(); - while(list($username) = mysql_fetch_row($sql)) - $tab[] = $username; - echo implode(', ', $tab); - mysql_free_result($sql); - ?> - $membres
@@ -131,7 +122,7 @@ class MListReq extends Validate {
-clean(); $this->submit(); - require_once("mailer.inc.php"); + require_once("diogenes.mailer.inc.php"); - $mymail = new mailer('Equipe Polytechnique.org ', + $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"); @@ -192,8 +183,7 @@ class MListReq extends Validate { $message = wordwrap($message,78); $mymail->setBody($message); $mymail->send(); - echo "

Mail envoyé

"; - return true; + return "Mail envoyé"; } function commit () { diff --git a/include/valid_photos.inc.php b/include/valid_photos.inc.php index 7e2a09c..e6af9a2 100644 --- a/include/valid_photos.inc.php +++ b/include/valid_photos.inc.php @@ -54,26 +54,24 @@ class PhotoReq extends Validate { } function echo_formu() { - require_once("popwin.inc.php"); -?> -
- - - + $url_app = isset($_COOKIE[session_name()]) ? "" : "&".SID; + return <<<________EOF + + + + - @@ -89,7 +87,7 @@ class PhotoReq extends Validate {
Demandeur : - prenom." ".$this->nom;?> + + {$this->prenom} {$this->nom}
- " width=110 alt=" [ PHOTO ] " /> - " width=110 alt=" [ PHOTO ] " /> +  [ PHOTO ] +  [ PHOTO ]
-', + require_once("diogenes.mailer.inc.php"); + $mymail = new DiogenesMailer('Equipe Polytechnique.org ', $this->username."@polytechnique.org", "[Polytechnique.org/PHOTO] Changement de photo de ".$this->username, false, "validation+trombino@m4x.org"); $mymail->setBody($message); $mymail->send(); - echo "
Mail envoyé"; $this->clean(); + return "Mail envoyé"; } function commit () { diff --git a/include/valid_sondages.inc.php b/include/valid_sondages.inc.php index 03dd978..04a0ab9 100644 --- a/include/valid_sondages.inc.php +++ b/include/valid_sondages.inc.php @@ -28,38 +28,35 @@ class SondageReq extends Validate { return parent::get_request($uid,'sondage',$stamp); } - function echo_formu() { - require_once("popwin.inc.php"); -?> -
- - - + function formu() { + global $baseurl; + $url = "$baseurl/sondage/questionnaire.php?SID=".$this->sid; + return <<<________EOF + + + + - - + - + - @@ -75,7 +72,7 @@ class SondageReq extends Validate {
Demandeur : prenom." ".$this->nom;?> + + {$this->prenom} {$this->nom} old)) echo "({$this->old})";?>
Titre du sondage :titre;?>{$this->titre}
Prévisualisation du sondage :'.$this->titre; - ?> - {$this->titre} +
Alias du sondage : (ne doit +  (ne doit pas contenir le caractère ')
-alias=$alias; } - require_once("mailer.inc.php"); + require_once("diogenes.mailer.inc.php"); $lien = "$baseurl/sondage/questionnaire.php?alias=".urlencode($this->alias); $titre = '"'.str_replace(''',"'",$this->titre).'"'; - $mymail = new mailer('Equipe Polytechnique.org ', + $mymail = new DiogenesMailer('Equipe Polytechnique.org ', $this->username."@polytechnique.org", "[Polytechnique.org/SONDAGE] Demande de validation du sondage $titre par ".$this->username, false, "validation+sondage@m4x.org"); @@ -148,9 +145,9 @@ class SondageReq extends Validate { $message = wordwrap($message,78); $mymail->setBody($message); $mymail->send(); - echo "
Mail envoyé"; //Suppression de la demande $this->clean(); + return "Mail envoyé"; } function commit () { diff --git a/include/validations.inc.php b/include/validations.inc.php index 9d992f4..c4212f0 100644 --- a/include/validations.inc.php +++ b/include/validations.inc.php @@ -1,6 +1,6 @@ unique ? "" : " AND stamp='".$this->stamp."'")); } - /** doit afficher le fomulaire de validation de la donnée + /** doit retourner le fomulaire de validation de la donnée * XXX la fonction est "virtuelle" XXX * XXX doit définir les variables $uid et $stamp en hidden XXX */ - function echo_formu() { } + function formu() { } /** fonction à réaliser en cas de valistion du formulaire * XXX la fonction est "virtuelle" XXX */ diff --git a/templates/admin/valider.tpl b/templates/admin/valider.tpl new file mode 100644 index 0000000..3fdff44 --- /dev/null +++ b/templates/admin/valider.tpl @@ -0,0 +1,11 @@ +{* $Id: valider.tpl,v 1.1 2004-01-27 09:08:57 x2000habouzit Exp $ *} + +{dynamic} +{$mail} +{foreach item=valid from=$valids} +
+{$valid->formu()} +{/foreach} +{/dynamic} + +{* vim:set et sw=2 sts=2 sws=2: *} diff --git a/templates/login.head.tpl b/templates/login.head.tpl index d6db692..5b86a94 100644 --- a/templates/login.head.tpl +++ b/templates/login.head.tpl @@ -1,4 +1,4 @@ -{* $Id: login.head.tpl,v 1.2 2004-01-26 12:45:07 x2000habouzit Exp $ *} +{* $Id: login.head.tpl,v 1.3 2004-01-27 09:08:56 x2000habouzit Exp $ *} {literal} {/literal} - {* vim:set et sw=2 sts=2 sws=2: *} diff --git a/templates/skin/common.header.tpl b/templates/skin/common.header.tpl index d5ed3a9..98220a4 100644 --- a/templates/skin/common.header.tpl +++ b/templates/skin/common.header.tpl @@ -1,4 +1,4 @@ -{* $Id: common.header.tpl,v 1.2 2004-01-26 12:36:32 x2000habouzit Exp $ *} +{* $Id: common.header.tpl,v 1.3 2004-01-27 09:08:57 x2000habouzit Exp $ *} @@ -20,5 +20,8 @@ Anciens eleves Polytechnique, annuaire email, Alumni +{if $popup_enable} + +{/if} {* vim:set et sw=2 sts=2 sws=2: *}