Subversion Repositories eFlore/Applications.cel

Rev

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

Rev 2701 Rev 2707
Line 19... Line 19...
19
 
19
 
20
// surcharge
20
// surcharge
21
WidgetSaisieSauvages.prototype.initCarto = function() {
21
WidgetSaisieSauvages.prototype.initCarto = function() {
22
	this.initialiserGoogleMap();
22
	this.initialiserGoogleMap();
-
 
23
	this.afficherEtapeGeolocalisation(1);
-
 
24
 
-
 
25
	$('#carte-recherche').autocomplete({
-
 
26
		//Cette partie utilise geocoder pour extraire des valeurs d'adresse
-
 
27
		source: function(request, response) {
-
 
28
			lthis.geocoder.geocode( {'address': request.term+', France', 'region' : 'fr' }, function(results, status) {
-
 
29
				if (status == google.maps.GeocoderStatus.OK) {
-
 
30
					response($.map(results, function(item) {
-
 
31
						var rue = "";
-
 
32
						$.each(item.address_components, function(){
-
 
33
							if (this.types[0] == "route" || this.types[0] == "street_address" ) {
-
 
34
								rue = this.short_name;
-
 
35
							}
-
 
36
						});
-
 
37
						var retour = {
-
 
38
							label: item.formatted_address,
-
 
39
							value: rue,
-
 
40
							latitude: item.geometry.location.lat(),
-
 
41
							longitude: item.geometry.location.lng()
-
 
42
						};
-
 
43
						return retour;
-
 
44
					}));
-
 
45
				} else {
-
 
46
					lthis.afficherErreurGoogleMap(status);
-
 
47
				}
-
 
48
			});
-
 
49
		},
-
 
50
		// Cette partie est executee a la selection d'une adresse
-
 
51
		select: function(event, ui) {
-
 
52
			var nouvellePosition = new google.maps.LatLng(ui.item.latitude, ui.item.longitude);
-
 
53
			lthis.initialiserMarkerDeb();
-
 
54
			lthis.deplacerMarkerDeb(nouvellePosition);
-
 
55
			lthis.map.setZoom(16);
-
 
56
			lthis.afficherEtapeGeolocalisation(2);
-
 
57
		}
23
	this.afficherEtapeGeolocalisation(1);
58
	});
Line 24... Line 59...
24
};
59
};
25
 
60
 
26
//surcharge
61
//surcharge
Line 42... Line 77...
42
};
77
};
Line 43... Line 78...
43
 
78
 
44
//surcharge
79
//surcharge
45
WidgetSaisieSauvages.prototype.initEvts = function() {
80
WidgetSaisieSauvages.prototype.initEvts = function() {
46
	var lthis = this;
-
 
47
 
81
	var lthis = this;
48
	// super() à la main - toute autre manière de faire est über-komplex
82
	// super() à la main - toute autre manière de faire est über-komplex
Line 49... Line -...
49
	WidgetSaisie.prototype.initEvts.call(this);
-
 
50
 
83
	WidgetSaisie.prototype.initEvts.call(this);
51
	$('.has-tooltip').tooltip('enable'); // @TODO harmoniser .has-tooltip et [rel="tooltip"]
84
 
52
	$('.dropdown-menu input, .dropdown-menu label').on('click', function(event) {
85
	$('.dropdown-menu input, .dropdown-menu label').on('click', function(event) {
53
		event.stopPropagation();
86
		event.stopPropagation();
54
	});
87
	});
Line 104... Line 137...
104
	});
137
	});
Line 105... Line 138...
105
 
138
 
