Skip to content

Commit

Permalink
v2.3 20200415
Browse files Browse the repository at this point in the history
  • Loading branch information
arnauddalayer committed Nov 27, 2020
1 parent 40982b2 commit 7f8def7
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 45 deletions.
19 changes: 10 additions & 9 deletions src/Serveur/INSTALL.sql
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
-- phpMyAdmin SQL Dump
-- phpMyAdmin SQL Dump
-- version 5.0.1
-- https://www.phpmyadmin.net/
--
-- Hôte : localhost
-- Généré le : mer. 25 mars 2020 à 02:10
-- Généré le : mer. 15 avr. 2020 à 01:54
-- Version du serveur : 5.6.47-log
-- Version de PHP : 7.4.3
-- Version de PHP : 7.4.4

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
Expand All @@ -30,17 +30,18 @@ SET time_zone = "+00:00";

CREATE TABLE `IsThereAnyFreeDesktop` (
`poste` text NOT NULL,
`statut` enum('dispo','oqp','na') NOT NULL DEFAULT 'dispo'
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
`statut` enum('dispo','oqp','na') NOT NULL DEFAULT 'dispo',
`commentaire` text CHARACTER SET utf8
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

INSERT INTO `IsThereAnyFreeDesktop` (`poste`, `statut`) VALUES
('test1', 'dispo'),
('test2', 'na'),
('test3', 'oqp');
INSERT INTO `IsThereAnyFreeDesktop` (`poste`, `statut`, `commentaire`) VALUES
('test1', 'dispo', 'Acrobat Pro disponible'),
('test2', 'na', 'Employés seulement'),
('test3', 'oqp', NULL);

--
-- Index pour les tables déchargées
Expand Down
7 changes: 4 additions & 3 deletions src/Serveur/LAB_config.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
<?php
/*
IsThereAnyFreeDesktop
v.2.2 (20200326), Arnaud d’Alayer
v.2.3 (20200415), Arnaud d’Alayer
https://creativecommons.org/licenses/by-nc/4.0/
*/
//BD MySQL
$pdo_options[PDO::ATTR_ERRMODE] = PDO::ERRMODE_EXCEPTION;
$bdd = new PDO('mysql:host=localhost;dbname=IsThereAnyFreeDesktop', 'login', 'motdepasse', $pdo_options);
$pdo_options = array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8');
$BD = "IsThereAnyFreeDesktop";
$table = "IsThereAnyFreeDesktop";
$bdd = new PDO('mysql:host=localhost;dbname='.$BD, 'login', 'motdepasse', $pdo_options);

//Nom du département, faculté ou du laboratoire
$LaboNom = "votresiteweb - Laboratoire informatique virtuel";
Expand Down
18 changes: 0 additions & 18 deletions src/Serveur/fichierrdp.php

This file was deleted.

52 changes: 38 additions & 14 deletions src/Serveur/index.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/*
IsThereAnyFreeDesktop
v.2.2 (20200326), Arnaud d’Alayer
v.2.3 (20200415), Arnaud d’Alayer
https://creativecommons.org/licenses/by-nc/4.0/
*/
//require_once('CAS_authent.php');
Expand All @@ -17,18 +17,18 @@

$count=count($retour);
if ($count > 0) {
//$PostesListe.="<table class='table udem-table-colored'>";
$PostesListe.="<table border='1'>";
//$PostesListe.="<table>";
$PostesListe.="<tr><th>Poste</th><th>Statut</th></tr>";
//$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";

foreach ($retour as $poste){
//Améliorer le résultat (au besoin ajouter des images, etc.)
$PosteAdresse=strtoupper($poste['poste'].$LabSuffixeAdresse);
$PosteAdresse=strtoupper($poste['poste'].$LaboSuffixeAdresse);
switch ($poste['statut']) {
case "dispo":
$PosteStatut="<span style='color:green'>Disponible</span>";
$PosteStatut.="<br/>Se connecter&nbsp:<a href='fichierrdp.php?poste=".$poste['poste']."'>PC</a> | <a href='rdp://full%20address=s:$PosteAdresse:3389'>Mac</a>";
$PosteStatut.="<br/>Se connecter&nbsp;: <a href='#' id='".$poste['poste']."' class='rdpwindows'>PC</a> | <a href='rdp://full%20address=s:$PosteAdresse:3389'>Mac</a>";
break;
case "oqp":
$PosteStatut="<span style='color:red'>Occupé</span>";
Expand All @@ -38,22 +38,46 @@
break;
}
//Construire ligne tableau
$PostesListe.="<tr><td>".$PosteAdresse."</td><td>".$PosteStatut."</td></tr>";
$PostesListe.="<tr><td>".$PosteAdresse."</td><td>".$poste['commentaire']."</td><td>".$PosteStatut."</td></tr>\r\n";
}
$PostesListe.="</table>";
$PostesListe.="</table>\r\n";
}
}
catch(Exception $e){
$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>
</head>
<body>
<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;
Expand Down
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.2 (20200326), Arnaud d’Alayer
v.2.3 (20200415), Arnaud d’Alayer
https://creativecommons.org/licenses/by-nc/4.0/
*/
require_once('LAB_config.php');
Expand Down

0 comments on commit 7f8def7

Please sign in to comment.