Changeset 8456


Ignore:
Timestamp:
Jan 3, 2011, 7:39:14 PM (13 years ago)
Author:
cljosse
Message:

[edit_gmaps] upgrade to Google map apiV3


Location:
extensions/edit_gmaps
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • extensions/edit_gmaps/admin/admin_edit.php

    r6445 r8456  
    11<?php
    22if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
     3
     4if (!defined('EDIT_RV_ROOT'))
     5define(  'EDIT_RV_ROOT',  PHPWG_PLUGINS_PATH.'edit_gmaps/admin/' );
     6
    37global $lang;
    48load_language('lang', dirname(__FILE__).'/../');
     
    3539
    3640$template->concat('TABSHEET_TITLE', ' '.l10n_dec('%d element', '%d elements', count($page['cat_elements_id'])).' - '.$page['title']);
     41
     42
     43$template->assign(
     44                                                array(                                         
     45                                                'EDIT_RV_ROOT' => EDIT_RV_ROOT)
     46                                                 );
    3747
    3848 
     
    99109            unset($collection);
    100110 }
     111
     112 
     113
    101114 if ($_POST['submit']==l10n('search_title' ))
    102115  { 
     116
    103117  $match  = $_POST['match'] ;
    104118
     
    203217{   
    204218    $lat =1000;
    205 
     219       
    206220if ($match<>"" && $match<>"/" )
    207221{   
    208222$match=str_replace(" ","+",$match);
    209 
    210223       $src="http://maps.google.com/maps/geo?q=".$match."&output=xml&sensor=true_or_false&key=".$conf['gmaps_api_key'];
    211224//json,kml,xml,csv
     
    216229                $lat=$location[1];
    217230                $lon=$location[0];
     231
    218232                                $template->assign(      array('lat' => $lat ,
    219233                                                                      'lon' => $lon ,));
     234                                $template->assign( 'coordinates',
     235                                                   array('LAT' => $lat,
     236                                                                                 'LON' => $lon,
     237                                                                                )
     238                                                                        );
    220239   }
    221240                                                                       
     
    225244                        if (array_search($id_0,$image)) {
    226245                         if ($lat==1000) {
    227                             $lat= ($image['lat'] <> '') ? $image['lat'] : '49.0'  ;
     246                            $lat= ($image['lat'] <> '') ? $image['lat'] : '100'  ;
    228247                                $lon= ($image['lon']  <> '') ? $image['lon'] : '3.0'  ;
    229                                 $template->assign(      array('lat' => $lat ,
    230                                                                       'lon' => $lon ,
    231                                                               )
    232                                 );
    233                         }
     248
     249                                $template->assign(      array('zoom' => 4,'lat' => $lat , 'lon' => $lon , )     );
     250                                $template->assign( 'coordinates',
     251                                                   array('LAT' => $lat,
     252                                                                                 'LON' => $lon,
     253                                                                                )
     254                                                                        );
     255
     256                                }
    234257                 
    235258                         $tpl_var = array_merge(
  • extensions/edit_gmaps/admin/admin_edit.tpl

    r5063 r8456  
    11{html_head}
    2 {* $Id: info_deroulante.tpl 3723 2009-08-07 04:53:38Z rvelices $ *}
     2{* $Id: admin_edit.tpl  2011-01-03  *}
    33
    4 {known_script id="jquery.cluetip" src=$ROOT_URL|@cat:"template-common/lib/plugins/jquery.cluetip.js"}
     4{known_script id="jquery" src=$ROOT_URL|@cat:"themes/default/js/jquery.packed.js" }
     5{known_script id="jquery.cluetip" src=$ROOT_URL|@cat:"themes/default/js/plugins/jquery.cluetip.packed.js"}
     6{known_script id="EDIT_RV_script" src=$EDIT_RV_ROOT|@cat:"js/JScript.js"}
     7 
    58
    6 
    7 <script type="text/javascript">
    8 jQuery().ready(
    9   function(){ldelim}
    10   jQuery('.cluetip').cluetip({ldelim}
    11     width: 300,
    12     splitTitle: '|'
    13    }
    14   );
    15  }
    16 );
    17 </script>
    18 
    19 {if $lat}
    20 <script src="http://maps.google.com/maps?file=api&amp;v=2&amp;key={$GMAPS_API_KEY}&amp;hl={$lang_info.code}" type="text/javascript"></script>
    21  
    22 <script src="plugins/rv_gmaps/template/windows_13/javascripts/prototype.js" type="text/javascript"></script>
     9<script src="http://maps.google.com/maps/api/js?sensor=false&amp;hl={$lang_info.code}" type="text/javascript"></script>
     10<script src="http://ajax.googleapis.com/ajax/libs/prototype/1.6.1.0/prototype.js" type="text/javascript"></script>
    2311
    2412
     
    4634{/literal}
    4735</style>
    48 {/if}
     36
     37
     38
    4939{/html_head}
    5040
     
    8070
    8171<form action="" method="post" id="Envoie" name="Envoie"   >
    82 
    83 <fieldset>
     72{if !$lat}
     73<fieldset  >
    8474        <legend>{'Elements'|@translate}</legend>
    8575
     
    10898        {/if}
    10999</fieldset>
    110 
    111 <!--/===================================================================================-->
     100{/if}
     101 
    112102
    113103<fieldset>
     
    117107<input class="cluetip" title="{'reset'|@translate}|{'hlp_line4'|@translate}."  type="submit" name="submit" value="{'reset'|@translate}" /><br />
    118108
    119 <input class="cluetip" title="{'search_title'|@translate}|{'hlp_line6'|@translate}."  type="submit" name="submit" value="{'search_title'|@translate}" />
    120 <input class="cluetip" title="{'lieu'|@translate}|{'hlp_line5'|@translate}." type="text" size="70"   value="{$match}"  name="match"    />
     109<input class="cluetip" title="{'search_title'|@translate}|{'hlp_line6'|@translate}."  type="submit" name="submit" value="{'search_title'|@translate}"  onclick="codeAddress()"  />
     110<input class="cluetip" title="{'lieu'|@translate}|{'hlp_line5'|@translate}." type="text" size="70"   value="{$match}"  name="match"      />
     111
    121112{if $lat}
    122 <div id="map"></div>
    123 {if not empty($Selectthumbnails)}
    124         <ul class="thumbnails">
    125                 {foreach from=$Selectthumbnails item=thumbnail}
    126                  
     113<fieldset>
     114<table>
     115<td><div id="markerStatus"></div></td>
     116<td><div id="markerAdress"></div></td>
     117</table>
     118
     119
     120    <div id="map"></div>
     121    {if not empty($Selectthumbnails)}
     122            <ul class="thumbnails">
     123                    {foreach from=$Selectthumbnails item=thumbnail}             
    127124                        <li><span class="wrap1">
    128125                                <label>
    129126                                        <span class="wrap2"><span>
    130127                                                <img src="{$thumbnail.U_TN}" alt="{$thumbnail.file}" title="{$thumbnail.TITLE}" class="thumbnail" />
    131                                         </span>
    132                                        
     128                                        </span>                                 
    133129                                        </span>
    134130                                        <br/>
    135 </label>
    136                                 <input type="hidden"  value={$thumbnail.id}  name="selection[]"    />
    137                                
    138                                
    139                                
     131                </label>
     132                                <input type="hidden"  value={$thumbnail.id}  name="selection[]"    />                           
    140133                                <span class="thumbLegend">
    141134                                {if isset($thumbnail.U_MAP)}
     
    150143                {/foreach}
    151144        </ul>
    152         {/if}
     145        {/if}
     146             <script type="text/javascript">
     147            {if isset($coordinates) && $coordinates.LAT != 100 }
     148                         var   coordinates={ldelim} LAT:{$coordinates.LAT},LON:{$coordinates.LON} };
     149            {else}
     150                         var  coordinates={ldelim} LAT:100,LON:100 }; 
     151            {/if}
     152           
     153             
     154 
    153155
    154  <script src="dragzoom.js" type="text/javascript"></script>
    155 <script type="text/javascript">
     156            Event.observe(window, 'load', onLoad );
     157            if (typeof $Moot == "undefined") $Moot = [];
     158             $Moot.push(Window.$);
     159           
     160           
     161            </script>
    156162
    157 {literal}
    158  //<![<!--CDATA[
    159  var map;
    160 var      controleMiniCarte ;
    161 function ajoutControle(newZoom){
     163</fieldset>
     164{/if}
    162165
    163 if (newZoom < 5) return ;
     166        <fieldset>
     167          <legend>{'Form'|@translate}</legend>
     168          <label>Latitude (-90=S to 90=N)
     169            <input type="text" size="8" value="{$lat}"  name="lat" />
     170          </label>
     171          <label>Longitude (-180=E to 180=W)
     172            <input type="text" size="9"value="{$lon}"  name="lon"  />
     173          </label> 
     174          <p>
     175            {'target'|@translate}
     176            <label><input type="radio" name="target" value="all" /> {'all'|@translate}</label>
     177            <label><input type="radio" name="target" value="selection" checked="checked" /> {'selection'|@translate}</label>
     178          </p>
    164179
    165  var vt1=typeof(controleMiniCarte) ;
    166 if (vt1=="undefined"   ) {
     180          <p><input class="submit" type="submit" value="{'Submit'|@translate}" name="submit" {$tag_input_enabled} /></p>
     181        </fieldset>
    167182
    168   controleMiniCarte = new google.maps.OverviewMapControl(new google.maps.Size(300,200));
    169  // controleMiniCarte.setMapType(G_PHYSICAL_MAP);
    170   map.addControl(controleMiniCarte);
    171  
    172       } 
    173 }
    174 
    175 function onLoad()
    176 {
    177   if (!GBrowserIsCompatible())   return;
    178   var mapElement = document.getElementById("map");
    179   map = new GMap2(document.getElementById("map"),{mapTypes: [G_SATELLITE_MAP,G_HYBRID_MAP,G_NORMAL_MAP,G_PHYSICAL_MAP,G_SATELLITE_3D_MAP]});
    180         map.addControl(new GLargeMapControl3D());
    181  
    182   map.addControl(new GMapTypeControl());
    183   map.addControl(new GScaleControl());
    184 <!--  map.enableScrollWheelZoom();-->
    185 <!--  map.enableDoubleClickZoom();-->
    186 {/literal}
    187 {if isset($lat)}{/if}
    188 var coord = new GLatLng( {$lat}, {$lon} );
    189 
    190   Ma_position=coord;
    191   var echelle=18;
    192 if ({$lat}=='49' && {$lon}=='3' )   echelle=4;
    193  
    194   map.setCenter( coord, echelle);
    195 
    196    var marker = new GMarker(coord,  {ldelim} draggable: true});
    197  
    198 
    199  
    200   map.addOverlay(marker);
    201 
    202 {literal}
    203   if ( !map.isLoaded() )    map.setCenter( new GLatLng(49,3), 4);
    204  try {
    205     // the overview must be added after setting map center
    206     //var ovcontrol = new GOverviewMapControl(new GSize(165,165));
    207 //              map.addControl(ovcontrol);
    208             GEvent.addListener(map, "zoomend", function() {
    209                      var        newZoom = map.getZoom();
    210                  ajoutControle(newZoom);
    211                         } );
    212                 GEvent.addListener(map, 'maptypechanged', function(){
    213            if (typeof(controleMiniCarte)!="undefined"   ) {
    214              var ov_map = controleMiniCarte.getOverviewMap();
    215                         if (ov_map) ov_map.setMapType(map.getCurrentMapType() );
    216                         }
    217                 });
    218                 }
    219   catch(e){ alert( e.message ); }
    220  
    221 GEvent.addListener(marker, "dragstart", function(overlay,latlng) {
    222    marker.closeInfoWindow();
    223                 });
    224                
    225 GEvent.addListener(marker, "dragend", function() {
    226 var latlng = marker.getPoint();
    227 
    228   /*          var myHtml = "Nouvelle position:"+  "<input    type=\"text\" name=\"lat\" value="+latlng.lat()+" /><input   type=\"text\" name=\"lon\" value="+latlng.lng()+" /> ";       
    229              map.openInfoWindow(latlng, myHtml);       
    230 */
    231                                 document.Envoie.lat.value=latlng.lat() ;
    232                                 document.Envoie.lon.value=latlng.lng() ;
    233   });
    234 GEvent.addListener(map,"click", function(overlay,latlng)
    235             {
    236  if (overlay) { return; }
    237             var myHtml = "<input    type=\"text\" name=\"lat\" value="+latlng.lat()+" /><input   type=\"text\" name=\"lon\" value="+latlng.lng()+" /> ";       
    238              map.openInfoWindow(latlng, myHtml);       
    239 
    240                 {/literal}
    241                                 document.Envoie.lat.value=latlng.lat() ;
    242                                 document.Envoie.lon.value=latlng.lng() ;
    243 
    244                                
    245                                
     183</fieldset>
     184</form>
    246185
    247186
    248                 {literal}       
    249             }
    250                         );
    251                          
    252                                  
    253 
    254  
    255 
    256 }
    257 
    258 function blowupUrl(theUrl)
    259 {
    260   var win = new Window({
    261     title: document.title,
    262     url: theUrl,
    263     classname: "alphacube",
    264     left: 0, top: 0,
    265     width:"640", height:"480",
    266     minimizable: false,
    267     maximizable: false,
    268     draggable: false,
    269     resizable: false,
    270     destroyOnClose: true,
    271     hideEffect: Element.hide,
    272     showEffectOptions: {duration:1.5}
    273   });
    274 
    275   win.setConstraint(true, {top:20, left:20, bottom:30, right:20} );
    276   win.maximize();
    277   win.showCenter(true, 20, 20);
    278  
    279   return false;
    280 }
    281 
    282 function $(element) {
    283   if (arguments.length > 1) {
    284     for (var i = 0, elements = [], length = arguments.length; i < length; i++)
    285       elements.push($(arguments[i]));
    286     return elements;
    287   }
    288   if (Object.isString(element))
    289     element = document.getElementById(element);
    290   return Element.extend(element);
    291 }
    292 
    293  Event.observe(window, 'load', onLoad );
    294  Event.observe(window, 'unload', GUnload );
    295 //]-->]>
    296 {/literal}
    297  
     187<script type="text/javascript">
     188jQuery().ready(
     189  function(){ldelim}
     190  jQuery('.cluetip').cluetip({ldelim}
     191    width: 300,height:100,
     192    splitTitle: '|'
     193   }
     194  );
     195 }
     196);
    298197</script>
    299198
    300 {/if}
    301 
    302 </fieldset>
    303 
    304 
    305 <fieldset>
    306   <legend>{'Form'|@translate}</legend>
    307 
    308  
    309   <label>Latitude (-90=S to 90=N)
    310     <input type="text" size="8" value="{$lat}"  name="lat" />
    311   </label>
    312   <label>Longitude (-180=E to 180=W)
    313     <input type="text" size="9"value="{$lon}"  name="lon"  />
    314   </label>
    315  
    316   <p>
    317     {'target'|@translate}
    318     <label><input type="radio" name="target" value="all" /> {'all'|@translate}</label>
    319     <label><input type="radio" name="target" value="selection" checked="checked" /> {'selection'|@translate}</label>
    320   </p>
    321 
    322   <p><input class="submit" type="submit" value="{'Submit'|@translate}" name="submit" {$tag_input_enabled} /></p>
    323 </fieldset>
    324 
    325 </form>
  • extensions/edit_gmaps/language/fr_FR/lang.php

    r4555 r8456  
    11<?php
    22global $lang;
     3$lang['search_title']='Rechercher un lieu...';
     4$lang['map']='Carte';
     5
    36$lang['selection']="Sélection";
    47$lang['reset'] ="Raz"  ;
     
    1215
    1316$lang['Map']='Carte';
     17
    1418
    1519$lang['displays %s on a map']='afficher %s sur la carte';
     
    2529$lang['show all pictures around this location']='Présente toutes les images à proximité de ces coordonnées';
    2630$lang['Search a location...']='Rechercher un lieu...';
     31$lang['search_title']='Rechercher un lieu...';
     32
    2733
    2834$lang['Loading']='Chargement';
  • extensions/edit_gmaps/template/cl_conflit.tpl

    r6445 r8456  
    77  jQuery.noConflict();
    88</script>{/literal}
     9   {known_script id="jquery.cluetip" src=$ROOT_URL|@cat:"themes/default/js/plugins/jquery.cluetip.packed.js"}
     10
    911{known_script id="jquery.ui" src=$ROOT_URL|@cat:$path_j@cat"ui/ui.core.packed.js"}
    1012{known_script id="gally" src=$PLUGIN_ROOT_URL|@cat:"/template/script.js"}
Note: See TracChangeset for help on using the changeset viewer.