From: Pierre Habouzit (MadCoder Date: Thu, 28 Apr 2005 12:35:57 +0000 (+0000) Subject: admin pages, mysql optimizations, menu fixes X-Git-Tag: xorg/old~158 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=43638886619fea51b4177d510e003d9fb7f5dabf;p=platal.git admin pages, mysql optimizations, menu fixes git-archimport-id: opensource@polytechnique.org--2005/platal--mainline--0.9--patch-604 --- diff --git a/htdocs.net/admin.php b/htdocs.net/admin.php new file mode 100644 index 0000000..f8a928e --- /dev/null +++ b/htdocs.net/admin.php @@ -0,0 +1,49 @@ +useMenu(); + + if (Get::has('del')) { + $res = $globals->xdb->query('SELECT id, nom, mail_domain FROM groupex.asso WHERE diminutif={?}', Get::get('del')); + list($id, $nom, $domain) = $res->fetchOneRow(); + $page->assign('nom', $nom); + if ($id && Post::has('del')) { + $globals->xdb->query('DELETE FROM groupex.membres WHERE asso_id={?}', $id); + $page->trig('membres supprimés'); + + if ($domain) { + $globals->xdb->query('DELETE FROM virtual_domains WHERE domain={?}', $domain); + $globals->xdb->query('DELETE FROM virtual, virtual_redirect + USING virtual INNER JOIN virtual_redirect USING (vid) + WHERE alias LIKE {?}', '%@'.$domain); + $page->trig('suppression des alias mails'); + + require_once('lists.inc.php'); + $client =& lists_xmlrpc(Session::getInt('uid'), Session::get('password'), $domain); + if ($listes = $client->get_lists()) { + foreach ($listes as $l) { + $client->delete_list($l['list'], true); + } + $page->trig('mail lists surpprimées'); + } + } + + $globals->xdb->query('DELETE FROM groupex.asso WHERE id={?}', $id); + $page->trig("Groupe $nom supprimé"); + Get::kill('del'); + } + if (!$id) { + Get::kill('del'); + } + } + + if (Post::has('diminutif')) { + $globals->xdb->query('INSERT INTO groupex.asso (id,diminutif) VALUES(NULL,{?})', Post::get('diminutif')); + header('Location: '.Post::get('diminutif').'/edit.php'); + } + + $res = $globals->xdb->query('SELECT nom,diminutif FROM groupex.asso ORDER by NOM'); + $page->assign('assos', $res->fetchAllAssoc()); + + $page->run(); +?> diff --git a/htdocs.net/groupe/edit.php b/htdocs.net/groupe/edit.php index 8d18421..bdb6d0c 100644 --- a/htdocs.net/groupe/edit.php +++ b/htdocs.net/groupe/edit.php @@ -12,6 +12,7 @@ Post::get('nom'), Post::get('diminutif'), Post::get('cat'), Post::getInt('dom'), Post::get('descr'), Post::get('site'), Post::get('mail'), Post::get('resp'), Post::get('forum'), Post::get('mail_domain'), Post::has('ax'), $globals->asso('id')); + $globals->xdb->execute('INSERT INTO virtual_domains (domain) VALUES({?})', Post::get('mail_domain')); } else { $globals->xdb->execute( "UPDATE groupex.asso diff --git a/include/xnet/page.inc.php b/include/xnet/page.inc.php index 6d83970..cf5c653 100644 --- a/include/xnet/page.inc.php +++ b/include/xnet/page.inc.php @@ -62,6 +62,9 @@ class XnetPage extends PlatalPage $sub['accueil'] = 'index.php'; $sub['liste des groupes'] = 'plan.php'; if (logged()) { + if (has_perms()) { + $sub['admin X.net'] = 'admin.php'; + } $sub['déconnexion'] = 'deconnexion.php'; } $menu["Menu Principal"] = $sub; @@ -69,7 +72,7 @@ class XnetPage extends PlatalPage if (logged() && (is_member() || may_update())) { $sub = array(); $dim = $globals->asso('diminutif'); - $sub['accueil'] = "$dim/asso.php"; + $sub['présentation'] = "$dim/asso.php"; $sub['annuaire du groupe'] = "$dim/annuaire.php"; if ($globals->asso('mail_domain')) { $sub['listes de diffusion'] = "$dim/listes.php"; @@ -84,10 +87,11 @@ class XnetPage extends PlatalPage if (logged() && may_update()) { $sub = array(); $sub['modifier l\'acceuil'] = "$dim/edit.php"; - $sub['envoyer un mail'] = "$dim/mail.php"; - $sub['créer une liste'] = "$dim/listes-create.php"; - $sub['créer un alias'] = "$dim/alias-create.php"; - + if ($globals->asso('mail_domain')) { + $sub['envoyer un mail'] = "$dim/mail.php"; + $sub['créer une liste'] = "$dim/listes-create.php"; + $sub['créer un alias'] = "$dim/alias-create.php"; + } $menu['Administrer Groupe'] = $sub; } diff --git a/templates/xnet/admin.tpl b/templates/xnet/admin.tpl new file mode 100644 index 0000000..90c6ffb --- /dev/null +++ b/templates/xnet/admin.tpl @@ -0,0 +1,60 @@ +{*************************************************************************** + * 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 * + ***************************************************************************} + +{if $smarty.get.del} + +

Suppression du groupe {$nom}

+ +
+
+ +
+
+ +{else} + +

Ajouter un groupe

+ +
+

+ Pour ajouter un groupe, choisir ici le diminutif qu'il va utiliser, + tu seras ensuite redirigé vers une page te permettant d'éditer le groupe : +

+
+ + +
+
+ + +

Administration des groupes X.net

+ + + {foreach from=$assos item=a key=i name=all} + {if $i is even}{/if} + + + {if $i is odd || $smarty.foreach.all.last}{/if} + {/foreach} +
delete{$a.nom}
+ +{/if} + +{* vim:set et sw=2 sts=2 sws=2: *} diff --git a/upgrade/0.9.6/00_xnet.sql b/upgrade/0.9.6/00_xnet.sql index afb1edf..0e1e997 100644 --- a/upgrade/0.9.6/00_xnet.sql +++ b/upgrade/0.9.6/00_xnet.sql @@ -1,3 +1,15 @@ update groupex.asso set nom=replace(nom, '', ''); update groupex.asso set nom=replace(nom, '', ''); + alter table groupex.asso drop column m_list; +alter table groupex.asso change column nom nom CHAR(255) not null; +alter table groupex.asso change column diminutif diminutif CHAR(64) not null; +alter table groupex.asso change column site site CHAR(255) not null; +alter table groupex.asso change column mail mail CHAR(255) not null; +alter table groupex.asso change column resp resp CHAR(255) not null; +alter table groupex.asso change column forum forum CHAR(255) not null; +alter table groupex.asso change column mail_domain mail_domain CHAR(255) not null; +alter table groupex.asso add unique index (diminutif); + +alter table groupex.membres change column uid uid int not null; +