huge piece of code to abstract the notion of Trombino ...
authorx2000habouzit <x2000habouzit>
Thu, 28 Oct 2004 20:28:40 +0000 (20:28 +0000)
committerx2000habouzit <x2000habouzit>
Thu, 28 Oct 2004 20:28:40 +0000 (20:28 +0000)
Closes FS#135

The classe XOrgPlugin has been invented to provide some support for big plugins that we want everywhere (like a trombi)
and that are \$_GET driven. The class is made only to manage the $_GET args atm

Note that one restriction (current) is that for a given instance of the class, the plugin cannot been used more that once
(some prefix mechanism should been implemented, but since the need is not here, and that it complicates the code a lot ... not done atm

ChangeLog
htdocs/listes/trombi.php
htdocs/mescontacts.php
htdocs/trombipromo.php
include/trombi.inc.php [new file with mode: 0644]
include/xorg.plugin.inc.php [new file with mode: 0644]
scripts/mailman/mailman-rpc.py
templates/include/trombi.tpl [new file with mode: 0644]
templates/listes/trombi.tpl
templates/mescontacts.tpl
templates/trombipromo.tpl

index 24d82cc..2604273 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,6 +3,10 @@ VERSION 0.9.2                                                                                                          ~20 Nov 2004
 
 Changes :
 
+       * Core :
+               - Creation of the Plugin class.                                                                         -MC
+               - First instance of the plugin class : class Trombi.  (FS#135)          -MC
+
        * Lists :
                - Refusal message is shown on mail moderation page.  (FS#138)           -MC
 
@@ -11,6 +15,9 @@ Changes :
                - Women now have a &bull; (no more dirty gender icons).  (FS#122)       -MC
                - Nicer icons.                                                                                                          -MC
 
+       * Contacts :
+               - Trombino of the contacts is available !  (FS#138)                                     -MC
+
 
 Fixes (from 0.9.1 branch) :
        * Lists :
index d69dc43..64440a4 100644 (file)
  *  Foundation, Inc.,                                                      *
  *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
  ***************************************************************************
-        $Id: trombi.php,v 1.7 2004-10-15 09:47:32 x2000habouzit Exp $
+        $Id: trombi.php,v 1.8 2004-10-28 20:28:41 x2000habouzit Exp $
  ***************************************************************************/
 
 if(empty($_REQUEST['liste'])) header('Location: index.php');
 $liste = $_REQUEST['liste'];
-$npage = isset($_REQUEST['npage']) ? $_REQUEST['npage'] : 1;
 
 require("auto.prepend.inc.php");
 new_skinned_page('listes/trombi.tpl', AUTH_COOKIE, true);
 include('xml-rpc-client.inc.php');
+require("trombi.inc.php");
 
 $res = $globals->db->query("SELECT password FROM auth_user_md5 WHERE user_id={$_SESSION['uid']}");
 list($pass) = mysql_fetch_row($res);
 mysql_free_result($res);
 
 $client = new xmlrpc_client("http://{$_SESSION['uid']}:$pass@localhost:4949");
-$members = $client->get_members_limit('polytechnique.org',$liste,$npage,30);
 
-if(is_array($members)) {
+function getList($offset,$limit) {
+    global $client, $globals;
+    $liste = $_REQUEST['liste'];
+    list($total,$members) = $client->get_members_limit('polytechnique.org',$liste,$offset,$limit);
+
     $membres = Array();
-    foreach($members[1] as $member) {
+    foreach($members as $member) {
         list($m) = split('@',$member[1]);
-        $res = $globals->db->query("SELECT  IF(epouse='', CONCAT(prenom, ' ', nom), CONCAT(prenom, ' ', epouse)), promo
+        $res = $globals->db->query("SELECT  prenom,IF(epouse='', nom, epouse) AS nom, promo, a.alias AS forlife
                                       FROM  auth_user_md5 AS u
                                 INNER JOIN  aliases AS a ON u.user_id = a.id
                                      WHERE  a.alias = '$m'");
-        if(list($nom, $promo) = mysql_fetch_row($res)) {
-            $membres[$promo][] = Array('n' => $nom, 'l' => $m);
+        if($tmp = mysql_fetch_assoc($res)) {
+            $membres[$tmp['nom']] = $tmp;
         } else {
-            $membres[0][] = Array('l' => $member[0]);
+            $membres[$member[0]] = Array('addr' => $member[0]);
         }
         mysql_free_result($res);
     }
-    ksort($membres);
+    return Array($total,$membres);
+}
+
+$owners = $client->get_owners('polytechnique.org',$liste);
 
+if(is_array($owners)) {
     $moderos = Array();
-    foreach($members[2] as $owner) {
+    foreach($owners[1] as $owner) {
        list($m) = split('@',$owner);
        $res = $globals->db->query("SELECT  IF(epouse='', CONCAT(prenom, ' ', nom), CONCAT(prenom, ' ', epouse)), promo
                                      FROM  auth_user_md5 AS u
@@ -69,19 +76,11 @@ if(is_array($members)) {
     }
     ksort($moderos);
 
-    $page->assign_by_ref('details', $members[0]);
-    $page->assign_by_ref('members', $membres);
+    $page->assign_by_ref('details', $owners[0]);
     $page->assign_by_ref('owners',  $moderos);
-    $links = Array();
-    if($npage>1)
-       $links[] = Array('i'=>$npage - 1, 'text' => 'Précédent');
-    for($i=1; $i<=$members[3]; $i++)
-       $links[] = Array('i'=>$i, 'text' => $i);
-    if($npage<$members[3])
-       $links[] = Array('i'=>$npage + 1, 'text' => 'Suivant');
-    $page->assign('links', $links);
-    $page->assign('npage', $npage);
-
+    
+    $trombi = new Trombi('getList');
+    $page->assign_by_ref('trombi',$trombi);
 } else
     $page->assign('no_list',true);
 
index 8e0fa88..cba0fb8 100644 (file)
  *  Foundation, Inc.,                                                      *
  *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
  ***************************************************************************
-        $Id: mescontacts.php,v 1.18 2004-10-28 12:20:59 x2000habouzit Exp $
+        $Id: mescontacts.php,v 1.19 2004-10-28 20:28:41 x2000habouzit Exp $
  ***************************************************************************/
 
 require("auto.prepend.inc.php");
 new_skinned_page("mescontacts.tpl",AUTH_COOKIE,true);
 require("applis.func.inc.php");
 
+
+if(isset($_GET['trombi'])) {
+    require_once('trombi.inc.php');
+    function getList($offset,$limit) {
+       global $globals;
+       $res = $globals->db->query("SELECT COUNT(*) FROM contacts WHERE uid = {$_SESSION['uid']}");
+       list($total) = mysql_fetch_row($res);
+       mysql_free_result($res);
+
+       $res = $globals->db->query("
+               SELECT  u.prenom, IF(u.epouse='',u.nom,u.epouse) AS nom, a.alias AS forlife, u.promo
+                 FROM  contacts       AS c
+           INNER JOIN  auth_user_md5  AS u   ON (u.user_id = c.contact)
+           INNER JOIN  aliases        AS a   ON (u.user_id = a.id AND a.type='a_vie')
+                WHERE  c.uid = {$_SESSION['uid']}
+             ORDER BY  nom
+                LIMIT  ".$offset*$limit.",$limit");
+       $list = Array();
+       while($tmp = mysql_fetch_assoc($res)) $list[] = $tmp;
+       mysql_free_result($res);
+
+       return Array($total, $list);
+    }
+    
+    $trombi = new Trombi('getList');
+    $trombi->setNbRows(4);
+    $page->assign_by_ref('trombi',$trombi);
+    $page->run();
+}
+
 // si l'utilisateur demande le retrait de qqun de sa liste
 if (isset($_REQUEST['action'])) {
     if($_REQUEST['action']=='retirer') {
index 8839341..59bbce4 100644 (file)
  *  Foundation, Inc.,                                                      *
  *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
  ***************************************************************************
-        $Id: trombipromo.php,v 1.6 2004-10-08 19:38:37 x2000habouzit Exp $
+        $Id: trombipromo.php,v 1.7 2004-10-28 20:28:41 x2000habouzit Exp $
  ***************************************************************************/
 
 require("auto.prepend.inc.php");
 new_skinned_page('trombipromo.tpl', AUTH_COOKIE, true);
+require("trombi.inc.php");
 
-$limit = 30;
+function getList($offset,$limit) {
+    global $globals;
 
-$page->assign('limit', $limit);
+    $xpromo = intval($_REQUEST['xpromo']);
+    $where = ( $xpromo>0 ? "WHERE promo='$xpromo'" : "" );
 
-if(!isset($_REQUEST['xpromo'])) $page->run();
+    $res = $globals->db->query("SELECT  COUNT(*)
+                                 FROM  auth_user_md5 AS u
+                           RIGHT JOIN  photo         AS p ON u.user_id=p.uid
+                           $where");
+    list($pnb) = mysql_fetch_row($res);
+    mysql_free_result($res);
 
-$xpromo = intval($_REQUEST['xpromo']);
+    $sql = "SELECT  promo,user_id,a.alias AS forlife,nom,prenom
+             FROM  photo         AS p
+       INNER JOIN  auth_user_md5 AS u ON u.user_id=p.uid
+       INNER JOIN  aliases       AS a ON ( u.user_id=a.id AND a.type='a_vie' )
+           $where
+         ORDER BY  promo,nom,prenom LIMIT ".($offset*$limit).",$limit";
 
-if ( $xpromo<1900 || $xpromo>date('Y') || ($xpromo == -1 && $_SESSION['perms']!="admin") ) {
-    $page->assign('erreur', "Promotion incorrecte (saisir au format YYYY). Recommence.");
-}
-
-$offset = (empty($_REQUEST['offset']) ? 0 : $_REQUEST['offset']);
-
-$where = ( $xpromo>0 ? "WHERE promo='$xpromo'" : "" );
+    $res = $globals->db->query($sql);
+    $list = Array();
+    while($tmp = mysql_fetch_assoc($res)) $list[] = $tmp;
+    mysql_free_result($res);
 
-$res = $globals->db->query("SELECT  COUNT(*)
-                              FROM  auth_user_md5 AS u
-                        RIGHT JOIN  photo         AS p ON u.user_id=p.uid
-                        $where");
-list($pnb) = mysql_fetch_row($res);
-$page->assign('pnb', $pnb);
+    return Array($pnb, $list);
+}
 
-$sql = "SELECT  promo,user_id,a.alias AS forlife,nom,prenom
-          FROM  photo         AS p
-    INNER JOIN  auth_user_md5 AS u ON u.user_id=p.uid
-    INNER JOIN  aliases       AS a ON ( u.user_id=a.id AND a.type='a_vie' )
-        $where
-      ORDER BY  promo,nom,prenom LIMIT $offset,$limit";
+if(isset($_REQUEST['xpromo'])) {
+    $xpromo = intval($_REQUEST['xpromo']);
 
-$links = Array();
-if($offset>0) { $links[] = Array($offset-$limit, 'précédent'); }
-for($i = 0; $i < $pnb / $limit ; $i++) $links[] = Array($i*$limit, $i+1);
-if($offset+$limit < $pnb) { $links[] = Array ($offset+$limit, 'suivant'); }
-$page->assign('links',$links);
+    if ( $xpromo<1900 || $xpromo>date('Y') || ($xpromo == -1 && $_SESSION['perms']!="admin") ) {
+       $page->assign('erreur', "Promotion incorrecte (saisir au format YYYY). Recommence.");
+    } else {
+       $trombi = new Trombi('getList');
+       $trombi->setAdmin();
+       $page->assign_by_ref('trombi',$trombi);
+    }
+}
 
-$page->mysql_assign($sql,'photos');
 $page->run();
 
 ?>
diff --git a/include/trombi.inc.php b/include/trombi.inc.php
new file mode 100644 (file)
index 0000000..98f4ace
--- /dev/null
@@ -0,0 +1,59 @@
+<?php
+/***************************************************************************
+ *  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                *
+ ***************************************************************************
+ $Id: trombi.inc.php,v 1.1 2004-10-28 20:28:41 x2000habouzit Exp $
+ ***************************************************************************/
+
+require_once('xorg.plugin.inc.php');
+class Trombi extends XOrgPlugin {
+    var $_get_vars = Array('offset');
+    var $limit = 24;
+    var $admin = false;
+
+    function setNbRows($row) { $this->limit = $row*3; }
+    function setAdmin() { $this->admin = true; }
+    
+    function show() {
+       global $page;
+
+       $offset = empty($_GET['offset']) ? 0 : intval($_GET['offset']);
+       list($total, $list) = call_user_func($this->_callback, $offset, $this->limit);
+       $page_max = intval(($total-1)/$this->limit);
+
+       $links = Array();
+       if($offset) {
+           $links[] = Array('u'=> $this->make_url($offset-1), 'i' => $offset-1,  'text' => 'précédent');
+       }
+       for($i = 0; $i <= $page_max ; $i++)
+           $links[] = Array('u'=>$this->make_url($i), 'i' => $i, 'text' => $i+1);
+
+       if($offset < $page_max) {
+           $links[] = Array ('u' => $this->make_url($offset+1), 'i' => $offset+1, 'text' => 'suivant');
+       }
+
+       $page->assign_by_ref('trombi_list', $list);
+       $page->assign_by_ref('trombi_links', $links);
+       $page->assign('trombi_admin', $this->admin);
+       return $page->fetch('include/trombi.tpl');
+    }
+}
+
+?>
diff --git a/include/xorg.plugin.inc.php b/include/xorg.plugin.inc.php
new file mode 100644 (file)
index 0000000..5185fd6
--- /dev/null
@@ -0,0 +1,62 @@
+<?php
+/***************************************************************************
+ *  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                *
+ ***************************************************************************
+ $Id: xorg.plugin.inc.php,v 1.1 2004-10-28 20:28:42 x2000habouzit Exp $
+ ***************************************************************************/
+
+class XOrgPlugin {
+    var $_get_vars = Array();
+    var $_callback;
+    
+    function XOrgPlugin($funcname) {
+       $this->_callback = $funcname;
+    }
+
+    function make_url($params) {
+       $get = Array();
+       $args = empty($params) ? Array() : $params;
+
+       if(!is_array($args)) {
+           if(count($this->_get_vars)!=1) {
+               return "<p class='erreur'>params should be an array</p>";
+           } else {
+               $args = Array($this->_get_vars[0]=>$params);
+           }
+       }
+
+       foreach($_GET as $key=>$val) {
+           if(in_array($key,$this->_get_vars) && array_key_exists($key,$args)) continue;
+           $get[] = urlencode($key) . '=' . urlencode($val);
+       }
+
+       foreach($this->_get_vars as $key) {
+           if(array_key_exists($key,$args)) {
+               if($args[$key]) $get[] = urlencode($key) . '=' . urlencode($args[$key]);
+           } elseif(isset($_GET['key'])) {
+               $get[] = urlencode($key) . '=' . urlencode($_GET[$key]);
+               
+           }
+       }
+
+       return $_SERVER['PHP_SELF'] . '?' . join('&amp;',$get);
+    }
+}
+
+?>
index ae6a06a..0cc625e 100755 (executable)
@@ -18,7 +18,7 @@
 #*  Foundation, Inc.,                                                      *
 #*  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
 #***************************************************************************
-#   $Id: mailman-rpc.py,v 1.66 2004-10-27 09:54:29 x2000habouzit Exp $
+#   $Id: mailman-rpc.py,v 1.67 2004-10-28 20:28:42 x2000habouzit Exp $
 #***************************************************************************
 
 import base64, MySQLdb, os, getopt, sys, MySQLdb.converters, sha, signal
@@ -295,11 +295,18 @@ def get_members((userdesc,perms),vhost,listname):
 
 def get_members_limit((userdesc,perms),vhost,listname,page,nb_per_page):
     try:
+        members = get_members((userdesc,perms),vhost,listname)[1]
+    except:
+        return 0
+    i = int(page) * int(nb_per_page)
+    return (len(members), members[i:i+int(nb_per_page)])
+
+def get_owners((userdesc,perms),vhost,listname):
+    try:
         details,members,owners = get_members((userdesc,perms),vhost,listname)
     except:
         return 0
-    i = (int(page)-1) * int(nb_per_page)
-    return (details,members[i:i+int(nb_per_page)],owners,(len(members)-1)/int(nb_per_page)+1)
+    return (details,owners)
 
 #-------------------------------------------------------------------------------
 # owners procedures [ admin.php ]
@@ -793,6 +800,7 @@ server.register_function(unsubscribe)
 server.register_function(get_members)
 # trombi.php
 server.register_function(get_members_limit)
+server.register_function(get_owners)
 # admin.php
 server.register_function(mass_subscribe)
 server.register_function(mass_unsubscribe)
diff --git a/templates/include/trombi.tpl b/templates/include/trombi.tpl
new file mode 100644 (file)
index 0000000..74e9cfc
--- /dev/null
@@ -0,0 +1,65 @@
+{***************************************************************************
+ *  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                *
+ ***************************************************************************
+        $Id: trombi.tpl,v 1.1 2004-10-28 20:28:43 x2000habouzit Exp $
+ ***************************************************************************}
+
+{dynamic}
+<table cellpadding="8" cellspacing="2" style="width:100%;">
+  {foreach from=$trombi_list item=p}
+  {cycle values="1,2,3" assign="loop"}
+  {if $loop eq "1"}
+  <tr>
+  {/if}
+    <td class="center">
+      <img src="{"getphoto.php"|url}?x={$p.forlife}" width="110" alt=" [ PHOTO ] " />
+      <br />
+      <a href="javascript:x()" onclick="popWin('{"fiche.php"|url}?user={$p.forlife}')">
+        {$p.prenom} {$p.nom} ({$p.promo})
+      </a>
+      {if $trombi_admin && $smarty.session.perms eq 'admin'}<br />
+      <a href="{"admin/admin_trombino.php"|url}?uid={$p.user_id}">[admin]</a>
+      {/if}
+    </td>
+  {if $loop eq "3"}
+  </tr>
+  {/if}
+  {/foreach}
+  {if $loop eq "1"}
+  <td></td><td></td></tr>
+  {elseif $loop eq "2"}
+  <td></td></tr>
+  {/if}
+  <tr>
+    <td colspan='3' class='center'>
+      {foreach from=$trombi_links item=l}
+      {if $l.i eq $smarty.request.offset}
+      <span class="erreur">{$l.text}</span>
+      {else}
+      <a href="{$l.u}">{$l.text}</a>
+      {/if}
+      {/foreach}
+    </td>
+  </tr>
+</table>
+
+{/dynamic}
+
+{* vim:set et sw=2 sts=2 sws=2: *}
index 315349a..b23fdfa 100644 (file)
@@ -17,7 +17,7 @@
  *  Foundation, Inc.,                                                      *
  *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
  ***************************************************************************
-        $Id: trombi.tpl,v 1.9 2004-10-24 14:41:13 x2000habouzit Exp $
+        $Id: trombi.tpl,v 1.10 2004-10-28 20:28:43 x2000habouzit Exp $
  ***************************************************************************}
 
 {dynamic}
   membres de la liste
 </h1>
 
-<table cellpadding="8" cellspacing="2" style="width:100%;">
-  {foreach from=$members item=xs key=promo}
-    {foreach from=$xs item=x}
-      {if $promo}
-      {cycle values="1,2,3" assign="loop"}
-      {if $loop eq "1"}<tr>{/if}
-        <td class='center'>
-          <img src="{"getphoto.php"|url}?x={$x.l}" width="110" alt=" [ PHOTO ] " />
-          <br />
-          <a href="javascript:x()" onclick="popWin('{"fiche.php"|url}?user={$x.l}')">
-            {$x.n} ({$promo})
-          </a>
-        </td>
-      {if $loop eq "3"}</tr>{/if}
-      {/if}
-    {/foreach}
-  {/foreach}
-  {if $loop eq "1"}<td></td><td></td></tr>{elseif $loop eq "2"}<td></td></tr>{/if}
-  <tr>
-    <td colspan='3' class='center'>
-      {foreach from=$links item=l}
-      {if $l.i eq $npage}
-      <span class='erreur'>{$l.text}</span>
-      {else}
-      <a href='?liste={$smarty.request.liste}&amp;npage={$l.i}'>{$l.text}</a>
-      {/if}
-      {/foreach}
-    </td>
-  </tr>
-</table>
+{$trombi->show()|smarty:nodefaults}
 
 {/if}
 
index 2acb356..79be830 100644 (file)
  *  Foundation, Inc.,                                                      *
  *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
  ***************************************************************************
-        $Id: mescontacts.tpl,v 1.10 2004-10-24 14:41:11 x2000habouzit Exp $
+        $Id: mescontacts.tpl,v 1.11 2004-10-28 20:28:42 x2000habouzit Exp $
  ***************************************************************************}
 
 
 {dynamic}
 <p class="erreur">{$erreur}</p>
-{/dynamic}
+
+{if $trombi}
+
+<h1>
+  Mon trombino de contacts
+</h1>
+
+<p>
+[<a href="{$smarty.server.PHP_SELF}">vue classique</a>]
+</p>
+
+{$trombi->show()|smarty:nodefaults}
+
+{else}
 
 <h1>
   Ma liste personnelle de contacts
@@ -40,9 +53,8 @@
 <p>
   Tu peux également rajouter des camarades dans tes contacts lors d'une recherche dans l'annuaire : 
   il te suffit de cliquer sur l'icône <img src="images/ajouter.gif" alt="ajout contact" /> en face de son nom dans les résultats !
-</p>
+</p>  
 
-{dynamic}
 {if $nb_contacts}
 <p>
   Pour récupérer ta liste de contacts dans un PDF imprimable :<br />
   [<a href="mescontacts_pdf.php/mes_contacts.pdf" onclick="return popup(this)"><strong>Triée par noms</strong></a>]
 </p>
 
+<p>
+Pour afficher le trombi de tes contacts : [<a href="?trombi=1"><strong>vue sous forme de trombi</strong></a>]
+</p>
+
 <br />
 
 <div class="contact-list">
@@ -61,6 +77,9 @@
 {else}
 <p>Actuellement ta liste de contacts est vide...</p>
 {/if}
+
+
+{/if}
 {/dynamic}
 
 {* vim:set et sw=2 sts=2 sws=2: *}
index 1e7d32e..c3a6001 100644 (file)
@@ -17,7 +17,7 @@
  *  Foundation, Inc.,                                                      *
  *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
  ***************************************************************************
-        $Id: trombipromo.tpl,v 1.7 2004-10-24 14:41:11 x2000habouzit Exp $
+        $Id: trombipromo.tpl,v 1.8 2004-10-28 20:28:42 x2000habouzit Exp $
  ***************************************************************************}
 
 
@@ -69,54 +69,7 @@ chaque page affiche au plus {$limit} photos.
   {/if}
 </h1>
 
-{if $pnb}
-<p>
-{$pnb} polytechnicien{if $pnb gt 1}s de la promotion {$smarty.request.xpromo} ont
-{else} de la promotion {$smarty.request.xpromo} a {/if} une photo dans l'album photo :
-</p>
-
-<table cellpadding="8" cellspacing="2" style="width:100%;">
-  {foreach from=$photos item=p}
-  {cycle values="1,2,3" assign="loop"}
-  {if $loop eq "1"}
-  <tr>
-  {/if}
-    <td class="center">
-      <a href="javascript:x()" onclick="popWin('fiche.php?user={$p.forlife}')">
-        <img src="getphoto.php?x={$p.user_id}" width="110" alt=" [ PHOTO ] " />
-      </a>
-      {mailto address="`$p.forlife`@polytechnique.org" text="`$p.prenom`&nbsp;`$p.nom`"}
-      {if $smarty.request.xpromo eq 'all'}{$p.promo}{/if}
-      {if $smarty.session.perms eq 'admin'}<br /><a href="admin/admin_trombino.php?uid={$p.user_id}">[admin]</a>{/if}
-    </td>
-  {if $loop eq "3"}
-  </tr>
-  {/if}
-  {/foreach}
-  {if $loop eq "1"}
-  <td></td><td></td></tr>
-  {elseif $loop eq "2"}
-  <td></td></tr>
-  {/if}
-</table>
-
-{foreach from=$links item=l}
-{if $l[0] eq $smarty.request.offset}
-<span class="erreur">
-  <a href="{$smarty.server.PHP_SELF}?xpromo={$smarty.request.xpromo}&amp;offset={$l[0]}">{$l[1]}</a>
-</span>
-{else}
-<a href="{$smarty.server.PHP_SELF}?xpromo={$smarty.request.xpromo}&amp;offset={$l[0]}">{$l[1]}</a>
-{/if}
-{/foreach}
-
-{else}
-
-<div>
-  Il n'y a aucune photo de camarade de cette promotion sur nos serveurs.
-</div>
-
-{/if}
+{$trombi->show()|smarty:nodefaults}
 
 {/if}