#380: add sex for external members
authorx2003bruneau <x2003bruneau@839d8a87-29fc-0310-9880-83ba4fa771e5>
Fri, 28 Jul 2006 14:36:06 +0000 (14:36 +0000)
committerx2003bruneau <x2003bruneau@839d8a87-29fc-0310-9880-83ba4fa771e5>
Fri, 28 Jul 2006 14:36:06 +0000 (14:36 +0000)
&& forgotten files from previous commits

git-svn-id: svn+ssh://murphy/home/svn/platal/trunk@692 839d8a87-29fc-0310-9880-83ba4fa771e5

ChangeLog
include/lists.inc.php
include/xnet/mail.inc.php
modules/xnetgrp.php
templates/xnet/groupe/mail.tpl
templates/xnet/groupe/membres-edit.tpl
upgrade/0.9.11/03_xnet.sql

index 7befda6..442f0f3 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -96,6 +96,7 @@ Bug/Wish:
     * Xnet:
         - #426: Add an identification header in mails.                     -FRU
         - #384: substitution of non-X's names in mail from web interface   -FRU
+        - #380: Add sex for non-X                                          -FRU
 
 From 0.9.10 Branch:
 
index a670cce..9857d3e 100644 (file)
@@ -82,5 +82,19 @@ function list_sort_members(&$members, $tri_promo = true) {
 }
 
 // }}}
+// {{{ function list_header_decode
+
+function _list_header_decode($charset, $c, $str) {
+    $s = ($c == 'Q' || $c == 'q') ? quoted_printable_decode($str) : base64_decode($str);
+    $s = iconv($charset, 'iso-8859-15', $s);
+    return str_replace('_', ' ', $s);
+}
+
+function list_header_decode($value) {
+    $val = preg_replace('/(=\?[^?]*\?[BQbq]\?[^?]*\?=) (=\?[^?]*\?[BQbq]\?[^?]*\?=)/', '\1\2', $value);
+    return preg_replace('/=\?([^?]*)\?([BQbq])\?([^?]*)\?=/e', '_list_header_decode("\1", "\2", "\3")', $val);
+}
+
+// }}}
 // vim:set et sw=4 sts=4 sws=4 foldmethod=marker:
 ?>
index cb196cc..43b87bd 100644 (file)
@@ -34,7 +34,7 @@ function get_all_redirects($membres, $mls, &$client)
                     'SELECT  IF(u.nom <> "", u.nom, m.nom) AS nom,
                              IF(u.prenom <> "", u.prenom, m.prenom) AS prenom,
                              IF(m.email <> "", m.email, CONCAT(a.alias, "@polytechnique.org")) as email,
-                             FIND_IN_SET("femme", u.flags) AS sexe
+                             IF(m.sexe IS NULL, FIND_IN_SET("femme", u.flags), m.sexe) AS sexe
                        FROM  groupex.membres AS m
                   LEFT JOIN  auth_user_md5   AS u ON (m.uid=u.user_id AND m.uid<50000)
                   LEFT JOIN  aliases         AS a ON (a.id=u.user_id and a.type="a_vie")
