update project with new architecture
This commit is contained in:
		
							
								
								
									
										24
									
								
								asupsetup/data/domain/apixpress/www/cdn/public/js/article.js
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										24
									
								
								asupsetup/data/domain/apixpress/www/cdn/public/js/article.js
									
									
									
									
									
										Executable file
									
								
							| @@ -0,0 +1,24 @@ | ||||
| (function($) { | ||||
|    $.fn.articlesaffiche = function(contenu){ | ||||
|      $(this).html(Mustache.to_html($('#tpl_articlelist').html(),contenu)).promise().done(function(){ | ||||
|          $('figure.article-item').on ('click',function(e){ | ||||
|            e.preventDefault(); | ||||
|            var data = {}; | ||||
|            console.log($(this).find('button').attr('href').replace('.html','.json')); | ||||
|            $.getJSON($(this).find('button').attr('href').replace('.html','.json') , function( contenuarticle){ | ||||
|                      $('#articlecontent').html(Mustache.to_html($('#tpl_article').html(),contenuarticle)) | ||||
|                           .promise().done(function(){ | ||||
|                             $('#maincontent').css('display','none'); | ||||
|                             $('#articlecontent').css('display','block'); | ||||
|                     }); | ||||
|             }); | ||||
|         }); | ||||
|      }); | ||||
|  | ||||
|    }; | ||||
|  | ||||
|    $.fn.articlemaj = function(contenu){ | ||||
|  | ||||
|    }; | ||||
|  | ||||
| }(jQuery)); | ||||
							
								
								
									
										212
									
								
								asupsetup/data/domain/apixpress/www/cdn/public/js/auth.js
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										212
									
								
								asupsetup/data/domain/apixpress/www/cdn/public/js/auth.js
									
									
									
									
									
										Executable file
									
								
							| @@ -0,0 +1,212 @@ | ||||
| (function($) { | ||||
|   const ROOT_TAAPP_URL = 'http://taapp.ndda.fr:3010'; | ||||
|   const ROOT_URL = 'http://maildigit.ndda.fr' | ||||
|  | ||||
|    $.fn.initlogin = function(URLCENTRALE) { | ||||
|      function register(blocauth) { | ||||
|        blocauth.html($('#register').html()).promise().done(function(){ | ||||
|  | ||||
|          $('a.oubliemdp').on('click', function(e){e.preventDefault(); forget(blocauth)}); | ||||
|          $('a.login').on('click', function(e){e.preventDefault(); login(blocauth)}); | ||||
|          $('.register-button').on('click',function(e){ | ||||
|             e.preventDefault(); | ||||
|              var etat = ""; | ||||
|              var senddata = {'action':'register'}; | ||||
|              var reg = new RegExp('^[a-z0-9]+([_|\.|-]{1}[a-z0-9]+)*@[a-z0-9]+([_|\.|-]{1}[a-z0-9]+)*[\.]{1}[a-z]{2,6}$', 'i'); | ||||
|              if (! reg.test($('#reg_email').val()) ) { | ||||
|                 etat += $('#reg_email').data('msgko') +"<br>"; | ||||
|               }else{ | ||||
|                 senddata['email'] = $('#reg_email').val(); | ||||
|               }; | ||||
|              if ($('#reg_password').val() != $('#reg_password_confirm') && $('#reg_password').val().length < 5 ) { | ||||
|                etat+=$('#reg_password').data('msgko') + "<br>"; | ||||
|              }else{ | ||||
|                senddata['psw'] = $('#reg_password').val(); | ||||
|              }; | ||||
|              if ( $('#reg_prenom').val().length < 3 ) { | ||||
|                 etat += $('#reg_prenom').data('msgko') +"<br>"; | ||||
|               }else{ | ||||
|                 senddata['prenom'] = $('#reg_prenom').val(); | ||||
|               }; | ||||
|               if (  $('#reg_nom').val().length < 3 ) { | ||||
|                  etat += $('#reg_nom').data('msgko') +"<br>"; | ||||
|                }else{ | ||||
|                  senddata['nom'] = $('#reg_nom').val(); | ||||
|                }; | ||||
|              senddata['genre'] = $("input[name='reg_gender']:checked").attr('id'); | ||||
|              if (!($('#reg_agree').is(':checked'))) { | ||||
|                etat+=$('#reg_agree').data('msgko')+"<br>"; | ||||
|              }; | ||||
|  | ||||
|              if (etat != "") { | ||||
|                $('#register-form p.msgreg').html(etat); | ||||
|              }else{ | ||||
|                $.ajax({ url: "/log", type: "POST", data:senddata, cache: false, | ||||
|                      success: function(e) { | ||||
|                         e=JSON.parse(e); | ||||
|                         console.log(e); | ||||
|                         if (e.etat == "ok") { | ||||
|                           login(blocauth); | ||||
|                         }else{ | ||||
|                           console.log(e.etat); | ||||
|                         $('#register-form p.msgreg').html(e.etat); | ||||
|                         }; | ||||
|                      }, | ||||
|                      error: function(e) { | ||||
|                          console.log(e); | ||||
|                          $('#register-form p.msgreg').html($('#register-form').data('msgko')); | ||||
|                      }, | ||||
|                }); | ||||
|              }; | ||||
|          }); | ||||
|        }); | ||||
|      }; | ||||
|  | ||||
|      function directorySelector(blocauth) { | ||||
|        blocauth.html($('.choose-directory').html()).promise().done(function () { | ||||
|          $('.choose-directory__submit').on('click', function(e) { | ||||
|            const selectedDirectory = $('.directory-selector option:selected').val(); | ||||
|            $.ajax({ | ||||
|              url: `${ROOT_TAAPP_URL}/nas/need-data/${selectedDirectory}`, | ||||
|              type: "POST", | ||||
|              beforeSend: function(request) { | ||||
|                request.setRequestHeader('x-auth', localStorage.getItem('token')) | ||||
|              }, | ||||
|              data: { login: 'max' }, | ||||
|              cache: false, | ||||
|              success: function (data, textStatus, request) { | ||||
|                console.log('URL Node-File-Manager here!'); | ||||
|                console.log('data: ', data); | ||||
|                displayIframe(blocauth, data.url); | ||||
|              }, | ||||
|              error: function (response) { | ||||
|                console.log('err: ', response); | ||||
|              }, | ||||
|              always: function (response) { | ||||
|                console.log('Hello!') | ||||
|              } | ||||
|            }); | ||||
|          }); | ||||
|        }); | ||||
|      } | ||||
|  | ||||
|      function displayIframe(blocauth, url) { | ||||
|        blocauth.html(`<iframe height="600" width="800" src=${url}> </iframe>`).promise().done(function() { | ||||
|          console.log('displayIframe'); | ||||
|        }) | ||||
|      } | ||||
|  | ||||
|     function login(blocauth) { | ||||
|       blocauth.html($('#proclogin').html()).promise().done(function() { | ||||
|           $('a.oubliemdp').on('click', function(e) { | ||||
|             e.preventDefault(); | ||||
|             forget(blocauth); | ||||
|           }); | ||||
|           $('a.register').on('click', function(e) { | ||||
|             e.preventDefault(); | ||||
|             register(blocauth); | ||||
|           }); | ||||
|           $('button.login-button').on('click', function(e) { | ||||
|             e.preventDefault(); | ||||
|             const ROOT_URL = 'http://maildigit.ndda.fr' | ||||
|             const tribeid = $(this).attr('data-tribeid'); | ||||
|             const $form = $('#login-form'); | ||||
|             const inputs = $form.serializeArray(); | ||||
|             let loginData = {}; | ||||
|             loginData.tribeid = tribeid; | ||||
|  | ||||
|             inputs.forEach(input => { | ||||
|               if (input.value.trim().length > 0) { | ||||
|                 loginData[input.name] = input.value.trim(); | ||||
|               } | ||||
|             }); | ||||
|             // Si les champs sont bien remplis on envoie la requête | ||||
|             if (Object.keys(loginData).length === 3) { | ||||
|               $.ajax({ | ||||
|                 url: `${ROOT_URL}/login`, | ||||
|                 type: "POST", | ||||
|                 data: loginData, | ||||
|                 cache: false, | ||||
|                 success: function (data, textStatus, request) { | ||||
|                   const token = request.getResponseHeader('x-auth'); | ||||
|                   console.log('token: ', token); | ||||
|                   localStorage.setItem('token', token); | ||||
|                   directorySelector(blocauth); | ||||
|                 }, | ||||
|                 error: function (response) { | ||||
|                   console.log('err: ', response.responseJSON.error); | ||||
|                 } | ||||
|               }); | ||||
|             } | ||||
|           }); | ||||
|         }); | ||||
|     } | ||||
|  | ||||
|      function forget(blocauth){ | ||||
|        blocauth.html($('#forgotpw').html()).promise().done(function(){ | ||||
|          $('a.login').on('click', function(e){e.preventDefault(); login(blocauth)}); | ||||
|          $('a.register').on('click', function(e){e.preventDefault(); register(blocauth)}); | ||||
|  | ||||
|        }); | ||||
|      }; | ||||
|  | ||||
|      login($(this)); | ||||
|    }; | ||||
|  | ||||
|    $.fn.login = function(){ | ||||
|      var form = $(this); | ||||
|      var lastdatasend = lastdatasend || ""; | ||||
|      form.find('.btnsendform').on('click',function(){ | ||||
|         var senddata = {}; | ||||
|         var etat = ""; | ||||
|         var msgok = form.data('msgok'); | ||||
|         var msgko = form.data('msgko'); | ||||
|  | ||||
|         senddata.fichier = form.data('fichier'); | ||||
|  | ||||
|         form.find('input').each(function(i){ | ||||
|           senddata[$(this).data('champs')]=$(this).val(); | ||||
|           var reg = "{{"+$(this).data('champs')+"}}"; | ||||
|           msgok = msgok.replace(reg,$(this).val()); | ||||
|           msgko = msgko.replace(reg,$(this).val()); | ||||
|  | ||||
|           if ( $(this).data('check') == 'email') { | ||||
|             var reg = new RegExp('^[a-z0-9]+([_|\.|-]{1}[a-z0-9]+)*@[a-z0-9]+([_|\.|-]{1}[a-z0-9]+)*[\.]{1}[a-z]{2,6}$', 'i'); | ||||
|             if (! reg.test($(this).val()) ) { etat += $(this).data('msgerreur') +"<br>";}; | ||||
|           }; | ||||
|  | ||||
|           if ( $(this).data('check') == 'phone') { | ||||
|             var phone = $(this).val().replace(/[^0-9]/g, ''); | ||||
|             if (phone.length != 10) {etat += $(this).data('msgerreur') +"<br>";}; | ||||
|           }; | ||||
|  | ||||
|         }); | ||||
|         var diff = false; | ||||
|         if (lastdatasend == "") {diff=true;} | ||||
|         $.each(lastdatasend,function(k,v){ | ||||
|           if (k in senddata && v!= senddata[k] ) {diff = true;} | ||||
|         }); | ||||
|         if (!(diff)) { | ||||
|           etat = "Action déjà effectuée"; | ||||
|         } | ||||
|         if (etat != "") { | ||||
|             form.find("p.msgform").html(etat); | ||||
|         }else{ | ||||
|             $.ajax({ url: "http://maildigit.ndda.fr:3000/msg", type: "POST", data:senddata, cache: false, | ||||
|                   success: function(e) { | ||||
|                       //console.log(e); | ||||
|                       lastdatasend = senddata; | ||||
|                       console.log(form.data('msgok')); | ||||
|                       form.find("p.msgform").html(msgok); | ||||
|                   }, | ||||
|                   error: function(e) { | ||||
|                       console.log(e); | ||||
|                       form.find("p.msgform").html(msgko); | ||||
|                   }, | ||||
|             }); | ||||
|         }; | ||||
|      }); | ||||
|    }; | ||||
|    $.fn.functionname = function(contenu){ | ||||
|    }; | ||||
| }(jQuery)); | ||||
							
								
								
									
										9
									
								
								asupsetup/data/domain/apixpress/www/cdn/public/js/axios.min.js
									
									
									
									
										vendored
									
									
										Executable file
									
								
							
							
						
						
									
										9
									
								
								asupsetup/data/domain/apixpress/www/cdn/public/js/axios.min.js
									
									
									
									
										vendored
									
									
										Executable file
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
							
								
								
									
										185
									
								
								asupsetup/data/domain/apixpress/www/cdn/public/js/checkdata.js
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										185
									
								
								asupsetup/data/domain/apixpress/www/cdn/public/js/checkdata.js
									
									
									
									
									
										Executable file
									
								
							| @@ -0,0 +1,185 @@ | ||||
