From: x2000habouzit Date: Fri, 10 Sep 2004 23:13:03 +0000 (+0000) Subject: improvements on list's page X-Git-Tag: xorg/old~1534 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=c71f8bc726e95ca1e60ba0943ec3eff2f76bb3b1;p=platal.git improvements on list's page trombi done. I'm quite happy with the results try : http://dev.m4x.org/listes/trombi.php?liste=test JM: I love your fiche.php work. it still needs some css tweaks, but the general impress is wonderful --- diff --git a/htdocs/getphoto.php b/htdocs/getphoto.php index 8ebe760..3252343 100644 --- a/htdocs/getphoto.php +++ b/htdocs/getphoto.php @@ -18,7 +18,7 @@ * Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * *************************************************************************** - $Id: getphoto.php,v 1.5 2004-08-31 10:03:28 x2000habouzit Exp $ + $Id: getphoto.php,v 1.6 2004-09-10 23:13:03 x2000habouzit Exp $ ***************************************************************************/ @@ -50,7 +50,15 @@ if(isset($_REQUEST['x'])) { Header("Content-type: image/".$myphoto->mimetype); echo $myphoto->data; } else { - $result = $globals->db->query("SELECT attachmime, attach FROM photo WHERE uid = '{$_REQUEST['x']}'"); + if(preg_match('/^\d*$/',$_REQUEST['x'])) { + $result = $globals->db->query("SELECT attachmime, attach FROM photo WHERE uid = '{$_REQUEST['x']}'"); + } else { + $sql = "SELECT attachmime, attach + FROM photo AS p + INNER JOIN aliases AS a ON p.uid=a.id + WHERE alias='{$_REQUEST['x']}'"; + $result = $globals->db->query($sql); + } if( list($type,$data) = @mysql_fetch_row($result) ) { Header( "Content-type: image/$type"); diff --git a/htdocs/listes/trombi.php b/htdocs/listes/trombi.php new file mode 100644 index 0000000..fc886b7 --- /dev/null +++ b/htdocs/listes/trombi.php @@ -0,0 +1,73 @@ +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($liste); + +if(is_array($members)) { + $membres = Array(); + foreach($members[1] as $member) { + if(preg_match('/^([^.]*.[^.]*.(\d\d\d\d))@polytechnique.org$/', $member[1], $matches)) { + $membres[$matches[2]][] = Array('n' => $member[0], 'l' => $matches[1]); + } else { + $membres[0][] = Array('l' => $member[1]); + } + } + ksort($membres); + + $moderos = Array(); + foreach($members[2] as $owner) { + list($m) = split('@',$owner); + $res = $globals->db->query("SELECT CONCAT(prenom, ' ', nom), promo + 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)) { + $moderos[$promo][] = Array('n' => $nom, 'l' => $m); + } else { + $moderos[0][] = Array('l' => $owner); + } + mysql_free_result($res); + } + ksort($moderos); + + $page->assign_by_ref('details', $members[0]); + $page->assign_by_ref('members', $membres); + $page->assign_by_ref('owners', $moderos); + +} else + $page->assign('no_list',true); + +$page->run(); +?> diff --git a/templates/listes/liste.tpl b/templates/listes/liste.tpl index ba9fcd0..a60de61 100644 --- a/templates/listes/liste.tpl +++ b/templates/listes/liste.tpl @@ -17,7 +17,7 @@ * Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * *************************************************************************** - $Id: liste.tpl,v 1.4 2004-09-10 22:47:19 x2000habouzit Exp $ + $Id: liste.tpl,v 1.5 2004-09-10 23:13:04 x2000habouzit Exp $ ***************************************************************************} {dynamic} @@ -55,7 +55,7 @@ - trombino de la liste + trombino de la liste (page longue à charger) diff --git a/templates/listes/trombi.tpl b/templates/listes/trombi.tpl new file mode 100644 index 0000000..69dfc92 --- /dev/null +++ b/templates/listes/trombi.tpl @@ -0,0 +1,122 @@ +{*************************************************************************** + * 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-09-10 23:13:04 x2000habouzit Exp $ + ***************************************************************************} + +{dynamic} + +{if $no_list} + +

La liste n'existe pas ou tu n'as pas le droit d'en voir les détails

+ +{else} + +
+ Liste {$smarty.request.liste} +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
Adresse {mailto address=$details.addr}
Sujet {$details.desc}
Visibilité {if $details.priv eq 0}publique{elseif $details.priv eq 1}privée{else}admin{/if}
Diffusion {if $details.diff}modérée{else}libre{/if}
Inscription {if $details.ins}modérée{else}libre{/if}
+ Page de la liste +
+ +
+ modérateurs de la liste +
+ + + {foreach from=$owners item=xs key=promo} + {foreach from=$xs item=x} + {if $promo} + {cycle values="1,2,3" assign="loop"} + {if $loop eq "1"}{/if} + + {if $loop eq "3"}{/if} + {/if} + {/foreach} + {/foreach} + {if $loop eq "1"} + {cycle values="1,2,3" assign="loop"} + {cycle values="1,2,3" assign="loop"} + + {elseif $loop eq "2"} + {cycle values="1,2,3" assign="loop"} + + {/if} +
+  [ PHOTO ] +
+ + {$x.n} ({$promo}) + +
+ +
+ membres de la liste +
+ + + {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"}{/if} + + {if $loop eq "3"}{/if} + {/if} + {/foreach} + {/foreach} + {if $loop eq "1"}{elseif $loop eq "2"}{/if} +
+  [ PHOTO ] +
+ + {$x.n} ({$promo}) + +
+ +{/if} + +{/dynamic} + +{* vim:set et sw=2 sts=2 sws=2: *}