Skip to content

Commit

Permalink
v2.4 20200506
Browse files Browse the repository at this point in the history
. Ajout d’une colonne « reserve » dans la base de données, permettant de réserver un poste à l’usage exclusif d’une personne; si le poste est réservé, il ne sera visible qu’à la personne concernée ou aux administrateurs (nécessite un processus d’authentification, comme dans la version UdeM).
. Le code HTML a été déplacé dans un fichier à part (pour répondre à un besoin interne).
  • Loading branch information
arnauddalayer committed Nov 27, 2020
1 parent 7f8def7 commit 43f2168
Show file tree
Hide file tree
Showing 4 changed files with 109 additions and 49 deletions.
14 changes: 8 additions & 6 deletions src/Serveur/INSTALL.sql
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
-- https://www.phpmyadmin.net/
--
-- Hôte : localhost
-- Généré le : mer. 15 avr. 2020 à 01:54
-- Généré le : mer. 06 mai 2020 à 17:38
-- Version du serveur : 5.6.47-log
-- Version de PHP : 7.4.4

Expand Down Expand Up @@ -31,17 +31,19 @@ SET time_zone = "+00:00";
CREATE TABLE `IsThereAnyFreeDesktop` (
`poste` text NOT NULL,
`statut` enum('dispo','oqp','na') NOT NULL DEFAULT 'dispo',
`commentaire` text CHARACTER SET utf8
`reserve` text,
`commentaire` text
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

--
-- Déchargement des données de la table `IsThereAnyFreeDesktop`
--

INSERT INTO `IsThereAnyFreeDesktop` (`poste`, `statut`, `commentaire`) VALUES
('test1', 'dispo', 'Acrobat Pro disponible'),
('test2', 'na', 'Employés seulement'),
('test3', 'oqp', NULL);
INSERT INTO `IsThereAnyFreeDesktop` (`poste`, `statut`, `reserve`, `commentaire`) VALUES
('test1', 'dispo', NULL, 'Acrobat Pro disponible'),
('test2', 'na', NULL, 'Employés seulement'),
('test3', 'oqp', NULL, NULL),
('test4', 'oqp', 'dalayera', 'Poste réservé pour Arnaud d\'Alayer');

--
-- Index pour les tables déchargées
Expand Down
91 changes: 91 additions & 0 deletions src/Serveur/IsThereAnyFreeDesktop.dwt
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
<!DOCTYPE html>
<html lang="fr-ca">
<head>
<meta charset="utf-8">
<title><?php echo $LaboNom; ?></title>
<style type="text/css">
table.udem-table-colored {
margin: 1em 0;
padding: 0;
border: 0;
border-spacing: 1px;
border-collapse: separate;
background: #ffffff;
width: 100%;
max-width: 100%;
}
table.udem-table-colored > tbody > tr.thead > td,
table.udem-table-colored > thead > tr > td,
table.udem-table-colored > tbody > tr.thead > th,
table.udem-table-colored > thead > tr > th {
background: #666666;
color: #ffffff;
border: 0;
text-align: left;
}
table.udem-table-colored > tbody > tr > td,
table.udem-table-colored > tbody > tr > th {
background: #ecebe9;
color: #000000;
border: 0;
text-align: left;
}
table.udem-table-colored > tbody > tr:nth-child(even) > td,
table.udem-table-colored > tbody > tr:nth-child(even) > th {
background: #fbf7f7;
color: #000000;
}
table.udem-table-unbordered {
border-width: 0;
}
table.udem-table-unbordered > thead > tr > th,
table.udem-table-unbordered > tbody > tr > th,
table.udem-table-unbordered > tfoot > tr > th,
table.udem-table-unbordered > thead > tr > td,
table.udem-table-unbordered > tbody > tr > td,
table.udem-table-unbordered > tfoot > tr > td {
border-width: 0;
}


.table > thead > tr > th,
.table > tbody > tr > th,
.table > tfoot > tr > th,
.table > thead > tr > td,
.table > tbody > tr > td,
.table > tfoot > tr > td {
padding: 8px;
line-height: 1.42857143;
vertical-align: top;
border-top: 1px solid #dddddd;
}
</style>
<script>
//Onload sans JQuery
document.addEventListener("DOMContentLoaded", function(event) {

//Ajouter événement onclick sur les liens RDP Windows
var lienWindows = document.getElementsByClassName("rdpwindows");
for (var i=0; i < lienWindows.length; i++) {
lienWindows[i].onclick = function(){
var poste = this.id,
rdpfileContent = "full address:s:" + poste + ".fil.umontreal.ca",
blob = new Blob([rdpfileContent], {type: "application/x-rdp"}),
url = window.URL.createObjectURL(blob);

this.href = url;
this.target = '_blank';

this.download = poste + '.rdp';
}
};

});
</script>
</head>
<body>
<?php
echo $PostesListe;
?>
</body>
</html>
51 changes: 9 additions & 42 deletions src/Serveur/index.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/*
IsThereAnyFreeDesktop
v.2.3 (20200415), Arnaud d’Alayer
v.2.4 (20200506), Arnaud d’Alayer
https://creativecommons.org/licenses/by-nc/4.0/
*/
//require_once('CAS_authent.php');
Expand All @@ -17,8 +17,8 @@

$count=count($retour);
if ($count > 0) {
//$PostesListe.="<table class='table udem-table-colored'>\r\n";
$PostesListe.="<table border='1'>\r\n";
$PostesListe.="<table class='table udem-table-colored'>\r\n";
//$PostesListe.="<table border='1'>\r\n";
//$PostesListe.="<table>\r\n";
$PostesListe.="<tr><th>Poste</th><th>Commentaire</th><th>Statut</th></tr>\r\n";

Expand All @@ -37,8 +37,10 @@
$PosteStatut="<span style='color:orange'>Non déterminé</span>";
break;
}
//Construire ligne tableau
$PostesListe.="<tr><td>".$PosteAdresse."</td><td>".$poste['commentaire']."</td><td>".$PosteStatut."</td></tr>\r\n";
//Construire ligne tableau (si le poste est réservé, ne l'afficher qu'à l'utilisateur concerné ou aux administrateurs)
if ((!$poste['reserve']) or ($poste['reserve'] == $_SESSION['$codeDGTIC']) or $estAdmin) {
$PostesListe.="<tr><td>".$PosteAdresse."</td><td>".$poste['commentaire']."</td><td>".$PosteStatut."</td></tr>\r\n";
}
}
$PostesListe.="</table>\r\n";
}
Expand All @@ -47,40 +49,5 @@
$PostesListe.= "<p>Erreur avec la base de données. Si l'erreur persiste, veuillez <a href=mailto:'".$LaboContact."'>nous contacter.</p>";
}
header('Content-Type: text/html; charset=utf-8');
//include 'D:\inetpub\cours\public_html\Templates\COURS-ressources-services_laboinfovirtuel.dwt';
?>
<!DOCTYPE html>
<html lang="fr-ca">
<head>
<meta charset="utf-8">
<title><?php echo $LaboNom; ?></title>
<script>
//Onload sans JQuery
document.addEventListener("DOMContentLoaded", function(event) {

//Ajouter événement onclick sur les liens RDP Windows
var lienWindows = document.getElementsByClassName("rdpwindows");
for (var i=0; i < lienWindows.length; i++) {
lienWindows[i].onclick = function(){
var poste = this.id,
rdpfileContent = "full address:s:" + poste + ".fil.umontreal.ca",
blob = new Blob([rdpfileContent], {type: "application/x-rdp"}),
url = window.URL.createObjectURL(blob);

this.href = url;
this.target = '_blank';

this.download = poste + '.rdp';
}
};

});
</script>
</head>
<body>
<h1>Statut des postes</h1>
<?php
echo $PostesListe;
?>
</body>
</html>
include 'IsThereAnyFreeDesktop.dwt';
?>
2 changes: 1 addition & 1 deletion src/Serveur/statut.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/*
IsThereAnyFreeDesktop
v.2.3 (20200415), Arnaud d’Alayer
v.2.4 (20200506), Arnaud d’Alayer
https://creativecommons.org/licenses/by-nc/4.0/
*/
require_once('LAB_config.php');
Expand Down

0 comments on commit 43f2168

Please sign in to comment.