begin to implement asso.php
authorPierre Habouzit (MadCoder <pierre.habouzit@m4x.org>
Mon, 18 Apr 2005 12:02:55 +0000 (12:02 +0000)
committerFlorent Bruneau <florent.bruneau@polytechnique.org>
Thu, 26 Jun 2008 21:28:38 +0000 (23:28 +0200)
git-archimport-id: opensource@polytechnique.org--2005/platal--mainline--0.9--patch-565

20 files changed:
htdocs.net/apropos.php
htdocs.net/article12.php
htdocs.net/article16.php
htdocs.net/creation-groupex.php
htdocs.net/css/xnet.css
htdocs.net/groupe/asso.php [new file with mode: 0644]
htdocs.net/groupe/getlogo.php [new file with mode: 0644]
htdocs.net/groupes.php
htdocs.net/index.php
htdocs.net/login.php
htdocs.net/manuel.php
htdocs.net/plan.php
htdocs.net/services.php
include/xnet.inc.php
include/xnet/globals.inc.php
include/xnet/page.inc.php
templates/xnet/groupe/asso.tpl [new file with mode: 0644]
templates/xnet/groupes.tpl
templates/xnet/index.tpl
templates/xnet/skin.tpl

index c988b3e..53a426a 100644 (file)
@@ -1,6 +1,5 @@
 <?php
     require 'xnet.inc.php';
-    require 'xnet/page.inc.php';
 
     new_skinned_page('xnet/apropos.tpl', AUTH_PUBLIC);
     $page->run();
index 45cc0b9..2564df5 100644 (file)
@@ -1,6 +1,5 @@
 <?php
     require 'xnet.inc.php';
-    require 'xnet/page.inc.php';
 
     new_skinned_page('xnet/article12.tpl', AUTH_PUBLIC);
     $page->run();
index 9f3f959..76bc42d 100644 (file)
@@ -1,6 +1,5 @@
 <?php
     require 'xnet.inc.php';
-    require 'xnet/page.inc.php';
 
     new_skinned_page('xnet/article16.tpl', AUTH_PUBLIC);
     $page->run();
index d14d215..7aaf99c 100644 (file)
@@ -1,6 +1,5 @@
 <?php
     require 'xnet.inc.php';
-    require 'xnet/page.inc.php';
 
     new_skinned_page('xnet/creation-groupex.tpl', AUTH_PUBLIC);
     $page->run();
index 4578767..c05920e 100644 (file)
@@ -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 (file)
index 0000000..9365db8
--- /dev/null
@@ -0,0 +1,22 @@
+<?php
+
+require 'xnet.inc.php';
+
+new_skinned_page('xnet/groupe/asso.tpl', AUTH_PUBLIC);
+if (!$globals->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 (file)
index 0000000..21f483b
--- /dev/null
@@ -0,0 +1,23 @@
+<?php
+require 'xnet.inc.php';
+
+$res = $globals->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");
+}
+
+?>
index 7547471..d77e5ef 100644 (file)
@@ -1,6 +1,5 @@
 <?php
     require 'xnet.inc.php';
-    require 'xnet/page.inc.php';
 
     if (!($cat = Get::get('cat'))) {
         header("Location:index.php");
index 98236fb..7db4380 100644 (file)
@@ -1,6 +1,5 @@
 <?php
     require 'xnet.inc.php';
-    require 'xnet/page.inc.php';
 
     new_skinned_page('xnet/index.tpl', AUTH_PUBLIC);
     $page->run();
index 885e33f..73207b5 100644 (file)
@@ -1,6 +1,5 @@
 <?php
     require 'xnet.inc.php';
-    require 'xnet/page.inc.php';
 
     if (logged()) {
         header("Location: index.php");
index 514a858..d7d651d 100644 (file)
@@ -1,6 +1,5 @@
 <?php
     require 'xnet.inc.php';
-    require 'xnet/page.inc.php';
 
     new_skinned_page('xnet/manuel.tpl', AUTH_PUBLIC);
     $page->run();
index f0439b7..cf17d49 100644 (file)
@@ -1,6 +1,5 @@
 <?php
     require 'xnet.inc.php';
-    require 'xnet/page.inc.php';
 
     new_skinned_page('xnet/plan.tpl', AUTH_PUBLIC);
     $page->setType('plan');
index 8e64d78..306212d 100644 (file)
@@ -1,6 +1,5 @@
 <?php
     require 'xnet.inc.php';
-    require 'xnet/page.inc.php';
 
     new_skinned_page('xnet/services.tpl', AUTH_PUBLIC);
     $page->run();
index 45f2bf5..f86bbd9 100644 (file)
@@ -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) {
index da31233..be7329c 100644 (file)
@@ -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;
+        }
+    }
 }
 
 // }}}
index d17c39f..1eb9fb9 100644 (file)
@@ -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 (file)
index 0000000..b4dcac1
--- /dev/null
@@ -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                *
+ ***************************************************************************}
+
+<table id="content" cellpadding="0" cellspacing="0">
+  <tr>
+    <td id="menu">
+    </td>
+    <td>
+      <table style="width: 100%">
+        <tr>
+          <td colspan="2">
+            <h1>
+              <a class="s" href="../groupes.php?cat={$asso.cat}">{$asso.cat}</a>
+              {if $asso.dom}&gt;
+              <a class="s" href="../groupes.php?cat={$asso.cat}&amp;dom={$asso.dom}">{$asso.domnom}</a>
+              {/if}
+              &gt; {$asso.nom} : Accueil
+            </h1>
+          </td>
+        </tr>
+        <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}
+            <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.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>
+
+            {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>
+    </td>
+  </tr>
+</table>
+
+{* vim:set et sw=2 sts=2 sws=2: *}
index 0a08b79..b7e16db 100644 (file)
@@ -43,7 +43,7 @@
             {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="...">{$g.nom}</a></td></tr>
+              <tr><td class="oval{if $hasdom}2{/if}"><a href="{rel}/{$g.diminutif}/asso.php">{$g.nom}</a></td></tr>
             </table>
             {/iterate}
             {else}
index 4622814..e882ccd 100644 (file)
@@ -20,7 +20,7 @@
 
 <table id="content" cellpadding="0" cellspacing="0">
   <tr>
-    <td>
+    <td style="vertical-align: middle;">
       <img src="images/parfait.jpg" width="459" height="200" alt="Logo des groupes" />
     </td>
 
index 25b9f85..fbc4de5 100644 (file)
@@ -53,7 +53,7 @@
 
     <table id="layout" cellspacing="0" cellpadding="0">
       {if $xnet_type}
-      <tr>
+      <tr id="top">
         <td>
           <a href="{rel}/index.php"><img src="{rel}/images/asso-montants.png" alt="Logo Assos" /></a>
         </td>
@@ -65,7 +65,7 @@
         </td>
       </tr>
       {else}
-      <tr>
+      <tr id="top">
         <td>
           <img src="images/logo.png" alt="LOGO Assos" />
         </td>