| /* | ||||
| This module have to be independant of any external package | ||||
| it is shared between back and front and is usefull | ||||
| to apply common check in front before sending it in back | ||||
| can be include in project with | ||||
|   <script src="https://apiback.maildigit.fr/js/Checkjson.js"></script> | ||||
| or with const Checkjson = require('../public/js/Checkjson.js') | ||||
|  | ||||
| */ | ||||
|  | ||||
| // --## | ||||
|  | ||||
| const Checkjson = {}; | ||||
| // each Checkjson.test. return true or false | ||||
| Checkjson.test = {}; | ||||
|  | ||||
| Checkjson.test.emailadress = ( ctx, email ) => { | ||||
| 	const regExp = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; | ||||
| 	return regExp.test( email ); | ||||
| }; | ||||
| /* | ||||
|  * @emaillist = "email1,email2, email3" | ||||
|  * it check if each eamil separate by , are correct | ||||
|  */ | ||||
| Checkjson.test.emailadresslist = ( ctx, emaillist ) => { | ||||
| 	//console.log(emaillist.split(',')) | ||||
| 	if( emaillist.length > 0 ) { | ||||
| 		const emails = emaillist.split( ',' ); | ||||
| 		for( var i in emails ) { | ||||
| 			//console.log(emails[i]) | ||||
| 			if( !Checkjson.test.emailadress( "", emails[ i ].trim() ) ) { | ||||
| 				return false | ||||
| 			} | ||||
| 		} | ||||
| 	}; | ||||
| 	return true; | ||||
| }; | ||||
|  | ||||
| Checkjson.test.password = ( ctx, pwd ) => { | ||||
| 	const regExp = new RegExp( | ||||
| 		/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[$@$!%*?&.])[A-Za-z\d$@$!%*?&.{}:|\s]{8,}/ | ||||
| 	); | ||||
| 	return regExp.test( pwd ); | ||||
| }; | ||||
| Checkjson.test.required = ( ctx, val ) => | ||||
| 	( val != null && val != 'undefined' && val.length > 0 ) || ( !!val && val.constructor === Array && val.length > 0 ) || ( !!val && val.constructor === Object && Object.keys( val ) | ||||
| 		.length > 0 ); | ||||
|  | ||||
| Checkjson.test.isNumber = ( ctx, n ) => typeof n === 'number'; | ||||
| Checkjson.test.isInt = ( ctx, n ) => n != '' && !isNaN( n ) && Math.round( n ) == n; | ||||
| Checkjson.test.isFloat = ( ctx, n ) => n != '' && !isNaN( n ) && Math.round( n ) != n; | ||||
| Checkjson.test.unique = ( ctx, val ) => { | ||||
| 	if( ctx.list[ ctx.currentfield ] ) { | ||||
| 		return !ctx.list[ ctx.currentfield ].includes( val ); | ||||
| 	} else { | ||||
| 		console.log( 'ERR no list for field:' + ctx.currentfield ); | ||||
| 		return false; | ||||
| 	} | ||||
| }; | ||||
| Checkjson.test.isDateDay = ( ctx, dateDay ) => true; | ||||
| /* Checkjson.test.filterInvalidInArray = (array, validate) => | ||||
|   array ? array.filter(el => !validate(el)) : true; | ||||
| // return true when every elements is valid | ||||
| */ | ||||
|  | ||||
| Checkjson.test.postalCode = ( ctx, postalCode ) => { | ||||
| 	if( postalCode.length == 0 ) return true; | ||||
| 	const regExp = new RegExp( /(^\d{5}$)|(^\d{5}-\d{4}$)/ ); | ||||
| 	return regExp.test( postalCode ); | ||||
| }; | ||||
| /** | ||||
|  * PHONE | ||||
|  */ | ||||
| Checkjson.test.phoneNumber = ( ctx, phoneNumber ) => { | ||||
| 	if( phoneNumber.length == 0 ) return true; | ||||
| 	phoneNumber = phoneNumber.trim() | ||||
| 		.replace( /[- .]/g, '' ) | ||||
| 	//french number | ||||
| 	const regExpfr = new RegExp( /^0[1-9][0-9]{9}$/ ); | ||||
| 	const regExpInternational = new RegExp( /^\+*(\d{3})*[0-9,\-]{8,}/ ); | ||||
| 	return regExpfr.test( phoneNumber ) || regExpInternational.test( phoneNumber ); | ||||
| }; | ||||
| /* | ||||
|  * @phonelist = "phone1,phone2,phone3" | ||||
|  * it check if each phone separate by , are correct | ||||
|  */ | ||||
| Checkjson.test.phoneNumberlist = ( ctx, phonelist ) => { | ||||
| 	//console.log(emaillist.split(',')) | ||||
| 	if( phonelist.length > 0 ) { | ||||
| 		const phones = phonelist.split( ',' ); | ||||
| 		for( var i in phones ) { | ||||
| 			//console.log(emails[i]) | ||||
| 			if( !Checkjson.test.phoneNumber( "", phones[ i ].trim() ) ) { | ||||
| 				return false | ||||
| 			} | ||||
| 		} | ||||
| 	}; | ||||
| 	return true; | ||||
| }; | ||||
|  | ||||
| // Checkjson.normalize take a correct data then reformat it to harmonise it | ||||
| Checkjson.normalize = {}; | ||||
| Checkjson.normalize.phoneNumber = ( ctx, phone ) => { | ||||
| 	phone = phone.trim() | ||||
| 		.replace( /[- .]/g, '' ); | ||||
| 	if( Checkjson.test.phoneNumber( '', phone ) && phone.length == 10 && phone[ 0 ] == "0" ) { | ||||
| 		phone = '+33 ' + phone.substring( 1 ); | ||||
| 	} | ||||
| 	return phone; | ||||
| } | ||||
| Checkjson.normalize.upperCase = ( ctx, txt ) => txt.toUpperCase(); | ||||
| Checkjson.normalize.lowerCase = ( ctx, txt ) => txt.toLowerCase(); | ||||
| // fixe 10 position et complete par des 0 devant | ||||
| Checkjson.normalize.zfill10 = ( ctx, num ) => { | ||||
| 	let s = num + ''; | ||||
| 	while( s.length < 10 ) s = '0' + s; | ||||
| 	return s; | ||||
| }; | ||||
| /*let tt = "+33 1   02.03 04 05"; | ||||
| console.log(Checkjson.test.phoneNumber('', tt)) | ||||
| console.log(Checkjson.normalize.phoneNumber('', tt)) | ||||
| */ | ||||
| Checkjson.evaluate = ( contexte, referential, data ) => { | ||||
| 	/* | ||||
| 	* contexte object {} with full info for evaluation | ||||
| 	* file referential path to get object to apply | ||||
| 	* data related to object | ||||
| 	- return {validefor =[keyword of error] if empty no error, | ||||
| 	          clean data eventually reformated | ||||
| 	           updateDatabase} | ||||
| 	 */ | ||||
| 	console.log( 'contexte', contexte ); | ||||
| 	console.log( 'referentiel', referential ); | ||||
| 	console.log( 'data', data ); | ||||
| 	const invalidefor = []; | ||||
| 	const objectdef = {}; | ||||
| 	const listfield = referential.map( ch => { | ||||
| 		objectdef[ ch.idfield ] = ch; | ||||
| 		return ch.idfield; | ||||
| 	} ); | ||||
|  | ||||
| 	Object.keys( data ) | ||||
| 		.forEach( field => { | ||||
| 			if( !listfield.includes( field ) ) { | ||||
| 				// some data can be inside an object with no control at all | ||||
| 				// they are used for process only | ||||
| 				// i leave it in case it will become a non sens | ||||
| 				// invalidefor.push('ERRFIELD unknown of referentials ' + field); | ||||
| 			} else { | ||||
| 				if( objectdef[ field ].check ) { | ||||
| 					// check data with rule list in check | ||||
| 					objectdef[ field ].Checkjson.forEach( ctrl => { | ||||
| 						console.log( 'ctrl', ctrl ); | ||||
| 						contexte.currentfield = field; | ||||
| 						if( !Checkjson.test[ ctrl ] ) { | ||||
| 							invalidefor.push( 'ERR check function does not exist :' + ctrl + '___' + field ) | ||||
| 						} else { | ||||
| 							if( !Checkjson.test[ ctrl ]( contexte, data[ field ] ) ) | ||||
| 								invalidefor.push( 'ERR' + ctrl + '___' + field ); | ||||
| 						} | ||||
| 					} ); | ||||
| 				} | ||||
|  | ||||
| 				if( objectdef[ field ].nouserupdate ) { | ||||
| 					// check if user can modify this information | ||||
| 					console.log( | ||||
| 						'evaluation :' + field + ' -- ' + objectdef[ field ].nouserupdate, | ||||
| 						eval( objectdef[ field ].nouserupdate ) | ||||
| 					); | ||||
| 					const evalright = eval( objectdef[ field ].nouserupdate ); | ||||
| 					objectdef[ field ].nouserupdate = evalright; | ||||
| 				} | ||||
| 			} | ||||
| 		} ); | ||||
| 	console.log( { | ||||
| 		invalidefor, | ||||
| 		data | ||||
| 	} ); | ||||
| 	return { | ||||
| 		invalidefor, | ||||
| 		data | ||||
| 	}; | ||||
| }; | ||||
|  | ||||
| if( typeof module !== 'undefined' ) module.exports = Checkjson; | ||||
							
								
								
									
										285
									
								
								asupsetup/data/domain/apixpress/www/cdn/public/js/editor.js
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										285
									
								
								asupsetup/data/domain/apixpress/www/cdn/public/js/editor.js
									
									
									
									
									
										Executable file
									
								
							| @@ -0,0 +1,285 @@ | ||||
