Subversion Repositories eFlore/Applications.cel

Rev

Rev 1514 | Rev 2170 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1514 Rev 1586
Line 1... Line 1...
1
/*+--------------------------------------------------------------------------------------------------------+*/
1
/*+--------------------------------------------------------------------------------------------------------+*/
2
// PARAMÊTRES et CONSTANTES
2
// PARAMÊTRES et CONSTANTES
3
// Mettre à true pour afficher les messages de débogage
-
 
4
var DEBUG = false; 
-
 
5
/**
3
/**
6
 * Indication de certaines variables ajoutée par php
4
* Indication de certaines variables ajoutée par php
7
* var communeImageUrl ;
5
* var communeImageUrl ;
8
* var pointImageUrl ;
6
* var pointImageUrl ;
9
* var groupeImageUrlTpl ;
7
* var groupeImageUrlTpl ;
10
*/
8
*/
-
 
9
var DEBUG = false,// Mettre à true pour afficher les messages de débogage 
11
var pointsOrigine = null;
10
	pointsOrigine = null,
12
var boundsOrigine = null;
11
	boundsOrigine = null,
13
var markerClusterer = null;
12
	markerClusterer = null,
14
var map = null;
13
	map = null,
15
var infoBulle = new google.maps.InfoWindow();
14
	infoBulle = new google.maps.InfoWindow(),
16
var stations = null;
15
	stations = null,
17
var pointClique = null;
16
	pointClique = null,
18
var carteCentre = new google.maps.LatLng(25, 10);
17
	carteCentre = new google.maps.LatLng(25, 10),
19
var carteOptions = {
18
	carteOptions = {
20
	zoom: 3,
19
		zoom: 3,
21
	center:carteCentre,
20
		center:carteCentre,
22
	mapTypeId: google.maps.MapTypeId.ROADMAP,
21
		mapTypeId: google.maps.MapTypeId.ROADMAP,
23
	mapTypeControlOptions: {
22
		mapTypeControlOptions: {
24
		mapTypeIds: ['OSM', 
23
			mapTypeIds: ['OSM', 
25
		             google.maps.MapTypeId.ROADMAP, 
24
				google.maps.MapTypeId.ROADMAP, 
26
		             google.maps.MapTypeId.HYBRID, 
25
				google.maps.MapTypeId.HYBRID, 
27
		             google.maps.MapTypeId.SATELLITE, 
26
				google.maps.MapTypeId.SATELLITE, 
28
		             google.maps.MapTypeId.TERRAIN]
27
				google.maps.MapTypeId.TERRAIN]
29
	},
28
		},
30
	zoomControlOptions: {
29
		zoomControlOptions: {
31
        style: google.maps.ZoomControlStyle.LARGE,
30
			style: google.maps.ZoomControlStyle.LARGE,
32
        position: google.maps.ControlPosition.LEFT_CENTER
31
			position: google.maps.ControlPosition.LEFT_CENTER
33
    },
32
		},
34
    panControl: false
33
		panControl: false
35
};			
-
 
36
var osmMapType = new google.maps.ImageMapType({
-
 
37
	getTileUrl: function(coord, zoom) {
-
 
38
		return "http://tile.openstreetmap.org/" +
-
 
39
		zoom + "/" + coord.x + "/" + coord.y + ".png";
-
 
40
	},
34
	},
-
 
35
	osmMapType = new google.maps.ImageMapType({
-
 
36
		getTileUrl: function(coord, zoom) {
-
 
37
			return "http://tile.openstreetmap.org/" +
-
 
38
			zoom + "/" + coord.x + "/" + coord.y + ".png";
-
 
39
		},
41
	tileSize: new google.maps.Size(256, 256),
40
		tileSize: new google.maps.Size(256, 256),
42
	isPng: true,
41
		isPng: true,
43
	alt: "OpenStreetMap",
42
		alt: "OpenStreetMap",
44
	name: "OSM",
43
		name: "OSM",
45
	maxZoom: 19
44
		maxZoom: 19
46
});
45
	}),
47
var ctaLayer = null;
46
	ctaLayer = null,
48
var pagineur = {'limite':300, 'start':0, 'total':0, 'stationId':null, 'format':'tableau'};
47
	pagineur = {'limite':300, 'start':0, 'total':0, 'stationId':null, 'format':'tableau'},
49
var station = {'commune':'', 'obsNbre':0};
48
	station = {'commune':'', 'obsNbre':0},
50
var obsStation = new Array();
49
	obsStation = new Array(),
51
var obsPage = new Array();
50
	obsPage = new Array(),
52
var taxonsCarte = new Array();
51
	taxonsCarte = new Array(),
53
var mgr = null;
52
	mgr = null,
54
var marqueursCache = new Array();
53
	marqueursCache = new Array(),
55
var zonesCache = new Array();
54
	zonesCache = new Array(),
56
var requeteChargementPoints;
55
	requeteChargementPoints,
57
var urlVars = null;
56
	urlVars = null;
-
 
57
 
58
/*+--------------------------------------------------------------------------------------------------------+*/
58
/*+--------------------------------------------------------------------------------------------------------+*/
59
// INITIALISATION DU CODE
59
// INITIALISATION DU CODE
Line 60... Line 60...
60
 
60
 
61
//Déclenchement d'actions quand JQuery et le document HTML sont OK
61
//Déclenchement d'actions quand JQuery et le document HTML sont OK
Line 76... Line 76...
76
	initialiserFormulaireContact();
76
	initialiserFormulaireContact();
77
	chargerLimitesCommunales();
77
	chargerLimitesCommunales();
78
	attribuerListenerCarte();
78
	attribuerListenerCarte();
79
}
79
}
Line 80... Line 80...
80
 
80
 
81
function getUrlVars()
-
 
82
{
81
function getUrlVars() {
83
    var vars = [], hash;
82
	var vars = [], hash;
84
    if(window.location.href.indexOf('?') != -1) {
83
	if (window.location.href.indexOf('?') != -1) {
85
	    var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
84
		var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
86
	    for(var i = 0; i < hashes.length; i++)
-
 
87
	    {
85
		for (var i = 0; i < hashes.length; i++) {
88
	        hash = hashes[i].split('=');
86
			hash = hashes[i].split('=');
89
	        vars.push(hash[0]);
87
			vars.push(hash[0]);
90
	        vars[hash[0]] = hash[1];
88
			vars[hash[0]] = hash[1];
91
	    }
89
		}
92
    }
90
	}
93
    return vars;
91
	return vars;
Line 94... Line 92...
94
}
92
}
95
 
93
 
Line 103... Line 101...
103
		if(obsNbre != 0) {
101
		if(obsNbre != 0) {
104
		    obsNbreFormate = stations.stats.observations.formaterNombre();
102
		    obsNbreFormate = stations.stats.observations.formaterNombre();
105
		}
103
		}
