Index: /extensions/Psli_BingMaps/admin/JS/Psli-BingMaps-Map.js
===================================================================
--- /extensions/Psli_BingMaps/admin/JS/Psli-BingMaps-Map.js	(revision 15448)
+++ /extensions/Psli_BingMaps/admin/JS/Psli-BingMaps-Map.js	(revision 15448)
@@ -0,0 +1,90 @@
+/*
+Plugin Name: Psli-BingMaps
+Author: psli 
+*/
+
+// Global data
+var psli_g_PolygonColor = new Microsoft.Maps.Color(100,20,0,20);
+var psli_g_VerticeInitial = new Array();
+var psli_g_ZoomEntity = new Array();
+var psli_g_Vertice;
+var psli_g_Map;
+var psli_g_BingKey;
+var psli_g_MapOptions;
+var psli_g_MapCenter;
+var psli_g_zoomInitial;
+var psli_g_handlerViewChange;
+var psli_g_handlerClick;
+
+// Data for guest view
+for (var i = 0; i < 20; i++)
+	psli_g_ZoomEntity.push(new Microsoft.Maps.EntityCollection());
+	
+/**************************************************************************/
+// JS global function for Map
+function psli_InitMap() {
+	psli_g_Map = new Microsoft.Maps.Map(document.getElementById("myMap"), psli_g_MapOptions);
+	psli_g_handlerClick = Microsoft.Maps.Events.addHandler(psli_g_Map, "click", psli_MapClick);
+	psli_g_Map.setView({center: psli_g_MapCenter, zoom: psli_g_zoomInitial});
+	
+	var pin = new Microsoft.Maps.Pushpin(psli_g_MapCenter);
+	psli_g_Map.entities.clear();
+	psli_g_Map.entities.push(pin);	
+}
+
+function psli_ShowGuestView () {
+	document.getElementById("showView").disabled = true;
+	document.getElementById("showData").disabled = false;
+	psli_g_handlerViewChange = Microsoft.Maps.Events.addHandler(psli_g_Map, "viewchangeend", psli_MapViewChangeEnd);
+	Microsoft.Maps.Events.removeHandler(psli_g_handlerClick);
+	psli_g_Map.entities.clear();
+	psli_g_Map.entities.push(psli_g_ZoomEntity[psli_g_Map.getZoom() - 1]);
+}
+
+function psli_ShowMapData () {
+	document.getElementById("showView").disabled = false;
+	document.getElementById("showData").disabled = true;
+	Microsoft.Maps.Events.removeHandler(psli_g_handlerViewChange);
+	psli_g_handlerClick = Microsoft.Maps.Events.addHandler(psli_g_Map, "click", psli_MapClick);
+	var pin = new Microsoft.Maps.Pushpin(psli_g_MapCenter);
+	psli_g_Map.entities.clear();
+	psli_g_Map.entities.push(pin);
+	psli_g_Map.setView({center: psli_g_MapCenter, zoom: psli_g_zoomInitial});
+}
+
+function psli_MapViewChangeEnd () {
+	psli_g_Map.entities.clear();
+	psli_g_Map.entities.push(psli_g_ZoomEntity[psli_g_Map.getZoom() - 1]);
+}
+
+function psli_MapClick(e) {
+	if (e.targetType == "map") 
+	{
+		var psli_l_Point = new Microsoft.Maps.Point(e.getX(), e.getY());
+		psli_g_MapCenter = e.target.tryPixelToLocation(psli_l_Point);
+		psli_g_zoomInitial = Math.round(psli_g_Map.getZoom());
+		
+		document.getElementById("lat").value = psli_g_MapCenter.latitude;
+		document.getElementById("lon").value = psli_g_MapCenter.longitude;
+		document.getElementById("zoom").value = psli_g_zoomInitial;
+				
+		var pin = new Microsoft.Maps.Pushpin(psli_g_MapCenter);
+		psli_g_Map.entities.clear();
+		psli_g_Map.entities.push(pin);
+		
+		psli_g_Map.setView({center: psli_g_MapCenter, zoom: psli_g_zoomInitial});	
+	}
+}
+	  
+function psli_AdminUpdateMap() {
+	psli_g_MapCenter = new Microsoft.Maps.Location(document.getElementById("lat").value, document.getElementById("lon").value);
+	psli_g_zoomInitial = parseInt(document.getElementById("zoom").value);
+	
+	var pin = new Microsoft.Maps.Pushpin(psli_g_MapCenter);
+	psli_g_Map.entities.clear();
+	psli_g_Map.entities.push(pin);
+	
+	psli_g_MapOptions.zoom = psli_g_zoomInitial;
+	psli_g_MapOptions.center = psli_g_MapCenter;
+	psli_g_Map.setView(psli_g_MapOptions);	
+}
Index: /extensions/Psli_BingMaps/admin/JS/Psli-BingMaps-Pin.js
===================================================================
--- /extensions/Psli_BingMaps/admin/JS/Psli-BingMaps-Pin.js	(revision 15448)
+++ /extensions/Psli_BingMaps/admin/JS/Psli-BingMaps-Pin.js	(revision 15448)
@@ -0,0 +1,74 @@
+/*
+Plugin Name: Psli-BingMaps
+Author: psli 
+*/
+
+// Global data
+var psli_g_Map;
+var psli_g_BingKey;
+var psli_g_MapOptions;
+var psli_g_MapCenter;
+
+/**************************************************************************/
+// JS global function for Map
+function psli_InitMap() {
+	psli_g_Map = new Microsoft.Maps.Map(document.getElementById("myMap"), psli_g_MapOptions);
+	Microsoft.Maps.Events.addHandler(psli_g_Map, "click", psli_MapClick);
+	psli_g_Map.setView({center: psli_g_MapCenter});
+}
+	
+function psli_ShowPin() {
+	var pin = new Microsoft.Maps.Pushpin(new Microsoft.Maps.Location(document.getElementById("lat").value, document.getElementById("lon").value));
+	psli_g_Map.entities.clear();
+	psli_g_Map.entities.push(pin);	
+}
+	
+function psli_MapClick(e) {
+	if (e.targetType == "map") 
+	{
+		var psli_l_Point = new Microsoft.Maps.Point(e.getX(), e.getY());
+		psli_g_MapCenter = e.target.tryPixelToLocation(psli_l_Point);
+		
+		document.getElementById("lat").value = psli_g_MapCenter.latitude;
+		document.getElementById("lon").value = psli_g_MapCenter.longitude;
+				
+		psli_g_Map.setView({center: psli_g_MapCenter});
+		psli_ShowPin();
+	}
+}
+	 
+function psli_SetMinimum() {
+	document.getElementById("zoommin").value = psli_g_Map.getZoom();
+}
+
+function psli_SetMaximum() {
+	document.getElementById("zoommax").value = psli_g_Map.getZoom();
+}
+
+function psli_SetAction() {
+	document.getElementById("actionzoomselect").selectedIndex = psli_g_Map.getZoom() - 1;
+} 
+ 
+function psli_ChangeActionMode() {
+	if (document.getElementById("actionselect").selectedIndex == 0)
+	{
+		document.getElementById("ActionAlbum").style.display = 'block';	
+		document.getElementById("ActionPicture").style.display = 'none';	
+	}
+	else
+	{
+		document.getElementById("ActionAlbum").style.display = 'none';
+		document.getElementById("ActionPicture").style.display = 'block';		
+	}
+}  
+
+function psli_AdminUpdateMap() {
+	psli_g_MapCenter = new Microsoft.Maps.Location(document.getElementById("lat").value, document.getElementById("lon").value);
+		
+	var pin = new Microsoft.Maps.Pushpin(psli_g_MapCenter);
+	psli_g_Map.entities.clear();
+	psli_g_Map.entities.push(pin);
+	
+	psli_g_MapOptions.center = psli_g_MapCenter;
+	psli_g_Map.setView(psli_g_MapOptions);	
+}
Index: /extensions/Psli_BingMaps/admin/JS/Psli-BingMaps-Zone.js
===================================================================
--- /extensions/Psli_BingMaps/admin/JS/Psli-BingMaps-Zone.js	(revision 15448)
+++ /extensions/Psli_BingMaps/admin/JS/Psli-BingMaps-Zone.js	(revision 15448)
@@ -0,0 +1,132 @@
+/*
+Plugin Name: Psli-BingMaps
+Author: psli 
+*/
+
+// Global data
+var psli_g_PolygonColor = new Microsoft.Maps.Color(100,20,0,20);
+var psli_g_VerticeInitial = new Array();
+var psli_g_Vertice;
+var psli_g_ZoneDraw;
+var psli_g_Map;
+var psli_g_BingKey;
+var psli_g_MapOptions;
+var psli_g_MapCenter;
+
+/**************************************************************************/
+// JS global function for Map	
+function psli_savePoints() {
+	var sSave = "";
+	var minLat = 200;
+	var maxLat = -200;
+	var minLon = 200;
+	var maxLon = -200;
+	for (var i = 0; i < psli_g_Vertice.length; i++)
+	{
+		sSave += psli_g_Vertice[i].latitude + ";" + psli_g_Vertice[i].longitude + "#";
+		if (psli_g_Vertice[i].latitude > maxLat)
+			maxLat = psli_g_Vertice[i].latitude;
+		if (psli_g_Vertice[i].latitude < minLat)
+			minLat = psli_g_Vertice[i].latitude;
+		if (psli_g_Vertice[i].longitude > maxLon)
+			maxLon = psli_g_Vertice[i].longitude;
+		if (psli_g_Vertice[i].longitude < minLon)
+			minLon = psli_g_Vertice[i].longitude;
+	}
+	document.getElementById("hiddenpoints").value = sSave;
+	document.getElementById("hiddencenterlat").value = (minLat + maxLat) / 2;
+	document.getElementById("hiddencenterlon").value = (minLon + maxLon) / 2;
+}
+function psli_MapClick(e) {
+	if (e.targetType == "map") 
+	{
+		var psli_l_Point = new Microsoft.Maps.Point(e.getX(), e.getY());
+		var psli_l_Loc = e.target.tryPixelToLocation(psli_l_Point);
+		psli_g_Vertice.push(psli_l_Loc);
+		var zone = new Microsoft.Maps.Polygon(psli_g_Vertice,{fillColor: psli_g_PolygonColor, strokeColor: psli_g_PolygonColor});
+		psli_g_Map.entities.clear();
+		psli_g_Map.entities.push(zone);
+		psli_savePoints();
+	}
+}
+
+function psli_Reload() {
+	psli_CopyInitial();
+	var psli_l_Polygon = new Microsoft.Maps.Polygon(psli_g_Vertice,{fillColor: psli_g_PolygonColor, strokeColor: psli_g_PolygonColor});
+	psli_g_Map.entities.clear();
+	psli_g_Map.entities.push(psli_l_Polygon);
+	psli_savePoints();	
+}
+		
+function psli_DeleteLast() {
+	if (psli_g_Vertice.length > 0) 
+	{
+		psli_g_Vertice.pop();
+		var psli_l_Polygon = new Microsoft.Maps.Polygon(psli_g_Vertice,{fillColor: psli_g_PolygonColor, strokeColor: psli_g_PolygonColor});
+		psli_g_Map.entities.clear();
+		psli_g_Map.entities.push(psli_l_Polygon);
+		psli_savePoints();
+	}
+}
+
+function psli_DeleteAll() {
+	psli_g_Vertice = new Array();
+	psli_g_Map.entities.clear();
+	psli_savePoints();
+}
+
+function psli_CopyInitial() {
+	psli_g_Vertice = new Array();
+	for (var i = 0; i < psli_g_VerticeInitial.length; i++)
+	{
+		psli_g_Vertice.push(psli_g_VerticeInitial[i]);
+	}
+}
+
+function psli_InitMap() {
+	psli_g_Map = new Microsoft.Maps.Map(document.getElementById("myMap"), psli_g_MapOptions);
+	Microsoft.Maps.Events.addHandler(psli_g_Map, "click", psli_MapClick);
+	psli_g_Map.setView({center: psli_g_MapCenter});
+}
+			 
+function psli_SetMinimum() {
+	document.getElementById("zoommin").value = psli_g_Map.getZoom();
+}
+
+function psli_SetMaximum() {
+	document.getElementById("zoommax").value = psli_g_Map.getZoom();
+}
+
+function psli_SetAction() {
+	document.getElementById("actionzoomselect").selectedIndex = psli_g_Map.getZoom() - 1;
+} 
+ 
+function psli_ChangeActionMode() {
+	if (document.getElementById("actionselect").selectedIndex == 0)
+	{
+		document.getElementById("ActionZoom").style.display = 'block';
+		document.getElementById("ActionAlbum").style.display = 'none';
+		document.getElementById("ActionPicture").style.display = 'none';
+	}
+	else
+	{
+		if (document.getElementById("actionselect").selectedIndex == 1)
+		{
+			document.getElementById("ActionZoom").style.display = 'none';
+			document.getElementById("ActionAlbum").style.display = 'block';	
+		document.getElementById("ActionPicture").style.display = 'none';	
+		}
+		else
+		{
+			document.getElementById("ActionZoom").style.display = 'none';
+			document.getElementById("ActionAlbum").style.display = 'none';
+		document.getElementById("ActionPicture").style.display = 'block';		
+		}
+	}	
+}  
+
+function psli_AdminUpdateMap() {
+	psli_g_MapCenter = new Microsoft.Maps.Location(document.getElementById("lat").value, document.getElementById("lon").value);	
+	psli_g_MapOptions.center = psli_g_MapCenter;
+	psli_g_Map.setView(psli_g_MapOptions);	
+}
Index: /extensions/Psli_BingMaps/admin/admin.php
===================================================================
--- /extensions/Psli_BingMaps/admin/admin.php	(revision 15448)
+++ /extensions/Psli_BingMaps/admin/admin.php	(revision 15448)
@@ -0,0 +1,91 @@
+<?php
+/*
+Plugin Name: Psli-BingMaps
+Author: psli 
+*/
+
+// Chech whether we are indeed included by Piwigo.
+if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
+
+include_once(PHPWG_ROOT_PATH.'admin/include/tabsheet.class.php');
+
+//******* Fetch global data *******
+global $template, $conf, $page, $debug;
+
+//******* Create tabs *******
+$tabs = array(
+  array(
+    'code' => 'configuration',
+    'label' => l10n('Configuration mode'),
+    ),
+  array(
+    'code' => 'map',
+    'label' => '1-'.l10n('Map mode'),
+    ),
+  array(
+    'code' => 'exif',
+    'label' => '2-'.l10n('Exif import'),
+    ),
+  array(
+    'code' => 'pin',
+    'label' => '3-'.l10n('Pin mode'),
+    ),
+  array(
+    'code' => 'zone',
+    'label' => '3-'.l10n('Zone mode'),
+    ),
+  array(
+    'code' => 'picture',
+    'label' => '4-'.l10n('Picture mode'),
+    ),
+  array(
+    'code' => 'batch',
+    'label' => '5-'.l10n('Batch association'),
+    ),
+  );
+
+//******* Select mode *******
+if (isset($_GET['mode']))
+  $page['tab'] = $_GET['mode'];
+else
+  $page['tab'] = $tabs[0]['code'];
+
+//******* Add tabs to page *******
+$tabsheet = new tabsheet();
+foreach ($tabs as $tab)
+{
+$tabsheet->add(
+  $tab['code'],
+  $tab['label'],
+  get_root_url().'admin.php?page=plugin&amp;section='.str_replace("/","%2F",$_GET['section']).'&amp;mode='.$tab['code']
+  );
+}
+$tabsheet->select($page['tab']);
+$tabsheet->assign();
+
+// Go to selected tab
+switch ($page['tab'])
+{
+	case 'configuration':
+		include(PSLI_BINGMAPS_ADMIN_CONF_PHP);
+		break;
+	case 'map':
+		include(PSLI_BINGMAPS_ADMIN_MAP_PHP);
+		break;
+	case 'pin':
+		include(PSLI_BINGMAPS_ADMIN_PIN_PHP);
+		break;
+	case 'zone':
+		include(PSLI_BINGMAPS_ADMIN_ZONE_PHP);
+		break;
+	case 'picture':
+		include(PSLI_BINGMAPS_ADMIN_PICTURE_PHP);
+		break;
+	case 'exif':
+		include(PSLI_BINGMAPS_ADMIN_EXIF_PHP);
+		break;
+	case 'batch':
+		include(PSLI_BINGMAPS_ADMIN_BATCH_PHP);
+		break;
+}  
+?>
Index: /extensions/Psli_BingMaps/admin/class/psli_entity.class.php
===================================================================
--- /extensions/Psli_BingMaps/admin/class/psli_entity.class.php	(revision 15448)
+++ /extensions/Psli_BingMaps/admin/class/psli_entity.class.php	(revision 15448)
@@ -0,0 +1,379 @@
+<?php
+class Psli_Entity {
+	/***********************************************************************/
+	/* Controlers **********************************************************/
+	protected $data_changed;		// Used to know if data were changed
+	protected $status;			// Status of this map ==> true:open, enable - false:closed, disable
+	/* Data ****************************************************************/
+	protected $id; 				// Unique id in table
+	protected $lat;
+	protected $lon;
+	protected $title;	
+	protected $idaction;
+	protected $zoommin;	
+	protected $zoommax;
+	protected $action;			// 1: Zoom - 2: Category - 3: Picture
+	protected $type;				// 1: pin - 2: zone - 3:picture
+	/* Maps ****************************************************************/
+	protected $maps;				// Array of associated maps
+
+	/***********************************************************************/
+	/* Methods *************************************************************/
+	/* getEntities
+			Return all entities in database order by type (zone, pin, picture)
+			and by title
+	*/
+	function getEntities() {
+		$query = '
+			SELECT id 
+				FROM '.PSLI_ENTITIES_TABLE.' 
+				ORDER BY action, title;';
+		$result = pwg_query($query);
+		$entities = array();
+		while ($row = pwg_db_fetch_assoc($result))
+		{
+			$entities[] = new Psli_Entity($row['id']);
+		}
+		return $entities;
+	}
+	
+	/* assignData
+			Assign all data of this entity to template $template with data name
+			$lat_name, $lon_name, $zoommin_name, $zoommax_name, $title_name, 
+			$actionid_name, $id_name
+	*/
+	function assignData ($template, $lat_name, $lon_name, $zoommin_name, $zoommax_name, $title_name, $actionid_name, $id_name) {
+		$template->assign(
+			array(			
+				$lat_name	=> $this->lat,
+				$lon_name   => $this->lon,
+				$zoommin_name  => $this->zoommin,
+				$zoommax_name  => $this->zoommax,
+				$title_name => $this->title,
+				$actionid_name    => $this->idaction,
+				$id_name    => $this->id
+			)
+		);
+	}
+	/* isOpened
+			Return true if entity is open
+	*/
+	function isOpened() {
+		return $this->status;
+	}
+	/* generateEntityList($template, $block, $entitytype)
+			Create an heml select option identified by $block in 
+			template $ template for each entity filtered by
+			$entitytype in "pin", "zone", "picture", "all".
+			Current Entity is selected.
+	*/
+	protected function generateList($template, $block, $entitytype) {
+		$entities = array();
+		$entities_selecteds = array();
+		if (! $this->status)
+			$entities_selecteds[0] = l10n('No selected entity');
+		
+		switch ($entitytype)
+		{
+			case "pin":			
+				$query = '
+					SELECT id, title 
+						FROM '.PSLI_ENTITIES_TABLE.' 
+						WHERE type = 1 
+						ORDER BY title;';
+				break;
+			case "zone":			
+				$query = '
+					SELECT id, title 
+						FROM '.PSLI_ENTITIES_TABLE.' 
+						WHERE type = 2 
+						ORDER BY title;';
+				break;
+			case "picture":			
+				$query = '
+					SELECT id, title 
+						FROM '.PSLI_ENTITIES_TABLE.' 
+						WHERE type = 3 
+						ORDER BY title;';
+				break;
+			case "all":			
+				$query = '
+					SELECT id, title 
+						FROM '.PSLI_ENTITIES_TABLE.'
+						ORDER BY title;';
+				break;
+		}
+		$result = pwg_query($query);
+		while ($row = pwg_db_fetch_assoc($result))
+		{
+			if ($row['id'] == $this->id)
+				$entities_selecteds[$row['id']] = $row['title'];
+			else
+				$entities[$row['id']] = $row['title'];
+		}
+		$template->assign($block.'_selected', $entities_selecteds);
+		$template->assign($block, $entities);
+	}
+	/* delete
+			Delete entity from the database.
+	*/
+	function delete() {
+		global $debug;
+		$debug .= "PSLIDEBUG : delete";
+		if ($this->status == true)
+		{
+			$debug .= "PSLIDEBUG : delete";
+			$query = 'DELETE FROM '.PSLI_ENTITIES_MAPS_TABLE.' WHERE id_entity = '.$this->id.';';
+			pwg_query($query);
+			$query = 'DELETE FROM '.PSLI_ENTITIES_TABLE.' WHERE id = '.$this->id.';';
+			pwg_query($query);
+			$this->status = false;
+			return true;
+		}
+		else	
+			return false;
+	}
+	/* save
+			Save entity data to the database
+	*/
+	function save() {
+		if (($this->status == true) && ($this->data_changed == true))
+		{
+			$query = '
+				UPDATE '.PSLI_ENTITIES_TABLE.'
+					SET lat = '.$this->lat.',
+						lon = '.$this->lon.',
+						zoommin = '.$this->zoommin.',
+						zoommax = '.$this->zoommax.',
+						action = '.$this->action.',
+						id_action = '.$this->idaction.',
+						title = "'.addslashes($this->title).'"
+					WHERE id = '.$this->id.';';
+			pwg_query($query);
+			
+			$q = 'DELETE FROM '.PSLI_ENTITIES_MAPS_TABLE.' WHERE id_entity = '.$this->id.';';
+			pwg_query($q);				
+				
+			foreach ($this->maps as $map)
+			{
+				$q = '
+					INSERT INTO '.PSLI_ENTITIES_MAPS_TABLE.' (id_entity, id_map)
+						VALUES ('.$this->id.', '.$map.');';
+				pwg_query($q);
+			}
+			
+			$this->data_changed = false;
+		}
+	}
+	/* open
+			Open entity identified by id $open
+	*/
+	function open ($open) {
+		$query = '
+			SELECT id, lat, lon, zoomMin, zoomMax, action, id_action, title, type
+				FROM '.PSLI_ENTITIES_TABLE.' 
+				WHERE id = '.$open.';';
+		$result = pwg_query($query);
+		
+		if (pwg_db_num_rows($result) > 0)
+		{
+			$row = pwg_db_fetch_assoc($result);
+			$this->id = $row['id'];
+			$this->lat = $row['lat'];
+			$this->lon = $row['lon'];
+			$this->zoommin = $row['zoomMin'];
+			$this->zoommax = $row['zoomMax'];
+			$this->title = $row['title'];
+			$this->action = $row['action'];
+			$this->idaction = $row['id_action'];
+			$this->type = $row['type'];
+			$this->status = true;
+			$this->data_changed = false;
+			
+			$query = '
+				SELECT id_map
+					FROM '.PSLI_ENTITIES_MAPS_TABLE.'
+					WHERE id_entity = '.$this->id.' ORDER BY id_map;'	;
+			$result = pwg_query($query);
+			if (pwg_db_num_rows($result) > 0)
+			{
+				while ($row = pwg_db_fetch_assoc($result))
+					array_push($this->maps,$row['id_map']);
+			}
+			
+			return true;
+		}
+		else
+			return false;
+	}
+	/* create
+			Create an entity with default value
+	*/
+	function create($typeentity) {
+		if ($this->status == false)
+		{
+			switch ($typeentity)
+			{
+				case "pin":
+					$query = '
+						INSERT INTO '.PSLI_ENTITIES_TABLE.'
+							(lat, lon, title, id_action, action, zoomMin, zoomMax, type)
+							VALUES (0, 0, "'.l10n("New Pin").'", 2, 1, 1, 20, 1);';
+					$this->type = 1;
+					$this->action = 2;
+					$this->title = l10n("New Pin");
+					break;
+				case "zone":
+					$query = '
+						INSERT INTO '.PSLI_ENTITIES_TABLE.'
+							(lat, lon, title, id_action, action, zoomMin, zoomMax, type)
+							VALUES (0, 0, "'.l10n("New Zone").'", 1, 1, 1, 20, 2);';
+					$this->type = 2;
+					$this->action = 1;
+					$this->title = l10n("New Zone");
+					break;
+				case "picture":
+					$query = '
+						INSERT INTO '.PSLI_ENTITIES_TABLE.'
+							(lat, lon, title, id_action, action, zoomMin, zoomMax, type)
+							VALUES (0, 0, "'.l10n("New Picture").'", 3, 1, 1, 20, 3);';
+					$this->type = 3;
+					$this->action = 3;
+					$this->title = l10n("New Picture");
+					break;
+			}
+			pwg_query($query);
+			$this->id = pwg_db_insert_id();
+			$this->lat = 0;
+			$this->lon = 0;
+			$this->idaction = 1;
+			$this->zoommin = 1;
+			$this->zoommax = 20;
+			$this->maps = Array();
+			$this->status = true;
+			$this->data_changed = false;
+			return true;
+		}
+		else
+			return false;
+	}
+	
+	/***********************************************************************/
+	/* Constructor *********************************************************/
+	function __construct ($openid = 0) {
+		$this->id = 0;
+		$this->lat = 0;
+		$this->lon = 0;
+		$this->zoom = 3;
+		$this->title = l10n("New Entity");
+		$this->status = false;
+		$this->maps = Array();
+		$this->data_changed = false;
+		if ($openid != 0)
+			$this->open($openid);
+	}
+	
+	/***********************************************************************/
+	/* Getters  ************************************************************/
+	function getType() {
+		return $this->type;
+	}
+	function getActionId() {
+		return $this->idaction;
+	}
+	function getAction() {
+		return $this->action;
+	}
+	function getLatitude() {
+		return $this->lat;
+	}
+	function getLongitude() {
+		return $this->lon;
+	}
+	function getZoomMax() {
+		return $this->zoommax;
+	}
+	function getZoomMin() {
+		return $this->zoommin;
+	}
+	function getId() {
+		return $this->id;
+	}	
+	function getTitle() {
+		return $this->title;
+	}	
+	
+	/***********************************************************************/
+	/* Setters  ************************************************************/
+	function setAction($type, $value) {
+		if (($this->status == true) && ($type != $this->action))
+		{
+			$this->action = $type;
+			$this->data_changed = true;
+		}
+		if (($this->status == true) && ($value != $this->idaction))
+		{
+			$this->idaction = $value;
+			$this->data_changed = true;
+		}
+	}
+	function setZoomMax($value) {
+		if (($this->status == true) && ($value != $this->zoommax))
+		{
+			$this->zoommax = $value;
+			$this->data_changed = true;
+		}
+	}
+	function setZoomMin($value) {
+		if (($this->status == true) && ($value != $this->zoommin))
+		{
+			$this->zoommin = $value;
+			$this->data_changed = true;
+		}
+	}
+	function setLongitude($value) {
+		if (($this->status == true) && ($value != $this->lon))
+		{
+			$this->lon = $value;
+			$this->data_changed = true;
+		}
+	}
+	function setLatitude($value) {
+		if (($this->status == true) && ($value != $this->lat))
+		{
+			$this->lat = $value;
+			$this->data_changed = true;
+		}
+	}
+	function setTitle($value) {
+		if (($this->status == true) && ($value != $this->title))
+		{
+			$this->title = $value;
+			$this->data_changed = true;
+		}
+	}
+	
+	/***********************************************************************/
+	/* Methods for associated maps *****************************************/
+	/* isMapAssociated
+			Return true if map identified by $map is associated with this entity
+	*/
+	function isMapAssociated($map) {
+		return in_array($map, $this->maps);
+	}
+	/* clearMaps
+			Remove all associated maps
+	*/
+	function clearMaps () {
+		$this->maps = Array();
+		$this->data_changed = true;
+	}
+	/* addMap
+			Add an associated map identified by $map
+	*/
+	function addMap($map) {
+		array_push($this->maps,$map);
+		$this->data_changed = true;
+	}
+}
+?>
Index: /extensions/Psli_BingMaps/admin/class/psli_map.class.php
===================================================================
--- /extensions/Psli_BingMaps/admin/class/psli_map.class.php	(revision 15448)
+++ /extensions/Psli_BingMaps/admin/class/psli_map.class.php	(revision 15448)
@@ -0,0 +1,235 @@
+<?php
+class Psli_Map {
+	/***********************************************************************/
+	/* Members *************************************************************/
+	private $id; 				// Unique id in table
+	private $status;			// Status of this map ==> true:open, enable - false:closed, disable
+	private $category;			// Id of the associated category
+	private $title;	
+	private $lat;
+	private $lon;
+	private $zoom;	
+	private $data_changed;		// Used to know if data were changed
+	private $category_changed;	// Used to know if category was changed
+	
+	/***********************************************************************/
+	/* Methods *************************************************************/
+	function getMaps() {
+		$query = '
+			SELECT id 
+				FROM '.PSLI_MAPS_TABLE.'
+				ORDER BY title;';
+		$result = pwg_query($query);
+		$maps = array();
+		while ($row = pwg_db_fetch_assoc($result))
+		{
+			$maps[] = new Psli_Map($row['id']);
+		}
+		return $maps;
+	}
+	
+	function assignData ($template, $lat_name, $lon_name, $zoom_name, $title_name, $id_name) {
+		$template->assign(
+			array(			
+				$lat_name	=> $this->lat,
+				$lon_name   => $this->lon,
+				$zoom_name  => $this->zoom,
+				$title_name => $this->title,
+				$id_name    => $this->id
+			)
+		);
+	}
+	
+	function generateMapsList($template, $block) {
+		$i = 0;
+		$query = '
+			SELECT id, title 
+				FROM '.PSLI_MAPS_TABLE.'
+				ORDER BY title;';
+		$result = pwg_query($query);
+		$maps = array();
+		$maps_selecteds = array();
+		if (! $this->status)
+			$maps_selecteds[0] = l10n('No selected map');
+		while ($row = pwg_db_fetch_assoc($result))
+		{
+			$i ++;
+			if ($row['id'] == $this->id)
+			{
+				$maps_selecteds[$row['id']] = $row['title'];
+			}
+			else
+			{
+				$maps[$row['id']] = $row['title'];
+			}
+		}
+		$template->assign($block.'_selected', $maps_selecteds);
+		$template->assign($block, $maps);
+		return $i;
+	}
+	
+	function delete() {
+		if ($this->status == true)
+		{			
+			$query = 'DELETE FROM '.PSLI_ENTITIES_MAPS_TABLE.' WHERE id_map = '.$this->id.';';
+			pwg_query($query);
+			$query = 'DELETE FROM '.PSLI_MAPS_TABLE.' WHERE id = '.$this->id.';';
+			pwg_query($query);
+			$this->status = false;
+			return true;
+		}
+		else	
+			return false;
+	}
+	
+	function create() {
+		if ($this->status == false)
+		{
+			$query = '
+				INSERT INTO '.PSLI_MAPS_TABLE.'
+					(lat, lon, zoom, title)
+					VALUES (0, 0, 2, "'.l10n("New Map").'");';
+			pwg_query($query);
+			$this->id = pwg_db_insert_id();
+			$this->category = 0;
+			$this->lat = 0;
+			$this->lon = 0;
+			$this->zoom = 2;
+			$this->title = l10n("New Map");
+			$this->status = true;
+			$this->category_changed = false;
+			$this->data_changed = false;
+			return true;
+		}
+		else
+			return false;
+	}
+	
+	function open($open) {
+		$query = '
+			SELECT id, id_category, lat, lon, zoom, title
+				FROM '.PSLI_MAPS_TABLE.'
+				WHERE id = '.$open.';';
+		$result = pwg_query($query);
+		
+		if (pwg_db_num_rows($result) > 0)
+		{
+			$row = pwg_db_fetch_assoc($result);
+			$this->id = $row['id'];
+			$this->category = $row['id_category'];
+			$this->lat = $row['lat'];
+			$this->lon = $row['lon'];
+			$this->zoom = $row['zoom'];
+			$this->title = $row['title'];
+			$this->status = true;
+			$this->category_changed = false;
+			$this->data_changed = false;
+			return true;
+		}
+		else
+			return false;
+	}
+
+	function save() {
+		if (($this->status == true) && ($this->data_changed == true))
+		{
+			$query = '
+				UPDATE '.PSLI_MAPS_TABLE.'
+					SET lat = '.$this->lat.',
+						lon = '.$this->lon.',
+						title = "'.addslashes($this->title).'",
+						zoom = '.$this->zoom.'
+					WHERE id = '.$this->id.';';
+			pwg_query($query);
+			$this->data_changed = false;
+		}
+		if (($this->status == true) && ($this->category_changed == true))
+		{
+			$query = '
+				UPDATE '.PSLI_MAPS_TABLE.'
+					SET id_category = '.$this->category.'
+					WHERE id = '.$this->id.';';
+			pwg_query($query);
+			$this->category_changed = false;
+		}
+	}
+	
+	/***********************************************************************/
+	/* Setters  ************************************************************/
+	function setCategory($value) {
+		if (($this->status == true) && ($value != $this->category))
+		{
+			$this->category = $value;
+			$this->category_changed = true;
+		}
+	}
+	function setTitle($value) {
+		if (($this->status == true) && ($value != $this->title))
+		{
+			$this->title = $value;
+			$this->data_changed = true;
+		}
+	}
+	function setLatitude($value) {
+		if (($this->status == true) && ($value != $this->lat))
+		{
+			$this->lat = $value;
+			$this->data_changed = true;
+		}
+	}
+	function setLongitude($value) {
+		if (($this->status == true) && ($value != $this->lon))
+		{
+			$this->lon = $value;
+			$this->data_changed = true;
+		}
+	}
+	function setZoom($value) {
+		if (($this->status == true) && ($value != $this->zoom))
+		{
+			$this->zoom = $value;
+			$this->data_changed = true;
+		}
+	}
+	
+	/***********************************************************************/
+	/* Getters  ************************************************************/
+	function getCategory() {
+		return $this->category;
+	}	
+	function getTitle() {
+		return $this->title;
+	}
+	function getLatitude() {
+		return $this->lat;
+	}
+	function getLongitude() {
+		return $this->lon;
+	}
+	function getZoom() {
+		return $this->zoom;
+	}
+	function getId() {
+		return $this->id;
+	}	
+	function isOpened() {
+		return $this->status;
+	}
+	
+	/***********************************************************************/
+	/* Constructor *********************************************************/
+	function __construct ($value = 0) {
+		
+		$this->category = 0;
+		$this->lat = 0;
+		$this->lon = 0;
+		$this->zoom = 2;
+		$this->title = l10n("New Map");
+		$this->status = false;
+		$this->category_changed = false;
+		$this->data_changed = false;
+		if ($value != 0)
+			$this->open($value);
+	}
+}
+?>
Index: /extensions/Psli_BingMaps/admin/class/psli_picture.class.php
===================================================================
--- /extensions/Psli_BingMaps/admin/class/psli_picture.class.php	(revision 15448)
+++ /extensions/Psli_BingMaps/admin/class/psli_picture.class.php	(revision 15448)
@@ -0,0 +1,18 @@
+<?php
+include_once(PSLI_BINGMAPS_CLASS_ENTITY_PHP);
+class Psli_Pin extends Psli_Entity {
+	
+	function generatePinList($template, $block) {
+		parent::generateList($template, $block, "picture");
+	}
+	
+	function create() {
+		return parent::create("picture");
+	}
+	
+	function __construct ($value = 0) {
+		parent::__construct();
+		$this->type = 3;
+	}
+}
+?>
Index: /extensions/Psli_BingMaps/admin/class/psli_pin.class.php
===================================================================
--- /extensions/Psli_BingMaps/admin/class/psli_pin.class.php	(revision 15448)
+++ /extensions/Psli_BingMaps/admin/class/psli_pin.class.php	(revision 15448)
@@ -0,0 +1,18 @@
+<?php
+include_once(PSLI_BINGMAPS_CLASS_ENTITY_PHP);
+class Psli_Pin extends Psli_Entity {
+	
+	function generatePinList($template, $block) {
+		parent::generateList($template, $block, "pin");
+	}
+		
+	function create() {
+		return parent::create("pin");
+	}
+	
+	function __construct ($value = 0) {
+		parent::__construct();
+		$this->type = 1;
+	}
+}
+?>
Index: /extensions/Psli_BingMaps/admin/class/psli_zone.class.php
===================================================================
--- /extensions/Psli_BingMaps/admin/class/psli_zone.class.php	(revision 15448)
+++ /extensions/Psli_BingMaps/admin/class/psli_zone.class.php	(revision 15448)
@@ -0,0 +1,91 @@
+<?php
+include_once(PSLI_BINGMAPS_CLASS_ENTITY_PHP);
+class Psli_Zone extends Psli_Entity {
+	
+	private $points;
+	
+	function clearZone() {
+		$this->points = Array();
+		$this->data_changed = true;
+	}
+	function addPoint ($lat, $lon) {
+		$point = Array();
+		$point["lat"] = $lat;
+		$point["lon"] = $lon;
+		array_push($this->points,$point);
+		$this->data_changed = true;
+	}
+	
+	function generateZoneList($template, $block) {
+		parent::generateList($template, $block, "zone");
+	}
+	
+	function delete() {
+		if (parent::delete() == true)
+		{			
+			$q = 'DELETE FROM '.PSLI_DATAPOINT_TABLE.' WHERE id_entity = '.$this->id.';';
+			pwg_query($q);	
+			return true;
+		}
+		else	
+			return false;
+	}
+	
+	function save() {
+		if (($this->status == true) && ($this->data_changed == true))
+		{
+			parent::save();
+			
+			$q = 'DELETE FROM '.PSLI_DATAPOINT_TABLE.' WHERE id_entity = '.$this->id.';';
+			pwg_query($q);				
+				
+			foreach ($this->points as $point)
+			{
+				$q = '
+					INSERT INTO '.PSLI_DATAPOINT_TABLE.' (id_entity, lat, lon)
+						VALUES ('.$this->id.', '.$point["lat"].', '.$point["lon"].');';
+				pwg_query($q);
+			}
+		}
+	}
+		
+	function open ($open) {
+		if (parent::open($open) == true)
+		{			
+			$this->points = Array();
+			$query_datapoint = '
+				SELECT lat, lon
+					FROM '.PSLI_DATAPOINT_TABLE.'
+					WHERE id_entity = '.$this->id.' ORDER BY id;'	;
+			$result_datapoint = pwg_query($query_datapoint);
+			if (pwg_db_num_rows($result_datapoint) > 0)
+			{
+				while ($row = pwg_db_fetch_assoc($result_datapoint))
+				{
+					$point = Array();	
+					$point["lat"] = $row['lat'];
+					$point["lon"] = $row['lon'];
+					array_push($this->points,$point);
+				}
+			}
+			return true;
+		}
+		else
+			return false;
+	}
+	
+	function create() {
+		return parent::create("zone");
+		$this->points = Array();
+	}
+	
+	function __construct () {
+		parent::__construct();
+		$this->type = 2;
+	}
+	
+	function getPoints () {
+		return $this->points;
+	}
+}
+?>
Index: /extensions/Psli_BingMaps/admin/css/admin_batch.css
===================================================================
--- /extensions/Psli_BingMaps/admin/css/admin_batch.css	(revision 15448)
+++ /extensions/Psli_BingMaps/admin/css/admin_batch.css	(revision 15448)
@@ -0,0 +1,22 @@
+.psli_batch_header_type {
+	border-top:1px solid white;
+	border-bottom:1px solid white;
+	font-weight:bold;
+	font-size:120%;
+	text-align:center;
+}
+
+.psli_batch_header_map {
+	text-align:center;
+	font-size:120%;
+	font-weight:bold;
+}
+
+.psli_batch_header_entity {
+	border-bottom:1px solid #444444;
+}
+
+.psli_batch_association {
+	border-bottom:1px solid #444444;
+	text-align:center;
+}
Index: /extensions/Psli_BingMaps/admin/include/admin_batch.inc.php
===================================================================
--- /extensions/Psli_BingMaps/admin/include/admin_batch.inc.php	(revision 15448)
+++ /extensions/Psli_BingMaps/admin/include/admin_batch.inc.php	(revision 15448)
@@ -0,0 +1,110 @@
+<?php
+/*
+Plugin Name: Psli-BingMaps
+Author: psli 
+*/
+
+// Chech whether we are indeed included by Piwigo.
+if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
+
+//******* Fetch global data *******
+global $template, $conf, $page, $debug;
+
+// import css
+$template->func_combine_css(array('path'=>PSLI_BINGMAPS_ADMIN_BATCH_CSS, 'order'=>0), $template->smarty);
+
+// Include class files for map, pin and zone
+include_once(PSLI_BINGMAPS_CLASS_MAP_PHP);
+include_once(PSLI_BINGMAPS_CLASS_ENTITY_PHP);
+
+//******* Data *******
+$tablecontent = "<tr><td>&nbsp;</td>\n";
+$colgroup = "";
+$nbcol = 1;
+$type_actuel = 0;
+
+//******* Get maps list *******
+$class_map = new Psli_Map ();
+$maps = $class_map->getMaps();
+foreach ($maps as $map)
+{
+	$colgroup .= '  <col width="200px">'."\n";
+	$tablecontent .= '  <td class="psli_batch_header_map">'.$map->getTitle().'</td>'."\n";
+	$nbcol ++;
+}	
+$tablecontent .= "</tr>\n";
+
+//******* Get entities list *******
+$class_entity = new Psli_Entity ();
+$entities = $class_entity->getEntities();
+
+
+/************************************************************************************/
+/* Submit - Update a pin ************************************************************/
+if (isset($_POST['save']))
+{
+	foreach ($entities as $entity)
+	{
+		$entity->clearMaps();
+		foreach ($maps as $map)
+		{
+			if (isset($_POST['entity-'.$entity->getId()."-".$map->getId()]))
+			{
+				$entity->addMap($map->getId());
+			}
+		}
+		$entity->save();
+	}
+}
+/************************************************************************************/
+
+//******* Process table *******
+foreach ($entities as $entity)
+{
+	if ($entity->getType() != $type_actuel)
+	{
+		$tablecontent .= '<tr><td class="psli_batch_header_type">';
+		switch ($entity->getType())
+		{
+			case 2:
+				$tablecontent .= l10n("Zone");
+				break;
+			case 1:
+				$tablecontent .= l10n("Pin");
+				break;
+			case 3:
+				$tablecontent .= l10n("Picture");
+				break;
+		}
+		$tablecontent .="</td>";
+		for ($i = 1; $i < $nbcol; $i++)
+			$tablecontent .= '<td class="psli_batch_header_type">&nbsp;</td>';
+		$tablecontent .= "</tr>\n";
+		$type_actuel = $entity->getType();
+	}
+	$tablecontent .= '<tr><td class="psli_batch_header_entity">'.$entity->getTitle().'</td>';
+		
+	foreach ($maps as $map)
+	{
+		$tablecontent .= '<td class="psli_batch_association"><input type="checkbox" name="entity-'.$entity->getId()."-".$map->getId().'" value="true" ';
+		if ($entity->isMapAssociated($map->getId()))
+			$tablecontent .= 'CHECKED';
+		$tablecontent .= '/></td>';
+	}
+		
+	$tablecontent .= "</tr>\n";
+}	
+
+//******* Assign data to template *******
+$template->assign(
+  array(
+	'VERSION' 	   => " v".PSLI_VERSION_MAJ.".".PSLI_VERSION_MIN,
+	'TABLECONTENT' => $tablecontent,
+	'COLGROUP' => $colgroup,
+  )
+);
+
+//******* Assign the template contents to ADMIN_CONTENT *******
+$template->set_filenames(array('plugin_admin_content' => PSLI_BINGMAPS_ADMIN_BATCH_TPL));
+$template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content');
+?>
Index: /extensions/Psli_BingMaps/admin/include/admin_conf.inc.php
===================================================================
--- /extensions/Psli_BingMaps/admin/include/admin_conf.inc.php	(revision 15448)
+++ /extensions/Psli_BingMaps/admin/include/admin_conf.inc.php	(revision 15448)
@@ -0,0 +1,46 @@
+<?php
+/*
+Plugin Name: Psli-BingMaps
+Author: psli 
+*/
+
+// Chech whether we are indeed included by Piwigo.
+if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
+
+//******* Fetch global data *******
+global $template, $conf, $page, $debug;
+
+/************************************************************************************/
+/* Submit - Update plugin setup *****************************************************/
+if (isset($_POST['configuration']))
+{
+	$query = '
+		UPDATE '.CONFIG_TABLE.'
+			SET value="'.addslashes($_POST['key']).'"
+			WHERE param="'.PSLI_CONF_KEY.'"
+			LIMIT 1';
+    pwg_query($query);
+	array_push($page['infos'], l10n('Information data registered in database'));
+}
+/************************************************************************************/
+
+//******* Get Bing Map Key *******
+$query = '
+	SELECT value
+		FROM '.CONFIG_TABLE.'
+		WHERE param = "'.PSLI_CONF_KEY.'";';
+$result = pwg_query($query);
+$row = pwg_db_fetch_assoc($result);
+
+//******* Assign data to template *******
+$template->assign(
+  array(
+	'KEY'          => $row['value'],
+	'VERSION' 	   => " v".PSLI_VERSION_MAJ.".".PSLI_VERSION_MIN
+  )
+);
+
+//******* Assign the template contents to ADMIN_CONTENT *******
+$template->set_filenames(array('plugin_admin_content' => PSLI_BINGMAPS_ADMIN_CONF_TPL));
+$template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content');
+?>
Index: /extensions/Psli_BingMaps/admin/include/admin_exif.inc.php
===================================================================
--- /extensions/Psli_BingMaps/admin/include/admin_exif.inc.php	(revision 15448)
+++ /extensions/Psli_BingMaps/admin/include/admin_exif.inc.php	(revision 15448)
@@ -0,0 +1,276 @@
+<?php
+/*
+Plugin Name: Psli-BingMaps
+Author: psli 
+*/
+
+// Chech whether we are indeed included by Piwigo.
+if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
+
+//******* Fetch global data *******
+global $template, $conf, $page, $debug, $prefixeTable;
+
+// Include class files for map, pin and zone
+include_once(PSLI_BINGMAPS_CLASS_PICTURE_PHP);
+
+//******* Select category to display *******
+$display = 'none';
+$opened = false;
+$category_ID = 0;
+$category_title = "";
+$zoom_min = 1;
+$zoom_max = 20;
+$nb_images_total = 0;
+$nb_new_exif = 0;
+$nb_updated_exif = 0;
+$associatedmap = "";
+if (isset($_POST['open']))
+{
+	if ((isset($_POST['categorySelected'])) && ($_POST['categorySelected'] != 0))
+	{
+		$opened = true;
+		$category_ID = $_POST['categorySelected'];
+	}
+	else
+		array_push($page['errors'], l10n('You need to select a category'));	
+}
+else
+{
+	if ((isset($_POST['hiddencategory'])) && ($_POST['hiddencategory'] != ""))
+	{
+		$opened = true;
+		$category_ID = $_POST['hiddencategory'];
+	}
+}
+
+/************************************************************************************/
+/* Submit - Import exif data ********************************************************/
+if (isset($_POST['save']))
+{
+	$zoommin = $_POST['zoommin'];
+	$zoommax = $_POST['zoommax'];
+	
+	$query = '
+		SELECT i.id id, i.file file, i.tn_ext tn_ext, i.name name, i.path path, i.representative_ext representative_ext 
+			FROM '.$prefixeTable.'images i 
+			LEFT JOIN '.$prefixeTable.'image_category c ON c.image_id = i.id
+			WHERE c.category_id = '.$category_ID.'
+			;';
+			
+	$result = pwg_query($query);
+			
+	while ($row = pwg_db_fetch_assoc($result))
+	{
+		$exif = exif_read_data($row['path'], 0, true);
+		$temp = false;
+		if (! ($exif===false))
+		{
+			if (isset($exif['GPS']))
+			{
+				$temp = exif_to_lat_lon($exif['GPS']);
+				
+				if (! ($temp === false))
+				{
+					$q = 'SELECT id, lat, lon 
+							FROM '.PSLI_ENTITIES_TABLE.'
+							WHERE id_action = '.$row['id'].' 
+								AND action = 3;';
+					$r = pwg_query($q);
+					if (pwg_db_num_rows($r) > 0)
+					{
+						$pic = pwg_db_fetch_assoc($r);
+						
+						if ((round($pic['lat'],8) != round($temp[0],8)) || (round($pic['lon'],8) != round($temp[1],8)))
+						{
+							$class_pin = new Psli_Pin();
+							$class_pin->open($row['id']);
+							$class_pin->setLatitude($temp[0]);
+							$class_pin->setLongitude($temp[1]);
+							$class_pin->setZoomMin($zoommin);
+							$class_pin->setZoomMax($zoommax);
+							
+							$class_pin->clearMaps();
+							if (isset ($_POST['associatedmap']))
+								for ($i = 0; $i < count($_POST['associatedmap']); $i++)
+									$class_pin->addMap($_POST['associatedmap'][$i]);
+									
+							$class_pin->save();	
+						}
+					}
+					else
+					{
+						$class_pin = new Psli_Pin();
+						$class_pin->create();
+						$class_pin->setLatitude($temp[0]);
+						$class_pin->setLongitude($temp[1]);
+						$class_pin->setTitle($row['name']);
+						$class_pin->setZoomMin($zoommin);
+						$class_pin->setZoomMax($zoommax);
+						$class_pin->setAction(3, $row['id']);
+						
+						$class_pin->clearMaps();
+						if (isset ($_POST['associatedmap']))
+							for ($i = 0; $i < count($_POST['associatedmap']); $i++)
+								$class_pin->addMap($_POST['associatedmap'][$i]);
+						
+						$class_pin->save();						
+					}
+				}
+			}
+		}
+	}	
+	array_push($page['infos'], l10n('Information data registered in database'));
+}
+/************************************************************************************/
+
+
+//******* Process album *******
+if ($opened)
+{
+	$query = '
+		SELECT uppercats
+		  FROM '.CATEGORIES_TABLE.'
+		  WHERE id = '.$category_ID.'
+		;';
+	$result = pwg_query($query);
+	$row = pwg_db_fetch_assoc($result);
+	$category_title = strip_tags(
+						get_cat_display_name_cache(
+							$row['uppercats'],
+							null,
+							false
+							)
+						);
+						
+	$query = '
+		SELECT count(*) nb
+			FROM '.$prefixeTable.'images i 
+			LEFT JOIN '.$prefixeTable.'image_category c ON c.image_id = i.id
+			WHERE c.category_id = '.$category_ID.'
+			;';
+			//get_thumbnail_url($row)
+	$result = pwg_query($query);
+	$row = pwg_db_fetch_assoc($result);
+	$nb_images_total = $row['nb'];
+	
+	if ($nb_images_total > 0)
+	{
+		$query = '
+			SELECT i.id id, i.file file, i.tn_ext tn_ext, i.name name, i.path path, i.representative_ext representative_ext 
+				FROM '.$prefixeTable.'images i 
+				LEFT JOIN '.$prefixeTable.'image_category c ON c.image_id = i.id
+				WHERE c.category_id = '.$category_ID.'
+				;';
+				
+		$result = pwg_query($query);
+				
+		while ($row = pwg_db_fetch_assoc($result))
+		{
+			$exif = exif_read_data($row['path'], 0, true);
+			$temp = false;
+			if (! ($exif===false))
+			{
+				if (isset($exif['GPS']))
+				{
+					$temp = exif_to_lat_lon($exif['GPS']);
+					
+					if (! ($temp === false))
+					{
+						$q = 'SELECT id, lat, lon 
+								FROM '.PSLI_ENTITIES_TABLE.'
+								WHERE id_action = '.$row['id'].' 
+									AND action = 3;';
+						$r = pwg_query($q);
+						if (pwg_db_num_rows($r) > 0)
+						{
+							$pic = pwg_db_fetch_assoc($r);
+							
+							if ((round($pic['lat'],8) != round($temp[0],8)) || (round($pic['lon'],8) != round($temp[1],8)))
+								$nb_updated_exif ++;
+						}
+						else
+							$nb_new_exif ++;			
+					}
+				}
+			}
+			
+		}
+		$category_title .= " (".$nb_images_total." ".l10n('pictures').")";
+		
+		//******* Generate map list *******
+		$query = "
+			SELECT id, title
+				FROM ".PSLI_MAPS_TABLE."
+				ORDER BY title;";
+		$result = pwg_query($query);
+		while ($row = pwg_db_fetch_assoc($result))
+		{
+			$associatedmap .= '<tr><td><input type="checkbox" name="associatedmap[]" value="'.$row['id'].'" style="margin-right:10px;" />'.$row['title'].'</td></tr>';
+		}
+	}
+	if (($nb_new_exif > 0) || ($nb_updated_exif > 0))
+		$display = 'block';
+	else
+	{
+		if (! isset($_POST['save']))
+			array_push($page['errors'], l10n('No exif in pictures for this category'));
+	}
+}
+	
+//******* Assign data to template *******
+generateCategoryList($category_ID, $opened, 'category_select', l10n('Category not selected'), true);
+$template->assign(
+  array(
+	'DISPLAY'      => $display,
+	'HIDDENCATEGORY' => $category_ID,
+	'TITLE' => $category_title,
+	'ZOOMMIN' => $zoom_min,
+	'ZOOMMAX' => $zoom_max,
+	'ASSOCIATEDMAP' => $associatedmap,
+	'NEWPICTURES' => $nb_new_exif,
+	'UPDATEDPICTURES' => $nb_updated_exif,
+  )
+);
+
+//******* Assign the template contents to ADMIN_CONTENT *******
+$template->set_filenames(array('plugin_admin_content' => PSLI_BINGMAPS_ADMIN_EXIF_TPL));
+$template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content');
+
+
+// functions
+function parse_fract( $f )
+{
+	$nd = explode( '/', $f );
+	return $nd[0]/$nd[1];
+}
+
+function parse_lat_lon( $arr )
+{
+	$v=0;
+	$v += parse_fract( $arr[0] );
+	$v += parse_fract( $arr[1] )/60;
+	$v += parse_fract( $arr[2] )/3600;
+	return $v;
+}
+
+function exif_to_lat_lon( $exif )
+{
+	$exif = array_intersect_key( $exif, array_flip( array('GPSLatitudeRef', 'GPSLatitude', 'GPSLongitudeRef', 'GPSLongitude') ) );
+	if ( count($exif)!=4 )
+		return false;
+	if ( !in_array($exif['GPSLatitudeRef'], array('S', 'N') ) )
+		return false;
+	if ( !in_array($exif['GPSLongitudeRef'], array('W', 'E') ) )
+		return false;
+	if (!is_array($exif['GPSLatitude']) or !is_array($exif['GPSLongitude']) )
+		return false;
+		
+	$lat = parse_lat_lon( $exif['GPSLatitude'] );
+	if ( $exif['GPSLatitudeRef']=='S' )
+		$lat = -$lat;
+	$lon = parse_lat_lon( $exif['GPSLongitude'] );
+	if ( $exif['GPSLongitudeRef']=='W' )
+		$lon = -$lon;
+	return array ($lat,$lon);
+}
+?>
Index: /extensions/Psli_BingMaps/admin/include/admin_map.inc.php
===================================================================
--- /extensions/Psli_BingMaps/admin/include/admin_map.inc.php	(revision 15448)
+++ /extensions/Psli_BingMaps/admin/include/admin_map.inc.php	(revision 15448)
@@ -0,0 +1,200 @@
+<?php
+/*
+Plugin Name: Psli-BingMaps
+Author: psli 
+*/
+
+// Chech whether we are indeed included by Piwigo.
+if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
+
+//******* Fetch global data *******
+global $template, $conf, $page, $debug;
+
+// Include class files for map, pin and zone
+include_once(PSLI_BINGMAPS_CLASS_MAP_PHP);
+
+//******* Select map to display *******
+$class_map = new Psli_Map();
+$addjs = "";
+if (isset($_POST['open']))
+{
+	if ((isset($_POST['mapSelected'])) && ($_POST['mapSelected'] != 0))
+		$class_map->open($_POST['mapSelected']);
+	else
+		array_push($page['errors'], l10n('You need to select a map'));	
+}
+else
+{
+	if ((isset($_POST['hiddenmap'])) && ($_POST['hiddenmap'] != ""))
+		$class_map->open($_POST['hiddenmap']);
+	else
+	{
+		$query = 'SELECT id FROM '.PSLI_MAPS_TABLE.' ORDER BY id LIMIT 1;';
+		$result = pwg_query($query);
+		if (pwg_db_num_rows($result) > 0)
+		{
+			$row = pwg_db_fetch_assoc($result);
+			$class_map->open($row['id']);
+		}
+	}
+}
+if ($class_map->isOpened())
+	$display = 'block';
+else
+	$display = 'none';
+
+/************************************************************************************/
+/* Submit - Delete map **************************************************************/
+if (isset($_POST['delete']))
+{
+	if (isset($_POST['deleteCheck']))
+	{
+		if ((isset($_POST['mapSelected'])) && ($_POST['mapSelected'] != 0))
+		{
+			$class_map->delete();
+			$class_map = new Psli_Map();
+			$display = 'none';
+			array_push($page['infos'], l10n('Information data registered in database'));
+		}
+		else
+			array_push($page['errors'], l10n('You need to select a map'));
+	}
+	else
+		array_push($page['errors'], l10n('You need to confirm deletion'));
+}
+/************************************************************************************/
+
+/************************************************************************************/
+/* Submit - Create a new map ********************************************************/
+if (isset($_POST['create']))
+{
+	$class_map = new Psli_Map();
+	$class_map->create();
+	$display = 'block';
+	array_push($page['infos'], l10n('Information data registered in database'));
+}
+/************************************************************************************/
+
+/************************************************************************************/
+/* Submit - Update in map data ******************************************************/
+if (isset ($_POST['save']))
+{
+    $class_map->setLatitude($_POST['lat']);
+	$class_map->setLongitude($_POST['lon']);
+	$class_map->setTitle($_POST['title']);
+	$class_map->setZoom($_POST['zoom']);
+	$class_map->setCategory($_POST['categorySelected']);
+		
+	$class_map->save();
+    array_push($page['infos'], l10n('Information data registered in database'));
+}
+/************************************************************************************/
+	
+//******* Load zone and pin for this map *******
+if ($class_map->isOpened())
+{
+	$query_entities = '
+		SELECT e.id id, lat, lon, zoomMin, zoomMax, action, id_action, title, type
+		  FROM '.PSLI_ENTITIES_TABLE.' e left join '.PSLI_ENTITIES_MAPS_TABLE.' j ON e.id = j.id_entity
+		  WHERE j.id_map = '.$class_map->getId().';';
+	$result_entities = pwg_query($query_entities);
+	
+	// Is there any entities ?
+	if (pwg_db_num_rows($result_entities) > 0)
+	{			
+		$desc_data = "";
+		$desc_function_mouse_over = "";
+		$desc_function_click = "";
+	
+		// For each sub category
+		while ($entity = pwg_db_fetch_assoc($result_entities))
+		{		
+			if ($entity['id_action'] != 0)
+			{
+				if ($entity['type'] == 2)
+				{
+					$query_datapoint = '
+						SELECT lat, lon
+							FROM '.PSLI_DATAPOINT_TABLE.'
+							WHERE id_entity = '.$entity['id'].' ORDER BY id;';
+					$result_datapoint = pwg_query($query_datapoint);
+					if (pwg_db_num_rows($result_datapoint) > 0)
+					{
+						$desc_data .= 'var psli_t_Vertices'.$entity['id'].' = new Array();'."\n";
+						while ($row = pwg_db_fetch_assoc($result_datapoint))
+						{
+							$desc_data .= 'psli_t_Vertices'.$entity['id'].'.push(new Microsoft.Maps.Location('.$row['lat'].','.$row['lon'].'));'."\n";
+						}
+						$desc_data .= '
+var psli_t_Child'.$entity['id'].' = new Microsoft.Maps.Polygon(psli_t_Vertices'.$entity['id'].',{fillColor: psli_g_PolygonColor, strokeColor: psli_g_PolygonColor});'."\n";
+					}
+				}
+				else
+				{
+					$desc_data .= '
+var psli_t_Child'.$entity['id'].' = new Microsoft.Maps.Pushpin(new Microsoft.Maps.Location('.$entity['lat'].','.$entity['lon'].'));'."\n";
+				}
+						
+				$desc_data .= '
+Microsoft.Maps.Events.addHandler(psli_t_Child'.$entity['id'].', "click", psli_MapsClick_'.$entity['id'].');'."\n";
+				switch ($entity['action'])
+				{
+					case 1:	
+						$desc_function_click .= '
+function psli_MapsClick_'.$entity['id'].' (e) { 
+psli_g_Map.setView({zoom:'.$entity['id_action'].', center: new Microsoft.Maps.Location('.$entity['lat'].', '.$entity['lon'].')});
+}'."\n";
+						break;
+					case 2:
+						$desc_function_click .= '
+function psli_MapsClick_'.$entity['id'].' (e) { 
+	alert ("'.l10n('Open this category').' '.$entity['title'].'");
+}'."\n";
+						break;
+					case 3:
+						$desc_function_click .= '
+function psli_MapsClick_'.$entity['id'].' (e) { 
+	alert ("'.l10n('Open this picture').' '.$entity['title'].'");
+}'."\n";
+						break;				
+				}
+				for ($i = $entity['zoomMin']; $i <= $entity['zoomMax']; $i++)
+				{
+					$desc_data .= 'psli_g_ZoomEntity['.($i - 1).'].push(psli_t_Child'.$entity['id'].');'."\n";
+				}
+			}
+		}
+		$addjs .= $desc_data;
+		$addjs .= $desc_function_mouse_over;
+		$addjs .= $desc_function_click;
+	}
+}
+
+//******* Get Bing Map Key *******
+$query = '
+	SELECT value
+		FROM '.CONFIG_TABLE.'
+		WHERE param = "'.PSLI_CONF_KEY.'";';
+$result = pwg_query($query);
+$row = pwg_db_fetch_assoc($result);
+$bing_map_key = $row['value'];
+
+//******* Send configuration data to template *******
+generateCategoryList($class_map->getCategory(), $class_map->isOpened(), 'category_select', l10n('Not assign to a category'));
+$class_map->generateMapsList($template, "map_select");
+$class_map->assignData($template, "LAT", "LON", "ZOOM", "TITLE", "HIDDENMAP");
+
+//******* Assign data to template *******
+$template->assign(
+  array(
+	'KEY'          => $bing_map_key,
+	'JSPATH'	   => PSLI_BINGMAPS_JS_MAP,
+	'DISPLAY'      => $display,
+	'ADDJS'      => $addjs,
+  )
+);
+
+//******* Assign the template contents to ADMIN_CONTENT *******
+$template->set_filenames(array('plugin_admin_content' => PSLI_BINGMAPS_ADMIN_MAP_TPL));
+$template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content');
+?>
Index: /extensions/Psli_BingMaps/admin/include/admin_picture.inc.php
===================================================================
--- /extensions/Psli_BingMaps/admin/include/admin_picture.inc.php	(revision 15448)
+++ /extensions/Psli_BingMaps/admin/include/admin_picture.inc.php	(revision 15448)
@@ -0,0 +1,119 @@
+<?php
+/*
+Plugin Name: Psli-BingMaps
+Author: psli 
+*/
+
+// Chech whether we are indeed included by Piwigo.
+if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
+
+//******* Fetch global data *******
+global $template, $conf, $page, $debug;
+
+$add_js = "";
+
+// Include class files for map, pin and zone
+include_once(PSLI_BINGMAPS_CLASS_PICTURE_PHP);
+
+//******* Get Bing Map Key *******
+$query = '
+	SELECT value
+		FROM '.CONFIG_TABLE.'
+		WHERE param = "'.PSLI_CONF_KEY.'";';
+$result = pwg_query($query);
+$row = pwg_db_fetch_assoc($result);
+$bing_map_key = $row['value'];
+
+//******* Select entity to display *******
+$class_pin = new Psli_Pin();
+if (isset($_POST['open']))
+{
+	if ((isset($_POST['pictureSelected'])) && ($_POST['pictureSelected'] != 0))
+		$class_pin->open($_POST['pictureSelected']);
+	else
+		array_push($page['errors'], l10n('You need to select a picture'));
+}
+else
+{
+	if ((isset($_POST['hiddenpicture'])) && ($_POST['hiddenpicture'] != ""))
+		$class_pin->open($_POST['hiddenpicture']);
+}		
+if ($class_pin->isOpened())
+	$display = 'block';
+else
+	$display = 'none';
+
+
+/************************************************************************************/
+/* Submit - Delete pin **************************************************************/
+if (isset($_POST['delete']))
+{
+	if (isset($_POST['deleteCheck']))
+	{
+		if ((isset($_POST['pictureSelected'])) && ($_POST['pictureSelected'] != 0))
+		{
+			$class_pin->open($_POST['pictureSelected']);
+			$class_pin->delete();
+			$class_pin = new Psli_Pin();
+			$display = 'none';
+			array_push($page['infos'], l10n('Information data registered in database'));
+		}
+		else
+			array_push($page['errors'], l10n('You need to select a picture'));
+	}
+	else
+		array_push($page['errors'], l10n('You need to confirm deletion'));
+}
+/************************************************************************************/
+
+/************************************************************************************/
+/* Submit - Update a pin ************************************************************/
+if (isset($_POST['save']))
+{
+	$class_pin->setTitle($_POST['title']);
+	$class_pin->setZoomMin($_POST['zoommin']);
+	$class_pin->setZoomMax($_POST['zoommax']);
+	
+	$class_pin->clearMaps();
+	if (isset ($_POST['associatedmap']))
+		for ($i = 0; $i < count($_POST['associatedmap']); $i++)
+			$class_pin->addMap($_POST['associatedmap'][$i]);
+			
+	$class_pin->save();
+	$display = 'block';
+	array_push($page['infos'], l10n('Information data registered in database'));
+}
+/************************************************************************************/
+
+//******* Generate map list *******
+$query = "
+	SELECT id, title
+		FROM ".PSLI_MAPS_TABLE."
+		ORDER BY title;";
+$result = pwg_query($query);
+$associatedmap = "";
+while ($row = pwg_db_fetch_assoc($result))
+{
+	$status = "";
+	if ($class_pin->isMapAssociated($row['id']))
+		$status = "CHECKED";
+	$associatedmap .= '<tr><td><input type="checkbox" name="associatedmap[]" value="'.$row['id'].'" style="margin-right:10px;" '.$status.' />'.$row['title'].'</td></tr>';
+}
+
+//******* Send configuration data to template *******
+$class_pin->assignData($template, "LAT", "LON", "ZOOMMIN", "ZOOMMAX", "TITLE", "ACTIONPICTURE", "HIDDENPICTURE");
+$class_pin->generatePinList($template, "picture_select");
+	
+//******* Assign data to template *******
+$template->assign(
+  array(
+	'KEY'          => $bing_map_key,
+	'DISPLAY'      => $display,
+	'ASSOCIATEDMAP' => $associatedmap,
+  )
+);
+
+//******* Assign the template contents to ADMIN_CONTENT *******
+$template->set_filenames(array('plugin_admin_content' => PSLI_BINGMAPS_ADMIN_PICTURE_TPL));
+$template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content');
+?>
Index: /extensions/Psli_BingMaps/admin/include/admin_pin.inc.php
===================================================================
--- /extensions/Psli_BingMaps/admin/include/admin_pin.inc.php	(revision 15448)
+++ /extensions/Psli_BingMaps/admin/include/admin_pin.inc.php	(revision 15448)
@@ -0,0 +1,171 @@
+<?php
+/*
+Plugin Name: Psli-BingMaps
+Author: psli 
+*/
+
+// Chech whether we are indeed included by Piwigo.
+if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
+
+//******* Fetch global data *******
+global $template, $conf, $page, $debug;
+
+$add_js = "";
+
+// Include class files for map, pin and zone
+include_once(PSLI_BINGMAPS_CLASS_PIN_PHP);
+
+//******* Get Bing Map Key *******
+$query = '
+	SELECT value
+		FROM '.CONFIG_TABLE.'
+		WHERE param = "'.PSLI_CONF_KEY.'";';
+$result = pwg_query($query);
+$row = pwg_db_fetch_assoc($result);
+$bing_map_key = $row['value'];
+
+//******* Select entity to display *******
+$class_pin = new Psli_Pin();
+if (isset($_POST['open']))
+{
+	if ((isset($_POST['pinSelected'])) && ($_POST['pinSelected'] != 0))
+		$class_pin->open($_POST['pinSelected']);
+	else
+		array_push($page['errors'], l10n('You need to select a pin'));
+}
+else
+{
+	if ((isset($_POST['hiddenpin'])) && ($_POST['hiddenpin'] != ""))
+		$class_pin->open($_POST['hiddenpin']);
+}		
+if ($class_pin->isOpened())
+	$display = 'block';
+else
+	$display = 'none';
+
+
+/************************************************************************************/
+/* Submit - Delete pin **************************************************************/
+if (isset($_POST['delete']))
+{
+	if (isset($_POST['deleteCheck']))
+	{
+		if ((isset($_POST['pinSelected'])) && ($_POST['pinSelected'] != 0))
+		{
+			$class_pin->open($_POST['pinSelected']);
+			$class_pin->delete();
+			$class_pin = new Psli_Pin();
+			$display = 'none';
+			array_push($page['infos'], l10n('Information data registered in database'));
+		}
+		else
+			array_push($page['errors'], l10n('You need to select a pin'));
+	}
+	else
+		array_push($page['errors'], l10n('You need to confirm deletion'));
+}
+/************************************************************************************/
+
+/************************************************************************************/
+/* Submit - Update a pin ************************************************************/
+if (isset($_POST['save']))
+{
+	$class_pin->setLatitude($_POST['lat']);
+	$class_pin->setLongitude($_POST['lon']);
+	$class_pin->setTitle($_POST['title']);
+	$class_pin->setZoomMin($_POST['zoommin']);
+	$class_pin->setZoomMax($_POST['zoommax']);
+	
+	$class_pin->clearMaps();
+	if (isset ($_POST['associatedmap']))
+		for ($i = 0; $i < count($_POST['associatedmap']); $i++)
+			$class_pin->addMap($_POST['associatedmap'][$i]);
+			
+	switch ($_POST['actionselect'])
+	{
+		case 2:
+			$class_pin->setAction(2, $_POST['actionalbumselect']);
+			break;
+		case 3:
+			$class_pin->setAction(3, $_POST['actionpictureid']);
+			break;
+	}
+	$class_pin->save();
+	$display = 'block';
+	array_push($page['infos'], l10n('Information data registered in database'));
+}
+/************************************************************************************/
+
+/************************************************************************************/
+/* Submit - Create a new pin ********************************************************/
+if (isset($_POST['create']))
+{
+	$class_pin = new Psli_Pin();
+	$class_pin->create();
+	$display = 'block';
+	array_push($page['infos'], l10n('Information data registered in database'));
+}
+/************************************************************************************/
+	
+
+//******* Get pin selected data *******
+if ($class_pin->isOpened())
+{
+	$add_js .= "\npsli_ShowPin();";
+	switch ($class_pin->getAction())
+	{
+		case 2:
+			$add_js .= "\ndocument.getElementById(\"actionselect\").selectedIndex = 0;";
+			$add_js .= "\ndocument.getElementById(\"actionalbumselect\").selectedItem = ".($class_pin->getActionId()).";";
+			$add_js .= "\ndocument.getElementById(\"ActionAlbum\").style.display = 'block';";
+			$add_js .= "\ndocument.getElementById(\"ActionPicture\").style.display = 'none';";
+			break;
+		case 3:
+			$add_js .= "\ndocument.getElementById(\"actionselect\").selectedIndex = 1;";
+			$add_js .= "\ndocument.getElementById(\"ActionAlbum\").style.display = 'none';";
+			$add_js .= "\ndocument.getElementById(\"ActionPicture\").style.display = 'block';";
+			break;
+	}
+}
+
+//******* Generate map list *******
+$query = "
+	SELECT id, title
+		FROM ".PSLI_MAPS_TABLE."
+		ORDER BY title;";
+$result = pwg_query($query);
+$associatedmap = "";
+while ($row = pwg_db_fetch_assoc($result))
+{
+	$status = "";
+	if ($class_pin->isMapAssociated($row['id']))
+		$status = "CHECKED";
+	$associatedmap .= '<tr><td><input type="checkbox" name="associatedmap[]" value="'.$row['id'].'" style="margin-right:10px;" '.$status.' />'.$row['title'].'</td></tr>';
+}
+	
+//******* Generate category list for pin action *******
+if ($class_pin->getAction() == 2)
+	generateCategoryList($class_pin->getActionId(), true, 'actionalbum_select', l10n('Not assign to a category'));
+else
+	generateCategoryList(0, false, 'actionalbum_select', l10n('Not assign to a category'));
+	
+//******* Send configuration data to template *******
+$class_pin->assignData($template, "LAT", "LON", "ZOOMMIN", "ZOOMMAX", "TITLE", "ACTIONPICTURE", "HIDDENPIN");
+$class_pin->generatePinList($template, "pin_select");
+	
+//******* Assign data to template *******
+$template->assign(
+  array(
+	'KEY'          => $bing_map_key,
+	'JSPATH'	   => PSLI_BINGMAPS_JS_PIN,
+	'DISPLAY'      => $display,
+	'ADDJS'        => $add_js,
+	'ASSOCIATEDMAP' => $associatedmap,
+	'ACTIONPICTURE' => $class_pin->getActionId()
+  )
+);
+
+//******* Assign the template contents to ADMIN_CONTENT *******
+$template->set_filenames(array('plugin_admin_content' => PSLI_BINGMAPS_ADMIN_PIN_TPL));
+$template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content');
+?>
Index: /extensions/Psli_BingMaps/admin/include/admin_zone.inc.php
===================================================================
--- /extensions/Psli_BingMaps/admin/include/admin_zone.inc.php	(revision 15448)
+++ /extensions/Psli_BingMaps/admin/include/admin_zone.inc.php	(revision 15448)
@@ -0,0 +1,230 @@
+<?php
+/*
+Plugin Name: Psli-BingMaps
+Author: psli 
+*/
+
+// Chech whether we are indeed included by Piwigo.
+if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
+
+//******* Fetch global data *******
+global $template, $conf, $page, $debug;
+
+$add_js = "";
+
+// Include class files for map, pin and zone
+include_once(PSLI_BINGMAPS_CLASS_ZONE_PHP);
+
+//******* Get Bing Map Key *******
+$query = '
+	SELECT value
+		FROM '.CONFIG_TABLE.'
+		WHERE param = "'.PSLI_CONF_KEY.'";';
+$result = pwg_query($query);
+$row = pwg_db_fetch_assoc($result);
+$bing_map_key = $row['value'];
+
+//******* Select entity to display *******
+$class_zone = new Psli_Zone();
+if (isset($_POST['open']))
+{
+	if ((isset($_POST['zoneSelected'])) && ($_POST['zoneSelected'] != 0))
+		$class_zone->open($_POST['zoneSelected']);
+	else
+		array_push($page['errors'], l10n('You need to select a zone'));
+}
+else
+{
+	if ((isset($_POST['hiddenzone'])) && ($_POST['hiddenzone'] != ""))
+		$class_zone->open($_POST['hiddenzone']);
+}		
+if ($class_zone->isOpened())
+	$display = 'block';
+else
+	$display = 'none';
+
+
+/************************************************************************************/
+/* Submit - Delete zone **************************************************************/
+if (isset($_POST['delete']))
+{
+	if (isset($_POST['deleteCheck']))
+	{
+		if ((isset($_POST['zoneSelected'])) && ($_POST['zoneSelected'] != 0))
+		{
+			$class_zone->delete();
+			$class_zone = new Psli_Zone();
+			$display = 'none';
+			array_push($page['infos'], l10n('Information data registered in database'));
+		}
+		else
+			array_push($page['errors'], l10n('You need to select a zone'));
+	}
+	else
+		array_push($page['errors'], l10n('You need to confirm deletion'));
+}
+/************************************************************************************/
+
+/************************************************************************************/
+/* Submit - Update a zone ************************************************************/
+if (isset($_POST['save']))
+{
+	$class_zone->setTitle($_POST['title']);
+	$class_zone->setZoomMin($_POST['zoommin']);
+	$class_zone->setZoomMax($_POST['zoommax']);
+	$class_zone->setLatitude($_POST['hiddencenterlat']);
+	$class_zone->setLongitude($_POST['hiddencenterlon']);
+	
+	$class_zone->clearZone();
+	$points = explode("#", $_POST['hiddenpoints']);
+	for ($i = 0; $i < (sizeof($points) - 1); $i++)
+	{
+		$coordonnee = explode(";", $points[$i]);
+		$class_zone->addPoint($coordonnee[0], $coordonnee[1]);
+	}
+	
+	$class_zone->clearMaps();
+	if (isset ($_POST['associatedmap']))
+		for ($i = 0; $i < count($_POST['associatedmap']); $i++)
+			$class_zone->addMap($_POST['associatedmap'][$i]);
+		
+	switch ($_POST['actionselect'])
+	{
+		case 1:
+			$class_zone->setAction(1, $_POST['actionzoomselect']);
+			break;
+		case 2:
+			$class_zone->setAction(2, $_POST['actionalbumselect']);
+			break;
+		case 3:
+			$class_zone->setAction(3, $_POST['actionpictureid']);
+			break;
+	}
+	$class_zone->save();
+	$display = 'block';
+	array_push($page['infos'], l10n('Information data registered in database'));
+}
+/************************************************************************************/
+
+/************************************************************************************/
+/* Submit - Create a new zone ********************************************************/
+if (isset($_POST['create']))
+{
+	$class_zone = new Psli_Zone();
+	$class_zone->create();
+	$display = 'block';
+	array_push($page['infos'], l10n('Information data registered in database'));
+}
+/************************************************************************************/
+
+//******* Draw zone *******
+if ($class_zone->isOpened())
+{
+	foreach ($class_zone->getPoints() as $point)
+	{
+		$add_js .= "\n".'psli_g_VerticeInitial.push(new Microsoft.Maps.Location('.$point['lat'].','.$point['lon'].'));';
+	}
+	$add_js .= '
+	psli_CopyInitial();
+	var psli_l_Pin = new Microsoft.Maps.Polygon(psli_g_Vertice,{fillColor: psli_g_PolygonColor, strokeColor: psli_g_PolygonColor});
+	psli_g_Map.entities.clear();
+	psli_g_Map.entities.push(psli_l_Pin);
+	psli_g_ZoneDraw = true;
+	'."\n";	
+}
+
+//******* Get zone selected data *******
+if ($class_zone->isOpened())
+{
+	switch ($class_zone->getAction())
+	{
+		case 1:
+			$add_js .= "\ndocument.getElementById(\"actionzoomselect\").selectedIndex = ".($class_zone->getActionId() - 1).";";
+			$add_js .= "\ndocument.getElementById(\"ActionAlbum\").style.display = 'none';";
+			$add_js .= "\ndocument.getElementById(\"ActionPicture\").style.display = 'none';";
+			break;
+		case 2:
+			$add_js .= "\ndocument.getElementById(\"actionselect\").selectedIndex = 1;";
+			$add_js .= "\ndocument.getElementById(\"actionalbumselect\").selectedItem = ".($class_zone->getActionId()).";";
+			$add_js .= "\ndocument.getElementById(\"ActionAlbum\").style.display = 'block';";
+			$add_js .= "\ndocument.getElementById(\"ActionZoom\").style.display = 'none';";
+			$add_js .= "\ndocument.getElementById(\"ActionPicture\").style.display = 'none';";
+			break;
+		case 3:
+			$add_js .= "\ndocument.getElementById(\"actionselect\").selectedIndex = 2;";
+			$add_js .= "\ndocument.getElementById(\"ActionAlbum\").style.display = 'none';";
+			$add_js .= "\ndocument.getElementById(\"ActionZoom\").style.display = 'none';";
+			$add_js .= "\ndocument.getElementById(\"ActionPicture\").style.display = 'block';";
+			break;
+	}
+}
+
+//******* Generate map list *******
+$query = "
+	SELECT id, title
+		FROM ".PSLI_MAPS_TABLE."
+		ORDER BY title;";
+$result = pwg_query($query);
+$associatedmap = "";
+while ($row = pwg_db_fetch_assoc($result))
+{
+	$status = "";
+	if ($class_zone->isMapAssociated($row['id']))
+		$status = "CHECKED";
+	$associatedmap .= '<tr><td><input type="checkbox" name="associatedmap[]" value="'.$row['id'].'" style="margin-right:10px;" '.$status.' />'.$row['title'].'</td></tr>';
+}
+		
+//******* Generate category list for pin action *******
+$query = '
+	SELECT id,name,uppercats,global_rank
+	  FROM '.CATEGORIES_TABLE.'
+	;';
+$result = pwg_query($query);
+$actionalbum = array();
+$actionalbum_selecteds = array();
+if (pwg_db_num_rows($result) > 0)
+{
+	while ($row = pwg_db_fetch_assoc($result))
+	{
+		if (($class_zone->getAction() == 2) && ($row['id'] == $class_zone->getActionId()))
+		{
+			$option = strip_tags(
+				get_cat_display_name_cache(
+					$row['uppercats'],
+					null,
+					false
+					)
+				);
+			$actionalbum_selecteds[$row['id']] = $option;
+			array_push($actionalbum, $row);
+		}
+		else
+		{
+			array_push($actionalbum, $row);
+		}
+	}
+}
+$actionalbum_selecteds[0] = l10n('Not assign to a category');
+usort($actionalbum, 'global_rank_compare');
+display_select_categories($actionalbum, $actionalbum_selecteds, 'actionalbum_select', true);
+	
+//******* Send configuration data to template *******
+$class_zone->assignData($template, "HIDDENCENTERLAT", "HIDDENCENTERLON", "ZOOMMIN", "ZOOMMAX", "TITLE", "ACTIONPICTURE", "HIDDENZONE");
+$class_zone->generateZoneList($template, "zone_select");
+	
+//******* Assign data to template *******
+$template->assign(
+  array(
+	'KEY'          => $bing_map_key,
+	'JSPATH'	   => PSLI_BINGMAPS_JS_ZONE,
+	'DISPLAY'      => $display,
+	'ADDJS'        => $add_js,
+	'ASSOCIATEDMAP' => $associatedmap,
+	'ACTIONPICTURE' => $class_zone->getActionId()
+  )
+);
+
+//******* Assign the template contents to ADMIN_CONTENT *******
+$template->set_filenames(array('plugin_admin_content' => PSLI_BINGMAPS_ADMIN_ZONE_TPL));
+$template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content');
+?>
Index: /extensions/Psli_BingMaps/admin/template/admin_batch.tpl
===================================================================
--- /extensions/Psli_BingMaps/admin/template/admin_batch.tpl	(revision 15448)
+++ /extensions/Psli_BingMaps/admin/template/admin_batch.tpl	(revision 15448)
@@ -0,0 +1,26 @@
+<!--
+Plugin Name: Psli-BingMaps
+Author: psli 
+-->
+<div class="titrePage">
+<h2>Psli-BingMaps</h2>
+</div>
+
+<form action="" method="post">
+<fieldset>
+<legend>{'Batch association'|@translate}</legend>
+	<table cellspacing=0>
+		<colgroup>
+			<col width="200px">
+			{$COLGROUP}
+		</colgroup>
+		<tr>
+			<td><input type="submit" name="save" value="{'Submit'|@translate}" style="width:100px;margin-bottom:10px;" /></td>
+		</tr>
+		{$TABLECONTENT}
+		<tr>
+			<td><input type="submit" name="save" value="{'Submit'|@translate}" style="width:100px;margin-top:10px;" /></td>
+		</tr>
+	</table>
+</fieldset>
+</form>
Index: /extensions/Psli_BingMaps/admin/template/admin_conf.tpl
===================================================================
--- /extensions/Psli_BingMaps/admin/template/admin_conf.tpl	(revision 15448)
+++ /extensions/Psli_BingMaps/admin/template/admin_conf.tpl	(revision 15448)
@@ -0,0 +1,54 @@
+<!--
+Plugin Name: Psli-BingMaps
+Author: psli 
+-->
+<div class="titrePage">
+<h2>Psli-BingMaps</h2>
+</div>
+
+<form action="" method="post">
+<input type="hidden" name="hiddenentity" value="{$HIDDENENTITY}" />
+<fieldset>
+<legend>{'Configuration'|@translate} {$VERSION}</legend>
+	<table style="width:100%;">
+		<colgroup>
+			<col width="200px" >
+			<col width="*" >
+		</colgroup>
+		<tr>
+			<td align="right">{'Bing Maps Key'|@translate} :</td>
+			<td>
+				<input type="text" style="width:500px;" maxlength="100" name="key" value="{$KEY}" />			
+				<input type="submit" name="configuration" value="{'Submit'|@translate}" style="width:140px;" />
+			</td>
+		</tr>
+		<tr>
+			<td align="right"><br />{'User manual'|@translate}</td>
+		</tr>
+		<tr>
+			<td>&nbsp;</td>
+			<td align="left">{'first step : create map'|@translate}</td>			
+		</tr>
+		<tr>
+			<td>&nbsp;</td>
+			<td align="left">{'second step : import exif data from your pictures'|@translate}</td>			
+		</tr>
+		<tr>
+			<td>&nbsp;</td>
+			<td align="left">{'third step : create new zone and new pin'|@translate}</td>			
+		</tr>
+		<tr>
+			<td>&nbsp;</td>
+			<td align="left">{'fourth step : make modification to pin associated to your pictures'|@translate}</td>			
+		</tr>
+		<tr>
+			<td>&nbsp;</td>
+			<td align="left">{'fifth step : check association with your maps'|@translate}</td>			
+		</tr>
+		<tr>
+			<td>&nbsp;</td>
+			<td align="left">{'last step : Enjoy !'|@translate}</td>			
+		</tr>
+	</table>
+</fieldset>
+</form>
Index: /extensions/Psli_BingMaps/admin/template/admin_exif.tpl
===================================================================
--- /extensions/Psli_BingMaps/admin/template/admin_exif.tpl	(revision 15448)
+++ /extensions/Psli_BingMaps/admin/template/admin_exif.tpl	(revision 15448)
@@ -0,0 +1,85 @@
+<!--
+Plugin Name: Psli-BingMaps
+Author: psli 
+-->
+<div class="titrePage">
+<h2>Psli-BingMaps</h2>
+</div>
+
+<form action="" method="post">
+<input type="hidden" name="hiddencategory" value="{$HIDDENCATEGORY}" />
+<!-- ***************************************************************************************************** -->
+<!-- ***************************************************************************************************** -->
+<!-- ***************************************************************************************************** -->
+<!-- ***************************************************************************************************** -->
+<table style="width:100%;">
+	<colgroup>
+		<col width="200px" >
+		<col width="*" >
+	</colgroup>
+	<tr>
+		<td align="right">
+			{'Select a Category'|@translate} :
+		</td>
+		<td>
+			<select name="categorySelected" style="width:300px;">
+				{html_options options=$category_select_selected}
+				{html_options options=$category_select}
+			</select>
+			<input type="submit" name="open" value="{'Open this category'|@translate}" style="width:140px;" />
+		</td>
+	</tr>
+</table>
+
+<!-- ***************************************************************************************************** -->
+<!-- ***************************************************************************************************** -->
+<!-- ***************************************************************************************************** -->
+<!-- ***************************************************************************************************** -->
+<fieldset id="tableData" style="display:none;">
+<legend>{$TITLE}</legend>
+	<table style="margin-top:10px;width:95%;">
+		<colgroup>
+			<col width="172px" >
+			<col width="470px" >
+			<col width="130px" >
+			<col width="*" >
+		</colgroup>
+		<tr>
+			<td align="right">{'Added pictures'|@translate}&nbsp;:</td>
+			<td>
+				{$NEWPICTURES}
+			</td>
+			<td><input type="submit" name="save" value="{'Submit'|@translate}" style="width:100px;margin-bottom:5px;" /></td>
+			<td rowspan="4" style="text-align:left;vertical-align:top;" >
+				<fieldset style="height:100%">
+				<legend>{'Associated map'|@translate}</legend>
+					<table style="width:100%;text-align:left;">
+						{$ASSOCIATEDMAP}
+					</table>
+				</fieldset>
+			<td>
+		</tr>
+		<tr>
+			<td align="right">{'Modified pictures'|@translate}&nbsp;:</td>
+			<td>
+				{$UPDATEDPICTURES}
+			</td>
+		</tr>		
+		<tr>
+			<td align="right">{'Zoom minimum'|@translate}&nbsp;:</td>
+			<td>
+				<input id="zoommin" type="text" name="zoommin" value="{$ZOOMMIN}" style="width:398px;margin-right:5px;" maxlength="2">
+			</td>							
+		</tr>
+		<tr>
+			<td align="right">{'Zoom maximum'|@translate}&nbsp;:</td>
+			<td>
+				<input id="zoommax" type="text" name="zoommax" value="{$ZOOMMAX}" style="width:398px;margin-right:5px;" maxlength="2">
+			</td>								
+		</tr>
+	</table>
+</fieldset>
+<script>	
+	document.getElementById("tableData").style.display='{$DISPLAY}';
+</script>
+</form>
Index: /extensions/Psli_BingMaps/admin/template/admin_map.tpl
===================================================================
--- /extensions/Psli_BingMaps/admin/template/admin_map.tpl	(revision 15448)
+++ /extensions/Psli_BingMaps/admin/template/admin_map.tpl	(revision 15448)
@@ -0,0 +1,123 @@
+<!--
+Plugin Name: Psli-BingMaps
+Author: psli 
+-->
+<div class="titrePage">
+<h2>Psli-BingMaps</h2>
+</div>
+
+<form action="" method="post">
+<input type="hidden" name="hiddenmap" value="{$HIDDENMAP}" />
+<!-- ***************************************************************************************************** -->
+<!-- ***************************************************************************************************** -->
+<!-- ***************************************************************************************************** -->
+<!-- ***************************************************************************************************** -->
+<table style="width:100%;">
+	<colgroup>
+		<col width="200px" >
+		<col width="*" >
+	</colgroup>
+	<tr>
+		<td>
+		&nbsp;
+		</td>
+		<td colspan="" style="text-align:left;">
+			<input type="submit" name="create" value="{'Create a map'|@translate}" style="width:140px;" />
+			<br />
+			<br />
+		</td>
+	</tr>
+	<tr>
+		<td align="right">
+			{'Select a Map'|@translate} :
+		</td>
+		<td>
+			<select name="mapSelected" style="width:300px;">
+				{html_options options=$map_select_selected}
+				{html_options options=$map_select}
+			</select>
+			<input type="submit" name="open" value="{'Open this map'|@translate}" style="width:140px;" />
+			<input type="submit" name="delete" value="{'Delete this map'|@translate}" style="width:140px;margin-left:30px;" />
+			<input type="checkbox" name="deleteCheck">&nbsp;{'Are you sure?'|@translate}</input>
+		</td>
+	</tr>
+</table>
+
+<!-- ***************************************************************************************************** -->
+<!-- ***************************************************************************************************** -->
+<!-- ***************************************************************************************************** -->
+<!-- ***************************************************************************************************** -->
+<fieldset id="tableData" style="display:none;">
+<legend>{$TITLE}</legend>
+	<table>
+		<colgroup>
+			<col width="200px" >
+			<col width="500px" >
+			<col width="*" >
+		</colgroup>
+		<tr>
+			<td align="right">{'Map Title'|@translate} : </td>
+			<td><input type="text" style="width:450px;" name="title" id="title" value="{$TITLE}" /></td>
+			<td rowspan="2" style="text-align:left;vertical-align:center;">
+				<input type="submit" name="save" value="{'Submit'|@translate}" style="width:100px;margin-bottom:5px;" />
+			</td>
+		</tr>
+		<tr>
+			<td align="right">{'Category'|@translate} : </td>
+			<td>
+				<select name="categorySelected" style="width:454px;">
+					{html_options options=$category_select_selected}
+					{html_options options=$category_select}
+				</select>
+			</td>
+		</tr>
+		<tr>
+			<td align="right">{'Zoom'|@translate} : </td>
+			<td><input type="text" style="width:250px;" maxlength="3" name="zoom" id="zoom" value="{$ZOOM}" onChange="psli_AdminUpdateMap();" /></td>
+			<td style="text-align:left;">
+				<button id="showView" style="width:180px;" type="button" onclick="psli_ShowGuestView();">{'Show guest view'|@translate}</button>
+			</td>
+		</tr>
+		<tr>
+			<td align="right">{'Center Latittude'|@translate} : </td>
+			<td><input type="text" style="width:250px;" maxlength="21" name="lat" id="lat" value="{$LAT}" onChange="psli_AdminUpdateMap();" /></td>
+			<td style="text-align:left;">
+				<button id="showData" style="width:180px;" type="button" onclick="psli_ShowMapData();" DISABLED>{'Show map center'|@translate}</button>
+			</td>
+		</tr>
+		<tr>
+			<td align="right">{'Center Longitude'|@translate} : </td>
+			<td><input type="text" style="width:250px;" maxlength="21" name="lon" id="lon" value="{$LON}" onChange="psli_AdminUpdateMap();" /></td>
+		</tr>
+	</table>
+</fieldset>
+
+<!-- ***************************************************************************************************** -->
+<!-- ***************************************************************************************************** -->
+<!-- ***************************************************************************************************** -->
+<!-- ***************************************************************************************************** -->		
+<div id='myMap' style="position:relative; text-align:center; height:600px; margin:15px; border:2px solid white;"></div>
+<script charset="UTF-8" type="text/javascript" src="http://ecn.dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=7.0"></script>			   
+<script charset="UTF-8" type="text/javascript" src="{$JSPATH}"></script>			   
+<script>
+	psli_g_BingKey = "{$KEY}";
+	psli_g_zoomInitial = {$ZOOM};
+	psli_g_MapCenter = new Microsoft.Maps.Location({$LAT}, {$LON});
+	
+	psli_g_MapOptions = {ldelim}
+		credentials: psli_g_BingKey, 
+		showDashboard:false,
+		showMapTypeSelector:false,
+		showScalebar:false,
+		mapTypeId: Microsoft.Maps.MapTypeId.road,
+		center: psli_g_MapCenter,
+		zoom: psli_g_zoomInitial
+	{rdelim};
+
+	psli_InitMap();
+	
+	document.getElementById("tableData").style.display='{$DISPLAY}';
+	
+	{$ADDJS}
+</script>
+</form>
Index: /extensions/Psli_BingMaps/admin/template/admin_picture.tpl
===================================================================
--- /extensions/Psli_BingMaps/admin/template/admin_picture.tpl	(revision 15448)
+++ /extensions/Psli_BingMaps/admin/template/admin_picture.tpl	(revision 15448)
@@ -0,0 +1,115 @@
+<!--
+Plugin Name: Psli-BingMaps
+Author: psli 
+-->
+<div class="titrePage">
+<h2>Psli-BingMaps</h2>
+</div>
+
+<form action="" method="post">
+<input type="hidden" name="hiddenpicture" value="{$HIDDENPICTURE}" />
+<!-- ***************************************************************************************************** -->
+<!-- ***************************************************************************************************** -->
+<!-- ***************************************************************************************************** -->
+<!-- ***************************************************************************************************** -->
+<table style="width:100%;">
+	<colgroup>
+		<col width="200px" >
+		<col width="*" >
+	</colgroup>
+	<tr>
+		<td align="right">
+			{'Select a picture'|@translate} :
+		</td>
+		<td>
+			<select name="pictureSelected" style="width:300px;">
+				{html_options options=$picture_select_selected}
+				{html_options options=$picture_select}
+			</select>
+			<input type="submit" name="open" value="{'Open this picture'|@translate}" style="width:140px;" />
+			<input type="submit" name="delete" value="{'Delete this picture'|@translate}" style="width:140px;margin-left:30px;" />
+			<input type="checkbox" name="deleteCheck">&nbsp;{'Are you sure?'|@translate}</input>
+		</td>
+	</tr>
+</table>
+
+<!-- ***************************************************************************************************** -->
+<!-- ***************************************************************************************************** -->
+<!-- ***************************************************************************************************** -->
+<!-- ***************************************************************************************************** -->
+<fieldset id="tableData" style="display:none;">
+<legend>{'Entity field'|@translate} : {$TITLE}</legend>
+	<table style="margin-top:10px;width:95%;">
+		<colgroup>
+			<col width="172px" >
+			<col width="470px" >
+			<col width="130px" >
+			<col width="*" >
+		</colgroup>
+		<tr>
+			<td align="right">{'Picture Title'|@translate} : </td>
+			<td><input type="text" style="width:398px;" name="title" id="title" value="{$TITLE}" /></td>
+			<td><input type="submit" name="save" value="{'Submit'|@translate}" style="width:100px;margin-bottom:5px;" /></td>
+			<td rowspan="7" style="text-align:left;vertical-align:top;" >
+				<fieldset style="height:100%">
+				<legend>{'Associated map'|@translate}</legend>
+					<table style="width:100%;text-align:left;">
+						{$ASSOCIATEDMAP}
+					</table>
+				</fieldset>
+			<td>
+		</tr>
+		<tr>
+			<td align="right">{'Zoom minimum'|@translate}&nbsp;:</td>
+			<td>
+				<input id="zoommin" type="text" name="zoommin" value="{$ZOOMMIN}" style="width:398px;margin-right:5px;" maxlength="2">
+				<button type="button" onclick="psli_SetMinimum();">{'Set'|@translate}</button>
+			</td>
+		</tr>
+		<tr>
+			<td align="right">{'Zoom maximum'|@translate}&nbsp;:</td>
+			<td>
+				<input id="zoommax" type="text" name="zoommax" value="{$ZOOMMAX}" style="width:398px;margin-right:5px;" maxlength="2">
+				<button type="button" onclick="psli_SetMaximum();">{'Set'|@translate}</button>	
+			</td>								
+		</tr>
+	</table>
+</fieldset>	
+
+	<!-- ***************************************************************************************************** -->
+	<!-- ***************************************************************************************************** -->
+	<!-- ***************************************************************************************************** -->
+	<!-- ***************************************************************************************************** -->		
+	<div id='myMap' style="position:relative; text-align:center; height:600px; margin:15px; border:2px solid white;"></div>
+	<script charset="UTF-8" type="text/javascript" src="http://ecn.dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=7.0"></script>			   			   
+	<script>
+		psli_g_BingKey = "{$KEY}";
+		psli_g_MapCenter = new Microsoft.Maps.Location({$LAT}, {$LON});
+		
+		psli_g_MapOptions = {ldelim}
+			credentials: psli_g_BingKey, 
+			showDashboard:false,
+			showMapTypeSelector:false,
+			showScalebar:false,
+			mapTypeId: Microsoft.Maps.MapTypeId.road,
+			center: psli_g_MapCenter,
+			zoom: parseInt(document.getElementById("zoommin").value)
+		{rdelim};
+		psli_g_Map = new Microsoft.Maps.Map(document.getElementById("myMap"), psli_g_MapOptions);
+		psli_g_Map.setView({ldelim}center: psli_g_MapCenter{rdelim});
+		var pin = new Microsoft.Maps.Pushpin(psli_g_MapCenter);
+		psli_g_Map.entities.clear();
+		psli_g_Map.entities.push(pin);
+		
+		document.getElementById("tableData").style.display='{$DISPLAY}';
+		 
+		function psli_SetMinimum() {ldelim}
+			document.getElementById("zoommin").value = psli_g_Map.getZoom();
+		{rdelim}
+
+		function psli_SetMaximum() {ldelim}
+			document.getElementById("zoommax").value = psli_g_Map.getZoom();
+		{rdelim}
+	</script>
+
+</form>
Index: /extensions/Psli_BingMaps/admin/template/admin_pin.tpl
===================================================================
--- /extensions/Psli_BingMaps/admin/template/admin_pin.tpl	(revision 15448)
+++ /extensions/Psli_BingMaps/admin/template/admin_pin.tpl	(revision 15448)
@@ -0,0 +1,149 @@
+<!--
+Plugin Name: Psli-BingMaps
+Author: psli 
+-->
+<div class="titrePage">
+<h2>Psli-BingMaps</h2>
+</div>
+
+<form action="" method="post">
+<input type="hidden" name="hiddenpin" value="{$HIDDENPIN}" />
+<!-- ***************************************************************************************************** -->
+<!-- ***************************************************************************************************** -->
+<!-- ***************************************************************************************************** -->
+<!-- ***************************************************************************************************** -->
+<table style="width:100%;">
+	<colgroup>
+		<col width="200px" >
+		<col width="*" >
+	</colgroup>
+	<tr>
+		<td>
+		&nbsp;
+		</td>
+		<td colspan="" style="text-align:left;">
+			<input type="submit" name="create" value="{'Create a pin'|@translate}" style="width:140px;" />
+			<br />
+			<br />
+		</td>
+	</tr>
+	<tr>
+		<td align="right">
+			{'Select a pin'|@translate} :
+		</td>
+		<td>
+			<select name="pinSelected" style="width:300px;">
+				{html_options options=$pin_select_selected}
+				{html_options options=$pin_select}
+			</select>
+			<input type="submit" name="open" value="{'Open this pin'|@translate}" style="width:140px;" />
+			<input type="submit" name="delete" value="{'Delete this pin'|@translate}" style="width:140px;margin-left:30px;" />
+			<input type="checkbox" name="deleteCheck">&nbsp;{'Are you sure?'|@translate}</input>
+		</td>
+	</tr>
+</table>
+
+<!-- ***************************************************************************************************** -->
+<!-- ***************************************************************************************************** -->
+<!-- ***************************************************************************************************** -->
+<!-- ***************************************************************************************************** -->
+<fieldset id="tableData" style="display:none;">
+<legend>{'Entity field'|@translate} : {$TITLE}</legend>
+	<table style="margin-top:10px;width:95%;">
+		<colgroup>
+			<col width="172px" >
+			<col width="470px" >
+			<col width="130px" >
+			<col width="*" >
+		</colgroup>
+		<tr>
+			<td align="right">{'Pin Title'|@translate} : </td>
+			<td><input type="text" style="width:398px;" name="title" id="title" value="{$TITLE}" /></td>
+			<td><input type="submit" name="save" value="{'Submit'|@translate}" style="width:100px;margin-bottom:5px;" /></td>
+			<td rowspan="7" style="text-align:left;vertical-align:top;" >
+				<fieldset style="height:100%">
+				<legend>{'Associated map'|@translate}</legend>
+					<table style="width:100%;text-align:left;">
+						{$ASSOCIATEDMAP}
+					</table>
+				</fieldset>
+			<td>
+		</tr>
+		<tr>
+			<td align="right">{'Latitude'|@translate}&nbsp;:</td>
+			<td><input id="lat" type="text" name="lat" value="{$LAT}" style="width:398px;" maxlength="21" onChange="psli_AdminUpdateMap();" /></td>						
+		</tr>
+		<tr>
+			<td align="right">{'Longitude'|@translate}&nbsp;:</td>
+			<td><input id="lon" type="text" name="lon" value="{$LON}" style="width:398px;" maxlength="21" onChange="psli_AdminUpdateMap();" /></td>	
+		</tr>
+		<tr>
+			<td align="right">{'Zoom minimum'|@translate}&nbsp;:</td>
+			<td>
+				<input id="zoommin" type="text" name="zoommin" value="{$ZOOMMIN}" style="width:398px;margin-right:5px;" maxlength="2">
+				<button type="button" onclick="psli_SetMinimum();">{'Set'|@translate}</button>
+			</td>
+		</tr>
+		<tr>
+			<td align="right">{'Zoom maximum'|@translate}&nbsp;:</td>
+			<td>
+				<input id="zoommax" type="text" name="zoommax" value="{$ZOOMMAX}" style="width:398px;margin-right:5px;" maxlength="2">
+				<button type="button" onclick="psli_SetMaximum();">{'Set'|@translate}</button>	
+			</td>								
+		</tr>
+		<tr>
+			<td align="right">{'Action'|@translate}&nbsp;:</td>
+			<td align="left">
+				<select id="actionselect" name="actionselect" style="width:402px;" onchange="psli_ChangeActionMode()">
+					<option value="2">{'Open Category'|@translate}</option>
+					<option value="3">{'Open Picture'|@translate}</option>
+				</select>
+			</td>
+		</tr>		
+		<tr id="ActionAlbum" style="display:block;">
+			<td align="right">{'Action Album'|@translate}&nbsp;:</td>
+			<td>
+				<select id="actionalbumselect" name="actionalbumselect" style="width:402px;" >
+					{html_options options=$actionalbum_select_selected}
+					{html_options options=$actionalbum_select}
+				</select>
+			</td>
+		</tr>
+		<tr id="ActionPicture" style="display:none;">
+			<td align="right">{'Action Picture'|@translate}&nbsp;:</td>
+			<td>
+				<input id="actionpictureid" type="text" name="actionpictureid" value="{$ACTIONPICTURE}" style="width:398px;margin-right:5px;" />
+			</td>
+		</tr>
+	</table>
+</fieldset>	
+
+	<!-- ***************************************************************************************************** -->
+	<!-- ***************************************************************************************************** -->
+	<!-- ***************************************************************************************************** -->
+	<!-- ***************************************************************************************************** -->		
+	<div id='myMap' style="position:relative; text-align:center; height:600px; margin:15px; border:2px solid white;"></div>
+	<script charset="UTF-8" type="text/javascript" src="http://ecn.dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=7.0"></script>			   
+	<script charset="UTF-8" type="text/javascript" src="{$JSPATH}"></script>			   
+	<script>
+		psli_g_BingKey = "{$KEY}";
+		psli_g_MapCenter = new Microsoft.Maps.Location(document.getElementById("lat").value, document.getElementById("lon").value);
+		
+		psli_g_MapOptions = {ldelim}
+			credentials: psli_g_BingKey, 
+			showDashboard:false,
+			showMapTypeSelector:false,
+			showScalebar:false,
+			mapTypeId: Microsoft.Maps.MapTypeId.road,
+			center: psli_g_MapCenter,
+			zoom: parseInt(document.getElementById("zoommin").value)
+		{rdelim};
+
+		psli_InitMap();
+		
+		document.getElementById("tableData").style.display='{$DISPLAY}';
+		
+		{$ADDJS}
+	</script>
+
+</form>
Index: /extensions/Psli_BingMaps/admin/template/admin_zone.tpl
===================================================================
--- /extensions/Psli_BingMaps/admin/template/admin_zone.tpl	(revision 15448)
+++ /extensions/Psli_BingMaps/admin/template/admin_zone.tpl	(revision 15448)
@@ -0,0 +1,183 @@
+<!--
+Plugin Name: Psli-BingMaps
+Author: psli 
+-->
+<div class="titrePage">
+<h2>Psli-BingMaps</h2>
+</div>
+
+<form action="" method="post">
+<input type="hidden" name="hiddenzone" value="{$HIDDENZONE}" />
+<input type="hidden" name="hiddenpoints" id="hiddenpoints" value="{$HIDDENPOINTS}" />
+<input type="hidden" name="hiddencenterlat" id="hiddencenterlat" value="{$HIDDENCENTERLAT}" />
+<input type="hidden" name="hiddencenterlon" id="hiddencenterlon" value="{$HIDDENCENTERLON}" />
+<!-- ***************************************************************************************************** -->
+<!-- ***************************************************************************************************** -->
+<!-- ***************************************************************************************************** -->
+<!-- ***************************************************************************************************** -->
+<table style="width:100%;">
+	<colgroup>
+		<col width="200px" >
+		<col width="*" >
+	</colgroup>
+	<tr>
+		<td>
+		&nbsp;
+		</td>
+		<td colspan="" style="text-align:left;">
+			<input type="submit" name="create" value="{'Create a zone'|@translate}" style="width:140px;" />
+			<br />
+			<br />
+		</td>
+	</tr>
+	<tr>
+		<td align="right">
+			{'Select a zone'|@translate} :
+		</td>
+		<td>
+			<select name="zoneSelected" style="width:300px;">
+				{html_options options=$zone_select_selected}
+				{html_options options=$zone_select}
+			</select>
+			<input type="submit" name="open" value="{'Open this zone'|@translate}" style="width:140px;" />
+			<input type="submit" name="delete" value="{'Delete this zone'|@translate}" style="width:140px;margin-left:30px;" />
+			<input type="checkbox" name="deleteCheck">&nbsp;{'Are you sure?'|@translate}</input>
+		</td>
+	</tr>
+</table>
+
+<!-- ***************************************************************************************************** -->
+<!-- ***************************************************************************************************** -->
+<!-- ***************************************************************************************************** -->
+<!-- ***************************************************************************************************** -->
+<fieldset id="tableData" style="display:none;">
+<legend>{'Entity field'|@translate} : {$TITLE}</legend>
+	<table style="margin-top:10px;width:95%;">
+		<colgroup>
+			<col width="172px" >
+			<col width="470px" >
+			<col width="200px" >
+			<col width="*" >
+		</colgroup>
+		<tr>
+			<td align="right">{'Zone Title'|@translate} : </td>
+			<td><input type="text" style="width:398px;" name="zonetitle" id="zonetitle" value="{$TITLE}" /></td>
+			<td style="text-align:left;">
+				<input type="submit" name="save" value="{'Submit'|@translate}" style="width:100px;margin-bottom:5px;" />
+			</td>
+			<td rowspan="5">
+				<fieldset>
+				<legend>{'Associated map'|@translate}</legend>					
+					<table>
+						{$ASSOCIATEDMAP}
+					</table>
+				</fieldset>
+			<td>
+		</tr>		
+		<tr>
+			<td align="right">{'Zoom minimum'|@translate}&nbsp;:</td>
+			<td>
+				<input id="zoommin" type="text" name="zoommin" value="{$ZOOMMIN}" style="width:398px;margin-right:5px;" maxlength="2">
+				<button type="button" onclick="psli_SetMinimum();">{'Set'|@translate}</button>
+			</td>
+			<td style="text-align:left;">
+				<button id="deletePoint" style="width:180px;" type="button" onclick="psli_DeleteLast();">{'Delete last point'|@translate}</button>
+			</td>	
+		</tr>
+		<tr>
+			<td align="right">{'Zoom maximum'|@translate}&nbsp;:</td>
+			<td>
+				<input id="zoommax" type="text" name="zoommax" value="{$ZOOMMAX}" style="width:398px;margin-right:5px;" maxlength="2">
+				<button type="button" onclick="psli_SetMaximum();">{'Set'|@translate}</button>	
+			</td>
+			<td style="text-align:left;">
+				<button id="deleteAllPoints" style="width:180px;" type="button" onclick="psli_DeleteAll();">{'Delete all points'|@translate}</button>
+			</td>								
+		</tr>
+		<tr>
+			<td align="right">{'Action'|@translate}&nbsp;:</td>
+			<td align="left">
+				<select id="actionselect" name="actionselect" style="width:402px;" onchange="psli_ChangeActionMode()">
+					<option value="1">{'Change Zoom Level'|@translate}</option>
+					<option value="2">{'Open Category'|@translate}</option>
+					<option value="3">{'Open Picture'|@translate}</option>
+				</select>
+			</td>
+			<td style="text-align:left;">
+				<button id="reloadPoints" style="width:180px;" type="button" onclick="psli_Reload();">{'Reload saved zone'|@translate}</button>
+			</td>
+		</tr>
+		<tr id="ActionZoom" style="display:block;">
+			<td align="right">{'Action Zoom'|@translate}&nbsp;:</td>
+			<td>
+				<select id="actionzoomselect" name="actionzoomselect" style="width:402px;margin-right:5px;" >
+					<option value="1">{'Zoom level 1'|@translate}</option>
+					<option value="2">{'Zoom level 2'|@translate}</option>
+					<option value="3">{'Zoom level 3'|@translate}</option>
+					<option value="4">{'Zoom level 4'|@translate}</option>
+					<option value="5">{'Zoom level 5'|@translate}</option>
+					<option value="6">{'Zoom level 6'|@translate}</option>
+					<option value="7">{'Zoom level 7'|@translate}</option>
+					<option value="8">{'Zoom level 8'|@translate}</option>
+					<option value="9">{'Zoom level 9'|@translate}</option>
+					<option value="10">{'Zoom level 10'|@translate}</option>
+					<option value="11">{'Zoom level 11'|@translate}</option>
+					<option value="12">{'Zoom level 12'|@translate}</option>
+					<option value="13">{'Zoom level 13'|@translate}</option>
+					<option value="14">{'Zoom level 14'|@translate}</option>
+					<option value="15">{'Zoom level 15'|@translate}</option>
+					<option value="16">{'Zoom level 16'|@translate}</option>
+					<option value="17">{'Zoom level 17'|@translate}</option>
+					<option value="18">{'Zoom level 18'|@translate}</option>
+					<option value="19">{'Zoom level 19'|@translate}</option>
+					<option value="20">{'Zoom level 20'|@translate}</option>
+				</select>														
+				<button type="button" onclick="psli_SetAction();">{'Set'|@translate}</button>					
+			</td>
+		</tr>
+		<tr id="ActionAlbum" style="display:none;">
+			<td align="right">{'Action Album'|@translate}&nbsp;:</td>
+			<td>
+				<select id="actionalbumselect" name="actionalbumselect" style="width:402px;" >
+					{html_options options=$actionalbum_select_selected}
+					{html_options options=$actionalbum_select}
+				</select>
+			</td>
+		</tr>
+		<tr id="ActionPicture" style="display:none;">
+			<td align="right">{'Action Picture'|@translate}&nbsp;:</td>
+			<td>
+				<input id="actionpictureid" type="text" name="actionpictureid" value="{$ACTIONPICTURE}" style="width:398px;margin-right:5px;" />
+			</td>
+		</tr>
+	</table>
+</fieldset>	
+
+	<!-- ***************************************************************************************************** -->
+	<!-- ***************************************************************************************************** -->
+	<!-- ***************************************************************************************************** -->
+	<!-- ***************************************************************************************************** -->		
+	<div id='myMap' style="position:relative; text-align:center; height:600px; margin:15px; border:2px solid white;"></div>
+	<script charset="UTF-8" type="text/javascript" src="http://ecn.dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=7.0"></script>			   
+	<script charset="UTF-8" type="text/javascript" src="{$JSPATH}"></script>			   
+	<script>
+		psli_g_BingKey = "{$KEY}";
+		psli_g_MapCenter = new Microsoft.Maps.Location(document.getElementById("hiddencenterlat").value, document.getElementById("hiddencenterlon").value);
+		
+		psli_g_MapOptions = {ldelim}
+			credentials: psli_g_BingKey, 
+			showDashboard:false,
+			showMapTypeSelector:false,
+			showScalebar:false,
+			mapTypeId: Microsoft.Maps.MapTypeId.road,
+			center: psli_g_MapCenter,
+			zoom: parseInt(document.getElementById("zoommax").value)
+		{rdelim};
+
+		psli_InitMap();
+		{$ADDJS}
+		document.getElementById("tableData").style.display='{$DISPLAY}';
+		psli_savePoints();
+	</script>
+
+</form>
