Index: /extensions/rv_gmaps/trunk/admin/admin_boot.php
===================================================================
--- /extensions/rv_gmaps/trunk/admin/admin_boot.php	(revision 17704)
+++ /extensions/rv_gmaps/trunk/admin/admin_boot.php	(revision 17705)
@@ -53,8 +53,8 @@
 	$template->append('element_set_global_plugins_actions',
 		array('ID' => 'geotag', 'NAME'=>l10n('Geotag'), 'CONTENT' => '
-  <label>Latitude (-90=S to 90=N)
+  <label>{\'Latitude\'|@translate} (-90=S to 90=N)
     <input type="text" size="8" name="lat">
   </label>
-  <label>Longitude (-180=E to 180=W)
+  <label>{\'Longitude\'|@translate} (-180=E to 180=W)
     <input type="text" size="9" name="lon">
   </label> (Empty values will erase coordinates)
@@ -73,5 +73,5 @@
 	{
 		if ( (double)$lat<=90 and (double)$lat>=-90
-				and (double)$lon<=180 and (double)$lat>=-180 )
+				and (double)$lon<=180 and (double)$lon>=-180 )
 			$update_query = 'lat='.$lat.', lon='.$lon;
 		else
@@ -92,3 +92,142 @@
   }
 }
+
+add_event_handler('loc_begin_element_set_unit', 'rvm_loc_begin_element_set_unit');
+function rvm_loc_begin_element_set_unit()
+{
+  global $page;
+  
+  if (isset($_POST['submit']))
+  {
+    $collection = explode(',', $_POST['element_ids']);
+    
+    $datas = array();
+    $errors = array();
+    
+    $query = '
+SELECT id, name
+  FROM '.IMAGES_TABLE.'
+  WHERE id IN ('.implode(',', $collection).')
+;';
+    $result = pwg_query($query);
+    
+    while ($row = pwg_db_fetch_assoc($result))
+    {
+      $data = array();
+      $error = false;
+      $data['id'] = $row['id'];
+      $data['lat'] = trim($_POST['lat-'.$row['id']]);
+      $data['lon'] = trim($_POST['lon-'.$row['id']]);
+      
+      if ( strlen($data['lat'])>0 and strlen($data['lon'])>0 )
+      {
+        if ( (double)$data['lat']>90 or (double)$data['lat']<-90
+            or (double)$data['lon']>180 or (double)$data['lon']<-180 )
+          $error = true;
+      }
+      elseif ( strlen($data['lat'])==0 and strlen($data['lon'])==0 )
+      {
+        // nothing
+      }
+      else
+      {
+        $error = true;
+      }
+      
+      if ($error)
+        array_push($errors, $row['name']);
+      else
+        array_push($datas, $data);
+    }
+    
+    mass_updates(
+      IMAGES_TABLE,
+      array(
+        'primary' => array('id'),
+        'update' => array('lat', 'lon')
+        ),
+      $datas
+      );
+    
+    if (count($errors)>0)
+    {
+      array_push($page['errors'], 'Invalid lat or lon value for files: '.implode(', ', $errors));
+    }
+  }
+}
+
+add_event_handler('loc_end_element_set_unit', 'rvm_loc_end_element_set_unit');
+function rvm_loc_end_element_set_unit()
+{
+  global $template, $conf, $page, $is_category, $category_info;
+  
+  $query = '
+SELECT id,lat,lon
+  FROM '.IMAGES_TABLE;
+  
+  if ($is_category)
+  {
+    $category_info = get_cat_info($_SESSION['bulk_manager_filter']['category']);
+    
+    $conf['order_by'] = $conf['order_by_inside_category'];
+    if (!empty($category_info['image_order']))
+    {
+      $conf['order_by'] = ' ORDER BY '.$category_info['image_order'];
+    }
+
+    $query.= '
+    JOIN '.IMAGE_CATEGORY_TABLE.' ON id = image_id';
+  }
+
+  $query.= '
+  WHERE id IN ('.implode(',', $page['cat_elements_id']).')';
+
+  if ($is_category)
+  {
+    $query.= '
+    AND category_id = '.$_SESSION['bulk_manager_filter']['category'];
+  }
+
+  $query.= '
+  '.$conf['order_by'].'
+  LIMIT '.$page['nb_images'].' OFFSET '.$page['start'].'
+;';
+  $result = pwg_query($query);
+
+  $tpl_vars = array();
+  while ($row = pwg_db_fetch_assoc($result))
+  {
+    // remove last zeros for better display
+    $row['lat'] = preg_replace('#\.([0-9]*?)([0]+)$#', '.$1', $row['lat']);
+    $row['lon'] = preg_replace('#\.([0-9]*?)([0]+)$#', '.$1', $row['lon']);
+    
+    $tpl_vars[ $row['id'] ] = array(
+      'LAT' => rtrim($row['lat'], '.'),
+      'LON' => rtrim($row['lon'], '.'),
+      );
+  }
+  
+  $template->assign('GEOTAG', $tpl_vars);
+  
+  $template->set_prefilter('batch_manager_unit', 'rvm_prefilter_batch_manager_unit');
+}
+
+function rvm_prefilter_batch_manager_unit($content, &$smarty)
+{
+  $search = '<td><strong>{\'Who can see this photo?\'|@translate}</strong></td>';
+  $add = '<td><strong>{\'Geotag\'|@translate}</strong></td>
+      <td>
+        <label>{\'Latitude\'|@translate}
+          <input type="text" size="8" name="lat-{$element.ID}" value="{$GEOTAG[$element.ID].LAT}">
+        </label>
+        <label>{\'Longitude\'|@translate}
+          <input type="text" size="9" name="lon-{$element.ID}" value="{$GEOTAG[$element.ID].LON}">
+        </label>
+      </td>
+    </tr>
+
+    <tr>
+      ';
+  return str_replace($search, $add.$search, $content);
+}
 ?>
Index: /extensions/rv_gmaps/trunk/language/en_UK/lang.php
===================================================================
--- /extensions/rv_gmaps/trunk/language/en_UK/lang.php	(revision 17704)
+++ /extensions/rv_gmaps/trunk/language/en_UK/lang.php	(revision 17705)
@@ -26,3 +26,5 @@
 $lang['Not geotagged']='Not geotagged';
 $lang['Geotag']='Geotag';
+$lang['Latitude'] = 'Latitude';
+$lang['Longitude'] = 'Longitude';
 ?>
