Line 120... |
Line 120... |
120 |
|
120 |
|
121 |
// surcharge fonction stockerObsData()
|
121 |
// surcharge fonction stockerObsData()
|
122 |
WidgetSaisieMessicoles.prototype.stockerObsData = function() {
|
122 |
WidgetSaisieMessicoles.prototype.stockerObsData = function() {
|
123 |
var lthis = this;
|
123 |
var lthis = this;
|
124 |
var nomHorsListe = $('#taxon-liste').val() == '?' ? true : false;
|
- |
|
125 |
nomSpecial = $('#taxon-liste option:selected').hasClass('nom-special'),
|
124 |
var nomHorsListe = $('#taxon-liste').val() == '?' ? true : false;
|
126 |
numNomSel = nomHorsListe ? $('#taxon').data('numNomSel') : $('#taxon-liste').val();
|
125 |
numNomSel = nomHorsListe ? $('#taxon').data('numNomSel') : $('#taxon-liste').val();
|
127 |
var nomSel = nomHorsListe ? $('#taxon').val() : $('#taxon-liste option:selected').data('nom-a-sauver'),
|
126 |
var nomSel = nomHorsListe ? $('#taxon').val() : $('#taxon-liste option:selected').data('nom-a-sauver'),
|
128 |
nomRet = nomHorsListe ? $('#taxon').data('nomRet') : this.taxons[numNomSel]['nom_ret'],
|
127 |
nomRet = nomHorsListe ? $('#taxon').data('nomRet') : this.taxons[numNomSel]['nom_ret'],
|
129 |
numNomRet = nomHorsListe ? $('#taxon').data('numNomRet') : this.taxons[numNomSel]['num_nom_ret'],
|
128 |
numNomRet = nomHorsListe ? $('#taxon').data('numNomRet') : this.taxons[numNomSel]['num_nom_ret'],
|
130 |
numTaxon = nomHorsListe ? $('#taxon').data('nt') : this.taxons[numNomSel]['num_taxon'],
|
129 |
numTaxon = nomHorsListe ? $('#taxon').data('nt') : this.taxons[numNomSel]['num_taxon'],
|
131 |
famille = nomHorsListe ? $('#taxon').data('famille') : this.taxons[numNomSel]['famille'],
|
130 |
famille = nomHorsListe ? $('#taxon').data('famille') : this.taxons[numNomSel]['famille'],
|
132 |
referentiel = (numNomSel == undefined) ? '' : this.nomSciReferentiel,
|
131 |
referentiel = (numNomSel == undefined) ? '' : this.nomSciReferentiel,
|
133 |
notes = (nomSpecial ? this.taxons[numNomSel]['nom_fr'] + '. ' : '') + $('#notes').val(),
|
132 |
notes = $('#notes').val();
|
134 |
zoneChamp = [],
|
133 |
// champs spécifques aux messicoles
|
135 |
abondance = $('#abondance-liste option:selected').val(),
|
- |
|
136 |
typeCulture = $('input[name=type-culture]:checked').val(),
|
134 |
var abondance = $('#abondance-liste').val(),
|
137 |
certitude = $('input[name=certitude]:checked').val(),
|
- |
|
138 |
certitude = (certitude == undefined) ? '' : certitude;
|
- |
|
139 |
|
135 |
certitude = $('#identification-liste').val();
|
140 |
|
136 |
|
141 |
$('#liste-obs').data('obsId'+this.obsNbre, {
|
137 |
$('#liste-obs').data('obsId'+this.obsNbre, {
|
142 |
'date': $('#date').val(),
|
138 |
'date': $('#date').val(),
|
Line 143... |
Line -... |
143 |
'notes': notes,
|
- |
|
144 |
|
139 |
'notes': notes,
|
145 |
'station': $('#station').val(),
|
140 |
|
146 |
'latitude': $('#latitude').val(),
|
141 |
'latitude': $('#latitude').val(),
|
147 |
'longitude': $('#longitude').val(),
|
142 |
'longitude': $('#longitude').val(),
|
- |
|
143 |
'commune_nom': $('#commune-nom').text(),
|
- |
|
144 |
'commune_code_insee': $('#commune-code-insee').text(),
|
- |
|
145 |
'lieudit' : $("#lieudit").val(),
|
Line 148... |
Line 146... |
148 |
'commune_nom': $('#commune-nom').text(),
|
146 |
'station' : $("#station").val(),
|
149 |
'commune_code_insee': $('#commune-code-insee').text(),
|
147 |
'milieu' : $("#milieu").val(),
|
150 |
|
148 |
|
151 |
'nom_sel': nomSel,
|
149 |
'nom_sel': nomSel,
|
152 |
'num_nom_sel': numNomSel,
|
150 |
'num_nom_sel': numNomSel,
|
153 |
'nom_ret': nomRet,
|
151 |
'nom_ret': nomRet,
|
154 |
'num_nom_ret': numNomRet,
|
152 |
'num_nom_ret': numNomRet,
|
- |
|
153 |
'num_taxon': numTaxon,
|
155 |
'num_taxon': numTaxon,
|
154 |
'famille': famille,
|
156 |
'famille': famille,
|
- |
|
157 |
'referentiel': referentiel,
|
- |
|
158 |
'certitude': certitude,
|
155 |
'referentiel': referentiel,
|
159 |
'milieu': milieu,
|
- |
|
Line 160... |
Line 156... |
160 |
'zone_champ': zoneChamp,
|
156 |
|
161 |
'abondance': abondance,
|
157 |
'certitude': certitude,
|
- |
|
158 |
'abondance': abondance,
|
Line 162... |
Line 159... |
162 |
'type_culture': typeCulture,
|
159 |
|
163 |
|
160 |
// Ajout des champs images
|
164 |
// Ajout des champs images
|
161 |
'image_nom' : lthis.getNomsImgsOriginales(),
|
165 |
//'image_nom': lthis.getNomsImgsOriginales(),
|
162 |
'image_b64' : lthis.getB64ImgsOriginales(),
|
166 |
|
163 |
|
167 |
// Ajout des champs étendus de l'obs
|
164 |
// Ajout des champs étendus de l'obs
|
168 |
//'obs_etendue': lthis.getObsChpEtendus()
|
165 |
'obs_etendue': lthis.getObsChpEtendus()
|
Line 169... |
Line 166... |
169 |
});
|
166 |
});
|
170 |
if (this.debug) {
|
167 |
if (this.debug) {
|
171 |
console.log($('#liste-obs').data('obsId'+this.obsNbre));
|
168 |
console.log($('#liste-obs').data('obsId'+this.obsNbre));
|
172 |
}
|
169 |
}
|
- |
|
170 |
};
|
- |
|
171 |
|
- |
|
172 |
/**
|
- |
|
173 |
* Affiche une observation dans la liste des observations à transmettre
|
- |
|
174 |
*/
|
173 |
};
|
175 |
WidgetSaisieMessicoles.prototype.afficherObs = function() {
|
174 |
|
176 |
var nomHorsListe = $('#taxon-liste').val() == '?' ? true : false,
|
175 |
/**
|
177 |
numNomSel = nomHorsListe ? $('#taxon').data('numNomSel') : $('#taxon-liste').val();
|
176 |
* Affiche une observation dans la liste des observations à transmettre
|
- |
|
177 |
*/
|
178 |
var nomSel = nomHorsListe ? $('#taxon').val() : $('#taxon-liste option:selected').data('nom-a-sauver'),
|
178 |
WidgetSaisieMessicoles.prototype.afficherObs = function() {
|
179 |
famille = nomHorsListe ? $('#taxon').data('famille') : this.taxons[numNomSel]['famille'],
|
179 |
|
- |
|
180 |
var commune = $("#commune-nom").text();
|
- |
|
181 |
commune = commune.trim() != "" ? commune : $("#carte-recherche").val();
|
- |
|
182 |
|
- |
|
183 |
var code_insee = $('#commune-code-insee').text();
|
180 |
referentiel = (numNomSel == undefined) ? '' : this.nomSciReferentiel;
|
184 |
code_insee = code_insee.trim() != "" ? "("+code_insee+")" : "";
|
181 |
|
185 |
|
- |
|
186 |
var taxonListe = $("#taxon-liste option:selected").data('nom-a-sauver');
|
182 |
var commune = $("#commune-nom").text();
|
187 |
var taxon = $("#taxon").val();
|
183 |
commune = commune.trim() != "" ? commune : $("#carte-recherche").val();
|
188 |
var numNomSel = $("#taxon").data("numNomSel");
|
184 |
var code_insee = $('#commune-code-insee').text();
|
- |
|
185 |
code_insee = code_insee.trim() != "" ? "("+code_insee+")" : "";
|
- |
|
186 |
var latitude = $("#latitude").val();
|
- |
|
187 |
var longitude = $("#longitude").val();
|
189 |
var latitude = $("#latitude").val();
|
188 |
var lieudit = ($('#lieudit').val() != "" ? $('#lieudit').val() : "pas de lieu-dit saisi");
|
190 |
var longitude = $("#longitude").val();
|
189 |
var station = ($('#station').val() != "" ? $('#station').val() : "pas de station saisie");
|
191 |
var date = $("#date").val();
|
190 |
var milieu = ($('#milieu').val() != "" ? $('#milieu').val() : "pas de milieu saisi");
|
192 |
var lieudit = ($('#lieudit').val() != "" ? $('#lieudit').val() : "pas de lieu-dit saisi");
|
191 |
|
193 |
var station = ($('#station').val() != "" ? $('#station').val() : "pas de station saisie");
|
192 |
var date = $("#date").val();
|
194 |
var milieu = ($('#milieu').val() != "" ? $('#milieu').val() : "pas de milieu saisi");
|
193 |
// champs spécifques aux messicoles
|
195 |
var culture = ($('#culture-autres-radio').is(':checked') ? $('#culture-autres-input').val() : $('input[name=type-culture]:checked').data('titre'));
|
194 |
var culture = ($('#culture-autres-radio').is(':checked') ? $('#culture-autres-input').val() : $('input[name=type-culture]:checked').data('titre'));
|
196 |
var identification = $('#identification-liste option:selected').data('titre');
|
195 |
var identification = $('#identification-liste option:selected').data('titre');
|
197 |
var abondance = $('#abondance-liste option:selected').data('titre');
|
196 |
var abondance = $('#abondance-liste option:selected').data('titre');
|
Line 198... |
Line -... |
198 |
var zoneChamp = [];
|
- |
|
199 |
// récupération des cases à cocher multiples dans un tableau pour l'abondance
|
- |
|
200 |
$('input[name="zone-champ[]"]:checked').each(function() {
|
- |
|
201 |
zoneChamp.push(' '+$(this).data('titre'));
|
- |
|
202 |
});
|
197 |
var zoneChamp = [];
|
203 |
var notes = $("#notes").val();
|
198 |
// récupération des cases à cocher multiples dans un tableau pour l'abondance
|
204 |
|
199 |
$('input[name="zone-champ[]"]:checked').each(function() {
|
205 |
if (this.debug) {
|
200 |
zoneChamp.push(' '+$(this).data('titre'));
|
206 |
console.log(commune+' - '+code_insee);
|
201 |
});
|
Line 222... |
Line 217... |
222 |
this.ajouterImgMiniatureAuTransfert()+
|
217 |
this.ajouterImgMiniatureAuTransfert()+
|
223 |
'</div>'+
|
218 |
'</div>'+
|
224 |
'<div class="span9">'+
|
219 |
'<div class="span9">'+
|
225 |
'<ul class="unstyled">'+
|
220 |
'<ul class="unstyled">'+
|
226 |
'<li>'+
|
221 |
'<li>'+
|
227 |
'<span class="nom-sci">'+taxonListe+taxon+'</span> '+
|
222 |
'<span class="nom-sci">'+nomSel+'</span> '+
|
228 |
this.ajouterNumNomSel()+'<span class="referentiel-obs">'+
|
223 |
this.ajouterNumNomSel(numNomSel, referentiel)+
|
229 |
(numNomSel == undefined ? '' : '['+ this.nomSciReferentiel +']')+'</span>'+
|
- |
|
230 |
' observé à <span class="gras">'+commune+' '+code_insee+'</span> ['+latitude+' / '+longitude+']'+' le <span class="gras">'+' '+date+'</span>'+
|
224 |
' observé à <span class="gras">'+commune+' '+code_insee+'</span> ['+latitude+' / '+longitude+']'+' le <span class="gras">'+' '+date+'</span>'+
|
231 |
'</li>'+
|
225 |
'</li>'+
|
232 |
'<li>'+
|
226 |
'<li>'+
|
233 |
'<div class="row-fluid">'+
|
227 |
'<div class="row-fluid">'+
|
234 |
'<span class="span4">Lieu-dit : <span class="gras">'+lieudit+'</span></span>'+
|
228 |
'<span class="span4">Lieu-dit : <span class="gras">'+lieudit+'</span></span>'+
|
Line 256... |
Line 250... |
256 |
'</div>'+
|
250 |
'</div>'+
|
257 |
'</div>');
|
251 |
'</div>');
|
258 |
$('#zone-liste-obs').removeClass("hidden").show();
|
252 |
$('#zone-liste-obs').removeClass("hidden").show();
|
259 |
};
|
253 |
};
|
Line -... |
Line 254... |
- |
|
254 |
|
- |
|
255 |
WidgetSaisieMessicoles.prototype.ajouterNumNomSel = function(numNom, referentiel) {
|
- |
|
256 |
var nn = '';
|
- |
|
257 |
if (numNom == '' || numNom == undefined) {
|
- |
|
258 |
nn = '<span class="alert-error">[non lié au référentiel]</span>';
|
- |
|
259 |
} else {
|
- |
|
260 |
nn = '<span class="nn">[nn'+numNom+']</span>'
|
- |
|
261 |
+ '<span class="referentiel-obs"> '
|
- |
|
262 |
+ referentiel+'</span>';
|
- |
|
263 |
}
|
- |
|
264 |
return nn;
|
- |
|
265 |
};
|
- |
|
266 |
|
- |
|
267 |
// surcharge, abadon du mécanisme générique et bidouillage en dur (plus facile
|
- |
|
268 |
// car champs radio / checkboxes)
|
- |
|
269 |
WidgetSaisieMessicoles.prototype.getObsChpEtendus = function() {
|
- |
|
270 |
var champs = [];
|
- |
|
271 |
|
- |
|
272 |
var zoneChamp = [];
|
- |
|
273 |
$('input[name="zone-champ[]"]:checked').each(function() {
|
- |
|
274 |
zoneChamp.push($(this).val());
|
- |
|
275 |
});
|
- |
|
276 |
//console.log("zc:", zoneChamp);
|
- |
|
277 |
// obligatoire donc jamais vide (on croise les doigts)
|
- |
|
278 |
champs.push({
|
- |
|
279 |
cle: "zoneDuChamp",
|
- |
|
280 |
label: "Zone du champ",
|
- |
|
281 |
valeur: zoneChamp.join()
|
- |
|
282 |
});
|
- |
|
283 |
|
- |
|
284 |
var typeCulture = $('input[name=type-culture]:checked').val();
|
- |
|
285 |
if (typeCulture == "autres") {
|
- |
|
286 |
typeCulture = $('#culture-autres-input').val();
|
- |
|
287 |
}
|
- |
|
288 |
//console.log("tc:", typeCulture);
|
- |
|
289 |
if (typeCulture != '') {
|
- |
|
290 |
champs.push({
|
- |
|
291 |
cle: "typeDeCulture",
|
- |
|
292 |
label: "Type de culture",
|
- |
|
293 |
valeur: typeCulture
|
- |
|
294 |
});
|
- |
|
295 |
}
|
- |
|
296 |
|
- |
|
297 |
return champs;
|
- |
|
298 |
}
|
Line 260... |
Line 299... |
260 |
|
299 |
|
261 |
|
300 |
|
Line 273... |
Line 312... |
273 |
return popoverHtmlContentDiv.html();
|
312 |
return popoverHtmlContentDiv.html();
|
274 |
}
|
313 |
}
|
275 |
});
|
314 |
});
|
Line 276... |
Line 315... |
276 |
|
315 |
|
277 |
// Activation de la saisie si on clique sur 'Autres' (type de champ)
|
316 |
// Activation de la saisie si on clique sur 'Autres' (type de champ)
|
278 |
$('.culture').change(function() {
|
317 |
function gererAffichageChampAutreCulture() {
|
279 |
var input = $('#culture-autres-input');
|
318 |
var input = $('#culture-autres-input');
|
280 |
($('#culture-autres-radio').is(':checked')) ? input.show() && input.focus() : input.hide();
|
319 |
($('#culture-autres-radio').is(':checked')) ? input.show() && input.focus() : input.hide();
|
- |
|
320 |
}
|
- |
|
321 |
$('.culture').change(gererAffichageChampAutreCulture);
|
- |
|
322 |
// ... et aussi au chargement du widget, si la sélection est restée sur "Autre"
|
Line 281... |
Line 323... |
281 |
});
|
323 |
gererAffichageChampAutreCulture();
|
282 |
|
324 |
|
283 |
// Affichage de l'espèce liée au référentiel sélectionné lors de la sélection 'Autres' (espèce)
|
325 |
// Affichage de l'espèce liée au référentiel sélectionné lors de la sélection 'Autres' (espèce)
|
284 |
$('#taxon-liste').change(function() {
|
326 |
function gererAffichageChampAutreEspece() {
|
285 |
var option = $('#taxon-liste').val();
|
327 |
var option = $('#taxon-liste').val();
|
286 |
var taxonCompletion = $('#taxon-input-groupe');
|
328 |
var taxonCompletion = $('#taxon-input-groupe');
|
287 |
if (option == '?') {
|
329 |
if (option == '?') {
|
288 |
taxonCompletion.show();
|
330 |
taxonCompletion.show();
|
289 |
$('#taxon').focus();
|
331 |
$('#taxon').focus();
|
290 |
}
|
332 |
}
|
291 |
else {
|
333 |
else {
|
292 |
taxonCompletion.hide();
|
334 |
taxonCompletion.hide();
|
- |
|
335 |
}
|
- |
|
336 |
}
|
- |
|
337 |
$('#taxon-liste').change(gererAffichageChampAutreEspece);
|
Line 293... |
Line 338... |
293 |
}
|
338 |
// ... et aussi au chargement du widget, si la sélection est restée sur "Autre espèce"
|
294 |
});
|
339 |
gererAffichageChampAutreEspece();
|
295 |
|
340 |
|
296 |
// On masque l'option par défaut pour l'abondance puisque le choix est obligatoire
|
341 |
// On masque l'option par défaut pour l'abondance puisque le choix est obligatoire
|