Finishes to move functions from geoloc.inc.php to geocoding.inc.php,
authorStéphane Jacob <jacou@melix.net>
Wed, 18 Feb 2009 20:45:48 +0000 (21:45 +0100)
committerStéphane Jacob <jacou@melix.net>
Thu, 19 Feb 2009 10:08:41 +0000 (11:08 +0100)
adapts them to the new geocoding, trashes the planisphere.

22 files changed:
classes/xnetpage.php
htdocs/xorg.php
include/geocoding.inc.php
include/geoloc.inc.php [deleted file]
include/userset.inc.php
modules/events.php
modules/geoloc.php [deleted file]
modules/geoloc/.gitignore [deleted file]
modules/profile/mentor.inc.php
plugins/function.display_address.php
plugins/function.geoloc_country.php [deleted file]
plugins/function.geoloc_region.php [deleted file]
templates/admin/index.tpl
templates/geoloc/admin.tpl [deleted file]
templates/geoloc/admin_dynamap.tpl [deleted file]
templates/geoloc/city.tpl [deleted file]
templates/geoloc/country.tpl [deleted file]
templates/geoloc/init.tpl [deleted file]
templates/include/plview.geoloc.tpl [deleted file]
templates/profile/groupesx.tpl
templates/profile/mentor.tpl
templates/skin/common.menu.tpl

index 50d86bb..f038564 100644 (file)
@@ -87,7 +87,6 @@ class XnetPage extends PlPage
             if ($perms->hasFlag('groupannu')) {
                 $sub['annuaire du groupe'] = "$dim/annuaire";
                 $sub['trombinoscope'] = "$dim/trombi";
-                $sub['planisphère'] = "$dim/geoloc";
             }
             if ($perms->hasFlag('groupmember')) {
                 if ($globals->asso('forum')) {
index 28202d6..7f1a842 100644 (file)
@@ -22,7 +22,7 @@
 require_once dirname(__FILE__).'/../include/xorg.inc.php';
 
 $platal = new Xorg('auth', 'carnet', 'email', 'events', 'forums',
-                   'geoloc', 'lists', 'marketing', 'payment', 'platal',
+                   'lists', 'marketing', 'payment', 'platal',
                    'profile', 'register', 'search', 'stats', 'admin',
                    'newsletter', 'axletter', 'bandeau', 'survey',
                    'fusionax', 'gadgets', 'googleapps', 'poison', 'openid');
index fc812fa..c888a85 100644 (file)
@@ -68,6 +68,16 @@ abstract class Geocoder {
         }
         return implode("\n", array_slice($textArray, 0, $limit));
     }
+
+    // Returns the number of non geocoded addresses for a user.
+    static public function countNonGeocoded($pid)
+    {
+        $res = XDB::query("SELECT  COUNT(*)
+                             FROM  profile_addresses
+                            WHERE  pid = {?} AND FIND_IN_SET('home', type) AND accuracy = 0",
+                          $pid);
+        return $res->fetchOneCell();
+    }
 }
 
 // Implementation of a Geocoder using the Google Maps API. Please refer to
