220,9 → 220,10 |
observateur = $("#form-observateur").valid(); |
situation = $("#form-situation").valid(); |
criteres = $("#form-criteres").valid(); |
remarquable = $("#form-remarquable").valid(); |
station = $("#form-station").valid(); |
obs = $("#form-obs").valid(); |
return (observateur && station && obs && criteres && situation); |
return (observateur && station && obs && criteres && situation &&remarquable); |
}; |
|
WidgetSaisieArbresRemarquables.prototype.definirReglesFormValidator = function() { |
263,22 → 264,33 |
}); |
$('#form-situation').validate({ |
rules: { |
"situation[]" : { |
"situation-ch" : { |
required : true, |
minlength : 1 |
} |
}, |
errorPlacement: function(error, element) { |
//error.insertBefore(element.parent()); |
error.insertBefore(element.parent()); |
error.insertAfter(element.closest('div.btn-group.dropdown')); |
} |
}); |
$('#form-criteres').validate({ |
rules: { |
"arbreRemarquableRemarquable[]": 'required', |
arbreRemarquableRemarquabilite: 'required' |
} |
}); |
$('#form-remarquable').validate({ |
rules: { |
"remarquable-ch" : { |
required : true, |
minlength : 1 |
} |
}, |
errorPlacement: function(error, element) { |
error.insertBefore(element.parent()); |
error.insertAfter(element.closest('div.control-group')); |
} |
}); |
}; |
|
|
318,7 → 330,6 |
lng = $('input[name="longitude"]').val(), |
date = $('#date').val(), |
certitude = $('#certitude').val(), |
nbreAligne = ($('#aligne-nbre').val() != undefined ? ' (' + $('#aligne-nbre').val() + ')' : ''), |
circonference = $('#circonference').val(), |
hauteur = $('#hauteurNbr').val(), |
hauteurPrec = ($('#hauteurPrec').val() != "" ? ' (' + $('#hauteurPrec').val() + ')' : ''), |
326,12 → 337,25 |
sante = $('#sante').val(), |
cavites = $('#cavites').val(), |
historique = $('#historique').val(), |
notes = (nomSpecial ? this.taxons[numNomSel]['nom_fr'] + ".<br />" : '') + $('#notes').val(); |
notes = (nomSpecial ? this.taxons[numNomSel]['nom_fr'] + ".<br />" : '') + $('#notes').val(), |
remarquabilite= $('#remarquabilite').val(); |
|
var culture = ($('input[name=type-culture]').is(':checked') ? $('input[name=type-culture]:checked').data('titre') : "?"); |
var cultureDetails = ($('input[name=type-culture]').is(':checked') ? $('input[name=type-culture]:checked').parent().find('input[type=text]').val() : '?'); |
var situation = []; |
// récupération des cases à cocher multiples dans un tableau pour l'abondance |
$('input[name="situation-ch"]:checked').each(function() { |
situation.push(' '+$(this).val()); |
}); |
var remarquable = []; |
// récupération des cases à cocher multiples dans un tableau pour l'abondance |
$('input[name="remarquable-ch"]:checked').each(function() { |
remarquable.push(' '+$(this).val()); |
}); |
var esthetique = []; |
// récupération des cases à cocher multiples dans un tableau pour l'abondance |
$('input[name="esthetique-ch"]:checked').each(function() { |
esthetique.push(' '+$(this).val()); |
}); |
|
|
$('#liste-obs').prepend( |
'<div id="obs'+this.obsNbre+'" class="obs obs'+this.obsNbre+'">'+ |
'<div class="well">'+ |
365,9 → 389,13 |
'<span>Âge :</span> ' + age + ' ; ' + |
'<span>Santé :</span> ' + sante + ' ; ' + |
'<span>Cavités :</span> ' + cavites + ' ; ' + |
'<span>Situation :</span> ' + situation + ' ; ' + |
'</li>' + |
'<li>' + |
'<span>Historique :</span> ' + historique + ' ' + |
'<span>Intérêt esthetique :</span> ' + esthetique + ' ' + |
'<span>Intérêt historique :</span> ' + historique + ' ' + |
'<span>Raison(s) remarquabilité :</span> ' + remarquable + ' ' + |
'<span>Degré de remarquabilité :</span> ' + remarquabilite + ' ' + |
'</li>' + |
'<li>' + |
'<span>Notes :</span> ' + notes + |
389,17 → 417,6 |
return nn; |
}; |
|
/*WidgetSaisieArbresRemarquables.prototype.getMilieux = function() { |
var milieuxStr = '', |
milieux = []; |
$('.cb-milieux:checked').each(function() { |
milieux.push($(this).val()); |
}); |
|
milieuxStr = Array.prototype.slice.call(milieux).join(', '); |
return milieuxStr; |
};*/ |
|
WidgetSaisieArbresRemarquables.prototype.getTextOptionSelectionne = function(id) { |
return ($('#' + id).val() != undefined ? $('#' + id + ' option:selected').text() : ''); |
}; |
434,7 → 451,6 |
'commune_code_insee' : $('#commune-code-insee').text(), |
'altitude': $('#altitude').text(), |
'lieudit': $('#lieudit').val(), |
'milieu': this.getMilieux(), |
'certitude': $('#certitude').val(), |
|
//Ajout des champs images |
449,7 → 465,10 |
* Redéfinition pour les champs complexes |
*/ |
WidgetSaisieArbresRemarquables.prototype.getObsChpEtendus = function() { |
var champs = []; |
var champs = [], |
situation = [], |
esthetique = [], |
remarquable = []; |
|
$('.obs-chp-etendu').each(function() { |
var valeur = $(this).val(), |
460,5 → 479,50 |
champs.push(chpEtendu); |
} |
}); |
|
$('input.cb-situation').each(function() { |
var valeur = $(this).val(); |
if (valeur == 'Autre') { |
if ($('#autre-situation').val() != '') { |
situation.push(valeur+' :'+$('#autre-situation').val()); |
} else { |
situation.push(valeur); |
} |
} else if (valeur != '') { |
situation.push(valeur); |
} |
}); |
var chpEtendu = {cle: 'arbreRemarquableSituation', label: 'contexte/situation', valeur: situation.join('; ')}; |
champs.push(chpEtendu); |
|
$('input.cb-remarquable').each(function() { |
var valeur = $(this).val(), |
comm = $(this).attr('id')+'-commentaire', |
commid = $('#'+comm).val(); |
if (commid != '') { |
remarquable.push(valeur+' :'+commid); |
} else { |
remarquable.push(valeur); |
} |
}); |
var chpEtendu = {cle: 'arbreRemarquableRemarquable', label: 'remarquable', valeur: remarquable.join('; ')}; |
champs.push(chpEtendu); |
|
$('input.cb-esthetique').each(function() { |
var valeur = $(this).val(); |
console.log(valeur); |
if (valeur == 'Autre') { |
if ($('#autre-esthetique').val() != '') { |
esthetique.push(valeur+' :'+$('#autre-esthetique').val()); |
} else { |
esthetique.push(valeur); |
} |
} else if (valeur != '') { |
esthetique.push(valeur); |
} |
}); |
var chpEtendu = {cle: 'arbreRemarquableEsthetique', label: 'Intérêt esthétique', valeur: esthetique.join('; ')}; |
champs.push(chpEtendu); |
|
return champs; |
}; |