commit a3184ceca314894da27bb27e10603bc7521b9199
Author: Jocelyn Delande <jocelyn at delalande dot fr>
Date:   Mon Dec 23 20:29:33 2013 +0100

    PREFIXXX

diff --git a/css/base.css b/css/base.css
index d891bb8..32fc6b0 100644
--- a/css/base.css
+++ b/css/base.css
@@ -106,3 +106,13 @@ form li {
 .validators a:hover {
   border-color:#F00;
 }
+
+fieldset {
+	padding: 1em;
+}
+
+.help {
+	margin-top: 1em;
+	font-style: italic;
+	font-size: small;
+}
\ No newline at end of file
diff --git a/css/layers.css b/css/layers.css
index 28b8cab..4b4b277 100644
--- a/css/layers.css
+++ b/css/layers.css
@@ -4,7 +4,6 @@
     z-index:100000;
     right: 0;
     height: 1em; 
-    width: 10em;
 }
 #panel div { 
     float: left;
diff --git a/envoyer.php b/envoyer.php
index db39f90..fb316b1 100644
--- a/envoyer.php
+++ b/envoyer.php
@@ -1,3 +1,13 @@
+<?php
+   if (array_key_exists('lat', $_GET) && array_key_exists('lon', $_GET)) {
+     $lat = $_GET['lat'];
+     $lon = $_GET['lon'];
+   } else {
+     $lat = '';
+     $lon = '';
+   }
+?>
+
 <!DOCTYPE html>
 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr">
   <head>
@@ -15,14 +25,38 @@
       <form action="uploadReceive.php" method="post" enctype="multipart/form-data" id="upload">
 	<ul>
 	  <li>
-	    <label for="file" class="description">Envoyer le fichier :</label>
-	    <div>
-	    <input type="hidden" name="APC_UPLOAD_PROGRESS" id="progress_key" value="panoramas"/>
-	    <input type="file" name="files[]" id="file" multiple="multiple"
-		   title="Le fichier à envoyer doit être une image de taille maximale 300 Mo"/>
-	    </div>  
+
+		  <fieldset>
+			<legend>Envoyer le fichier:</legend>
+			<input type="hidden" name="APC_UPLOAD_PROGRESS" id="progress_key"
+			value="panoramas"/>
+			<ul>
+			  <li><input type="file" name="files[]" id="file" multiple="multiple"/></li>
+
+			  <li><input type="checkbox" name="loop">Panorama bouclant
+			  (360°)</li>
+			</ul>
+		<p class="help">
+		  Le fichier à envoyer doit être une image de taille maximale 300 Mo ;
+		  il peut s'agir d'un panorama (par exemple assemblé
+		  avec <a href="http://hugin.sourceforge.net/">hugin</a>), faisant 360°
+		  ou non, ou encore d'une simple photo.
+		</p>
+
+		</fieldset>
+	  </li>
+	  <li>
+		<fieldset>
+	    <legend>Coordonnées (optionnel)</legend>
+		<input type="text" name="lon" placeholder="longitude" value="<?php echo $lat ?>"/>
+		<input type="text" name="lat" placeholder="latitude" value="<?php echo $lon; ?>"/>
+		<input type="text" name="alt" placeholder="altitude (m)" width="20"/>
+        <p class="help">
+		  Si vous ne spécifiez pas les coordonnées maintenant, il sera
+		  toujours possible de le faire plus tard.
+		</p>
+        </fieldset>
 	  </li>
-	  
 	  <li>
 	    <input type="submit" name="submit" value="Envoyer" />
 	  </li>
diff --git a/images/plus_photo.png b/images/plus_photo.png
new file mode 100644
index 0000000..7d9fe79
Binary files /dev/null and b/images/plus_photo.png differ
diff --git a/js/utils_osm.js b/js/utils_osm.js
index bd18549..7d77f50 100644
--- a/js/utils_osm.js
+++ b/js/utils_osm.js
@@ -16,16 +16,19 @@ function draw_cap_map(zoom) {
     } else zcontrol = new OpenLayers.Control.Zoom();
 
     var map = new OpenLayers.Map({
-	div: "map",
-        zoom: typeof zoom == 'undefined' ? 10:zoom,
+	    div: "map",
+	    theme: null,
+	    zoom: typeof zoom == 'undefined' ? 10:zoom,
 	controls:[zcontrol,
 		  new OpenLayers.Control.KeyboardDefaults(),
 		  new OpenLayers.Control.Navigation()],
     });
-
+	
+	
     if (typeof scale_line != 'undefined' && scale_line == true) {
 	map.addControl(new OpenLayers.Control.ScaleLine({bottomOutUnits: ''}));
     }
+	map.celutz_addnew = false;
 
     if (typeof base_layers != 'undefined') {
 	var layers = new OpenLayers.Control.LayerSwitcher();
@@ -61,9 +64,25 @@ function draw_cap_map(zoom) {
 		map.events.unregister("click", map, show_pos);
 	    }
 	}
+	    
+	    
+    var bt_pano = mk_new_pano_button(map);
 	var panel = new OpenLayers.Control.Panel({
-	    div: document.getElementById("panel")
-	});
+		div: document.getElementById("panel"),
+    	default: bt_pano,
+        createControlMarkup: function(control) {
+            var button = document.createElement('button'),
+                iconSpan = document.createElement('span'),
+                textSpan = document.createElement('span');
+            iconSpan.innerHTML = '&nbsp;';
+            button.appendChild(iconSpan);
+            if (control.text) {
+                textSpan.innerHTML = control.text;
+            }
+            button.appendChild(textSpan);
+            return button;
+        }
+    });
 
 	function formatLonlats(lonLat) {
 	    lonLat.transform(map.getProjectionObject(), new OpenLayers.Projection("EPSG:4326"));
@@ -78,9 +97,19 @@ function draw_cap_map(zoom) {
 	    formatOutput: formatLonlats
 	}));
 
-	var history = new OpenLayers.Control.NavigationHistory();
+    var history = new OpenLayers.Control.NavigationHistory({
+	    previousOptions: {
+		    title: "Go to previous map position",
+		    text: "Préc."
+	    },
+	    nextOptions: {
+		    title: "Go to next map position",
+		    text: "Suiv."
+	    },
+    });
+	    
 	map.addControl(history);
-	panel.addControls([history.next, history.previous]);
+	    panel.addControls([bt_pano, history.next, history.previous]);
 	map.addControl(panel);
 
 	document.getElementById("clic_pos").onchange = set_pos;
@@ -315,6 +344,69 @@ function add_refpoint_control(layer, map) {
 	
 	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);
 }
 
diff --git a/show_capline.php b/show_capline.php
index 9103b04..cd8c99e 100644
--- a/show_capline.php
+++ b/show_capline.php
@@ -3,6 +3,9 @@
   <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
   <link type="image/x-icon" rel="shortcut icon" href="images/tsf.png"/>
   <link rel="stylesheet" type="text/css" href="css/layers.css" />
+  <link rel="stylesheet" type="text/css" href="http://dev.openlayers.org/releases/OpenLayers-2.13.1/theme/default/style.css" />
+  <link rel="stylesheet" type="text/css" href="css/olmap.css" />
+
 <?php
 if (isset($_REQUEST['cap']) && isset($_REQUEST['org_lat']) && isset($_REQUEST['org_lon'])) {
   $cap = $_REQUEST['cap'];
