...
 
Commits (7)
APP_PORT=8080
SECRET_KEY=qwe1234
\ No newline at end of file
node_modules
node_modules
\ No newline at end of file
const router = require('express').Router();
router.post('/temp', function (req, res) {
//requete de ouf qui fait des trucs mais on l'a pas encore
let matiere = 'Informatique';
res.redirect('/selection_annale?matiere='+matiere);
});
module.exports = router;
\ No newline at end of file
......@@ -41,9 +41,7 @@ module.exports = (passport) => {
});
router.get('/logout', (req,res) => {
req.logout();
//requete de ouf qui fait des trucs mais on l'a pas encore
let matiere = 'Informatique';
res.redirect('/selection_annale?matiere='+matiere);
res.redirect('/');
});
return router;
......
{"tables":{"Promo":{"columns":[{"columnid":"promo_id","dbtypeid":"NUMBER UNSIGNED","notnull":true,"identity":{"value":1,"step":1}},{"columnid":"annee","dbtypeid":"STRING"},{"columnid":"specialite","dbtypeid":"STRING"}]},"Role":{"columns":[{"columnid":"role_id","dbtypeid":"NUMBER UNSIGNED","notnull":true,"identity":{"value":1,"step":1}},{"columnid":"nom","dbtypeid":"STRING"}],"dirty":true},"Utilisateur":{"columns":[{"columnid":"user_id","dbtypeid":"NUMBER UNSIGNED","notnull":true,"identity":{"value":1,"step":1}},{"columnid":"username","dbtypeid":"STRING","notnull":true},{"columnid":"password","dbtypeid":"STRING","notnull":true},{"columnid":"firstname","dbtypeid":"STRING"},{"columnid":"lastname","dbtypeid":"STRING"},{"columnid":"email","dbtypeid":"STRING"},{"columnid":"role_id","dbtypeid":"NUMBER UNSIGNED","notnull":true}],"dirty":true},"Matiere":{"columns":[{"columnid":"matiere_id","dbtypeid":"NUMBER UNSIGNED","notnull":true,"identity":{"value":1,"step":1}},{"columnid":"nom","dbtypeid":"STRING"},{"columnid":"user_id","dbtypeid":"NUMBER UNSIGNED","notnull":true},{"columnid":"promo_id","dbtypeid":"NUMBER UNSIGNED","notnull":true}]},"Sujet":{"columns":[{"columnid":"sujet_id","dbtypeid":"NUMBER UNSIGNED","notnull":true,"identity":{"value":1,"step":1}},{"columnid":"nom","dbtypeid":"STRING"},{"columnid":"pdf_sujet","dbtypeid":"STRING"},{"columnid":"pdf_correction","dbtypeid":"STRING"},{"columnid":"verif","dbtypeid":"BOOLEAN"},{"columnid":"date_depot","dbtypeid":"DATE"},{"columnid":"matiere_id","dbtypeid":"NUMBER UNSIGNED","notnull":true}]},"Commentaire":{"columns":[{"columnid":"com_id","dbtypeid":"NUMBER UNSIGNED","notnull":true,"identity":{"value":1,"step":1}},{"columnid":"position","dbtypeid":"NUMBER UNSIGNED"},{"columnid":"message","dbtypeid":"STRING"},{"columnid":"typesujet","dbtypeid":"STRING"},{"columnid":"sujet_id","dbtypeid":"NUMBER UNSIGNED","notnull":true},{"columnid":"user_id","dbtypeid":"NUMBER UNSIGNED","notnull":true}]},"Notification":{"columns":[{"columnid":"notif_id","dbtypeid":"NUMBER UNSIGNED","notnull":true,"identity":{"value":1,"step":1}},{"columnid":"user_id","dbtypeid":"NUMBER UNSIGNED","notnull":true}]},"Suivre":{"columns":[{"columnid":"matiere_id","dbtypeid":"NUMBER UNSIGNED","notnull":true},{"columnid":"user_id","dbtypeid":"NUMBER UNSIGNED","notnull":true}]}},"Promo":[],"Role":[{"id":1,"nom":"Etudiant"},{"id":2,"nom":"Admin"}],"Utilisateur":[{"username":"romain","password":"$2b$10$KMoSK0svIqmvfsR2fnn04ONEztKsnHwOt7.VpEVucPPM8mnv89PXW","firstname":"","lastname":"","email":""},{"username":"romain","password":"$2b$10$Te4rAuQlw.5w/0TY956J5O4LSi3L1Cb6U93ZAGMicJy8xidzgS/Di","firstname":"","lastname":"","email":""},{"username":"romain","password":"$2b$10$maeAQpSmqzfm8QSy7AX4E.IRKJyjQ465/y0p1Yz0yGqJ8yHrdSKHi","firstname":"","lastname":"","email":""},{"username":"romain","password":"$2b$10$hKtLNTYk72kiEQhVuIDHeuC9xFXYWdVEdV2U.s3MZra/bg4oOs3ju","firstname":"","lastname":"","email":""},{"username":"romain","password":"$2b$10$.JVsqxJOo3Vr5Jz50sTN6.038G2.RICvzpbS8F8Dh/B2frTUSAB16","firstname":"","lastname":"","email":""},{"username":"romain","password":"$2b$10$Er/LPepl1HIva/1rMOmRye.DDlkLP5gu8G4x7b7L6JjMyPKWrmdTi","firstname":"","lastname":"","email":""},{"user_id":1,"username":"$2b$10$ASz.kqALa/Hn1GzwtGYodOOQCtgehDiAK9BHMLrZK1apTEJtrzKdi","password":"","firstname":"","lastname":"","email":"etudiant"},{"user_id":2,"username":"bite","password":"$2b$10$UcJMN4YM7RBRTSH1gwMac.kxMbCenRh/KRcjdI0yHnIaNpANTjM/W","firstname":"","lastname":"","email":"","role":"etudiant"},{"user_id":3,"username":"bite","password":"$2b$10$NKX1o7zHC60VcHWzhq/5fuz2mrwPaMLB8iiXx3z0mTrY0kkUBvswC","firstname":"","lastname":"","email":"","role":"etudiant"}],"Matiere":[],"Sujet":[],"Commentaire":[],"Notification":[],"Suivre":[]}
\ No newline at end of file
{"tables":{}}
\ No newline at end of file
......@@ -2,6 +2,8 @@
/* global Mustache, page */
'use strict';
//import { load_table } from "ssf/types";
// Le script principal de notre application single page
// Celui-ci effectue le routing coté client (et d'autres choses)
......@@ -62,6 +64,69 @@ page('/login', async function () {
await renderTemplate(templates('public/templates/login.mustache'), context);
});
page('/accueil', async function () {
await renderTemplate(templates('public/templates/accueil.mustache'), context);
/*let valide = document.querySelector('#form');
valide.addEventListener('click', function () {
//evt.preventDefault();
let specialite = getElementByName("#specialite");
let annee = getElementByName("#annee");
//Faire une requête du style SELECT name FROM promo WHERE promo = <specialite> AND year = <annee>
let promo = 'Informatique'; //Ce que doit renvoyer la requête
page(`/selection_annale`);
return false;
})*/
});
/*window.onload = function(){
document.getElementById("form").onsubmit = function(){
window.location.replace(`http://localhost:8080/selection_annale`);
return false;
}
}*/
/*function matiere() {
}*/
page('/selection_annale', async function () {
await renderTemplate(templates('public/templates/selection_annale.mustache'), context);
//let promo = request.url.split('?')[1];
//requête SQL : SELECT * FROM matiere WHERE promotion=promo;
//requête SQL : SELECT * FROM annales WHERE matiere=mat AND year = promo[1] (l'année quoi)
let list_annale; //le résultat de la dernière requête
let form=document.getElementById('form');
let fieldset=form.children[1];
/*while (fieldset.firstChild.nextSibling){
fieldset.removeChild(fieldset.firstChild.nextSibling);
}*/
let input;
let label;
list_annale.forEach(element => {
input = document.createElement('input');
input.type = "radio";
input.name = "annale";
input.id = input.name = input.innerHTML = `${element.name}`;
label = document.createElement('label');
label.for = label.innerHTML = `${element.name}`;
});
});
page('/annale', async function () {
await renderTemplate(templates('public/templates/annale.mustache'), context);
});
page('/connexion', async function () {
await renderTemplate(templates('public/templates/connexion.mustache'), context);
});
// On démarre le routing
page.start();
......
<img src="/storage/images/logo.png"/>
<!-- image du logo de polytech nantes -->
<h1>Bienvenue sur Polysheet</h1>
<section>
<h3>Vous êtes un étudiant et vous souhaitez accéder à des annales et/ou proposer des corrigés ?</h3>
<form id="form" action="/api/matiere/temp" method="POST">
<fieldset>
<p>1) Choisis d'abord ton année</p>
<input type="radio" id="3A" name="annee" value="3" required>
<label for="3A">3ème année</label>
<input type="radio" id="4A" name="annee" value="4" required>
<label for="4A">4ème année</label>
<input type="radio" id="5A" name="annee" value="5" required>
<label for="5A">5ème année</label>
</fieldset>
<fieldset>
<p>2) Choisis ensuite ta spécialité</p>
<input type="radio" id="INFO" name="specialite" value="INFO" required>
<label for="INFO">Informatique</label>
<input type="radio" id="ETN" name="specialite" value="ETN" required>
<label for="ETN">ETN</label>
<input type="radio" id="MAT" name="specialite" value="MAT" required>
<label for="MAT">Matériaux</label>
<input type="radio" id="TE" name="specialite" value="TE" required>
<label for="TE">TE</label>
</fieldset>
<fieldset>
<label for="valider">3) Valide ici pour aller chercher les annales</label>
<button id="valider">Valider</button>
</fieldset>
</form>
</section>
<a href="http://localhost:8080/connexion/">
<p>Vous êtes un enseignant ?</p>
<p>Cliquez ici</p>
</a>
\ No newline at end of file
<img src="/storage/images/logo.png"/>
<!-- image du logo de polytech nantes -->
<h1>Polysheet</h1>
<section>
<h3><!-- titre du corrigé --></h3>
<article>
<button>Faire un commentaire</button>
<p>Sujet </p>
<embed src="" type='image/pdf'/><!-- prend le fichier pdf contenant l'annale choisie -->
</article>
<article>
<button>Faire un commentaire</button>
<p>Corrigé</p>
<!-- Ou on va avoir un embed qui prend le pdf, ou le pdf est pas trouvé et on fait une chaîne de caractère et un nouveau bouton -->
<button>Masquer le corrigé</button>
</article>
</section>
\ No newline at end of file
<img src="/storage/images/logo.png"/>
<!-- image du logo de polytech nantes -->
<h1>Bienvenue sur Polysheet</h1>
<section>
<h3>Espace de connexion enseignants</h3>
<form>
<p>Vous pouvez vous connecter</p>
<input id="login" placeholder="LOGIN:"/>
<input id="MDP" placeholder="MOT DE PASSE:"/>
<button>Valider</button>
</form>
</section>
<section>
<a href="http://localhost:8080/accueil/">
<p>Vous êtes un étudiant ?</p>
<p>Cliquez ici</p>
</a>
<section>
\ No newline at end of file
<img src="/storage/images/logo.png"/>
<!-- image du logo de polytech nantes -->
\ No newline at end of file
<img src="/storage/images/logo.png"/>
<!-- image du logo de polytech nantes -->
<h1>Polysheet</h1>
<section>
<h3>Tu peux maintenant choisir la matière ainsi que l'annale que tu souhaites</h3>
<form id="form">
<fieldset>
<p>1) Choisis ta matière</p>
<!-- Attention, là c'est statique mais après on importera depuis les données reçues la page précédente -->
<input type="radio" id="IHM" name="matiere" value="IHM">
<label for="IHM">IHM</label>
<input type="radio" id="gestion" name="matiere" value="gestion">
<label for="gestion">Outils de gestion</label>
<input type="radio" id="stats1" name="matiere" value="stats1">
<label for="stats1">Statistique I</label>
<input type="radio" id="stats2" name="matiere" value="stats2">
<label for="stats2">Statistique II</label>
<input type="radio" id="graph" name="matiere" value="graph">
<label for="graph">Théorie des graphes</label>
<input type="radio" id="sys" name="matiere" value="sys">
<label for="sys">Systèmes</label>
<input type="radio" id="reseau" name="matiere" value="reseau">
<label for="reseau">Réseau</label>
<input type="radio" id="WEB" name="matiere" value="WEB">
<label for="WEB">WEB</label>
</fieldset>
<fieldset>
<p>2) Choisis ton annale</p>
</fieldset>
</form>
</section>
\ No newline at end of file
......@@ -4,6 +4,7 @@ require('dotenv').config();
const app = express();
const bodyParser = require('body-parser');
const userRouter = require('./api/users/user.router');
const matiereRouter = require('./api/matiere/matiere.router');
const auth = require('./auth/auth.js');
// on met en place une authentification valide pour toute le site
......@@ -23,9 +24,15 @@ app.use(bodyParser.urlencoded({
app.use(bodyParser.json());
// on redirige ce qui vient de /api/users vers userRouter
app.use('/api/users', userRouter(passport));
app.use('/api/matiere', matiereRouter);
// Pour toutes les autres url (catch all) on renverra l'index.html
// c'est le routeur coté client qui fera alors le routing
app.use(function (req, res) {
res.sendFile('public/index.html', {'root': __dirname});
});
......