Port Xnet trombi and geoloc using PlSet
authorx2003bruneau <x2003bruneau@839d8a87-29fc-0310-9880-83ba4fa771e5>
Mon, 2 Apr 2007 00:15:44 +0000 (00:15 +0000)
committerx2003bruneau <x2003bruneau@839d8a87-29fc-0310-9880-83ba4fa771e5>
Mon, 2 Apr 2007 00:15:44 +0000 (00:15 +0000)
Remove a lot of code deprecated by PlSet (XorgPlugin is dead)
Fix countries in advance search form

git-svn-id: svn+ssh://murphy/home/svn/platal/trunk@1652 839d8a87-29fc-0310-9880-83ba4fa771e5

13 files changed:
classes/platalpage.php
classes/plset.php
classes/trombi.php [deleted file]
classes/xorgplugin.php [deleted file]
include/geoloc.inc.php
modules/geoloc.php
modules/profile.php
modules/search.php
modules/search/search.inc.php
modules/xnetgrp.php
templates/geoloc/index.tpl [deleted file]
templates/include/plview.geoloc.tpl
templates/profile/trombipromo.tpl [deleted file]

index e2011dd..b0a561b 100644 (file)
@@ -136,7 +136,7 @@ class PlatalPage extends Smarty
         }
 
         $this->assign('validate', true);
-        #error_reporting(0);
+        error_reporting(0);
         $result = $this->fetch($skin);
         $ttime  = sprintf('Temps total: %.02fs - Mémoire totale : %dKo<br />', microtime(true) - $TIME_BEGIN
                                                                                 , memory_get_peak_usage(true) / 1024);
index d2267d0..9ca8d57 100644 (file)
@@ -138,7 +138,11 @@ class PlSet
         if (is_null($view)) {
             return false;
         }
-        $page->changeTpl('core/plset.tpl');
+        if (empty($GLOBALS['IS_XNET_SITE'])) {
+            $page->changeTpl('core/plset.tpl');
+        } else {
+            new_group_open_page('core/plset.tpl');
+        }
         $page->assign('plset_base', $baseurl);
         $page->assign('plset_mods', $this->mods);
         $page->assign('plset_mod', $this->mod);
diff --git a/classes/trombi.php b/classes/trombi.php
deleted file mode 100644 (file)
index 31aa528..0000000
+++ /dev/null
@@ -1,74 +0,0 @@
-<?php
-/***************************************************************************
- *  Copyright (C) 2003-2007 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                *
- ***************************************************************************/
-
-class Trombi extends XOrgPlugin
-{
-    private $limit = 24;
-    private $admin = false;
-    private $showpromo = true;
-
-    public function __construct($funcname = null, $prefix = null) 
-    {
-        $this->_get_vars = array('offset');
-        parent::__construct($funcname, $prefix);
-    }
-
-    public function setNbRows($row)
-    { $this->limit = $row*3; }
-
-    public function setAdmin()
-    { $this->admin = true; }
-
-    public function hidePromo()
-    { $this->showpromo = false; }
-
-    public function show()
-    {
-        /* this point is nasty...  but since show() is called from the template ...
-         * I can't see any more clever way to achieve that
-         */
-        global $page;
-
-        $offset = intval($this->get_value('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_show_promo', $this->showpromo);
-        $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');
-    }
-}
-
-// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
-?>
diff --git a/classes/xorgplugin.php b/classes/xorgplugin.php
deleted file mode 100644 (file)
index 90fc62e..0000000
+++ /dev/null
@@ -1,102 +0,0 @@
-<?php
-/***************************************************************************
- *  Copyright (C) 2003-2007 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                *
- ***************************************************************************/
-
-/**
- * XOrg Plugins class
- *
- * this class is used for plugins whose behavior depends only from the GET.
- *
- * @category XOrgCore
- * @package  XOrgCore
- * @author   Pierre Habouzit <pierre.habouzit@polytechnique.org>
- * @access   public
- * @since    Classe available since 0.9.2
- */
-class XOrgPlugin
-{
-    /** have to override, contents the fields names used to drive the plugin */
-    public $_get_vars = array();
-    /** some polymorphism at low cost, may be used, or not */
-    public $_callback;
-
-    /** constructor.
-     * the constructor override $_get_vars settings by prefixing the names with $prefix
-     */
-    public function __construct($funcname='', $prefix='')
-    {
-        $this->_callback = $funcname;
-        $this->_prefix = $prefix;
-        foreach ($this->_get_vars as $key=>$val) {
-            $this->_get_vars[$key] = $prefix.$val;
-        }
-    }
-
-    /** transparent access to $_GET, wrt the right $prefix
-     */
-    public function get_value($key)
-    {
-        return Get::v($this->_prefix.$key);
-    }
-
-    /** construct an url with the given parameters to drive the plugin.
-     * leave all other GET params alone
-     */
-    public function make_url($params)
-    {
-        $get = Array();
-        $args = isset($params) ? $params : Array();
-
-        if (!is_array($args)) {
-            $args = array($this->_get_vars[0]=>$params);
-        }
-
-        foreach ($_GET as $key=>$val) {
-            if ($key == 'n') {
-                continue;
-            }
-            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 (Get::has('key')) {
-                $get[] = urlencode($key) . '=' . urlencode(Get::v($key));
-            }
-        }
-
-        return pl_self() . '?' . join('&amp;', $get);
-    }
-
-    /** need to be overriden.  */
-    public function show()
-    {
-        return '';
-    }
-}
-
-// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
-?>
index 107a562..6a460bc 100644 (file)
@@ -44,6 +44,7 @@ function geoloc_country($current, $avail_only = false)
 
 function _geoloc_country_smarty($params)
 {
+    echo "miqjfmeij";
     if(!isset($params['country'])) {
         return;
     }
@@ -77,10 +78,9 @@ function geoloc_region($country, $current, $avail_only = false)
                  $regid, ($current==$regid?"selected='selected'":""), $regname);
     }
     return $html;