106
		var plteNbre = taxonsCarte.length;
104
		var plteNbre = taxonsCarte.length;
107
		var plteNbreFormate = plteNbre;
105
		var plteNbreFormate = plteNbre;
108
		if(plteNbre != 0) {
106
		if (plteNbre != 0) {
109
		    plteNbreFormate = taxonsCarte.length.formaterNombre();
107
			plteNbreFormate = taxonsCarte.length.formaterNombre();
110
		}
108
		}
111
		var communeNbre = stations.stats.communes;
109
		var communeNbre = stations.stats.communes;
112
		var communeNbreFormate = communeNbre;
110
		var communeNbreFormate = communeNbre;
113
		if(communeNbre != 0) {
111
		if(communeNbre != 0) {
114
		   communeNbreFormate = stations.stats.communes.formaterNombre();
112
		   communeNbreFormate = stations.stats.communes.formaterNombre();
Line 120... Line 118...
120
		}
118
		}
Line 121... Line 119...
121
	
119
	
122
		var stats = obsNbreFormate+' observation';
120
		var stats = obsNbreFormate+' observation';
Line 123... Line 121...
123
		stats += (obsNbre > 1) ? 's' : '' ;
121
		stats += (obsNbre > 1) ? 's' : '' ;
124
 
122
 
125
		if(photos != null && photos == 1) {
123
		if (photos != null && photos == 1) {
Line 126... Line 124...
126
			stats += ' avec photos ';
124
			stats += ' avec photos ';
127
		}
125
		}
Line 134... Line 132...
134
			stats += (plteNbre > 1) ? 's' : '' ;
132
			stats += (plteNbre > 1) ? 's' : '' ;
