From: Florent Bruneau Date: Sun, 16 Sep 2007 13:06:10 +0000 (+0200) Subject: FS#28 - step 2: Use the group list from xnet in the profile X-Git-Tag: xorg/0.9.15~147 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=b37aacd982444c6b71d8f0b3555ab52f45e03a71;p=platal.git FS#28 - step 2: Use the group list from xnet in the profile Signed-off-by: Florent Bruneau --- diff --git a/include/user.func.inc.php b/include/user.func.inc.php index aca62cd..7a4ec0c 100644 --- a/include/user.func.inc.php +++ b/include/user.func.inc.php @@ -46,7 +46,6 @@ function user_clear_all_subs($user_id, $really_del=true) array_push($tables_to_clear['user_id'], 'newsletter_ins', 'auth_user_quick', 'binets_ins'); $tables_to_clear['id'] = array('aliases'); $tables_to_clear['contact'] = array('contacts'); - $tables_to_clear['guid'] = array('groupesx_ins'); XDB::execute("UPDATE auth_user_md5 SET date_ins = 0, promo_sortie = 0, nom_usage = '', password = '', perms = 'pending', nationalite = '', cv = '', section = 0, date = 0, smtppass = '' @@ -448,14 +447,18 @@ function &get_user_details($login, $from_uid = '', $view = 'private') $user['binets'] = $res->fetchColumn(); $user['binets_join'] = join(', ', $user['binets']); - $res = XDB::iterRow("SELECT text, url - FROM groupesx_ins - LEFT JOIN groupesx_def ON groupesx_ins.gid = groupesx_def.id - WHERE guid = {?}", $uid); + $res = XDB::iterRow("SELECT a.diminutif, a.nom, a.site + FROM groupex.asso AS a + LEFT JOIN groupex.membres AS m ON (m.asso_id = a.id) + WHERE m.uid = {?} AND (a.cat = 'GroupesX' OR a.cat = 'Institutions') + AND pub = 'public'", $uid); $user['gpxs'] = Array(); $user['gpxs_name'] = Array(); - while (list($gxt, $gxu) = $res->next()) { - $user['gpxs'][] = $gxu ? "$gxt" : $gxt; + while (list($gxd, $gxt, $gxu) = $res->next()) { + if (!$gxu) { + $gxu = 'http://www.polytechnique.net/' . $gxd; + } + $user['gpxs'][] = '$gxd"; $user['gpxs_name'][] = $gxt; } $user['gpxs_join'] = join(', ', $user['gpxs']); diff --git a/modules/profile.php b/modules/profile.php index e4fb63f..b8237db 100644 --- a/modules/profile.php +++ b/modules/profile.php @@ -54,7 +54,6 @@ class ProfileModule extends PLModule 'admin/binets' => $this->make_hook('admin_binets', AUTH_MDP, 'admin'), 'admin/medals' => $this->make_hook('admin_medals', AUTH_MDP, 'admin'), 'admin/formations' => $this->make_hook('admin_formations', AUTH_MDP, 'admin'), - 'admin/groupes-x' => $this->make_hook('admin_groupesx', AUTH_MDP, 'admin'), 'admin/sections' => $this->make_hook('admin_sections', AUTH_MDP, 'admin'), 'admin/secteurs' => $this->make_hook('admin_secteurs', AUTH_MDP, 'admin'), 'admin/trombino' => $this->make_hook('admin_trombino', AUTH_MDP, 'admin'), @@ -741,15 +740,6 @@ class ProfileModule extends PLModule $table_editor->describe('url','site web',false); $table_editor->apply($page, $action, $id); } - function handler_admin_groupesx(&$page, $action = 'list', $id = null) { - $page->assign('xorg_title','Polytechnique.org - Administration - Groupes X'); - $page->assign('title', 'Gestion des Groupes X'); - $table_editor = new PLTableEditor('admin/groupes-x','groupesx_def','id'); - $table_editor->add_join_table('groupesx_ins','gid',true); - $table_editor->describe('text','intitulé',true); - $table_editor->describe('url','site web',false); - $table_editor->apply($page, $action, $id); - } function handler_admin_sections(&$page, $action = 'list', $id = null) { $page->assign('xorg_title','Polytechnique.org - Administration - Sections'); $page->assign('title', 'Gestion des Sections'); diff --git a/modules/profile/groups.inc.php b/modules/profile/groups.inc.php index dcc8298..a967b94 100644 --- a/modules/profile/groups.inc.php +++ b/modules/profile/groups.inc.php @@ -103,7 +103,23 @@ class ProfileGroups extends ProfilePage parent::__construct($wiz); $this->settings['section'] = new ProfileSection(); $this->settings['binets'] = new ProfileGroup('binets', 'user_id', 'binet_id'); - $this->settings['groupesx'] = new ProfileGroup('groupesx', 'guid', 'gid'); + } + + public function prepare(PlatalPage &$page) + { + parent::prepare($page); + $page->assign('mygroups', XDB::iterator("SELECT a.nom, a.site, a.diminutif, a.unsub_url, a.pub, m.perms + FROM groupex.asso AS a + INNER JOIN groupex.membres AS m ON (m.asso_id = a.id) + WHERE m.uid = {?} AND (a.cat = 'GroupesX' OR a.cat = 'Institutions')", + S::i('uid'))); + $page->assign('listgroups', XDB::iterator("SELECT a.nom, a.diminutif, a.sub_url, + IF (a.cat = 'Institutions', a.cat, d.nom) AS dom + FROM groupex.asso AS a + LEFT JOIN groupex.dom AS d ON (d.id = a.dom) + WHERE a.inscriptible != 0 + AND (a.cat = 'GroupesX' OR a.cat = 'Institutions') + ORDER BY a.cat, a.dom, a.nom")); } } diff --git a/templates/admin/index.tpl b/templates/admin/index.tpl index 2cfec57..a9acab2 100644 --- a/templates/admin/index.tpl +++ b/templates/admin/index.tpl @@ -91,8 +91,6 @@   |   Binets   |   - Groupes X -   |   Skins   |   Décorations diff --git a/templates/profile/groups.tpl b/templates/profile/groups.tpl index cf24edd..67d9543 100644 --- a/templates/profile/groups.tpl +++ b/templates/profile/groups.tpl @@ -78,11 +78,17 @@ update(cat); } + function updateSubLink(cb) + { + var href = cb.value ? cb.value : "http://www.polytechnique.net"; + document.getElementById("groupesx_sub").href = href; + } + //]]> {/literal} - +
{/foreach} - - - -
Informations polytechniciennes @@ -129,34 +135,88 @@
Groupe(s) X - - {icon name="add" title="Ajouter ce groupe X"} +
+ + + + + + - {foreach item=text key=bid from=$groupesx} - - + + + + {/iterate} + + + + + + + - {/foreach}
Groupes et institutions X
+

