mirror of
https://gitlab.aliens-lyon.fr/savrillo/gpens.git
synced 2026-09-11 21:20:46 +02:00
Add links to search results
This commit is contained in:
+49
-19
@@ -1,15 +1,3 @@
|
||||
function httpGetAsync(theUrl, callback)
|
||||
{
|
||||
var xmlHttp = new XMLHttpRequest();
|
||||
xmlHttp.onreadystatechange = function() {
|
||||
if (xmlHttp.readyState == 4) {
|
||||
callback(xmlHttp.responseText, xmlHttp.status);
|
||||
}
|
||||
}
|
||||
xmlHttp.open("GET", theUrl, true);
|
||||
xmlHttp.send(null);
|
||||
}
|
||||
|
||||
function researchRoom()
|
||||
{
|
||||
var research = document.getElementById('research').value;
|
||||
@@ -26,13 +14,31 @@ function researchRoom()
|
||||
res = JSON.parse(xhr.responseText);
|
||||
|
||||
for (var i=0; i<res.length; i++) {
|
||||
table.innerHTML += '<tr><th scope="row">' + res[i].id + '</th><td>' + res[i].name + '</td></tr>';
|
||||
table.innerHTML += '<tr>\
|
||||
<th scope="row">\
|
||||
<a href="#' + res[i].id + '">' + res[i].name + '</a>\
|
||||
</th>\
|
||||
<td>' + '??' + '</td>\
|
||||
</tr>';
|
||||
}
|
||||
};
|
||||
|
||||
xhr.send(null);
|
||||
}
|
||||
|
||||
// Update the current room based on the current anchor
|
||||
function updateCurrentRoom()
|
||||
{
|
||||
// Hide room research modal
|
||||
var modal = bootstrap.Modal.getInstance(document.getElementById('room-research-modal'));
|
||||
if (modal != null) {
|
||||
modal.hide();
|
||||
}
|
||||
|
||||
var id = window.location.hash;
|
||||
console.log(id);
|
||||
}
|
||||
|
||||
function putWaitNetworkScreen()
|
||||
{
|
||||
outputDiv.innerHTML = "Récupération des informations auprès du serveur...";
|
||||
@@ -45,6 +51,18 @@ function salleInfosToHtml(salle)
|
||||
return titres + ((salle.description!=null)?("\n<br/>\n" + salle.description):"") + ((salle.locataires.length!=0)?("\n<br/>\n<b>Locataires</b>: " + locataires):"");
|
||||
}
|
||||
|
||||
function httpGetAsync(theUrl, callback)
|
||||
{
|
||||
var xmlHttp = new XMLHttpRequest();
|
||||
xmlHttp.onreadystatechange = function() {
|
||||
if (xmlHttp.readyState == 4) {
|
||||
callback(xmlHttp.responseText, xmlHttp.status);
|
||||
}
|
||||
}
|
||||
xmlHttp.open("GET", theUrl, true);
|
||||
xmlHttp.send(null);
|
||||
}
|
||||
|
||||
function initSvgSupport()
|
||||
{
|
||||
var plan = document.getElementById('plan');
|
||||
@@ -93,9 +111,21 @@ function initSvgSupport()
|
||||
}
|
||||
|
||||
|
||||
// Initialisation du svg.
|
||||
var plan = document.getElementById('plan');
|
||||
if(plan.contentDocument==null)
|
||||
plan.addEventListener('load', initSvgSupport);
|
||||
else
|
||||
initSvgSupport();
|
||||
window.addEventListener("DOMContentLoaded", (event) => {
|
||||
// Init SVG
|
||||
var plan = document.getElementById('plan');
|
||||
if (plan.contentDocument == null) {
|
||||
plan.addEventListener('load', initSvgSupport);
|
||||
} else {
|
||||
initSvgSupport();
|
||||
}
|
||||
|
||||
// Update the current room
|
||||
if (window.location.hash != "") {
|
||||
updateCurrentRoom();
|
||||
}
|
||||
|
||||
window.onhashchange = function() {
|
||||
updateCurrentRoom();
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user