remove use_map for geoloc, use a setting instead (is that really useful ?
authorx2000habouzit <x2000habouzit@839d8a87-29fc-0310-9880-83ba4fa771e5>
Sun, 23 Jul 2006 22:42:05 +0000 (22:42 +0000)
committerx2000habouzit <x2000habouzit@839d8a87-29fc-0310-9880-83ba4fa771e5>
Sun, 23 Jul 2006 22:42:05 +0000 (22:42 +0000)
why so many complication !?)

remove the config hook for real, all is now set as default in platal.ini,
and platal.conf is used as an override.

yay, it's one step in the hooks disparition sense !

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

15 files changed:
configs/platal.ini
hooks/geoloc.inc.php [deleted file]
htdocs.net/groupe/dynamap.php
htdocs.net/groupe/geoloc.php
htdocs.net/groupe/icon.php
include/geoloc.inc.php
include/xnet/globals.inc.php
include/xorg/globals.inc.php
include/xorg/hook.inc.php
modules/geoloc.php
modules/search.php
templates/geoloc/index.tpl
templates/search/adv.form.tpl
templates/search/index.tpl
templates/skin/common.menu.tpl

index 350fc58..2c9e019 100644 (file)
@@ -9,6 +9,12 @@ web_pass = "***"
 table_prefix = "banana_"
 
 
+[Geoloc]
+use_map        = 0
+webservice_url = ""
+dynamap_path   = ""
+icon_path      = ""
+
 [Mail]
 domain  = ""
 domain2 = ""
diff --git a/hooks/geoloc.inc.php b/hooks/geoloc.inc.php
deleted file mode 100644 (file)
index 3a9ca55..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-<?php
-/***************************************************************************
- *  Copyright (C) 2003-2006 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 HOOK
-
-class GeolocConfig
-{
-    var $webservice_url = '';
-    var $dynamap_path = false;
-    var $icon_path = false;
-
-    function use_map() {
-        static $use_map;
-        if (!isset($use_map))
-            $use_map = $this->dynamap_path != false && is_file($this->dynamap_path) && is_file($this->icon_path);
-        return $use_map;
-    }
-}
-
-function geoloc_config()
-{
-    global $globals;
-    $globals->geoloc = new GeolocConfig;
-}
-
-// }}}
-// vim:set et sw=4 sts=4 sws=4 foldmethod=marker:
-?>
index 2b0cfb8..07410a4 100644 (file)
@@ -36,7 +36,7 @@ if (urlencode(Env::v('initfile')) != $initfile)
 
 header("Content-type: application/x-shockwave-flash");
 
-if ($globals->geoloc->use_map())
+if ($globals->geoloc->use_map)
        readfile($globals->geoloc->dynamap_path);
 
 ?>
index ecbb45e..c0164bc 100644 (file)
 
 require_once 'xnet.inc.php';
 
-if ($globals->asso('pub') == 'public')
-       new_group_page('geoloc/index.tpl');
-else
-       new_groupadmin_page('geoloc/index.tpl');
+if ($globals->asso('pub') == 'public') {
+    new_group_page('geoloc/index.tpl');
+} else {
+    new_groupadmin_page('geoloc/index.tpl');
+}
 
-$page->assign('use_map', $globals->geoloc->use_map());
 $page->assign('no_annu', true);
 $page->assign('dynamap_vars', 'none');
 $page->run();
 
-?>
\ No newline at end of file
+?>
index b6a46d0..fb284e0 100644 (file)
@@ -26,7 +26,8 @@ new_nonhtml_page('');
 
 header("Content-type: application/x-shockwave-flash");
 
-if ($globals->geoloc->use_map())
-       readfile($globals->geoloc->icon_path);
+if ($globals->geoloc->use_map) {
+    readfile($globals->geoloc->icon_path);
+}
 
 ?>
index e06a051..c23da8c 100644 (file)
@@ -19,7 +19,6 @@
  *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
  ***************************************************************************/
 