@@ -56,7 +56,7 @@ function get_all_redirects($membres, $mls, &$client)
                         $tos[] = $person;
                     }
                 } else {
-                    $res = XDB::query('SELECT prenom, nom FROM groupex.membres WHERE email={?}', $mem[1]);
+                    $res = XDB::query('SELECT prenom, nom, sexe FROM groupex.membres WHERE email={?}', $mem[1]);
                     if ($person = $res->fetchOneAssoc()) {
                         $person['email'] = $mem[1];
                         $tos[] = $person;
index dc41ccd..a45d370 100644 (file)
@@ -309,7 +309,7 @@ class XnetGrpModule extends PLModule
                            IF(m.origine='X',u.promo,'extérieur') AS promo,
                            IF(m.origine='X',u.promo,'') AS promo_o,
                            IF(m.origine='X',a.alias,m.email) AS email,
-                           IF(m.origine='X',FIND_IN_SET('femme', u.flags),0) AS femme,
+                           IF(m.origine='X',FIND_IN_SET('femme', u.flags), m.sexe) AS femme,
                            m.perms='admin' AS admin,
                            m.origine='X' AS x,
                            m.uid
@@ -682,13 +682,14 @@ class XnetGrpModule extends PLModule
         if (Post::has('change')) {
             if ($user['origine'] != 'X') {
                 XDB::query('UPDATE groupex.membres
-                                         SET prenom={?}, nom={?}, email={?}
-                                       WHERE uid={?} AND asso_id={?}',
-                                     Post::v('prenom'), Post::v('nom'),
-                                     Post::v('email'), $user['uid'],
-                                     $globals->asso('id'));
+                               SET prenom={?}, nom={?}, email={?}, sexe={?}
+                             WHERE uid={?} AND asso_id={?}',
+                           Post::v('prenom'), Post::v('nom'),
+                           Post::v('email'), Post::v('sexe'),
+                           $user['uid'], $globals->asso('id'));
                 $user['nom']    = Post::v('nom');
                 $user['prenom'] = Post::v('prenom');
+                $user['sexe']   = Post::v('sexe');
                 $user['email']  = Post::v('email');
                 $user['email2'] = Post::v('email');
             }
@@ -696,9 +697,9 @@ class XnetGrpModule extends PLModule
             $perms = Post::i('is_admin');
             if ($user['perms'] != $perms) {
                 XDB::query('UPDATE groupex.membres SET perms={?}
-                                      WHERE uid={?} AND asso_id={?}',
-                                      $perms ? 'admin' : 'membre',
-                                      $user['uid'], $globals->asso('id'));
+                             WHERE uid={?} AND asso_id={?}',
+                            $perms ? 'admin' : 'membre',
+                            $user['uid'], $globals->asso('id'));
                 $user['perms'] = $perms;
                 $page->trig('permissions modifiées');
             }
index d12aeea..1779ccc 100644 (file)
@@ -42,7 +42,7 @@ masculin ou f
       </td>
     </tr>
     <tr>
-      <td class="titre">Reply-To :</td>
+      <td class="titre">Répondre à :</td>
       <td>
         <input type="text" name="replyto" size="55" maxlength="70" value="{$smarty.request.replyto}" />
       </td>
index a30bf8c..b30780a 100644 (file)
@@ -37,8 +37,8 @@
 </h2>
 
 <form method="post" action="{$platal->ns}member/{$platal->argv[1]}">
-  <table cellpadding="0" cellspacing="0" class='tiny'>
-    <tr>
+  <table cellpadding="0" cellspacing="0" class='tinybicol'>
+    <tr class="pair">
       <td class="titre">
         Permissions:
       </td>
@@ -50,7 +50,7 @@
       </td>
     </tr>
     {if $user.origine neq X}
-    <tr>
+    <tr class="impair">
       <td class="titre">
         Prénom:
       </td>
@@ -58,7 +58,7 @@
         <input type="text" value="{$user.prenom}" name="prenom" size="40" />
       </td>
     </tr>
-    <tr>
+    <tr class="impair">
       <td class="titre">
         Nom:
       </td>
         <input type="text" value="{$user.nom}" name="nom" size="40" />
       </td>
     </tr>
-    <tr>
+    <tr class="impair">
+      <td class="titre">
+        Sexe:
+      </td>
+      <td>
+        <select name="sexe">
+          <option value="0"{if $user.sexe eq 0} selected="selected"{/if}>Homme</option>
+          <option value="1"{if $user.sexe eq 1} selected="selected"{/if}>Femme</option>
+        </select>
+      </td>
+    </tr>
+    <tr class="impair">
       <td class="titre">
         Email:
       </td>
index fad1950..a044a85 100644 (file)
@@ -1,5 +1,6 @@
 use groupex
 alter table evenements drop column advertise;
 alter table evenements drop column membres_only;
+alter table membres add column sexe bool default null;
 use x4dat