106
	$('#photo-placeholder').click(function(event) {
139
	$('#photo-placeholder').click(function(event) {
107
		$('#fichier').click();
140
		$('#fichier').click();
108
	});
-
 
109
 
-
 
110
	// Autocompletion du champ adresse
-
 
111
	$('#carte-recherche').on('focus', function() {
-
 
112
		$(this).select();
-
 
113
	});
-
 
114
	$('#carte-recherche').on('mouseup', function(event) {// Pour Safari...
-
 
115
		event.preventDefault();
-
 
116
	});
-
 
117
	$('#carte-recherche').keypress(function(e) {
-
 
118
		if (e.which == 13) {
-
 
119
			e.preventDefault();
-
 
120
		}
-
 
121
	});
-
 
122
	$('#carte-recherche').autocomplete({
-
 
123
		//Cette partie utilise geocoder pour extraire des valeurs d'adresse
-
 
124
		source: function(request, response) {
-
 
125
			lthis.geocoder.geocode( {'address': request.term+', France', 'region' : 'fr' }, function(results, status) {
-
 
126
				if (status == google.maps.GeocoderStatus.OK) {
-
 
127
					response($.map(results, function(item) {
-
 
128
						var rue = "";
-
 
129
						$.each(item.address_components, function(){
-
 
130
							if (this.types[0] == "route" || this.types[0] == "street_address" ) {
-
 
131
								rue = this.short_name;
-
 
132
							}
-
 
133
						});
-
 
134
						var retour = {
-
 
135
							label: item.formatted_address,
-
 
136
							value: rue,
-
 
137
							latitude: item.geometry.location.lat(),
-
 
138
							longitude: item.geometry.location.lng()
-
 
139
						};
-
 
140
						return retour;
-
 
141
					}));
-
 
142
				} else {
-
 
143
					lthis.afficherErreurGoogleMap(status);
-
 
144
				}
-
 
145
			});
-
 
146
		},
-
 
147
		// Cette partie est executee a la selection d'une adresse
-
 
148
		select: function(event, ui) {
-
 
149
			var nouvellePosition = new google.maps.LatLng(ui.item.latitude, ui.item.longitude);
-
 
150
			lthis.initialiserMarkerDeb();
-
 
151
			lthis.deplacerMarkerDeb(nouvellePosition);
-
 
152
			lthis.map.setZoom(16);
-
 
153
			lthis.afficherEtapeGeolocalisation(2);
-
 
154
		}
-
 
155
	});
141
	});
156
	$('#geolocaliser').on('click', this.geolocaliser.bind(this));
142
	$('#geolocaliser').on('click', this.geolocaliser.bind(this));
Line 157... Line 143...
157
};
143
};
158
 
144
 
Line 579... Line 565...
579
	} else {
565
	} else {
580
		$('#certitude-adeterminer').removeAttr('checked');
566
		$('#certitude-adeterminer').removeAttr('checked');
581
	}
567
	}
582
};
568
};
Line 583... Line -...
583
 
-
 
584
// surcharge @TODO fusionner
-
 
585
WidgetSaisieSauvages.prototype.configurerDatePicker = function(selector) {
-
 
586
	$.datepicker.setDefaults($.datepicker.regional['fr']);
-
 
587
	$(selector).datepicker({
-
 
588
		dateFormat: 'dd/mm/yy',
-
 
589
		maxDate: new Date,
-
 
590
		showOn: 'button',
-
 
591
		buttonImageOnly: true,
-
 
592
		buttonImage: this.calendrierIconeUrl,
-
 
593
		buttonText: 'Afficher le calendrier pour saisir la date.',
-
 
594
		showButtonPanel: true,
-
 
595
		onSelect: function(date) {
-
 
596
			$(this).valid();
-
 
597
		}
-
 
598
	});
-
 
599
	$(selector + ' + img.ui-datepicker-trigger').appendTo(selector + '-icone.add-on');
-
 
600
};
-
 
601
 
-
 
602
// surcharge @TODO uniformiser .has-tooltip & rel="tooltip"
-
 
603
WidgetSaisieSauvages.prototype.basculerAffichageAide = function() {
-
 
604
	if ($(this).hasClass('btn-warning')) {
-
 
605
		$('.has-tooltip').tooltip('enable');
-
 
606
		$(this).removeClass('btn-warning').addClass('btn-success');
-
 
607
		$('#btn-aide-txt', this).text("Désactiver l'aide");
-
 
608
	} else {
-
 
609
		$('.has-tooltip').tooltip('disable');
-
 
610
		$(this).removeClass('btn-success').addClass('btn-warning');
-
 
611
		$('#btn-aide-txt', this).text("Activer l'aide");
-
 
612
	}
-
 
613
};
-
 
614
 
569
 
615
// surcharge
570
// surcharge
616
WidgetSaisieSauvages.prototype.ajouterObs = function() {
571
WidgetSaisieSauvages.prototype.ajouterObs = function() {
617
	if (this.validerFormulaire() == true) {
572
	if (this.validerFormulaire() == true) {
618
		this.obsNbre = this.obsNbre + 1;
573
		this.obsNbre = this.obsNbre + 1;