-
 // {{{ liste les pays ou les régions d'un pays
 /** donne la liste déroulante des pays
  * @param $current pays actuellement selectionné
@@ -419,5 +418,7 @@ function geoloc_getData_subcountries($mapid, $SFields, $minentities) {
        
     return array($countries, $cities);   
 } 
+// }}}
+
 // vim:set et sw=4 sts=4 sws=4 foldmethod=marker:
 ?>
index 585dbd5..e1863d1 100644 (file)
@@ -37,8 +37,6 @@ class XnetGlobals extends PlatalGlobals
         $globals->core = new CoreConfig;
         $globals->hook = new XOrgHook();
 
-        $globals->hook->config(null);
-
         $globals->read_config();
 
         $globals->dbconnect();
index a8bea5a..2561df2 100644 (file)
@@ -37,8 +37,6 @@ class XorgGlobals extends PlatalGlobals
         $globals->core = new CoreConfig;
         $globals->hook = new XOrgHook();
 
-        $globals->hook->config(null);
-
         $globals->read_config();
 
         $globals->dbconnect();
index d94e7c8..69ea5a1 100644 (file)
@@ -72,17 +72,6 @@ class XOrgHook
     }
 
     // }}}
-    // {{{ function config
-
-    function config()
-    {
-        foreach ($this->_mods as $mod) {
-            if (!function_exists($mod.'_config')) continue;
-            call_user_func($mod.'_config');
-        }
-    }
-
-    // }}}
     // {{{ function subscribe
 
     function subscribe($forlife, $uid, $promo, $pass)
index 49f3895..c808fbd 100644 (file)
@@ -67,8 +67,6 @@ class GeolocModule extends PLModule
         if ($search) {
             $page->assign('dynamap_vars', $search);
         }
-
-        $page->assign('use_map', $globals->geoloc->use_map());
     }
 
     function handler_icon(&$page)
@@ -77,7 +75,7 @@ class GeolocModule extends PLModule
 
         header("Content-type: application/x-shockwave-flash");
 
-        if ($globals->geoloc->use_map()) {
+        if ($globals->geoloc->use_map) {
             readfile($globals->geoloc->icon_path);
             exit;
         }
@@ -99,7 +97,7 @@ class GeolocModule extends PLModule
 
         header("Content-type: application/x-shockwave-flash");
 
-        if ($globals->geoloc->use_map()) {
+        if ($globals->geoloc->use_map) {
             readfile($globals->geoloc->dynamap_path);
             exit;
         }
index db1eb6a..7cd0c58 100644 (file)
@@ -199,7 +199,6 @@ class SearchModule extends PLModule
 
         $page->assign('advanced',1);
         $page->assign('public_directory',0);
-        $page->assign('use_map', $globals->geoloc->use_map());
 
         if (!Env::has('rechercher')) {
             $this->form_prepare();
index 5341780..8d0983e 100644 (file)
@@ -62,7 +62,7 @@ function searchMapId(f)
     Aujourd'hui {$localises} de nos camarades sont localisés grâce à leurs adresses personnelles.
   </p>
 {/if}
-{if $use_map}
+{if $globals->geoloc->use_map}
   <p class="center">
     <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="600" height="450" id="dynamap" align="middle">
     <param name="allowScriptAccess" value="sameDomain" />
index 5930963..5c965df 100644 (file)
       f.submit();
     }
   {/literal}</script>
-  {if $use_map}
+  {if $globals->geoloc->use_map}
     <input type="button" value="Voir les résultats sur une carte" onclick="launch_form('geoloc/')"/>
   {/if}
   <input type="button" value="Chercher" onclick="launch_form('search/adv')"/>
index 71f5c21..9f19adc 100644 (file)
@@ -34,7 +34,7 @@
     {if $search_results_nb==0}Aucune{else}{$search_results_nb}{/if} réponse{if $search_results_nb>1}s{/if}.
   </h1>
 
-  {if $search_results_nb and $advanced and !$simple and $use_map}
+  {if $search_results_nb and $advanced and !$simple and $globals->geoloc->use_map}
   <p>
     [<a href='geoloc/?{$search_vars}'>Voir la recherche sur une carte</a>].
   </p>
index 865e4c0..28bef32 100644 (file)
@@ -60,7 +60,7 @@
 
 <div class="menu_title">Communauté X</div>
 <div class="menu_item"><a href="search">Annuaire</a></div>
-{if $globals->geoloc->use_map()}
+{if $globals->geoloc->use_map}
 <div class="menu_item"><a href="geoloc">Planisphère</a></div>
 {/if}
 <div class="menu_item"><a href="trombi">Trombi promo</a></div>