| 'use strict'; | ||||
| var edit = edit || {}; | ||||
|  | ||||
| edit.article = function() { | ||||
|   // Add remove an article | ||||
|   $('section.filterlist .card-group .card').append(` | ||||
|     <p> | ||||
|       <button class='btn btn-primary deleteArticle' title="Attention supprime l'article"> | ||||
|          <i class="fas fa-trash"></i> | ||||
|       </button> | ||||
|       <button class='btn btn-primary hideArticle' title="Cache l'article sans le supprimer"> | ||||
|          <i class="fas fa-eye-slash"></i> | ||||
|       </button> | ||||
|       <button class='btn btn-primary editArticle' title="Editer l'article"> | ||||
|          <i class="fas fa-edit" ></i> | ||||
|       </button> | ||||
|       <button class='btn btn-primary cloneArticle' title="Clone un article et l'ajoute"> | ||||
|          <i class="fas fa-clone" ></i> | ||||
|       </button> | ||||
|     </p> | ||||
|     `); | ||||
|   // Add element data for each modal article | ||||
|   $('.dataarticle').each(function(i, ele) { | ||||
|     $(this).prepend(` | ||||
|       <p title="Liste des tag utilisés pour filtrer cette article"> | ||||
|         <b>cardtag:</b><span class='data-cardtag' contenteditable="true" >${$(this).attr('data-cardtag')}</span> | ||||
|       </p> | ||||
|       <p title="Titre de chaque carte"> | ||||
|         <b>cardtitle:</b><span class='data-cardtitle' contenteditable="true" >${$(this).attr('data-cardtitle')}</span> | ||||
|       </p> | ||||
|       <p title="Sous-titre de chaque carte"> | ||||
|         <b>cardtext:</b><span class='data-cardtext' contenteditable="true" >${$(this).attr('data-cardtext')}</span> | ||||
|       </p> | ||||
|       <p title="Texte en petit de charte carte"> | ||||
|         <b>cardsmalltext:</b><span class='data-cardsmalltext' contenteditable="true" >${$(this).attr('data-cardsmalltext')}</span> | ||||
|       </p> | ||||
|       `) | ||||
|   }) | ||||
|   $('.card').attr('data-toggle', 'none'); | ||||
|   $('button.deleteArticle').on('click', function(e) { | ||||
|     if(confirm("Attention, l'article va être définitivement supprimé, êtes-vous sur?")) { | ||||
|       $(this).closest('[data-uuid]').attr('data-update', 'delete'); | ||||
|       $(this).closest('[data-uuid]').hide(); | ||||
|     } | ||||
|   }) | ||||
|   $('button.hideArticle').on('click', function(e) { | ||||
|     if($(this).closest('[data-uuid]').attr('data-update') != 'hide') { | ||||
|       $(this).closest('[data-uuid]').attr('data-update', 'hide'); | ||||
|       $(this).closest('[data-uuid]').css('background-color', 'rgb(0,0,0,0.2)'); | ||||
|     } else { | ||||
|       $(this).closest('[data-uuid]').attr('data-update', ''); | ||||
|       $(this).closest('[data-uuid]').css('background-color', 'rgb(0,0,0,0)'); | ||||
|     } | ||||
|   }) | ||||
|   $('button.editArticle').on('click', function(e) { | ||||
|     $(this).closest('[data-uuid]').attr('data-update', 'update'); | ||||
|     $(this).closest('.card').attr('data-toggle', 'modal'); | ||||
|   }) | ||||
|   $('button.cloneArticle').on('click', function(e) { | ||||
|     //alert('todo from template ') | ||||
|     var origin = $(this).closest('[data-uuid]') | ||||
|     var originuuid = origin.attr('data-uuid') | ||||
|     console.log(originuuid) | ||||
|   }) | ||||
|  | ||||
| } | ||||
|  | ||||
| edit.image = function() { | ||||
|   // Add button to upload file below each image | ||||
|   if($('input.imageLoader').length == 0) { | ||||
|     $('img').each(function(i) { | ||||
|       //console.log($(this).attr('src')); | ||||
|       $(this).attr('src', $(this).attr('src')); | ||||
|       $(this).attr('H', $(this).css('height')); | ||||
|       $(this).attr('L', $(this).attr('width')); | ||||
|       const alt = $(this).attr('alt') | ||||
|       $(this) | ||||
|         .closest("[contenteditable='true']") | ||||
|         .append(`<p class="editortag">alt=<span class="alt" contenteditable='true'>${alt}</span><br><input type='file' class='imageLoader'/>`); | ||||
|     }); | ||||
|   }; | ||||
|   // Replace old image with the new uploaded image in base64 | ||||
|   $('body').on('change', '.imageLoader', function(e) { | ||||
|     var imgEl = $(this) | ||||
|       .closest("[contenteditable='true']") | ||||
|       .find('img'); | ||||
|     // Get img tree like /images/equipe or /images/ | ||||
|     var tree = imgEl[0].src.split(window.location.origin)[1]; | ||||
|     // This is needed because if we change two times an image at the same place | ||||
|     // first time we replaced it the src will be in base64 | ||||
|     // then we need to find the computed src which is stored in dataset.tree | ||||
|     if(!tree) tree = imgEl[0].dataset.tree; | ||||
|     tree = tree.substr(0, tree.lastIndexOf('/') + 1); | ||||
|     if($(this)[0].files.length === 1) { | ||||
|       var fileName = $(this)[0].files[0].name; | ||||
|       fileName = fileName.normalize('NFD').replace(/[\u0300-\u036f]/g, ''); // remove accents | ||||
|       fileName = fileName.replace(/\s+/g, '_'); // remove spaces | ||||
|       var ext = fileName.substring(fileName.lastIndexOf('.') + 1).toLowerCase(); | ||||
|       // Add fileName and tree in data attributes | ||||
|       imgEl[0].dataset.fileName = fileName; | ||||
|       imgEl[0].dataset.tree = tree + fileName; | ||||
|       console.log(imgEl[0].dataset.tree); | ||||
|       // console.log(imgEl); | ||||
|  | ||||
|       if(ext === 'gif' || ext === 'png' || ext === 'jpeg' || ext === 'jpg') { | ||||
|         var reader = new FileReader(); | ||||
|         reader.onload = function(e) { | ||||
|           imgEl.attr('src', e.target.result); | ||||
|         }; | ||||
|         reader.readAsDataURL($(this)[0].files[0]); | ||||
|       } | ||||
|     } | ||||
|   }); | ||||
| } | ||||
|  | ||||
| edit.init = function() { | ||||
|   var DOWNLOAD_NAME = 'index.maildigit'; | ||||
|   // Apply contenteditable attributes on text elements | ||||
|   $('p,h1,h2,h3,h4,h5,h6,a,li,ul').attr('contenteditable', 'true'); | ||||
|   edit.article(); | ||||
|   edit.image(); | ||||
|   // Add Save/Load menu | ||||
|   $('body').prepend( | ||||
|     `<div class='editor' style='position:fixed; bottom: 5px; z-index: 1000000;'> | ||||
|       <button class='btn btn-primary editersauve' title="sauvegarde les modifications"> | ||||
|         <i class="fas fa-save"></i> | ||||
|       </button> | ||||
|       <button class='btn btn-primary editercharge' title="charge une sauvegarde"> | ||||
|         <i class="fas fa-file-import"></i> | ||||
|       </button> | ||||
|       <input  style='display:none;' type='file' class='chargehisto'/> | ||||
|       . | ||||
|       <button class='btn btn-primary addheader2' title='Ajoute un entete'> | ||||
|         <i class="fas fa-heading">2</i> | ||||
|       </button> | ||||
|       <button class='btn btn-primary addparagraphe' title='Ajoute un paragraphe à la suite'> | ||||
|         <i class="fas fa-paragraph"></i> | ||||
|       </button> | ||||
|       <button class='btn btn-primary addlist' title='Ajoute une liste à la suite'> | ||||
|         <i class="fas fa-list"></i> | ||||
|       </button> | ||||
|       <button class='btn btn-primary addimage' title='Ajoute une image'> | ||||
|         <i class="fas fa-image"></i> | ||||
|       </button> | ||||
|       <button class='btn btn-primary addhyperlien' title='Ajoute un lien hypertexte'> | ||||
|         <i class="fas fa-link"></i> | ||||
|       </button> | ||||
|       <button class='btn btn-primary eraseselection' title='Supprime la selection en cours'> | ||||
|         <i class="fas fa-eraser"></i> | ||||
|       </button> | ||||
|       . | ||||
|       <button class='btn btn-primary aligncenter' title='Centre le texte du curseur'> | ||||
|         <i class="fas fa-align-center"></i> | ||||
|       </button> | ||||
|       <button class='btn btn-primary alignjustify' title='Justifie le texte du curseur'> | ||||
|         <i class="fas fa-align-justify"></i> | ||||
|       </button> | ||||
|       <button class='btn btn-primary alignright' title='cale à droite'> | ||||
|         <i class="fas fa-align-right"></i> | ||||
|       </button> | ||||
|       <button class='btn btn-primary alignleft' title='cale à gauche'> | ||||
|         <i class="fas fa-align-left"></i> | ||||
|       </button> | ||||
|       . | ||||
|       <button class='btn btn-dark addBold' title='Mise en gras de la selection'> | ||||
|         <i class="fas fa-bold"></i> | ||||
|       </button> | ||||
|       <button class='btn btn-primary color' data-color='text-primary' title='Change la couleur de texte'> | ||||
|         <i class="fas fa-palette"></i> | ||||
|       </button> | ||||
|       <button class='btn btn-secondary color' data-color='text-secondary' title='change la couleur de texte'> | ||||
|         <i class="fas fa-palette"></i> | ||||
|       </button> | ||||
|       <button class='btn btn-primary removeformat' title='Supprime le format de la selection'> | ||||
|         <i class="fas icon-action-undo"></i> | ||||
|       </button> | ||||
|     </div>` | ||||
|   ); | ||||
|   $('body').on('focus', 'p,h1,h2,h3,h4,h5,h6,a,li,ul', function(e) { | ||||
|     $('.selectionencours').removeClass('selectionencours') | ||||
|     $(this).addClass('selectionencours') | ||||
|   }); | ||||
|   $('button.addheader2').on('click', function() { | ||||
|     $('<h2 contenteditable="true">x</h2>').insertAfter('.selectionencours') | ||||
|     $('.selectionencours').removeClass('selectionencours') | ||||
|   }) | ||||
|   $('button.addparagraphe').on('click', function() { | ||||
|     $('<p contenteditable="true">x</p>').insertAfter('.selectionencours') | ||||
|     $('.selectionencours').removeClass('selectionencours') | ||||
|   }) | ||||
|   $('button.addlist').on('click', function() { | ||||
|     $('<ul contenteditable="true"><li contenteditable="true">x</li></ul>').insertAfter('.selectionencours') | ||||
|     $('.selectionencours').removeClass('selectionencours') | ||||
|   }) | ||||
|   $('button.addimage').on('click', function() { | ||||
|     $(` | ||||
|       <p> | ||||
|         <img src="" alt="" class="img-fluid"><br> | ||||
|         alt=<span class="alt" contenteditable='true'></span><br> | ||||
|         <input type="file" class="imageLoader"/> | ||||
|       </p> | ||||
|       `).insertAfter('.selectionencours') | ||||
|     $('.selectionencours').removeClass('selectionencours') | ||||
|   }) | ||||
|  | ||||
|   $('button.eraseselection').on('click', function() { | ||||
|     $('.selectionencours').remove() | ||||
|   }) | ||||
|   $('button.aligncenter').on('click', function() { | ||||
|     $('.selectionencours').removeClass('text-justify').removeClass('text-right').removeClass('text-left'); | ||||
|     $('.selectionencours').addClass('text-center') | ||||
|   }) | ||||
|   $('button.alignjustify').on('click', function() { | ||||
|     $('.selectionencours').removeClass('text-center').removeClass('text-right').removeClass('text-left'); | ||||
|     $('.selectionencours').addClass('text-justify') | ||||
|   }) | ||||
|   $('button.alignright').on('click', function() { | ||||
|     $('.selectionencours').removeClass('text-justify').removeClass('text-center').removeClass('text-left'); | ||||
|     $('.selectionencours').addClass('text-right') | ||||
|   }) | ||||
|   $('button.alignleft').on('click', function() { | ||||
|     $('.selectionencours').removeClass('text-justify').removeClass('text-right').removeClass('text-center'); | ||||
|     $('.selectionencours').addClass('text-left') | ||||
|   }) | ||||
|   $('button.removeformat').on('click', function() { | ||||
|     const txtencours = $('.selectionencours').html().replace(/<[^>]*>/g, '') | ||||
|     $('.selectionencours').html(txtencours); | ||||
|   }) | ||||
|   $('button.addBold').on('click', function() { | ||||
|     const sel = window.getSelection().toString(); | ||||
|     const txtencours = $('.selectionencours').html().replace(sel, `<b>${sel}</b>`) | ||||
|     $('.selectionencours').html(txtencours); | ||||
|   }); | ||||
|   $('button.color').on('click', function(e) { | ||||
|     const colo = $(this).attr('data-color') | ||||
|     const sel = window.getSelection().toString(); | ||||
|     const txtencours = $('.selectionencours').html().replace(sel, `<span class='${colo}'>${sel}</span>`) | ||||
|     $('.selectionencours').html(txtencours); | ||||
|   }); | ||||
|  | ||||
|   $('button.editercharge').on('click', function() { | ||||
|     $(this) | ||||
|       .closest('div') | ||||
|       .find('.chargehisto') | ||||
|       .trigger('click'); | ||||
|   }); | ||||
|   $('.chargehisto').on('change', function(e) { | ||||
|     if($(this)[0].files !== undefined) { | ||||
|       //charge un dom avec les info et recupere tous les editables et les changes dans le dom d'origine pour mettre à jour | ||||
|       // a developper en prod recupere fichier | ||||
|       var ext = $(this)[0] | ||||
|         .files[0]['name'].substring( | ||||
|           $(this)[0].files[0]['name'].lastIndexOf('.') + 1 | ||||
|         ) | ||||
|         .toLowerCase(); | ||||
|       if($(this)[0].files && $(this)[0].files[0] && ext == 'maildigit') | ||||
|         var reader = new FileReader(); | ||||
|       reader.onload = function(e) { | ||||
|         $('body').html(e.target.result); | ||||
|       }; | ||||
|       reader.readAsText($(this)[0].files[0]); | ||||
|     } | ||||
|   }); | ||||
|  | ||||
|   $('button.editersauve').on('click', function() { | ||||
|     //nettoie editeur | ||||
|     //$('p,h1,h2,h3,h4,a').removeAttr('contenteditable'); | ||||
|     //$('button.editersauve, p.editinfo').remove(); | ||||
|     //recupere body | ||||
|     var a = window.document.createElement('a'); | ||||
|     a.href = window.URL.createObjectURL( | ||||
|       new Blob([$('body').html()], { | ||||
|         type: 'text/csv;charset=utf-8;' | ||||
|       }) | ||||
|     ); | ||||
|     a.download = DOWNLOAD_NAME; | ||||
|     document.body.appendChild(a); | ||||
|     a.click(); | ||||
|     document.body.removeChild(a); | ||||
|   }); | ||||
| }; | ||||
|  | ||||
| $(document).ready(function() { | ||||
|   if(window.location.href.indexOf('#editer_') > -1) edit.init(); | ||||
| }); | ||||
							
								
								
									
										104
									
								
								asupsetup/data/domain/apixpress/www/cdn/public/js/editorsave.js
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										104
									
								
								asupsetup/data/domain/apixpress/www/cdn/public/js/editorsave.js
									
									
									
									
									
										Executable file
									
								
							| @@ -0,0 +1,104 @@ | ||||
