diff --git a/server_static/assets/css/index.css b/server_static/assets/css/index.css
index 76fa5bb..64b0ccf 100644
--- a/server_static/assets/css/index.css
+++ b/server_static/assets/css/index.css
@@ -6,13 +6,7 @@
src: url('../fonts/Fredoka-Regular.ttf');
}
-@font-face{
- font-family:'FontAwesome';
- src:url('../fonts/fontawesome-webfont.woff2?v=4.7.0') format('woff2'),
- url('../fonts/fontawesome-webfont.svg?v=4.7.0#fontawesomeregular') format('svg');
- font-weight:normal;
- font-style:normal}
-.fa-exclamation-circle:before{content:"\f06a"}
+
/*//////////////////////////////////////////////////////////////////
@@ -273,7 +267,7 @@ a:hover {
background-color: #fff;
border: 1px solid #c80000;
border-radius: 14px;
- padding: 4px 25px 4px 10px;
+ padding: 4px 10px 4px 10px;
top: 50%;
-webkit-transform: translateY(-50%);
-moz-transform: translateY(-50%);
@@ -296,7 +290,6 @@ a:hover {
}
.alert-validate::after {
- content: "\f06a";
font-family: FontAwesome;
display: block;
position: absolute;
diff --git a/server_static/assets/js/accueil.js b/server_static/assets/js/accueil.js
index 6492631..856fb90 100644
--- a/server_static/assets/js/accueil.js
+++ b/server_static/assets/js/accueil.js
@@ -1,3 +1,4 @@
$(document).ready(function(){
$("#li_accueil").addClass("hover");
+
});
\ No newline at end of file
diff --git a/server_static/assets/js/index.js b/server_static/assets/js/index.js
index d60a1d6..379f4d9 100644
--- a/server_static/assets/js/index.js
+++ b/server_static/assets/js/index.js
@@ -4,6 +4,7 @@
if (!window.navigator.onLine){
console.log("offline");
$(".info_message").show();
+ $(".info_message").show();
}
"use strict";
var input = $('.validate-input .input-forms');
@@ -25,7 +26,7 @@
success: function(data, status, jqXHR) {
console.log(data.trim());
if (data.trim() == "true"){
- location.href='/';
+ location.href='/accueil.php';
} else {
$("#zone-login").addClass("shaking_error");
setTimeout(function() {
@@ -79,11 +80,29 @@ $('.hidden').delay(300).fadeIn(400);
if ('serviceWorker' in navigator) {
window.addEventListener('load', () => {
navigator.serviceWorker.register('sw.js')
- .then(registration => {
- console.log(`Service Worker enregistré ! Ressource: ${registration.scope}`);
- })
- .catch(err => {
- console.log(`Echec de l'enregistrement du Service Worker: ${err}`);
- });
+ .then(registration => {console.log(`[SW] enregistré ! ${registration.scope}`);})
+ .catch(err => {console.log(`[SW] Echec de l'enregistrement: ${err}`);});
});
-}
\ No newline at end of file
+}
+
+
+/*
+function getCookie(user) {
+ var cookieArr = document.cookie.split(";");
+ for (var i = 0; i < cookieArr.length; i++) {
+ var cookiePair = cookieArr[i].split("=");
+ if (user == cookiePair[0].trim()) {
+ return decodeURIComponent(cookiePair[1]);
+ }
+ }
+ return null;
+}
+
+function checkCookie() {
+ var username = getCookie("username");
+ var pass = getCookie("pass");
+ if (!(username != "" && username != null && pass != null && pass != null)) {
+ console.log("no cookie");
+ }
+}
+checkCookie();*/
\ No newline at end of file
diff --git a/website/controller/Manage_companies.php b/website/controller/Manage_companies.php
index d40b3f5..21a733f 100644
--- a/website/controller/Manage_companies.php
+++ b/website/controller/Manage_companies.php
@@ -28,6 +28,8 @@ if (isset($_COOKIE['username']) && isset($_COOKIE['pass'])) {
$ID_add_company = $query_add_company->fetchALL(PDO::FETCH_OBJ)[0]->ID_company;
$query_add_company = $bdd->prepare('INSERT INTO companies_located VALUES (:ID_localisation, :ID_company);');
$query_add_company->execute(['ID_localisation' => $_POST["localisation"], 'ID_company' => $ID_add_company]);
+ $query_add_company = $bdd->prepare('INSERT INTO companies_located VALUES (:ID_localisation, :ID_company);');
+ $query_add_company->execute(['ID_localisation' => $_POST["localisation"], 'ID_company' => $ID_add_company]);
echo "";
} catch (Exception $e) {
echo "false";
diff --git a/website/fallback.php b/website/fallback.php
new file mode 100644
index 0000000..ba00e5b
--- /dev/null
+++ b/website/fallback.php
@@ -0,0 +1,35 @@
+
+
+ Offline
+
+
+
+
+
+
+
+
+
+
+
+
+

+
Aucune connexion à internet
+
+
+
Page inaccessible en mode hors ligne.
+
+ Due à un manque de connexion internet, nous ne pouvez pas afficher cette page.
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/website/index.php b/website/index.php
index 4ad752c..0c6f475 100644
--- a/website/index.php
+++ b/website/index.php
@@ -1,15 +1,5 @@
-prepare('SELECT * FROM users NATURAL JOIN roles NATURAL JOIN roles_has_permissions NATURAL JOIN permissions WHERE code_permission="SFx1" AND username=:user AND password_user=:password_user;');
- $query->execute(['user' => $_COOKIE['username'], 'password_user' => $_COOKIE['pass']]);
- if ($query->rowCount() == 1){echo "";}
- else {echo "";}
- }
-} else {
-?>
+
Connexion - CTS
@@ -27,7 +17,11 @@ if (isset($_COOKIE['username']) && isset($_COOKIE['pass'])) {
-
+
@@ -57,6 +51,3 @@ if (isset($_COOKIE['username']) && isset($_COOKIE['pass'])) {
-
\ No newline at end of file
diff --git a/website/sw.js b/website/sw.js
index a244b29..3502a1d 100644
--- a/website/sw.js
+++ b/website/sw.js
@@ -1,59 +1,63 @@
-importScripts(
- 'https://storage.googleapis.com/workbox-cdn/releases/4.3.1/workbox-sw.js'
-);
-if (workbox) {
- console.log(`Super ! Workbox est chargé 🎉`);
-
- workbox.routing.registerRoute(
- /\.(?:html|js|css|png|jpg|jpeg|svg|gif)$/,
- new workbox.strategies.StaleWhileRevalidate()
- );
-}
+const staticCacheName = "site_static_v1";
+const dynamicCacheName = "site_dynamic_v1";
+const assets = [
+ './',
+ './index.php',
+ './fallback.php',
+ './manifest/manifest.json',
+ 'http://ctsstatic.fr/assets/css/index.css',
+ 'http://ctsstatic.fr/assets/css/a_propos.css',
+ 'http://ctsstatic.fr/assets/images/fond_cesi_large.png',
+ 'http://ctsstatic.fr/assets/vendors/fontawesome/css/all.min.css',
+ 'http://ctsstatic.fr/assets/js/index.js',
+ 'http://ctsstatic.fr/assets/js/nav_bar.js',
+ 'http://ctsstatic.fr/assets/css/nav_bar.css',
+ 'http://ctsstatic.fr/assets/images/logo.png',
+ 'http://ctsstatic.fr/assets/images/logo144.png',
+ 'http://ctsstatic.fr/assets/images/logo_petit.png',
+ 'http://ctsstatic.fr/assets/vendors/jquery/jquery-3.6.0.min.js',
+ 'http://ctsstatic.fr/assets/js/sha1.min.js',
+ 'http://ctsstatic.fr/assets/fonts/Fredoka-Regular.ttf',
+];
-//Installation du service worker
-self.addEventListener('install', (e) => {
- console.log('[Service Worker] Installation');
- var cacheName = 'CTS_v2';
- var appShellFiles = [
- 'index.php',
- 'http://ctsstatic.fr/assets/css/index.css',
- 'http://ctsstatic.fr/assets/js/index.js',
- 'http://ctsstatic.fr/assets/images/logo_petit.png',
- 'http://ctsstatic.fr/assets/vendors/jquery/jquery-3.6.0.min.js'
- ];
-
- e.waitUntil(
- caches.open(cacheName).then((cache) => {
- console.log('[Service Worker] Mise en cache globale: app shell et contenu')
- return cache.addAll(appShellFiles);
- }))
+self.addEventListener('install', evt => { //Event à l'installation
+ //console.log("installed");
+ evt.waitUntil( //Ne s'arrete pas tant que le cache n'est complet
+ caches.open(staticCacheName).then(cache => {
+ console.log("Caching assets");
+ cache.addAll(assets);
+ })
+ )
});
-//fetch event afin de répondre quand on est en mode hors ligne.
-self.addEventListener('fetch', (e) => {
- e.respondWith(
- caches.open('ma_sauvegarde').then(function(cache) {
- return cache.match(e.request).then(function (response) {
- return response || fetch(e.request).then(function(response) {
- cache.put(e.request, response.clone());
- return response;
- });
- });
+self.addEventListener('activate', evt => {
+ //console.log("activated");
+ evt.waitUntil(
+ caches.keys().then(keys => {
+ //console.log(keys);
+ return Promise.all(keys
+ .filter(key => key !== staticCacheName && key !== dynamicCacheName)
+ .map(key => caches.delete(key)))
})
);
});
-/*
-self.addEventListener('fetch', (e) => {
- e.respondWith(
- caches.match(e.request).then((r) => {
- console.log('[Service Worker] Récupération de la ressource: '+e.request.url);
- return r || fetch(e.request).then((response) => {
- return caches.open(cacheName).then((cache) => {
- console.log('[Service Worker] Mise en cache de la nouvelle ressource: '+e.request.url);
- cache.put(e.request, response.clone());
- return response;
- });
- });
- })
+
+/*self.addEventListener('fetch', evt => {
+ evt.respondWith(
+ caches.match(evt.request).then(cacheRes => {
+ console.log(evt.request);
+ return cacheRes || fetch(evt.request).then(fetchRes => {
+ return caches.open(dynamicCacheName).then(cache => {
+ if (evt.request.url.indexOf('favoris') > -1){
+ cache.put(evt.request.url, fetchRes.clone());
+ }
+ return fetchRes;
+ })
+ });
+ }).catch(() => {
+ console.log("Erreur d'accès à :", evt.request.url)
+ return caches.match('/fallback.php');
+ })
);
- });*/
\ No newline at end of file
+});
+*/
\ No newline at end of file