From: x2001corpet Date: Tue, 25 Jul 2006 12:59:24 +0000 (+0000) Subject: geoloc pour xnet X-Git-Tag: xorg/0.9.11~266 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=80244bbe5852490f79360c1e3efc3fe61fcda648;p=platal.git geoloc pour xnet git-svn-id: svn+ssh://murphy/home/svn/platal/trunk@645 839d8a87-29fc-0310-9880-83ba4fa771e5 --- diff --git a/htdocs.net/.htaccess b/htdocs.net/.htaccess index 6e2ffaa..c5457d6 100644 --- a/htdocs.net/.htaccess +++ b/htdocs.net/.htaccess @@ -1,7 +1,7 @@ Options +FollowSymLinks RewriteEngine on -RewriteBase /~x2000habouzit +RewriteBase /~x2001corpet # Rewrite URLs of the form 'index.php?q=x': RewriteCond %{REQUEST_FILENAME} !-f diff --git a/htdocs.net/groupe/dynamap.php b/htdocs.net/groupe/dynamap.php deleted file mode 100644 index 07410a4..0000000 --- a/htdocs.net/groupe/dynamap.php +++ /dev/null @@ -1,42 +0,0 @@ - $a) - if ($v != 'initfile') - $querystring .= '&'.urlencode($v).'='.urlencode($a); -$initfile = urlencode('geolocInit.php?'.$querystring); - -if (urlencode(Env::v('initfile')) != $initfile) -{ - header("Location: dynamap.php?initfile=$initfile{$querystring}"); - die(); -} - -header("Content-type: application/x-shockwave-flash"); - -if ($globals->geoloc->use_map) - readfile($globals->geoloc->dynamap_path); - -?> diff --git a/htdocs.net/groupe/geoloc.php b/htdocs.net/groupe/geoloc.php deleted file mode 100644 index c0164bc..0000000 --- a/htdocs.net/groupe/geoloc.php +++ /dev/null @@ -1,34 +0,0 @@ -asso('pub') == 'public') { - new_group_page('geoloc/index.tpl'); -} else { - new_groupadmin_page('geoloc/index.tpl'); -} - -$page->assign('no_annu', true); -$page->assign('dynamap_vars', 'none'); -$page->run(); - -?> diff --git a/htdocs.net/groupe/geolocInit.php b/htdocs.net/groupe/geolocInit.php deleted file mode 100644 index 6026a30..0000000 --- a/htdocs.net/groupe/geolocInit.php +++ /dev/null @@ -1,29 +0,0 @@ -assign('background', '#F4FAD4'); -$page->run(); -?> diff --git a/htdocs.net/groupe/getCityInfos.php b/htdocs.net/groupe/getCityInfos.php deleted file mode 100644 index eda7d7d..0000000 --- a/htdocs.net/groupe/getCityInfos.php +++ /dev/null @@ -1,56 +0,0 @@ -asso('id'); -$_REQUEST['only_current'] = 1; -$assoField = new RefSField('asso_id',array('gxm.asso_id'),'groupex.membres','gxm','u.user_id=gxm.uid'); -$cityIdField = new RefSField('cityid',array('av.cityid'),'adresses','av',getadr_join('av')); - -$fields = new SFieldGroup(true, array($assoField, $cityIdField)); -$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 - 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) - ".$fields->get_select_statement()." - ".$where." - GROUP BY u.user_id LIMIT 11", - $id); - -if ($globals->asso('pub') == 'public' || S::has_perms()) - $page->assign('users', $users); - -$page->run(); -// vim:set et sw=4 sts=4 sws=4 foldmethod=marker: -?> diff --git a/htdocs.net/groupe/getData.php b/htdocs.net/groupe/getData.php deleted file mode 100644 index 62203a3..0000000 --- a/htdocs.net/groupe/getData.php +++ /dev/null @@ -1,54 +0,0 @@ -asso('pub') != 'public') && !S::has_perms(); - -header("Content-type: text/xml"); - -require_once('geoloc.inc.php'); -require_once('search.inc.php'); - -$querystring = ""; -foreach ($_GET as $v => $a) - if ($v != 'mapid') - $querystring .= urlencode($v).'='.urlencode($a).'&'; -$page->assign('searchvars', $querystring); -if (Env::has('mapid')) - $mapid = Env::i('mapid', -2); -else - $mapid = false; - -$_REQUEST['asso_id'] = $globals->asso('id'); -$_REQUEST['only_current'] = 1; -$assoField = new RefSField('asso_id',array('gxm.asso_id'),'groupex.membres','gxm','u.user_id=gxm.uid'); - -if (!$nodata) { - list($countries, $cities) = geoloc_getData_subcountries($mapid, array($assoField), 10); - $page->assign('countries', $countries); - $page->assign('cities', $cities); -} - -$page->run(); -// vim:set et sw=4 sts=4 sws=4 foldmethod=marker: -?> diff --git a/htdocs.net/groupe/icon.php b/htdocs.net/groupe/icon.php deleted file mode 100644 index fb284e0..0000000 --- a/htdocs.net/groupe/icon.php +++ /dev/null @@ -1,33 +0,0 @@ -geoloc->use_map) { - readfile($globals->geoloc->icon_path); -} - -?> diff --git a/htdocs.net/index.php b/htdocs.net/index.php index a3896b6..e60b157 100644 --- a/htdocs.net/index.php +++ b/htdocs.net/index.php @@ -24,7 +24,8 @@ require 'xnet.inc.php'; require_once dirname(__FILE__).'/../classes/Xnet.php'; require_once dirname(__FILE__).'/../classes/PLModule.php'; -$platal = new Xnet('xnet', 'xnetgrp', 'xnetlists', 'xnetevents'); +$GLOBALS['IS_XNET_SITE'] = true; +$platal = new Xnet('xnet', 'xnetgrp', 'xnetlists', 'xnetevents', 'geoloc'); $platal->run(); ?> diff --git a/include/geoloc.inc.php b/include/geoloc.inc.php index c23f726..133d6ea 100644 --- a/include/geoloc.inc.php +++ b/include/geoloc.inc.php @@ -127,6 +127,7 @@ function get_new_maps($url) XDB::execute('INSERT INTO geoloc_maps VALUES '.substr($s, 1)); return true; } +// }}} // {{{ get_address_text($adr) /** make the text of an address that can be read by a mailman diff --git a/include/xnet/page.inc.php b/include/xnet/page.inc.php index 7bb8971..a110793 100644 --- a/include/xnet/page.inc.php +++ b/include/xnet/page.inc.php @@ -81,7 +81,7 @@ class XnetPage extends PlatalPage if (may_update() || $globals->asso('pub') == 'public') { $sub['annuaire du groupe'] = "$dim/annuaire"; if ($globals->xnet->geoloc) - $sub['carte'] = "$dim/geoloc.php"; + $sub['carte'] = "$dim/geoloc"; } if ($globals->asso('mail_domain')) { $sub['listes de diffusion'] = "$dim/lists"; diff --git a/modules/geoloc.php b/modules/geoloc.php index 9a4bb4d..133e24a 100644 --- a/modules/geoloc.php +++ b/modules/geoloc.php @@ -30,6 +30,12 @@ class GeolocModule extends PLModule '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), ); } @@ -50,10 +56,18 @@ class GeolocModule extends PLModule { global $globals; - require_once 'search.inc.php'; + if (!is_file(dirname(__FILE__).'/geoloc/dynamap.swf') || + !is_file(dirname(__FILE__).'/geoloc/icon.swf')) + $page->assign('request_geodesix', 1); - $page->changeTpl('geoloc/index.tpl'); + if (!empty($GLOBALS['IS_XNET_SITE'])) { + $page->useMenu(); + $page->setType($globals->asso('cat')); + $page->assign('no_annu', 1); + } + require_once 'search.inc.php'; + $page->changeTpl('geoloc/index.tpl'); $fields = new SFieldGroup(true, advancedSearchFromInput()); $search = $fields->get_url(); if (!Env::has('only_current')) @@ -64,8 +78,7 @@ class GeolocModule extends PLModule $search = preg_replace('/(^|&)mapid=([0-9]+)(&|$)/','\1\3', $search); if ($search) $search = '?'.$search; - $initfile = urlencode('geoloc/init'.$search); - $page->assign('flashvars','initfile='.$initfile); + $page->assign('search',$search); $page->assign('protocole', substr($globals->baseurl,0,strpos($globals->baseurl,':'))); @@ -83,10 +96,8 @@ class GeolocModule extends PLModule header("Content-type: application/x-shockwave-flash"); header("Pragma:"); - if ($globals->geoloc->use_map) { - readfile($globals->geoloc->icon_path); - exit; - } + readfile(dirname(__FILE__).'/geoloc/icon.swf'); + exit; return PL_NOT_FOUND; } @@ -97,11 +108,9 @@ class GeolocModule extends PLModule header("Content-type: application/x-shockwave-flash"); - if ($globals->geoloc->use_map) { - header("Pragma:"); - readfile($globals->geoloc->dynamap_path); - exit; - } + header("Pragma:"); + readfile(dirname(__FILE__).'/geoloc/dynamap.swf'); + exit; return PL_NOT_FOUND; } @@ -114,6 +123,8 @@ class GeolocModule extends PLModule header('Content-type: text/xml'); header('Pragma:'); + if(!empty($GLOBALS['IS_XNET_SITE'])) + $page->assign('background', 0xF2E9D0); $page->assign('querystring', $this->_make_qs()); } @@ -129,8 +140,16 @@ class GeolocModule extends PLModule require_once('geoloc.inc.php'); require_once('search.inc.php'); - $usual_fields = advancedSearchFromInput(); - $fields = new SFieldGroup(true, $usual_fields); + 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; @@ -166,8 +185,15 @@ class GeolocModule extends PLModule $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, advancedSearchFromInput(), 10); + list($countries, $cities) = geoloc_getData_subcountries($mapid, $fields, 10); $page->assign('countries', $countries); $page->assign('cities', $cities); diff --git a/templates/geoloc/geolocInit.tpl b/templates/geoloc/geolocInit.tpl index ead89a1..b3beaf9 100644 --- a/templates/geoloc/geolocInit.tpl +++ b/templates/geoloc/geolocInit.tpl @@ -41,7 +41,8 @@ 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" -iconSwf="geoloc/icon.swf" -scriptInfosArea="geoloc/country?{$querystring}"/> +iconSwf="{$platal->ns}geoloc/icon.swf" +scriptInfosArea="{$platal->ns}geoloc/country?{$querystring}"/> diff --git a/templates/geoloc/getData.tpl b/templates/geoloc/getData.tpl index a5e55d3..b133ba5 100644 --- a/templates/geoloc/getData.tpl +++ b/templates/geoloc/getData.tpl @@ -30,7 +30,7 @@ {if $country.nbPop > 0 or $country.id eq 0} - + {/if} {/foreach} @@ -39,7 +39,7 @@ {foreach from=$cities item="city"} - + {/foreach} diff --git a/templates/geoloc/index.tpl b/templates/geoloc/index.tpl index 91b3fbc..9518308 100644 --- a/templates/geoloc/index.tpl +++ b/templates/geoloc/index.tpl @@ -26,7 +26,7 @@ {literal} function ficheXorg(id) { - window.open('profile/'+id,'_blank','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width=840,height=600'); + 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} @@ -62,10 +62,10 @@ function searchMapId(f) Aujourd'hui {$localises} de nos camarades sont localisés grâce à leurs adresses personnelles.

{/if} -{if $globals->geoloc->use_map} +{if !$request_geodesix}