diff --git a/include/geoloc.inc.php b/include/geoloc.inc.php
deleted file mode 100644 (file)
index 0a6bfac..0000000
+++ /dev/null
@@ -1,538 +0,0 @@
-<?php
-/***************************************************************************
- *  Copyright (C) 2003-2009 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                *
- ***************************************************************************/
-
-// {{{ get_address_text($adr)
-/** make the text of an address that can be read by a mailman
- * @param $adr an array with all the usual fields
- */
-function get_address_text($adr)
-{
-    $t = "";
-    if (isset($adr['adr1']) && $adr['adr1']) $t.= $adr['adr1'];
-    if (isset($adr['adr2']) && $adr['adr2']) $t.= "\n".$adr['adr2'];
-    if (isset($adr['adr3']) && $adr['adr3']) $t.= "\n".$adr['adr3'];
-    $l = "";
-    if (isset($adr['display']) && $adr['display']) {
-        $keys = explode(' ', $adr['display']);
-        foreach ($keys as $key) {
-            if (isset($adr[$key])) {
-                $l .= " ".$adr[$key];
-            } else {
-                $l .= " ".$key;
-            }
-        }
-        if ($l) substr($l, 1);
-    } elseif ($adr['country'] == 'US' || $adr['country'] == 'CA' || $adr['country'] == 'GB') {
-        if ($adr['city']) $l .= $adr['city'].",\n";
-        if ($adr['region']) $l .= $adr['region']." ";
-        if ($adr['postcode']) $l .= $adr['postcode'];
-    } else {
-        if (isset($adr['postcode']) && $adr['postcode']) $l .= $adr['postcode']." ";
-        if (isset($adr['city']) && $adr['city']) $l .= $adr['city'];
-    }
-    if ($l) $t .= "\n".trim($l);
-    if ($adr['country'] != '00' && (!$adr['countrytxt'] || $adr['countrytxt'] == strtoupper($adr['countrytxt']))) {
-        $res = XDB::query("SELECT pays FROM geoloc_pays WHERE a2 = {?}", $adr['country']);
-        $adr['countrytxt'] = $res->fetchOneCell();
-    }
-    if (isset($adr['countrytxt']) && $adr['countrytxt']) {
-        $t .= "\n".$adr['countrytxt'];
-    }
-    return trim($t);
-}
-// }}}
-// {{{ compare_addresses_text($a, $b)
-/** compares if two address matches
- * @param $a the raw text of an address
- * @param $b the raw text of a complete valid address
- */
-function compare_addresses_text($a, $b)
-{
-    $ta = strtoupper(preg_replace(array("/[0-9,\"'#~:;_\- ]/", "/\r\n/"), array("", "\n"), $a));
-    $tb = strtoupper(preg_replace(array("/[0-9,\"'#~:;_\- ]/", "/\r\n/"), array("", "\n"), $b));
-
-    $la = explode("\n", $ta);
-    $lb = explode("\n", $tb);
-
-    if (count($lb) > count($la) + 1) {
-        return false;
-    }
-    foreach ($la as $i => $l) {
-        if (levenshtein(trim($l), trim($lb[$i])) > 3) {
-            return false;
-        }
-    }
-    return true;
-}
-
-// }}}
-// {{{ localize_addresses($uid)
-/* localize all the address of a user and modify the database
- * if the new address match with the old one
- * @param $uid the id of the user
- */
-function localize_addresses($uid)
-{
-    $res = XDB::iterator("SELECT  *
-                            FROM  adresses
-                           WHERE  uid = {?} and (cityid IS NULL OR cityid = 0)", $uid);
-    $erreur = Array();
-
-    while ($a = $res->next()) {
-        $new = get_address_infos($ta = get_address_text($a));
-        if (compare_addresses_text($ta, get_address_text($new))) {
-            XDB::execute("UPDATE  adresses
-                             SET  adr1 = {?}, adr2 = {?}, adr3 = {?},
-                                  cityid = {?}, city = {?}, postcode = {?},
-                                  region = {?}, regiontxt = {?}, country = {?},
-                                  glat = {?}, glng = {?}
-                           WHERE  uid = {?} AND adrid = {?}",
-                          $new['adr1'], $new['adr2'], $new['adr3'],
-                          $new['cityid'], $new['city'], $new['postcode'],
-                          $new['region'], $new['regiontxt'], $new['country'],
-                          $new['precise_lat'], $new['precise_lon'],
-                          $uid, $a['adrid']);
-            $new['store'] = true;
-            if (!$new['cityid']) {
-                $erreur[$a['adrid']] = $new;
-            }
-        } else {
-            $new['store'] = false;
-            $erreur[$a['adrid']] = $new;
-        }
-    }
-    return $erreur;
-}
-// }}}
-// {{{ get_address_infos($txt)
-/** retrieve the infos on a text address
- * store on the fly the info of the city concerned
- * @param $txt the raw text of an address
- */
-
-function get_address_infos($txt)
-{
-    global $globals;
-
-    $url = $globals->geoloc->webservice_url."address.php?precise=1&txt=" . urlencode($txt);
-    if ($globals->debug & DEBUG_BT) {
-        if (!isset(PlBacktrace::$bt['Geoloc'])) {
-            new PlBacktrace('Geoloc');
-        }
-        PlBacktrace::$bt['Geoloc']->start($url);
-    }
-    $f = @fopen($url, 'r');
-    if ($f === false) {
-        if ($globals->debug & DEBUG_BT) {
-            PlBacktrace::$bt['Geoloc']->stop(0, 'Can\'t fetch result');
-        }
-        return false;
-    }
-    $keys = explode('|',fgets($f));
-    $vals = explode('|',fgets($f));
-    if ($globals->debug & DEBUG_BT) {
-        $data = array();
-        for ($i = 0 ; $i < count($keys) ; ++$i) {
-            $data[] = array($keys[$i], $vals[$i]);
-        }
-        PlBacktrace::$bt['Geoloc']->stop(count($keys), null, $data);
-    }
-    $infos = empty_address();
-    foreach ($keys as $i=>$key) {
-        if($vals[$i]) {
-            if ($key == 'sql') {
-                $infos[$key] = $vals[$i];
-            } else {
-                $val = strtr($vals[$i], array(chr(197).chr(147) => "&oelig;"));
-                $infos[$key] = $val;
-            }
-        }
-    }
-    if (empty($infos['country'])) {
-        $infos['country'] = '00';
-    }
-    if (isset($infos['sql']) && $infos['sql']) {
-        $sql = explode(', ', trim($infos['sql'], '()'));
-        if (count($sql) == 16) {
-            for ($i = 0 ; $i < 16 ; ++$i) {
-                $sql[$i] = stripslashes(trim($sql[$i], ' \''));
-            }
-            XDB::execute("REPLACE INTO  geoloc_city
-                                VALUES  ({?}, {?}, {?}, {?}, {?}, {?},
-                                         {?}, {?}, {?}, {?}, {?}, {?},
-                                         {?}, {?}, {?}, {?})",
-                         $sql[0], $sql[1], $sql[2], $sql[3], $sql[4], $sql[5],
-                         $sql[6], $sql[7], $sql[8], $sql[9], $sql[10], $sql[11],
-                         $sql[12], $sql[13], $sql[14], $sql[15]);
-        }
-    }
-    if (isset($infos['display']) && $infos['display'])
-        XDB::execute("UPDATE  geoloc_pays
-                         SET  display = {?}
-                       WHERE  a2 = {?}", $infos['display'], $infos['country']);
-    if (isset($infos['cityid'])) {
-        fix_cities_not_on_map(1, $infos['cityid']);
-        if (floatval($infos['precise_lat']) && floatval($infos['precise_lon'])) {
-            $res = XDB::query("SELECT  c.lat / 100000, c.lon / 100000
-                                 FROM  geoloc_city AS c
-                                WHERE  c.id = {?}", $infos['cityid']);
-            if ($res->numRows()) {
-                list($glat, $glng) = $res->fetchOneRow();
-                $infos['precise_lat'] = $glat;
-                $infos['precise_lon'] = $glng;
-            }
-        }
-    }
-    return $infos;
-}
-
-// }}}
-// {{{ synchro_city($id)
-/** synchronise the local geoloc_city base to geoloc.org
- * @param $id the id of the city to synchronize
- */
-function synchro_city($id)
-{
-    global $globals;
-    $url = $globals->geoloc->webservice_url."cityFinder.php?method=id&id=".$id."&out=sql";
-    if (!($f = @fopen($url, 'r'))) {
-        return false;
-    }
-    $s = fgets($f);
-    if ($s) {
-        return XDB::execute("REPLACE INTO geoloc_city VALUES ".$s) > 0;
-    }
-}
- // }}}
-// {{{ function fix_cities_not_on_map($limit)
-function fix_cities_not_on_map($limit=false, $cityid=false)
-{
-    $missing = XDB::query("SELECT  c.id
-                             FROM  geoloc_city AS c
-                        LEFT JOIN  geoloc_city_in_maps AS m ON(c.id = m.city_id)
-                            WHERE  m.city_id IS NULL"
-                            . ($cityid ? " AND c.id = '" . $cityid . "'" : "" )
-                            . ($limit ?  " LIMIT $limit" : "" ));
-    $maps = get_cities_maps($missing->fetchColumn());
-    if ($maps) {
-        $values = "";
-        foreach ($maps as $cityid => $maps_c) {
-            foreach ($maps_c as $map_id) {
-                $values .= ",($cityid, $map_id, '')";
-            }
-        }
-        if (strlen($values) > 1) {
-            XDB::execute("REPLACE INTO  geoloc_city_in_maps
-                                VALUES  ".substr($values, 1));
-        }
-    } else {
-        return false;
-    }
-    return true;
-}
-
-function set_smallest_levels()
-{
-    $maxlengths = XDB::iterRow("SELECT  MAX(LENGTH(gm.path)), gcim.city_id
-                                  FROM  geoloc_city_in_maps AS gcim
-                            INNER JOIN  geoloc_maps AS gm USING ( map_id )
-                              GROUP BY  gcim.city_id");
-    while (list($length, $id) = $maxlengths->next()) {
-        XDB::execute("UPDATE  geoloc_city_in_maps AS gcim
-                  INNER JOIN  geoloc_maps AS gm USING(map_id)
-                         SET  gcim.infos = IF(LENGTH(gm.path) = {?}, 'smallest', '')
-                       WHERE  gcim.city_id = {?}", $length, $id);
-    }
-    return true;
-}
-// }}}
-// {{{ geoloc_country($current, $avail_only = false)
-/** donne la liste déroulante des pays
- * @param $current pays actuellement selectionné
- */
-function geoloc_country($current, $avail_only = false)
-{
-    if ($avail_only) {
-        $res = XDB::iterRow('SELECT  g.a2, g.pays
-                               FROM  geoloc_pays AS g
-                         INNER JOIN  adresses    AS a ON(a.country = g.a2)
-                           GROUP BY  g.a2
-                           ORDER BY  g.pays');
-    } else {
-        $res = XDB::iterRow('SELECT a2,pays FROM geoloc_pays ORDER BY pays');
-    }
-    $html = "";
-    while (list($my_id, $my_pays) = $res->next()) {
-        $html .= sprintf("<option value=\"%s\" %s>%s</option>\n",
-                         $my_id, ($current==$my_id?"selected='selected'":""), $my_pays);
-    }
-    return $html;
-}
-
-// }}}
-// {{{ geoloc_region($country, $current, $avail_only = false)
-/** donne la liste deroulante des regions pour un pays
- * @param $pays le pays dont on veut afficher les regions
- * @param $current la region actuellement selectionnee
- */
-function geoloc_region($country, $current, $avail_only = false)
-{
-    if ($avail_only) {
-        $res = XDB::iterRow('SELECT  r.region, r.name
-                               FROM  geoloc_region AS r
-                         INNER JOIN  adresses      AS a ON (a.country = r.a2 AND a.region = r.region)
-                              WHERE  r.a2 = {?}
-                           GROUP BY  r.region
-                           ORDER BY  r.name', $country);
-    } else {
-        $res = XDB::iterRow('SELECT  region,name
-                               FROM  geoloc_region
-                              WHERE  a2 = {?}
-                           ORDER BY  name', $country);
-    }
-    $html = "<option value=\"\"></option>";
-    while (list($regid, $regname) = $res->next()) {
-        $html .= sprintf("<option value=\"%s\" %s>%s</option>\n",
-                 $regid, ($current==$regid?"selected='selected'":""), $regname);
-    }
-    return $html;
-}
-// }}}
-// {{{ get_cities_maps($array)
-/* get all the maps id of the cities contained in an array */
-function get_cities_maps($array)
-{
-    global $globals;
-    implode("\n",$array);
-    $url = $globals->geoloc->webservice_url."findMaps.php?datatext=".urlencode(implode("\n", $array));
-    if (!($f = @fopen($url, 'r'))) return false;
-    $maps = array();
-    while (!feof($f))
-    {
-        $l = trim(fgets($f));
-        $tab = explode(';', $l);
-        $i = $tab[0];
-        unset($tab[0]);
-        $maps[$i] = $tab;
-    }
-    return $maps;
-}
-// }}}
-// {{{ get_new_maps($url)
-/** set new maps from url **/
-function get_new_maps($url)
-{
-    if (!($f = @fopen($url, 'r'))) {
-        return false;
-    }
-    XDB::query('TRUNCATE TABLE geoloc_maps');
-    $s = '';
-    while (!feof($f)) {
-        $l = fgetcsv($f, 1024, ';', '"');
-        foreach ($l as $i => $val) {
-            if ($val != 'NULL') {
-                $l[$i] = '\''.addslashes($val).'\'';
-            }
-        }
-        $s .= ',('.implode(',',$l).')';
-    }
-    XDB::execute('INSERT INTO geoloc_maps VALUES '.substr($s, 1));
-    return true;
-}
-// }}}
-
-function geoloc_to_x($lon, $lat)
-{
-    return deg2rad(1) * $lon *100;
-}
-
-function geoloc_to_y($lon, $lat)
-{
-    if ($lat < -75) {
-        return latToY(-75);
-    }
-    if ($lat > 75) {
-        return latToY(75);
-    }
-    return -100 * log(tan(pi()/4 + deg2rad(1)/2*$lat));
-}
-
-function size_of_city($nb)
-{
-    $s = round(log($nb + 1)*2,2);
-    if ($s < 1) {
-        return 1;
-    }
-    return $s;
-}
-
-function size_of_territory($nb)
-{
-    return size_of_city($nb);
-}
-
-function geoloc_getData_subcities($mapid, $SFields, &$cities, $direct=true)
-{
-    if ($SFields instanceof UserSet) {
-        $set = $SFields;
-        $SFields = array();
-    } else {
-        $set = new UserSet();
-    }
-    for ($i_mapfield=0; $i_mapfield < count($SFields) ; $i_mapfield++) {
-        if ($SFields[$i_mapfield]->fieldFormName == 'mapid') {
-            break;
-        }
-    }
-    $SFields[$i_mapfield] = new MapSField('mapid',
-                                          array('gcim.map_id'),
-                                          array('adresses','geoloc_city_in_maps'),
-                                          array('am','gcim'),
-                                          array(getadr_join('am'), 'am.cityid = gcim.city_id'),
-                                          $mapid);
-    $fields = new SFieldGroup(true, $SFields);
-    $where = $fields->get_where_statement();
-    $joins = $fields->get_select_statement();
-    if ($where) {
-        $where .= ' AND ';
-    }
-    $cityres = $set->get('gc.id,
-                          gc.lon / 100000 AS x, gc.lat/100000 AS y,
-                          gc.name,
-                          COUNT(u.user_id) AS pop,
-                          SUM(u.promo % 2) AS yellow',
-                          "$joins
-                          LEFT JOIN  geoloc_city  AS gc ON(gcim.city_id = gc.id)",
-                          $where . ($direct ? "gcim.infos = 'smallest'" : '1'),
-                          'gc.id, gc.alias',
-                          'pop DESC');
-    foreach($cityres as $c) {
-        if ($c['pop'] > 0) {
-            $city = $c;
-            $city['x'] = geoloc_to_x($c['x'], $c['y']);
-            $city['y'] = geoloc_to_y($c['x'], $c['y']);
-            $city['size'] = size_of_city($c['pop']);
-            $cities[$c['id']] = $city;
-        }
-    }
-}
-
-function geoloc_getData_subcountries($mapid, $sin, $minentities)
-{
-    $countries = array();
-    $cities = array();
-
-    if ($mapid === false) {
-        $wheremapid = "WHERE gm.parent IS NULL";
-    } else {
-        $wheremapid = "WHERE   gm.parent = {?}";
-    }
-    $submapres = XDB::iterator(
-        "SELECT  gm.map_id AS id, gm.name, gm.x, gm.y, gm.xclip, gm.yclip,
-                 gm.width, gm.height, gm.scale, 1 AS rat
-           FROM  geoloc_maps AS gm
-        ". $wheremapid, Env::v('mapid',''));
-
-    global $globals;
-
-    while ($c = $submapres->next()) {
-        $country = $c;
-        $country['color'] = 0xFFFFFF;
-        $country['swf'] = $globals->geoloc->webservice_url."maps/mercator/map_".$c['id'].".swf";
-        $countries[$c['id']] = $country;
-    }
-
-    if ($mapid === false) {
-        return array($countries, $cities);
-    }
-
-    geoloc_getData_subcities(Env::i('mapid'), $sin, $cities);
-    $nbcities = count($cities);
-    $nocity = $nbcities == 0;
-    if ($sin instanceof UserSet) {
-        $set = $sin;
-        $SFields = array();
-    } else {
-        $set = new UserSet();
-        $SFields = $sin;
-    }
-
-    for ($i_mapfield=0; $i_mapfield < count($SFields) ; $i_mapfield++) {
-        if ($SFields[$i_mapfield]->fieldFormName == 'mapid') {
-            break;
-        }
-    }
-    $SFields[$i_mapfield] = new MapSField('mapid',
-                                          array('map.parent'),
-                                          array('adresses','geoloc_city_in_maps','geoloc_maps'),
-                                          array('am','gcim','map'),
-                                          array(getadr_join('am'),
-                                          'am.cityid = gcim.city_id',
-                                          'map.map_id = gcim.map_id'));
-    $fields = new SFieldGroup(true, $SFields);
-    $where  = $fields->get_where_statement();
-    $joins  = $fields->get_select_statement();
-    $countryres = $set->get('map.map_id AS id,
-                             COUNT(u.user_id) AS nbPop,
-                             SUM(u.promo % 2) AS yellow,
-                             COUNT(DISTINCT gcim.city_id) AS nbCities,
-                             SUM(IF(u.user_id IS NULL,0,am.glng)) AS lonPop,
-                             SUM(IF(u.user_id IS NULL, 0,am.glat)) AS latPop',
-                            $joins,
-                            $where,
-                            'map.map_id',
-                            'NULL');
-
-    $maxpop = 0;
-    $nbentities = $nbcities + count($countryres);
-    foreach ($countryres as $c) {
-        $c['latPop'] /= $c['nbPop'];
-        $c['lonPop'] /= $c['nbPop'];
-        $c['rad'] = size_of_territory($c['nbPop']);
-        if ($maxpop < $c['nbPop']) $maxpop = $c['nbPop'];
-        $c['xPop'] = geoloc_to_x($c['lonPop'], $c['latPop']);
-        $c['yPop'] = geoloc_to_y($c['lonPop'], $c['latPop']);
-        @$countries[$c['id']] = array_merge($countries[$c['id']], $c);
-
-        $nbcities += $c['nbCities'];
-    }
-
-    if ($nocity && $nbcities < $minentities){
-        foreach($countries as $i => $c) {
-            $countries[$i]['nbPop'] = 0;
-            if (@$c['nbCities'] > 0) {
-                geoloc_getData_subcities($c['id'], $sin, $cities, false);
-            }
-        }
-    }
-
-    foreach ($countries as $i => $c) {
-        if (@$c['nbPop'] > 0) {
-            $lambda = pow($c['nbPop'] / $maxpop,0.3);
-            $countries[$i]['color'] = 0x0000FF + round((1-$lambda) * 0xFF)*0x010100;
-        }
-    }
-
-    return array($countries, $cities);
-}
-
-// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
-?>
index 5251d44..be9e740 100644 (file)
@@ -367,102 +367,6 @@ class TrombiView extends MultipageView
     }
 }
 
-class GeolocView implements PlView
-{
-    private $set;
-    private $type;
-    private $params;
-
-    public function __construct(PlSet &$set, $data, array $params)
-    {
-        $this->params = $params;
-        $this->set   =& $set;
-        $this->type   = $data;
-    }
-
-    private function use_map()
-    {
-        return is_file(dirname(__FILE__) . '/../modules/geoloc/dynamap.swf') &&
-               is_file(dirname(__FILE__) . '/../modules/geoloc/icon.swf');
-    }
-
-    public function args()
-    {
-        $args = $this->set->args();
-        unset($args['initfile']);
-        unset($args['mapid']);
-        return $args;
-    }
-
-    public function apply(PlPage &$page)
-    {
-        require_once 'geoloc.inc.php';
-        require_once '../modules/search/search.inc.php';
-
-        switch ($this->type) {
-          case 'icon.swf':
-            header("Content-type: application/x-shockwave-flash");
-            header("Pragma:");
-            readfile(dirname(__FILE__).'/../modules/geoloc/icon.swf');
-            exit;
-
-          case 'dynamap.swf':
-            header("Content-type: application/x-shockwave-flash");
-            header("Pragma:");
-            readfile(dirname(__FILE__).'/../modules/geoloc/dynamap.swf');
-            exit;
-
-          case 'init':
-            $page->changeTpl('geoloc/init.tpl', NO_SKIN);
-            header('Content-Type: text/xml');
-            header('Pragma:');
-            if (!empty($GLOBALS['IS_XNET_SITE'])) {
-                $page->assign('background', 0xF2E9D0);
-            }
-            break;
-
-          case 'city':
-            $page->changeTpl('geoloc/city.tpl', NO_SKIN);
-            header('Content-Type: text/xml');
-            header('Pragma:');
-            $only_current = Env::v('only_current', false)? ' AND FIND_IN_SET(\'current\', adrf.flags)' : '';
-            $it =& $this->set->get('u.user_id AS id, u.prenom, u.nom, d.promo, al.alias',
-                                   "INNER JOIN  profile-addresses AS adrf ON (adrf.pid = u.user_id $only_current)
-                                    INNER JOIN  profile_display   AS d    ON (d.pid = u.user_id)
-                                     LEFT JOIN  aliases           AS al   ON (u.user_id = al.id
-                                                                            AND FIND_IN_SET('bestalias', al.flags))
-                                    INNER JOIN  profile_addresses AS avg  ON (" . getadr_join('avg') . ")",
-                                   'adrf.localityId = ' . Env::i('cityid'), null, null, 11);
-            $page->assign('users', $it);
-            break;
-
-          case 'country':
-            if (Env::has('debug')) {
-                $page->changeTpl('geoloc/country.tpl', SIMPLE);
-            } else {
-                $page->changeTpl('geoloc/country.tpl', NO_SKIN);
-                header('Content-Type: text/xml');
-                header('Pragma:');
-            }
-            $mapid = Env::has('mapid') ? Env::i('mapid', -2) : false;
-            list($countries, $cities) = geoloc_getData_subcountries($mapid, $this->set, 10);
-            $page->assign('countries', $countries);
-            $page->assign('cities', $cities);
-            break;
-
-          default:
-            global $globals;
-            if (!$this->use_map()) {
-                $page->assign('request_geodesix', true);
-            }
-            $page->assign('annu', @$this->params['with_annu']);
-            $page->assign('protocole', @$_SERVER['HTTPS'] ? 'https' : 'http');
-            $this->set->get('u.user_id', null, "u.perms != 'pending' AND u.deces = 0", "u.user_id", null);
-            return 'include/plview.geoloc.tpl';
-        }
-    }
-}
-
 class GadgetView implements PlView
 {
     public function __construct(PlSet &$set, $data, array $params)
index 191c6c5..c51aec9 100644 (file)
@@ -128,9 +128,8 @@ class EventsModule extends PLModule
         $page->assign('photo_incitation', $res->fetchOneCell() == 0);
 
         // Geo-location onebox.
-        require_once 'geoloc.inc.php';
-        $res = localize_addresses(S::user()->id());
-        $page->assign('geoloc_incitation', count($res));
+        require_once "geocoding.inc.php";
+        $page->assign('geoloc_incitation', Geocoder::countNonGeocoded(S::user()->id()));
 
         // Direct link to the RSS feed, when available.
         if (S::rssActivated()) {
diff --git a/modules/geoloc.php b/modules/geoloc.php
deleted file mode 100644 (file)
index bb63263..0000000
+++ /dev/null
@@ -1,159 +0,0 @@
-<?php
-/***************************************************************************
- *  Copyright (C) 2003-2009 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 GeolocModule extends PLModule
-{
-    function handlers()
-    {
-        return array(
-            'geoloc'             => $this->make_hook('default', AUTH_COOKIE),
-            'admin/geoloc'           => $this->make_hook('admin', AUTH_MDP, 'admin'),
-            'admin/geoloc/dynamap'   => $this->make_hook('admin_dynamap', AUTH_MDP, 'admin'),
-            'admin/geoloc/country'   => $this->make_hook('admin_country',  AUTH_MDP, 'admin')
-        );
-    }
-
-    function handler_default(&$page, $action = null, $subaction = null)
-    {
-        global $globals;
-
-        $set = new UserSet();
-        $set->addMod('geoloc', 'Geolocalisation', true);
-        $set->apply('geoloc', $page, $action, $subaction);
-    }
-
-    function handler_admin(&$page, $action = false) {
-        $page->changeTpl('geoloc/admin.tpl');
-        require_once("geoloc.inc.php");
-        $page->setTitle('Administration - Geolocalisation');
-
-        $nb_synchro = 0;
-
-        if (Env::has('id') && is_numeric(Env::v('id'))) {
-            if (synchro_city(Env::v('id'))) $nb_synchro ++;
-        }
-
-        if ($action == 'missinglat') {
-            $res = XDB::iterRow("SELECT id FROM geoloc_city WHERE lat = 0 AND lon = 0");
-            while ($a = $res->next()) if (synchro_city($a[0])) $nb_synchro++;
-        }
-
-        if ($nb_synchro)
-            $page->trigSuccess(($nb_synchro > 1)?($nb_synchro." villes ont été synchronisées"):"Une ville a été synchronisée");
-
-        $res = XDB::query("SELECT COUNT(*) FROM geoloc_city WHERE lat = 0 AND lon = 0");
-        $page->assign("nb_missinglat", $res->fetchOneCell());
-    }
-
-    function handler_admin_dynamap(&$page, $action = false) {
-        $page->changeTpl('geoloc/admin_dynamap.tpl');
-
-        if ($action == 'cities_not_on_map') {
-            require_once('geoloc.inc.php');
-            if (!fix_cities_not_on_map(20))
-                $page->trigError("Impossible d'accéder au webservice");
-            else
-                $refresh = true;
-        }
-
-        if ($action == 'smallest_maps') {
-            require_once('geoloc.inc.php');
-            set_smallest_levels();
-        }
-
-        if ($action == 'precise_coordinates') {
-            XDB::execute("UPDATE  adresses AS a
-                      INNER JOIN  geoloc_city AS c ON(a.cityid = c.id)
-                             SET  a.glat = c.lat / 100000, a.glng = c.lon / 100000");
-        }
-
-        if ($action == 'newmaps') {
-            require_once('geoloc.inc.php');
-            if (!get_new_maps(Env::v('url')))
-                $page->trigError("Impossible d'accéder aux nouvelles cartes");
-        }
-
-        $countMissing = XDB::query("SELECT COUNT(*) FROM geoloc_city AS c LEFT JOIN geoloc_city_in_maps AS m ON(c.id = m.city_id) WHERE m.city_id IS NULL");
-        $missing = $countMissing->fetchOneCell();
-
-        $countNoSmallest = XDB::query("SELECT SUM(IF(infos = 'smallest',1,0)) AS n FROM geoloc_city_in_maps GROUP BY city_id ORDER BY n");
-        $noSmallest = $countNoSmallest->fetchOneCell() == 0;
-
-        $countNoCoordinates = XDB::query("SELECT COUNT(*) FROM adresses WHERE cityid IS NOT NULL AND glat = 0 AND glng = 0");
-        $noCoordinates = $countNoCoordinates->fetchOneCell();
-
-        if (isset($refresh) && $missing) {
-            $page->assign("pl_extra_header", "<meta http-equiv='Refresh' content='3'/>");
-        }
-        $page->assign("nb_cities_not_on_map", $missing);
-        $page->assign("no_smallest", $noSmallest);
-        $page->assign("no_coordinates", $noCoordinates);
-    }
-
-    function handler_admin_country(&$page, $action = 'list', $id = null)
-    {
-        $page->assign('xorg_title', 'Polytechnique.org - Administration - Pays');
-        $page->assign('title', 'Gestion des pays');
-        $table_editor = new PLTableEditor('admin/geoloc/country', 'geoloc_pays', 'a2', true);
-        $table_editor->describe('a2', 'alpha-2', true);
-        $table_editor->describe('a3', 'alpha-3', false);
-        $table_editor->describe('n3', 'ISO numeric', false);
-        $table_editor->describe('num', 'num', false);
-        $table_editor->describe('worldrgn', 'Continent', false);
-        $table_editor->describe('subd', 'Subdivisions territoriales', false);
-        $table_editor->describe('post', 'post', false);
-        $table_editor->describe('pays', 'Nom (fr)', true);
-        $table_editor->describe('country', 'Nom (en)', true);
-        $table_editor->describe('phoneprf', 'Préfixe téléphonique', true);
-        $table_editor->describe('phoneformat', 'Format du téléphone (ex: (+p) ### ## ## ##)', false);
-        $table_editor->describe('capital', 'Capitale', true);
-        $table_editor->describe('nat', 'Nationalité', true);
-        $table_editor->describe('display', 'Format des adresses', false);
-
-        if ($action == 'update') {
-            if (Post::has('a2') && (Post::v('a2') == $id) && Post::has('phoneprf') && (Post::v('phoneprf') != '')) {
-                if (Post::has('phoneformat')) {
-                    $new_format = Post::v('phoneformat');
-                } else {
-                    $new_format = '';
-                }
-                $res = XDB::query("SELECT phoneformat
-                                     FROM geoloc_pays
-                                    WHERE phoneprf = {?}
-                                    LIMIT 1",
-                                  Post::v('phoneprf'));
-                $old_format = $res->fetchOneCell();
-                if ($new_format != $old_format) {
-                    require_once("profil.func.inc.php");
-                    XDB::execute("UPDATE  geoloc_pays
-                                     SET  phoneformat = {?}
-                                   WHERE  phoneprf = {?}",
-                                 $new_format, Post::v('phoneprf'));
-                }
-            }
-        }
-        $table_editor->apply($page, $action, $id);
-    }
-
-}
-
-// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
-?>
diff --git a/modules/geoloc/.gitignore b/modules/geoloc/.gitignore
deleted file mode 100644 (file)
index da97ff7..0000000
+++ /dev/null
@@ -1 +0,0 @@
-*.swf
index 2e9b8c2..5de721d 100644 (file)
@@ -153,6 +153,10 @@ class ProfileMentor extends ProfilePage
     {
         $page->assign('secteurs_sel', XDB::iterator("SELECT  id, name AS label
                                                        FROM  profile_job_sector_enum"));
+
+        $page->assign('countryList', XDB::iterator("SELECT  iso_3166_1_a2, countryFR
+                                                      FROM  geoloc_countries
+                                                  ORDER BY  countryFR"));
     }
 }
 
index 47af0b0..7114a2b 100644 (file)
@@ -39,7 +39,7 @@ function display_address_isIdentity($idt, $value, $test_reverse = true)
 function smarty_function_display_address($param, &$smarty)
 {
     require_once('geoloc.inc.php');
-    $txtad = get_address_text($param['adr']);
+    $txtad = $param['adr']['text'];
     if (!$txtad && !$param['adr']['tels'] && !count($param['adr']['tels'])) {
         return "";
     }
diff --git a/plugins/function.geoloc_country.php b/plugins/function.geoloc_country.php
deleted file mode 100644 (file)
index fd4c8d9..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-<?php
-/***************************************************************************
- *  Copyright (C) 2003-2009 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                *
- ***************************************************************************/
-
-function smarty_function_geoloc_country($params, &$smarty) {
-    require_once 'geoloc.inc.php';
-    if(!isset($params['country'])) {
-        return;
-    }
-    return geoloc_country($params['country'], @$params['available']);
-}
-
-// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
-?>
diff --git a/plugins/function.geoloc_region.php b/plugins/function.geoloc_region.php
deleted file mode 100644 (file)
index 1a66dae..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-<?php
-/***************************************************************************
- *  Copyright (C) 2003-2009 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                *
- ***************************************************************************/
-
-function smarty_function_geoloc_region($params, &$smarty) {
-    require_once 'geoloc.inc.php';
-    if(!isset($params['country']) || !isset($params['region'])) {
-        return;
-    }
-    return geoloc_region($params['country'], $params['region'], @$params['available']);
-}
-
-// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
-?>
index ddf1c01..4fa3591 100644 (file)
     </td>
   </tr>
   <tr class="impair">
-    <td class="titre">Géoloc</td>
-    <td>
-      <a href="admin/geoloc">Synchro</a>
-      &nbsp;&nbsp;|&nbsp;&nbsp;
-      <a href="admin/geoloc/dynamap">Dynamap</a>
-    </td>
-  </tr>
-  <tr class="pair">
     <td class="titre">Compte</td>
     <td>
       <a href="admin/skins">Skins</a>
diff --git a/templates/geoloc/admin.tpl b/templates/geoloc/admin.tpl
deleted file mode 100644 (file)
index 9cbe2e1..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-{**************************************************************************}
-{*                                                                        *}
-{*  Copyright (C) 2003-2009 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>Geoloc</h1>
-<h2>Synchroniser des villes avec geoloc.org</h2>
-
-{if $nb_missinglat}
-<p>[<a href='admin/geoloc/missinglat'>toutes les villes sans coordonnées ({$nb_missinglat})</a>]</p>
-{/if}
-
-<form action='admin/geoloc' method='post'>
-<p>
-La ville dont l'id est&nbsp;: <input size="6" name="id" />
-</p>
-</form>
-{* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *}
diff --git a/templates/geoloc/admin_dynamap.tpl b/templates/geoloc/admin_dynamap.tpl
deleted file mode 100644 (file)
index 490acd9..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-{**************************************************************************}
-{*                                                                        *}
-{*  Copyright (C) 2003-2009 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>
-  Administration de la dynamap
-</h1>
-
-<h2>
-  Utiliser de nouvelles cartes
-</h2>
-  <form action='admin/geoloc/dynamaps/newmaps' method='post'>
-    <p>
-      <input type='text' name='url' value='{$smarty.request.url|default:"url des données des cartes"}' onfocus='select()' size='40'/>
-         <br/>
-      <input type='submit'/>
-    </p>
-  </form>
-  
-<h2>
-  Placement des villes sur les cartes
-</h2>
-{if $nb_cities_not_on_map}
-  <p>
-    Il y a {$nb_cities_not_on_map} villes qui ne sont pas placées dans les cartes.
-    [<a href='admin/geoloc/dynamap/cities_not_on_map'>Réparer</a>]
-  </p>
-{else}
-  <p> Toutes les villes de la base sont placées dans des cartes. </p>
-{/if}
-{if $no_smallest}
-  <p>
-    Il faut <a href='admin/geoloc/dynamap/smallest_maps'>définir la plus petite carte</a>
-    pour chaque ville (à ne faire qu'une fois quand on a placé toutes les villes).
-  </p>
-{/if}
-{if $no_coordinates}
-<h2>
-  Placement précis des adresses
-</h2>
-<p>
-  {$no_coordinates} adresses n'ont pas été bien reconnues précisément.
-  [<a href='admin/geoloc/dynamap/precise_coordinates'>Mettre les coordonnées du centre de la ville</a>]
-</p>
-{/if}
-{* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *}
diff --git a/templates/geoloc/city.tpl b/templates/geoloc/city.tpl
deleted file mode 100644 (file)
index d7fa392..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-{**************************************************************************}\r
-{*                                                                        *}\r
-{*  Copyright (C) 2003-2009 Polytechnique.org                             *}\r
-{*  http://opensource.polytechnique.org/                                  *}\r
-{*                                                                        *}\r
-{*  This program is free software; you can redistribute it and/or modify  *}\r
-{*  it under the terms of the GNU General Public License as published by  *}\r
-{*  the Free Software Foundation; either version 2 of the License, or     *}\r
-{*  (at your option) any later version.                                   *}\r
-{*                                                                        *}\r
-{*  This program is distributed in the hope that it will be useful,       *}\r
-{*  but WITHOUT ANY WARRANTY; without even the implied warranty of        *}\r
-{*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *}\r
-{*  GNU General Public License for more details.                          *}\r
-{*                                                                        *}\r
-{*  You should have received a copy of the GNU General Public License     *}\r
-{*  along with this program; if not, write to the Free Software           *}\r
-{*  Foundation, Inc.,                                                     *}\r
-{*  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA               *}\r
-{*                                                                        *}\r
-<?xml version="1.0" encoding="utf-8"?>\r
-<city id="{$smarty.request.cityid}">\r
-  {assign var="beginning" value=true}\r
-  {assign var="nb_displayed" value=0}\r
-  {foreach from=$users item="user"}{if !$beginning}<br/>{/if}{if $nb_displayed < 10}<a href="javascript:ficheXorg('{$user.alias}');">{$user.prenom} {$user.nom|strtolower|ucwords} - {$user.promo}</a>{else}<a href="javascript:clickOnCity({$smarty.request.cityid})">...</a>{/if}{assign var="nb_displayed" value=$nb_displayed+1}{assign var="beginning" value=false}{/foreach}\r
-</city>\r
-{* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *}\r
diff --git a/templates/geoloc/country.tpl b/templates/geoloc/country.tpl
deleted file mode 100644 (file)
index 46e2f18..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-{**************************************************************************}\r
-{*                                                                        *}\r
-{*  Copyright (C) 2003-2009 Polytechnique.org                             *}\r
-{*  http://opensource.polytechnique.org/                                  *}\r
-{*                                                                        *}\r
-{*  This program is free software; you can redistribute it and/or modify  *}\r
-{*  it under the terms of the GNU General Public License as published by  *}\r
-{*  the Free Software Foundation; either version 2 of the License, or     *}\r
-{*  (at your option) any later version.                                   *}\r
-{*                                                                        *}\r
-{*  This program is distributed in the hope that it will be useful,       *}\r
-{*  but WITHOUT ANY WARRANTY; without even the implied warranty of        *}\r
-{*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *}\r
-{*  GNU General Public License for more details.                          *}\r
-{*                                                                        *}\r
-{*  You should have received a copy of the GNU General Public License     *}\r
-{*  along with this program; if not, write to the Free Software           *}\r
-{*  Foundation, Inc.,                                                     *}\r
-{*  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA               *}\r
-{*                                                                        *}\r
-{**************************************************************************}\r
-<?xml version="1.0" encoding="utf-8"?>\r
-<country id="{$smarty.request.mapid}">\r
-  <countries>\r
-    {foreach from=$countries item="country"}\r
-    <country id="{$country.id}" name="{$country.name}">\r
-      <file swf="{$country.swf}" scale="{$country.scale}" xclip="{$country.xclip}" yclip="{$country.yclip}">\r
-        <color value="{$country.color}"/>\r
-      </file>\r
-      {if $country.nbPop > 0 or $country.id eq 0}\r
-      <map x="{$country.x}" y="{$country.y}" height="{$country.height}" width="{$country.width}" ratio="{$country.rat}"/>\r
-      <icon x="{$country.xPop}" y="{$country.yPop}" nb="{$country.nbPop}" size="{$country.rad}" name="{$country.name}" green="{if $country.nbPop}{$country.yellow/$country.nbPop}{else}0{/if}" blue="0" alpha="0.7"/>\r
-      <moreinfos url="country{$plset_search|escape_html}mapid={$country.id}"/>\r
-      {/if}\r
-    </country>\r
-    {/foreach}\r
-  </countries>\r
-  <cities>\r
-    {foreach from=$cities item="city"}\r
-    <city id="{$city.id}" name="{$city.name}">\r
-      <icon x="{$city.x}" y="{$city.y}" nb="{$city.pop}" size="{$city.size}" name="{$city.name}" green="{if $city.pop}{$city.yellow/$city.pop}{else}0{/if}" blue="0"/>\r
-      <moreinfos url="city{$plset_search|escape_html}cityid={$city.id}"/>\r
-    </city>\r
-    {/foreach}\r
-  </cities>\r
-</country>\r
-{* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *}\r
diff --git a/templates/geoloc/init.tpl b/templates/geoloc/init.tpl
deleted file mode 100644 (file)
index 9fdda87..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-{**************************************************************************}
-{*                                                                        *}
-{*  Copyright (C) 2003-2009 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               *}
-{*                                                                        *}
-{**************************************************************************}
-<config
-grandOncleVisibility="-1"
-tooltipSize="0"
-tooltipDX="0"
-tooltipDY="20"
-panelSize="28"
-citySize="6"
-radius100="1.6"
-radius0="3"
-select="aim"
-aimTween="5"
-transition="2"
-textLookInCity="Rechercher les x dans cette ville"
-textZoomIn="Zoom"
-textGoTo="Va à "
-textZoomBackTo="Revient à "
-textLoading="Chargement"
-textYouAreIn="Tu es dans "
-textSeeMapOfCity="Voir la carte de "
-textYouHaveSelected="Tu as sélectionné "
-{if $background}
-background="{$background}"
-zoomBarBackgroundColor="{$background}"
-{/if} 
-textCopyright="Les règles de l'annuaire s'appliquent aussi à cette application"
-autofolder="true"
-iconSwf="icon.swf"
-scriptInfosArea="country{$plset_search|escape_html}">
-<translation>
-  <text name="Hide/Show labels" value="Montrer/Cacher les étiquettes"/>
-  <text name="- You are in " value="Vous êtes dans "/>
-  <text name="Loading first part of XML data" value="Chargement des données"/>
-  <text name="Loading own map" value="Chargement de la carte principale"/>
-  <text name="Loading XML data" value="Chargement des données"/>
-  <text name="Loading maps of sub-countries" value="Chargement des cartes"/>
-</translation>
-</config>
-{* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *}
diff --git a/templates/include/plview.geoloc.tpl b/templates/include/plview.geoloc.tpl
deleted file mode 100644 (file)
index a0952fd..0000000
+++ /dev/null
@@ -1,84 +0,0 @@
-{**************************************************************************}
-{*                                                                        *}
-{*  Copyright (C) 2003-2009 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               *}
-{*                                                                        *}
-{**************************************************************************}
-
-<script type="text/javascript">//<![CDATA[
-{literal}
-function ficheXorg(id)
-{
-  window.open('{/literal}{if !$annu}https://{#globals.core.secure_domain#}/{/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 $annu}
-var search_url = platal_baseurl + "{$platal->ns}{$annu}{$plset_search|smarty:nodefaults}";
-{literal}
-function clickOnCity(id)
-{
-    window.open(search_url + unescape('%26')+'cityid=' + id, '_blank', '');
-}
-var mapid = 0;
-function goToCountry(id)
-{
-    mapid = id;
-}
-function searchMapId()
-{
-    window.open(search_url + unescape('%26')+'mapid=' + mapid, '_blank', '');
-}
-{/literal}
-{/if}
-
-//]]></script>
-
-{if !$request_geodesix}
-
-  <p class="center">
-  {if $smarty.request.only_current neq 'on'}
-    [<a href="{$platal->ns}{$plset_base}/geoloc{$plset_search}only_current=on">Ne voir que les adresses principales</a>]
-  {else}
-    [<a href="{$platal->ns}{$plset_base}/geoloc{$plset_search|replace:'only_current=on':''}">Voir toutes les adresses</a>]
-  {/if}
-  </p>
-
-  <p class="center">
-  <object
-    type="application/x-shockwave-flash"
-    data="{$platal->ns}{$plset_base}/geoloc/dynamap.swf"
-    width="600"
-    height="450">
-      <param name="movie" value="{$platal->ns}{$plset_base}/geoloc/dynamap.swf"/>
-      <param name="wmode" value="transparent"/>
-      <param name="flashvars" value="initfile=init{$plset_search_enc}"/>
-    </object>
-  </p>
-  {if $annu}
-  <p class="center">
-    <a href="javascript:searchMapId()">Lister les X présents sur cette carte</a>
-  </p>
-  {/if}
-  <p class="smaller">Carte fournie gracieusement par <a href="http://www.geodesix.com/">Geodesix</a>.</p>
-{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 email à 
-<a href="mailto:{#globals.geoloc.email#}">{#globals.geoloc.email#}</a>.</p>
-
-{* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *}
index b9c6b49..5261224 100644 (file)
@@ -38,7 +38,6 @@
     <ul style="padding-top:0px;padding-bottom:0px">
         <li><a href="http://www.polytechnique.net/{$asso.diminutif}/annuaire">annuaire</a></li>
         <li><a href="http://www.polytechnique.net/{$asso.diminutif}/trombi">trombino</a></li>
-        <li><a href="http://www.polytechnique.net/{$asso.diminutif}/geoloc">carte</a></li>
         {if $asso.lists}
             <li><a href="http://www.polytechnique.net/{$asso.diminutif}/lists">listes de diffusion</a></li>
         {/if}
index 6a7abc9..d0a6e18 100644 (file)
         <a href="javascript:addCountry()">{icon name=add title="Ajouter ce pays"}</a>
       </div>
       <select name="countries_sel" onchange="updateCountry()">
-        {geoloc_country country='00'}
+        <option value=""></option>
+        {iterate from=$countryList item=country}
+        <option value="{$country.iso_3166_1_a2}">{$country.countryFR}</option>
+        {/iterate}
       </select>
     </td>
   </tr>
index f73cfb8..e7e00f9 100644 (file)
@@ -65,7 +65,6 @@
 
 <div class="menu_title">Communauté X</div>
 <div class="menu_item"><a href="search">Annuaire</a></div>
-<div class="menu_item"><a href="geoloc">Planisphère</a></div>
 <div class="menu_item"><a href="emploi">Emploi &amp; Carrières</a></div>
 <div class="menu_item"><a href="groupes-x">Mes groupes X</a></div>
 <div class="menu_item"><a href="survey">Sondages</a></div>