| 'use strict'; | ||||
| var edit = edit || {}; | ||||
|  | ||||
| edit.init = function() { | ||||
|   var DOWNLOAD_NAME = 'index.maildigit'; | ||||
|   // Apply contenteditable attributes on text elements | ||||
|   $('p,h1,h2,h3,h4,h5,h6,a,li,ul').attr('contenteditable', 'true'); | ||||
|  | ||||
|   // Add Save/Load menu | ||||
|   $('body').prepend( | ||||
|     "<div class='editor' style='position:fixed; top: 250px; z-index: 10000;'><button class='btn btn-default editersauve'>Sauvegarder les modifications</button> \ | ||||
|                       <!--<button class='btn btn-default editercharge'>Charger des modifications</button>--> \ | ||||
|                       <input  style='display:none;' type='file' class='chargehisto'/></div>" | ||||
|   ); | ||||
|  | ||||
|   // Add button to upload file below each image | ||||
|   $('img').each(function(i) { | ||||
|     //console.log($(this).attr('src')); | ||||
|     $(this).attr('src', $(this).attr('src')); | ||||
|     $(this).attr('H', $(this).css('height')); | ||||
|     $(this).attr('L', $(this).attr('width')); | ||||
|     $(this) | ||||
|       .closest('div') | ||||
|       .append("<input type='file' class='imageLoader'/>"); | ||||
|   }); | ||||
|  | ||||
|   // Replace old image with the new uploaded image in base64 | ||||
|   $('.imageLoader').on('change', function(e) { | ||||
|     var imgEl = $(this) | ||||
|       .closest('div') | ||||
|       .find('img'); | ||||
|     // Get img tree like /images/equipe or /images/ | ||||
|     var tree = imgEl[0].src.split(window.location.origin)[1]; | ||||
|     // This is needed because if we change two times an image at the same place | ||||
|     // first time we replaced it the src will be in base64 | ||||
|     // then we need to find the computed src which is stored in dataset.tree | ||||
|     if (!tree) tree = imgEl[0].dataset.tree; | ||||
|     tree = tree.substr(0, tree.lastIndexOf('/') + 1); | ||||
|     if ($(this)[0].files.length === 1) { | ||||
|       var fileName = $(this)[0].files[0].name; | ||||
|       fileName = fileName.normalize('NFD').replace(/[\u0300-\u036f]/g, ''); // remove accents | ||||
|       fileName = fileName.replace(/\s+/g, '_'); // remove spaces | ||||
|       var ext = fileName.substring(fileName.lastIndexOf('.') + 1).toLowerCase(); | ||||
|       // Add fileName and tree in data attributes | ||||
|       imgEl[0].dataset.fileName = fileName; | ||||
|       imgEl[0].dataset.tree = tree + fileName; | ||||
|       console.log(imgEl[0].dataset.tree); | ||||
|       // console.log(imgEl); | ||||
|  | ||||
|       if (ext === 'gif' || ext === 'png' || ext === 'jpeg' || ext === 'jpg') { | ||||
|         var reader = new FileReader(); | ||||
|         reader.onload = function(e) { | ||||
|           imgEl.attr('src', e.target.result); | ||||
|         }; | ||||
|         reader.readAsDataURL($(this)[0].files[0]); | ||||
|       } | ||||
|     } | ||||
|   }); | ||||
|  | ||||
|   $('button.editercharge').on('click', function() { | ||||
|     $(this) | ||||
|       .closest('div') | ||||
|       .find('.chargehisto') | ||||
|       .trigger('click'); | ||||
|   }); | ||||
|   $('.chargehisto').on('change', function(e) { | ||||
|     if ($(this)[0].files !== undefined) { | ||||
|       //charge un dom avec les info et recupere tous les editables et les changes dans le dom d'origine pour mettre à jour | ||||
|       // a developper en prod recupere fichier | ||||
|       var ext = $(this)[0] | ||||
|         .files[0]['name'].substring( | ||||
|           $(this)[0].files[0]['name'].lastIndexOf('.') + 1 | ||||
|         ) | ||||
|         .toLowerCase(); | ||||
|       if ($(this)[0].files && $(this)[0].files[0] && ext == 'maildigit') | ||||
|         var reader = new FileReader(); | ||||
|       reader.onload = function(e) { | ||||
|         $('body').html(e.target.result); | ||||
|       }; | ||||
|       reader.readAsText($(this)[0].files[0]); | ||||
|     } | ||||
|   }); | ||||
|  | ||||
|   $('button.editersauve').on('click', function() { | ||||
|     //nettoie editeur | ||||
|     //$('p,h1,h2,h3,h4,a').removeAttr('contenteditable'); | ||||
|     //$('button.editersauve, p.editinfo').remove(); | ||||
|     //recupere body | ||||
|     var a = window.document.createElement('a'); | ||||
|     a.href = window.URL.createObjectURL( | ||||
|       new Blob([$('body').html()], { | ||||
|         type: 'text/csv;charset=utf-8;' | ||||
|       }) | ||||
|     ); | ||||
|     a.download = DOWNLOAD_NAME; | ||||
|     document.body.appendChild(a); | ||||
|     a.click(); | ||||
|     document.body.removeChild(a); | ||||
|   }); | ||||
| }; | ||||
|  | ||||
| $(document).ready(function() { | ||||
|   if (window.location.href.indexOf('#editer_') > -1) edit.init(); | ||||
| }); | ||||
							
								
								
									
										305
									
								
								asupsetup/data/domain/apixpress/www/cdn/public/js/formsave.js
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										305
									
								
								asupsetup/data/domain/apixpress/www/cdn/public/js/formsave.js
									
									
									
									
									
										Executable file
									
								
							| @@ -0,0 +1,305 @@ | ||||
