Index: extensions/edit_gmaps/admin/admin.php
===================================================================
--- extensions/edit_gmaps/admin/admin.php	(revision 4545)
+++ extensions/edit_gmaps/admin/admin.php	(revision 4545)
@@ -0,0 +1,29 @@
+<?php 
+if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
+include_once(PHPWG_ROOT_PATH.'admin/include/tabsheet.class.php');
+
+$template->set_filename('plugin_admin_content', dirname(__FILE__).'/admin.tpl');
+
+if (!isset($_GET['tab']))
+  $page['tab'] = 'config';
+else
+  $page['tab'] = $_GET['tab'];
+
+$my_base_url = get_admin_plugin_menu_link(__FILE__);
+
+$tabsheet = new tabsheet();
+$tabsheet->add( 'edit', 'Edit', add_url_params( $my_base_url, array('tab'=>'edit') ) );
+$tabsheet->select($page['tab']);
+$tabsheet->assign();
+
+$my_base_url = $tabsheet->sheets[ $page['tab'] ]['url'];
+$template->set_filename( 'tab_data', dirname(__FILE__).'/admin_'.$page['tab'].'.tpl' );
+include_once( dirname(__FILE__).'/admin_'.$page['tab'].'.php');
+ 
+$template->assign_var_from_handle( 'TAB_DATA', 'tab_data');
+$template->assign_var_from_handle( 'ADMIN_CONTENT', 'plugin_admin_content');
+
+if ( empty($conf['gmaps_api_key']) )
+  $page['infos'][] = 'Please define the Google maps api key';
+
+?>
Index: extensions/edit_gmaps/admin/admin.tpl
===================================================================
--- extensions/edit_gmaps/admin/admin.tpl	(revision 4545)
+++ extensions/edit_gmaps/admin/admin.tpl	(revision 4545)
@@ -0,0 +1,5 @@
+<div class="titrePage">
+  <h2>Maps & Earth {$TABSHEET_TITLE} {'version'|@translate}  { $VERSION} </h2>
+</div>
+
+{$TAB_DATA}
Index: extensions/edit_gmaps/admin/admin_edit.php
===================================================================
--- extensions/edit_gmaps/admin/admin_edit.php	(revision 4545)
+++ extensions/edit_gmaps/admin/admin_edit.php	(revision 4545)
@@ -0,0 +1,257 @@
+<?php 
+if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
+global $lang;
+load_language('lang', dirname(__FILE__).'/../');
+$admin_url = PHPWG_ROOT_PATH.'admin.php';
+
+$sql="SELECT * 
+FROM `".$prefixeTable."plugins` 
+WHERE `id` LIKE 'edit_gmaps'
+";
+ $result = @pwg_query($sql);
+	if ($result) {
+	    $versions = mysql_fetch_array($result,MYSQL_ASSOC);
+	}
+$version= $versions['version'];
+
+if ( !isset($_GET['cat']) )
+  $_GET['cat'] = 'caddie';
+$_GET['mode'] = 'map';
+include (PHPWG_ROOT_PATH.'admin/element_set.php');
+
+
+$template->concat('TABSHEET_TITLE', ' '.l10n_dec('%d element', '%d elements', count($page['cat_elements_id'])).' - '.$page['title']);
+
+ 
+if ( isset($_POST['submit']) and !is_adviser() )
+{
+
+
+  $collection = array();
+$_POST['target']=isset($_POST['target']) ? $_POST['target']: "" ;
+  switch ($_POST['target'])
+  {
+    case 'all' :
+      $collection = $page['cat_elements_id'];
+      break;
+    case 'selection' :
+      if (!isset($_POST['selection']) or count($_POST['selection']) == 0)
+        array_push($page['errors'], l10n('Select at least one picture'));
+      else
+        $collection = $_POST['selection'];
+      break;
+  }
+//===========================================================================  
+$match="";
+
+  if ( count($collection)>0 )
+  {
+  
+
+    $lat = trim($_POST['lat']);
+    $lon = trim($_POST['lon']);
+
+    if ( strlen($lat)>0 and strlen($lon)>0 )
+    {
+      if ( (double)$lat<=90 and (double)$lat>=-90
+          and (double)$lon<=180 and (double)$lat>=-180 )
+        $update_query = 'lat='.$lat.', lon='.$lon;
+      else
+        $page['errors'][] = 'Invalid lat or lon value';
+    }
+    elseif ( strlen($lat)==0 and strlen($lon)==0 )
+      $update_query = 'lat=NULL, lon=NULL';
+    else
+      $page['errors'][] = 'Both lat/lon must be empty or not empty';
+ 
+  if ($_POST['submit']=='Valider' )
+  {
+    	if (isset($update_query))
+    	{
+      		$update_query = '
+					UPDATE '.IMAGES_TABLE.' SET '.$update_query.'
+  					WHERE id IN ('.implode(',',$collection).')';
+      		pwg_query($update_query);
+      		rvm_invalidate_cache();
+    	}
+		 $_POST['selection']=array();
+		 unset($collection);
+		 
+	}
+  }
+//===========================================================================  
+
+ if ($_POST['submit']=='Raz' )
+ {
+       $_POST['selection']=array();
+	    unset($collection);
+ }
+ if ($_POST['submit']=='cherche' )
+  {  
+  $match  = $_POST['match'] ;
+
+   
+  }
+ }
+ 
+$template->append(
+  'specials',
+  array(
+		$admin_url.get_query_string_diff(array('start','cat')).'&amp;cat=caddie' => l10n('Caddie')
+    ),
+	true
+  );
+
+$query = '
+SELECT id,name,uppercats,global_rank
+  FROM '.CATEGORIES_TABLE.'
+;';
+$result = pwg_query($query);
+$categories = array();
+$selecteds = array();
+if (!empty($result))
+{
+  while ($row = mysql_fetch_assoc($result))
+  {
+    $url = $admin_url.get_query_string_diff(array('start','cat')).'&amp;cat='.$row['id'];
+    if ( $row['id']==$_GET['cat'] ) $selecteds[] = $url;
+    $row['id']=$url;
+    array_push($categories, $row);
+  }
+}
+usort($categories, 'global_rank_compare');
+display_select_categories($categories, $selecteds, 'categories', false);
+
+if (!empty($_GET['display']))
+{
+  if ('all' == $_GET['display'])
+    $page['nb_images'] = count($page['cat_elements_id']);
+  else
+    $page['nb_images'] = intval($_GET['display']);
+}
+else
+  $page['nb_images'] = 20;
+
+if ( !empty($page['cat_elements_id']) )
+{
+  $nav_bar = create_navigation_bar(
+    $admin_url.get_query_string_diff(array('start')),
+    count($page['cat_elements_id']),
+    $page['start'],
+    $page['nb_images']
+    );
+  $template->assign('NAV_BAR', $nav_bar);
+}
+   
+$images=array();
+if ( !empty($page['cat_elements_id']) )
+{
+  $query='
+		SELECT id,tn_ext,name,path,file,lat,lon FROM '.IMAGES_TABLE.'
+  		WHERE id IN ('.implode(',',$page['cat_elements_id']).')
+  		'.$conf['order_by'].'
+  		LIMIT '.$page['start'].', '.$page['nb_images'].'
+		;';
+ 	 $result = pwg_query($query);
+  	while ( $row=mysql_fetch_assoc($result) )
+    		$images[] = $row;
+}
+//=================================================================================
+foreach ($images as $image)
+{
+	$tpl_var = array_merge( $image,
+      array(
+        'U_TN' => get_thumbnail_url($image),
+        'TITLE' => get_thumbnail_title($image)
+      )
+    );
+	
+  if ( isset($image['lat']) )
+    $tpl_var['U_MAP'] = rvm_make_map_picture_url( array('image_id'=>$image['id'], 'image_file'=>$image['file']) );
+	$template->append('thumbnails', $tpl_var);
+}
+
+//===================================================================================
+$template->assign(
+    array(
+      'U_DISPLAY'=> $admin_url.get_query_string_diff(array('display')),
+	   'VERSION'=> $version,
+	      ) 
+  );
+//==================================================================================  
+$template->assign(
+    array(	  
+	   		'GMAPS_API_KEY' => $conf['gmaps_api_key'],
+	   	 )
+	   );
+//==================================================================================
+$src="";
+
+if (isset($collection))	
+{   
+    $lat =1000;
+
+if ($match<>"" && $match<>"/" )
+{   
+$match=str_replace(" ","+",$match);
+
+       $src="http://maps.google.com/maps/geo?q=".$match."&output=xml&sensor=true_or_false&key=".$conf['gmaps_api_key'];
+//json,kml,xml,csv
+  
+		$location = file_get_contents($src);
+		$location = explode("coordinates>",$location );
+		$location = explode(",",$location[1]);
+		$lat=$location[1];
+		$lon=$location[0];
+  				$template->assign(	array('lat' => $lat ,
+	  						              'lon' => $lon ,));
+   }
+									
+  foreach ($collection as $id_0)  {
+  		foreach ($images as $image)  {
+
+   			if (array_search($id_0,$image)) {
+			 if ($lat==1000) {
+			    $lat= ($image['lat'] <> '') ? $image['lat'] : '49.0'  ;
+				$lon= ($image['lon']  <> '') ? $image['lon'] : '3.0'  ;
+ 				$template->assign(	array('lat' => $lat ,
+	  						              'lon' => $lon ,
+							      )
+				);
+			}
+ 		  
+			 $tpl_var = array_merge( 
+			            $image,
+      					array(
+						 'src'  => $src ,
+						   'match' => $_POST['match']  ,
+						   'check' => $_POST['submit']  ,
+        					'U_TN' => get_thumbnail_url($image),
+        					'TITLE' => get_thumbnail_title($image),
+							'U_MAP' => rvm_make_map_picture_url(
+							                                    array(
+							                                         'image_id'=>$image['id'],
+							                                         'image_file'=>$image['file'],
+							                                         ) 
+
+      						                                    ),
+								)  								
+    						);
+						 
+		$template->append('Selectthumbnails', $tpl_var);	
+		
+		}
+	}	
+}
+
+
+}
+ if ($_POST['submit']=='Valider' )
+ {
+ 
+  $_POST['selection']=array();  
+   $collection =array();  
+  }
+  //=======================================================================
+
+?>
Index: extensions/edit_gmaps/admin/admin_edit.tpl
===================================================================
--- extensions/edit_gmaps/admin/admin_edit.tpl	(revision 4545)
+++ extensions/edit_gmaps/admin/admin_edit.tpl	(revision 4545)
@@ -0,0 +1,257 @@
+{html_head}
+{if $lat}
+<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>
+
+
+<script src="{$PLUGIN_ROOT_URL}/template/windows_13/javascripts/prototype.js" type="text/javascript"></script>
+<script src="{$PLUGIN_ROOT_URL}/template/windows_13/javascripts/window.js" type="text/javascript" defer="defer"></script>
+<link href="{$PLUGIN_ROOT_URL}/template/windows_13/themes/default.css" rel="stylesheet" type="text/css" />
+<link href="{$PLUGIN_ROOT_URL}/template/windows_13/themes/alphacube.css" rel="stylesheet" type="text/css" />
+
+<style type="text/css">{literal}
+
+#map2{    
+left:0px;
+ width:250px
+}
+#mapPicture{ 
+
+width:100px ;
+ border:outset;
+ height:100px;
+}
+#map{ float:left;
+ top:20px;
+ right:0px;
+  width:500px;
+  height:500px;
+ border:outset;
+}
+
+
+{/literal}
+</style>
+{/if}
+{/html_head}
+
+<fieldset>
+  <legend>{'Display options'|@translate}</legend>
+<form>
+Set:
+<select onchange="document.location = this.options[this.selectedIndex].value;">
+  <optgroup label="Specials">
+    {html_options options=$specials}
+  </optgroup>
+  <optgroup label="{'Categories'|@translate}">
+  	{html_options options=$categories selected=$categories_selected}
+  </optgroup>
+  <!-- <optgroup label="{'Tags'|@translate}"></optgroup> -->
+</select>
+</form>
+<table ><td align="left" >{'New_hlp'|@translate}</td> 
+<tr><td align="left" >{'New_hlp2'|@translate}
+</td></tr> 
+</table>
+
+  <p>{'elements per page'|@translate}:
+      <a href="{$U_DISPLAY}&amp;display=20">20</a>
+    | <a href="{$U_DISPLAY}&amp;display=50">50</a>
+    | <a href="{$U_DISPLAY}&amp;display=100">100</a>
+    | <a href="{$U_DISPLAY}&amp;display=all">{'all'|@translate}</a>
+  </p>
+</fieldset>
+
+<form action="" method="post" id="Envoie" name="Envoie"   >
+
+<fieldset>
+	<legend>{'Elements'|@translate}</legend>
+
+	<div class="navigationBar">{$NAV_BAR}</div>
+  {if not empty($thumbnails)}
+	<ul class="thumbnails">
+		{foreach from=$thumbnails item=thumbnail}
+		<li><span class="wrap1">
+			<label>
+				<span class="wrap2"><span>
+					<img src="{$thumbnail.U_TN}" alt="{$thumbnail.file}" title="{$thumbnail.TITLE}" class="thumbnail" />
+				</span></span>
+				<input type="checkbox" name="selection[]" value="{$thumbnail.id}" />
+			</label>
+
+			<span class="thumbLegend">
+			{if isset($thumbnail.U_MAP)}
+			<a href="{$thumbnail.U_MAP}" target="_blank">{$thumbnail.lat},{$thumbnail.lon}</a>
+			{/if}
+			</span>
+
+			</span>
+		</li>
+		{/foreach}
+	</ul>
+	{/if}
+</fieldset>
+
+<!--/===================================================================================-->
+
+<fieldset>
+<legend>{'map'|@translate}</legend>
+<input class="submit" type="submit" name="submit" value="{'selection'|@translate}" />
+<input class="submit" type="submit" name="submit" value="{'reset'|@translate}" /><br />
+<input type="text" size="300px" value="{$match}"  name="match"    />
+<input class="submit" type="submit" name="submit" value="{'search_title'|@translate}" />
+
+{if $lat}
+<div id="map"></div>
+{if not empty($Selectthumbnails)}
+	<ul class="thumbnails">
+		{foreach from=$Selectthumbnails item=thumbnail}
+		 
+			<li><span class="wrap1">
+				<label>
+					<span class="wrap2"><span>
+						<img src="{$thumbnail.U_TN}" alt="{$thumbnail.file}" title="{$thumbnail.TITLE}" class="thumbnail" />
+					</span>
+					
+					</span>
+					<br/>
+</label>
+				<input type="text"  value={$thumbnail.id}  name="selection[]"    />
+				
+				
+				
+				<span class="thumbLegend">
+				{if isset($thumbnail.U_MAP)}
+					<a href="{$thumbnail.U_MAP}" target="_blank">{$thumbnail.lat},{$thumbnail.lon}</a>
+				{/if}
+				{$thumbnail.file}  
+				</span>
+
+				</span>
+			</li>
+			
+		{/foreach}
+	</ul>
+	{/if}
+
+ <script src="dragzoom.js" type="text/javascript"></script>
+<script type="text/javascript">
+
+{literal}
+ //<![<!--CDATA[
+function onLoad()
+{
+  if (!GBrowserIsCompatible())   return;
+  var mapElement = document.getElementById("map");
+  var map = new GMap2(document.getElementById("map"),{mapTypes: [G_SATELLITE_MAP,G_HYBRID_MAP,G_NORMAL_MAP,G_PHYSICAL_MAP,G_SATELLITE_3D_MAP]});
+  
+  map.addControl(new GLargeMapControl());
+  map.addControl(new GMapTypeControl());
+  map.addControl(new GScaleControl());
+<!--  map.enableScrollWheelZoom();-->
+<!--  map.enableDoubleClickZoom();-->
+{/literal}
+{if isset($lat)}{/if}
+var coord = new GLatLng( {$lat}, {$lon} );
+
+  Ma_position=coord;
+  var echelle=18;
+  
+  map.setCenter( coord, echelle);
+  var marker = new GMarker(coord);
+  map.addOverlay(marker);
+
+{literal}
+  if ( !map.isLoaded() )
+    map.setCenter( new GLatLng(49,3), 14);
+  try {
+    // the overview must be added after setting map center
+    var ovcontrol = new GOverviewMapControl(new GSize(165,165));
+		map.addControl(ovcontrol);
+		var ov_map = ovcontrol.getOverviewMap();
+		GEvent.addListener(map, 'maptypechanged', function(){
+			ov_map.setMapType(G_NORMAL_MAP);
+		});
+		
+
+GEvent.addListener(map,"click", function(overlay,latlng)
+            {
+ if (overlay) { return; }
+            var myHtml = "<input    type=\"text\" name=\"lat\" value="+latlng.lat()+" /><input   type=\"text\" name=\"lon\" value="+latlng.lng()+" /> ";	
+             map.openInfoWindow(latlng, myHtml);	
+
+		{/literal}
+				document.Envoie.lat.value=latlng.lat() ;
+				document.Envoie.lon.value=latlng.lng() ;
+
+				
+				
+
+
+		{literal}	
+            }
+			);
+			 
+				 
+  }
+  catch(e){ alert( e.message ); }
+  
+
+}
+
+function blowupUrl(theUrl)
+{
+  var win = new Window({
+    title: document.title,
+    url: theUrl,
+    classname: "alphacube",
+    left: 0, top: 0,
+    width:"640", height:"480",
+    minimizable: false,
+    maximizable: false,
+    draggable: false,
+    resizable: false,
+    destroyOnClose: true,
+    hideEffect: Element.hide,
+    showEffectOptions: {duration:1.5}
+  });
+
+  win.setConstraint(true, {top:20, left:20, bottom:30, right:20} );
+  win.maximize();
+  win.showCenter(true, 20, 20);
+ 
+  return false;
+}
+
+<!--Event.observe(window, 'load', onLoad );-->
+<!--Event.observe(window, 'unload', GUnload );-->
+//]-->]>
+{/literal}
+onLoad();
+</script>
+
+{/if}
+
+</fieldset>
+
+
+<fieldset>
+  <legend>{'Form'|@translate}</legend>
+
+ 
+  <label>Latitude (-90=S to 90=N)
+    <input type="text" size="8" value="{$lat}"  name="lat" />
+  </label>
+  <label>Longitude (-180=E to 180=W)
+    <input type="text" size="9"value="{$lon}"  name="lon"  />
+  </label>
+  
+  <p>
+    {'target'|@translate}
+    <label><input type="radio" name="target" value="all" /> {'all'|@translate}</label>
+    <label><input type="radio" name="target" value="selection" checked="checked" /> {'selection'|@translate}</label>
+  </p>
+
+  <p><input class="submit" type="submit" value="{'Submit'|@translate}" name="submit" {$tag_input_enabled} /></p>
+</fieldset>
+
+</form>
