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> <tr>
<th>Number</th> <th>Number</th>
<th>Date</th> <th>Date</th>
<th>File (if any)</th>
<th>Message</th> <th>Message</th>
<th>Image</th>
</tr> </tr>
</thead> </thead>

View File

@ -17,22 +17,39 @@ function ApplyAllConversationMessages(){
appendTo: target, appendTo: target,
type: "tr", type: "tr",
innerHTML: innerHTML:
"<td>" + message.ID + "</td>" + "<td>" + message.id + "</td>" +
"<td>" + timeToStr(message.time_insert) + "</td>" + "<td>" + timeToStr(message.time_sent) + "</td>" +
"<td>" + message.message + "</td>" "<td class='file-cell'></td>"
}); });
//Add conversation image (if any) //Add conversation image (if any)
if(message.image_path != null){ if(message.file != null){
let imageElem = createElem2({ let cell = messageEl.querySelector(".file-cell");
appendTo: messageEl,
type: "img",
class: "conversation-img"
});
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 = messageFileContainer.innerHTML =
"Name: " + message.file.name +
"Size: "+ fileSizeToHuman(message.file.size) + "<br />" + "Size: "+ fileSizeToHuman(message.file.size) + "<br />" +
"Type: " + message.file.type + "<br />" + "Type: " + message.file.type + "<br />" +
"URL: <a target='_blank' href='" + getFilePathFromURL(message.file.url) + "'>"+message.file.url+"</a><br />"; "URL: <a target='_blank' href='" + getFilePathFromURL(message.file.url) + "'>"+message.file.url+"</a><br />";