| /* | ||||
| !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||||
| En cas de mofification des options => mettre à jour la doc du wiki gitlab | ||||
| !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||||
| */ | ||||
| const form = {}; | ||||
| /* var ajaxget = function(url) { | ||||
|   $.ajax({ | ||||
|     url: `https://api.maildigit.fr/template/${url}.mustache`, | ||||
|     datatype: "jsonp", | ||||
|     success: function(tplq) { | ||||
|       console.log(tplq); | ||||
|       console.log(quest); | ||||
|       return Mustache.render(tplq, quest); | ||||
|     } | ||||
|   }); | ||||
| };*/ | ||||
| document.addEventListener('DOMContentLoaded', () => { | ||||
|   form.create(); | ||||
| }); | ||||
| /* | ||||
|   Cette partie sera généré dans les sections et il ne restera | ||||
|   que $('.formmanager form').gestionform() | ||||
|  | ||||
|   */ | ||||
| //  $(".formmanager").each(function(i) { | ||||
| form.create = () => { | ||||
|   // alert("pass"); | ||||
|   document.querySelectorAll('div.formmanager').forEach(form => { | ||||
|     // let bloc = $(this).attr("id"); | ||||
|     const bloc = form.getAttribute('id'); | ||||
|     axios.get(`./${bloc}.json`).then(async formd => { | ||||
|       console.log('formd', formd); | ||||
|       const formdef = formd.data; | ||||
|       // Liste les template | ||||
|       let tplname = [formdef.info.tpl]; | ||||
|       formdef.quest.forEach(quest => { | ||||
|         quest.idhtml = formdef.id; | ||||
|         tplname.indexOf(quest.tpl) == -1 ? | ||||
|           tplname.push(quest.tpl) : | ||||
|           (tplname = tplname); | ||||
|       }); | ||||
|       const tplhtml = await Promise.all( | ||||
|         tplname.map(t => | ||||
|           axios.get(`${pwa.urlbacknoauth}/template/${t}.mustache`) | ||||
|         ) | ||||
|       ); | ||||
|       const template = {}; | ||||
|       tplname.forEach((t, i) => { | ||||
|         template[t] = tplhtml[i].data; | ||||
|       }); | ||||
|       console.log('template', template); | ||||
|       // Construire le form | ||||
|       formdef.content = formdef.quest | ||||
|         .map(quest => Mustache.render(template[quest.tpl], quest)) | ||||
|         .join(' '); | ||||
|       console.log('formdef', formdef); | ||||
|       form.innerHTML = Mustache.render(template[formdef.info.tpl], formdef); | ||||
|     }); | ||||
|   }); | ||||
| }; | ||||
| /* | ||||
|       //https://api.maildigit.fr/template/ | ||||
|       $.get(data.info.tpl, function(tpl) { | ||||
|         let questhtml = $.map(data.quest, function(quest, q) { | ||||
|           console.log(q); | ||||
|           console.log(quest); | ||||
|           quest.idhtml = data.info.idhtml; | ||||
|           $.ajax({ | ||||
|             url: data.quest[q].tpl, | ||||
|             datatype: "jsonp", | ||||
|             async: false, | ||||
|             success: function(tplq) { | ||||
|               console.log(tplq); | ||||
|               console.log(quest); | ||||
|               return Mustache.render(tplq, quest); | ||||
|             } | ||||
|           }); | ||||
|         }); | ||||
|         console.log(questhtml); | ||||
|         data.content = questhtml.join(" "); | ||||
|         console.log(data); | ||||
|         let fullform = Mustache.to_html(tpl, data); | ||||
|         $(data.info.idhtml).html(fullform); | ||||
|         $(".formmanager form").gestionform(); | ||||
|       }); | ||||
|     }); | ||||
|   }); | ||||
| });*/ | ||||
|  | ||||
| form.manage = function() { | ||||
|   const form = $(this); | ||||
|   var lastdatasend = lastdatasend || ''; | ||||
|   form.find('input').keyup(function(e) { | ||||
|     if (e.which == 13) { | ||||
|       form.find('.btnSendForm').click(); | ||||
|     } | ||||
|   }); | ||||
|   form.find('select').on('click', function() { | ||||
|     const chph = $(this).data('hiddenchamps'); | ||||
|     const valh = $(this) | ||||
|       .find('option:selected') | ||||
|       .text(); | ||||
|     form.find('input[data-champs=\'' + chph + '\']').val(valh); | ||||
|   }); | ||||
|   form.find('.type-choix button').on('click', function() { | ||||
|     const blocchoix = $(this).closest('.type-choix'); | ||||
|     blocchoix.find('button').removeClass('active'); | ||||
|     $(this).addClass('active'); | ||||
|     form | ||||
|       .find('input[data-champs=\'' + blocchoix.data('champs') + '\']') | ||||
|       .val($(this).data('val')); | ||||
|   }); | ||||
|   form.find('.type-multichoix button').on('click', function(e) { | ||||
|     e.preventDefault(); | ||||
|     const reponsemultiple = []; | ||||
|     const blocmultichoix = $(this).closest('.type-multichoix'); | ||||
|     const champsdest = blocmultichoix.attr('data-champs'); | ||||
|     console.log(champsdest); | ||||
|     const nbmaxchoix = parseInt(blocmultichoix.attr('data-nbmaxchoix')); | ||||
|     $(this).toggleClass('active'); | ||||
|     if ($('.type-multichoix button.active').length > nbmaxchoix) { | ||||
|       alert('Choisissez au maximum ' + nbmaxchoix + ' choix!'); | ||||
|       $(this).toggleClass('active'); | ||||
|     } else { | ||||
|       blocmultichoix.find('button.active').each(function(i) { | ||||
|         reponsemultiple.push($(this).attr('data-choix')); | ||||
|       }); | ||||
|       blocmultichoix | ||||
|         .find('input[data-champs=\'' + champsdest + '\']') | ||||
|         .val(JSON.stringify(reponsemultiple)); | ||||
|     } | ||||
|   }); | ||||
|   form.find('.btnSendForm').on('click', function(e) { | ||||
|     e.preventDefault(); | ||||
|     const formencours = $(this).closest('form'); | ||||
|     let r = localStorage.getItem('r'); | ||||
|     if (r == undefined) { | ||||
|       r = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) { | ||||
|         let r = (Math.random() * 16) | 0, | ||||
|           v = c == 'x' ? r : (r & 0x3) | 0x8; | ||||
|         return v.toString(16); | ||||
|       }); | ||||
|       localStorage.setItem('r', r); | ||||
|     } | ||||
|     const senddata = { | ||||
|       r: r | ||||
|     }; | ||||
|     let etat = ''; | ||||
|     let msgok = formencours.data('msgok'); | ||||
|     let msgko = formencours.data('msgko'); | ||||
|     formencours.find('textarea').each(function() { | ||||
|       senddata[$(this).data('champs')] = $(this).val(); | ||||
|       if ($(this).val() == '' && $(this).data('check') == 'notnull') { | ||||
|         etat += $(this).data('msgerreur') + '<br>'; | ||||
|       } | ||||
|     }); | ||||
|     formencours.find('.blochtml').each(function() { | ||||
|       senddata[$(this).data('champs')] = $(this).html(); | ||||
|     }); | ||||
|     formencours.find('input').each(function(i) { | ||||
|       senddata[$(this).data('champs')] = $(this).val(); | ||||
|       var reg = '{{' + $(this).data('champs') + '}}'; | ||||
|       msgok = msgok.replace(reg, $(this).val()); | ||||
|       msgko = msgko.replace(reg, $(this).val()); | ||||
|  | ||||
|       if ($(this).data('check') == 'email') { | ||||
|         /* | ||||
|            var reg = new RegExp( | ||||
|             '^[a-z0-9]+([_|.|-]{1}[a-z0-9]+)*@[a-z0-9]+([_|.|-]{1}[a-z0-9]+)*[.]{1}[a-z]{2,6}$', | ||||
|             'i' | ||||
|           ); | ||||
|           var reg = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/; | ||||
|           */ | ||||
|         var reg = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; | ||||
|  | ||||
|         // console.log($(this).val()); | ||||
|         // console.log(reg.test($(this).val()) ); | ||||
|         if (!reg.test($(this).val())) { | ||||
|           if (!$(this).data('msgerreur')) { | ||||
|             etat += 'invalid email'; | ||||
|           } else { | ||||
|             etat += $(this).data('msgerreur') + '<br>'; | ||||
|           } | ||||
|         } | ||||
|       } | ||||
|       if ($(this).data('check') == 'phone') { | ||||
|         const phone = $(this) | ||||
|           .val() | ||||
|           .replace('+33', '0') | ||||
|           .replace(/[^0-9]/g, ''); | ||||
|         if (phone.length != 10) { | ||||
|           if (!$(this).data('msgerreur')) { | ||||
|             etat += 'invalid phone'; | ||||
|           } else { | ||||
|             etat += $(this).data('msgerreur') + '<br>'; | ||||
|           } | ||||
|         } | ||||
|       } | ||||
|       if ($(this).data('check') == 'notnull') { | ||||
|         if ($(this).val() == '') { | ||||
|           if (!$(this).data('msgerreur')) { | ||||
|             etat += 'empty field'; | ||||
|           } else { | ||||
|             etat += $(this).data('msgerreur') + '<br>'; | ||||
|           } | ||||
|         } | ||||
|       } | ||||
|       if ($(this).data('check') == 'valpositif') { | ||||
|         if (parseInt($(this).val()) < 0) { | ||||
|           if (!$(this).data('msgerreur')) { | ||||
|             etat += 'invalid value have to be positive'; | ||||
|           } else { | ||||
|             etat += 'valpos ' + $(this).data('msgerreur') + '<br>'; | ||||
|           } | ||||
|         } | ||||
|       } | ||||
|       if ($(this).data('check') == 'codepostal') { | ||||
|         if ($(this).val().length != 5) { | ||||
|           if (!$(this).data('msgerreur')) { | ||||
|             etat += 'invalid zipcode'; | ||||
|           } else { | ||||
|             etat += 'cp' + $(this).data('msgerreur') + '<br>'; | ||||
|           } | ||||
|         } | ||||
|       } | ||||
|       if ($(this).data('check') == 'departement') { | ||||
|         let dep = 0; | ||||
|         if ($.isNumeric($(this).val())) { | ||||
|           dep = parseInt($(this).val()); | ||||
|         } | ||||
|         if (!(dep > 0 && dep < 96)) { | ||||
|           if (!$(this).data('msgerreur')) { | ||||
|             etat += 'invalid french departement'; | ||||
|           } else { | ||||
|             etat += 'dep ' + $(this).data('msgerreur') + '<br>'; | ||||
|           } | ||||
|         } | ||||
|       } | ||||
|     }); | ||||
|     console.log(JSON.stringify(senddata)); | ||||
|     let diff = false; | ||||
|     if (lastdatasend == '') { | ||||
|       diff = true; | ||||
|     } | ||||
|     $.each(lastdatasend, function(k, v) { | ||||
|       if (k in senddata && v != senddata[k]) { | ||||
|         diff = true; | ||||
|       } | ||||
|     }); | ||||
|     if (!diff) { | ||||
|       etat = | ||||
|         'Action déjà effectuée, si vous recliquez, vous allez renvoyer la même demande'; | ||||
|       lastdatasend = ''; | ||||
|     } | ||||
|     console.log(etat); | ||||
|     if (etat != '') { | ||||
|       formencours.find('p.msgform').html(etat); | ||||
|     } else { | ||||
|       console.log( | ||||
|         'https://api.maildigit.fr' + formencours.data('formmaildigit') | ||||
|       ); | ||||
|       console.log( | ||||
|         formencours.data('tribeid') + | ||||
|         '_' + | ||||
|         $('html').attr('lang') + | ||||
|         '_' + | ||||
|         formencours.data('auth') + | ||||
|         '_' + | ||||
|         formencours.data('uuid') | ||||
|       ); | ||||
|       $.ajax({ | ||||
|         url: pwa.urlbacknoauth + formencours.data('formmaildigit'), | ||||
|         type: 'POST', | ||||
|         beforeSend: function(request) { | ||||
|           request.setRequestHeader('x-Client-id', formencours.data('tribeid')); | ||||
|           request.setRequestHeader('x-language', $('html').attr('lang')); | ||||
|           request.setRequestHeader('x-auth', formencours.data('auth')); | ||||
|           request.setRequestHeader('x-uuid', formencours.data('uuid')); | ||||
|         }, | ||||
|         data: senddata, | ||||
|         cache: false, | ||||
|         success: function(res) { | ||||
|           // console.log(e); | ||||
|           var app = app || {}; | ||||
|           lastdatasend = senddata; | ||||
|           console.log(formencours.data('msgok')); | ||||
|           console.log(res); | ||||
|           if (res.idpanier) { | ||||
|             $('button.clickvalidecommande').data('idpanier', res.idpanier); | ||||
|             console.log('trig clickvalidecommande via form'); | ||||
|             $('button.clickvalidecommande').trigger('click'); | ||||
|           } | ||||
|           formencours.find('p.msgform').html(msgok); | ||||
|           // var chargeext = app.custom(senddata) || 'Pas de custom à executer'; | ||||
|         }, | ||||
|         error: function(e) { | ||||
|           console.log(e); | ||||
|           // formencours.data(state).val('error'); | ||||
|           formencours.find('p.msgform').html(msgko); | ||||
|         } | ||||
|       }); | ||||
|     } | ||||
|   }); | ||||
| }; | ||||
							
								
								
									
										291
									
								
								asupsetup/data/domain/apixpress/www/cdn/public/js/formvieux.js
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										291
									
								
								asupsetup/data/domain/apixpress/www/cdn/public/js/formvieux.js
									
									
									
									
									
										Executable file
									
								
							| @@ -0,0 +1,291 @@ | ||||