135
		} else {
133
		} else {
136
			if($('.taxon-actif .taxon').text() != '') {
134
			if($('.taxon-actif .taxon').text() != '') {
137
				var element = $('.taxon-actif .taxon').clone();
135
				var element = $('.taxon-actif .taxon').clone();
138
				element.children().remove();
136
				element.children().remove();
139
		        var taxon = element.text();
137
				var taxon = element.text();
140
		        stats += ' pour '+taxon;
138
				stats += ' pour '+taxon;
141
			} else {
139
			} else {
142
				if (taxonsCarte[0]) {
140
				if (taxonsCarte[0]) {
143
					var taxon = taxonsCarte[0];
141
					var taxon = taxonsCarte[0];
144
					stats += ' pour '+taxon.nom;
142
					stats += ' pour '+taxon.nom;
145
				}
143
				}
Line 158... Line 156...
158
	$('#zone-stats > h1').text(stats);
156
	$('#zone-stats > h1').text(stats);
159
	centrerTitreEtStats();
157
	centrerTitreEtStats();
160
}
158
}
Line 161... Line 159...
161
 
159
 
162
function attribuerListenersOverlay() {
-
 
163
	
160
function attribuerListenersOverlay() {
164
	$(window).resize(function() {
161
	$(window).resize(function() {
165
		dimensionnerCarte();
162
		dimensionnerCarte();
166
		definirTailleOverlay();
163
		definirTailleOverlay();
167
		centrerTitreEtStats();
164
		centrerTitreEtStats();
Line 180... Line 177...
180
	});
177
	});
181
}
178
}
Line 182... Line 179...
182
 
179
 
183
var tailleMaxFiltreUtilisateur;
180
var tailleMaxFiltreUtilisateur;
184
function definirTailleOverlay() {
181
function definirTailleOverlay() {
185
	var largeurViewPort = $(window).width();
182
	var largeurViewPort = $(window).width(),
186
	var taille = '1.6';
183
		taille = '1.6',
187
	var tailleMaxLogo = 60;
184
		tailleMaxLogo = 60,
188
	var tailleMaxIcones = 10;
185
		tailleMaxIcones = 10,
189
	var padding_icones = 8;
186
		padding_icones = 8,
190
	var tailleFiltre = 80;
187
		tailleFiltre = 80;
191
	tailleMaxFiltreUtilisateur = 350;
188
	tailleMaxFiltreUtilisateur = 350;
192
	$('#raz-filtre-utilisateur').css('display', 'block');
189
	$('#raz-filtre-utilisateur').css('display', 'block');
193
	if (largeurViewPort <= 450) {
190
	if (largeurViewPort <= 450) {
194
		taille = '1';
191
		taille = '1';
Line 257... Line 254...
257
function dimensionnerLogo(tailleMaxLogo) {
254
function dimensionnerLogo(tailleMaxLogo) {
258
	// Dimensionnement du logo
255
	// Dimensionnement du logo
259
	hauteurLogo = $('.image-logo').height();
256
	hauteurLogo = $('.image-logo').height();
260
	// Redimensionnement du logo s'il est trop grand
257
	// Redimensionnement du logo s'il est trop grand
261
	// on perd en qualité mais ça vaut mieux que de casser l'affichage
258
	// on perd en qualité mais ça vaut mieux que de casser l'affichage
262
	if(hauteurLogo > tailleMaxLogo) {
259
	if (hauteurLogo > tailleMaxLogo) {
263
		hauteurLogo = tailleMaxLogo;
260
		hauteurLogo = tailleMaxLogo;
264
		$('.image-logo').css("top", "5px");
261
		$('.image-logo').css("top", "5px");
265
		$('.image-logo').height(tailleMaxLogo);
262
		$('.image-logo').height(tailleMaxLogo);
266
	}
263
	}
Line 267... Line 264...
267
	
264
	
268
	if(hauteurLogo == 0) {
265
	if (hauteurLogo == 0) {
269
		$('.image-logo').load(function(event) {
266
		$('.image-logo').load(function(event) {
270
			definirTailleOverlay();
267
			definirTailleOverlay();
271
		});
268
		});
272
		return;
269
		return;
Line 275... Line 272...
275
	largeurLogo = $('#logo img').width();
272
	largeurLogo = $('#logo img').width();
276
}
273
}
Line 277... Line 274...
277
 
274
 
278
function dimensionnerImage(largeurViewPort) {
275
function dimensionnerImage(largeurViewPort) {
279
	// Dimensionnement de l'image
276
	// Dimensionnement de l'image
280
	if(largeurViewPort > 500) {
277
	if (largeurViewPort > 500) {
281
		largeurLogo = 155;
278
		largeurLogo = 155;
282
	} else {
279
	} else {
283
		largeurLogo = 70;
280
		largeurLogo = 70;
Line 291... Line 288...
291
		carteOptions.mapTypeControlOptions.style = google.maps.MapTypeControlStyle.DROPDOWN_MENU;
288
		carteOptions.mapTypeControlOptions.style = google.maps.MapTypeControlStyle.DROPDOWN_MENU;
292
	} else {
289
	} else {
293
		carteOptions.mapTypeControlOptions.style = google.maps.MapTypeControlStyle.DEFAULT;
290
		carteOptions.mapTypeControlOptions.style = google.maps.MapTypeControlStyle.DEFAULT;
294
	}
291
	}
Line 295... Line 292...
295
	
292
	
296
	if(map != null) {	
293
	if (map != null) {	
297
		map.setOptions(carteOptions);
294
		map.setOptions(carteOptions);
298
	}
295
	}
Line 299... Line 296...
299
}
296
}
300
 
297
 
301
function centrerTitreEtStats() {
298
function centrerTitreEtStats() {
302
	centrerTitre();
299
	centrerTitre();
Line 303... Line 300...
303
	centrerStats();
300
	centrerStats();
304
}
301
}
305
 
302
 
306
function centrerTitre() {
303
function centrerTitre() {
307
	var largeurViewPort = $(window).width();
304
	var largeurViewPort = $(window).width(),
-
 
305
		largeurTitre = $('#zone-titre').width(),
308
	var largeurTitre = $('#zone-titre').width();
306
		marge = (largeurViewPort - largeurTitre)/2;
309
	var marge = (largeurViewPort - largeurTitre)/2;
307
	$('#zone-titre').css("margin-left",marge);
310
	$('#zone-titre').css("margin-left",marge);
308
	
311
	var tailleRestante = largeurViewPort - (marge + largeurTitre);
309
	var tailleRestante = largeurViewPort - (marge + largeurTitre);
312
	if(tailleRestante <= 170) {
310
	if (tailleRestante <= 170) {
313
		$('#zone-titre').css("top", "25px");
311
		$('#zone-titre').css("top", "25px");
314
	} else {
312
	} else {
Line 315... Line 313...
315
		$('#zone-titre').css("top", "5px");
313
		$('#zone-titre').css("top", "5px");
316
	}
314
	}
317
}
315
}
318
 
316
 
319
function centrerStats() {
317
function centrerStats() {
320
	var largeurViewPort = $(window).width();
318
	var largeurViewPort = $(window).width(),
Line 321... Line 319...
321
	var largeurStats = $('#zone-stats').width();
319
		largeurStats = $('#zone-stats').width(),
322
	var marge = ((largeurViewPort - largeurStats)/2);
320
		marge = ((largeurViewPort - largeurStats)/2);
Line 351... Line 349...
351
			ctaLayer.setMap(map);
349
			ctaLayer.setMap(map);
352
		}
350
		}
353
	}
351
	}
354
}
352
}
Line 355... Line 353...
355
 
353
 
356
var listener = null;
354
var listener = null,
-
 
355
	timer = null;
357
var timer = null;
356
 
358
function attribuerListenerCarte() {
357
function attribuerListenerCarte() {
359
	listener = google.maps.event.addListener(map, 'bounds_changed', function(){
358
	listener = google.maps.event.addListener(map, 'bounds_changed', function(){
360
		programmerRafraichissementCarte();
359
		programmerRafraichissementCarte();
361
	});
360
	});
362
	listener = google.maps.event.addListener(map, 'zoom_changed', function(){
361
	listener = google.maps.event.addListener(map, 'zoom_changed', function(){
363
		programmerRafraichissementCarte();
362
		programmerRafraichissementCarte();
364
	});
363
	});
-
 
364
}
365
}
365
 
366
function programmerRafraichissementCarte() {
366
function programmerRafraichissementCarte() {
367
	if(timer != null) {
367
	if (timer != null) {
368
        window.clearTimeout(timer);
368
		window.clearTimeout(timer);
369
    }
369
	}
370
	if(requeteChargementPoints != null) {
370
	if (requeteChargementPoints != null) {
371
		requeteChargementPoints.abort();
371
		requeteChargementPoints.abort();
372
	}
372
	}
373
	timer = window.setTimeout(function() {
373
	timer = window.setTimeout(function() {
374
		if(map.getBounds() != undefined) {
374
		if (map.getBounds() != undefined) {
375
			var zoom = map.getZoom();
375
			var zoom = map.getZoom(),
376
			var lngNE = map.getBounds().getNorthEast().lng();
376
				lngNE = map.getBounds().getNorthEast().lng(),
377
			var lngSW = map.getBounds().getSouthWest().lng()
377
				lngSW = map.getBounds().getSouthWest().lng()
378
			if(map.getBounds().getNorthEast().lng() < map.getBounds().getSouthWest().lng()) {
378
			if (map.getBounds().getNorthEast().lng() < map.getBounds().getSouthWest().lng()) {
379
				lngNE = 176;
379
				lngNE = 176;
380
				lngSW = -156;
380
				lngSW = -156;
381
			}
381
			}
382
			var NELatLng = (map.getBounds().getNorthEast().lat())+'|'+(lngNE);
382
			var NELatLng = (map.getBounds().getNorthEast().lat())+'|'+(lngNE),
383
			var SWLatLng = (map.getBounds().getSouthWest().lat())+'|'+(lngSW);
383
				SWLatLng = (map.getBounds().getSouthWest().lat())+'|'+(lngSW);
384
			chargerMarqueurs(zoom, NELatLng, SWLatLng);
384
			chargerMarqueurs(zoom, NELatLng, SWLatLng);
385
		} else {
385
		} else {
386
			programmerRafraichissementCarte();
386
			programmerRafraichissementCarte();
387
		}
387
		}
388
    }, 400);		
388
	}, 400);
Line 389... Line 389...
389
}
389
}
390
 
390
 
391
var marqueurs = new Array();
391
var marqueurs = new Array();
392
function chargerMarqueurs(zoom, NELatLng, SWLatLng) {
392
function chargerMarqueurs(zoom, NELatLng, SWLatLng) {
393
	cacherMessageAucuneObs()
393
	cacherMessageAucuneObs()
394
	var url = stationsUrl+
394
	var url = stationsUrl+
395
		'&zoom='+zoom+
395
		'&zoom='+zoom+
Line 396... Line 396...
396
		'&ne='+NELatLng+
396
		'&ne='+NELatLng+
397
		'&sw='+SWLatLng;
397
		'&sw='+SWLatLng;
398
	
398
	
Line 399... Line 399...
399
	if(infoBulleOuverte) {
399
	if (infoBulleOuverte) {
400
		return;
400
		return;
401
	}
401
	}
402
	
402
	
Line 403... Line 403...
403
	if(requeteChargementPoints != null) {
403
	if (requeteChargementPoints != null) {
Line 411... Line 411...
411
		cacherMessageChargementPoints();
411
		cacherMessageChargementPoints();
412
	});
412
	});
413
}
413
}
Line 414... Line 414...
414
 
414
 
415
function centrerDansLaPage(selecteur) {
415
function centrerDansLaPage(selecteur) {
416
	var largeurViewport = $(window).width();
416
	var largeurViewport = $(window).width(),
417
	var hauteurViewport = $(window).height();
417
		hauteurViewport = $(window).height();
418
	selecteur.css('display','block');
418
	selecteur.css('display','block');
419
	var left = (largeurViewport/2) - (selecteur.width())/2;
419
	var left = (largeurViewport/2) - (selecteur.width())/2,
420
	var top = (hauteurViewport/2) - (selecteur.height())/2
420
		top = (hauteurViewport/2) - (selecteur.height())/2
421
	selecteur.css('left',left);
421
	selecteur.css('left',left);
422
	selecteur.css('top',top);
422
	selecteur.css('top',top);
Line 423... Line 423...
423
}
423
}
Line 445... Line 445...
445
function doitCentrerCarte() {
445
function doitCentrerCarte() {
446
	return premierChargement && urlVars != null && urlVars.length > 0;
446
	return premierChargement && urlVars != null && urlVars.length > 0;
447
}
447
}
Line 448... Line 448...
448
 
448
 
449
function rafraichirMarqueurs(data) {
-
 
450
	
449
function rafraichirMarqueurs(data) {
451
	$.each(marqueurs, function(index, marqueur) {
450
	$.each(marqueurs, function(index, marqueur) {
452
		marqueur.setMap(null);
451
		marqueur.setMap(null);
Line 453... Line 452...
453
	});
452
	});
454
 
453
 
Line 455... Line 454...
455
	marqueurs = new Array();
454
	marqueurs = new Array();
456
	stations = null;
455
	stations = null;
457
	
-
 
458
	if(data.points.length > 0) {
456
	
Line 459... Line 457...
459
		marqueurs = new Array();
457
	if (data.points.length > 0) {
460
		
458
		marqueurs = new Array();
461
		stations = data;
459
		stations = data;
462
		
460
		
463
		$.each(stations.points, function (index, station) {		
461
		$.each(stations.points, function (index, station) {		
464
			if(station != null) {
462
			if(station != null) {
Line 465... Line 463...
465
				var nouveauMarqueur = creerMarqueur(station);
463
				var nouveauMarqueur = creerMarqueur(station);
466
				marqueurs.push(nouveauMarqueur);
464
				marqueurs.push(nouveauMarqueur);
467
			}
465
			}
468
		});
466
		});
469
		
467
		
470
		if(doitCentrerCarte()) {
468
		if (doitCentrerCarte()) {
471
			premierChargement = false;
469
			premierChargement = false;
472
			var bounds = new google.maps.LatLngBounds();
470
			var bounds = new google.maps.LatLngBounds(),
473
			var latMax = new google.maps.LatLng(data.stats.coordmax.latMax, data.stats.coordmax.lngMax);
471
				latMax = new google.maps.LatLng(data.stats.coordmax.latMax, data.stats.coordmax.lngMax),
474
			var latMin = new google.maps.LatLng(data.stats.coordmax.latMin, data.stats.coordmax.lngMin);
472
				latMin = new google.maps.LatLng(data.stats.coordmax.latMin, data.stats.coordmax.lngMin);
Line 481... Line 479...
481
	afficherTitreCarteEtStats();
479
	afficherTitreCarteEtStats();
482
}
480
}
Line 483... Line 481...
483
 
481
 
484
function creerMarqueur(station) {
482
function creerMarqueur(station) {
485
	var titre = '';
483
	var titre = '';
486
	if(station.nbreMarqueur) {
484
	if (station.nbreMarqueur) {
487
		titre = station.nbreMarqueur+' points renseignés';
485
		titre = station.nbreMarqueur+' points renseignés';
488
	} else {
486
	} else {
489
		if(station.nom) {
487
		if(station.nom) {
490
			titre = station.nom;
488
			titre = station.nom;
491
		}
489
		}
Line 492... Line 490...
492
	}
490
	}
493
	
491
	
494
	var icone = attribuerImageMarqueur(station['id'], station['nbreMarqueur']);
492
	var icone = attribuerImageMarqueur(station['id'], station['nbreMarqueur']),
495
	var latLng = new google.maps.LatLng(station['lat'], station['lng']);
493
		latLng = new google.maps.LatLng(station['lat'], station['lng']),
496
	var marqueur = new google.maps.Marker({
494
			marqueur = new google.maps.Marker({
497
		position: latLng,
495
				position: latLng,
498
		icon: icone,
496
				icon: icone,
499
		title: ''+titre,
497
				title: ''+titre,
500
		map: map,
498
				map: map,
501
		stationInfos: station
499
				stationInfos: station
502
	});
500
			});
503
	attribuerListenerClick(marqueur, station['id']);
501
	attribuerListenerClick(marqueur, station['id']);
504
	marqueur.setMap(map);
502
	marqueur.setMap(map);
Line 505... Line 503...
505
    return marqueur;
503
	return marqueur;
506
}
504
}
507
 
505
 
Line 515... Line 513...
515
	if (etreMarqueurCommune(id)) {
513
	if (etreMarqueurCommune(id)) {
516
		marqueurImage = new google.maps.MarkerImage(communeImageUrl, new google.maps.Size(24, 32));
514
		marqueurImage = new google.maps.MarkerImage(communeImageUrl, new google.maps.Size(24, 32));
517
	} else if (etreMarqueurStation(id)) {
515
	} else if (etreMarqueurStation(id)) {
518
		marqueurImage = new google.maps.MarkerImage(pointImageUrl, new google.maps.Size(16, 16));
516
		marqueurImage = new google.maps.MarkerImage(pointImageUrl, new google.maps.Size(16, 16));
519
	} else if (etreMarqueurGroupe(id)) {
517
	} else if (etreMarqueurGroupe(id)) {
520
		var type = 0;
518
		var type = 0,
521
		var largeur = 0;
519
			largeur = 0,
522
		var hauteur = 0;
520
			hauteur = 0;
523
		if (nbreMarqueur != null) {
521
		if (nbreMarqueur != null) {
524
			if (nbreMarqueur >= 2 && nbreMarqueur < 100 ) {
522
			if (nbreMarqueur >= 2 && nbreMarqueur < 100 ) {
525
				type = '1';
523
				type = '1';
526
				largeur = 53;
524
				largeur = 53;
527
				hauteur = 52;
525
				hauteur = 52;
Line 559... Line 557...
559
}
557
}
Line 560... Line 558...
560
 
558
 
561
var pointCentreAvantAffichageInfoBulle = null;
559
var pointCentreAvantAffichageInfoBulle = null;
562
function surClickMarqueur(event) {
560
function surClickMarqueur(event) {
563
	pointCentreAvantAffichageInfoBulle = map.getCenter();
561
	pointCentreAvantAffichageInfoBulle = map.getCenter();
564
	
562
 
565
	if(infoBulleOuverte) {
563
	if(infoBulleOuverte) {
566
	    infoBulle.close();
564
		infoBulle.close();
567
	}
565
	}
568
  
566
 
569
	pointClique = this;
567
	pointClique = this;
570
	infoBulle.open(map, this);
568
	infoBulle.open(map, this);
571
	actualiserPagineur();
569
	actualiserPagineur();
572
	
570
 
573
	var limites = map.getBounds();
571
	var limites = map.getBounds(),
574
	var centre = limites.getCenter();
572
		centre = limites.getCenter(),
575
	var nordEst = limites.getNorthEast();
573
		nordEst = limites.getNorthEast(),
576
	var centreSudLatLng = new google.maps.LatLng(nordEst.lat(), centre.lng());
574
		centreSudLatLng = new google.maps.LatLng(nordEst.lat(), centre.lng());
Line 577... Line 575...
577
	map.panTo(centreSudLatLng);
575
	map.panTo(centreSudLatLng);
578
	
576
	
Line 585... Line 583...
585
	map.setZoom(nouveauZoom);
583
	map.setZoom(nouveauZoom);
586
	mgr.clearMarkers();
584
	mgr.clearMarkers();
587
}
585
}
Line 588... Line 586...
588
 
586
 
589
function etreMarqueurGroupe(id) {
587
function etreMarqueurGroupe(id) {
590
	var groupe = false;
588
	var groupe = false,
591
	var motif = /^GROUPE/;
589
		motif = /^GROUPE/;
592
	if (motif.test(id)) {
590
	if (motif.test(id)) {
593
		groupe = true;
591
		groupe = true;
594
	}
592
	}
595
	return groupe;
593
	return groupe;
Line 596... Line 594...
596
}
594
}
597
 
595
 
598
function etreMarqueurCommune(id) {
596
function etreMarqueurCommune(id) {
599
	var commune = false;
597
	var commune = false,
600
	var motif = /^COMMUNE:/;
598
		motif = /^COMMUNE:/;
601
	if (motif.test(id)) {
599
	if (motif.test(id)) {
602
		commune = true;
600
		commune = true;
603
	}
601
	}
Line 604... Line 602...
604
	return commune;
602
	return commune;
605
}
603
}
606
 
604
 
607
function etreMarqueurStation(id) {
605
function etreMarqueurStation(id) {
608
	var station = false;
606
	var station = false,
609
	var motif = /^STATION:/;
607
		motif = /^STATION:/;
610
	if (motif.test(id)) {
608
	if (motif.test(id)) {
611
		station = true;
609
		station = true;
Line 640... Line 638...
640
	map.panTo(pointCentreAvantAffichageInfoBulle);
638
	map.panTo(pointCentreAvantAffichageInfoBulle);
641
	programmerRafraichissementCarte();
639
	programmerRafraichissementCarte();
642
}
640
}
Line 643... Line 641...
643
 
641
 
644
function centrerInfoBulle() {
642
function centrerInfoBulle() {
645
	var limites = map.getBounds();
643
	var limites = map.getBounds(),
646
	var centre = limites.getCenter();
644
		centre = limites.getCenter(),
647
	var nordEst = limites.getNorthEast();
645
		nordEst = limites.getNorthEast(),
648
	var centreSudLatLng = new google.maps.LatLng(nordEst.lat(), centre.lng());
646
		centreSudLatLng = new google.maps.LatLng(nordEst.lat(), centre.lng());
649
	map.panTo(centreSudLatLng);
647
	map.panTo(centreSudLatLng);
Line 650... Line 648...
650
}
648
}
651
 
649
 
652
function afficherInfoBulle() {
650
function afficherInfoBulle() {
653
	var obsHtml = $("#tpl-obs").html();
651
	var obsHtml = $('#tpl-obs').html(),
654
	var largeur = definirLargeurInfoBulle();
652
		largeur = definirLargeurInfoBulle(),
655
	var taillePolice = definirTaillePoliceInfoBulle();
-
 
656
	obsHtml = obsHtml.replace(/\{largeur\}/, largeur);
653
		taillePolice = definirTaillePoliceInfoBulle();
657
	obsHtml = mettreAJourUrlSaisie(obsHtml);
654
	obsHtml = obsHtml.replace(/\{largeur\}/, largeur);
658
	infoBulle.setContent(obsHtml);
655
	infoBulle.setContent(obsHtml);
659
	$('#observations').css('font-size',taillePolice+'em');
656
	$('#observations').css('font-size', taillePolice + 'em');
660
	chargerObs(0, 0);
657
	chargerObs(0, 0);
Line 661... Line 658...
661
	infoBulleOuverte = true;
658
	infoBulleOuverte = true;
662
}
659
}
663
 
660
 
664
//TODO utiliser cette fonction lors des remplacements de 
661
//TODO utiliser cette fonction lors des remplacements de 
665
//paramètres url sur changement de filtre
662
//paramètres url sur changement de filtre
666
function parserFiltre(filtre) {
663
function parserFiltre(filtre) {
667
	var nvpair = {};
664
	var nvpair = {},
668
	var qs = filtre.replace('?', '');
665
		qs = filtre.replace('?', ''),
669
	var pairs = qs.split('&');
666
		pairs = qs.split('&');
670
	$.each(pairs, function(i, v){
667
	$.each(pairs, function(i, v){
671
		var pair = v.split('=');
668
		var pair = v.split('=');
672
		nvpair[pair[0]] = pair[1];
669
		nvpair[pair[0]] = pair[1];
Line 673... Line 670...
673
	});
670
	});
-
 
671
	return nvpair;
674
	return nvpair;
672
}
675
}
673
 
-
 
674
function mettreAJourUrlSaisie(obs) {
676
 
675
	if (obs.observations.length > 0) {
677
function mettreAJourUrlSaisie(obsHtml) {
676
		var filtreTableau = parserFiltre(filtreCommun),
678
	var filtreTableau = parserFiltre(filtreCommun);
677
			filtresGardes = new Array()
679
	var filtresGardes = new Array();
678
			idObs = obs.observations[0].idObs;
680
	filtre = '';
679
		filtre = '';
-
 
680
		for (i in filtreTableau) {
681
	for(i in filtreTableau) {
681
			if (filtreTableau[i] != undefined && filtreTableau[i] != '' && decodeURIComponent(filtreTableau[i]) != '*') {
-
 
682
				console.log(i + '  ' + filtreTableau[i]);
-
 
683
				filtresGardes.push(i + '=' + filtreTableau[i]);
-
 
684
			}
-
 
685
		}
-
 
686
		filtresGardes.push('id-obs=' + idObs);
-
 
687
		if (filtresGardes.length > 0) {
682
		if(filtreTableau[i] != undefined && filtreTableau[i] != '' && decodeURIComponent(filtreTableau[i]) != '*') {
688
			filtre = '?' + filtresGardes.join('&');
683
			console.log(i+"  "+filtreTableau[i]);
-
 
684
			filtresGardes.push(i+'='+filtreTableau[i]);
-
 
685
		}
-
 
686
	}
-
 
687
	if(filtresGardes.length > 0) {
-
 
688
		filtre = '?'+filtresGardes.join('&');
689
		}
Line 689... Line 690...
689
	}
690
		var urlAvecFiltre = urlWidgetSaisie + filtre;
690
	obsHtml = obsHtml.replace(/\{parametres-lien-saisie\}/, filtre);
691
		$('.lien-widget-saisie').attr('href', urlAvecFiltre).parents('.conteneur-lien-saisie').show();
691
	return obsHtml;
692
	}
692
}
693
}
693
 
694
 
694
function definirLargeurInfoBulle() {
695
function definirLargeurInfoBulle() {
695
	var largeurViewPort = $(window).width();
696
	var largeurViewPort = $(window).width(),
696
	var largeurInfoBulle = null;
697
		largeurInfoBulle = null;
Line 705... Line 706...
705
	}
706
	}
706
	return largeurInfoBulle;
707
	return largeurInfoBulle;
707
}
708
}
Line 708... Line 709...
708
 
709
 
709
function definirTaillePoliceInfoBulle() {
710
function definirTaillePoliceInfoBulle() {
710
	var largeurViewPort = $(window).width();
711
	var largeurViewPort = $(window).width(),
711
	var taillePolice = null;
712
		taillePolice = null;
712
	if (largeurViewPort < 400) {
713
	if (largeurViewPort < 400) {
713
		taillePolice = 0.8;
714
		taillePolice = 0.8;
714
	} else if (largeurViewPort < 800) {
715
	} else if (largeurViewPort < 800) {
715
		taillePolice = 1;
716
		taillePolice = 1;
Line 773... Line 774...
773
function surRetourChargementObs(observations, depart, total) {
774
function surRetourChargementObs(observations, depart, total) {
774
	obsStation = obsStation.concat(observations.observations);
775
	obsStation = obsStation.concat(observations.observations);
775
	if (depart == 0) {
776
	if (depart == 0) {
776
		actualiserInfosStation(observations);
777
		actualiserInfosStation(observations);
777
		creerTitreInfoBulle();
778
		creerTitreInfoBulle();
778
		surClicPagePagination(0, null);	
779
		surClicPagePagination(0, null);
-
 
780
		console.log(observations);
-
 
781
		mettreAJourUrlSaisie(observations);
779
	}
782
	}
Line 780... Line 783...
780
	
783
	
781
	afficherPagination();
784
	afficherPagination();
782
	actualiserPagineur();
785
	actualiserPagineur();
Line 787... Line 790...
787
	pointClique.stationInfos.commune = infos.commune;
790
	pointClique.stationInfos.commune = infos.commune;
788
	pointClique.stationInfos.obsNbre = infos.total;
791
	pointClique.stationInfos.obsNbre = infos.total;
789
}
792
}
Line 790... Line 793...
790
 
793
 
791
function creerTitreInfoBulle() {
794
function creerTitreInfoBulle() {
792
	$("#obs-total").text(station.obsNbre);
795
	$('#obs-total').text(station.obsNbre);
793
	$("#obs-commune").text(station.commune);
796
	$('#obs-commune').text(station.commune);
794
	var titre = '';
797
	var titre = '';
795
	titre += pointClique.stationInfos.obsNbre+' observation';
798
	titre += pointClique.stationInfos.obsNbre+' observation';
796
	titre += (pointClique.stationInfos.obsNbre > 1) ? 's': '' ;
799
	titre += (pointClique.stationInfos.obsNbre > 1) ? 's': '' ;
797
	titre += ' pour ';
800
	titre += ' pour ';
798
	if (etreMarqueurCommune(pointClique.stationInfos.id)) {
801
	if (etreMarqueurCommune(pointClique.stationInfos.id)) {
799
		nomStation = 'la commune : ';
802
		nomStation = 'la commune : ';
800
	} else {
803
	} else {
801
		nomStation = 'la station : ';
804
		nomStation = 'la station : ';
802
	}
805
	}
803
	titre += pointClique.stationInfos.nom;
806
	titre += pointClique.stationInfos.nom;
804
	$("#obs-station-titre").text(titre);	
807
	$('#obs-station-titre').text(titre);	
Line 805... Line 808...
805
}
808
}
806
 
809
 
807
function actualiserPagineur() {
810
function actualiserPagineur() {
Line 815... Line 818...
815
		pagineur.format = 'liste';
818
		pagineur.format = 'liste';
816
	}
819
	}
817
}
820
}
Line 818... Line 821...
818
 
821
 
819
function afficherPagination(observations) {
822
function afficherPagination(observations) {
820
	$(".navigation").pagination(pagineur.total, {
823
	$('.navigation').pagination(pagineur.total, {
821
		items_per_page:pagineur.limite,
824
		items_per_page:pagineur.limite,
822
		callback:surClicPagePagination,
825
		callback:surClicPagePagination,
823
		next_text:'Suivant',
826
		next_text:'Suivant',
824
		prev_text:'Précédent',
827
		prev_text:'Précédent',
Line 828... Line 831...
828
		load_first_page:true
831
		load_first_page:true
829
	});
832
	});
830
}
833
}
Line 831... Line 834...
831
 
834
 
832
function surClicPagePagination(pageIndex, paginationConteneur) {
835
function surClicPagePagination(pageIndex, paginationConteneur) {
833
	var index = pageIndex * pagineur.limite;
836
	var index = pageIndex * pagineur.limite,
834
	var indexMax = index + pagineur.limite;
837
		indexMax = index + pagineur.limite;
835
	pagineur.depart = index;
838
	pagineur.depart = index;
836
	obsPage = new Array();
839
	obsPage = new Array();
837
    for(index; index < indexMax; index++) {
840
	for (index; index < indexMax; index++) {
838
    	obsPage.push(obsStation[index]);
841
		obsPage.push(obsStation[index]);
839
    }
842
	}
840
    
843
 
841
    supprimerMessageChargement();
844
	supprimerMessageChargement();
842
    mettreAJourObservations();
845
	mettreAJourObservations();
843
	return false;
846
	return false;
Line 844... Line 847...
844
}
847
}
845
 
848
 
846
function mettreAJourObservations() {
849
function mettreAJourObservations() {
847
	$("#obs-"+pagineur.format+"-lignes").empty();
850
	$('#obs-'+pagineur.format+'-lignes').empty();
848
   	$("#obs-vue-"+pagineur.format).css('display', 'block');
851
	$('#obs-vue-'+pagineur.format).css('display', 'block');
Line 849... Line 852...
849
   	$(".obs-conteneur").css('counter-reset', 'item '+pagineur.depart);
852
	$('.obs-conteneur').css('counter-reset', 'item '+pagineur.depart);
850
	$("#tpl-obs-"+pagineur.format).tmpl(obsPage).appendTo("#obs-"+pagineur.format+"-lignes");
853
	$('#tpl-obs-'+pagineur.format).tmpl(obsPage).appendTo('#obs-'+pagineur.format+'-lignes');
851
	
854
	
852
	// Actualisation de Fancybox
855
	// Actualisation de Fancybox
853
	ajouterFormulaireContact("a.contact");
856
	ajouterFormulaireContact('a.contact');
854
	if (pagineur.format == 'liste') {
857
	if (pagineur.format == 'liste') {
Line 855... Line 858...
855
		ajouterGaleriePhoto("a.cel-img");
858
		ajouterGaleriePhoto('a.cel-img');
856
	}
859
	}
857
}
860
}
858
 
861
 
859
function initialiserContenuInfoBulle() {
862
function initialiserContenuInfoBulle() {
860
	afficherMessageChargement('#observations');
863
	afficherMessageChargement('#observations');
861
	cacherContenuOnglets();
864
	cacherContenuOnglets();
862
	afficherOnglets();
865
	afficherOnglets();
Line 863... Line 866...
863
	ajouterTableauTriable("#obs-tableau");
866
	ajouterTableauTriable('#obs-tableau');
864
	afficherTextStationId();
867
	afficherTextStationId();
865
	corrigerLargeurInfoWindow();
868
	corrigerLargeurInfoWindow();
866
}
869
}
Line 867... Line 870...
867
 
870
 
868
function cacherContenuOnglets() {
871
function cacherContenuOnglets() {
869
	$("#obs-vue-tableau").css("display", "none");
872
	$('#obs-vue-tableau').css('display', 'none');
Line 929... Line 932...
929
		}, 
932
		}, 
930
		// set type, either numeric or text 
933
		// set type, either numeric or text 
931
		type: 'numeric' 
934
		type: 'numeric' 
932
	});
935
	});
933
	$(element).tablesorter({ 
936
	$(element).tablesorter({ 
934
        headers: { 
937
		headers: { 
935
			1: { 
938
			1: { 
936
            	sorter:'date_cel' 
939
				sorter: 'date_cel' 
937
        	} 
940
			} 
938
    	} 
941
		}
939
	});
942
	});
940
}
943
}
Line 941... Line 944...
941
 
944
 
942
function mettreAJourTableauTriable(element) {
945
function mettreAJourTableauTriable(element) {
943
	$(element).trigger('update');
946
	$(element).trigger('update');
Line 944... Line 947...
944
}
947
}
945
 
948
 
946
function ajouterGaleriePhoto(element) {
949
function ajouterGaleriePhoto(element) {
947
	$(element).fancybox({
950
	$(element).fancybox({
948
		transitionIn:'elastic',
951
		transitionIn: 'elastic',
949
		transitionOut:'elastic',
952
		transitionOut: 'elastic',
950
		speedIn	:600, 
953
		speedIn: 600, 
951
		speedOut:200,
954
		speedOut: 200,
952
		overlayShow:true,
955
		overlayShow: true,
953
		titleShow:true,
956
		titleShow: true,
954
		titlePosition:'inside',
957
		titlePosition: 'inside',
955
		titleFormat:function (titre, currentArray, currentIndex, currentOpts) {
958
		titleFormat: function (titre, currentArray, currentIndex, currentOpts) {
956
			var motif = /urn:lsid:tela-botanica[.]org:cel:img([0-9]+)$/;
959
			var motif = /urn:lsid:tela-botanica[.]org:cel:img([0-9]+)$/;
957
			motif.exec(titre);
960
			motif.exec(titre);
958
			var id = RegExp.$1;
961
			var id = RegExp.$1,
959
			var info = $('#cel-info-'+id).clone().html();
962
				info = $('#cel-info-'+id).clone().html(),
960
			var tpl = 
963
				tpl = 
961
				'<div class="cel-legende">'+
964
					'<div class="cel-legende">'+
962
				'<p class="cel-legende-vei">'+'Image n°' + (currentIndex + 1) + ' sur ' + currentArray.length +'<\/p>'+	
965
					'<p class="cel-legende-vei">'+'Image n°' + (currentIndex + 1) + ' sur ' + currentArray.length +'<\/p>'+	
963
				(titre && titre.length ? '<p>'+info+'<\/p>' : '' )+
966
					(titre && titre.length ? '<p>'+info+'<\/p>' : '' )+
964
				'<\/div>';
967
					'<\/div>';
965
			return tpl;
968
			return tpl;
966
		}
969
		}
967
	}).live('click', function(e) {
970
	}).live('click', function(e) {
Line 1142... Line 1145...
1142
	attribuerListenersFiltreUtilisateur();
1145
	attribuerListenersFiltreUtilisateur();
1143
	chargerTaxons(0, 0);
1146
	chargerTaxons(0, 0);
1144
}
1147
}
Line 1145... Line 1148...
1145
 
1148
 
1146
function attribuerListenersFiltreUtilisateur() {
-
 
1147
	
1149
function attribuerListenersFiltreUtilisateur() {
1148
	$('#valider-filtre-utilisateur').click(function() {
1150
	$('#valider-filtre-utilisateur').click(function() {
1149
		var utilisateur = $('#filtre-utilisateur').val();
1151
		var utilisateur = $('#filtre-utilisateur').val();
1150
		filtrerParUtilisateur(utilisateur);
1152
		filtrerParUtilisateur(utilisateur);
1151
		$('#raz-filtre-utilisateur').show();
1153
		$('#raz-filtre-utilisateur').show();
Line 1152... Line 1154...
1152
	});
1154
	});
1153
	
1155
	
1154
	$('#filtre-utilisateur').keypress(function(e) {
1156
	$('#filtre-utilisateur').keypress(function(e) {
1155
	    if(e.which == 13) {
1157
		if (e.which == 13) {
1156
	    	var utilisateur = $('#filtre-utilisateur').val();
1158
			var utilisateur = $('#filtre-utilisateur').val();
1157
			filtrerParUtilisateur(utilisateur);
1159
			filtrerParUtilisateur(utilisateur);
1158
			$('#raz-filtre-utilisateur').show();
1160
			$('#raz-filtre-utilisateur').show();
Line 1159... Line 1161...
1159
	    }
1161
		}
1160
	});
1162
	});
1161
	
1163
	
Line 1167... Line 1169...
1167
	});
1169
	});
Line 1168... Line 1170...
1168
	
1170
	
1169
	$('#lien-affichage-filtre-utilisateur').click(function() {
1171
	$('#lien-affichage-filtre-utilisateur').click(function() {
1170
		afficherCacherFiltreUtilisateur();
1172
		afficherCacherFiltreUtilisateur();
1171
	});
1173
	});
1172
	
1174
 
1173
	$('#raz-filtre-utilisateur').hide();
1175
	$('#raz-filtre-utilisateur').hide();
1174
	$('#formulaire-filtre-utilisateur').hide();
1176
	$('#formulaire-filtre-utilisateur').hide();
Line 1175... Line 1177...
1175
}
1177
}
1176
 
1178
 
1177
function afficherCacherFiltreUtilisateur() {
1179
function afficherCacherFiltreUtilisateur() {
1178
	$('#formulaire-filtre-utilisateur').slideToggle();
1180
	$('#formulaire-filtre-utilisateur').slideToggle();
1179
	$('#conteneur-filtre-utilisateur').toggleClass('ferme');
1181
	$('#conteneur-filtre-utilisateur').toggleClass('ferme');
1180
	if(!$('#conteneur-filtre-utilisateur').hasClass('ferme')) {
1182
	if (!$('#conteneur-filtre-utilisateur').hasClass('ferme')) {
1181
		$('#conteneur-filtre-utilisateur').width(tailleMaxFiltreUtilisateur);
1183
		$('#conteneur-filtre-utilisateur').width(tailleMaxFiltreUtilisateur);
1182
	} else {
1184
	} else {
1183
		$('#conteneur-filtre-utilisateur').width('auto');
1185
		$('#conteneur-filtre-utilisateur').width('auto');
Line 1184... Line 1186...
1184
	}
1186
	}
1185
}
1187
}
1186
 
1188
 
1187
function filtrerParUtilisateur(utilisateurFiltre) {
1189
function filtrerParUtilisateur(utilisateurFiltre) {
1188
	if(utilisateurFiltre == '') {	
1190
	if (utilisateurFiltre == '') {	
1189
		utilisateurFiltre = '*';
1191
		utilisateurFiltre = '*';
1190
	}
1192
	}
1191
	utilisateur = utilisateurFiltre;
1193
	utilisateur = utilisateurFiltre;
1192
	var pattern = /utilisateur=[^&]*/i;
1194
	var pattern = /utilisateur=[^&]*/i,
1193
	var utilisateurCourant = pattern.exec(stationsUrl);
1195
		utilisateurCourant = pattern.exec(stationsUrl);
1194
	stationsUrl = stationsUrl.replace(utilisateurCourant, "utilisateur="+utilisateurFiltre);
1196
	stationsUrl = stationsUrl.replace(utilisateurCourant, "utilisateur="+utilisateurFiltre);
1195
	taxonsUrl = taxonsUrl.replace(utilisateurCourant, "utilisateur="+utilisateurFiltre);
1197
	taxonsUrl = taxonsUrl.replace(utilisateurCourant, "utilisateur="+utilisateurFiltre);
Line 1212... Line 1214...
1212
		var urlTax = taxonsUrl+'&start={start}&limit='+limite;
1214
		var urlTax = taxonsUrl+'&start={start}&limit='+limite;
1213
		urlTax = urlTax.replace(/\{start\}/g, depart);
1215
		urlTax = urlTax.replace(/\{start\}/g, depart);
1214
		//console.log(urlTax);
1216
		//console.log(urlTax);
1215
		$.getJSON(urlTax, function(infos) {
1217
		$.getJSON(urlTax, function(infos) {
1216
			nbTaxons += infos.taxons.length;
1218
			nbTaxons += infos.taxons.length;
1217
			$(".plantes-nbre").text(nbTaxons);
1219
			$('.plantes-nbre').text(nbTaxons);
1218
			$("#tpl-taxons-liste").tmpl({'taxons':infos.taxons}).appendTo("#taxons");
1220
			$('#tpl-taxons-liste').tmpl({'taxons': infos.taxons}).appendTo('#taxons');
1219
			taxonsCarte = taxonsCarte.concat(infos.taxons);
1221
			taxonsCarte = taxonsCarte.concat(infos.taxons);
1220
			//console.log("Nbre taxons :"+taxonsCarte.length);
1222
			//console.log("Nbre taxons :"+taxonsCarte.length);
1221
			chargerTaxons(depart+limite, infos.total);
1223
			chargerTaxons(depart+limite, infos.total);
1222
		});
1224
		});
1223
	} else {
1225
	} else {
Line 1247... Line 1249...
1247
 
1249
 
1248
	google.maps.event.trigger(map, 'resize');
1250
	google.maps.event.trigger(map, 'resize');
Line 1249... Line 1251...
1249
};
1251
};
1250
 
1252
 
1251
function cacherPanneauLateral() {
1253
function cacherPanneauLateral() {
1252
	$('#panneau-lateral').height(25+"px");
1254
	$('#panneau-lateral').height(25 + 'px');
1253
	$('#panneau-lateral').width(largeurPanneauLateralFerme+"px");
1255
	$('#panneau-lateral').width(largeurPanneauLateralFerme + 'px');
1254
	$('#pl-contenu').css('display', 'none');
1256
	$('#pl-contenu').css('display', 'none');
Line 1255... Line 1257...
1255
	$('#pl-ouverture').css('display', 'block');
1257
	$('#pl-ouverture').css('display', 'block');
Line 1384... Line 1386...
1384
		return sRetour.substr(0, sRetour.lastIndexOf(separateurMilliers));
1386
		return sRetour.substr(0, sRetour.lastIndexOf(separateurMilliers));
1385
	}
1387
	}
Line 1386... Line 1388...
1386
	
1388
	
1387
	if (_sNombre.indexOf('.') == -1) {
1389
	if (_sNombre.indexOf('.') == -1) {
1388
		for (i = 0; i < decimales; i++) {
1390
		for (i = 0; i < decimales; i++) {
1389
			_sDecimales += "0";
1391
			_sDecimales += '0';
1390
		}
1392
		}
1391
		_sRetour = separeMilliers(_sNombre) + signe + _sDecimales;
1393
		_sRetour = separeMilliers(_sNombre) + signe + _sDecimales;
1392
	} else {
1394
	} else {
1393
		var sDecimalesTmp = (_sNombre.substr(_sNombre.indexOf('.')+1));
1395
		var sDecimalesTmp = (_sNombre.substr(_sNombre.indexOf('.')+1));
Line 1406... Line 1408...
1406
 
1408
 
1407
function debug(objet) {
1409
function debug(objet) {
1408
	var msg = '';
1410
	var msg = '';
1409
	if (objet != null) {
1411
	if (objet != null) {
1410
		$.each(objet, function (cle, valeur) {
1412
		$.each(objet, function (cle, valeur) {
1411
			msg += cle+":"+valeur + "\n";
1413
			msg += cle+':'+valeur + "\n";
1412
		});
1414
		});
1413
	} else {
1415
	} else {
1414
		msg = "La variable vaut null.";
1416
		msg = 'La variable vaut null.';
1415
	}
1417
	}
1416
	console.log(msg);
1418
	console.log(msg);
1417
}
1419
}