From: x2000habouzit Date: Fri, 14 Jul 2006 19:49:18 +0000 (+0000) Subject: begin to migrate the first 'asso' page to the new system, using a namespace hack... X-Git-Tag: xorg/0.9.11~418 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=ae7bb1801452804bb5c01f856f2ae0a914508adc;p=platal.git begin to migrate the first 'asso' page to the new system, using a namespace hack, determined cooperatively from a Xnet class (implementing the Platal site) and from xnet globals. this is hacky, and has to disappear at some point, when we will clean session objs. git-svn-id: svn+ssh://murphy/home/svn/platal/trunk@483 839d8a87-29fc-0310-9880-83ba4fa771e5 --- diff --git a/classes/Xnet.php b/classes/Xnet.php new file mode 100644 index 0000000..408ff55 --- /dev/null +++ b/classes/Xnet.php @@ -0,0 +1,44 @@ +asso()) { + if ($p = strpos($this->path, '/')) { + $this->ns = substr($this->path, 0, $p); + $this->path = 'grp'.substr($this->path, $p); + } else { + $this->ns = $this->path.'/'; + $this->path = 'grp'; + } + } + } +} + +?> diff --git a/htdocs.net/groupe/asso.php b/htdocs.net/groupe/asso.php deleted file mode 100644 index 39be21f..0000000 --- a/htdocs.net/groupe/asso.php +++ /dev/null @@ -1,18 +0,0 @@ -useMenu(); -$page->setType($globals->asso('cat')); -$page->assign('is_member', is_member()); -$page->assign('logged', logged()); - -$page->assign('asso', $globals->asso()); -if (!$globals->asso('id')) { - redirect("../"); -} - -$page->run(); - -?> diff --git a/htdocs.net/index.php b/htdocs.net/index.php index 83f93a2..8ee3c5d 100644 --- a/htdocs.net/index.php +++ b/htdocs.net/index.php @@ -21,10 +21,10 @@ require 'xnet.inc.php'; -require_once dirname(__FILE__).'/../classes/Platal.php'; +require_once dirname(__FILE__).'/../classes/Xnet.php'; require_once dirname(__FILE__).'/../classes/PLModule.php'; -$platal = new Platal('xnet'); +$platal = new Xnet('xnet', 'xnetgrp'); $platal->run(); ?> diff --git a/include/xnet/page.inc.php b/include/xnet/page.inc.php index ba72a7f..f336167 100644 --- a/include/xnet/page.inc.php +++ b/include/xnet/page.inc.php @@ -72,7 +72,7 @@ class XnetPage extends PlatalPage if (logged() && (is_member() || may_update())) { $sub = array(); $dim = $globals->asso('diminutif'); - $sub['présentation'] = "$dim/asso.php"; + $sub['présentation'] = "$dim/"; if (may_update() || $globals->asso('pub') == 'public') { $sub['annuaire du groupe'] = "$dim/annuaire.php"; if ($globals->xnet->geoloc) diff --git a/include/xnet/smarty.plugins.inc.php b/include/xnet/smarty.plugins.inc.php index 46db21c..725b50f 100644 --- a/include/xnet/smarty.plugins.inc.php +++ b/include/xnet/smarty.plugins.inc.php @@ -36,7 +36,7 @@ function list_all_my_groups($params) WHERE m.uid={?}", Session::getInt('uid')); $html = '
Mes groupes :
'; while (list($nom, $mini) = $res->next()) { - $html .= "• $nom"; + $html .= "• $nom"; } return $html; } diff --git a/modules/xnetgrp.php b/modules/xnetgrp.php new file mode 100644 index 0000000..b6d7968 --- /dev/null +++ b/modules/xnetgrp.php @@ -0,0 +1,49 @@ + $this->make_hook('index', AUTH_PUBLIC), + ); + } + + function handler_index(&$page) + { + global $globals; + + if (!$globals->asso('id')) { + return PL_NOT_FOUND; + } + + $page->changeTpl('xnet/groupe/asso.tpl'); + $page->useMenu(); + $page->setType($globals->asso('cat')); + $page->assign('is_member', is_member()); + $page->assign('logged', logged()); + + $page->assign('asso', $globals->asso()); + } +} + +?> diff --git a/plugins/function.rel.php b/plugins/function.rel.php index c43eb9e..b2bccc8 100644 --- a/plugins/function.rel.php +++ b/plugins/function.rel.php @@ -23,7 +23,8 @@ function smarty_function_rel() { static $rel; if (empty($rel)) { - global $globals; + global $globals, $platal; + $url = parse_url($globals->baseurl); return ($rel = $url['path']); } diff --git a/templates/xnet/groupe/asso.tpl b/templates/xnet/groupe/asso.tpl index 6605416..2762497 100644 --- a/templates/xnet/groupe/asso.tpl +++ b/templates/xnet/groupe/asso.tpl @@ -21,9 +21,9 @@ {**************************************************************************} {if $asso.site} -LOGO +LOGO {else} -LOGO +LOGO {/if}

{$asso.nom} : Accueil

@@ -59,7 +59,7 @@ Forum: - par le web + par le web ou par nntp @@ -71,7 +71,7 @@ M'inscrire : - m'inscrire + m'inscrire {/if} diff --git a/templates/xnet/groupe/inscrire.tpl b/templates/xnet/groupe/inscrire.tpl index 6b1c540..45a31af 100644 --- a/templates/xnet/groupe/inscrire.tpl +++ b/templates/xnet/groupe/inscrire.tpl @@ -44,7 +44,7 @@

Ta demande d'inscription a bien été envoyée ! Tu seras averti par email de la suite qui lui sera donnée.

-

[Retour à la page d'accueil de {$asso.nom}]

+

[Retour à la page d'accueil de {$asso.nom}]

{else} diff --git a/templates/xnet/groupes.tpl b/templates/xnet/groupes.tpl index a158168..e45f450 100644 --- a/templates/xnet/groupes.tpl +++ b/templates/xnet/groupes.tpl @@ -50,7 +50,7 @@ {iterate from=$gps item=g} - +
{$g.nom}
{$g.nom}
{/iterate} diff --git a/templates/xnet/manuel-public.tpl b/templates/xnet/manuel-public.tpl index c5e815c..b597d38 100644 --- a/templates/xnet/manuel-public.tpl +++ b/templates/xnet/manuel-public.tpl @@ -84,7 +84,7 @@ Professionnels) qui permettent un rep Après avoir sélectionné l'association polytechnicienne de ton choix, tu arrives sur la page qui lui est dédiée. - L'exemple d'X-Israël L'exemple d'X-Israël diff --git a/templates/xnet/plan.tpl b/templates/xnet/plan.tpl index d12b294..30c9522 100644 --- a/templates/xnet/plan.tpl +++ b/templates/xnet/plan.tpl @@ -32,7 +32,7 @@ {foreach from=$groupesx key=id item=dom} {$dom[0].domnom} {foreach from=$dom item=g} - {$g.nom} + {$g.nom} {/foreach} {/foreach} @@ -50,7 +50,7 @@ {foreach from=$binets key=id item=dom} {$dom[0].domnom} {foreach from=$dom item=g} - {$g.nom} + {$g.nom} {/foreach} {/foreach} @@ -66,7 +66,7 @@ {iterate from=$promos item=g} - {$g.nom} + {$g.nom} {/iterate} @@ -81,7 +81,7 @@ {iterate from=$inst item=g} - {$g.nom} + {$g.nom} {/iterate}