-
 }
 
-function _geoloc_region_smarty($params)
+function _geoloc_region_smarty($params, &$smarty)
 {
     if(!isset($params['country']) || !isset($params['region'])) {
         return;
index e4b549e..0336637 100644 (file)
@@ -24,43 +24,13 @@ class GeolocModule extends PLModule
     function handlers()
     {
         return array(
-//            'icon.swf'           => $this->make_hook('icon',    AUTH_COOKIE),
             'geoloc'             => $this->make_hook('default', AUTH_COOKIE),
-//            'geoloc/icon.swf'    => $this->make_hook('icon',    AUTH_COOKIE),
-//            'geoloc/dynamap.swf' => $this->make_hook('dynamap', AUTH_COOKIE),
-//            'geoloc/init'        => $this->make_hook('init',    AUTH_COOKIE),
-//            'geoloc/city'        => $this->make_hook('city',    AUTH_COOKIE),
-//            'geoloc/country'     => $this->make_hook('country', AUTH_COOKIE),
             '%grp/geoloc'            => $this->make_hook('default',AUTH_COOKIE),
-            '%grp/geoloc/icon.swf'   => $this->make_hook('icon',   AUTH_COOKIE),
-            '%grp/geoloc/dynamap.swf'=> $this->make_hook('dynamap',AUTH_COOKIE),
-            '%grp/geoloc/init'       => $this->make_hook('init',   AUTH_COOKIE),
-            '%grp/geoloc/city'       => $this->make_hook('city',   AUTH_COOKIE),
-            '%grp/geoloc/country'    => $this->make_hook('country',AUTH_COOKIE),
             'admin/geoloc'           => $this->make_hook('admin', AUTH_MDP, 'admin'),
             'admin/geoloc/dynamap'   => $this->make_hook('admin_dynamap', AUTH_MDP, 'admin'),
         );
     }
 
-    function _make_qs()
-    {
-        $querystring = "";
-
-        foreach ($_GET as $v => $a) {
-            if ($v != 'initfile' && $v != 'n' && $v != 'mapid') {
-                $querystring .= urlencode($v).'='.urlencode($a).'&amp;';
-            }
-        }
-
-        return $querystring;
-    }
-
-    function use_map()
-    {
-        return is_file(dirname(__FILE__).'/geoloc/dynamap.swf') &&
-                is_file(dirname(__FILE__).'/geoloc/icon.swf');
-    }
-
     function handler_default(&$page, $action = null, $subaction = null)
     {
         global $globals;
@@ -68,151 +38,6 @@ class GeolocModule extends PLModule
         $set = new UserSet();
         $set->addMod('geoloc', 'Geolocalisation', true);
         $set->apply('geoloc', $page, $action, $subaction);
-        return;
-
-        if (!$this->use_map())
-            $page->assign('request_geodesix', 1);
-
-        if (!empty($GLOBALS['IS_XNET_SITE'])) {
-            $page->assign('no_annu', 1);
-            new_annu_page('geoloc/index.tpl');
-        } else {
-            $page->changeTpl('geoloc/index.tpl');
-        }
-
-        require_once dirname(__FILE__).'/search/search.inc.php';
-
-        $fields = new SFieldGroup(true, advancedSearchFromInput());
-        $search = str_replace('&amp;','&',$fields->get_url());
-        if ((!Env::has('only_current') && !Env::has('rechercher')) || Env::v('only_current') == 'on')
-            $search .= '&only_current=on';
-        elseif (Env::i('only_current') != 'on')
-            $search .= '&only_current=';
-
-        $search = preg_replace('/(^|&)mapid=([0-9]+)(&)/','\1\3', $search);
-        if ($search)
-            $search = '?'.$search;
-        $page->assign('search_nourlencode',$search);
-        $page->assign('search',urlencode($search));
-
-        $page->assign('protocole', substr($globals->baseurl,0,strpos($globals->baseurl,':')));
-
-        if (!$search) {
-            $res = XDB::query('SELECT COUNT(DISTINCT uid)
-                                   FROM adresses WHERE cityid IS NOT NULL');
-            $page->assign('localises', $res->fetchOneCell());
-        }
-    }
-
-    function handler_icon(&$page)
-    {
-        global $globals;
-
-        header("Content-type: application/x-shockwave-flash");
-        header("Pragma:");
-
-        readfile(dirname(__FILE__).'/geoloc/icon.swf');
-        exit;
-
-        return PL_NOT_FOUND;
-    }
-
-    function handler_dynamap(&$page)
-    {
-        global $globals;
-
-        header("Content-type: application/x-shockwave-flash");
-
-        header("Pragma:");
-        readfile(dirname(__FILE__).'/geoloc/dynamap.swf');
-        exit;
-
-        return PL_NOT_FOUND;
-    }
-
-    function handler_init(&$page)
-    {
-        global $globals;
-
-        $page->changeTpl('geoloc/init.tpl', NO_SKIN);
-
-        header('Content-type: text/xml');
-        header('Pragma:');
-        if(!empty($GLOBALS['IS_XNET_SITE']))
-            $page->assign('background', 0xF2E9D0);               
-        $page->assign('querystring', $this->_make_qs());
-    }
-
-    function handler_city(&$page)
-    {
-        global $globals;
-
-        header("Content-type: text/xml");
-        header("Pragma:");
-
-        $page->changeTpl('geoloc/city.tpl', NO_SKIN);
-
-        require_once dirname(__FILE__).'/search/search.inc.php';
-        require_once('geoloc.inc.php');
-
-        if (empty($GLOBALS['IS_XNET_SITE'])) {
-            $usual_fields = advancedSearchFromInput();
-            $fields = new SFieldGroup(true, $usual_fields);
-        } else {
-            $_REQUEST['asso_id'] = $globals->asso('id');
-            $_REQUEST['only_current'] = 'on';
-            $fields   = new SFieldGroup(true, array(
-                new RefSField('asso_id',array('gxm.asso_id'),'groupex.membres','gxm','u.user_id=gxm.uid'),
-                new RefSField('cityid',array('av.cityid'),'adresses','av',getadr_join('av'))));
-        }
-        $where = $fields->get_where_statement();
-        if ($where) $where = "WHERE ".$where;
-
-        $users = XDB::iterator("
-            SELECT u.user_id AS id, u.prenom, u.nom, u.promo, alias
-              FROM adresses AS a 
-        INNER JOIN auth_user_md5 AS u ON(u.user_id = a.uid)
-        INNER JOIN auth_user_quick AS q ON(q.user_id = a.uid)
-         LEFT JOIN aliases ON(u.user_id = aliases.id AND FIND_IN_SET(aliases.flags,'bestalias'))
-                ".$fields->get_select_statement()."
-                ".$where."
-             GROUP BY u.user_id LIMIT 11", $id);
-
-        $page->assign('users', $users);
-    }
-
-    function handler_country(&$page)
-    {
-        global $globals;
-
-        // to debug sql use the next line
-        if (Env::has('debug')) {
-            $page->changeTpl('geoloc/country.tpl', SIMPLE);
-        } else {
-            header("Content-type: text/xml");
-            header("Pragma:");
-            $page->changeTpl('geoloc/country.tpl', NO_SKIN);
-        }
-
-        require_once dirname(__FILE__).'/search/search.inc.php';
-        require_once 'geoloc.inc.php';
-
-        $querystring = $this->_make_qs();
-        $page->assign('searchvars', $querystring);
-
-        $mapid = Env::has('mapid') ? Env::i('mapid', -2) : false;
-        if (empty($GLOBALS['IS_XNET_SITE'])) {
-            $fields = advancedSearchFromInput();
-        } else {
-            $_REQUEST['asso_id'] = $globals->asso('id');
-            $_REQUEST['only_current'] = 'on';
-            $fields   = array(new RefSField('asso_id',array('gxm.asso_id'),'groupex.membres','gxm','u.user_id=gxm.uid'));
-        }
-
-        list($countries, $cities) = geoloc_getData_subcountries($mapid, $fields, 10);
-
-        $page->assign('countries', $countries);
-        $page->assign('cities', $cities);
     }
 
     function handler_admin(&$page, $action = false) {
index a7bc193..c47b3e6 100644 (file)
@@ -37,7 +37,6 @@ class ProfileModule extends PLModule
             'referent'         => $this->make_hook('referent',   AUTH_COOKIE),
             'referent/search'  => $this->make_hook('ref_search', AUTH_COOKIE),
 
-            'trombi'  => $this->make_hook('trombi', AUTH_COOKIE),
             'groupes-x'        => $this->make_hook('xnet',      AUTH_COOKIE),
 
             'vcard'   => $this->make_hook('vcard',  AUTH_COOKIE),
@@ -664,29 +663,6 @@ class ProfileModule extends PLModule
         }
     }
 
-    function handler_trombi(&$page, $promo = null)
-    {
-        $page->changeTpl('profile/trombipromo.tpl');
-        $page->assign('xorg_title', 'Polytechnique.org - Trombi Promo');
-
-        if (is_null($promo)) {
-            return;
-        }
-
-        $this->promo = $promo = intval($promo);
-
-        if ($promo >= 1900 && ($promo < intval(date('Y')) || ($promo == intval(date('Y')) && intval(date('m')) >= 9))
-        || ($promo == -1 && S::has_perms()))
-        {
-            $trombi = new Trombi(array($this, '_trombi_getlist'));
-            $trombi->hidePromo();
-            $trombi->setAdmin();
-            $page->assign_by_ref('trombi', $trombi);
-        } else {
-            $page->trig('Promotion incorrecte (saisir au format YYYY). Recommence.');
-        }
-    }
-
     function handler_xnet(&$page)
     {
         $page->changeTpl('profile/groupesx.tpl');
index 2f281f5..2847322 100644 (file)
@@ -46,48 +46,6 @@ class SearchModule extends PLModule
         user_reindex($uid);
     }
 
-    function get_quick($offset, $limit, $order)
-    {
-        global $globals;
-        if (!S::logged()) {
-            Env::kill('with_soundex');
-        }
-        $qSearch = new QuickSearch('quick');
-        $fields  = new SFieldGroup(true, array($qSearch));
-
-        if ($qSearch->isempty()) {
-            new ThrowError('Recherche trop générale.');
-        }
-
-        $sql = 'SELECT SQL_CALC_FOUND_ROWS
-            UPPER(IF(u.nom!="",u.nom,u.nom_ini)) AS nom,
-            IF(u.prenom!="",u.prenom,u.prenom_ini) AS prenom,
-            '.$globals->search->result_fields.'
-            c.uid AS contact, w.ni_id AS watch,
-            '.$qSearch->get_score_statement().'
-                FROM  auth_user_md5  AS u
-                '.$fields->get_select_statement().'
-                LEFT JOIN  auth_user_quick AS q  ON (u.user_id = q.user_id)
-                LEFT JOIN  aliases         AS a  ON (u.user_id = a.id AND a.type="a_vie")
-                LEFT JOIN  contacts        AS c  ON (c.uid='.S::i('uid', -1).'
-                                                     AND c.contact=u.user_id)
-                LEFT JOIN  watch_nonins    AS w  ON (w.ni_id=u.user_id
-                                                     AND w.uid='.S::i('uid', -1).')
-                '.$globals->search->result_where_statement.'
-                    WHERE  '.$fields->get_where_statement()
-                    .(S::logged() && Env::has('nonins') ? ' AND u.perms="pending" AND u.deces=0' : '')
-                .'
-                 GROUP BY  u.user_id
-                 ORDER BY  '.($order?($order.', '):'')
-                .implode(',',array_filter(array($fields->get_order_statement(),
-                                                'u.promo DESC, NomSortKey, prenom'))).'
-                    LIMIT  '.$offset * $globals->search->per_page.','
-                .$globals->search->per_page;
-        $list    = XDB::iterator($sql);
-        $res     = XDB::query("SELECT  FOUND_ROWS()");
-        $nb_tot  = $res->fetchOneCell();
-        return array($list, $nb_tot);
-    }
 
     function form_prepare()
     {
@@ -123,48 +81,6 @@ class SearchModule extends PLModule
         $page->assign('choix_diplomas', explode(',',$types));
     }
 
-    function get_advanced($offset, $limit, $order)
-    {
-        $fields = new SFieldGroup(true, advancedSearchFromInput());
-        if ($fields->too_large()) {
-            $this->form_prepare();
-            new ThrowError('Recherche trop générale.');
-        }
-        global $globals, $page;
-
-                       $page->assign('search_vars', $fields->get_url());
-
-        $where = $fields->get_where_statement();
-        if ($where) {
-            $where = "WHERE  $where";
-        }
-        $sql = 'SELECT SQL_CALC_FOUND_ROWS DISTINCT
-                           u.nom, u.prenom,
-                           '.$globals->search->result_fields.'
-                           c.uid AS contact,
-                           w.ni_id AS watch
-                     FROM  auth_user_md5   AS u
-               LEFT JOIN  auth_user_quick AS q USING(user_id)
-                '.$fields->get_select_statement().'
-                '.(Env::has('only_referent') ? ' INNER JOIN mentor AS m ON (m.uid = u.user_id)' : '').'
-                LEFT JOIN  aliases        AS a ON (u.user_id = a.id AND a.type="a_vie")
-                LEFT JOIN  contacts       AS c ON (c.uid='.S::v('uid').'
-                                                   AND c.contact=u.user_id)
-                LEFT JOIN  watch_nonins   AS w ON (w.ni_id=u.user_id
-                                                   AND w.uid='.S::v('uid').')
-                '.$globals->search->result_where_statement."
-                    $where
-                 GROUP BY  u.user_id
-                 ORDER BY  ".($order?($order.', '):'')
-                .implode(',',array_filter(array($fields->get_order_statement(),
-                                                'promo DESC, NomSortKey, prenom'))).'
-                    LIMIT  '.($offset * $limit).','.$limit;
-        $liste   = XDB::iterator($sql);
-        $res     = XDB::query("SELECT  FOUND_ROWS()");
-        $nb_tot  = $res->fetchOneCell();
-        return Array($liste, $nb_tot);
-    }
-
     function handler_quick(&$page, $action = null, $subaction = null)
     {
         global $globals;
@@ -201,15 +117,17 @@ class SearchModule extends PLModule
             $page->addJsLink('ajax.js');
         }
 
+        require_once dirname(__FILE__) . '/search/search.inc.php';
         $page->changeTpl('search/index.tpl');            
         $page->assign('xorg_title','Polytechnique.org - Annuaire');
         $page->assign('baseurl', $globals->baseurl);
+        $page->register_modifier('display_lines', 'display_lines');
     }
 
-    function handler_advanced(&$page, $mode = null)
+    function handler_advanced(&$page, $action = null, $subaction = null)
     {
         global $globals;
-        if (!Env::has('rechercher')) {
+        if (!Env::has('rechercher') && $action != 'geoloc') {
             $this->form_prepare();
         } else {
             require_once 'userset.inc.php';
@@ -229,10 +147,13 @@ class SearchModule extends PLModule
             }
         }
 
-        $page->changeTpl('search/index.tpl', $mode == 'mini' ? SIMPLE : SKINNED);
+        require_once 'geoloc.inc.php';
+        require_once dirname(__FILE__) . '/search/search.inc.php';
+        $page->changeTpl('search/index.tpl', $action == 'mini' ? SIMPLE : SKINNED);
         $page->addJsLink('ajax.js');
         $page->assign('advanced',1);
         $page->assign('public_directory',0);
+        $page->register_modifier('display_lines', 'display_lines');
     }
 
     function handler_region(&$page, $country = null)
index dcbf7aa..eae0a04 100644 (file)
@@ -74,120 +74,5 @@ function advancedSearchFromInput()
 
 // }}}
 
-// {{{ class XOrgSearch
-
-class XOrgSearch extends XOrgPlugin
-{
-    // {{{ properties
-    
-    var $_get_vars    = Array('offset', 'order', 'order_inv', 'rechercher');
-    var $limit        = 20;
-    var $order_defaut = 'promo';
-    // type of orders : (field name, default ASC, text name, auth)
-    var $orders = array(
-            'nom'       =>array('nom,prenom',   true,  'nom',             AUTH_PUBLIC),
-            'promo'     =>array('promo,nom',  false, 'promotion',             AUTH_PUBLIC),
-            'date_mod'  =>array('u.date,nom', false, 'dernière modification', AUTH_COOKIE)
-        );
-
-    // }}}
-    // {{{ function setNbLines()
-    
-    function setNbLines($lines)
-    { $this->limit = $lines; }
-
-    // }}}
-    // {{{ function setAuth()
-
-    function setAuth()
-    {
-        foreach ($this->orders as $key=>$o) {
-            if ($o[3] == AUTH_COOKIE) {
-                $this->orders[$key][3] = S::logged();
-            } elseif ($o[3] == AUTH_PUBLIC) {
-                $this->orders[$key][3] = true;
-            } else {
-                $this->orders[$key][3] = S::identified();
-            }
-        }
-    }
-
-    // }}}
-    // {{{ function addOrder()
-
-    function addOrder($name, $field, $inv_order, $text, $auth, $defaut=false)
-    {
-        // reverse the array, to get the defaut order first
-        if ($defaut)
-            $this->orders = array_reverse($this->orders);
-        $this->orders[$name] = array($field, $inv_order, $text, $auth);
-        if ($defaut) {
-            $this->orders = array_reverse($this->orders);
-            $this->order_defaut = $name;
-        }
-    }
-
-    // }}}
-    // {{{ function show()
-    
-    function show()
-    {
-        $this->setAuth();
-       global $page, $globals;
-
-        $offset = intval($this->get_value('offset'));
-        $tab    = @$this->orders[$this->get_value('order')];
-        if (!$tab || !$tab[3]) {
-            $tab = $this->orders[$this->order_defaut];
-        }
-        $order     = $tab[0];
-        $order_inv = ($this->get_value('order_inv') != '') == $tab[1];
-
-        if ($order_inv && $order)
-            $sql_order = str_replace(",", " DESC,", $order)." DESC";
-        else $sql_order = $order;
-
-        list($list, $total) = call_user_func($this->_callback, $offset, $this->limit, $sql_order);
-        
-       $page_max = intval(($total-1)/$this->limit);
-        if(!S::logged() && $page_max > $globals->search->public_max)
-            $page_max = $globals->search->public_max;
-
-       $links = Array();
-           if ($offset) {
-           $links[] = Array('u'=> $this->make_url(Array('offset'=>$offset-1)), 'i' => $offset-1,  'text' => 'précédent');
-           }
-       for ($i = 0; $i <= $page_max ; $i++) {
-               $links[] = Array('u'=>$this->make_url(Array('offset'=>$i)), 'i' => $i, 'text' => $i+1);
-        }
-       if ($offset < $page_max) {
-               $links[] = Array ('u' => $this->make_url(Array('offset'=>$offset+1)), 'i' => $offset+1, 'text' => 'suivant');
-       }
-        
-        $page->assign('search_results', $list);
-        $page->assign('search_results_nb', $total);
-        $page->assign('search_page', $offset);
-        $page->assign('search_pages_nb', $page_max+1);
-        $page->assign('search_pages_link', $links);
-
-        $order_links = Array();
-        foreach ($this->orders as $key=>$o) if ($o[3]) {
-            $order_links[] = Array(
-                "text" => $o[2],
-                "url"  => $this->make_url(Array('order' => $key, 'order_inv' => ($o[0] == $order) && ($order_inv != $o[1]))),
-                "asc"  => ($o[0] == $order) && $order_inv,
-                "desc" => ($o[0] == $order) && !$order_inv
-            );
-        }
-        $page->assign('search_order_link', $order_links);
-  
-        return $total;
-    }
-    
-    // }}}
-}
-
-// }}}
-
 // vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
 ?>
index 4115206..9fcfd9f 100644 (file)
@@ -428,16 +428,11 @@ class XnetGrpModule extends PLModule
         $page->jsonAssign('ann', $ann);
     }
 
-    function handler_trombi(&$page, $num = 1)
+    function handler_trombi(&$page, $action = null, $subaction = null)
     {
-        global $globals;
-        new_annu_page('xnetgrp/trombi.tpl');
-        
-        $page->assign('urlmainsite', "https://www.polytechnique.org/");
-        $trombi = new Trombi(array($this, '_trombi_getlist'));
-        $trombi->hidePromo();
-        $trombi->setAdmin();
-        $page->assign_by_ref('trombi', $trombi);
+        $view = new UserSet();
+        $view->addMod('trombi', 'Trombinoscope', true, array('with_admin' => false, 'with_promo' => true));
+        $view->apply('trombi', $page,  'trombi', $action, $subaction);
     }
 
     function _trombi_getlist($offset, $limit)
diff --git a/templates/geoloc/index.tpl b/templates/geoloc/index.tpl
deleted file mode 100644 (file)
index 655aa71..0000000
+++ /dev/null
@@ -1,108 +0,0 @@
-{**************************************************************************}
-{*                                                                        *}
-{*  Copyright (C) 2003-2007 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               *}
-{*                                                                        *}
-{**************************************************************************}
-
-<h1>Géolocalisation</h1>
-
-<script type="text/javascript">
-{literal}
-function ficheXorg(id)
-{
-  window.open('{/literal}{if $no_annu}https://www.polytechnique.org/{/if}{literal}profile/'+id,'_blank','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width=840,height=600');
-}
-{/literal}
-{if !$no_annu}
-{literal}
-function clickOnCity(id)
-{
-       var f = document.getElementById('search_form');
-       var url = f.action;
-       f.action += unescape('%26')+'cityid=' + id; 
-       f.submit();
-       f.action = url;
-       document.getElementById('search_results').style.height = '250px';
-}
-var mapid = 0;
-function goToCountry(id)
-{
-       mapid = id;
-}
-function searchMapId(f)
-{
-       var url = f.action;
-       f.action += unescape('%26')+'mapid=' + mapid; 
-       f.submit();
-       f.action = url;
-       document.getElementById('search_results').style.height = '250px';
-}
-{/literal}
-{/if}
-
-</script>
-{if $localises}
-  <p class="descr">
-    Aujourd'hui {$localises} de nos camarades sont localisés grâce à leurs adresses personnelles.
-  </p>
-{/if}
-{if !$request_geodesix}
-  <p class="center">
-  <object
-    classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
-    codebase="{$protocole}://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0"
-    width="600"
-    height="450"
-    align="middle">
-      <param name="movie" value="{$platal->ns}geoloc/dynamap.swf"/>
-      <param name="bgcolor" value="#ffffff"/>
-      <param name="wmode" value="opaque"/>
-      <param name="quality" value="high"/>
-      <param name="flashvars" value="initfile={$platal->ns}geoloc%2Finit{$search|smarty:nodefaults}"/>
-      <embed
-        src="{$platal->ns}geoloc/dynamap.swf"
-        quality="high"
-        bgcolor="#ffffff"
-        width="600"
-        height="450"
-        name="dynamap"
-        id="dynamap"
-        align="middle"
-        flashvars="initfile={$platal->ns}geoloc%2Finit{$search|smarty:nodefaults}"
-        type="application/x-shockwave-flash"
-        menu="false"
-        wmode="opaque"
-        salign="tl"
-        pluginspage="{$protocole}://www.macromedia.com/go/getflashplayer"/>
-    </object>
-  </p>
-  <p class="smaller">Carte fournie gracieusement par <a href="http://www.geodesix.com/">Geodesix</a>.</p>
-  {if !$no_annu}
-    <form id="search_form" action="search/adv/{$search_nourlencode}&amp;rechercher=1" method="post">
-    <p>
-       <input type="button" value="Lister les camarades de la carte ci-dessus" onclick="searchMapId(this.form)"/>
-    </p>
-    </form>
-  {/if}
-{else}
-  <p>Le moteur de carte n'a pas été installé sur cette version de plat/al. Veuillez contacter <a href="http://www.geodesix.com/">Geodesix</a>.</p>
-{/if} 
-<p class="descr">Pour toute question, problème ou suggestion tu peux envoyer un mail à <a href="mailto:geoloc@staff.polytechnique.org">geoloc@staff.polytechnique.org</a></p>
-
-{* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *}
index 141e4d1..2c6bc57 100644 (file)
@@ -60,7 +60,7 @@ function searchMapId(f)
   
   {if $smarty.request.only_current neq 'on'}
   <p class="center">
-    [<a href="{$plset_base}/geoloc{$search_nourlencode|smarty:nodefaults}&amp;only_current=on">Ne voir que les adresses principales</a>]
+    [<a href="{$platal->ns}{$plset_base}/geoloc{$search_nourlencode|smarty:nodefaults}&amp;only_current=on">Ne voir que les adresses principales</a>]
   </p>
   {/if}
   
@@ -71,13 +71,13 @@ function searchMapId(f)
     width="600"
     height="450"
     align="middle">
-      <param name="movie" value="{$plset_base}/geoloc/dynamap.swf"/>
+      <param name="movie" value="{$platal->ns}{$plset_base}/geoloc/dynamap.swf"/>
       <param name="bgcolor" value="#ffffff"/>
       <param name="wmode" value="opaque"/>
       <param name="quality" value="high"/>
-      <param name="flashvars" value="initfile={$plset_base|urlencode}%2Fgeoloc%2Finit{$search|smarty:nodefaults}"/>
+      <param name="flashvars" value="initfile={$platal->ns|urlencode}{$plset_base|urlencode}%2Fgeoloc%2Finit{$search|smarty:nodefaults}"/>
       <embed
-        src="{$plset_base}/geoloc/dynamap.swf"
+        src="{$platal->ns}{$plset_base}/geoloc/dynamap.swf"
         quality="high"
         bgcolor="#ffffff"
         width="600"
@@ -85,7 +85,7 @@ function searchMapId(f)
         name="dynamap"
         id="dynamap"
         align="middle"
-        flashvars="initfile={$plset_base|urlencode}%2Fgeoloc%2Finit{$search|smarty:nodefaults}"
+        flashvars="initfile={$platal->ns|urlencode}{$plset_base|urlencode}%2Fgeoloc%2Finit{$search|smarty:nodefaults}"
         type="application/x-shockwave-flash"
         menu="false"
         wmode="opaque"
diff --git a/templates/profile/trombipromo.tpl b/templates/profile/trombipromo.tpl
deleted file mode 100644 (file)
index 702eee8..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-{**************************************************************************}
-{*                                                                        *}
-{*  Copyright (C) 2003-2007 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               *}
-{*                                                                        *}
-{**************************************************************************}
-
-<h1>
-  Trombinoscope promo
-</h1>
-<p>
-Cette page te permet de voir l'album photo d'une promotion
-donnée.
-</p>
-<p>
-Fais attention, si tu as une connexion à internet lente (par
-exemple si tu es sur un vieux modem), la page que tu vas télécharger
-en validant peut être longue à afficher.
-</p>
-
-<form action="trombi/" method="post">
-  <table class="tinybicol" cellpadding="3" summary="Saisie promo" style="width: 30%; margin-left:35%">
-    <tr>
-      <th colspan="2">
-        Trombinoscope
-      </th>
-    </tr>
-    <tr>
-      <td class="titre" style="vertical-align: middle;">
-        Promotion
-      </td>
-      <td>
-        <input type="text" name="xpromo" size="4" maxlength="4" value="{$smarty.session.promo}" />
-        <input type="submit" value="Ok"
-          onclick='this.form.action = this.form.action + this.form.xpromo.value' />
-      </td>
-    </tr>
-  </table>
-</form>
-
-{if $trombi}
-
-<h1>
-  Album photo
-  {if $platal->argv[1] eq -1}
-  {#globals.core.sitename#}
-  {else}
-  promotion {$platal->argv[1]}
-  {/if}
-</h1>
-
-{$trombi->show()|smarty:nodefaults}
-
-{/if}
-
-{* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *}