This commit is contained in:
thaaoblues 2024-09-13 14:13:42 +02:00
parent bc93ef40ed
commit 99a21e4673
3 changed files with 58 additions and 18 deletions

View file

@ -348,12 +348,11 @@ function generer_chronologie(){
global $conn;
// on va choper les 10 derniers trucs televerses par les gens
$sql = "SELECT * FROM ensembles WHERE valide=1 ORDER BY date_televersement DESC ";
$sql = "SELECT * FROM ensembles WHERE valide=1 ORDER BY date_televersement DESC LIMIT 10";
$res = $conn->execute_query($sql);
$i = 0;
$ensembles = array();
while (($ens = $res->fetch_assoc()) && $i < 10){
while (($ens = $res->fetch_assoc())){
array_push($ensembles,$ens);

View file

@ -144,7 +144,16 @@
height: auto;
margin-bottom: 10px;
border-radius: 7px;
}
.card textarea{
width: 100%;
height: auto;
margin-bottom: 10px;
border-radius: 7px;
}
.card embed{
width: 100%;
height: 50vw;
@ -153,12 +162,14 @@
.card iframe {
width: 100%;
height: 50vw; /* Ajuster la hauteur selon vos besoins */
height: 50vw;
}
.card video {
width: 100%;
height: auto;
}
.card div {
@ -171,7 +182,17 @@
margin-bottom: 10px;
}
.card a{
width: fit-content;
grid-column: auto;
}
.ligne-boutons{
}
.ligne-boutons #lien{
}
/* Styles pour les liens */

View file

@ -54,6 +54,9 @@ async function rechercher(){
titre_ensemble.setAttribute("onclick","document.location.href='ens.php?ensemble_id="+doc.ensemble_id.toString()+"'");
card.appendChild(titre_ensemble);
const buttonsDiv = document.createElement("div");
buttonsDiv.classList.add("ligne-boutons");
// fichiers spéciaux ?
@ -104,22 +107,27 @@ async function rechercher(){
text = xmlhttp.responseText;
textarea.value = text;
card.appendChild(textarea)
break;
default:
const unsupportedLink = document.createElement('a');
unsupportedLink.href = doc.upload_path;
unsupportedLink.classList.add('lien');
unsupportedLink.textContent = 'Type de fichier non supporté.';
unsupportedLink.target = '_blank';
card.appendChild(unsupportedLink);
buttonsDiv.appendChild(unsupportedLink);
break;
}
const ele = document.createElement("a");
ele.innerText = "Voir ce que c'est";
ele.innerText = "Voir tous les pdf de cet ensemble";
ele.href = `ens.php?ensemble_id=${doc.ensemble_id}`;
ele.classList.add("lien")
card.appendChild(ele)
ele.classList.add("lien");
buttonsDiv.appendChild(ele);
card.appendChild(buttonsDiv);
document.getElementById("liste_resultats").appendChild(card);
@ -142,10 +150,15 @@ async function gen_chronologie(){
// vide d'abord les éléments présents dans la liste sur la page
document.getElementById("liste_resultats").innerHTML = "";
// ensuite on ajoute un petit titre à la chronologie
let titre = document.createElement("h1");
titre.innerText = "Documents récemment publiés";
document.getElementById("liste_resultats").appendChild(titre);
if(data.resultats.length > 0){
// ensuite on ajoute un petit titre à la chronologie
let titre = document.createElement("h1");
titre.innerText = "Documents récemment publiés";
document.getElementById("liste_resultats").appendChild(titre);
}else{
}
// et on remplis avec ce que l'api a généré
if(data.status == 1){
@ -163,6 +176,9 @@ async function gen_chronologie(){
titre_ensemble.setAttribute("onclick","document.location.href='ens.php?ensemble_id="+doc.ensemble_id.toString()+"'");
card.appendChild(titre_ensemble);
const buttonsDiv = document.createElement("div");
buttonsDiv.classList.add("ligne-boutons");
// fichiers spéciaux ?
@ -179,7 +195,7 @@ async function gen_chronologie(){
imageLink.classList.add('lien');
imageLink.textContent = 'Voir image';
imageLink.target = '_blank';
card.appendChild(imageLink);
buttonsDiv.appendChild(imageLink);
break;
case 3: // pdf
const embed = document.createElement('embed');
@ -191,7 +207,7 @@ async function gen_chronologie(){
pdfLink.classList.add('lien');
pdfLink.textContent = 'Voir PDF en grand';
pdfLink.target = '_blank';
card.appendChild(pdfLink);
buttonsDiv.appendChild(pdfLink);
break;
case 4: // video
const video = document.createElement('video');
@ -214,22 +230,26 @@ async function gen_chronologie(){
text = xmlhttp.responseText;
textarea.value = text;
card.appendChild(textarea)
break;
default:
const unsupportedLink = document.createElement('a');
unsupportedLink.href = doc.upload_path;
unsupportedLink.classList.add('lien');
unsupportedLink.textContent = 'Type de fichier non supporté.';
unsupportedLink.target = '_blank';
card.appendChild(unsupportedLink);
buttonsDiv.appendChild(unsupportedLink);
break;
}
const ele = document.createElement("a");
ele.innerText = "Voir ce que c'est";
ele.innerText = "Voir tous les pdf de cet ensemble";
ele.href = `ens.php?ensemble_id=${doc.ensemble_id}`;
ele.classList.add("lien")
card.appendChild(ele)
ele.classList.add("lien");
buttonsDiv.appendChild(ele);
card.appendChild(buttonsDiv);
document.getElementById("liste_resultats").appendChild(card);