| /* | ||||
| !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||||
| En cas de mofification des options => mettre à jour la doc du wiki gitlab | ||||
| !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||||
| */ | ||||
| var ajaxget = function(url) { | ||||
|   $.ajax({ | ||||
|     url: `https://api.maildigit.fr/template/${url}.mustache`, | ||||
|     datatype: "jsonp", | ||||
|     success: function(tplq) { | ||||
|       console.log(tplq); | ||||
|       console.log(quest); | ||||
|       return Mustache.render(tplq, quest); | ||||
|     } | ||||
|   }); | ||||
| }; | ||||
| $(document).ready(function() { | ||||
|   /* | ||||
|   Cette partie sera généré dans les sections et il ne restera | ||||
|   que $('.formmanager form').gestionform() | ||||
|  | ||||
|   */ | ||||
|   //  $(".formmanager").each(function(i) { | ||||
|   document.querySelectorAll("div.formmanager").forEach(form => { | ||||
|     //let bloc = $(this).attr("id"); | ||||
|     let bloc = form.getAttribute("id"); | ||||
|     axios.get(`./${bloc}.json`).then(function(rep) { | ||||
|       // recup les templatemp | ||||
|       console.log("rep     ddddd", rep); | ||||
|       let tpl = [rep.data.info.tpl]; | ||||
|       $.each(rep.data.quest, function(q, quest) { | ||||
|         console.log(quest); | ||||
|         if (tpl.indexOf(quest.tpl) == -1) { | ||||
|           tpl.push(quest.tpl); | ||||
|         } | ||||
|         console.log("template", tpl); | ||||
|       }); | ||||
|     }); | ||||
|   }); | ||||
| }); | ||||
|   /* | ||||
|       //https://api.maildigit.fr/template/ | ||||
|       $.get(data.info.tpl, function(tpl) { | ||||
|         let questhtml = $.map(data.quest, function(quest, q) { | ||||
|           console.log(q); | ||||
|           console.log(quest); | ||||
|           quest.idhtml = data.info.idhtml; | ||||
|           $.ajax({ | ||||
|             url: data.quest[q].tpl, | ||||
|             datatype: "jsonp", | ||||
|             async: false, | ||||
|             success: function(tplq) { | ||||
|               console.log(tplq); | ||||
|               console.log(quest); | ||||
|               return Mustache.render(tplq, quest); | ||||
|             } | ||||
|           }); | ||||
|         }); | ||||
|         console.log(questhtml); | ||||
|         data.content = questhtml.join(" "); | ||||
|         console.log(data); | ||||
|         let fullform = Mustache.to_html(tpl, data); | ||||
|         $(data.info.idhtml).html(fullform); | ||||
|         $(".formmanager form").gestionform(); | ||||
|       }); | ||||
|     }); | ||||
|   }); | ||||
| });*/ | ||||
|  | ||||
|   function($) { | ||||
|     $.fn.gestionform = function() { | ||||
|       let form = $(this); | ||||
|       var lastdatasend = lastdatasend || ""; | ||||
|       form.find("input").keyup(function(e) { | ||||
|         if (e.which == 13) { | ||||
|           form.find(".btnSendForm").click(); | ||||
|         } | ||||
|       }); | ||||
|       form.find("select").on("click", function() { | ||||
|         let chph = $(this).data("hiddenchamps"); | ||||
|         var valh = $(this) | ||||
|           .find("option:selected") | ||||
|           .text(); | ||||
|         form.find("input[data-champs='" + chph + "']").val(valh); | ||||
|       }); | ||||
|       form.find(".type-choix button").on("click", function() { | ||||
|         var blocchoix = $(this).closest(".type-choix"); | ||||
|         blocchoix.find("button").removeClass("active"); | ||||
|         $(this).addClass("active"); | ||||
|         form | ||||
|           .find("input[data-champs='" + blocchoix.data("champs") + "']") | ||||
|           .val($(this).data("val")); | ||||
|       }); | ||||
|       form.find(".type-multichoix button").on("click", function(e) { | ||||
|         e.preventDefault(); | ||||
|         var reponsemultiple = []; | ||||
|         var blocmultichoix = $(this).closest(".type-multichoix"); | ||||
|         var champsdest = blocmultichoix.attr("data-champs"); | ||||
|         console.log(champsdest); | ||||
|         var nbmaxchoix = parseInt(blocmultichoix.attr("data-nbmaxchoix")); | ||||
|         $(this).toggleClass("active"); | ||||
|         if ($(".type-multichoix button.active").length > nbmaxchoix) { | ||||
|           alert("Choisissez au maximum " + nbmaxchoix + " choix!"); | ||||
|           $(this).toggleClass("active"); | ||||
|         } else { | ||||
|           blocmultichoix.find("button.active").each(function(i) { | ||||
|             reponsemultiple.push($(this).attr("data-choix")); | ||||
|           }); | ||||
|           blocmultichoix | ||||
|             .find("input[data-champs='" + champsdest + "']") | ||||
|             .val(JSON.stringify(reponsemultiple)); | ||||
|         } | ||||
|       }); | ||||
|       form.find(".btnSendForm").on("click", function(e) { | ||||
|         e.preventDefault(); | ||||
|         var formencours = $(this).closest("form"); | ||||
|         var r = localStorage.getItem("r"); | ||||
|         if (r == undefined) { | ||||
|           r = "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function( | ||||
|             c | ||||
|           ) { | ||||
|             var r = (Math.random() * 16) | 0, | ||||
|               v = c == "x" ? r : (r & 0x3) | 0x8; | ||||
|             return v.toString(16); | ||||
|           }); | ||||
|           localStorage.setItem("r", r); | ||||
|         } | ||||
|         var senddata = { r: r }; | ||||
|         var etat = ""; | ||||
|         var msgok = formencours.data("msgok"); | ||||
|         var msgko = formencours.data("msgko"); | ||||
|         formencours.find("textarea").each(function() { | ||||
|           senddata[$(this).data("champs")] = $(this).val(); | ||||
|           if ($(this).val() == "" && $(this).data("check") == "notnull") { | ||||
|             etat += $(this).data("msgerreur") + "<br>"; | ||||
|           } | ||||
|         }); | ||||
|         formencours.find(".blochtml").each(function() { | ||||
|           senddata[$(this).data("champs")] = $(this).html(); | ||||
|         }); | ||||
|         formencours.find("input").each(function(i) { | ||||
|           senddata[$(this).data("champs")] = $(this).val(); | ||||
|           var reg = "{{" + $(this).data("champs") + "}}"; | ||||
|           msgok = msgok.replace(reg, $(this).val()); | ||||
|           msgko = msgko.replace(reg, $(this).val()); | ||||
|  | ||||
|           if ($(this).data("check") == "email") { | ||||
|             /* | ||||
|            var reg = new RegExp( | ||||
|             '^[a-z0-9]+([_|.|-]{1}[a-z0-9]+)*@[a-z0-9]+([_|.|-]{1}[a-z0-9]+)*[.]{1}[a-z]{2,6}$', | ||||
|             'i' | ||||
|           ); | ||||
|           var reg = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/; | ||||
|           */ | ||||
|             var reg = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; | ||||
|  | ||||
|             //console.log($(this).val()); | ||||
|             //console.log(reg.test($(this).val()) ); | ||||
|             if (!reg.test($(this).val())) { | ||||
|               if (!$(this).data("msgerreur")) { | ||||
|                 etat += "invalid email"; | ||||
|               } else { | ||||
|                 etat += $(this).data("msgerreur") + "<br>"; | ||||
|               } | ||||
|             } | ||||
|           } | ||||
|           if ($(this).data("check") == "phone") { | ||||
|             var phone = $(this) | ||||
|               .val() | ||||
|               .replace("+33", "0") | ||||
|               .replace(/[^0-9]/g, ""); | ||||
|             if (phone.length != 10) { | ||||
|               if (!$(this).data("msgerreur")) { | ||||
|                 etat += "invalid phone"; | ||||
|               } else { | ||||
|                 etat += $(this).data("msgerreur") + "<br>"; | ||||
|               } | ||||
|             } | ||||
|           } | ||||
|           if ($(this).data("check") == "notnull") { | ||||
|             if ($(this).val() == "") { | ||||
|               if (!$(this).data("msgerreur")) { | ||||
|                 etat += "empty field"; | ||||
|               } else { | ||||
|                 etat += $(this).data("msgerreur") + "<br>"; | ||||
|               } | ||||
|             } | ||||
|           } | ||||
|           if ($(this).data("check") == "valpositif") { | ||||
|             if (parseInt($(this).val()) < 0) { | ||||
|               if (!$(this).data("msgerreur")) { | ||||
|                 etat += "invalid value have to be positive"; | ||||
|               } else { | ||||
|                 etat += "valpos " + $(this).data("msgerreur") + "<br>"; | ||||
|               } | ||||
|             } | ||||
|           } | ||||
|           if ($(this).data("check") == "codepostal") { | ||||
|             if ($(this).val().length != 5) { | ||||
|               if (!$(this).data("msgerreur")) { | ||||
|                 etat += "invalid zipcode"; | ||||
|               } else { | ||||
|                 etat += "cp" + $(this).data("msgerreur") + "<br>"; | ||||
|               } | ||||
|             } | ||||
|           } | ||||
|           if ($(this).data("check") == "departement") { | ||||
|             var dep = 0; | ||||
|             if ($.isNumeric($(this).val())) { | ||||
|               dep = parseInt($(this).val()); | ||||
|             } | ||||
|             if (!(dep > 0 && dep < 96)) { | ||||
|               if (!$(this).data("msgerreur")) { | ||||
|                 etat += "invalid french departement"; | ||||
|               } else { | ||||
|                 etat += "dep " + $(this).data("msgerreur") + "<br>"; | ||||
|               } | ||||
|             } | ||||
|           } | ||||
|         }); | ||||
|         console.log(JSON.stringify(senddata)); | ||||
|         var diff = false; | ||||
|         if (lastdatasend == "") { | ||||
|           diff = true; | ||||
|         } | ||||
|         $.each(lastdatasend, function(k, v) { | ||||
|           if (k in senddata && v != senddata[k]) { | ||||
|             diff = true; | ||||
|           } | ||||
|         }); | ||||
|         if (!diff) { | ||||
|           etat = | ||||
|             "Action déjà effectuée, si vous recliquez, vous allez renvoyer la même demande"; | ||||
|           lastdatasend = ""; | ||||
|         } | ||||
|         console.log(etat); | ||||
|         if (etat != "") { | ||||
|           formencours.find("p.msgform").html(etat); | ||||
|         } else { | ||||
|           console.log( | ||||
|             "https://api.maildigit.fr" + formencours.data("formmaildigit") | ||||
|           ); | ||||
|           console.log( | ||||
|             formencours.data("tribeid") + | ||||
|               "_" + | ||||
|               $("html").attr("lang") + | ||||
|               "_" + | ||||
|               formencours.data("auth") + | ||||
|               "_" + | ||||
|               formencours.data("uuid") | ||||
|           ); | ||||
|           $.ajax({ | ||||
|             url: "https://api.maildigit.fr" + formencours.data("formmaildigit"), | ||||
|             type: "POST", | ||||
|             beforeSend: function(request) { | ||||
|               request.setRequestHeader( | ||||
|                 "x-Client-id", | ||||
|                 formencours.data("tribeid") | ||||
|               ); | ||||
|               request.setRequestHeader("x-language", $("html").attr("lang")); | ||||
|               request.setRequestHeader("x-auth", formencours.data("auth")); | ||||
|               request.setRequestHeader("x-uuid", formencours.data("uuid")); | ||||
|             }, | ||||
|             data: senddata, | ||||
|             cache: false, | ||||
|             success: function(res) { | ||||
|               //console.log(e); | ||||
|               var app = app || {}; | ||||
|               lastdatasend = senddata; | ||||
|               console.log(formencours.data("msgok")); | ||||
|               console.log(res); | ||||
|               if (res.idpanier) { | ||||
|                 $("button.clickvalidecommande").data("idpanier", res.idpanier); | ||||
|                 console.log("trig clickvalidecommande via form"); | ||||
|                 $("button.clickvalidecommande").trigger("click"); | ||||
|               } | ||||
|               formencours.find("p.msgform").html(msgok); | ||||
|               //var chargeext = app.custom(senddata) || 'Pas de custom à executer'; | ||||
|             }, | ||||
|             error: function(e) { | ||||
|               console.log(e); | ||||
|               //formencours.data(state).val('error'); | ||||
|               formencours.find("p.msgform").html(msgko); | ||||
|             } | ||||
|           }); | ||||
|         } | ||||
|       }); | ||||
|     }; | ||||
|     $.fn.functionname = function(contenu) {}; | ||||
|   } | ||||
| )(jQuery); | ||||
							
								
								
									
										10881
									
								
								asupsetup/data/domain/apixpress/www/cdn/public/js/jquery-3.6.0.js
									
									
									
									
										vendored
									
									
										Executable file
									
								
							
							
						
						
									
										10881
									
								
								asupsetup/data/domain/apixpress/www/cdn/public/js/jquery-3.6.0.js
									
									
									
									
										vendored
									
									
										Executable file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										53
									
								
								asupsetup/data/domain/apixpress/www/cdn/public/js/main.js
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										53
									
								
								asupsetup/data/domain/apixpress/www/cdn/public/js/main.js
									
									
									
									
									
										Executable file
									
								
							| @@ -0,0 +1,53 @@ | ||||
