40,6 → 40,7 |
this.msgs = { |
fr: { |
'format-non-supporte': 'Le format de fichier n\'est pas supporté, les formats acceptés sont', |
'image-deja-chargee' : 'Cette image a déjà été utilisée', |
'date-incomplete': 'Format : jj/mm/aaaa. Date incomplète, utiliser 0, exemple : 00/12/2011.', |
'observations-transmises': 'observations transmises', |
'taxon-ou-image' : 'Veuillez transmettre au moins, soit une image, soit une espèce', |
61,6 → 62,7 |
}, |
en: { |
'format-non-supporte': 'The file format is not supported, the accepted formats are', |
'image-deja-chargee' : 'This image has already been used', |
'date-incomplete': 'Format: dd / mm / yyyy. Incomplete date, use 0, example: 00/12/2011.', |
'observations-transmises': 'observations transmitted', |
'taxon-ou-image' : 'Please transmit at least one image or one species', |
95,9 → 97,8 |
* Initialise le formulaire, les validateurs, les listes de complétion... |
*/ |
WidgetSaisie.prototype.initForm = function() { |
const lthis = this; |
|
var lthis = this; |
|
this.chargerStatutSSO(); |
|
if ( valeurOk( this.obsId ) ) { |
155,12 → 156,14 |
* Initialise les écouteurs d'événements |
*/ |
WidgetSaisie.prototype.initEvts = function() { |
var lthis = this; |
const lthis = this; |
|
// Empêcher que le module carto ne bind ses events partout |
$( '#tb-geolocation' ).on( 'submit blur click focus mousedown mouseleave mouseup touchend touchstart change', '*', function( event ) { |
$( '#tb-geolocation' ).on( 'submit blur click focus mousedown mouseleave mouseup change', '*', function( event ) { |
event.preventDefault(); |
return false; |
}); |
$( '#tb-geolocation' ).on( 'location' , lthis.locationHandler.bind( lthis ) ); |
|
// identité |
$( '#bouton-inscription' ).attr( 'href', this.urlSiteTb() + 'inscription' ); |
194,13 → 197,22 |
resetForm: true // reset the form after successful submit |
}; |
$( '#miniature' ).append( '<img id="miniature-chargement" class="miniature" alt="chargement" src="' + this.chargementImageIconeUrl + '"/>' ); |
$( '#ajouter-obs' ).attr( 'disabled', 'disabled' ); |
if( lthis.verifierFormat( $( '#fichier' ).val() ) ) { |
|
var imgCheminTmp = $( '#fichier' ).val(), |
formatImgOk = lthis.verifierFormat( imgCheminTmp ), |
imgNonDupliquee = lthis.verifierDuplication( imgCheminTmp ); |
|
if( formatImgOk && imgNonDupliquee ) { |
$( '#form-upload' ).ajaxSubmit( options ); |
} else { |
$( '#form-upload' )[0].reset(); |
if ( !formatImgOk ) { |
window.alert( lthis.msgTraduction( 'format-non-supporte' ) + ' ' + $( '#fichier' ).attr( 'accept' ) ); |
} |
if ( !imgNonDupliquee ) { |
window.alert( lthis.msgTraduction( 'image-deja-chargee' ) ); |
} |
} |
return false; |
}); |
|
242,10 → 254,11 |
* à droite de la barre en fonction |
*/ |
WidgetSaisie.prototype.chargerStatutSSO = function() { |
const lthis = this; |
var urlAuth = this.urlBaseAuth + '/identite'; |
|
$( '#form-observateur' )[0].reset(); |
var lthis = this; |
|
var urlAuth = this.urlBaseAuth + '/identite'; |
|
if( 'local' !== this.mode ) { |
this.connexion( urlAuth, true ); |
262,19 → 275,19 |
* Déconnecte l'utilisateur du SSO |
*/ |
WidgetSaisie.prototype.deconnecterUtilisateur = function() { |
var urlAuth = this.urlBaseAuth + '/deconnexion'; |
|
if( 'local' === this.mode ) { |
this.definirUtilisateur(); |
window.location.reload(); |
return; |
} |
|
var urlAuth = this.urlBaseAuth + '/deconnexion'; |
|
this.connexion( urlAuth, false ); |
}; |
|
WidgetSaisie.prototype.connexion = function( urlAuth, connexionOnOff ) { |
var lthis = this; |
const lthis = this; |
|
$.ajax({ |
url: urlAuth, |
type: "GET", |
373,9 → 386,11 |
|
// Identité Observateur par courriel |
WidgetSaisie.prototype.requeterIdentiteCourriel = function() { |
var lthis = this; |
const lthis = this; |
|
var courriel = $( '#courriel' ).val(); |
var urlAnnuaire = this.serviceAnnuaireIdUrl + courriel; |
|
if ( valeurOk( courriel ) ) { |
$.ajax({ |
url : urlAnnuaire, |
473,8 → 488,10 |
|
// Préchargement des infos-obs ************************************************/ |
WidgetSaisie.prototype.chargerInfoObs = function() { |
const lthis = this; |
|
var urlObs = this.serviceObsUrl + '/' + this.obsId; |
var lthis = this; |
|
$.ajax({ |
url: urlObs, |
type: 'GET', |
548,7 → 565,6 |
} |
}; |
|
|
WidgetSaisie.prototype.surChangementValeurTaxon = function() { |
var numNomSel = 0; |
|
584,9 → 600,10 |
|
// Autocompletion taxons ******************************************************/ |
WidgetSaisie.prototype.ajouterAutocompletionNoms = function() { |
var lthis = this; |
const lthis = this; |
|
var taxonSelecteur = '#taxon'; |
|
if ( valeurOk ( $( '#taxon-liste' ).val(), true, 'autre' ) ) { |
taxonSelecteur += '-autre'; |
} |
618,18 → 635,21 |
|
WidgetSaisie.prototype.getUrlAutocompletionNomsSci = function() { |
var taxonSelecteur = '#taxon'; |
|
if ( valeurOk ( $( '#taxon-liste' ).val(), true, 'autre' ) ) { |
taxonSelecteur += '-autre'; |
} |
|
var mots = $( taxonSelecteur ).val(); |
var url = this.serviceAutocompletionNomSciUrlTpl.replace( '{referentiel}', this.nomSciReferentiel ); |
|
url = url.replace( '{masque}', mots ); |
return url; |
}; |
|
WidgetSaisie.prototype.traiterRetourNomsSci = function( data ) { |
var taxonSelecteur = '#taxon'; |
|
var taxonSelecteur = '#taxon'; |
if ( valeurOk ( $( '#taxon-liste' ).val(), true, 'autre' ) ) { |
taxonSelecteur += '-autre'; |
} |
689,7 → 709,6 |
} else { |
$( '#taxon' ).removeClass( 'ns-retenu' ); |
} |
|
// Si l'espèce est mal déterminée la certitude est "à déterminer" |
if( !valeurOk( $( '#taxon' ).data( 'numNomSel' ) ) ) { |
$( '#certitude' ).find( 'option' ).each( function() { |
704,9 → 723,70 |
$( '#taxon' ).trigger( 'change' ); |
}; |
|
|
// Géolocalisation *************************************************************/ |
/** |
* Fonction handler de l'évenement location du module tb-geoloc |
*/ |
WidgetSaisie.prototype.locationHandler = function( location ) { |
var locDatas = location.originalEvent.detail; |
|
if ( valeurOk( locDatas ) ) { |
console.log( locDatas ); |
var altitude = ( valeurOk( locDatas.elevation ) ) ? locDatas.elevation : ''; |
var pays = ( valeurOk( locDatas.osmCountryCode ) ) ? locDatas.osmCountryCode.toUpperCase() : 'FR'; |
var latitude = ''; |
var longitude = ''; |
var coordLineaire = ''; |
var nomCommune = ''; |
var communeInsee = ''; |
|
if ( valeurOk( locDatas.geometry.coordinates ) ) { |
if ( 'Point' === locDatas.geometry.type ) { |
if ( valeurOk( locDatas.geometry.coordinates[0] ) ) { |
longitude = locDatas.geometry.coordinates[0]; |
} |
if ( valeurOk( locDatas.geometry.coordinates[1] ) ) { |
latitude = locDatas.geometry.coordinates[1]; |
} |
} else if ( 'LineString' === locDatas.geometry.type ) {// on a besoin que d'un point de la rue |
coordLineaire = JSON.stringify( locDatas.geometry.coordinates ); |
if ( valeurOk( locDatas.geometry.coordinates[0][0] ) ) { |
longitude = locDatas.geometry.coordinates[0][0]; |
} |
if ( valeurOk( locDatas.geometry.coordinates[0][1] ) ){ |
latitude = locDatas.geometry.coordinates[0][1]; |
} |
} |
} |
if ( valeurOk( locDatas.inseeData ) ) { |
nomCommune = locDatas.inseeData.nom; |
communeInsee = ( valeurOk( locDatas.inseeData.code ) ) ? locDatas.inseeData.code : ''; |
} else if ( valeurOk( locDatas.locality ) ) { |
nomCommune = locDatas.locality; |
} else if ( valeurOk( locDatas.locality ) ) { |
nomCommune = locDatas.osmCounty; |
} |
$( '#coord-lineaire' ).val( coordLineaire ); |
$( '#latitude' ).val( latitude ); |
$( '#longitude' ).val( longitude ); |
$( '#commune-nom' ).val( nomCommune ); |
$( '#commune-insee' ).val( communeInsee ); |
$( '#altitude' ).val( altitude ); |
$( '#pays' ).val( pays ); |
if ( valeurOk( $( '#latitude' ).val() ) && valeurOk( $( '#longitude' ).val() ) ) { |
$( '#geoloc' ).closest( '.control-group' ).removeClass( 'error' ); |
} else { |
$( '#geoloc' ).closest( '.control-group' ).addClass( 'error' ); |
} |
} else { |
console.log( 'Error location' ); |
} |
} |
|
// Form Validator *************************************************************/ |
WidgetSaisie.prototype.configurerFormValidator = function() { |
var lthis = this; |
const lthis = this; |
|
$.validator.addMethod( |
'dateCel', |
715,7 → 795,6 |
}, |
lthis.msgTraduction( 'date-incomplete' ) |
); |
|
$.validator.addMethod( |
'userEmailOk', |
function ( value, element ) { |
723,7 → 802,6 |
}, |
'' |
); |
|
$.validator.addMethod( |
'minMaxOk', |
function ( value, element, param ) { |
732,7 → 810,6 |
}, |
$.validator.messages.minMaxOk |
); |
|
$.validator.addMethod( |
'listFields', |
function ( value, element ) { |
740,7 → 817,6 |
}, |
'' |
); |
|
$.extend( $.validator.defaults, { |
errorElement: 'span', |
onfocusout: function( element ) { |
773,7 → 849,8 |
}; |
|
WidgetSaisie.prototype.chpEtendusValidation = function() { |
var lthis = this; |
const lthis = this; |
|
var $thisForm = $( '#form-supp' ), |
elements = |
'.checkbox,'+ |
800,11 → 877,11 |
$( elements, $thisForm ).each( function() { |
for( var fieldsClass = 0; spefieldsCount > fieldsClass; fieldsClass++ ) { |
if ( valeurOk( $( this ).attr( 'required' ) ) && $( this ).hasClass( speFields[fieldsClass] ) && !valeurOk( chpSuppValidation.rules[ dataName ] ) ) { |
|
var dataName = $( this ).data( 'name' ); |
|
namesListFields.push( dataName ); |
chpSuppValidation.rules[ dataName ] = { required : true }; |
|
if ( valeurOk( $( '.other', $( this ) ) ) ) { |
picked = ( 'select' === speFields[fieldsClass] ) ? ':selected' : ':checked'; |
chpSuppValidation.rules[ 'collect-other-' + dataName.replace( '[]', '' ) ] = { |
873,8 → 950,8 |
|
|
WidgetSaisie.prototype.definirReglesFormValidator = function() { |
var formSuppValidation = this.chpEtendusValidation(), |
lthis = this; |
const lthis = this; |
var formSuppValidation = this.chpEtendusValidation(); |
|
$( '#form-supp' ).validate({ |
onclick : function( element ) { |
926,24 → 1003,19 |
} |
} |
}); |
|
$( '#form-supp .select' ).change( function() { |
$( this ).valid(); |
}); |
|
$( 'input[type=date]' ).on( 'input', function() { |
$( this ).valid(); |
}); |
|
// Validation Taxon si pas de miniature |
$( '#taxon' ).on( 'change', function() { |
var images = valeurOk( $( '#miniatures .miniature' ) ); |
lthis.validerTaxonImage( valeurOk( $( this ).val() ), images ); |
}); |
|
// Validation miniatures avec MutationObserver |
this.surPresenceAbsenceMiniature(); |
|
$( '#form-observation' ).validate({ |
rules : { |
date_releve : { |
962,7 → 1034,6 |
} |
} |
}); |
|
$( '#form-observateur' ).validate({ |
rules : { |
courriel : { |
976,7 → 1047,6 |
} |
} |
}); |
|
$( '#connexion,#bouton-inscription,#bouton-anonyme' ).click( function( event ) { |
$( '.nav.control-group' ).removeClass( 'error' ); |
}); |
1001,7 → 1071,7 |
}; |
|
WidgetSaisie.prototype.surPresenceAbsenceMiniature = function() { |
var lthis = this; |
const lthis = this; |
|
// voir : https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver/disconnect |
// Selectionne le noeud dont les mutations seront observées |
1010,6 → 1080,7 |
var callback = function( mutationsList ) { |
for( var mutation of mutationsList ) { |
var taxon = valeurOk( $( '#taxon' ).val() ); |
|
images = ( 0 < mutation.target.childElementCount ); |
lthis.validerTaxonImage( taxon, images ); |
} |
1062,7 → 1133,6 |
this.afficherPanneau( '#dialogue-utilisateur-non-identifie' ); |
$( '.nav.control-group' ).addClass( 'error' ); |
} |
|
return ( observateur && obs && geoloc && taxonOuImage && chpsSupp ); |
}; |
|
1075,7 → 1145,9 |
var debogage = $( 'debogage', reponse ).text(); |
//console.log( 'Débogage upload : '+debogage); |
} |
|
var message = $( 'message', reponse ).text(); |
|
if ( valeurOk( message ) ) { |
$( '#miniature-msg' ).append( message ); |
} else { |
1095,6 → 1167,7 |
'<img class="miniature-img" class="miniature img-rounded" alt="' + imgNom + '" src="' + miniatureUrl + '"/>'+ |
'<a class="effacer-miniature"><i class="far fa-trash-alt"></i></a>'+ |
'</div>'; |
|
return html; |
}; |
|
1103,11 → 1176,41 |
*/ |
WidgetSaisie.prototype.verifierFormat = function( nom ) { |
var parts = nom.split( '.' ); |
|
extension = parts[ parts.length - 1 ]; |
return ( 'jpeg' === extension.toLowerCase() || 'jpg' === extension.toLowerCase() ); |
}; |
|
/** |
* Check les miniatures déjà téléchargées |
* renvoie false si le même nom est rencontré 2 fois |
* renvoie true sinon |
*/ |
WidgetSaisie.prototype.verifierDuplication = function( cheminTmp ) { |
var parts = cheminTmp.split( '\\' ), |
nomImage = parts[ parts.length - 1 ], |
thisSrcParts = [], |
thisNomImage = '', |
nonDupliquee = true; |
|
$( 'img.miniature-img,img.miniature' ).each( function() { |
// vérification avec alt de l'image |
if ( valeurOk( $( this ).attr ( 'alt' ), true, nomImage ) ) { |
nonDupliquee = false; |
return false;// Pas besoin de poursuivre la boucle |
} else { // sinon vérifie aussi avec l'adresse (src) de l'image |
thisSrcParts = $( this ).attr( 'src' ).split( '/' ); |
thisNomImage = thisSrcParts[ thisSrcParts.length - 1 ].replace( '_min', '' ); |
if ( valeurOk( thisNomImage, true, nomImage ) ) { |
nonDupliquee = false; |
return false; |
} |
} |
}); |
return nonDupliquee; |
}; |
|
/** |
* Efface une miniature (formulaire) |
*/ |
WidgetSaisie.prototype.supprimerMiniature = function( miniature ) { |
1121,8 → 1224,6 |
//réinitialise taxon.val |
$( '#taxon' ).val( '' ); |
$( '#taxon' ).data( 'numNomSel', '' ); |
// this.initialiserAutocompleteCommune(); |
// this.initialiserGoogleMap( false ); |
}; |
|
// Ajouter Obs ****************************************************************/ |
1134,7 → 1235,6 |
// @WARNING TEST |
$( '#dialogue-obs-transaction-ko' ).addClass( 'hidden' ); |
$( '#dialogue-obs-transaction-ok' ).addClass( 'hidden' ); |
|
if ( this.validerFormulaire() ) { |
this.masquerPanneau( '#dialogue-form-invalide' ); |
this.obsNbre = this.obsNbre + 1; |
1177,7 → 1277,6 |
* Affiche une observation dans la liste des observations à transmettre |
*/ |
WidgetSaisie.prototype.afficherObs = function() { |
|
var numNomSel = $( '#taxon' ).data( 'numNomSel' ), |
taxon = $( '#taxon' ).val(), |
referentiel = '', |
1207,7 → 1306,7 |
milieu = '<span>' + this.msgTraduction( 'milieu' ) + ' :</span> ' + $( '#milieu' ).val() + ' '; |
} |
if ( valeurOk( $( '#notes' ).val() ) ) { |
commentaires = this.msgTraduction( 'commentaires' ) + ' : <span class="discretion">' + $( '#notes' ).val() + '</span>' + ' '; |
commentaires = this.msgTraduction( 'commentaires' ) + ' : <span>' + $( '#notes' ).val() + '</span>' + ' '; |
} |
|
var responsivDiff1 = '', |
1290,14 → 1389,16 |
|
if ( valeurOk( $( '#miniatures img' ) ) ) { |
$( '#miniatures img' ).each( function() { |
var imgVisible = ( premiere ) ? 'miniature-selectionnee' : 'miniature-cachee'; |
premiere = false; |
|
var css = ( $( this ).hasClass( 'b64' ) ) ? 'miniature b64' : 'miniature', |
var imgVisible = ( premiere ) ? 'miniature-selectionnee' : 'miniature-cachee', |
css = ( $( this ).hasClass( 'b64' ) ) ? 'miniature b64' : 'miniature', |
src = $( this ).attr( 'src' ), |
alt = $( this ).attr( 'alt' ), |
miniature = '<img class="' + css + ' ' + imgVisible + ' align-middle" alt="' + alt + '"src="' + src + '" width="80%" />'; |
|
premiere = false; |
|
|
miniatures += miniature; |
}); |
if ( 1 === $( '#miniatures img' ).length ) { |
1337,7 → 1438,7 |
|
|
WidgetSaisie.prototype.stockerObsData = function() { |
var lthis = this; |
const lthis = this; |
|
var numNomSel = $( '#taxon' ).data( 'numNomSel' ), |
nomSel = $( '#taxon' ).val(), |
1364,13 → 1465,6 |
'latitude' : $( '#latitude' ).val(), |
'longitude' : $( '#longitude' ).val(), |
'altitude' : $( '#altitude' ).val(), |
// début valeurs pour test: |
// 'commune_nom' : 'Montpellier', |
// 'commune_code_insee' : '34172', |
// 'latitude' : '43.608320', |
// 'longitude' : '3.880196', |
// 'altitude' : '0', |
//fin valeurs pour test |
'lieudit' : $( '#lieudit' ).val(), |
'station' : $( '#station' ).val(), |
'milieu' : $( '#milieu' ).val(), |
1384,6 → 1478,7 |
|
WidgetSaisie.prototype.getNomsImgsOriginales = function() { |
var noms = new Array(); |
|
$( '.miniature-img' ).each( function() { |
noms.push( $( this ).attr( 'alt' ) ); |
}); |
1392,6 → 1487,7 |
|
WidgetSaisie.prototype.getB64ImgsOriginales = function() { |
var b64 = new Array(); |
|
$( '.miniature-img' ).each( function() { |
if ( $( this ).hasClass( 'b64' ) ) { |
b64.push( $( this ).attr( 'src' ) ); |
1433,7 → 1529,10 |
}); |
for( var key in champs ) { |
retour.push({ 'cle' : key , 'valeur' : champs[key] }); |
}; |
} |
if ( valeurOk( $( '#coord-lineaire' ).val() ) ) { |
retour.push({ 'cle' : 'coordonnees-rue-ou-lineaire' , 'valeur' : $( '#coord-lineaire' ).val() }); |
} |
return retour; |
}; |
|
1463,8 → 1562,8 |
}; |
|
WidgetSaisie.prototype.defilerMiniatures = function( element ) { |
var miniatureSelectionne = element.siblings( 'figure' ).find( 'img.miniature-selectionnee' ); |
|
var miniatureSelectionne = element.siblings( 'figure' ).find( 'img.miniature-selectionnee' ); |
miniatureSelectionne.removeClass( 'miniature-selectionnee' ); |
miniatureSelectionne.addClass( 'miniature-cachee' ); |
|
1489,6 → 1588,7 |
|
WidgetSaisie.prototype.supprimerObs = function( selector ) { |
var obsId = $( selector ).val(); |
|
// Problème avec IE 6 et 7 |
if ( 'Supprimer' === obsId ) { |
obsId = $( selector ).attr( 'title' ); |
1501,11 → 1601,37 |
$( '.obs-nbre' ).text( this.obsNbre ); |
$( '.obs-nbre' ).triggerHandler( 'changement' ); |
$( '.obs' + obsId ).remove(); |
$( '#liste-obs' ).removeData( 'obsId' + obsId ); |
obsId = parseInt( obsId ); |
|
var listObsData = $( '#liste-obs' ).data(), |
exId = 0, |
indexObs = '', |
exIndexObs = ''; |
|
for ( var id = obsId; id <= ( this.obsNbre + 1 ); id++ ) { |
exId = parseInt( id ) + 1; |
indexObs = 'obsId' + id; |
exIndexObs = 'obsId' + exId; |
$( '#liste-obs' ).removeData( indexObs ); |
if ( valeurOk( listObsData[ exIndexObs ] ) ) { |
$( '#liste-obs' ).data( indexObs, listObsData[ exIndexObs ] ); |
} |
$( '#obs' + exId ) |
.attr( 'id', 'obs' + id ) |
.removeClass( 'obs' + exId ) |
.addClass( 'obs' + id ) |
.find( '.supprimer-obs' ) |
.attr( 'title', 'Observation n°' + id ) |
.val( id ); |
if ( parseInt( id ) !== this.obsNbre ) { |
id = parseInt( id ); |
} |
} |
}; |
|
WidgetSaisie.prototype.transmettreObs = function() { |
var observations = $( '#liste-obs' ).data(); |
|
if ( this.debug ) { |
console.log( observations ); |
} |
1524,6 → 1650,7 |
|
WidgetSaisie.prototype.depilerObsPourEnvoi = function() { |
var observations = $( '#liste-obs' ).data(); |
|
// la boucle est factice car on utilise un tableau |
// dont on a besoin de n'extraire que le premier élément |
// or javascript n'a pas de méthode cross browsers pour extraire les clés |
1541,9 → 1668,12 |
nom : $( '#nom' ).val(), |
courriel : $( '#courriel' ).val() |
}; |
|
obsATransmettre['utilisateur'] = utilisateur; |
obsATransmettre[obsNum] = observations[obsNum]; |
|
var idObsNumerique = obsNum.replace( 'obsId', '' ); |
|
if( '' !== idObsNumerique ) { |
this.envoyerObsAuCel( idObsNumerique, obsATransmettre ); |
} |
1552,9 → 1682,10 |
}; |
|
WidgetSaisie.prototype.envoyerObsAuCel = function( idObs, observation ) { |
var lthis = this; |
const lthis = this; |
|
var erreurMsg = ''; |
|
$.ajax({ |
url : lthis.serviceSaisieUrl, |
type : 'POST', |
1606,14 → 1737,12 |
$( '#dialogue-obs-transaction-ko .alert-txt' ).append( '<pre class="msg-erreur">' + erreurMsg + '</pre>' ); |
$( '#dialogue-obs-transaction-ko .alert-txt' ).append( '<pre class="msg-debug">Débogage : ' + debugMsg + '</pre>' ); |
} |
|
var hrefCourriel = 'mailto:cel_remarques@tela-botanica.org?'+ |
'subject=Dysfonctionnement du widget de saisie ' + lthis.tagProjet+ |
'&body=' + erreurMsg + '%0D%0ADébogage :%0D%0A' + debugMsg; |
|
// mise en valeur de l'obs en erreur + scroll vers celle ci en changeant le hash |
$( '#obs' + idObs + ' div div' ).addClass( 'obs-erreur' ); |
window.location.hash = 'obs' + idObs; |
|
$( '#dialogue-obs-transaction-ko .alert-txt' ).append( |
$( '#tpl-transmission-ko' ).clone() |
.find( '.courriel-erreur' ) |
1633,7 → 1762,6 |
$( '#chargement' ).addClass( 'hidden' ); |
$( '#dialogue-obs-transaction-ok .alert-txt' ).append( $( '#tpl-transmission-ok' ).clone().html() ); |
$( '#dialogue-obs-transaction-ok' ).removeClass( 'hidden' ); |
window.location.hash = 'dialogue-obs-transaction-ok'; |
lthis.initialiserObs.bind( lthis ); |
}, 1500 ); |
} |
1702,6 → 1830,7 |
*/ |
WidgetSaisie.prototype.msgTraduction = function( cle ) { |
var msg = 'N/A'; |
|
if ( this.msgs ) { |
if ( this.langue in this.msgs && cle in this.msgs[this.langue] ) { |
msg = this.msgs[this.langue][cle]; |
1726,7 → 1855,6 |
* @returns {boolean} |
*/ |
function valeurOk( valeur, sensComparaison = true, comparer = undefined ) { |
|
if ( 'boolean' !== typeof valeur ) { |
switch( typeof valeur ) { |
case 'string' : |
1777,8 → 1905,10 |
*/ |
function extraireEnteteDebug( jqXHR ) { |
var msgDebug = ''; |
|
if ( '' !== jqXHR.getResponseHeader( 'X-DebugJrest-Data' ) ) { |
var debugInfos = jQuery.parseJSON( jqXHR.getResponseHeader( 'X-DebugJrest-Data' ) ); |
|
if ( null !== debugInfos ) { |
$.each( debugInfos, function( cle, valeur ) { |
msgDebug += valeur + '\n'; |
1804,6 → 1934,7 |
|
WidgetSaisie.prototype.filter = function( array, term ) { |
var matcher = new RegExp( $.ui.autocomplete.escapeRegex( term ), 'i' ); |
|
return $.grep( array, function( value ) { |
return matcher.test( $( '<div>' ).html( value.label || value.value || value ).text() ); |
}); |