begin to migrate the first 'asso' page to the new system, using a namespace hack...
authorx2000habouzit <x2000habouzit@839d8a87-29fc-0310-9880-83ba4fa771e5>
Fri, 14 Jul 2006 19:49:18 +0000 (19:49 +0000)
committerx2000habouzit <x2000habouzit@839d8a87-29fc-0310-9880-83ba4fa771e5>
Fri, 14 Jul 2006 19:49:18 +0000 (19:49 +0000)
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

12 files changed:
classes/Xnet.php [new file with mode: 0644]
htdocs.net/groupe/asso.php [deleted file]
htdocs.net/index.php
include/xnet/page.inc.php
include/xnet/smarty.plugins.inc.php
modules/xnetgrp.php [new file with mode: 0644]
plugins/function.rel.php
templates/xnet/groupe/asso.tpl
templates/xnet/groupe/inscrire.tpl
templates/xnet/groupes.tpl
templates/xnet/manuel-public.tpl
templates/xnet/plan.tpl

diff --git a/classes/Xnet.php b/classes/Xnet.php
new file mode 100644 (file)
index 0000000..408ff55
--- /dev/null
@@ -0,0 +1,44 @@
+<?php
+/***************************************************************************
+ *  Copyright (C) 2003-2006 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                *
+ ***************************************************************************/
+
+require_once dirname(__FILE__).'/Platal.php';
+
+class Xnet extends Platal
+{
+    function Xnet()
+    {
+        $modules = func_get_args();
+        call_user_func_array(array(&$this, 'Platal'), $modules);
+
+        global $globals;
+        if ($globals->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 (file)
index 39be21f..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-<?php
-
-require 'xnet.inc.php';
-
-new_page('xnet/groupe/asso.tpl', AUTH_PUBLIC);
-$page->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();
-
-?>
index 83f93a2..8ee3c5d 100644 (file)
 
 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();
 
 ?>
index ba72a7f..f336167 100644 (file)
@@ -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)
index 46db21c..725b50f 100644 (file)
@@ -36,7 +36,7 @@ function list_all_my_groups($params)
               WHERE  m.uid={?}", Session::getInt('uid'));
     $html = '<div>Mes groupes :</div>';
     while (list($nom, $mini) = $res->next()) {
-        $html .= "<a class='gp' href='".smarty_function_rel()."/$mini/asso.php'>&bull; $nom</a>";
+        $html .= "<a class='gp' href='".smarty_function_rel()."/$mini'>&bull; $nom</a>";
     }
     return $html;
 }
diff --git a/modules/xnetgrp.php b/modules/xnetgrp.php
new file mode 100644 (file)
index 0000000..b6d7968
--- /dev/null
@@ -0,0 +1,49 @@
+<?php
+/***************************************************************************
+ *  Copyright (C) 2003-2006 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                *
+ ***************************************************************************/
+
+class XnetGrpModule extends PLModule
+{
+    function handlers()
+    {
+        return array(
+            'grp' => $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());
+    }
+}
+
+?>
index c43eb9e..b2bccc8 100644 (file)
@@ -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']);
     }
index 6605416..2762497 100644 (file)
@@ -21,9 +21,9 @@
 {**************************************************************************}
 
 {if $asso.site}
-<a href="{$asso.site}"><img src='getlogo.php' alt="LOGO" style="float: right;" /></a>
+<a href="{$asso.site}"><img src='{rel}/{$platal->ns}getlogo.php' alt="LOGO" style="float: right;" /></a>
 {else}
-<img src='getlogo.php' alt="LOGO" style="float: right;" />
+<img src='{rel}/{$platal->ns}getlogo.php' alt="LOGO" style="float: right;" />
 {/if}
 
 <h1>{$asso.nom} : Accueil</h1>
@@ -59,7 +59,7 @@
       Forum:
     </td>
     <td>
-      <a href="https://www.polytechnique.org/banana/?group={$asso.forum}">par le web</a>
+      <a href="https://www.polytechnique.org/banana/{$asso.forum}">par le web</a>
       ou <a href="news://ssl.polytechnique.org/{$asso.forum}">par nntp</a>
     </td>
   </tr>
@@ -71,7 +71,7 @@
       M'inscrire :
     </td>
     <td>
-      <a href="{$asso.sub_url|default:"inscrire.php"}">m'inscrire</a>
+      <a href="{rel}/{$platal->ns}inscrire.php">m'inscrire</a>
     </td>
   </tr>
   {/if}
index 6b1c540..45a31af 100644 (file)
@@ -44,7 +44,7 @@
 <p class="descr">
 <strong>Ta demande d'inscription a bien été envoyée !</strong> Tu seras averti par email de la suite qui lui sera donnée.
 <p>
-<p class="descr">[<a href="asso.php">Retour à la page d'accueil de {$asso.nom}</a>]</p>
+<p class="descr">[<a href="{rel}/{$platal->ns}">Retour à la page d'accueil de {$asso.nom}</a>]</p>
 
 {else}
 
index a158168..e45f450 100644 (file)
@@ -50,7 +50,7 @@
     <td style="text-align:right;">
       {iterate from=$gps item=g}
       <table style="float: left;" cellspacing="2" cellpadding="0">
-        <tr><td class="oval{if $doms}2{/if}"><a href="{rel}/{$g.diminutif}/asso.php">{$g.nom}</a></td></tr>
+        <tr><td class="oval{if $doms}2{/if}"><a href="{rel}/{$g.diminutif}/">{$g.nom}</a></td></tr>
       </table>
       {/iterate}
     </td>
index c5e815c..b597d38 100644 (file)
@@ -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.
-<a href="http://www.polytechnique.net/X-Israel/asso.php"> L'exemple d'X-Israël</a
+<a href="http://www.polytechnique.net/X-Israel/"> L'exemple d'X-Israël</a
 La page de chaque association comporte ainsi :
 
 <ul style='margin-top:0cm' type=disc>
index d12b294..30c9522 100644 (file)
@@ -32,7 +32,7 @@
             {foreach from=$groupesx key=id item=dom}
             <a class="cat" href="{rel}/groups/groupesx/{$id}">{$dom[0].domnom}</a>
             {foreach from=$dom item=g}
-            <a href="{$g.diminutif}/asso.php">{$g.nom}</a>
+            <a href="{rel}/{$g.diminutif}/">{$g.nom}</a>
             {/foreach}
             {/foreach}
           </td>
@@ -50,7 +50,7 @@
             {foreach from=$binets key=id item=dom}
             <a class="cat" href="sommaire.php?cat=binets&amp;dom={$id}">{$dom[0].domnom}</a>
             {foreach from=$dom item=g}
-            <a href="{$g.diminutif}/asso.php">{$g.nom}</a>
+            <a href="{rel}/{$g.diminutif}/">{$g.nom}</a>
             {/foreach}
             {/foreach}
           </td>
@@ -66,7 +66,7 @@
         <tr>
           <td class="listec">
             {iterate from=$promos item=g}
-            <a href="{$g.diminutif}/asso.php">{$g.nom}</a>
+            <a href="{rel}/{$g.diminutif}/">{$g.nom}</a>
             {/iterate}
           </td>
         </tr>
@@ -81,7 +81,7 @@
         <tr>
           <td class="listec">
             {iterate from=$inst item=g}
-            <a href="{$g.diminutif}/asso.php">{$g.nom}</a>
+            <a href="{rel}/{$g.diminutif}/">{$g.nom}</a>
             {/iterate}
           </td>
         </tr>