| 'use strict'; | ||||
| var app = app || {}; | ||||
| var URLCENTRALE = "http://maildigit.ndda.fr"; | ||||
| if (location.href.indexOf('https:')>-1){ | ||||
|   URLCENTRALE='https://maildigit.ndda.fr'; | ||||
| } | ||||
|  | ||||
| app.test = function(){ | ||||
|     $('a.test').on('click',function(){ | ||||
|        console.log('lance test pdf'); | ||||
|        $.ajax({ | ||||
|                 url: "/pdf", | ||||
|                 type: "POST", | ||||
|                 data: { | ||||
|                         tpl: 'tete', | ||||
|                         info : 'tyty', | ||||
|                        }, | ||||
|                 cache: false, | ||||
|                 success: function(res) { | ||||
|                        console.log(res.success) | ||||
|                        }, | ||||
|                 error: function(res) { | ||||
|                        }, | ||||
|         }); | ||||
|  | ||||
|     }); | ||||
| }; | ||||
| $('.btncode').on('click',function(){ | ||||
|  | ||||
|   var clair = $('.clair').val(); | ||||
|   var code  = $('.code').val(); | ||||
|   if (clair !='' && code!='') { | ||||
|      $('p.msgcode').html("Vider un champs pour générer le codage") | ||||
|    } | ||||
|   if (code=='') { | ||||
|     $('.code').val(window.btoa(unescape(encodeURIComponent( clair )))); | ||||
|   }; | ||||
|   if (clair ==''){ | ||||
|     $('.clair').val(decodeURIComponent(escape(window.atob( code )))); | ||||
|   } | ||||
|   }); | ||||
|  | ||||
| $(document).ready(function () { | ||||
|   //permet d'afficher du code à copier coller du site | ||||
|   $( 'code' ).each(function(){$(this).find('pre').text( $(this).html() )}); | ||||
|   //app.init() | ||||
|   md.tg("&s=s0"); | ||||
|   $('form.formmaildigit').gestionform(URLCENTRALE); | ||||
|   $('.loginprocess').initlogin(); | ||||
|   //app.sendform(); | ||||
| //  app.test(); | ||||
|    //pour tester | ||||
| }); | ||||
							
								
								
									
										1
									
								
								asupsetup/data/domain/apixpress/www/cdn/public/js/mustache.min.js
									
									
									
									
										vendored
									
									
										Executable file
									
								
							
							
						
						
									
										1
									
								
								asupsetup/data/domain/apixpress/www/cdn/public/js/mustache.min.js
									
									
									
									
										vendored
									
									
										Executable file
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
							
								
								
									
										24
									
								
								asupsetup/data/domain/apixpress/www/cdn/public/js/plugins.js
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										24
									
								
								asupsetup/data/domain/apixpress/www/cdn/public/js/plugins.js
									
									
									
									
									
										Executable file
									
								
							| @@ -0,0 +1,24 @@ | ||||
| // Avoid `console` errors in browsers that lack a console. | ||||
| (function() { | ||||
|     var method; | ||||
|     var noop = function () {}; | ||||
|     var methods = [ | ||||
|         'assert', 'clear', 'count', 'debug', 'dir', 'dirxml', 'error', | ||||
|         'exception', 'group', 'groupCollapsed', 'groupEnd', 'info', 'log', | ||||
|         'markTimeline', 'profile', 'profileEnd', 'table', 'time', 'timeEnd', | ||||
|         'timeline', 'timelineEnd', 'timeStamp', 'trace', 'warn' | ||||
|     ]; | ||||
|     var length = methods.length; | ||||
|     var console = (window.console = window.console || {}); | ||||
|  | ||||
|     while (length--) { | ||||
|         method = methods[length]; | ||||
|  | ||||
|         // Only stub undefined methods. | ||||
|         if (!console[method]) { | ||||
|             console[method] = noop; | ||||
|         } | ||||
|     } | ||||
| }()); | ||||
|  | ||||
| // Place any jQuery/helper plugins in here. | ||||
							
								
								
									
										50
									
								
								asupsetup/data/domain/apixpress/www/cdn/public/js/questio.js
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										50
									
								
								asupsetup/data/domain/apixpress/www/cdn/public/js/questio.js
									
									
									
									
									
										Executable file
									
								
							| @@ -0,0 +1,50 @@ | ||||
| 'use strict' | ||||
| var md = md || {}; | ||||
| var $ = $ || jQuery; | ||||
| md.u = 'http://maildigit.ndda.fr'; | ||||
| if (location.href.indexOf('https:')>-1){ | ||||
|   md.u='https://maildigit.ndda.fr'; | ||||
| } | ||||
| //survey.js doit être installé sur la page qui heberge les declencheurs | ||||
| md.questio = function(quest,iduser){ | ||||
|  | ||||
|   function sendDataToServer(survey) { | ||||
|     console.log(survey) | ||||
|     $.ajax({url:md.u+'/questiodone',type: "POST", data:{'questio':survey.data,'quest':quest,'iduser':iduser}, cache: false, | ||||
|            success:function(e){ | ||||
|              console.log(e.msg) | ||||
|            } | ||||
|     }); | ||||
|   } | ||||
|   $.ajax({ url: md.u+"/questiotodo", type: "GET", | ||||
|            data:{quest:quest,iduser:iduser}, cache: false, | ||||
|            success: function(e) { | ||||
|               console.log(e); | ||||
|               if (e.surveyjson) { | ||||
|                 console.log('survey') | ||||
|                 console.log(e.surveyjson) | ||||
|                 var survey = new Survey.Model(e.surveyjson); | ||||
|                 $("#modalsurvey .survey").Survey({ | ||||
|                        model:survey, | ||||
|                        onComplete:sendDataToServer | ||||
|                 }); | ||||
|                 $('#modalsurvey').modal('show'); | ||||
|               } | ||||
|            }, | ||||
|             error: function(e) { | ||||
|               console.log(e); | ||||
|            }, | ||||
|   }); | ||||
| } | ||||
| $(document).ready(function(){ | ||||
|    $('[data-tgsurvey][data-tgid]').on('click',function(){ | ||||
|       console.log($(this).data('tgsurvey')+"-"+$(this).data('tgid')) | ||||
|       //pour tester enlever cette ligne pour la prod | ||||
|       var idt = $(this).data('tgid') | ||||
|       idt = $("input.testid").val() | ||||
|       md.questio($(this).data('tgsurvey'),idt); | ||||
|    }); | ||||
|    $('[data-tgsurvey][data-tgid]').on('load',function(){ | ||||
|       md.questio($(this).data('tgsurvey'),$(this).data('tgid')); | ||||
|    }); | ||||
| }); | ||||
							
								
								
									
										164
									
								
								asupsetup/data/domain/apixpress/www/cdn/public/js/tagASUPVOIRstate.js.js
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										164
									
								
								asupsetup/data/domain/apixpress/www/cdn/public/js/tagASUPVOIRstate.js.js
									
									
									
									
									
										Executable file
									
								
							| @@ -0,0 +1,164 @@ | ||||
