...
....
.....
ML are DONE oh yeah !
from=Equipe Polytechnique.org <validation+epouse@polytechnique.org>
cc=Equipe Polytechnique.org <validation+epouse@polytechnique.org>
-[valid_ml]
+[valid_liste]
from=Equipe Polytechnique.org <validation+listes@polytechnique.org>
cc=Equipe Polytechnique.org <validation+listes@polytechnique.org>
--- /dev/null
+<?php
+/***************************************************************************
+ * 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 *
+ ***************************************************************************
+ $Id: create.php,v 1.1 2004-09-25 20:11:34 x2000habouzit Exp $
+ ***************************************************************************/
+
+require("auto.prepend.inc.php");
+new_skinned_page('listes/create.tpl', AUTH_MDP);
+
+$owners = empty($_POST['owners']) ? Array() : preg_split("/[\r\n]+/",$_POST['owners']);
+$members = empty($_POST['members']) ? Array() : preg_split("/[\r\n]+/",$_POST['members']);
+
+if(isset($_POST['desc'])) $_POST['desc'] = stripslashes($_POST['desc']);
+
+if(isset($_POST['add_owner_sub']) && isset($_POST['add_owner'])) {
+ $res = $globals->db->query("
+ SELECT a.alias AS forlife
+ FROM aliases AS a
+ INNER JOIN aliases AS b USING(id)
+ WHERE b.alias='{$_POST['add_owner']}' AND b.type!='homonyme' AND a.type='a_vie'");
+ if(list($forlife) = mysql_fetch_row($res)) {
+ $owners [] = $forlife;
+ }
+ mysql_free_result($res);
+}
+
+if(isset($_POST['add_member_sub']) && isset($_POST['add_member'])) {
+ $res = $globals->db->query("
+ SELECT a.alias AS forlife
+ FROM aliases AS a
+ INNER JOIN aliases AS b USING(id)
+ WHERE b.alias='{$_POST['add_member']}' AND b.type!='homonyme' AND a.type='a_vie'");
+ if(list($forlife) = mysql_fetch_row($res)) {
+ $members[] = $forlife;
+ }
+ mysql_free_result($res);
+}
+
+ksort($owners); array_unique($owners);
+ksort($members); array_unique($members);
+
+if(isset($_POST['submit'])) {
+ $err = Array();
+
+ if(empty($_POST['liste'])) $err[] = 'champs «addresse souhaitée» vide';
+
+ $res = $globals->db->query("SELECT COUNT(*) FROM aliases WHERE alias='{$_POST['liste']}'");
+ list($n) = mysql_fetch_row($res);
+ mysql_free_result($res);
+ if($n) $err[] = 'cet alias est déjà pris';
+
+ if(empty($_POST['desc'])) $err[] = 'le sujet est vide';
+ if(!count($owners)) $err[] = 'pas de gestionnaire';
+ if(count($members)<4) $err[] = 'pas assez de membres';
+
+ if(!count($err)) {
+ $page->assign('created', true);
+ require('validations.inc.php');
+ $req = new ListeReq($_SESSION['uid'], $_POST['liste'], $_POST['desc'],
+ $_POST['advertise'], $_POST['modlevel'], $_POST['inslevel'],
+ $owners, $members);
+ $req->submit();
+ } else {
+ $page->assign('err', $err);
+ }
+}
+
+$page->assign('owners', join("\n",$owners));
+$page->assign('members', join("\n",$members));
+$page->run();
+?>
--- /dev/null
+<?php
+/***************************************************************************
+ * 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 *
+ ***************************************************************************
+ $Id: valid_listes.inc.php,v 1.1 2004-09-25 20:11:34 x2000habouzit Exp $
+ ***************************************************************************/
+
+class ListeReq extends Validate {
+ var $forlife;
+ var $liste;
+ var $desc;
+
+ var $advertise;
+ var $modlevel;
+ var $inslevel;
+
+ var $owners;
+ var $members;
+
+ function ListeReq ($_uid, $_liste, $_desc, $_advertise, $_modlevel, $_inslevel, $_owners, $_members, $_stamp=0) {
+ global $globals;
+ $this->Validate($_uid, true, 'liste', $_stamp);
+ $this->liste = $_liste;
+ $this->desc = $_desc;
+
+ $this->advertise = $_advertise;
+ $this->modlevel = $_modlevel;
+ $this->inslevel = $_inslevel;
+
+ $this->owners = $_owners;
+ $this->members = $_members;
+
+ $sql = $globals->db->query("
+ SELECT l.alias
+ FROM auth_user_md5 AS u
+ INNER JOIN aliases AS l ON (u.user_id=l.id AND type='a_vie')
+ WHERE user_id='".$this->uid."'");
+ list($this->forlife) = mysql_fetch_row($sql);
+ mysql_free_result($sql);
+ }
+
+ function get_unique_request($uid) {
+ return parent::get_unique_request($uid,'liste');
+ }
+
+ function formu() { return 'include/form.valid.listes.tpl'; }
+
+ function handle_formu () {
+ if(empty($_REQUEST['submit'])
+ || ($_REQUEST['submit']!="Accepter" && $_REQUEST['submit']!="Refuser"))
+ return false;
+
+ require_once("tpl.mailer.inc.php");
+ $mymail = new TplMailer('valid.liste.tpl');
+ $mymail->assign('alias', $this->liste);
+ $mymail->assign('forlife', $this->forlife);
+ $mymail->assign('motif', stripslashes($_REQUEST['motif']));
+
+ if($_REQUEST['submit']=="Accepter") {
+ $mymail->assign('answer', 'yes');
+ if(!$this->commit()) return 'problème';
+ } else {
+ $mymail->assign('answer', 'no');
+ }
+ $mymail->send();
+ //Suppression de la demande
+ $this->clean();
+ return "Mail envoyé";
+ }
+
+ function commit () {
+ global $globals;
+ include('xml-rpc-client.inc.php');
+ $res = $globals->db->query("SELECT password FROM auth_user_md5 WHERE user_id={$_SESSION['uid']}");
+ list($pass) = mysql_fetch_row($res);
+ mysql_free_result($res);
+
+ $client = new xmlrpc_client("http://{$_SESSION['uid']}:$pass@localhost:4949");
+ $ret = $client->create_list('polytechnique.org', $this->liste, $this->desc,
+ $this->advertise, $this->modlevel, $this->inslevel,
+ $this->owners, $this->members);
+ if($ret) {
+ $globals->db->query("INSERT INTO aliases (alias,type) VALUES('{$this->liste}', 'liste')");
+ }
+ return $ret;
+ }
+}
+
+?>
* Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
***************************************************************************
- $Id: validations.inc.php,v 1.15 2004-09-02 20:12:08 x2000habouzit Exp $
+ $Id: validations.inc.php,v 1.16 2004-09-25 20:11:34 x2000habouzit Exp $
***************************************************************************/
/* vim: set expandtab shiftwidth=4 tabstop=4 softtabstop=4 textwidth=100:
- * $Id: validations.inc.php,v 1.15 2004-09-02 20:12:08 x2000habouzit Exp $
+ * $Id: validations.inc.php,v 1.16 2004-09-25 20:11:34 x2000habouzit Exp $
*
*/
require("valid_epouses.inc.php");
require("valid_photos.inc.php");
require("valid_evts.inc.php");
+require("valid_listes.inc.php");
?>
#* Foundation, Inc., *
#* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
#***************************************************************************
-# $Id: mailman-rpc.py,v 1.40 2004-09-25 15:55:56 x2000habouzit Exp $
+# $Id: mailman-rpc.py,v 1.41 2004-09-25 20:11:35 x2000habouzit Exp $
#***************************************************************************
-import base64, MySQLdb, os, getopt, sys, MySQLdb.converters
+import base64, MySQLdb, os, getopt, sys, MySQLdb.converters, sha
from pwd import getpwnam
from grp import getgrnam
else:
return None
- def log_message(self, format, *args):
- return
-
################################################################################
#
# XML RPC STUFF
return (details,options)
except:
mlist.Unlock()
+ return 0
+
+#-------------------------------------------------------------------------------
+# admin procedures [ soptions.php ]
+#
+
+def create_list((userdesc,perms),vhost,listname,desc,advertise,modlevel,inslevel,owners,members):
+ if perms != 'admin':
+ return 0
+ name = vhost+'-'+listname;
+ if Utils.list_exists(name):
+ return 0
+
+ mlist = MailList.MailList()
+ try:
+ oldmask = os.umask(002)
+ pw = sha.new('foobar').hexdigest()
+ try:
+ mlist.Create(name, owners[0]+'@polytechnique.org', pw)
+ finally:
+ os.umask(oldmask)
+
+ mlist.real_name = listname
+ mlist.description = desc
+
+ mlist.advertised = int(advertise)
+ mlist.default_member_moderation = int(modlevel) is 2
+ mlist.generic_nonmember_action = int(modlevel) > 0
+ mlist.subscribe_policy = 2 * (int(inslevel) is 1)
+
+ mlist.owner = map(lambda a: a+'@polytechnique.org', owners)
+
+ mlist.Save()
+ mlist.Unlock()
+ check_options((userdesc,perms),vhost,listname,True)
+ mass_subscribe((userdesc,perms),vhost,listname,members)
+ except:
raise
return 0
+ return 1
+
+
#-------------------------------------------------------------------------------
# server
server.register_function(set_admin_options)
# check.php
server.register_function(check_options)
+# create
+server.register_function(create_list)
server.serve_forever()
-- pas sur que je veuille le dropper pr le moment celui la ... a voir
--*-- ALTER TABLE x4dat.auth_user_md5 DROP COLUMN lastnewslogin;
+-- cgt de type pour les ML
+ALTER TABLE x4dat.requests CHANGE `type` `type` ENUM('alias','epouse','liste','photo','sondage','emploi','evts' ) DEFAULT 'alias' NOT NULL
-- lastlogin --> logger
ALTER TABLE x4dat.auth_user_md5 DROP COLUMN lastlogin;
ALTER TABLE x4dat.auth_user_md5 DROP COLUMN host;
--- /dev/null
+{***************************************************************************
+ * 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 *
+ ***************************************************************************
+ $Id: form.valid.listes.tpl,v 1.1 2004-09-25 20:11:35 x2000habouzit Exp $
+ ***************************************************************************}
+
+
+<form action="{$smarty.server.PHP_SELF}" method="post">
+ <table class="bicol" cellpadding="4" summary="Demande d'alias">
+ <tr>
+ <td>Demandeur :
+ </td>
+ <td>
+ <a href="javascript:x()" onclick="popWin('{"fiche.php"|url}?user={$valid->forlife}')">
+ {$valid->forlife}</a>
+ </td>
+ </tr>
+ <tr>
+ <td>Liste :</td>
+ <td>{$valid->liste}@polytechnique.org</td>
+ </tr>
+ <tr>
+ <td>Desc :</td>
+ <td style="border: 1px dotted inherit">
+ {$valid->desc}
+ </td>
+ </tr>
+ <tr>
+ <td>Propriétés :</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 :</td>
+ <td>
+ {foreach from=$valid->owners item=o}
+ <a href="javascript:x()" onclick="popWin('{"fiche.php"|url}?user={$o}')">{$o}</a>
+ {/foreach}
+ </td>
+ </tr>
+ <tr>
+ <td>Membres :</td>
+ <td>
+ {foreach from=$valid->members item=o}
+ <a href="javascript:x()" onclick="popWin('{"fiche.php"|url}?user={$o}')">{$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>
+
+{* vim:set et sw=2 sts=2 sws=2: *}
--- /dev/null
+{***************************************************************************
+ * 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 *
+ ***************************************************************************
+ $Id: create.tpl,v 1.1 2004-09-25 20:11:36 x2000habouzit Exp $
+ ***************************************************************************}
+
+{dynamic}
+
+{foreach from=$err item=e}
+<p class='erreur'>{$e}</p>
+{/foreach}
+
+<div class="rubrique">
+ Création d'une liste de diffusion
+</div>
+
+{if $created}
+<p class='erreur'>Demande de création envoyée !</p>
+
+{else}
+
+<p>
+N'importe qui peut faire la demande de création d'une mailing-list, il suffit pour cela d'être au
+moins 4 polytechniciens inscrits sur le site, et de fournir les informations suivantes concernant la
+liste :
+</p>
+
+<form action='{$smarty.server.PHP_SELF}' method='post'>
+ <table class='bicol' cellspacing='0' cellpadding='2'>
+ <tr>
+ <th colspan='2'>Caractéristiques de la Liste</th>
+ </tr>
+ <tr>
+ <td class='titre'>Addresse souhaitée :</td>
+ <td>
+ <input type='text' name='liste' value='{$smarty.post.liste}' />@polytechnique.org
+ </td>
+ </tr>
+ <tr>
+ <td class='titre'>Sujet (bref) :</td>
+ <td>
+ <input type='text' name='desc' size='50' value="{$smarty.post.desc}" />
+ </td>
+ </tr>
+ <tr>
+ <td class='titre'>Propriétés :</td>
+ <td>
+ <table style='width: 100%'>
+ <tr>
+ <td>visibilité :</td>
+ <td><input type='radio' name='advertise' value='0'
+ {if $smarty.post.advertise eq 0 && $smarty.post}checked='checked'{/if} />publique</td>
+ <td><input type='radio' name='advertise' value='1'
+ {if $smarty.post.advertise neq 0 || !$smarty.post}checked='checked'{/if} />privée</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>diffusion :</td>
+ <td><input type='radio' name='modlevel' value='0'
+ {if !$smarty.post.modlevel}checked='checked'{/if} />libre</td>
+ <td><input type='radio' name='modlevel' value='1'
+ {if $smarty.post.modlevel eq 1}checked='checked'{/if} />restreinte</td>
+ <td><input type='radio' name='modlevel' value='2'
+ {if $smarty.post.modlevel eq 2}checked='checked'{/if} />modérée</td>
+ </tr>
+ <tr>
+ <td>inscription :</td>
+ <td><input type='radio' name='inslevel' value='0'
+ {if $smarty.post.inslevel eq 0 && $smarty.post}checked='checked'{/if} />libre</td>
+ <td><input type='radio' name='inslevel' value='1'
+ {if $smarty.post.inslevel neq 0 || !$smarty.post}checked='checked'{/if} />modérée</td>
+ <td></td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ <tr><th colspan='2'>Membres et Gestionnaires</th></tr>
+ <tr>
+ <td class='titre'>Gestionnaires</td>
+ <td>
+ <input type='hidden' name='owners' value='{$owners}' />
+ {$owners|nl2br|default:"<span class='erreur'>pas de gestionnaires</span>"}
+ <br />
+ <input type='text' name='add_owner' />
+ <input type='submit' name='add_owner_sub' value='Ajouter' />
+ </td>
+ </tr>
+ <tr>
+ <td class='titre'>Membres</td>
+ <td>
+ <input type='hidden' name='members' value='{$members}' />
+ {$members|nl2br|default:"<span class='erreur'>pas de membres</span>"}
+ <br />
+ <input type='text' name='add_member' />
+ <input type='submit' name='add_member_sub' value='Ajouter' />
+ </td>
+ </tr>
+ </table>
+ <p>
+ La création de la liste sera soumise à un contrôle manuel avant d'être validée. Ce contrôle a
+ pour but notamment de vérifier qu'il n'y aura pas ambiguité entre les membres de la liste et son
+ identité. Exemple: n'importe qui ne peut pas ouvrir pointgamma@polytechnique.org, il ne suffit
+ pas d'être le premier à le demander :-)
+ </p>
+ <p>
+ La liste est habituellement créée dans les jours qui suivent la demande sauf exception. Pour plus
+ d'informations écris-nous à l'adresse {mailto address='listes@polytechnique.org'} en mettant dans
+ le sujet de ton mail le nom de la liste souhaité afin de faciliter les échanges de mails
+ ultérieurs éventuels.
+ </p>
+ <div class='center'>
+ <br />
+ <input type='submit' name='submit' value='Soumettre' />
+ </div>
+</form>
+
+{/if}
+
+{/dynamic}
+
+{* vim:set et sw=2 sts=2 sws=2: *}
* Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
***************************************************************************
- $Id: index.tpl,v 1.9 2004-09-25 16:30:26 x2000habouzit Exp $
+ $Id: index.tpl,v 1.10 2004-09-25 20:11:36 x2000habouzit Exp $
***************************************************************************}
<div class="rubrique">
<li>modérée: l'envoi d'un mail à la liste est alors filtré par des
modérateurs, eux seuls peuvent accepter un message envoyé à la liste.</li>
</ul>
-</p>
+
<p class='smaller'>
NB : les gestionnaires d'une liste sont aussi ses modérateurs.
</p>
+<div class='ssrubrique'>
+ Demander la création d'une liste de diffusion
+</div>
+
+<p>
+Nos listes ont pour but de réunir des X autour de thèmes ou centres d'intérêt communs. C'est un
+moyen pratique et efficace de rassembler plusieurs personnes autour d'un projet commun ou d'une
+thématique particulière.
+</p>
+<p>
+Tu peux demander <a href='create.php'>la création</a> d'une liste de diffusion sur le thème de ton choix.
+</p>
+
{dynamic}
<div class="rubrique">
* Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
***************************************************************************
- $Id: valid.ml.tpl,v 1.3 2004-09-02 21:09:33 x2000habouzit Exp $
+ $Id: valid.liste.tpl,v 1.1 2004-09-25 20:11:36 x2000habouzit Exp $
***************************************************************************}
-{config_load file="mails.conf" section="valid_ml"}
+{config_load file="mails.conf" section="valid_liste"}
{subject text="[Polytechnique.org/LISTES] Demande de la liste $alias par $forlife"}
{from full=#from#}
{to addr="$forlife@polytechnique.org"}