diff --git a/webui/src/main/js/search.js b/webui/src/main/js/search.js
index 6e1ecd53..bcd96663 100644
--- a/webui/src/main/js/search.js
+++ b/webui/src/main/js/search.js
@@ -174,7 +174,8 @@ class ResultByFile {
}
class Certificate {
- constructor(xmlNode) {
+ constructor(xmlNode, divId) {
+ this.divId = divId
this.issuer = xmlNode.getElementsByTagName("Issuer")[0].childNodes[0].nodeValue
this.name = xmlNode.getElementsByTagName("Name")[0].childNodes[0].nodeValue
this.comment = null
@@ -186,6 +187,16 @@ class Certificate {
this.imported = xmlNode.getElementsByTagName("Imported")[0].childNodes[0].nodeValue
}
+ getViewCommentBlock() {
+ if (this.comment == null)
+ return ""
+ var linkText = _t("Show Comment")
+ var link = "" + linkText + ""
+ var linkBlock = "
" +
+ ""
+ return linkBlock
+ }
+
getImportLink() {
var linkText = _t("Import")
var link = "" + linkText + ""
@@ -198,9 +209,8 @@ class Certificate {
commentPresent = "true"
var html = ""
- html += "| " + this.issuer + " | "
+ html += "" + this.issuer + this.getViewCommentBlock() + " | "
html += "" + this.name + " | "
- html += "" + commentPresent + " | "
html += "" + this.timestamp + " | "
if (this.imported == "true")
@@ -214,15 +224,19 @@ class Certificate {
}
class CertificateResponse {
- constructor(xmlNode) {
+ constructor(xmlNode, divId) {
this.status = xmlNode.getElementsByTagName("Status")[0].childNodes[0].nodeValue
this.total = xmlNode.getElementsByTagName("Total")[0].childNodes[0].nodeValue
+ this.divId = divId
var certNodes = xmlNode.getElementsByTagName("Certificates")[0].getElementsByTagName("Certificate")
var i
this.certificates = []
+ this.certificatesBy64 = new Map()
for (i = 0; i < certNodes.length; i++) {
- this.certificates.push( new Certificate(certNodes[i]))
+ var certificate = new Certificate(certNodes[i], this.divId)
+ this.certificates.push(certificate)
+ this.certificatesBy64.set(certificate.base64, certificate)
}
}
@@ -234,7 +248,7 @@ class CertificateResponse {
html += " "
html += _t("Certificates") + " " + this.certificates.length + "/" + this.total
- var headers = [_t("Issuer"), _t("Name"), _t("Comment"), _t("Timestamp"), _t("Import")]
+ var headers = [_t("Issuer"), _t("Name"), _t("Timestamp"), _t("Import")]
html += "
"
html += "| " + headers.join(" | ") + " |
"
var i
@@ -252,6 +266,7 @@ class CertificateFetch {
this.senderB64 = senderB64
this.fileInfoHash = fileInfoHash
this.divId = senderB64 + "_" + fileInfoHash
+ this.lastResponse = null
}
updateTable() {
@@ -260,8 +275,8 @@ class CertificateFetch {
var xmlhttp = new XMLHttpRequest()
xmlhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
- var response = new CertificateResponse(this.responseXML)
- block.innerHTML = response.renderTable()
+ this.lastResponse = new CertificateResponse(this.responseXML, this.divId)
+ block.innerHTML = this.lastResponse.renderTable()
}
}
xmlhttp.open("GET", "/MuWire/Certificate?user=" + this.senderB64 + "&infoHash=" + this.fileInfoHash, true)