commit e1acd4a196bf65dd03abeb0426a70e07a037f139
Author: Jocelyn Delande <jocelyn@crapouillou.net>
Date:   Fri Nov 28 20:58:41 2014 +0100

    Can add a panorama from the map.

diff --git a/css/layers.css b/css/layers.css
index 4b4b277..a0289b4 100644
--- a/css/layers.css
+++ b/css/layers.css
@@ -5,7 +5,7 @@
     right: 0;
     height: 1em; 
 }
-#panel div { 
+#panel div {
     float: left;
     margin: 0.5em;
 }
@@ -53,3 +53,6 @@
     background-color:#F0F;
     padding:1em;
 }
+
+
+
diff --git a/css/olmap.css b/css/olmap.css
new file mode 100644
index 0000000..07764a6
--- /dev/null
+++ b/css/olmap.css
@@ -0,0 +1,70 @@
+
+#panel {
+
+/*    border: 1px solid black;*/
+    cursor: pointer;
+    }
+
+#panel button {
+    position: relative;
+    display: block;
+    margin: 2px;
+    border: 1px solid;
+    padding: 0 5px;
+    border-radius: 4px;
+    height: 35px;
+    background-color: white;
+    float: left;
+    overflow: visible; /* needed to remove padding from buttons in IE */
+	width: 6em;
+	background-repeat: none;
+}
+#panel button span {
+    padding-left: 25px;
+}
+#panel button span:first-child {
+    padding-left: 0;
+    display: block;
+    position: absolute;
+    left: 2px;
+}
+
+#panel .olControlNavigationHistory {
+	background-image: none;
+}
+
+
+#panel {
+	opacity: 0.5;
+}
+
+#panel:hover {
+	opacity: 1;
+}
+
+
+#panel .olControlNavigationHistory span:first-child, #panel .olControlBtnNewPanoItemInActive span:first-child {
+    background-image: url("../images/plus_photo.png");
+    height: 24px;
+    width: 24px;
+    top: 4px;
+}
+#panel .olControlNavigationHistoryPreviousItemActive span:first-child {
+    background-position: 0 0;
+}
+#panel .olControlNavigationHistoryPreviousItemInactive span:first-child {
+    background-position: 0 -24px;
+}
+#panel .olControlNavigationHistoryNextItemActive span:first-child {
+    background-position: -24px 0;
+}
+#panel .olControlNavigationHistoryNextItemInactive span:first-child {
+    background-position: -24px -24px;
+}
+
+#panel .olControlNavigationHistory span:first-child {
+    background-image: url("http://dev.openlayers.org/releases/OpenLayers-2.13.1/theme/default/img/navigation_history.png");
+    height: 24px;
+    width: 24px;
+    top: 4px;
+}
\ No newline at end of file
diff --git a/js/utils_osm.js b/js/utils_osm.js
index 5a1e6b7..d91d980 100644
--- a/js/utils_osm.js
+++ b/js/utils_osm.js
@@ -341,10 +341,73 @@ function add_refpoint_control(layer, map) {
 				feature.popup.destroy();
 				feature.popup = null;
 			}});
-	
+
 	map.addControl(selectControl);
 	selectControl.activate();
+}
+
+
+function mk_new_pano_button(map) {
+	var btn = new OpenLayers.Control.Button({
+		displayClass: 'olControlBtnNewPano',
+		title: "Ajouter un nouveau panorama",
+		text: "Photo",
+		id: 'btn-new-pano',
+		autoActivate: true,
+		trigger: function() {start_add_new_pano(map)},
+	});
+	return btn;
+}
+
+
+function add_pano_click_handler(callback) {
+	var ctrlClass = OpenLayers.Class(OpenLayers.Control, {
+		defaultHandlerOptions: {
+		    'single': false,
+		    'double': true,
+		    'pixelTolerance': 0,
+		    'stopSingle': false,
+		    'stopDouble': false
+		},
+
+		initialize: function(options)
+		{
+		    this.handlerOptions = OpenLayers.Util.extend(
+		        {}, this.defaultHandlerOptions
+		    );
 
+		    OpenLayers.Control.prototype.initialize.apply(this, arguments);
+
+		    this.handler = new OpenLayers.Handler.Click(
+		        this, {
+		            'click': callback
+		        }, this.handlerOptions
+		    );
+		},
+	});
+
+	var control = new ctrlClass({
+		        handlerOptions: {
+		            "single": true,
+		            "double": false
+		        },
+		autoActivate: true});
+
+	return control;
+}
+
+function start_add_new_pano(map) {
+	map.celutz_addnew = true;
+	alert("cliquer sur un point de la carte pour choisir l'emplacement");
+	document.body.style.cursor = 'crosshair';
+
+	var control = add_pano_click_handler(function(evt) {
+		var coord = map.getLonLatFromPixel(evt.xy);
+		coord.transform(new OpenLayers.Projection("EPSG:900913"),
+		                new OpenLayers.Projection("EPSG:4326"));
+		window.location = 'envoyer.php?lat='+coord.lat+'&lon='+coord.lon;
+	});
+	map.addControl(control);
 }
 
 