| 'use strict'; | ||||
| var tg = tg || {}; | ||||
|  | ||||
| var pwa = pwa || {}; | ||||
|  | ||||
| $.fn.isInViewport = function() { | ||||
|   var elementTop = $(this) | ||||
|     .offset() | ||||
|     .top; | ||||
|   var elementBottom = elementTop + $(this) | ||||
|     .outerHeight(); | ||||
|   var viewportTop = $(window) | ||||
|     .scrollTop(); | ||||
|   var viewportBottom = viewportTop + $(window) | ||||
|     .height(); | ||||
|   return elementBottom > viewportTop && elementTop < viewportBottom; | ||||
| }; | ||||
| // A cutomiser par client | ||||
| tg.plan = { | ||||
|   action: [ | ||||
|     { selector: '*[data-tgmd]', action: 'click' } | ||||
|   ], | ||||
|   showed: [{ selector: '*[data-tgmd="partietext"]' }] | ||||
| }; | ||||
| tg.content = []; | ||||
| if(localStorage.getItem('tgcontent')) tg.content = JSON.parse(localStorage.getItem('tgcontent')); | ||||
| tg.listen = function() { | ||||
|   //$('.data-tgmd').onclick(function(){console.log("test")}) | ||||
|   tg.plan.action.forEach(e => { | ||||
|     $(e.selector) | ||||
|       .on(e.action, function() { | ||||
|         //envoie un poste avec tag et onclick | ||||
|         console.log('declenche ' + e.action + ' sur ' + e.selector + 'avec valeur de ' + $(e.selector) | ||||
|           .val()); | ||||
|         tgcontent.push([e.action, e.selector, $(e.selector) | ||||
|           .val(), Date.now() | ||||
|         ]) | ||||
|       }) | ||||
|   }); | ||||
|   $(window) | ||||
|     .on('resize scroll', function() { | ||||
|       tg.plan.showed.foreach((e, i) => { | ||||
|         if($(e.selector) | ||||
|           .isInViewport) { | ||||
|           //marque l'affichage | ||||
|           tg.plan.showed[i].timeon = Date.now(); | ||||
|         } else { | ||||
|           if(tg.plan.showed[i].timeon) { | ||||
|             //affichage qui passe of | ||||
|  | ||||
|           } | ||||
|         } | ||||
|       }) | ||||
|     }) | ||||
|   $(window) | ||||
|     .unload(function() { | ||||
|       // on quitte la fenetre | ||||
|       tg.action({ tgcontent: tg.content }) | ||||
|  | ||||
|     }) | ||||
| } | ||||
|  | ||||
| tg.getUrlParams = function(url) { | ||||
|   var params = {}; | ||||
|   (url + '?') | ||||
|   .split('?')[1].split('&') | ||||
|     .forEach(function(pair) { | ||||
|       pair = (pair + '=') | ||||
|         .split('=') | ||||
|         .map(decodeURIComponent); | ||||
|       if(pair[0].length) { | ||||
|         params[pair[0]] = pair[1]; | ||||
|       } | ||||
|     }); | ||||
|   return params; | ||||
| }; | ||||
|  | ||||
| tg.setCookie = (key, value) => {var expires = new Date(); | ||||
|  | ||||
|   expires.setTime(expires.getTime() + 365 * 24 * 60 * 60 * 1000); | ||||
|   document.cookie = key + '=' + value + ';expires=' + expires.toUTCString(); | ||||
| }; | ||||
|  | ||||
| tg.getCookie = (key) => { | ||||
|   var keyValue = document.cookie.match('(^|;) ?' + key + '=([^;]*)(;|$)'); | ||||
|   return keyValue ? keyValue[2] : null; | ||||
| } | ||||
|  | ||||
| tg.setlocalS = (info) => { | ||||
|   let r = localStorage.getItem('r'); | ||||
|   console.log(r); | ||||
|   if(r == undefined || !r) { | ||||
|     r = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) { | ||||
|       var r = (Math.random() * 16) | 0, | ||||
|         v = c == 'x' ? r : (r & 0x3) | 0x8; | ||||
|       return v.toString(16); | ||||
|     }); | ||||
|     localStorage.setItem('r', r); | ||||
|     tg.setCookie(r, r); | ||||
|   } | ||||
|   if(info.id) { | ||||
|     localStorage.setItem('id', info.id); | ||||
|   } | ||||
|   console.log(info) | ||||
|   tg.action(info) | ||||
| } | ||||
| tg.agreement = () => { | ||||
|   if(tg.getCookie('accept') == undefined) { | ||||
|     $('.cookiewarning') | ||||
|       .css('display', 'inline-block'); | ||||
|   } | ||||
|   $('button.acceptcookie') | ||||
|     .on('click', function() { | ||||
|       let accord = "ok" | ||||
|       if($(this) | ||||
|         .attr('data-accord')) { | ||||
|         accord = $(this) | ||||
|           .attr('data-accord') | ||||
|       } | ||||
|       tg.setCookie('accept', accord); | ||||
|       $('.cookiewarning') | ||||
|         .css('display', 'none'); | ||||
|     }); | ||||
| } | ||||
| tg.action = (post) => { | ||||
|   post.tit = encodeURIComponent(document.title); | ||||
|   if(localStorage.getItem('r')) post.r = localStorage.getItem('r'); | ||||
|   if(localStorage.getItem('id')) post.id = localStorage.getItem('id'); | ||||
|   if(localStorage.getItem('accept')) post.accept = localStorage.getItem('accept'); | ||||
|   console.log('post content', post); | ||||
|   let xhttp = new XMLHttpRequest(); | ||||
|   xhttp.onreadystatechange = function() {}; | ||||
|   xhttp.open( | ||||
|     'POST', | ||||
|     `${pwa.urlapxtrib}/tags/${pwa.tribeid}`, | ||||
|     true | ||||
|   ); | ||||
|   xhttp.setRequestHeader("Content-Type", "application/json;charset=UTF-8"); | ||||
|   xhttp.onload = function(post) { | ||||
|     if(xhttp.status != 200) { | ||||
|       //pb d'acces on stock tag: | ||||
|       localStorage.setItem('tgcontent', JSON.stringify(tg.content)); | ||||
|     } else { | ||||
|       //envoyer on vide tgcontent | ||||
|       localStorage.setItem('tgcontent', '[]') | ||||
|     } | ||||
|   } | ||||
|   xhttp.send(JSON.stringify(post)); | ||||
| }; | ||||
|  | ||||
| $(document) | ||||
|   .ready(function() { | ||||
|     if(!pwa.tribeid) { | ||||
|       pwa.urlapxtrib = 'https://api' + $('#mxp') | ||||
|         .attr('data-destin') + '.maildigit.fr'; | ||||
|       pwa.tribeid = $('#mxp') | ||||
|         .attr('data-tribeid'); | ||||
|     } | ||||
|     console.log('pwa', pwa) | ||||
|     console.log('url', window.location.href) | ||||
|     console.log('info', tg.getUrlParams(window.location.href)) | ||||
|     tg.setlocalS(tg.getUrlParams(window.location.href)); | ||||
|     tg.agreement(); | ||||
|   }); | ||||
							
								
								
									
										67
									
								
								asupsetup/data/domain/apixpress/www/cdn/public/js/tagold.js
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										67
									
								
								asupsetup/data/domain/apixpress/www/cdn/public/js/tagold.js
									
									
									
									
									
										Executable file
									
								
							| @@ -0,0 +1,67 @@ | ||||
| 'use strict'; | ||||
|  | ||||
| console.log('md.u:' + md.u); | ||||
| md.cookiepol = function() { | ||||
|   function setCookie(key, value) { | ||||
|     var expires = new Date(); | ||||
|     expires.setTime(expires.getTime() + 365 * 24 * 60 * 60 * 1000); | ||||
|     document.cookie = key + '=' + value + ';expires=' + expires.toUTCString(); | ||||
|   } | ||||
|   function getCookie(key) { | ||||
|     var keyValue = document.cookie.match('(^|;) ?' + key + '=([^;]*)(;|$)'); | ||||
|     return keyValue ? keyValue[2] : null; | ||||
|   } | ||||
|  | ||||
|   if (getCookie('accept') == undefined) { | ||||
|     $('.cookiewarning').css('display', 'inline-block'); | ||||
|   } | ||||
|   $('button.acceptcookie').on('click', function() { | ||||
|     let accord ="ok" | ||||
|     if ($(this).attr('data-accord')){ | ||||
|        accord = $(this).attr('data-accord') | ||||
|     } | ||||
|     setCookie('accept', accord); | ||||
|     $('.cookiewarning').css('display', 'none'); | ||||
|   }); | ||||
| }; | ||||
| md.tg = function(v) { | ||||
|   md.cookiepol(); | ||||
|   var l = window.location.href.split('#coo'); | ||||
|   console.log(l); | ||||
|   if (l.length == 2) { | ||||
|     v += l[1]; | ||||
|   } | ||||
|   var r = localStorage.getItem('r'); | ||||
|   console.log(r); | ||||
|   if (r == undefined) { | ||||
|     r = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) { | ||||
|       var r = (Math.random() * 16) | 0, | ||||
|         v = c == 'x' ? r : (r & 0x3) | 0x8; | ||||
|       return v.toString(16); | ||||
|     }); | ||||
|     localStorage.setItem('r', r); | ||||
|   } | ||||
|   //$.get(md.u+'/?a=tg&r='+r+v,function(data,status){}); | ||||
|   console.log( | ||||
|     md.u + '/?a=tg&r=' + r + '&tit=' + encodeURIComponent(document.title) + v | ||||
|   ); | ||||
|   var xhttp = new XMLHttpRequest(); | ||||
|   xhttp.onreadystatechange = function() {}; | ||||
|   xhttp.open( | ||||
|     'GET', | ||||
|     md.u + '/?a=tg&r=' + r + '&tit=' + encodeURIComponent(document.title) + v, | ||||
|     true | ||||
|   ); | ||||
|   xhttp.send(); | ||||
| }; | ||||
|  | ||||
| $(document).ready(function() { | ||||
|   md.cookiepol(); | ||||
|   $('[data-tgmd]').on('click', function() { | ||||
|     md.tg('&s=' + $(this).data('tgmd')); | ||||
|   }); | ||||
|   $('[data-tgmd]').on('load', function() { | ||||
|     md.tg('&s=' + $(this).data('tgmd')); | ||||
|   }); | ||||
|   md.tg('&s=s0'); | ||||
| }); | ||||
		Reference in New Issue
	
	Block a user