Compare commits
No commits in common. "362b5e836f0a5f7b901aabdafac898ba89578597" and "9a3673847f9eeffab6237308c88f406fed3b6205" have entirely different histories.
362b5e836f
...
9a3673847f
26
.gitignore
vendored
@ -15,17 +15,17 @@ nodemon.json
|
||||
|
||||
/front/node_modules/
|
||||
/front/webpack.config*
|
||||
/front/public/www/.htaccess*
|
||||
/front/public/www/.htpasswd
|
||||
/front/public/.htaccess*
|
||||
/front/public/.htpasswd
|
||||
!/front/webpack.config.js
|
||||
/front/public/www/img/quizs/
|
||||
/front/*/www/JS/*
|
||||
/front/public/www/quiz/
|
||||
/front/public/www/quizs/
|
||||
/front/public/www/themes/
|
||||
/front/public/www/index.html
|
||||
/front/public/www/CGV-CGU.html
|
||||
/front/public/www/mentions-legales.html
|
||||
/front/*/robots-*.txt
|
||||
/front/*/WikiLerni-pub.asc
|
||||
/front/public/www/*.xml
|
||||
/front/public/img/quizs/
|
||||
/front/public/JS/*
|
||||
/front/public/quiz/
|
||||
/front/public/quizs/
|
||||
/front/public/themes/
|
||||
/front/public/index.html
|
||||
/front/public/CGV-CGU.html
|
||||
/front/public/mentions-legales.html
|
||||
/front/public/robots-*.txt
|
||||
/front/public/WikiLerni-pub.asc
|
||||
/front/public/*.xml
|
@ -14,5 +14,5 @@ module.exports =
|
||||
},
|
||||
// files upload tempory dir
|
||||
dirIllustrationsTmp : "temp",
|
||||
dirIllustrations: "front/public/www/img/quizs"
|
||||
dirIllustrations: "front/public/img/quizs"
|
||||
};
|
@ -9,7 +9,7 @@ instance.tokenPrivateKey=process.env.TOKEN_PRIVATE_KEY;
|
||||
instance.maxLoginFail=parseInt(process.env.MAX_LOGIN_FAILS,10);
|
||||
instance.loginFailTimeInMinutes=parseInt(process.env.LOGIN_FAIL_TIME_IN_MINUTES,10);
|
||||
instance.dirCache="datas";
|
||||
instance.dirHTML="front/public/www";
|
||||
instance.dirHTML="front/public";
|
||||
instance.dirTmp="datas/tmp";
|
||||
instance.dirTmpLogin="datas/tmp/logins";
|
||||
|
||||
|
@ -56,10 +56,10 @@ module.exports =
|
||||
dirCacheTags : "datas/questionnaires/tags",
|
||||
dirCacheUsersQuestionnaires : "datas/users/questionnaires",
|
||||
// Emplacement des fichiers HTML générés :
|
||||
dirHTMLGroups : "front/public/www/quiz/gp",
|
||||
dirHTMLQuestionnaires : "front/public/www/quiz",
|
||||
dirHTMLNews : "front/public/www/quizs",
|
||||
dirHTMLTags : "front/public/www/quizs",
|
||||
dirHTMLGroups : "front/public/quiz/gp",
|
||||
dirHTMLQuestionnaires : "front/public/quiz",
|
||||
dirHTMLNews : "front/public/quizs",
|
||||
dirHTMLTags : "front/public/quizs",
|
||||
// Idem mais pour urls :
|
||||
dirWebGroups : "quiz/gp",
|
||||
dirWebQuestionnaires : "quiz",
|
||||
|
@ -407,6 +407,7 @@ exports.checkQuestionnairesNeedToBePublished = async (req, res, next) =>
|
||||
const creaQuestionnaireJson = async (id) =>
|
||||
{
|
||||
const db=require("../models/index");
|
||||
console.log("j'arrive ici avec "+id);
|
||||
const Questionnaire=await db["Questionnaire"].findByPk(id);
|
||||
if(Questionnaire)
|
||||
{
|
||||
@ -542,9 +543,6 @@ const creaQuestionnaireHTML = async (id, preview=false) =>
|
||||
// deux possibilités :
|
||||
// -- si élément d'un groupe de quiz : juste le texte sans les questions
|
||||
// -- si quiz automone : toutes les infos
|
||||
|
||||
console.log("je passe par ici pour créer le fichier du quiz "+id);
|
||||
|
||||
const questionnaire=await searchQuestionnaireById(id, true);
|
||||
if(!questionnaire)
|
||||
return false;
|
||||
@ -832,6 +830,7 @@ const creaNewQuestionnairesHTML = async (Questionnaires) =>
|
||||
await toolFile.createHTML(configQuestionnaires.dirHTMLNews, "index", html);
|
||||
// + le flux ATOM
|
||||
compiledFunction=pug.compileFile("./views/"+config.theme+"/atom.pug");
|
||||
//console.log(pageDatas.questionnaires);
|
||||
const xml=await compiledFunction(pageDatas);
|
||||
await toolFile.createXML(config.dirHTML, "atom", xml);
|
||||
return true;
|
||||
|
@ -1,36 +0,0 @@
|
||||
{
|
||||
"name": "wikilerni",
|
||||
"version": "0.2.0",
|
||||
"description": "Admin pages of WikiLerni web application",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1",
|
||||
"build": "webpack --mode production",
|
||||
"start": "webpack serve --no-live-reload"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://forge.chapril.org/Fab_Blab/WikiLerni"
|
||||
},
|
||||
"keywords": [
|
||||
"quiz",
|
||||
"wikipédia",
|
||||
"questionnaire",
|
||||
"e-learning"
|
||||
],
|
||||
"author": "Fabrice PENHOËT",
|
||||
"license": "GPL-3.0-or-later",
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.15.5",
|
||||
"@babel/preset-env": "^7.15.6",
|
||||
"@webpack-cli/serve": "^1.5.2",
|
||||
"babel-loader": "^8.2.2",
|
||||
"babel-polyfill": "^6.26.0",
|
||||
"webpack": "^5.56.1",
|
||||
"webpack-cli": "^4.8.0",
|
||||
"webpack-dev-server": "^4.3.0"
|
||||
},
|
||||
"browserslist": [
|
||||
"> 1%"
|
||||
]
|
||||
}
|
@ -1,34 +0,0 @@
|
||||
import { isEmpty } from "../../../../tools/main";
|
||||
|
||||
// Fonction associant les attributs fournis à un champ de formulaire
|
||||
export const addElement = (eltParent, eltType, eltContent="", eltId="", eltClass=[], eltAttributes={}, replace=true) =>
|
||||
{
|
||||
if(isEmpty(eltType) || isEmpty(eltParent))
|
||||
return false;
|
||||
else
|
||||
{
|
||||
const newElement=document.createElement(eltType);
|
||||
|
||||
if(!isEmpty(eltId))// tester si l'id n'est pas déjà utilisé dans le DOM ?
|
||||
newElement.id=eltId;
|
||||
|
||||
if(Array.isArray(eltClass) && eltClass.length!=0)
|
||||
{
|
||||
for(let i in eltClass)
|
||||
newElement.classList.add(eltClass[i]);
|
||||
}
|
||||
|
||||
if(typeof eltAttributes === "object") // !! tous les objets ne sont pas ok
|
||||
{
|
||||
for(let attributName in eltAttributes)
|
||||
newElement.setAttribute(attributName, eltAttributes[attributName]);
|
||||
}
|
||||
|
||||
if(!isEmpty(eltContent))
|
||||
newElement.innerHTML=eltContent.replace(/\n/g,"<br>");// innerHTML permet d'ajouter du texte ayant lui-même des balises, etc.
|
||||
|
||||
if(replace)
|
||||
eltParent.innerHTML="";
|
||||
eltParent.appendChild(newElement);
|
||||
}
|
||||
}
|
@ -1,6 +0,0 @@
|
||||
// Ce script fournit des fonctions utilisées sur toutes les pages du site
|
||||
export const helloDev = () =>
|
||||
{
|
||||
console.log("**** Hello les devs :-)\nLe code source de WikiLerni est libre et vous pouvez le trouver à cette adresse :\nhttps://forge.chapril.org/Fab_Blab/WikiLerni\nBonne lecture ! ****");
|
||||
return true;
|
||||
}
|
@ -1,51 +0,0 @@
|
||||
import { isEmpty } from "../../../../tools/main";
|
||||
|
||||
// Fonction associant les attributs fournis à un champ de formulaire
|
||||
export const setAttributesToInputs = (inputsConf, myForm) =>
|
||||
{
|
||||
for(let i in myForm.elements)
|
||||
{
|
||||
if(!isEmpty(myForm.elements[i].id))
|
||||
{
|
||||
let idInput=myForm.elements[i].id;
|
||||
if(inputsConf[idInput]!==undefined)
|
||||
{
|
||||
let inputHTML=document.getElementById(idInput);
|
||||
for (let attribute in inputsConf[idInput])
|
||||
inputHTML.setAttribute(attribute, inputsConf[idInput][attribute]);
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// Récupère toutes les valeurs de champs en omettant les checkbox non cochées, etc.
|
||||
export const getDatasFromInputs = (myForm) =>
|
||||
{
|
||||
const datas={};
|
||||
const formData = new FormData(myForm);
|
||||
for(let entrie of formData.entries())
|
||||
datas[entrie[0]]=entrie[1];
|
||||
return datas;
|
||||
}
|
||||
|
||||
// Vide tous les champs d'un formulaire, y compris hidden, checkbox, etc.
|
||||
// Revoir pour les select
|
||||
export const empyForm = (myForm) =>
|
||||
{
|
||||
const formData = new FormData(myForm);
|
||||
for(let entrie of formData.entries())
|
||||
{
|
||||
if(myForm.elements[entrie[0]].type=="checkbox" || myForm.elements[entrie[0]].type=="radio")
|
||||
myForm.elements[entrie[0]].checked=false;
|
||||
else
|
||||
myForm.elements[entrie[0]].value="";
|
||||
}
|
||||
return true;
|
||||
}
|
||||
// Vide et cache le formulaire
|
||||
export const empyAndHideForm = (myForm) =>
|
||||
{
|
||||
empyForm(myForm);
|
||||
myForm.style.display="none";
|
||||
}
|
@ -1,42 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta name="description" content="Page d'accueil pour les gestionnaires du site.">
|
||||
<meta name="robots" content="noindex">
|
||||
<title>Mon WikiLerni</title>
|
||||
<!-- Version lisible des scripts : https://forge.chapril.org/Fab_Blab/WikiLerni/src/branch/master/front/src -->
|
||||
<script src="/JS/polyfill.app.js" defer></script>
|
||||
<script src="/JS/homeManager.app.js" defer></script>
|
||||
<link rel="shortcut icon" href="./img/favicon.ico">
|
||||
<link rel="stylesheet" href="/themes/wikilerni/css/style.css">
|
||||
</head>
|
||||
|
||||
<body class="cardboard">
|
||||
<!-- En tête -->
|
||||
<header class="cardboard">
|
||||
<a href="./gestion.html" title="Page d'accueil"><img src="/themes/wikilerni/img/wikilerni-purple-2-128.png" alt="WikiLerni (logo)" title="Accéder à la page d'accueil" /></a>
|
||||
<ul id="headLinks">
|
||||
<li><a href="./sortie.html">Me déconnecter</a></li>
|
||||
<li><a href="./gestion-utilisateurs.html" title="Les comptes utilisateurs">Les utilisateurs</a></li>
|
||||
<li><a href="./gestion-quizs.html" title="Publication des quizs">Les quizs</a></li>
|
||||
<li><a href="./gestion.html">Gestion WikiLerni</a></li>
|
||||
</ul>
|
||||
</header>
|
||||
|
||||
<div id="crash"></div>
|
||||
|
||||
<section id="main-content" class="needJS">
|
||||
|
||||
<div id="home" class="cardboard">
|
||||
<img id="logo" src="/themes/wikilerni/img/wikilerni-purple-2-512.png" alt="Logo WikiLerni" />
|
||||
<div id="message" class="cardboard"></div>
|
||||
<p><a href="#" class="button cardboard" id="wantRegenerate">Régénérer le HTML.</a></p>
|
||||
<div id="questionnaires"></div>
|
||||
</div>
|
||||
|
||||
</section>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -1,29 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta name="robots" content="noindex">
|
||||
<title>Déconnexion WikiLerni</title>
|
||||
<!-- Version lisible des scripts : https://forge.chapril.org/Fab_Blab/WikiLerni/src/branch/master/front/src -->
|
||||
<script src="/JS/polyfill.app.js" defer></script>
|
||||
<script src="/JS/deconnection.app.js" defer></script>
|
||||
<link rel="shortcut icon" href="/img/favicon.ico">
|
||||
<link rel="stylesheet" href="/themes/wikilerni/css/style.css">
|
||||
</head>
|
||||
|
||||
<body class="cardboard">
|
||||
<!-- En tête -->
|
||||
<header class="cardboard">
|
||||
<a href="/" title="Page de connexion"><img src="/themes/wikilerni/img/wikilerni-purple-2-128.png" alt="WikiLerni (logo)" title="Accéder à la page de connexion" /></a>
|
||||
</header>
|
||||
|
||||
<div id="prompt" class="cardboard">
|
||||
<a href="./gestion.html" title="Page d'accueil"><img src="/themes/wikilerni/img/wikilerni-purple-2-512.png" alt="Logo WikiLerni" title="W I K I L E R N I" /></a>
|
||||
<p>Cultivons notre jardin !</p>
|
||||
<h1 class="cardboard">Au revoir !</h1>
|
||||
<div id="response"><p class="error">Si vous voyez ce message, c’est qu’un problème a été rencontré durant la déconnexion.</p></div>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
Before Width: | Height: | Size: 811 B |
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "wikilerni",
|
||||
"version": "0.2.0",
|
||||
"description": "Public site of WikiLerni web application",
|
||||
"description": "Front-end of WikiLerni web application",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1",
|
50
front/public/.htaccess
Normal file
@ -0,0 +1,50 @@
|
||||
# Activation de la génération des en-têtes Expires
|
||||
ExpiresActive On
|
||||
# Les documents HTML, JS, JSON, CSS, XML expirent dès leur modification
|
||||
ExpiresByType text/html M0
|
||||
ExpiresByType text/javascript M0
|
||||
ExpiresByType application/javascript M0
|
||||
ExpiresByType application/json M0
|
||||
ExpiresByType text/css M0
|
||||
ExpiresByType application/xml M0
|
||||
|
||||
# Compression de certains fichiers
|
||||
SetOutputFilter DEFLATE
|
||||
|
||||
AddOutputFilterByType DEFLATE application/javascript
|
||||
AddOutputFilterByType DEFLATE application/rss+xml
|
||||
AddOutputFilterByType DEFLATE application/vnd.ms-fontobject
|
||||
AddOutputFilterByType DEFLATE application/x-font
|
||||
AddOutputFilterByType DEFLATE application/x-font-opentype
|
||||
AddOutputFilterByType DEFLATE application/x-font-otf
|
||||
AddOutputFilterByType DEFLATE application/x-font-truetype
|
||||
AddOutputFilterByType DEFLATE application/x-font-ttf
|
||||
AddOutputFilterByType DEFLATE application/x-javascript
|
||||
AddOutputFilterByType DEFLATE application/xhtml+xml
|
||||
AddOutputFilterByType DEFLATE application/xml
|
||||
AddOutputFilterByType DEFLATE font/opentype
|
||||
AddOutputFilterByType DEFLATE font/otf
|
||||
AddOutputFilterByType DEFLATE font/ttf
|
||||
AddOutputFilterByType DEFLATE image/png
|
||||
AddOutputFilterByType DEFLATE image/svg+xml
|
||||
AddOutputFilterByType DEFLATE image/x-icon
|
||||
AddOutputFilterByType DEFLATE text/css
|
||||
AddOutputFilterByType DEFLATE text/html
|
||||
AddOutputFilterByType DEFLATE text/javascript
|
||||
AddOutputFilterByType DEFLATE text/xml
|
||||
|
||||
# Bloquer ETag
|
||||
Header unset ETag
|
||||
FileETag none
|
||||
|
||||
# Protection de la lecture des répertoires
|
||||
Options -Indexes
|
||||
|
||||
# protection du htaccess
|
||||
<files .htaccess>
|
||||
order allow,deny
|
||||
deny from all
|
||||
</files>
|
||||
|
||||
# erreur 404
|
||||
ErrorDocument 404 /404.html
|
@ -21,6 +21,7 @@
|
||||
<ul id="headLinks">
|
||||
<li><a href="/contact.html" rel="nofollow">Contact</a></li>
|
||||
<li><a href="/quizs/" id="indexHeadLink" title="Les dernières publications">Parcourir</a></li>
|
||||
<!--<li><a href="/connexion.html" id="accountHeadLink">Mon compte</a></li>-->
|
||||
<li><a href="/a-propos.html">À propos</a></li>
|
||||
</ul>
|
||||
</header>
|
@ -6,21 +6,21 @@
|
||||
<meta name="robots" content="noindex">
|
||||
<title>Gestion des groupes de quizs</title>
|
||||
<!-- Version lisible des scripts : https://forge.chapril.org/Fab_Blab/WikiLerni/src/branch/master/front/src -->
|
||||
<script src="/JS/polyfill.app.js" defer></script>
|
||||
<script src="/JS/manageGroups.app.js" defer></script>
|
||||
<link rel="shortcut icon" href="./img/favicon.ico">
|
||||
<link rel="stylesheet" href="/themes/wikilerni/css/style.css">
|
||||
<script src="../JS/polyfill.app.js" defer></script>
|
||||
<script src="../JS/manageGroups.app.js" defer></script>
|
||||
<link rel="shortcut icon" href="../img/favicon.ico">
|
||||
<link rel="stylesheet" href="../themes/wikilerni/css/style.css">
|
||||
</head>
|
||||
|
||||
<body class="cardboard">
|
||||
<!-- En tête -->
|
||||
<header class="cardboard">
|
||||
<a href="./gestion.html" title="Page d'accueil"><img src="/themes/wikilerni/img/wikilerni-purple-2-128.png" alt="WikiLerni (logo)" title="Accéder à la page d'accueil" /></a>
|
||||
<a href="../" title="Page d'accueil WikLerni"><img src="../themes/wikilerni/img/wikilerni-purple-2-128.png" alt="WikiLerni (logo)" title="Accéder à la page d'accueil de WikiLerni" /></a>
|
||||
<ul id="headLinks">
|
||||
<li><a href="./sortie.html">Me déconnecter</a></li>
|
||||
<li><a href="./gestion-utilisateurs.html" title="Les comptes utilisateurs">Les utilisateurs</a></li>
|
||||
<li><a href="./gestion-quizs.html" title="Publication des quizs">Les quizs</a></li>
|
||||
<li><a href="./gestion.html">Gestion WikiLerni</a></li>
|
||||
<li><a href="../contact.html" rel="nofollow">Contact</a></li>
|
||||
<li><a href="../quizs/" id="indexHeadLink" title="Les derniers quizs">Parcourir</a></li>
|
||||
<li><a href="../a-propos.html">À propos</a></li>
|
||||
<li><a href="../" title="Page d'accueil de WikiLerni">Accueil</a></li>
|
||||
</ul>
|
||||
</header>
|
||||
|
||||
@ -28,6 +28,13 @@
|
||||
|
||||
<section id="main-content" class="needJS">
|
||||
|
||||
<ul id="menu" class="cardboard">
|
||||
<li><a href="./gestion.html">Gestion WikiLerni</a></li>
|
||||
<li><a href="./gestion-quizs.html" title="Publication des quizs">Les quizs</a></li>
|
||||
<li><a href="./gestion-utilisateurs.html" title="Les comptes utilisateurs">Les abonné(e)s</a></li>
|
||||
<li><a href="./sortie.html">Me déconnecter</a></li>
|
||||
</ul>
|
||||
|
||||
<div id="account" class="cardboard">
|
||||
|
||||
<h1 class="cardboard" id="infos">Les groupes de quizs</h1>
|
||||
@ -61,5 +68,14 @@
|
||||
<div id="questionnairesList"></div>
|
||||
</section>
|
||||
|
||||
<footer class="cardboard">
|
||||
<ul id="footLinks">
|
||||
<li><a href="https://diaspora-fr.org/people/815767c0c09e0139ec6f32a01d0dfba2" title="Blog WikiLerni sur diaspora*">Blog</a></li>
|
||||
<li><a href="../credits.html">Crédits</a></li>
|
||||
<li><a href="../mentions-legales.html" rel="nofollow">Mentions légales</a></li>
|
||||
<li><a href="../donnees.html">Données personnelles</a></li>
|
||||
<li><a href="../CGV-CGU.html" rel="nofollow">CGV & CGU</a></li>
|
||||
</ul>
|
||||
</footer>
|
||||
</body>
|
||||
</html>
|
@ -6,21 +6,21 @@
|
||||
<meta name="robots" content="noindex">
|
||||
<title>Gestion des quizs</title>
|
||||
<!-- Version lisible des scripts : https://forge.chapril.org/Fab_Blab/WikiLerni/src/branch/master/front/src -->
|
||||
<script src="/JS/polyfill.app.js" defer></script>
|
||||
<script src="/JS/manageQuestionnaires.app.js" defer></script>
|
||||
<link rel="shortcut icon" href="./img/favicon.ico">
|
||||
<link rel="stylesheet" href="/themes/wikilerni/css/style.css">
|
||||
<script src="../JS/polyfill.app.js" defer></script>
|
||||
<script src="../JS/manageQuestionnaires.app.js" defer></script>
|
||||
<link rel="shortcut icon" href="../img/favicon.ico">
|
||||
<link rel="stylesheet" href="../themes/wikilerni/css/style.css">
|
||||
</head>
|
||||
|
||||
<body class="cardboard">
|
||||
<!-- En tête -->
|
||||
<header class="cardboard">
|
||||
<a href="./gestion.html" title="Page d'accueil"><img src="/themes/wikilerni/img/wikilerni-purple-2-128.png" alt="WikiLerni (logo)" title="Accéder à la page d'accueil" /></a>
|
||||
<a href="../" title="Page d'accueil WikLerni"><img src="../themes/wikilerni/img/wikilerni-purple-2-128.png" alt="WikiLerni (logo)" title="Accéder à la page d'accueil de WikiLerni" /></a>
|
||||
<ul id="headLinks">
|
||||
<li><a href="./sortie.html">Me déconnecter</a></li>
|
||||
<li><a href="./gestion-utilisateurs.html" title="Les comptes utilisateurs">Les utilisateurs</a></li>
|
||||
<li><a href="./gestion-quizs.html" title="Publication des quizs">Les quizs</a></li>
|
||||
<li><a href="./gestion.html">Gestion WikiLerni</a></li>
|
||||
<li><a href="../contact.html" rel="nofollow">Contact</a></li>
|
||||
<li><a href="../quizs/" id="indexHeadLink" title="Les derniers quizs">Parcourir</a></li>
|
||||
<li><a href="../a-propos.html">À propos</a></li>
|
||||
<li><a href="../" title="Page d'accueil de WikiLerni">Accueil</a></li>
|
||||
</ul>
|
||||
</header>
|
||||
|
||||
@ -28,6 +28,13 @@
|
||||
|
||||
<section id="main-content" class="needJS">
|
||||
|
||||
<ul id="menu" class="cardboard">
|
||||
<li><a href="./gestion.html">Gestion WikiLerni</a></li>
|
||||
<li><a href="./gestion-quizs.html" title="Publication des quizs">Les quizs</a></li>
|
||||
<li><a href="./gestion-utilisateurs.html" title="Les comptes utilisateurs">Les abonné(e)s</a></li>
|
||||
<li><a href="./sortie.html">Me déconnecter</a></li>
|
||||
</ul>
|
||||
|
||||
<div id="manageQuestionnaires" class="cardboard">
|
||||
|
||||
<h1 class="cardboard" id="infos">Les quizs</h1>
|
||||
@ -172,6 +179,14 @@
|
||||
<div id="questionnairesList"></div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<footer class="cardboard">
|
||||
<ul id="footLinks">
|
||||
<li><a href="https://diaspora-fr.org/people/815767c0c09e0139ec6f32a01d0dfba2" title="Blog WikiLerni sur diaspora*">Blog</a></li>
|
||||
<li><a href="../credits.html">Crédits</a></li>
|
||||
<li><a href="../mentions-legales.html" rel="nofollow">Mentions légales</a></li>
|
||||
<li><a href="../donnees.html">Données personnelles</a></li>
|
||||
<li><a href="../CGV-CGU.html" rel="nofollow">CGV & CGU</a></li>
|
||||
</ul>
|
||||
</footer>
|
||||
</body>
|
||||
</html>
|
@ -6,21 +6,21 @@
|
||||
<meta name="robots" content="noindex">
|
||||
<title>Gestion des abonnés</title>
|
||||
<!-- Version lisible des scripts : https://forge.chapril.org/Fab_Blab/WikiLerni/src/branch/master/front/src -->
|
||||
<script src="./JS/polyfill.app.js" defer></script>
|
||||
<script src="./JS/manageUsers.app.js" defer></script>
|
||||
<link rel="shortcut icon" href="./img/favicon.ico">
|
||||
<link rel="stylesheet" href="/themes/wikilerni/css/style.css">
|
||||
<script src="../JS/polyfill.app.js" defer></script>
|
||||
<script src="../JS/manageUsers.app.js" defer></script>
|
||||
<link rel="shortcut icon" href="../img/favicon.ico">
|
||||
<link rel="stylesheet" href="../themes/wikilerni/css/style.css">
|
||||
</head>
|
||||
|
||||
<body class="cardboard">
|
||||
<!-- En tête -->
|
||||
<header class="cardboard">
|
||||
<a href="./gestion.html" title="Page d'accueil"><img src="/themes/wikilerni/img/wikilerni-purple-2-128.png" alt="WikiLerni (logo)" title="Accéder à la page d'accueil" /></a>
|
||||
<a href="../" title="Page d'accueil WikLerni"><img src="../themes/wikilerni/img/wikilerni-purple-2-128.png" alt="WikiLerni (logo)" title="Accéder à la page d'accueil de WikiLerni" /></a>
|
||||
<ul id="headLinks">
|
||||
<li><a href="./sortie.html">Me déconnecter</a></li>
|
||||
<li><a href="./gestion-utilisateurs.html" title="Les comptes utilisateurs">Les utilisateurs</a></li>
|
||||
<li><a href="./gestion-quizs.html" title="Publication des quizs">Les quizs</a></li>
|
||||
<li><a href="./gestion.html">Gestion WikiLerni</a></li>
|
||||
<li><a href="../contact.html" rel="nofollow">Contact</a></li>
|
||||
<li><a href="../quizs/" id="indexHeadLink" title="Les derniers quizs">Parcourir</a></li>
|
||||
<li><a href="../a-propos.html">À propos</a></li>
|
||||
<li><a href="../" title="Page d'accueil de WikiLerni">Accueil</a></li>
|
||||
</ul>
|
||||
</header>
|
||||
|
||||
@ -28,6 +28,13 @@
|
||||
|
||||
<section id="main-content" class="needJS">
|
||||
|
||||
<ul id="menu" class="cardboard">
|
||||
<li><a href="./gestion.html">Gestion WikiLerni</a></li>
|
||||
<li><a href="./gestion-quizs.html" title="Publication des quizs">Les quizs</a></li>
|
||||
<li><a href="./gestion-utilisateurs.html" title="Les comptes utilisateurs">Les abonné(e)s</a></li>
|
||||
<li><a href="./sortie.html">Me déconnecter</a></li>
|
||||
</ul>
|
||||
|
||||
<div id="account" class="cardboard">
|
||||
|
||||
<h1 class="cardboard" id="infos">Les abonnés</h1>
|
||||
@ -112,5 +119,14 @@
|
||||
<div id="infosGodchilds" class="needJS"></div>
|
||||
</section>
|
||||
|
||||
<footer class="cardboard">
|
||||
<ul id="footLinks">
|
||||
<li><a href="https://diaspora-fr.org/people/815767c0c09e0139ec6f32a01d0dfba2" title="Blog WikiLerni sur diaspora*">Blog</a></li>
|
||||
<li><a href="../credits.html">Crédits</a></li>
|
||||
<li><a href="../mentions-legales.html" rel="nofollow">Mentions légales</a></li>
|
||||
<li><a href="../donnees.html">Données personnelles</a></li>
|
||||
<li><a href="../CGV-CGU.html" rel="nofollow">CGV & CGU</a></li>
|
||||
</ul>
|
||||
</footer>
|
||||
</body>
|
||||
</html>
|
58
front/public/admin/gestion.html
Normal file
@ -0,0 +1,58 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta name="description" content="Page d'accueil pour les gestionnaires du site.">
|
||||
<meta name="robots" content="noindex">
|
||||
<title>Mon WikiLerni</title>
|
||||
<!-- Version lisible des scripts : https://forge.chapril.org/Fab_Blab/WikiLerni/src/branch/master/front/src -->
|
||||
<script src="../JS/polyfill.app.js" defer></script>
|
||||
<script src="../JS/homeManager.app.js" defer></script>
|
||||
<link rel="shortcut icon" href="../img/favicon.ico">
|
||||
<link rel="stylesheet" href="../themes/wikilerni/css/style.css">
|
||||
</head>
|
||||
|
||||
<body class="cardboard">
|
||||
<!-- En tête -->
|
||||
<header class="cardboard">
|
||||
<a href="../" title="Page d'accueil WikLerni"><img src="../themes/wikilerni/img/wikilerni-purple-2-128.png" alt="WikiLerni (logo)" title="Accéder à la page d'accueil de WikiLerni" /></a>
|
||||
<ul id="headLinks">
|
||||
<li><a href="../contact.html" rel="nofollow">Contact</a></li>
|
||||
<li><a href="../quizs/" id="indexHeadLink" title="Les derniers quizs">Parcourir</a></li>
|
||||
<li><a href="../a-propos.html">À propos</a></li>
|
||||
<li><a href="../" title="Page d'accueil de WikiLerni">Accueil</a></li>
|
||||
</ul>
|
||||
</header>
|
||||
|
||||
<div id="crash"></div>
|
||||
|
||||
<section id="main-content" class="needJS">
|
||||
|
||||
<ul id="menu" class="cardboard">
|
||||
<li><a href="./gestion.html">Gestion WikiLerni</a></li>
|
||||
<li><a href="./gestion-quizs.html" title="Publication des quizs">Les quizs</a></li>
|
||||
<li><a href="./gestion-utilisateurs.html" title="Les comptes utilisateurs">Les abonné(e)s</a></li>
|
||||
<li><a href="./sortie.html">Me déconnecter</a></li>
|
||||
</ul>
|
||||
|
||||
<div id="home" class="cardboard">
|
||||
<img id="logo" src="../themes/wikilerni/img/wikilerni-purple-2-512.png" alt="Logo WikiLerni" />
|
||||
<div id="message" class="cardboard"></div>
|
||||
<p><a href="#" class="button cardboard" id="wantRegenerate">Régénérer le HTML.</a></p>
|
||||
<div id="questionnaires"></div>
|
||||
</div>
|
||||
|
||||
</section>
|
||||
|
||||
<footer class="cardboard">
|
||||
<ul id="footLinks">
|
||||
<li><a href="https://diaspora-fr.org/people/815767c0c09e0139ec6f32a01d0dfba2" title="Blog WikiLerni sur diaspora*">Blog</a></li>
|
||||
<li><a href="../credits.html">Crédits</a></li>
|
||||
<li><a href="../mentions-legales.html" rel="nofollow">Mentions légales</a></li>
|
||||
<li><a href="../donnees.html">Données personnelles</a></li>
|
||||
<li><a href="../CGV-CGU.html" rel="nofollow">CGV & CGU</a></li>
|
||||
</ul>
|
||||
</footer>
|
||||
</body>
|
||||
</html>
|
@ -6,20 +6,26 @@
|
||||
<meta name="description" content="Formulaire de connexion à WikiLerni.">
|
||||
<title>Se connecter à WikiLerni</title>
|
||||
<!-- Version lisible des scripts : https://forge.chapril.org/Fab_Blab/WikiLerni/src/branch/master/front/src -->
|
||||
<script src="/JS/polyfill.app.js" defer></script>
|
||||
<script src="/JS/connection.app.js" defer></script>
|
||||
<link rel="shortcut icon" href="./img/favicon.ico">
|
||||
<link rel="stylesheet" href="/themes/wikilerni/css/style.css">
|
||||
<script src="../JS/polyfill.app.js" defer></script>
|
||||
<script src="../JS/connection.app.js" defer></script>
|
||||
<link rel="shortcut icon" href="../img/favicon.ico">
|
||||
<link rel="stylesheet" href="../themes/wikilerni/css/style.css">
|
||||
</head>
|
||||
|
||||
<body class="cardboard">
|
||||
<!-- En tête -->
|
||||
<header class="cardboard">
|
||||
<a href="/" title="Page de connexion"><img src="/themes/wikilerni/img/wikilerni-purple-2-128.png" alt="WikiLerni (logo)" title="Accéder à la page de connexion" /></a>
|
||||
<a href="../" title="Page d'accueil WikLerni"><img src="../themes/wikilerni/img/wikilerni-purple-2-128.png" alt="WikiLerni (logo)" title="Accéder à la page d'accueil de WikiLerni" /></a>
|
||||
<ul id="headLinks">
|
||||
<li><a href="../contact.html" rel="nofollow">Contact</a></li>
|
||||
<li><a href="../quizs/" id="indexHeadLink" title="Les dernières publications">Parcourir</a></li>
|
||||
<li><a href="../a-propos.html">À propos</a></li>
|
||||
<li><a href="../" title="Page d'accueil de WikiLerni">Accueil</a></li>
|
||||
</ul>
|
||||
</header>
|
||||
|
||||
<div id="prompt" class="cardboard">
|
||||
<a href="./gestion.html" title="Page d'accueil"><img src="/themes/wikilerni/img/wikilerni-purple-2-512.png" alt="Logo WikiLerni" title="W I K I L E R N I" /></a>
|
||||
<a href="../" title="Page d'accueil WikLerni"><img src="../themes/wikilerni/img/wikilerni-purple-2-512.png" alt="Logo WikiLerni" title="W I K I L E R N I" /></a>
|
||||
<p>Cultivons notre jardin !</p>
|
||||
</div>
|
||||
|
||||
@ -51,6 +57,25 @@
|
||||
</div>
|
||||
</form>
|
||||
<div id="response"></div>
|
||||
|
||||
<div class="info"><b>Pas encore de compte ?</b> <a href="../inscription.html">Créez-le en cliquant ici.</a></div>
|
||||
|
||||
<div id="explanations" class="framed engraved">
|
||||
<h2>Besoin d’aide ?</h2>
|
||||
<p>Si vous avez <b>oublié votre mot de passe</b>, il vous suffit de cocher la case « Je souhaite recevoir un lien de connexion par e-mail ». Un lien valide pendant une courte durée vous permettra de vous connecter au site.</p>
|
||||
<p>Si vous ne vous souvenez pas non plus de l’adresse e-mail utilisée sur ce site ou que vous n’y avez plus accès, vous pouvez <a href="../contact.html">me contacter</a>, en fournissant des informations permettant de vous identifier.</p>
|
||||
<p>La case <b>« Je souhaite ne pas avoir à me connecter à chaque fois. »</b> vous permettra de rester connecté jusqu’à 6 mois, pour peu que vous utilisiez le même navigateur internet sur le même ordinateur.</p>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<footer class="cardboard">
|
||||
<ul id="footLinks">
|
||||
<li><a href="https://diaspora-fr.org/people/815767c0c09e0139ec6f32a01d0dfba2" title="Blog WikiLerni sur diaspora*">Blog</a></li>
|
||||
<li><a href="../credits.html">Crédits</a></li>
|
||||
<li><a href="../mentions-legales.html" rel="nofollow">Mentions légales</a></li>
|
||||
<li><a href="../donnees.html">Données personnelles</a></li>
|
||||
<li><a href="../CGV-CGU.html" rel="nofollow">CGV & CGU</a></li>
|
||||
</ul>
|
||||
</footer>
|
||||
</body>
|
||||
</html>
|
44
front/public/admin/sortie.html
Normal file
@ -0,0 +1,44 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta name="robots" content="noindex">
|
||||
<title>Déconnexion WikiLerni</title>
|
||||
<!-- Version lisible des scripts : https://forge.chapril.org/Fab_Blab/WikiLerni/src/branch/master/front/src -->
|
||||
<script src="../JS/polyfill.app.js" defer></script>
|
||||
<script src="../JS/deconnection.app.js" defer></script>
|
||||
<link rel="shortcut icon" href="../img/favicon.ico">
|
||||
<link rel="stylesheet" href="../themes/wikilerni/css/style.css">
|
||||
</head>
|
||||
|
||||
<body class="cardboard">
|
||||
<!-- En tête -->
|
||||
<header class="cardboard">
|
||||
<a href="../" title="Page d'accueil WikLerni"><img src="../themes/wikilerni/img/wikilerni-purple-2-128.png" alt="WikiLerni (logo)" title="Accéder à la page d'accueil de WikiLerni" /></a>
|
||||
<ul id="headLinks">
|
||||
<li><a href="../contact.html" rel="nofollow">Contact</a></li>
|
||||
<li><a href="../quizs/" id="indexHeadLink" title="Les dernières publications">Parcourir</a></li>
|
||||
<li><a href="../a-propos.html">À propos</a></li>
|
||||
<li><a href="../" title="Page d'accueil de WikiLerni">Accueil</a></li>
|
||||
</ul>
|
||||
</header>
|
||||
|
||||
<div id="prompt" class="cardboard">
|
||||
<a href="../" title="Page d'accueil WikLerni"><img src="../themes/wikilerni/img/wikilerni-purple-2-512.png" alt="Logo WikiLerni" title="W I K I L E R N I" /></a>
|
||||
<p>Cultivons notre jardin !</p>
|
||||
<h1 class="cardboard">Au revoir !</h1>
|
||||
<div id="response"><p class="error">Si vous voyez ce message, c’est qu’un problème a été rencontré durant la déconnexion.<br>N’hésitez pas <a href="../contact.html">à nous prévenir</a> si le problème persiste.</p></div>
|
||||
</div>
|
||||
|
||||
<footer class="cardboard">
|
||||
<ul id="footLinks">
|
||||
<li><a href="https://diaspora-fr.org/people/815767c0c09e0139ec6f32a01d0dfba2" title="Blog WikiLerni sur diaspora*">Blog</a></li>
|
||||
<li><a href="../credits.html">Crédits</a></li>
|
||||
<li><a href="../mentions-legales.html" rel="nofollow">Mentions légales</a></li>
|
||||
<li><a href="../donnees.html">Données personnelles</a></li>
|
||||
<li><a href="../CGV-CGU.html" rel="nofollow">CGV & CGU</a></li>
|
||||
</ul>
|
||||
</footer>
|
||||
</body>
|
||||
</html>
|
@ -20,6 +20,7 @@
|
||||
<ul id="headLinks">
|
||||
<li><a href="/contact.html" rel="nofollow">Contact</a></li>
|
||||
<li><a href="/quizs/" id="indexHeadLink" title="Les dernières publications">Parcourir</a></li>
|
||||
<!--<li><a href="/connexion.html" id="accountHeadLink">Mon compte</a></li>-->
|
||||
<li><a href="/a-propos.html">À propos</a></li>
|
||||
<li><a href="/" title="Page d'accueil de WikiLerni">Accueil</a></li>
|
||||
</ul>
|
@ -21,6 +21,7 @@
|
||||
<ul id="headLinks">
|
||||
<li><a href="/contact.html" rel="nofollow">Contact</a></li>
|
||||
<li><a href="/quizs/" id="indexHeadLink" title="Les dernières publications">Parcourir</a></li>
|
||||
<!--<li><a href="/connexion.html" id="accountHeadLink">Mon compte</a></li>-->
|
||||
<li><a href="/a-propos.html">À propos</a></li>
|
||||
<li><a href="/" title="Page d'accueil de WikiLerni">Accueil</a></li>
|
||||
</ul>
|
@ -21,6 +21,7 @@
|
||||
<ul id="headLinks">
|
||||
<li><a href="/contact.html" rel="nofollow">Contact</a></li>
|
||||
<li><a href="/quizs/" id="indexHeadLink" title="Les dernières publications">Parcourir</a></li>
|
||||
<!--<li><a href="/connexion.html" id="accountHeadLink">Mon compte</a></li>-->
|
||||
<li><a href="/a-propos.html">À propos</a></li>
|
||||
<li><a href="/" title="Page d'accueil de WikiLerni">Accueil</a></li>
|
||||
</ul>
|
Before Width: | Height: | Size: 185 KiB After Width: | Height: | Size: 185 KiB |
Before Width: | Height: | Size: 49 KiB After Width: | Height: | Size: 49 KiB |
Before Width: | Height: | Size: 4.8 KiB After Width: | Height: | Size: 4.8 KiB |
Before Width: | Height: | Size: 28 KiB After Width: | Height: | Size: 28 KiB |
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.9 KiB |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 21 KiB |
@ -20,6 +20,7 @@
|
||||
<ul id="headLinks">
|
||||
<li><a href="/contact.html" rel="nofollow">Contact</a></li>
|
||||
<li><a href="/quizs/" id="indexHeadLink" title="Les dernières publications">Parcourir</a></li>
|
||||
<!--<li><a href="/connexion.html" id="accountHeadLink">Mon compte</a></li>-->
|
||||
<li><a href="/a-propos.html">À propos</a></li>
|
||||
<li><a href="/" title="Page d'accueil de WikiLerni">Accueil</a></li>
|
||||
</ul>
|
10513
front/public/package-lock.json
generated
@ -21,6 +21,7 @@
|
||||
<ul id="headLinks">
|
||||
<li><a href="/contact.html" rel="nofollow">Contact</a></li>
|
||||
<li><a href="/quizs/" id="indexHeadLink" title="Les dernières publications">Parcourir</a></li>
|
||||
<!--<li><a href="/connexion.html" id="accountHeadLink">Mon compte</a></li>-->
|
||||
<li><a href="/a-propos.html">À propos</a></li>
|
||||
<li><a href="/" title="Page d'accueil de WikiLerni">Accueil</a></li>
|
||||
</ul>
|
@ -1,18 +0,0 @@
|
||||
// à supprimer une fois que tout récupérer du backend :
|
||||
|
||||
module.exports =
|
||||
{
|
||||
apiUrl : "http://localhost:3000/api",
|
||||
usersGetConfigUrl : "/user/getconfig",
|
||||
lang : "fr",
|
||||
userHomePage : "accueil.html",
|
||||
adminHomePage : "admin.html",
|
||||
managerHomePage : "gestion.html",
|
||||
subscribePage : "inscription.html",
|
||||
connectionPage : "connexion.html",
|
||||
accountPage: "compte.html",
|
||||
questionnairesManagementPage: "gestion-quizs.html",
|
||||
usersManagementPage: "gestion-utilisateurs.html",
|
||||
nbQuestionnairesUserHomePage : 10,
|
||||
illustrationDir : "/img/quizs/"
|
||||
};
|
@ -1,6 +0,0 @@
|
||||
// -- SCRIPT DE BASE APPELÉ DANS LES PAGES TYPE ACCUEIL DU SITE
|
||||
import { helloDev } from "./tools/everywhere.js";
|
||||
import { loadMatomo } from "./tools/matomo.js";
|
||||
|
||||
helloDev();
|
||||
loadMatomo();
|
@ -1,34 +0,0 @@
|
||||
// FONCTIONS UTILES AU STOCKAGE LOCAL (SESSION, COOKIES, INDEXDB, ETC.)
|
||||
// Éviter sessionStorage dont le contenu n'est pas gardé d'un onglet à l'autre : https://developer.mozilla.org/fr/docs/Web/API/Window/sessionStorage
|
||||
|
||||
export const saveLocaly = (name, data) =>
|
||||
{
|
||||
localStorage.setItem(name, JSON.stringify(data));
|
||||
}
|
||||
|
||||
export const getLocaly = (name, json=false) =>
|
||||
{
|
||||
if(json)
|
||||
return JSON.parse(localStorage.getItem(name));
|
||||
else
|
||||
return localStorage.getItem(name);
|
||||
}
|
||||
|
||||
export const removeLocaly = (name) =>
|
||||
{
|
||||
localStorage.removeItem(name);
|
||||
}
|
||||
|
||||
export const saveIsReady = () =>
|
||||
{
|
||||
if (!window.indexedDB)
|
||||
return false;
|
||||
else
|
||||
return true;
|
||||
}
|
||||
|
||||
export const getStore = (db, store_name, mode) =>
|
||||
{
|
||||
const tx=db.transaction(store_name, mode);
|
||||
return tx.objectStore(store_name);
|
||||
}
|
@ -1,6 +0,0 @@
|
||||
// Ce script fournit des fonctions utilisées sur toutes les pages du site
|
||||
export const helloDev = () =>
|
||||
{
|
||||
console.log("**** Hello les devs :-)\nLe code source de WikiLerni est libre et vous pouvez le trouver à cette adresse :\nhttps://forge.chapril.org/Fab_Blab/WikiLerni\nBonne lecture ! ****");
|
||||
return true;
|
||||
}
|
@ -1,41 +0,0 @@
|
||||
const checkBoxes=
|
||||
{
|
||||
"CGV" : document.getElementById("CGVOk"),
|
||||
"abo1" : document.getElementById("abo1"),
|
||||
"abo2" : document.getElementById("abo2"),
|
||||
"abo3" : document.getElementById("abo3"),
|
||||
"abo4" : document.getElementById("abo4")
|
||||
}
|
||||
const divWPBtns=document.getElementById("WPBtns");
|
||||
|
||||
// Lorsque l'on sélectionne un montant, les autres options + les CGV sont désélectionnés
|
||||
export const unCheckAllOthers = (choice) =>
|
||||
{
|
||||
for (let id in checkBoxes)
|
||||
{
|
||||
if(id!==choice)
|
||||
checkBoxes[id].checked=false;
|
||||
divWPBtns.style.display="none";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const btns=
|
||||
{
|
||||
"btn1" : document.getElementById("WPBtn1"),
|
||||
"btn2" : document.getElementById("WPBtn2"),
|
||||
"btn3" : document.getElementById("WPBtn3"),
|
||||
"btn4" : document.getElementById("WPBtn4")
|
||||
}
|
||||
|
||||
// Affiche le bon bouton de paiement et cache les autres
|
||||
export const showBtnPayment = (choice) =>
|
||||
{
|
||||
for (let id in btns)
|
||||
{
|
||||
if(id!==choice)
|
||||
btns[id].style.display="none";
|
||||
else
|
||||
btns[id].style.display="block";
|
||||
}
|
||||
}
|
Before Width: | Height: | Size: 197 KiB After Width: | Height: | Size: 197 KiB |
Before Width: | Height: | Size: 340 B After Width: | Height: | Size: 340 B |
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.1 KiB |
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.1 KiB |
Before Width: | Height: | Size: 922 B After Width: | Height: | Size: 922 B |
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.0 KiB |
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 2.3 KiB |
Before Width: | Height: | Size: 7.2 KiB After Width: | Height: | Size: 7.2 KiB |
Before Width: | Height: | Size: 93 KiB After Width: | Height: | Size: 93 KiB |
Before Width: | Height: | Size: 928 B After Width: | Height: | Size: 928 B |
@ -1,37 +0,0 @@
|
||||
const path = require('path');
|
||||
|
||||
module.exports =
|
||||
{
|
||||
mode: "development",
|
||||
entry:
|
||||
{
|
||||
index: "./src/index.js",
|
||||
paymentPage: "./src/paymentPage.js",
|
||||
polyfill: "babel-polyfill",
|
||||
quiz: "./src/quiz.js"
|
||||
},
|
||||
output:
|
||||
{
|
||||
path: path.resolve(__dirname, "public"),
|
||||
filename: "JS/[name].app.js",
|
||||
},
|
||||
module:
|
||||
{
|
||||
rules: [
|
||||
{
|
||||
test: /\.js$/,
|
||||
exclude: /node_modules/,
|
||||
use: {
|
||||
loader: "babel-loader",
|
||||
options: {
|
||||
presets: ["@babel/preset-env"]
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
devServer:
|
||||
{
|
||||
static: path.resolve(__dirname, "./www")
|
||||
},
|
||||
};
|
@ -1,35 +0,0 @@
|
||||
-----BEGIN PGP PUBLIC KEY BLOCK-----
|
||||
|
||||
xsDNBGCVExsBDADFoIoW8B7PJ91lRP/E1WEzsiN9ILpU9pCOs3rW09ZzOCju37FUYW7jcTAQpDya
|
||||
plvOMg8JC3BcyCYGPd1xlCnDfoUnY7TyEbUUMLySg6eD3cz+Kz051GlHOayGfGYymwHF9BvvqLBf
|
||||
B4b9wb4rLidbdgYqXlL6gXX7WqeGvshHZ1wvqm96vLSNJPqnntTn9qhyZMRnW7oyPcsPYVuQQ9v3
|
||||
9sgbcglOfUDxlBT1rz2dCnvPzYF2FyGwELIkyvj75kp9JwBYxggLgxQf1BW9HE6vYBYNH2/nNbjJ
|
||||
Ol/1VzIYzvO1MQIvgGv1rZ1+qWb44xoLG+BT5pLR0N6XrrciPISbbRQHBtcO24dm+y8q0kHh7ov+
|
||||
+aubkJ94lQkauIPH+WdjnXuPFxtJmBUdX5O2jJZrZZ0A0zfKxLKFGjR+7NFtRAmWCIwL6hGVN6dy
|
||||
DvgUFIpKPHixnPmxFiD6cwZRR0bfJ8BtNcLxArW201/RTsrA/iffBSH0XinAfbGpJ8q+CtMAEQEA
|
||||
Ac0hV2lraUxlcm5pIDxib25qb3VyQHdpa2lsZXJuaS5jb20+wsEJBBMBCAAzFiEEmfN8AfrUk6e8
|
||||
Cr338WI1eEGVsn4FAmCVEx0CGwMFCwkIBwIGFQgJCgsCBRYCAwEAAAoJEPFiNXhBlbJ+LDIL/AoO
|
||||
rhQX+Ou+gEEN0io92l7OEKU9BQHJYb35Y5V0p8k95lGCL+mnNvfBtXsWlLk7T1wave/cw3kl6nlE
|
||||
eTMilht4h1TmFJAP8GLaC712uR1OuVTgcn7jYElP7Fd6esdZ9FYhBQYRCYetvaZzb19lbLJz2LHL
|
||||
PrX/AHJGjrMzOf/d3wMUG/gATZZLzdcqHTbSWIS49YySXcak4pmbX3+z91eYhttJJ4hdAK0bnkHy
|
||||
/jwkMKCykZ0UKbbMjtOjQc6D5M6SJIEtoLioBBZ1irHgwAsTRuZCaPazJKkI45UEROfqAOFOLrnQ
|
||||
NZlkaCqCEBLUVT7btdxdShux2MT/IDyQSejg+4wOsqVp+mic8JZYzf7n/YMS2kOwP7Qnlw/myJ4M
|
||||
iceGabOQ8eV8/UcUQcI97p3ylAdl7kI7tGY20qdMBqYx6ztCJAAFzoLAFqtCOcC/SxOTy+aLY6Ck
|
||||
kxHLXshp8xmYTb1/pgaNKBHWUIgJq1SuRUk3n1PiOsLOfUv6/Aswm87AzQRglRMdAQwAt1m1/L9L
|
||||
9I14QW+2Gw013GucJT7pzoQNziAJYcOr9z6KvAsNT0XtAaMiyJX1OJ8c9vwAaNfWUZP59sJb9F/F
|
||||
gM20KhYJUp4aWO96wAQvItV1/z5V35hid2ozeFTqEZGLD64qS5TO1M6/mX4Fmyt6ByXQjAj55lxi
|
||||
XCrSdHRE+peO/TIX40MnvYElaiUFCzabZ4ionGMGnsPJp1sWVPeJ5XIMMCy+Qfz3AcMzKZ6clxlK
|
||||
0Q64Cv8ZrKqSNl5dquvrTTTIG7qb26M5iX9yEuCn6GKaZdcRE2HXa+5znx3qHUQuI+j904RLgsNC
|
||||
ZGB8TWxfDiCHt84jz1BnsSfiedKn0NFky9DhjI69UQyuYXUqMKfiSef9snufHvd+Z8bfuphzjiSj
|
||||
IcmljrjHztbQgAdoOsTrxd/BuVNF5h5KfVQl5+kyJENgsMs9DAf9hF76Xm9tDSSsQVpc2RP4Z+kh
|
||||
bwy2tdZmKNDPN4q/DGHi8WwH8aGvn/RRxtyT6sDCrCsIOTx/ABEBAAHCwPYEGAEIACAWIQSZ83wB
|
||||
+tSTp7wKvffxYjV4QZWyfgUCYJUTHgIbDAAKCRDxYjV4QZWyflLsDAC39JCuoeP6rZe8tKphuVRO
|
||||
dhGEGVzQi4J6UFt1+L92ley5F6SK/bVP6OpzCb9l1S12mcu3/tXuizyWzTjiX+hqVgkfEF31dkrq
|
||||
3ZHELQgwJOaG+1AB9dLVi1DpmygywcmeLFdURPgj6Ftk/QtaTDGkL3ZEF3sOEOrn/IeyP/L460fd
|
||||
64BS8KZUgTNfmgTbUNu/qRxSwTrhVR8QKEkKFQd8B5Hsgpf5Y1tRzHeYgIk2BjQS3WQSQY64FdJZ
|
||||
d6/CXN8wmzPEcPOEdxr5Zlknl0jfm+yBEYTrREUwzkAu8hDHdIa8aceYFiJMaN9lUGIHiRfEaxSU
|
||||
wWBpGfDmV3XmxKTb0anBYnKOt1hUb+weSiwh6sm6pkOS7WXHs8mb8+SAorUJnNkMllmF+2sfHrG+
|
||||
feYWliIvczO6C/Cbb7TC+d6GTt0itwjuNuNgKL0QnvRnil36ZW22jQDLiMazm3UIyjfC7T5ue5Er
|
||||
qJv6ZtLnAb/6I0Q7qAtQ7gxTdBJuZloUlWM=
|
||||
=jiGl
|
||||
-----END PGP PUBLIC KEY BLOCK-----
|
Before Width: | Height: | Size: 185 KiB |
Before Width: | Height: | Size: 49 KiB |
Before Width: | Height: | Size: 4.8 KiB |
Before Width: | Height: | Size: 1.9 KiB |
Before Width: | Height: | Size: 1.1 KiB |
260
front/src/accountUser.js
Normal file
@ -0,0 +1,260 @@
|
||||
// -- GESTION DES FORMULAIRES PERMETTANT AUX UTILISATEURS DE METTRE À JOUR LEURS INFORMATIONS + LEUR ABONNEMENT
|
||||
|
||||
/// Vérifier que l'utilisateur est bien connecté, a le bon statut et le rediriger vers le formulaire d'inscription si ce n'est pas le cas.
|
||||
/// Si c'est ok, on récupère les infos de son compte et son abonnement et les affiche dans le formulaire.
|
||||
/// Une information est affichée concernant la possibilité de parrainage et liste les filleuls existants.
|
||||
/// Un menu permet à l'utilisateur d'accéder à la modification de ses infos, etc.
|
||||
/// Des boutons de paiement sont aussi affichés suivant le choix de l'utilisateur pour lui permettre de prolonger son abonnement.
|
||||
/// Un message venant d'une autre page peut aussi être à afficher lors du premier chargement.
|
||||
|
||||
// Fichier de configuration côté client :
|
||||
import { apiUrl, availableLangs, theme } from "../../config/instance.js";
|
||||
const lang=availableLangs[0];
|
||||
const configTemplate = require("../../views/"+theme+"/config/"+lang+".js");// besoin de toutes les déclarations pour la fonction : updateAccountLink()
|
||||
const { beginCodeGodfather } = require("../../config/instance");
|
||||
const configUsers = require("../../config/users"); // besoin de tous le fichier pour configurer le formulaire
|
||||
|
||||
// Fonctions utiles au script
|
||||
import { getLocaly, removeLocaly } from "./tools/clientstorage.js";
|
||||
import { addElement } from "./tools/dom.js";
|
||||
import { helloDev, updateAccountLink } from "./tools/everywhere.js";
|
||||
import { getDatasFromInputs, setAttributesToInputs } from "./tools/forms.js";
|
||||
import { isEmpty } from "../../tools/main";
|
||||
import { checkSession, getConfig, getTimeDifference } from "./tools/users.js";
|
||||
|
||||
// Spécifique WebPortage pour paiements:
|
||||
import { showBtnPayment, unCheckAllOthers } from "./tools/webportage.js";
|
||||
|
||||
// Dictionnaires :
|
||||
const { serverError } = require("../../lang/"+lang+"/general");
|
||||
const { infosUserNbGodChilds, infosUserNoGodchilds, needBeConnected } = require("../../lang/"+lang+"/user");
|
||||
const { infosExpirated, infosNbDays } = require("../../lang/"+lang+"/subscription");
|
||||
|
||||
// Principaux éléments du DOM manipulés :
|
||||
const divCrash = document.getElementById("crash");
|
||||
const divMain = document.getElementById("main-content");
|
||||
const divMessage = document.getElementById("message");
|
||||
const divResponse = document.getElementById("response");
|
||||
const divGodfatherInfos = document.getElementById("godfatherInfos");
|
||||
const divGodchilds = document.getElementById("godchilds");
|
||||
const divSubscribeInfos = document.getElementById("subscribeInfos");
|
||||
const divSubscribeIntro = document.getElementById("subscribeIntro");
|
||||
const formAccount = document.getElementById("accountUpdate");
|
||||
const newPassword = document.getElementById("newPassword");
|
||||
const showGFEmail = document.getElementById("godfatherEmail");
|
||||
const showGFCode = document.getElementById("godfatherCode");
|
||||
|
||||
helloDev();
|
||||
|
||||
const initialise = async () =>
|
||||
{
|
||||
try
|
||||
{
|
||||
// Si l'utilisateur n'est pas connecté avec le bon statut, pas la peine d'aller + loin :
|
||||
const isConnected=await checkSession(["user"], "/"+configTemplate.connectionPage, { message: needBeConnected, color:"error" }, window.location);
|
||||
if(isConnected)
|
||||
{
|
||||
divMain.style.display="block";
|
||||
// l'éventuelle ancre est ignorée, car absente du DOM avant d'avoir vérifié la connexion
|
||||
if(window.location.hash!==undefined)
|
||||
window.location.assign(window.location.hash);
|
||||
|
||||
if(!isEmpty(getLocaly("message")))
|
||||
{
|
||||
addElement(divMessage, "p", getLocaly("message", true).message, "", [getLocaly("message", true).color], "", false);
|
||||
removeLocaly("message");
|
||||
}
|
||||
const user=getLocaly("user", true);
|
||||
updateAccountLink(user.status, configTemplate);
|
||||
// Initialise le formulaire permettant de mettre à jour les infos :
|
||||
setAttributesToInputs(configUsers, formAccount);
|
||||
// Certains navigateurs remplissent les champs password :
|
||||
newPassword.value="";
|
||||
|
||||
// Fonction affichant les infos connues au premier affichage, puis après envoi mise à jour
|
||||
const getInfos = () =>
|
||||
{
|
||||
const xhrGetInfos = new XMLHttpRequest();
|
||||
xhrGetInfos.open("GET", apiUrl+configUsers.userRoutes+configUsers.getUserInfos+user.id);
|
||||
xhrGetInfos.onreadystatechange = function()
|
||||
{
|
||||
if (this.readyState == XMLHttpRequest.DONE)
|
||||
{
|
||||
let response=JSON.parse(this.responseText);
|
||||
if (this.status === 200 && response.User != undefined && response.Subscription != undefined)
|
||||
{
|
||||
for(let data in response.User)
|
||||
{
|
||||
if(formAccount.elements[data]!==undefined)
|
||||
{
|
||||
if(response.User[data]!==true && response.User[data]!==false)// booléen = case à cocher !
|
||||
formAccount.elements[data].value=response.User[data];
|
||||
else if (response.User[data]==true) // si false, on ne fait rien
|
||||
formAccount.elements[""+data].checked="checked";
|
||||
}
|
||||
}
|
||||
// jours de réception
|
||||
for(let i in response.Subscription.receiptDays)
|
||||
formAccount.elements["d"+response.Subscription.receiptDays[i]].checked="checked";
|
||||
// "codes" possibles à transmettre pour parrainer d'autres utilisateurs
|
||||
showGFEmail.innerHTML=response.User.email;
|
||||
showGFCode.innerHTML=beginCodeGodfather+response.User.id;
|
||||
}
|
||||
const beginSubTS=new Date(response.Subscription.createdAt).getTime();
|
||||
if(response.Subscription.numberOfDays !== 0)
|
||||
{
|
||||
divGodfatherInfos.style.display="block";
|
||||
divSubscribeInfos.style.display="block";
|
||||
const nbDaysOk=response.Subscription.numberOfDays-Math.round((Date.now()-beginSubTS)/1000/3600/24);
|
||||
if(nbDaysOk > 0)
|
||||
addElement(divSubscribeIntro, "p", infosNbDays.replace("NB_DAYS", nbDaysOk), "", ["info"]);
|
||||
else
|
||||
{
|
||||
addElement(divSubscribeIntro, "p", infosExpirated.replace("NB_DAYS", nbDaysOk), "", ["error"]);
|
||||
window.location.assign("#subscribe");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
xhrGetInfos.setRequestHeader("Authorization", "Bearer "+user.token);
|
||||
xhrGetInfos.send();
|
||||
}
|
||||
// Remonte les infos déjà enregistrées :
|
||||
getInfos();
|
||||
|
||||
// Traitement de l'envoi d'une mise à jour des infos
|
||||
formAccount.addEventListener("submit", function(e)
|
||||
{
|
||||
e.preventDefault();
|
||||
divResponse.innerHTML="";
|
||||
let datas=getDatasFromInputs(formAccount);
|
||||
// recomposition des jours valables pour l'abonnement :
|
||||
datas.receiptDays="";
|
||||
for(let i=1; i<=7; i++)
|
||||
{
|
||||
if(datas["d"+i]!==undefined)
|
||||
datas.receiptDays+=""+i;
|
||||
}
|
||||
datas.timeDifference=getTimeDifference();
|
||||
const xhrUserUpdate = new XMLHttpRequest();
|
||||
if(datas.deleteOk!==undefined)
|
||||
xhrUserUpdate.open("DELETE", apiUrl+configUsers.userRoutes+"/"+user.id);
|
||||
else
|
||||
xhrUserUpdate.open("PUT", apiUrl+configUsers.userRoutes+configUsers.updateUserInfos+user.id);
|
||||
xhrUserUpdate.onreadystatechange = function()
|
||||
{
|
||||
if (this.readyState == XMLHttpRequest.DONE)
|
||||
{
|
||||
let response=JSON.parse(this.responseText);
|
||||
if (this.status === 200 && response.message!=undefined)
|
||||
{
|
||||
if(Array.isArray(response.message))
|
||||
response.message = response.message.join("<br>");
|
||||
else
|
||||
response.message = response.message;
|
||||
addElement(divResponse, "p", response.message, "", ["success"]);
|
||||
}
|
||||
else if (response.errors)
|
||||
{
|
||||
if(Array.isArray(response.errors))
|
||||
response.errors = response.errors.join("<br>");
|
||||
else
|
||||
response.errors = serverError;
|
||||
addElement(divResponse, "p", response.errors, "", ["error"]);
|
||||
}
|
||||
else
|
||||
addElement(divResponse, "p", serverError, "", ["error"]);
|
||||
// dans tous les cas, je mets à jour le contenu du formulaire :
|
||||
getInfos();
|
||||
}
|
||||
}
|
||||
xhrUserUpdate.setRequestHeader("Content-Type", "application/json");
|
||||
xhrUserUpdate.setRequestHeader("Authorization", "Bearer "+user.token);
|
||||
if(datas)
|
||||
{
|
||||
datas.output="html";
|
||||
xhrUserUpdate.send(JSON.stringify(datas));
|
||||
}
|
||||
});
|
||||
|
||||
// on passe à la caisse ?
|
||||
const abo9=document.getElementById("abo9");
|
||||
const abo18=document.getElementById("abo18");
|
||||
const abo36=document.getElementById("abo36");
|
||||
const abo54=document.getElementById("abo54");
|
||||
const CGV=document.getElementById("CGVOk");
|
||||
const divWPBtns=document.getElementById("WPBtns");
|
||||
divWPBtns.style.display="none";
|
||||
abo9.addEventListener("change", function(e)
|
||||
{
|
||||
unCheckAllOthers("abo9");
|
||||
});
|
||||
abo18.addEventListener("change", function(e)
|
||||
{
|
||||
unCheckAllOthers("abo18");
|
||||
});
|
||||
abo36.addEventListener("change", function(e)
|
||||
{
|
||||
unCheckAllOthers("abo36");
|
||||
});
|
||||
abo54.addEventListener("change", function(e)
|
||||
{
|
||||
unCheckAllOthers("abo54");
|
||||
});
|
||||
CGV.addEventListener("change", function(e)
|
||||
{
|
||||
if(CGV.checked===true)
|
||||
{
|
||||
divWPBtns.style.display="block";
|
||||
if(abo9.checked===true)
|
||||
showBtnPayment("btn9");
|
||||
else if(abo18.checked===true)
|
||||
showBtnPayment("btn18");
|
||||
else if(abo36.checked===true)
|
||||
showBtnPayment("btn36");
|
||||
else if(abo54.checked===true)
|
||||
showBtnPayment("btn54");
|
||||
else
|
||||
{
|
||||
divWPBtns.style.display="none";
|
||||
CGV.checked=false;
|
||||
}
|
||||
}
|
||||
else
|
||||
divWPBtns.style.display="none";
|
||||
});
|
||||
|
||||
// Liste des filleuls, si il y en a
|
||||
const xhrGetGodchilds = new XMLHttpRequest();
|
||||
xhrGetGodchilds.open("GET", apiUrl+configUsers.userRoutes+configUsers.getGodChilds);
|
||||
xhrGetGodchilds.onreadystatechange = function()
|
||||
{
|
||||
if (this.readyState == XMLHttpRequest.DONE)
|
||||
{
|
||||
let response=JSON.parse(this.responseText), txtGodchilds="";
|
||||
if (this.status === 200)
|
||||
{
|
||||
const nbGodchilds=response.length;
|
||||
if(nbGodchilds===0)
|
||||
txtGodchilds=infosUserNoGodchilds;
|
||||
else
|
||||
{
|
||||
txtGodchilds=infosUserNbGodChilds.replace("#NB", nbGodchilds);
|
||||
for(let i in response)
|
||||
txtGodchilds+=response[i].name+" ("+response[i].email+") ";
|
||||
}
|
||||
}
|
||||
addElement(divGodchilds, "p", txtGodchilds, "", ["info"]);
|
||||
}
|
||||
}
|
||||
xhrGetGodchilds.setRequestHeader("Authorization", "Bearer "+user.token);
|
||||
xhrGetGodchilds.send();
|
||||
}
|
||||
}
|
||||
catch(e)
|
||||
{
|
||||
addElement(divCrash, "p", serverError, "", ["error"]);
|
||||
console.error(e);
|
||||
}
|
||||
}
|
||||
initialise();
|
@ -6,23 +6,24 @@
|
||||
/// Le connexion peut se faire directement ici via la saisie d'un mot de passe ou via l'envoi d'un token par e-mail.
|
||||
|
||||
// Fichier de configuration tirés du backend :
|
||||
import { apiUrl, availableLangs, siteUrl, theme } from "../../../config/instance.js";
|
||||
import { apiUrl, availableLangs, siteUrl, theme } from "../../config/instance.js";
|
||||
const lang=availableLangs[0];
|
||||
|
||||
import { connectionRoute, getLoginLinkRoute, userRoutes } from "../../../config/users.js";
|
||||
const configTemplate = require("../../../views/"+theme+"/config/"+lang+".js");
|
||||
import { connectionRoute, getLoginLinkRoute, userRoutes } from "../../config/users.js";
|
||||
const configTemplate = require("../../views/"+theme+"/config/"+lang+".js");
|
||||
|
||||
// Importation des fonctions utiles au script :
|
||||
import { getLocaly, removeLocaly, saveLocaly } from "./tools/clientstorage.js";
|
||||
import { addElement } from "./tools/dom.js";
|
||||
import { helloDev } from "./tools/everywhere.js";
|
||||
import { getDatasFromInputs } from "./tools/forms.js";
|
||||
import { isEmpty } from "../../../tools/main";
|
||||
import { isEmpty } from "../../tools/main";
|
||||
import { loadMatomo } from "./tools/matomo.js";
|
||||
import { checkAnswerDatas, checkSession, getTimeDifference, setSession } from "./tools/users.js";
|
||||
|
||||
// Dictionnaires :
|
||||
const { serverError } = require("../../../lang/"+lang+"/general");
|
||||
const { alreadyConnected, needChooseLoginWay } = require("../../../lang/"+lang+"/user");
|
||||
const { serverError } = require("../../lang/"+lang+"/general");
|
||||
const { alreadyConnected, needChooseLoginWay } = require("../../lang/"+lang+"/user");
|
||||
|
||||
// Principaux éléments du DOM manipulés :
|
||||
const myForm = document.getElementById("connection");
|
||||
@ -42,11 +43,11 @@ const initialise = async () =>
|
||||
saveLocaly("message", { message: alreadyConnected, color:"info" });// pour l'afficher sur la page suivante
|
||||
const user=getLocaly("user", true);
|
||||
const homePage=user.status+"HomePage";
|
||||
console.log("./"+configTemplate[homePage]);
|
||||
window.location.assign("./"+configTemplate[homePage]);
|
||||
window.location.assign("/"+configTemplate[homePage]);
|
||||
}
|
||||
else
|
||||
{
|
||||
loadMatomo();
|
||||
myForm.style.display="block";
|
||||
if(!isEmpty(getLocaly("message")))
|
||||
{
|
@ -3,7 +3,7 @@
|
||||
/// On se contente ici de supprimer la session stockée côté client
|
||||
|
||||
// Fichier de configuration côté client :
|
||||
import { apiUrl, availableLangs, theme } from "../../../config/instance.js";
|
||||
import { apiUrl, availableLangs, theme } from "../../config/instance.js";
|
||||
const lang=availableLangs[0];
|
||||
|
||||
// Importation des fonctions utile au script :
|
||||
@ -12,8 +12,8 @@ import { addElement } from "./tools/dom.js";
|
||||
import { helloDev } from "./tools/everywhere.js";
|
||||
|
||||
// Dictionnaires :
|
||||
const { serverError } = require("../../../lang/"+lang+"/general");
|
||||
const { byebyeMessage } = require("../../../lang/"+lang+"/user");
|
||||
const { serverError } = require("../../lang/"+lang+"/general");
|
||||
const { byebyeMessage } = require("../../lang/"+lang+"/user");
|
||||
|
||||
const divResponse = document.getElementById("response");
|
||||
|
69
front/src/deleteValidation.js
Normal file
@ -0,0 +1,69 @@
|
||||
// -- GESTION DE LA PAGE PERMETTANT DE VALIDER LA DEMANDE DE SUPPRESSION DE SON COMPTE
|
||||
|
||||
/// Un token est transmis en paramètre de l'Url. Il a une validité limitée dans le temps.
|
||||
/// Si le token est ok, on valide la suppression, supprime la session de l'utilisateur et affiche un message de confirmation.
|
||||
|
||||
// Fichier de configuration côté client :
|
||||
import { apiUrl, availableLangs, theme } from "../../config/instance.js";
|
||||
const lang=availableLangs[0];
|
||||
const { accountPage } = require("../../views/"+theme+"/config/"+lang+".js");
|
||||
const { checkDeleteLinkRoute, userRoutes } = require("../../config/users");
|
||||
|
||||
// Importation des fonctions utile au script :
|
||||
import { getLocaly, removeLocaly, saveLocaly } from "./tools/clientstorage.js";
|
||||
import { addElement } from "./tools/dom.js";
|
||||
import { helloDev } from "./tools/everywhere.js";
|
||||
import { loadMatomo } from "./tools/matomo.js";
|
||||
import { getUrlParams } from "./tools/url.js";
|
||||
import { checkSession, setSession } from "./tools/users.js";
|
||||
|
||||
// Dictionnaires :
|
||||
const { serverError } = require("../../lang/"+lang+"/general");
|
||||
const { badLinkValidationMessage } = require("../../lang/"+lang+"/user");
|
||||
|
||||
const divResponse = document.getElementById("response");
|
||||
|
||||
helloDev();
|
||||
|
||||
const initialise = async () =>
|
||||
{
|
||||
try
|
||||
{
|
||||
const datas=getUrlParams();
|
||||
if(datas && datas.t!==undefined)
|
||||
{
|
||||
const xhr = new XMLHttpRequest();
|
||||
xhr.open("GET", apiUrl+userRoutes+checkDeleteLinkRoute+datas.t);
|
||||
xhr.onreadystatechange = function()
|
||||
{
|
||||
if (this.readyState == XMLHttpRequest.DONE)
|
||||
{
|
||||
let response=JSON.parse(this.responseText);
|
||||
if (this.status === 200 && response.message != undefined)
|
||||
{
|
||||
addElement(divResponse, "p", response.message, "", ["success"]);
|
||||
removeLocaly("user");
|
||||
}
|
||||
else if (this.status === 400 && response.errors != undefined)
|
||||
{
|
||||
if(Array.isArray(response.errors))
|
||||
response.errors = response.errors.join("<br>");
|
||||
else
|
||||
response.errors = serverError;
|
||||
addElement(divResponse, "p", response.errors, "", ["error"]);
|
||||
}
|
||||
else
|
||||
addElement(divResponse, "p", badLinkValidationMessage.replace("#URL", accountPage), "", ["error"]);
|
||||
}
|
||||
}
|
||||
xhr.setRequestHeader("Authorization", "Bearer "+datas.t);
|
||||
xhr.send();
|
||||
}
|
||||
}
|
||||
catch(e)
|
||||
{
|
||||
addElement(divResponse, "p", serverError, "", ["error"]);
|
||||
console.error(e);
|
||||
}
|
||||
}
|
||||
initialise();
|
138
front/src/groupElement.js
Normal file
@ -0,0 +1,138 @@
|
||||
// -- PAGE AFFICHANT L'ÉLÉMENT D'UN GROUPE DE QUIZ ET PROPOSANT DE CRÉER SON COMPTE DE MANIÈRE SIMPLIFIÉE
|
||||
|
||||
/// L'utilisateur peut avoir répondu à un quiz avant de lancer la création de son compte
|
||||
/// Dans ce cas il faut enregistrer son résultat en même temps que les informations de son compte
|
||||
|
||||
// Fichier de configuration tirés du backend :
|
||||
import { apiUrl, availableLangs, theme } from "../../config/instance.js";
|
||||
const lang=availableLangs[0];
|
||||
const configTemplate = require("../../views/"+theme+"/config/"+lang+".js");// besoin de toutes les déclarations, car appel dynamique : configTemplate[homePage]
|
||||
const configUsers = require("../../config/users");// idem pour configurer formulaire
|
||||
|
||||
// Importation des fonctions utiles au script :
|
||||
import { getLocaly, removeLocaly } from "./tools/clientstorage.js";
|
||||
import { addElement } from "./tools/dom.js";
|
||||
import { helloDev, updateAccountLink } from "./tools/everywhere.js";
|
||||
import { getDatasFromInputs, setAttributesToInputs } from "./tools/forms.js";
|
||||
import { loadMatomo } from "./tools/matomo.js";
|
||||
import { checkAnswerDatas, checkSession, getTimeDifference } from "./tools/users.js";
|
||||
|
||||
// Dictionnaires :
|
||||
const { serverError } = require("../../lang/"+lang+"/general");
|
||||
const { needUniqueEmail } = require("../../lang/"+lang+"/user");
|
||||
|
||||
// Principaux éléments du DOM manipulés :
|
||||
const btnSubmit=document.getElementById("submitDatas");
|
||||
const divResponse=document.getElementById("response");
|
||||
// const emailInput=document.getElementById("email");
|
||||
// const myForm=document.getElementById("subscription");
|
||||
|
||||
// Test de connexion de l'utilisateur + affichage formulaire d'inscription :
|
||||
const initialise = async () =>
|
||||
{
|
||||
try
|
||||
{
|
||||
/*
|
||||
let isConnected=await checkSession(), user;
|
||||
if(isConnected)
|
||||
{
|
||||
user=getLocaly("user", true);
|
||||
updateAccountLink(user.status, configTemplate);// lien vers le compte adapté pour les utilisateurs connectés
|
||||
}
|
||||
else
|
||||
{ */
|
||||
loadMatomo();
|
||||
//setAttributesToInputs(configUsers, myForm);
|
||||
//myForm.style.display="block";
|
||||
//}
|
||||
}
|
||||
catch(e)
|
||||
{
|
||||
addElement(divResponse, "p", serverError, "", ["error"]);
|
||||
console.error(e);
|
||||
}
|
||||
}
|
||||
initialise();
|
||||
helloDev();
|
||||
|
||||
/*
|
||||
// Test si l'e-mail saisi est déjà utilisé par un autre compte.
|
||||
// Si c'est le cas, la validation du formulaire est bloquée.
|
||||
emailInput.addEventListener("focus", function(e)
|
||||
{
|
||||
document.getElementById("emailMessage").innerHTML="";// pour supprimer l'éventuel message d'erreur déjà affiché
|
||||
});
|
||||
emailInput.addEventListener("blur", function(e)
|
||||
{
|
||||
const emailValue=emailInput.value.trim();
|
||||
if(emailValue!=="")
|
||||
{
|
||||
const xhr = new XMLHttpRequest();
|
||||
xhr.open("POST", apiUrl+configUsers.userRoutes+configUsers.checkIfIsEmailfreeRoute);
|
||||
xhr.onreadystatechange = function()
|
||||
{
|
||||
if (this.readyState == XMLHttpRequest.DONE)
|
||||
{
|
||||
let response=JSON.parse(this.responseText);
|
||||
if (this.status === 200 && response.free !== undefined && response.free === false)
|
||||
{
|
||||
addElement(document.getElementById("emailMessage"), "div", needUniqueEmail.replace("#URL", configTemplate.connectionPage), "", ["error"]);
|
||||
btnSubmit.setAttribute("disabled", true);
|
||||
}
|
||||
else
|
||||
btnSubmit.removeAttribute("disabled");
|
||||
}
|
||||
}
|
||||
xhr.setRequestHeader("Content-Type", "application/json");
|
||||
const datas={ emailTest:emailValue };
|
||||
xhr.send(JSON.stringify(datas));
|
||||
}
|
||||
})
|
||||
|
||||
// Traitement de l'envoi des données d'inscription :
|
||||
myForm.addEventListener("submit", function(e)
|
||||
{
|
||||
try
|
||||
{
|
||||
e.preventDefault();
|
||||
const xhr = new XMLHttpRequest();
|
||||
xhr.open("POST", apiUrl+configUsers.userRoutes+configUsers.subscribeRoute);
|
||||
xhr.onreadystatechange = function()
|
||||
{
|
||||
if (this.readyState == XMLHttpRequest.DONE)
|
||||
{
|
||||
let response=JSON.parse(this.responseText);
|
||||
if (this.status === 201)
|
||||
{
|
||||
myForm.style.display="none";
|
||||
addElement(divResponse, "p", response.message, "", ["success"]);
|
||||
removeLocaly("lastAnswer");// !! important, pour ne pas enregister plusieurs fois le résultat.
|
||||
}
|
||||
else if (response.errors)
|
||||
{
|
||||
if(Array.isArray(response.errors))
|
||||
response.errors = response.errors.join("<br>");
|
||||
else
|
||||
response.errors = serverError;
|
||||
addElement(divResponse, "p", response.errors, "", ["error"]);
|
||||
}
|
||||
else
|
||||
addElement(divResponse, "p", serverError, "", ["error"]);
|
||||
}
|
||||
}
|
||||
xhr.setRequestHeader("Content-Type", "application/json");
|
||||
let datas=getDatasFromInputs(myForm);
|
||||
if(datas)
|
||||
{
|
||||
datas.timeDifference=getTimeDifference(configUsers);
|
||||
// Si l'utilisateur a précédement répondu à un quiz, on ajoute les données de son résultat :
|
||||
datas=checkAnswerDatas(datas);
|
||||
xhr.send(JSON.stringify(datas));
|
||||
}
|
||||
}
|
||||
catch(e)
|
||||
{
|
||||
addElement(divResponse, "p", serverError, "", ["error"]);
|
||||
console.error(e);
|
||||
}
|
||||
});;*/
|
@ -9,24 +9,24 @@
|
||||
/// Temporairement, c'est ici aussi que l'on peut régénérer tout le HTML -> à terme dans homeAdmin !
|
||||
|
||||
// Fichier de configuration côté client :
|
||||
import { apiUrl, availableLangs, theme } from "../../../config/instance.js";
|
||||
import { apiUrl, availableLangs, theme } from "../../config/instance.js";
|
||||
const lang=availableLangs[0];
|
||||
|
||||
import { getAdminStats, userRoutes } from "../../../config/users.js";
|
||||
import { getListNextQuestionnaires, questionnaireRoutes, regenerateHTML } from "../../../config/questionnaires.js";
|
||||
const configTemplate = require("../../../views/"+theme+"/config/"+lang+".js");
|
||||
import { getAdminStats, userRoutes } from "../../config/users.js";
|
||||
import { getListNextQuestionnaires, questionnaireRoutes, regenerateHTML } from "../../config/questionnaires.js";
|
||||
const configTemplate = require("../../views/"+theme+"/config/"+lang+".js");
|
||||
|
||||
// Fonctions utiles au script :
|
||||
import { getLocaly, removeLocaly } from "./tools/clientstorage.js";
|
||||
import { addElement } from "./tools/dom.js";
|
||||
import { helloDev } from "./tools/everywhere.js";
|
||||
import { dateFormat, isEmpty, replaceAll } from "../../../tools/main";
|
||||
import { helloDev, updateAccountLink } from "./tools/everywhere.js";
|
||||
import { dateFormat, isEmpty, replaceAll } from "../../tools/main";
|
||||
import { checkSession } from "./tools/users.js";
|
||||
|
||||
// Dictionnaires :
|
||||
const { notAllowed, serverError, statsAdmin } = require("../../../lang/"+lang+"/general");
|
||||
const { nextDateWithoutQuestionnaire, nextQuestionnairesList, questionnaireNeedBeCompleted } = require("../../../lang/"+lang+"/questionnaire");
|
||||
const { welcomeMessage } = require("../../../lang/"+lang+"/user");
|
||||
const { notAllowed, serverError, statsAdmin } = require("../../lang/"+lang+"/general");
|
||||
const { nextDateWithoutQuestionnaire, nextQuestionnairesList, questionnaireNeedBeCompleted } = require("../../lang/"+lang+"/questionnaire");
|
||||
const { welcomeMessage } = require("../../lang/"+lang+"/user");
|
||||
|
||||
// Principaux éléments du DOM manipulés :
|
||||
const divMain = document.getElementById("main-content");
|
||||
@ -45,6 +45,7 @@ const initialise = async () =>
|
||||
if(isConnected)
|
||||
{
|
||||
const user=getLocaly("user", true);
|
||||
updateAccountLink(user.status, configTemplate);
|
||||
addElement(divMessage, "h2", welcomeMessage.replace("#NAME", user.name));
|
||||
divMain.style.display="block";
|
||||
if(!isEmpty(getLocaly("message")))
|
||||
@ -142,4 +143,4 @@ const initialise = async () =>
|
||||
console.error(e);
|
||||
}
|
||||
}
|
||||
initialise();
|
||||
initialise();
|
237
front/src/homeUser.js
Normal file
@ -0,0 +1,237 @@
|
||||
// -- PAGE D'ACCUEIL DE L'UTILISATEUR
|
||||
|
||||
/// Vérifier que l'utilisateur est bien connecté, a le bon statut et le rediriger vers le formulaire d'inscription si ce n'est pas le cas.
|
||||
/// Si c'est ok, on récupère ses infos et stats + les derniers quizs auxquels il a accès, mais n'a pas répondu.
|
||||
/// Un moteur de recherche permet d'obtenir d'autres quizs parmi ceux publiés.
|
||||
/// Pour l'affichage des listings de quiz, l'API retourne directement du html.
|
||||
/// Un menu permet à l'utilisateur d'accéder à la modification de ses infos, de son abonnement, etc.
|
||||
/// Un message venant d'une autre page peut aussi être à afficher lors du premier chargement.
|
||||
|
||||
// Fichier de configuration côté client :
|
||||
import { apiUrl, availableLangs, theme } from "../../config/instance.js";
|
||||
const lang=availableLangs[0];
|
||||
const configTemplate = require("../../views/"+theme+"/config/"+lang+".js");
|
||||
const { getRandomQuestionnairesRoute, getStatsAnswers, questionnaireRoutes, searchQuestionnaires, searchQuestionnairesRoute } = require("../../config/questionnaires");
|
||||
const { getUsersQuestionnairesRoute, userRoutes } = require("../../config/users");
|
||||
|
||||
// Fonctions utiles au script :
|
||||
import { getLocaly, removeLocaly, saveLocaly } from "./tools/clientstorage.js";
|
||||
import { addElement } from "./tools/dom.js";
|
||||
import { helloDev, updateAccountLink } from "./tools/everywhere.js";
|
||||
import { getDatasFromInputs, setAttributesToInputs } from "./tools/forms.js";
|
||||
import { isEmpty, replaceAll } from "../../tools/main";
|
||||
import { checkSession } from "./tools/users.js";
|
||||
|
||||
// Dictionnaires :
|
||||
const { statsUser } = require("../../lang/"+lang+"/answer");
|
||||
const { nextPage, previousPage, serverError } = require("../../lang/"+lang+"/general");
|
||||
const { searchQuestionnaireWithResult, searchQuestionnaireWithNoResult } = require("../../lang/"+lang+"/questionnaire");
|
||||
const { lastQuestionnairesForUser, noQuestionnaireAccess } = require("../../lang/"+lang+"/questionnaireaccess");
|
||||
const { needBeConnected, welcomeMessage } = require("../../lang/"+lang+"/user");
|
||||
|
||||
// Principaux éléments du DOM manipulés :
|
||||
const divMain= document.getElementById("main-content");
|
||||
const divCrash= document.getElementById("crash");
|
||||
const divMessage = document.getElementById("message");
|
||||
const quizIntro = document.getElementById("quizsIntro");
|
||||
const quizListing = document.getElementById("quizsList");
|
||||
const quizPaginationPrevious = document.getElementById("previous");
|
||||
const quizPaginationNext = document.getElementById("next");
|
||||
const formSearch = document.getElementById("search");
|
||||
const inputBegin = document.getElementById("begin");
|
||||
const btnRandom = document.getElementById("random");
|
||||
|
||||
helloDev();
|
||||
|
||||
const initialise = async () =>
|
||||
{
|
||||
try
|
||||
{
|
||||
// Si l'utilisateur n'est pas connecté, pas la peine d'aller + loin :
|
||||
const isConnected=await checkSession(["user"], "/"+configTemplate.connectionPage, { message: needBeConnected, color:"error" }, window.location);
|
||||
if(isConnected)
|
||||
{
|
||||
const user=getLocaly("user", true);
|
||||
updateAccountLink(user.status, configTemplate);
|
||||
addElement(divMessage, "h1", welcomeMessage.replace("#NAME", user.name));
|
||||
divMain.style.display="block";
|
||||
if(!isEmpty(getLocaly("message")))
|
||||
{
|
||||
addElement(divMessage, "p", getLocaly("message", true).message, "", [getLocaly("message", true).color], "", false);
|
||||
removeLocaly("message");
|
||||
}
|
||||
// Initialisation du formulaire de recherche :
|
||||
setAttributesToInputs({ "searchQuestionnaires": searchQuestionnaires }, formSearch);
|
||||
// Les stats :
|
||||
const xhrStats = new XMLHttpRequest();
|
||||
xhrStats.open("GET", apiUrl+questionnaireRoutes+getStatsAnswers+user.id);
|
||||
xhrStats.onreadystatechange = function()
|
||||
{
|
||||
if (this.readyState == XMLHttpRequest.DONE)
|
||||
{
|
||||
let response=JSON.parse(this.responseText);
|
||||
if (this.status === 200 && !isEmpty(response.nbAnswers) && response.nbAnswers!==0)// pas de stats si aucune réponse !
|
||||
{
|
||||
let txtIntro="";
|
||||
const mapText =
|
||||
{
|
||||
NBANSWERS : response.nbAnswers,
|
||||
NBQUESTIONNAIRES : response.nbQuestionnaires,
|
||||
NBTOTQUESTIONNAIRES : response.groups.nbPublished+response.questionnaires.nbWithoutGroupPublished,
|
||||
AVGDURATION : response.avgDuration,
|
||||
AVGCORRECTANSWERS : response.avgCorrectAnswers
|
||||
};
|
||||
// La situation est plurielle...
|
||||
txtIntro=replaceAll(statsUser, mapText);
|
||||
txtIntro=(response.nbAnswers > 1) ? txtIntro.replace("S1", "s") : txtIntro.replace("S1", "");
|
||||
txtIntro=(response.nbQuestionnaires > 1) ? txtIntro.replace("S2", "s").replace("S3", "s") : txtIntro.replace("S2", "").replace("S3", "s");
|
||||
txtIntro=(mapText.NBTOTQUESTIONNAIRES > 1) ? txtIntro.replace("S4", "s") : txtIntro.replace("S4", "");
|
||||
addElement(divMessage, "p", txtIntro, "", "", "", false);
|
||||
}
|
||||
}
|
||||
}
|
||||
xhrStats.setRequestHeader("Authorization", "Bearer "+user.token);
|
||||
xhrStats.send();
|
||||
|
||||
// Par défaut, on affiche des derniers éléments supposés lus par l'utilisateur :
|
||||
const xhrLastQuizs = new XMLHttpRequest();
|
||||
xhrLastQuizs.open("GET", apiUrl+userRoutes+getUsersQuestionnairesRoute+""+user.id+"/"+0+"/"+configTemplate.nbQuestionnairesUserHomePage+"/html");
|
||||
xhrLastQuizs.onreadystatechange = function()
|
||||
{
|
||||
if (this.readyState == XMLHttpRequest.DONE)
|
||||
{
|
||||
let response=JSON.parse(this.responseText);
|
||||
if (this.status === 200)
|
||||
{
|
||||
if(response.nbTot === 0)
|
||||
addElement(quizIntro, "p", noQuestionnaireAccess, "", ["info"]);
|
||||
else if(response.html)
|
||||
{
|
||||
addElement(quizIntro, "p", lastQuestionnairesForUser, "", ["info"]);
|
||||
quizListing.innerHTML=response.html;
|
||||
}
|
||||
else
|
||||
addElement(quizs, "p", serverError, "", ["error"]);// revoir si intérêt d'afficher quelque chose
|
||||
}
|
||||
else
|
||||
addElement(quizs, "p", serverError, "", ["error"]); // idem
|
||||
}
|
||||
}
|
||||
xhrLastQuizs.setRequestHeader("Authorization", "Bearer "+user.token);
|
||||
xhrLastQuizs.send();
|
||||
|
||||
// Traitement du lancement d'une recherche
|
||||
// La recherche peut être lancée via la bouton submit ou un lien de pagination
|
||||
const sendSearch = (type="search") =>
|
||||
{
|
||||
quizListing.innerHTML=""+"";
|
||||
let datas=getDatasFromInputs(formSearch);
|
||||
const xhrSearch = new XMLHttpRequest();
|
||||
if(type=="search")
|
||||
xhrSearch.open("POST", apiUrl+questionnaireRoutes+searchQuestionnairesRoute);
|
||||
else if(type=="random")
|
||||
xhrSearch.open("POST", apiUrl+questionnaireRoutes+getRandomQuestionnairesRoute);
|
||||
xhrSearch.onreadystatechange = function()
|
||||
{
|
||||
if (this.readyState == XMLHttpRequest.DONE)
|
||||
{
|
||||
let response=JSON.parse(this.responseText);
|
||||
if (this.status === 200 && !isEmpty(response.nbTot))
|
||||
{
|
||||
if(response.nbTot===0)
|
||||
{
|
||||
addElement(quizIntro, "p", searchQuestionnaireWithNoResult, "", ["info"]);
|
||||
window.location.hash="";// sinon les hash s'enchaînent...
|
||||
window.location.assign("#quizsIntro");
|
||||
}
|
||||
else if(response.html)
|
||||
{
|
||||
let txtIntro=searchQuestionnaireWithResult.replace("#NB", response.nbTot);
|
||||
txtIntro=(response.nbTot > 1) ? txtIntro.replace("#S","s") : txtIntro.replace("#S","");
|
||||
addElement(quizIntro, "p", txtIntro , "", ["success"]);
|
||||
quizListing.innerHTML=response.html;
|
||||
window.location.hash="";
|
||||
window.location.assign("#quizsIntro");
|
||||
// Pagination nécessaire ?
|
||||
// on commence par vider...
|
||||
quizPaginationPrevious.innerHTML="";
|
||||
quizPaginationNext.innerHTML="";
|
||||
if(response.begin != 0)// peut retourner "0" et non 0 !
|
||||
{
|
||||
addElement(quizPaginationPrevious, "a", "<< "+previousPage , "previousRes", ["button"], { href: "#search" }); // revoir, les "<<" pourraient être gérées par le CSS
|
||||
const previousPageElt=document.getElementById("previousRes");
|
||||
// le retour à la page précédente peut se faire en cliquant sur le bouton ou via l'historique du navigateur
|
||||
const goBackRes = () =>
|
||||
{
|
||||
let newBegin=response.begin-configTemplate.nbQuestionnairesUserHomePage;
|
||||
if(newBegin<0) // ne devrait pas être possible..
|
||||
newBegin=0;
|
||||
document.getElementById("begin").value=newBegin;
|
||||
sendSearch();
|
||||
window.location.hash="";
|
||||
window.location.assign("#quizsIntro");// pour remonter
|
||||
}
|
||||
previousPageElt.addEventListener("click", function(e)
|
||||
{
|
||||
e.preventDefault();
|
||||
goBackRes();
|
||||
});
|
||||
/* semble provoqué bug ???
|
||||
window.onpopstate = function(e)
|
||||
{
|
||||
e.preventDefault();
|
||||
goBackRes();
|
||||
};*/
|
||||
}
|
||||
if(response.end < (response.nbTot-1))// -1, car tableau commence à 0 !
|
||||
{
|
||||
addElement(quizPaginationNext, "a", nextPage+ " >>", "nextRes", ["button"], { href: "#search" }, false);
|
||||
const nextPageElt=document.getElementById("nextRes");
|
||||
nextPageElt.addEventListener("click", function(e)
|
||||
{
|
||||
e.preventDefault();
|
||||
document.getElementById("begin").value=response.end+1;
|
||||
sendSearch();
|
||||
window.location.hash="";// sinon les hash s'enchaînent...
|
||||
window.location.assign("#quizsIntro"); // pour remonter
|
||||
});
|
||||
}
|
||||
}
|
||||
else
|
||||
addElement(quizs, "p", serverError, "", ["error"]);
|
||||
}
|
||||
else
|
||||
addElement(quizs, "p", serverError, "", ["error"]);
|
||||
}
|
||||
}
|
||||
xhrSearch.setRequestHeader("Content-Type", "application/json");
|
||||
xhrSearch.setRequestHeader("Authorization", "Bearer "+user.token);
|
||||
if(datas)
|
||||
{
|
||||
datas.output="html";
|
||||
xhrSearch.send(JSON.stringify(datas));
|
||||
}
|
||||
}
|
||||
|
||||
btnRandom.addEventListener("click", function(e)
|
||||
{
|
||||
e.preventDefault();
|
||||
document.getElementById("begin").value=0;
|
||||
sendSearch("random");
|
||||
});
|
||||
|
||||
formSearch.addEventListener("submit", function(e)
|
||||
{
|
||||
e.preventDefault();
|
||||
document.getElementById("begin").value=0;
|
||||
sendSearch();
|
||||
});
|
||||
}
|
||||
}
|
||||
catch(e)
|
||||
{
|
||||
console.error(e);
|
||||
addElement(divCrash, "p", serverError, "", ["error"]);
|
||||
}
|
||||
}
|
||||
initialise();
|
36
front/src/index.js
Normal file
@ -0,0 +1,36 @@
|
||||
// -- SCRIPT DE BASE APPELÉ DANS LES PAGES TYPE ACCUEIL DU SITE
|
||||
|
||||
// Fichier de configuration tirés du backend :
|
||||
import { availableLangs, theme } from "../../config/instance.js";
|
||||
const lang=availableLangs[0];
|
||||
|
||||
const configTemplate = require("../../views/"+theme+"/config/"+lang+".js");
|
||||
|
||||
import { getLocaly } from "./tools/clientstorage.js";
|
||||
import { helloDev, updateAccountLink } from "./tools/everywhere.js";
|
||||
import { loadMatomo } from "./tools/matomo.js";
|
||||
import { checkSession } from "./tools/users.js";
|
||||
|
||||
helloDev();
|
||||
|
||||
// Test de connexion de l'utilisateur pour adapter le lien du menu...
|
||||
const initialise = async () =>
|
||||
{
|
||||
try
|
||||
{
|
||||
/* const isConnected=await checkSession();
|
||||
if(isConnected)
|
||||
{
|
||||
// on change le lien d'accès au compte
|
||||
const user=getLocaly("user", true);
|
||||
updateAccountLink(user.status, configTemplate);
|
||||
}
|
||||
else*/
|
||||
loadMatomo();
|
||||
}
|
||||
catch(e)
|
||||
{
|
||||
console.error(e);
|
||||
}
|
||||
}
|
||||
initialise();
|