Subversion Repositories eFlore/Applications.cel

Rev

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

Rev 3273 Rev 3274
Line 157... Line 157...
157
 */
157
 */
158
WidgetSaisie.prototype.initEvts = function() {
158
WidgetSaisie.prototype.initEvts = function() {
159
	var lthis = this;
159
	var lthis = this;
Line 160... Line 160...
160
 
160
 
161
	// identité
161
	// identité
-
 
162
	$( '#bouton-anonyme' ).on( 'click', function( event ) {
162
	$( '#bouton-anonyme' ).on( 'click', function() {
163
		arreter( event );
163
		$( this ).css({
164
		$( this ).css({
164
			'background-color': 'rgba(0, 159, 184, 0.7)',
165
			'background-color': 'rgba(0, 159, 184, 0.7)',
165
			'color': '#fff'
166
			'color': '#fff'
166
		});
167
		});
Line 259... Line 260...
259
			}
260
			}
260
		});
261
		});
261
	}
262
	}
262
};
263
};
Line -... Line 264...
-
 
264
 
263
 
265
// se déclanche quand on choisit "Observation sans inscription" mais que le mail entré est incrit à Tela
-
 
266
WidgetSaisie.prototype.surSuccesCompletionCourriel = function( infos, courriel ) {
264
WidgetSaisie.prototype.surSuccesCompletionCourriel = function( infos, courriel ) {
267
	if ( $( '#utilisateur-connecte' ).hasClass( 'hidden' ) ) {// si quelque chose a foiré après actualisation
265
	$( '#zone-courriel' ).before( '<p class="warning"><i class="fas fa-exclamation-triangle"></i> ' + this.msgTraduction( 'courriel-connu' ) + '</p>' );
268
		$( '#zone-courriel' ).before( '<p class="warning"><i class="fas fa-exclamation-triangle"></i> ' + this.msgTraduction( 'courriel-connu' ) + '</p>' );
266
	$( '#bouton-inscription, #zone-prenom-nom, #zone-courriel-confirmation' ).addClass( 'hidden' );
269
		$( '#bouton-inscription, #zone-prenom-nom, #zone-courriel-confirmation' ).addClass( 'hidden' );
267
	$( '#prenom, #nom, #courriel_confirmation' ).attr( 'disabled', 'disabled' );
270
		$( '#prenom, #nom, #courriel_confirmation' ).attr( 'disabled', 'disabled' );
-
 
271
		$( '.nav.control-group' ).addClass( 'error' );
268
	$( '#bouton-connexion a' ).css( 'box-shadow', '0 0 1.5px 1px red' );
272
	}
Line -... Line 273...
-
 
273
};
269
};
274
 
270
 
275
// se déclanche quand on choisit "Observation sans inscription" et qu'effectivement le mail n'est pas connu de Tela
271
WidgetSaisie.prototype.surErreurCompletionCourriel = function() {
276
WidgetSaisie.prototype.surErreurCompletionCourriel = function() {
272
	$( '#creation-compte, #zone-prenom-nom, #zone-courriel-confirmation' ).removeClass( 'hidden' );
277
	$( '#creation-compte, #zone-prenom-nom, #zone-courriel-confirmation' ).removeClass( 'hidden' );
Line 273... Line 278...
273
	$( '.warning' ).remove();
278
	$( '.warning' ).remove();
274
	$( '#bouton-connexion a' ).css( 'box-shadow', '' );
279
	$( '.nav.control-group' ).removeClass( 'error' );
275
 
280
 
Line 799... Line 804...
799
				required : true,
804
				required : true,
800
				'dateCel' : true
805
				'dateCel' : true
801
			},
806
			},
802
			latitude : {
807
			latitude : {
803
				required : true,
808
				required : true,
-
 
809
				minlength : 1,
804
				range: [-90, 90]
810
				range : [-90, 90]
805
			},
811
			},
806
			longitude : {
812
			longitude : {
807
				required : true,
813
				required : true,
-
 
814
				minlength : 1,
808
				range: [-180, 180]
815
				range : [-180, 180]
809
			}
816
			}
810
		}
817
		}
811
	});
818
	});
Line 812... Line 819...
812
 
819
 
Line 821... Line 828...
821
				required : true,
828
				required : true,
