lists + photos OK
authorPierre Habouzit (MadCoder <pierre.habouzit@m4x.org>
Wed, 29 Dec 2004 08:43:31 +0000 (08:43 +0000)
committerFlorent Bruneau <florent.bruneau@polytechnique.org>
Thu, 26 Jun 2008 21:26:57 +0000 (23:26 +0200)
git-archimport-id: opensource@polytechnique.org--2005/platal--mainline--0.9--patch-166

configs/mails.conf
htdocs/listes/create.php
include/validations/listes.inc.php
include/validations/photos.inc.php
templates/include/form.valid.listes.tpl
templates/include/form.valid.photos.tpl
templates/mails/valid.liste.tpl [deleted file]
templates/mails/valid.photos.tpl [deleted file]

index dc9692d..eb3eb1e 100644 (file)
@@ -2,14 +2,6 @@
 from="Equipe Polytechnique.org" <validation+epouse@polytechnique.org>
 cc="Equipe Polytechnique.org" <validation+epouse@polytechnique.org>
 
-[valid_liste]
-from="Equipe Polytechnique.org" <validation+listes@polytechnique.org>
-cc="Equipe Polytechnique.org" <validation+listes@polytechnique.org>
-
-[valid_photos]
-from="Equipe Polytechnique.org" <validation+trombino@polytechnique.org>
-cc="Equipe Polytechnique.org" <validation+trombino@polytechnique.org>
-
 [valid_evts]
 from="Equipe Polytechnique.org" <validation+evts@polytechnique.org>
 cc="Equipe Polytechnique.org" <validation+evts@polytechnique.org>
index a04cc1a..b7413cd 100644 (file)
@@ -22,8 +22,8 @@
 require_once("xorg.inc.php");
 new_skinned_page('listes/create.tpl', AUTH_MDP);
 
-$owners  = preg_split("/[\r\n]+/",Post::get('owners'));
-$members = preg_split("/[\r\n]+/",Post::get('members'));
+$owners  = preg_split("/[\r\n]+/",Post::get('owners'), -1, PREG_SPLIT_NO_EMPTY);
+$members = preg_split("/[\r\n]+/",Post::get('members'), -1, PREG_SPLIT_NO_EMPTY);
 
 if (Post::has('add_owner_sub') && Post::has('add_owner')) {
     require_once('user.func.inc.php');
index 56ff6d9..53187b1 100644 (file)
@@ -67,33 +67,23 @@ class ListeReq extends Validate
     { return 'include/form.valid.listes.tpl'; }
 
     // }}}
-    // {{{ function handle_formu()
+    // {{{ function _mail_subj
 
-    function handle_formu()
+    function _mail_subj()
     {
-        if (Env::get('submit') != "Accepter" && Env::get('submit') != "Refuser") {
-            return false;
-        }
+        return "[Polytechnique.org/LISTES] Demande de la liste {$this->liste}";
+    }
 
-        require_once("xorg.mailer.inc.php");
-        $mymail = new XOrgMailer('valid.liste.tpl');
-        $mymail->assign('alias', $this->liste);
-        $mymail->assign('bestalias', $this->bestalias);
-        $mymail->assign('motif', stripslashes(Env::get('motif')));
+    // }}}
+    // {{{ function _mail_body
 
-        if (Env::get('submit') == "Accepter") {
-            $mymail->assign('answer', 'yes');
-            if (!$this->commit()) {
-                return 'problème';
-            }
+    function _mail_body($isok)
+    {
+        if ($isok) {
+            return "  La mailing list {$this->liste} que tu avais demandée vient d'être créée.";
         } else {
-            $mymail->assign('answer', 'no');
+            return "  La demande que tu avais faite pour la mailing list {$this->liste} a été refusée.";
         }
-        $mymail->send();
-
-        //Suppression de la demande
-        $this->clean();
-        return "Mail envoyé";
     }
 
     // }}}
index 717bffe..d6768fa 100644 (file)
@@ -96,29 +96,23 @@ class PhotoReq extends Validate
     { return 'include/form.valid.photos.tpl'; }
 
     // }}}
-    // {{{ function handle_formu()
-    
-    function handle_formu ()
+    // {{{ function _mail_subj
+
+    function _mail_subj()
     {
-        if (Post::get('submit') != "Accepter" && Post::get('submit') != "Refuser") {
-            return false;
-        }
-        
-        require_once("xorg.mailer.inc.php");
-        $mymail = new XOrgMailer('valid.photos.tpl');
-        $mymail->assign('bestalias', $this->bestalias);
+        return "[Polytechnique.org/PHOTO] Changement de photo";
+    }
 
-        if (Post::get('submit') == "Accepter") {
-            $mymail->assign('answer','yes');
-            $this->commit();
+    // }}}
+    // {{{ function _mail_body
+    
+    function _mail_body($isok)
+    {
+        if ($isok) {
+            return "  La demande de changement de photo que tu as demandée vient d'être effectuée.";
         } else {
-            $mymail->assign('answer','no');
+            return "  La demande de changement de photo que tu avais faite a été refusée.";
         }
-        
-        $mymail->send();
-
-        $this->clean();
-        return "Mail envoyé";
     }
 
     // }}}
@@ -133,6 +127,7 @@ class PhotoReq extends Validate
                                       $this->uid, $this->mimetype, $this->data, $this->x, $this->y);
        require_once('notifs.inc.php');
        register_watch_op($this->uid,WATCH_FICHE);
+        return true;
     }
 
     // }}}
index f104af7..da2c74a 100644 (file)
@@ -1,93 +1,68 @@
 {***************************************************************************
- *  Copyright (C) 2003-2004 Polytechnique.org                              *
- *  http://opensource.polytechnique.org/                                   *
- *                                                                         *
- *  This program is free software; you can redistribute it and/or modify   *
- *  it under the terms of the GNU General Public License as published by   *
- *  the Free Software Foundation; either version 2 of the License, or      *
- *  (at your option) any later version.                                    *
- *                                                                         *
- *  This program is distributed in the hope that it will be useful,        *
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of         *
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          *
- *  GNU General Public License for more details.                           *
- *                                                                         *
- *  You should have received a copy of the GNU General Public License      *
- *  along with this program; if not, write to the Free Software            *
- *  Foundation, Inc.,                                                      *
- *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
- ***************************************************************************}
+*  Copyright (C) 2003-2004 Polytechnique.org                              *
+*  http://opensource.polytechnique.org/                                   *
+*                                                                         *
+*  This program is free software; you can redistribute it and/or modify   *
+*  it under the terms of the GNU General Public License as published by   *
+*  the Free Software Foundation; either version 2 of the License, or      *
+*  (at your option) any later version.                                    *
+*                                                                         *
+*  This program is distributed in the hope that it will be useful,        *
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of         *
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          *
+*  GNU General Public License for more details.                           *
+*                                                                         *
+*  You should have received a copy of the GNU General Public License      *
+*  along with this program; if not, write to the Free Software            *
+*  Foundation, Inc.,                                                      *
+*  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
+***************************************************************************}
 
 
-<form action="{$smarty.server.PHP_SELF}" method="post">
-  <table class="bicol" cellpadding="4" summary="Demande d'alias">
-    <tr>
-      <td>Demandeur&nbsp;:
-      </td>
-      <td>
-        <a href="{"fiche.php"|url}?user={$valid->bestalias}" class="popup2">
-          {$valid->bestalias}</a>
-      </td>
-    </tr>
-    <tr>
-      <td>Liste&nbsp;:</td>
-      <td>{$valid->liste}@polytechnique.org</td>
-    </tr>
-    <tr>
-      <td>Desc&nbsp;:</td>
-      <td style="border: 1px dotted inherit">
-        {$valid->desc}
-      </td>
-    </tr>
-    <tr>
-      <td>Propriétés&nbsp;:</td>
-      <td>
-        <table cellpadding='2' cellspacing='0'>
-          <tr>
-            <td>visibilité:</td>
-            <td>{if $valid->advertise}publique{else}privée{/if}</td>
-          </tr>
-          <tr>
-            <td>diffusion:</td>
-            <td>{if $valid->modlevel eq 2}modérée{elseif $valid->modlevel}restreinte{else}libre{/if}</td>
-          </tr>
-          <tr>
-            <td>inscription:</td>
-            <td>{if $valid->inslevel}modérée{else}libre{/if}</td>
-          </tr>
-        </table>
-      </td>
-    </tr>
-    <tr>
-      <td>Getionnaires&nbsp;:</td>
-      <td>
-        {foreach from=$valid->owners item=o}
-        <a href="{"fiche.php"|url}?user={$o}" class="popup2">{$o}</a>
-        {/foreach}
-      </td>
-    </tr>
-    <tr>
-      <td>Membres&nbsp;:</td>
-      <td>
-        {foreach from=$valid->members item=o}
-        <a href="{"fiche.php"|url}?user={$o}" class="popup2">{$o}</a>
-        {/foreach}
-      </td>
-    </tr>
-    <tr>
-      <td class="middle">
-        <input type="hidden" name="uid" value="{$valid->uid}" />
-        <input type="hidden" name="type" value="{$valid->type}" />
-        <input type="hidden" name="stamp" value="{$valid->stamp}" />
-        <input type="submit" name="submit" value="Accepter" />
-        <br /><br />
-        <input type="submit" name="submit" value="Refuser" />
-      </td>
-      <td>
-        <textarea rows="5" cols="50" name="motif"></textarea>
-      </td>
-    </tr>
-  </table>
-</form>
+<tr class="pair">
+  <td class="titre">Liste&nbsp;:</td>
+  <td>{$valid->liste}@polytechnique.org</td>
+</tr>
+<tr class="pair">
+  <td class="titre">Desc&nbsp;:</td>
+  <td style="border: 1px dotted inherit">
+    {$valid->desc}
+  </td>
+</tr>
+<tr class="pair">
+  <td class="titre">Propriétés&nbsp;:</td>
+  <td>
+    <table cellpadding='2' cellspacing='0'>
+      <tr>
+        <td>visibilité:</td>
+        <td>{if $valid->advertise}publique{else}privée{/if}</td>
+      </tr>
+      <tr>
+        <td>diffusion:</td>
+        <td>{if $valid->modlevel eq 2}modérée{elseif $valid->modlevel}restreinte{else}libre{/if}</td>
+      </tr>
+      <tr>
+        <td>inscription:</td>
+        <td>{if $valid->inslevel}modérée{else}libre{/if}</td>
+      </tr>
+    </table>
+  </td>
+</tr>
+<tr class="pair">
+  <td class="titre">Gestionnaires&nbsp;:</td>
+  <td>
+    {foreach from=$valid->owners item=o}
+    <a href="{rel}/fiche.php?user={$o}" class="popup2">{$o}</a>
+    {/foreach}
+  </td>
+</tr>
+<tr class="pair">
+  <td class="titre">Membres&nbsp;:</td>
+  <td>
+    {foreach from=$valid->members item=o}
+    <a href="{rel}/fiche.php?user={$o}" class="popup2">{$o}</a>
+    {/foreach}
+  </td>
+</tr>
 
 {* vim:set et sw=2 sts=2 sws=2: *}
index 5b095b6..06b6bc4 100644 (file)
  *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
  ***************************************************************************}
 
