better navigation
authorPierre Habouzit (MadCoder <pierre.habouzit@m4x.org>
Mon, 25 Apr 2005 15:17:51 +0000 (15:17 +0000)
committerFlorent Bruneau <florent.bruneau@polytechnique.org>
Thu, 26 Jun 2008 21:28:44 +0000 (23:28 +0200)
git-archimport-id: opensource@polytechnique.org--2005/platal--mainline--0.9--patch-589

htdocs.net/css/xnet.css
htdocs.net/groupes.php
include/xnet/page.inc.php
include/xnet/smarty.plugins.inc.php
templates/xnet/groupe/asso.tpl
templates/xnet/groupes.tpl
templates/xnet/include/descr.tpl
templates/xnet/skin.tpl

index 59a4fa2..7abac4b 100644 (file)
@@ -130,6 +130,12 @@ td#menu {
  * CLASSES
  ***************************************************************************/
 
+div.breadcrumb {
+    font-weight: bold;
+    font-size: 90%;
+    padding: 0.5em 0em;
+}
+
 .erreur { color: red; }
 .error  { color: red; }
 .center { text-align: center; }
index e2f73c4..ab2aeff 100644 (file)
@@ -8,11 +8,11 @@
 
     new_page('xnet/groupes.tpl', AUTH_PUBLIC);
 
-    $res = $globals->xdb->iterator("SELECT id,nom FROM groupex.dom WHERE FIND_IN_SET({?}, cat) ORDER BY nom", $cat);
-    $page->assign('doms', $res);
-    $page->assign('hasdom', $res->total()!=0);
+    $res  = $globals->xdb->query("SELECT id,nom FROM groupex.dom WHERE FIND_IN_SET({?}, cat) ORDER BY nom", $cat);
+    $doms = $res->fetchAllAssoc();
+    $page->assign('doms', $doms);
     
-    if (!$res->total()) {
+    if (empty($doms)) {
         $res = $globals->xdb->iterator("SELECT diminutif, nom FROM groupex.asso WHERE FIND_IN_SET({?}, cat) ORDER BY nom", $cat);
     } elseif (Get::has('dom')) {
         $res = $globals->xdb->iterator("SELECT diminutif, nom FROM groupex.asso WHERE FIND_IN_SET({?}, cat) AND dom={?} ORDER BY nom", $cat, Get::getInt('dom'));
index f821395..6d83970 100644 (file)
@@ -79,14 +79,6 @@ class XnetPage extends PlatalPage
             $sub['telepaiement'] = "$dim/telepaiement.php";
 
             $menu[$globals->asso('nom')] = $sub;
-        } else {
-            $sub = array();
-            $sub['Groupes X']    = "groupes.php?cat=groupesx";
-            $sub['Binets']       = "groupes.php?cat=binets";
-            $sub['Promotions']   = "groupes.php?cat=promotions";
-            $sub['Institutions'] = "groupes.php?cat=institutions";
-
-            $menu['Navigation']  = $sub;
         }
 
         if (logged() && may_update()) {
@@ -108,6 +100,7 @@ class XnetPage extends PlatalPage
     function doAuth()
     {
         $this->register_function('list_all_my_groups', 'list_all_my_groups');
+        $this->register_modifier('cat_pp', 'cat_pp');
         $this->assign('it_is_xnet', true);
         if (!logged() && Get::has('auth')) {
             $_SESSION['session']->doAuthX($this);
index cd55390..a035207 100644 (file)
@@ -42,6 +42,21 @@ function list_all_my_groups($params)
 }
 
 // }}}
+// {{{ cat_pp
+
+function cat_pp($cat)
+{
+    $trans = array(
+        'groupesx' => 'Groupes X' ,
+        'binets'   => 'Binets' ,
+        'institutions' => 'Institutions' ,
+        'promotions' => 'Promotions'
+    );
+
+    return $trans[strtolower($cat)];
+}
+
+// }}}
 
 // vim:set et sw=4 sts=4 sws=4 foldmethod=marker:
 ?>
index 3c7866f..802bf92 100644 (file)
 
 <h1>{$asso.nom} : Accueil</h1>
 
-<table id="content" cellpadding="0" cellspacing="0">
-  <tr>
-    <td>
-      {if $asso.site}
-      <a href="{$asso.site}"><img src='getlogo.php' alt="LOGO" /></a>
-      {else}
-      <img src='getlogo.php' alt="LOGO" />
-      {/if}
+{if $asso.site}
+<a href="{$asso.site}"><img src='getlogo.php' alt="LOGO" /></a>
+{else}
+<img src='getlogo.php' alt="LOGO" />
+{/if}
 
-      {if $asso.site}
-      <p class="descr">
-      <strong>Site Web:</strong> <a href="{$asso.site}">{$asso.site}</a>
-      </p>
-      {/if}
+{if $asso.site}
+<p class="descr">
+<strong>Site Web:</strong> <a href="{$asso.site}">{$asso.site}</a>
+</p>
+{/if}
 
-      {if $asso.resp && $asso.mail}
-      <p class="descr">
-      <strong>Contact:</strong> {mailto address=$asso.mail text=$asso.resp encode=javascript}
-      </p>
-      {elseif $asso.resp}
-      <p class="descr">
-      <strong>Contact:</strong> {$asso.resp}
-      </p>
-      {/if}
+{if $asso.resp && $asso.mail}
+<p class="descr">
+<strong>Contact:</strong> {mailto address=$asso.mail text=$asso.resp encode=javascript}
+</p>
+{elseif $asso.resp}
+<p class="descr">
+<strong>Contact:</strong> {$asso.resp}
+</p>
+{/if}
 
-      {if $asso.forum}
-      <p class="descr">
-      <strong>Forum:</strong>
-      <a href="https://www.polytechnique.org/banana/thread.php?group={$asso.forum}">par le web</a> ou
-      <a href="news://ssl.polytechnique.org/{$asso.forum}">par nntp</a>
-      </p>
-      {/if}
+{if $asso.forum}
+<p class="descr">
+<strong>Forum:</strong>
+<a href="https://www.polytechnique.org/banana/thread.php?group={$asso.forum}">par le web</a> ou
+<a href="news://ssl.polytechnique.org/{$asso.forum}">par nntp</a>
+</p>
+{/if}
 
-      <strong>TODO: INSCRIPTION</strong>
+<strong>TODO: INSCRIPTION</strong>
 
-      {if $asso.ax}
-      <p class="descr">
-      <strong>groupe agrée par l'AX</strong>
-      </p>
-      {/if}
+{if $asso.ax}
+<p class="descr">
+<strong>groupe agrée par l'AX</strong>
+</p>
+{/if}
 
-      <div>
-        {$asso.descr|smarty:nodefaults}
-      </div>
-    </td>
-    <td>
-      {iterate from=$gps item=g}
-      <div class="cat">
-        <a href="../{$g.diminutif}/asso.php">{$g.nom}</a>
-      </div>
-      {/iterate}
-    </td>
-  </tr>
-</table>
+<div>
+  {$asso.descr|smarty:nodefaults}
+</div>
 
 {* vim:set et sw=2 sts=2 sws=2: *}
index 099dbb2..707ce28 100644 (file)
 
 <table id="content" cellspacing="0" cellpadding="4">
   <tr>
-    <td{if $hasdom} colspan="2"{/if}>
+    <td colspan="2">
       {include file="xnet/include/descr.tpl" cat=$smarty.get.cat}
     </td>
   </tr>
   <tr>
-    {if $hasdom}
+    {if !$doms || !$gps}
     <td style="vertical-align: top">
-      {iterate from=$doms item=g}
+      <div class="cat {if $smarty.get.cat eq groupesx}sel{/if}"><a href="?cat=groupesx">Groupes X</a></div>
+      <div class="cat {if $smarty.get.cat eq binets}sel{/if}"><a href="?cat=binets">Binets</a></div>
+      <div class="cat {if $smarty.get.cat eq institutions}sel{/if}"><a href="?cat=institutions">Institutions</a></div>
+      <div class="cat {if $smarty.get.cat eq promotions}sel{/if}"><a href="?cat=promotions">Promotions</a></div>
+    </td>
+    {/if}
+    
+    {if $doms}
+    <td style="vertical-align: top">
+      {foreach from=$doms item=g}
       <div class="cat {if $g.id eq $smarty.get.dom}sel{/if}">
-        <a href="groupes.php?cat={$smarty.get.cat}&amp;dom={$g.id}">{$g.nom}</a>
+        <a href="?cat={$smarty.get.cat}&amp;dom={$g.id}">{$g.nom}</a>
       </div>
-      {/iterate}
+      {/foreach}
     </td>
     {/if}
+
+    {if $gps}
     <td style="text-align:right;">
-      {if $gps}
       {iterate from=$gps item=g}
       <table style="float: left;" cellspacing="2" cellpadding="0">
-        <tr><td class="oval{if $hasdom}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}/asso.php">{$g.nom}</a></td></tr>
       </table>
       {/iterate}
-      {else}
-      <img src="images/carre2.jpg" alt="logos_associations" width="201" height="165" />
-      {/if}
     </td>
+    {/if}
   </tr>
 </table>
 
index 0c241b9..0b383f9 100644 (file)
@@ -39,25 +39,31 @@ renseignements aupr
 
 {elseif $cat eq binets}
 
+<p class="descr">
 Les binets sont les associations des élèves polytechniciens effectuant leur scolarité à l'X (sur le
 plateau). Cette appellation, qui peut sembler étrange, est, pour certains, simplement un diminutif
 de "cabinet". Pour d'autres, elle aurait pour origine un certain général Binet, commandant l'Ecole
 Polytechnique, qui aurait le premier autorisé ces regroupements d'élèves. Les binets présents à
 l'Ecole n'ont pas tous leur site web présenté ici. Vous pouvez voir tous les sites des binets en
 cliquant <a href= "http://www.polytechnique.fr/eleves/acces/binets/">ici</a>.
+</p>
 
 {elseif $cat eq institutions}
 
+<p class="descr">
 De nombreuses organismes officiels sont liés à l'Ecole Polytechnique: le collège de l'Ecole
 Polytechnique, l'amicale des anciens élèves, le site des X sur le web Polytechnique.org, etc...
 Cette liste n'est pas exhaustive. Vous pouvez découvrir chacun de ces organismes en cliquant sur les
 liens correspondants:
+</p>
 
 {elseif $cat eq promotions}
 
+<p class="descr">
 Quelques promotions de polytechniciens ont mis au point leur propre site web, qui permet aux élèves
 de ces promotions d'organiser des repas promos, de faire partager des souvenirs photographiques, de
 se retrouver sur internet... En voici des exemples:
+</p>
 
 {/if}
 
index 2fec408..d454aaa 100644 (file)
           {/only_public}
         </td>
         <td colspan="3">
+          <div class="breadcrumb">
+            {if $asso}
+            <a href="{rel}/groupes.php?cat={$asso.cat}">{$asso.cat|cat_pp}</a> »
+            {if $asso.dom}
+            <a href="{rel}/groupes.php?cat={$asso.cat}&amp;dom={$asso.dom}">{$asso.domnom}</a> »
+            {/if}
+            {$asso.nom}
+            {elseif $smarty.request.cat}
+            <a href="{rel}/groupes.php?cat={$smarty.request.cat}">{$smarty.request.cat|cat_pp}</a> »
+            {if $smarty.request.dom || !$doms}
+            Choix de l'Asso
+            {else}
+            Choix du domaine
+            {/if}
+            {/if}
+          </div>
           {include file="skin/common.content.tpl"}
         </td>
       </tr>