822
				equalTo : '#courriel'
829
				equalTo : '#courriel'
823
			}
830
			}
824
		}
831
		}
825
	});
832
	});
-
 
833
 
-
 
834
	$( '#connexion,#bouton-inscription,#bouton-anonyme' ).click( function( event ) {
-
 
835
		$( '.nav.control-group' ).removeClass( 'error' );
-
 
836
	});
826
};
837
};
Line 827... Line 838...
827
 
838
 
828
WidgetSaisie.prototype.validerTaxonImage = function( taxon = false, images = false ) {
839
WidgetSaisie.prototype.validerTaxonImage = function( taxon = false, images = false ) {
829
	var taxonOuImage = ( images || taxon );
840
	var taxonOuImage = ( images || taxon );
Line 862... Line 873...
862
	// Commence à observer le noeud cible pour les mutations précédemment configurées
873
	// Commence à observer le noeud cible pour les mutations précédemment configurées
863
	this.observer.observe( targetNode, { childList: true } );
874
	this.observer.observe( targetNode, { childList: true } );
864
};
875
};
Line 865... Line 876...
865
 
876
 
866
WidgetSaisie.prototype.validerFormulaire = function() {
877
WidgetSaisie.prototype.validerFormulaire = function() {
867
	var observateur  = $( '#form-observateur' ).valid();
878
	var observateur  = ( $( '#form-observateur' ).valid() && $( '#courriel' ).valid() && $( '#courriel_confirmation' ).valid() )
-
 
879
	var obs          = $( '#form-observation' ).valid();
868
	var obs          = $( '#form-observation' ).valid();
880
	var geoloc       = ( valeurOk( $( '#latitude' ).val() ) && valeurOk( $( '#longitude' ).val() ) ) ;
869
	var images       = valeurOk( $( '#miniatures .miniature' ) );
881
	var images       = valeurOk( $( '#miniatures .miniature' ) );
870
	var taxon        = valeurOk( $( '#taxon' ).val() );
882
	var taxon        = valeurOk( $( '#taxon' ).val() );
871
	// validation et panneau taxon/images
883
	// validation et panneau taxon/images
872
 	var taxonOuImage = this.validerTaxonImage( taxon, images );
884
 	var taxonOuImage = this.validerTaxonImage( taxon, images );
Line 887... Line 899...
887
		})();
899
		})();
888
	} else {
900
	} else {
889
		chpsSupp = true;
901
		chpsSupp = true;
890
	}
902
	}
891
	// panneau geoloc
903
	// panneau geoloc
-
 
904
	if ( geoloc ) {
-
 
905
		this.masquerPanneau( '#dialogue-geoloc-ko' );
892
	( $( '#latitude' ).valid() && $( '#longitude' ).valid() ) ? this.masquerPanneau( '#dialogue-geoloc-ko' ) : this.afficherPanneau( '#dialogue-geoloc-ko' );
906
		$( '#geoloc-datas' ).closest( '.control-group' ).removeClass( 'error' );
-
 
907
	} else{
-
 
908
		this.afficherPanneau( '#dialogue-geoloc-ko' );
-
 
909
		$( '#geoloc-datas' ).closest( '.control-group' ).addClass( 'error' );
-
 
910
	}
893
	// panneau observateur
911
	// panneau observateur
-
 
912
	if ( observateur ) {
-
 
913
		this.masquerPanneau( '#dialogue-utilisateur-non-identifie' );
-
 
914
		$( '.nav.control-group' ).removeClass( 'error' );
-
 
915
	} else {
894
	( observateur ) ? this.masquerPanneau( '#dialogue-utilisateur-non-identifie' ) : this.afficherPanneau( '#dialogue-utilisateur-non-identifie' );
916
		this.afficherPanneau( '#dialogue-utilisateur-non-identifie' );
-
 
917
		$( '.nav.control-group' ).addClass( 'error' );
-
 
918
	}
Line 895... Line 919...
895
 
919
 
896
	return ( observateur && obs && taxonOuImage && chpsSupp );
920
	return ( observateur && obs && geoloc && taxonOuImage && chpsSupp );
Line 897... Line 921...
897
};
921
};
898
 
922
 
899
// Fichier Images *************************************************************/
923
// Fichier Images *************************************************************/