-
-<form action="{$smarty.server.PHP_SELF}" method="post">
-<table class="bicol" summary="Demande d'alias">
-<tr>
-  <td>Demandeur&nbsp;:</td>
-  <td><a href="{"fiche.php"|url}?user={$valid->bestalias}" class="popup2">
-      {$valid->prenom} {$valid->nom}
-      </a>
-  </td>
-</tr>
-<tr>
-  <td class="middle" colspan="2">
-    <img src="{"getphoto.php"|url}?x={$valid->uid}" style="width:110px;" alt=" [ PHOTO ] " />
-    &nbsp;
-    <img src="{"getphoto.php"|url}?x={$valid->uid}&amp;req=true" style="width:110px;" alt=" [ PHOTO ] " />
-  </td>
-</tr>
-<tr>
-  <td class="middle">
-    <input type="hidden" name="uid" value="{$valid->uid}" />
-    <input type="hidden" name="type" value="{$valid->type}" />
-    <input type="hidden" name="stamp" value="{$valid->stamp}" />
-    <input type="submit" name="submit" value="Accepter" />
-    <br /><br />
-    <input type="submit" name="submit" value="Refuser" />
-  </td>
+<tr class="pair">
+  <td class="titre">Photos</td>
   <td>
-    <p>Raison du refus:</p>
-    <textarea rows="5" cols="50" name="motif"></textarea>
+    <img src="{rel}/getphoto.php?x={$valid->uid}" style="width:110px;" alt=" [ PHOTO ] " />
+    &nbsp;&nbsp;&nbsp;&nbsp;
+    <img src="{rel}/getphoto.php?x={$valid->uid}&amp;req=true" style="width:110px;" alt=" [ PHOTO ] " />
   </td>
 </tr>