+ La gestion des annuaires des groupes X est réalisée grâce à + Polytechnique.net. Pour faire apparaître un groupe sur ta fiche + il faut que soit inscrit dans ce groupe sur l'annuaire sur Polytechnique.net. +

+

+ Tu es actuellement inscrit aux groupes X suivants : +

- + {iterate from=$mygroups item=group} +
+ {if $group.pub neq 'public'}{icon name=error title="Liste de membres a accès restreint"}{/if} + {if $group.perms eq 'admin'}{icon name=wrench title="Tu es administrateur du groupe"}{/if} + {if $group.site}{else}{/if} + {$group.nom} + + + {icon name=cross title="Demander désinscription"} Demander ta désinscription + +
+
Signification des symboles :
+ {icon name=error} L'annuaire du groupe est à visibilité restreinte et ce groupe n'apparaîtra pas sur ta fiche
+ {icon name=wrench} Tu es administrateur du groupe +
+

+ Tu peux demander ton inscription aux groupes X qui t'intéressent. Voici la liste de ceux disponibles actuellement + sur Polytechnique.net et qui autorisent les demandes d'inscription : +

+
-
- {$text} -
- {icon name="cross" title="Supprimer ce groupe X"} + {assign var=groupcat value=""} + {assign var=ingroup value=false} + +
+ + {icon name="add" title="Demander ton inscription"} Demander ton inscription +
{* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *} diff --git a/templates/profile/profile.tpl b/templates/profile/profile.tpl index 5af2146..27ce51c 100644 --- a/templates/profile/profile.tpl +++ b/templates/profile/profile.tpl @@ -49,7 +49,7 @@ function chgMainWinLoc(strPage) {if $logged} {if $x.section}
Section : {$x.section}
{/if} {if $x.binets_join}
Binet(s) : {$x.binets_join}
{/if} - {if $x.gpxs_join}
Groupe(s) X : {$x.gpxs_join|smarty:nodefaults}
{/if} + {if $x.gpxs_join}
Groupe(s) et institution(s) X :
{$x.gpxs_join|smarty:nodefaults}
{/if} {/if} {if $x.web}
Site Web :
{$x.web}
{/if} {if $x.freetext}
Commentaires :
{$x.freetext|smarty:nodefaults}
{/if}