From af6cdd241e97a891f75dc5aa07ad72c89be5c0b6 Mon Sep 17 00:00:00 2001 From: "Pierre Habouzit (MadCoder" Date: Mon, 18 Apr 2005 12:02:55 +0000 Subject: [PATCH] begin to implement asso.php git-archimport-id: opensource@polytechnique.org--2005/platal--mainline--0.9--patch-565 --- htdocs.net/apropos.php | 1 - htdocs.net/article12.php | 1 - htdocs.net/article16.php | 1 - htdocs.net/creation-groupex.php | 1 - htdocs.net/css/xnet.css | 13 +++--- htdocs.net/groupe/asso.php | 22 ++++++++++ htdocs.net/groupe/getlogo.php | 23 ++++++++++ htdocs.net/groupes.php | 1 - htdocs.net/index.php | 1 - htdocs.net/login.php | 1 - htdocs.net/manuel.php | 1 - htdocs.net/plan.php | 1 - htdocs.net/services.php | 1 - include/xnet.inc.php | 2 +- include/xnet/globals.inc.php | 22 ++++++++++ include/xnet/page.inc.php | 2 +- templates/xnet/groupe/asso.tpl | 95 +++++++++++++++++++++++++++++++++++++++++ templates/xnet/groupes.tpl | 2 +- templates/xnet/index.tpl | 2 +- templates/xnet/skin.tpl | 4 +- 20 files changed, 176 insertions(+), 21 deletions(-) create mode 100644 htdocs.net/groupe/asso.php create mode 100644 htdocs.net/groupe/getlogo.php create mode 100644 templates/xnet/groupe/asso.tpl diff --git a/htdocs.net/apropos.php b/htdocs.net/apropos.php index c988b3e..53a426a 100644 --- a/htdocs.net/apropos.php +++ b/htdocs.net/apropos.php @@ -1,6 +1,5 @@ run(); diff --git a/htdocs.net/article12.php b/htdocs.net/article12.php index 45cc0b9..2564df5 100644 --- a/htdocs.net/article12.php +++ b/htdocs.net/article12.php @@ -1,6 +1,5 @@ run(); diff --git a/htdocs.net/article16.php b/htdocs.net/article16.php index 9f3f959..76bc42d 100644 --- a/htdocs.net/article16.php +++ b/htdocs.net/article16.php @@ -1,6 +1,5 @@ run(); diff --git a/htdocs.net/creation-groupex.php b/htdocs.net/creation-groupex.php index d14d215..7aaf99c 100644 --- a/htdocs.net/creation-groupex.php +++ b/htdocs.net/creation-groupex.php @@ -1,6 +1,5 @@ run(); diff --git a/htdocs.net/css/xnet.css b/htdocs.net/css/xnet.css index 4578767..c05920e 100644 --- a/htdocs.net/css/xnet.css +++ b/htdocs.net/css/xnet.css @@ -39,7 +39,7 @@ a, a:link, a:visited { text-decoration: none ; color: #5c81aa; } a img { border: none; } img { vertical-align: middle; } -td { vertical-align: middle; } +td { vertical-align: top; } h1 { font-size: 150%; } h2 { font-size: 135%; } @@ -71,6 +71,10 @@ table#layout { margin-right: auto; } +tr#top td { + vertical-align: middle; +} + td#credits { text-align: center; font-size: 90%; @@ -158,7 +162,6 @@ table.links a { ***************************************************************************/ table#liste td.fourth { - vertical-align: top; width: 25%; } @@ -190,12 +193,12 @@ table#liste td.liste a:hover, table#liste td.listec a:hover { div.cat { background: #d0c198; - width: 180px; - padding: 2px; - margin: 6px 0px; text-align: center; font-weight: bold; font-size: 90%; + padding: 2px; + width: 180px; + margin: 4px 0px; } div.sel { background-color: #5c81aa; color: #d0c198; } diff --git a/htdocs.net/groupe/asso.php b/htdocs.net/groupe/asso.php new file mode 100644 index 0000000..9365db8 --- /dev/null +++ b/htdocs.net/groupe/asso.php @@ -0,0 +1,22 @@ +asso('id')) { + header("Location: ../"); +} +$page->setType(strtolower($globals->asso('cat'))); +$page->assign('asso', $globals->asso()); + +// Sélection de toutes les associations ayant la même catégorie et le même domaine que l'activité sélectionnée +$gps = $globals->xdb->iterator( + "SELECT diminutif, nom + FROM groupex.asso + WHERE cat = {?} AND dom = {?} + ORDER BY nom", $globals->asso('cat'), $globals->asso('dom')); +$page->assign('gps', $gps); + +$page->run(); + +?> diff --git a/htdocs.net/groupe/getlogo.php b/htdocs.net/groupe/getlogo.php new file mode 100644 index 0000000..21f483b --- /dev/null +++ b/htdocs.net/groupe/getlogo.php @@ -0,0 +1,23 @@ +xdb->query("SELECT logo, logo_mime FROM groupex.asso WHERE id = {?}", $globals->asso('id')); +list($logo, $logo_mime) = $res->fetchOneRow(); + +if (!empty($logo)) { + header("Content-type: $mime"); + header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); + header("Last-Modified:" . gmdate("D, d M Y H:i:s") . " GMT"); + header("Cache-Control: no-cache, must-revalidate"); + header("Pragma: no-cache"); + echo $logo; +} else { + header("Content-type: image/jpeg"); + header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); + header("Last-Modified:" . gmdate("D, d M Y H:i:s") . " GMT"); + header("Cache-Control: no-cache, must-revalidate"); + header("Pragma: no-cache"); + readfile("../images/dflt_carre.jpg"); +} + +?> diff --git a/htdocs.net/groupes.php b/htdocs.net/groupes.php index 7547471..d77e5ef 100644 --- a/htdocs.net/groupes.php +++ b/htdocs.net/groupes.php @@ -1,6 +1,5 @@ run(); diff --git a/htdocs.net/login.php b/htdocs.net/login.php index 885e33f..73207b5 100644 --- a/htdocs.net/login.php +++ b/htdocs.net/login.php @@ -1,6 +1,5 @@ run(); diff --git a/htdocs.net/plan.php b/htdocs.net/plan.php index f0439b7..cf17d49 100644 --- a/htdocs.net/plan.php +++ b/htdocs.net/plan.php @@ -1,6 +1,5 @@ setType('plan'); diff --git a/htdocs.net/services.php b/htdocs.net/services.php index 8e64d78..306212d 100644 --- a/htdocs.net/services.php +++ b/htdocs.net/services.php @@ -1,6 +1,5 @@ run(); diff --git a/include/xnet.inc.php b/include/xnet.inc.php index 45f2bf5..f86bbd9 100644 --- a/include/xnet.inc.php +++ b/include/xnet.inc.php @@ -30,7 +30,7 @@ XnetSession::init(); function _new_page($type, $tpl_name, $min_auth, $admin=false) { global $page,$globals; - require_once("xorg/page.inc.php"); + require_once("xnet/page.inc.php"); if (!empty($admin)) { $page = new XnetAdmin($tpl_name, $type); } else switch($min_auth) { diff --git a/include/xnet/globals.inc.php b/include/xnet/globals.inc.php index da31233..be7329c 100644 --- a/include/xnet/globals.inc.php +++ b/include/xnet/globals.inc.php @@ -50,6 +50,28 @@ class XnetGlobals extends PlatalGlobals } $globals->xdb =& new XOrgDB; } + + function asso($key=null) + { + static $aid = null; + if ($aid === null) { + $gp = basename(dirname($_SERVER['PHP_SELF'])); + $res = $this->xdb->query('SELECT a.*, d.nom AS domnom + FROM groupex.asso AS a + LEFT JOIN groupex.dom AS d ON d.id = a.dom + WHERE diminutif = {?}', $gp); + if (!($aid = $res->fetchOneAssoc())) { + $aid = array(); + } + } + if (empty($key)) { + return $aid; + } elseif ( isset($aid[$key]) ) { + return $aid[$key]; + } else { + return null; + } + } } // }}} diff --git a/include/xnet/page.inc.php b/include/xnet/page.inc.php index d17c39f..1eb9fb9 100644 --- a/include/xnet/page.inc.php +++ b/include/xnet/page.inc.php @@ -51,7 +51,7 @@ class XnetPage extends PlatalPage function setType($type) { - $this->assign('xnet_type', $type); + $this->assign('xnet_type', strtolower($type)); } // }}} diff --git a/templates/xnet/groupe/asso.tpl b/templates/xnet/groupe/asso.tpl new file mode 100644 index 0000000..b4dcac1 --- /dev/null +++ b/templates/xnet/groupe/asso.tpl @@ -0,0 +1,95 @@ +{*************************************************************************** + * 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 * + ***************************************************************************} + + + + + + +
+ + + + + + + + +
+

+ {$asso.cat} + {if $asso.dom}> + {$asso.domnom} + {/if} + > {$asso.nom} : Accueil +

+
+ {if $asso.site} + LOGO + {else} + LOGO + {/if} + + {if $asso.site} +

+ Site Web: {$asso.site} +

+ {/if} + + {if $asso.resp && $asso.mail} +

+ Contact: {mailto address=$asso.mail text=$asso.resp encode=javascript} +

+ {elseif $asso.resp} +

+ Contact: {$asso.resp} +

+ {/if} + + {if $asso.forum} +

+ Forum: + par le web ou + par nntp +

+ {/if} + + TODO: INSCRIPTION + + {if $asso.ax} +

+ groupe agrée par l'AX +

+ {/if} + +
+ {$asso.descr|smarty:nodefaults} +
+
+ {iterate from=$gps item=g} +
+ {$g.nom} +
+ {/iterate} +
+
+ +{* vim:set et sw=2 sts=2 sws=2: *} diff --git a/templates/xnet/groupes.tpl b/templates/xnet/groupes.tpl index 0a08b79..b7e16db 100644 --- a/templates/xnet/groupes.tpl +++ b/templates/xnet/groupes.tpl @@ -43,7 +43,7 @@ {if $gps} {iterate from=$gps item=g} - +
{$g.nom}
{$g.nom}
{/iterate} {else} diff --git a/templates/xnet/index.tpl b/templates/xnet/index.tpl index 4622814..e882ccd 100644 --- a/templates/xnet/index.tpl +++ b/templates/xnet/index.tpl @@ -20,7 +20,7 @@ - diff --git a/templates/xnet/skin.tpl b/templates/xnet/skin.tpl index 25b9f85..fbc4de5 100644 --- a/templates/xnet/skin.tpl +++ b/templates/xnet/skin.tpl @@ -53,7 +53,7 @@
+ Logo des groupes
{if $xnet_type} - + @@ -65,7 +65,7 @@ {else} - + -- 2.1.4
Logo Assos
LOGO Assos