-</table>
-</form>
 
 {* vim:set et sw=2 sts=2 sws=2: *}
diff --git a/templates/mails/valid.liste.tpl b/templates/mails/valid.liste.tpl
deleted file mode 100644 (file)
index 6593d6f..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-{***************************************************************************
- *  Copyright (C) 2003-2004 Polytechnique.org                              *
- *  http://opensource.polytechnique.org/                                   *
- *                                                                         *
- *  This program is free software; you can redistribute it and/or modify   *
- *  it under the terms of the GNU General Public License as published by   *
- *  the Free Software Foundation; either version 2 of the License, or      *
- *  (at your option) any later version.                                    *
- *                                                                         *
- *  This program is distributed in the hope that it will be useful,        *
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of         *
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          *
- *  GNU General Public License for more details.                           *
- *                                                                         *
- *  You should have received a copy of the GNU General Public License      *
- *  along with this program; if not, write to the Free Software            *
- *  Foundation, Inc.,                                                      *
- *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
- ***************************************************************************}
-
-{config_load file="mails.conf" section="valid_liste"}
-{subject text="[Polytechnique.org/LISTES] Demande de la liste $alias par $bestalias"}
-{from full=#from#}
-{to addr="$bestalias@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|stripslashes}
-{/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|stripslashes}
-
-Cordialement,
-L'équipe X.org
-{/if}
-{* vim:set et sw=2 sts=2 sws=2: *}
diff --git a/templates/mails/valid.photos.tpl b/templates/mails/valid.photos.tpl
deleted file mode 100644 (file)
index abd863d..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-{***************************************************************************
- *  Copyright (C) 2003-2004 Polytechnique.org                              *
- *  http://opensource.polytechnique.org/                                   *
- *                                                                         *
- *  This program is free software; you can redistribute it and/or modify   *
- *  it under the terms of the GNU General Public License as published by   *
- *  the Free Software Foundation; either version 2 of the License, or      *
- *  (at your option) any later version.                                    *
- *                                                                         *
- *  This program is distributed in the hope that it will be useful,        *
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of         *
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          *
- *  GNU General Public License for more details.                           *
- *                                                                         *
- *  You should have received a copy of the GNU General Public License      *
- *  along with this program; if not, write to the Free Software            *
- *  Foundation, Inc.,                                                      *
- *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
- ***************************************************************************}
-
-{config_load file="mails.conf" section="valid_photos"}
-{subject text="[Polytechnique.org/PHOTO] Changement de photo de $bestalias"}
-{from full=#from#}
-{to addr="$bestalias@polytechnique.org"}
-{cc full=#cc#}
-{if $answer eq "yes"}
-Cher(e) camarade,
-
-  La demande de changement de photo que tu as demandée vient d'être effectuée.
-
-Cordialement,
-L'équipe X.org
-{elseif $answer eq 'no'}
-Cher(e) camarade,
-
-  La demande de changement de photo que tu avais faite a été refusée.
-La raison de ce refus est :
-{$smarty.request.motif|stripslashes}
-
-Cordialement,
-L'équipe X.org
-{/if}
-{* vim:set et sw=2 sts=2 sws=2: *}