Update all conversation messages screen

This commit is contained in:
Pierre HUBERT 2021-03-08 17:16:29 +01:00
parent 349b66939c
commit 30353c5277
3 changed files with 29 additions and 11 deletions

View File

@ -178,8 +178,8 @@
<tr>
<th>Number</th>
<th>Date</th>
<th>File (if any)</th>
<th>Message</th>
<th>Image</th>
</tr>
</thead>

View File

@ -17,22 +17,39 @@ function ApplyAllConversationMessages(){
appendTo: target,
type: "tr",
innerHTML:
"<td>" + message.ID + "</td>" +
"<td>" + timeToStr(message.time_insert) + "</td>" +
"<td>" + message.message + "</td>"
"<td>" + message.id + "</td>" +
"<td>" + timeToStr(message.time_sent) + "</td>" +
"<td class='file-cell'></td>"
});
//Add conversation image (if any)
if(message.image_path != null){
let imageElem = createElem2({
appendTo: messageEl,
type: "img",
class: "conversation-img"
});
if(message.file != null){
let cell = messageEl.querySelector(".file-cell");
applyURLToImage(imageElem, message.image_path);
if (message.file.type.startsWith("image/")) {
let imageElem = createElem2({
appendTo: cell,
type: "img",
class: "conversation-img"
});
applyURLToImage(imageElem, message.file.url);
}
else {
let link = createElem2({
appendTo: cell,
type: "a",
href: getFilePathFromURL(message.file.url),
innerHTML: message.file.url
})
link.target = "_blank"
}
}
if (message.message)
messageEl.innerHTML += "<td>" + message.message + "</td>";
});
}

View File

@ -186,6 +186,7 @@ function ApplyConversations(){
});
messageFileContainer.innerHTML =
"Name: " + message.file.name +
"Size: "+ fileSizeToHuman(message.file.size) + "<br />" +
"Type: " + message.file.type + "<br />" +
"URL: <a target='_blank' href='" + getFilePathFromURL(message.file.url) + "'>"+message.file.url+"</a><br />";