diff --git a/webui/src/main/js/search.js b/webui/src/main/js/search.js index 10b93376..a7a40d68 100644 --- a/webui/src/main/js/search.js +++ b/webui/src/main/js/search.js @@ -108,6 +108,17 @@ class ResultBySender { this.comment = comment[0].childNodes[0].nodeValue; this.certificates = xmlNode.getElementsByTagName("Certificates")[0].childNodes[0].nodeValue } + + getCertificatesBlock() { + if (this.certificates == "0") + return "" + var linkText = _t("View {0} Certificates", this.certificates) + var link = "" + + linkText + "" + var id = senderB64 + "_" + this.infoHash + var html = "
" + _t("Name") + " | " + _t("Size") + " | " + _t("Download") + " |
---|---|---|
"; @@ -334,6 +348,7 @@ function updateSender(senderName) { table += ""; } } + table += result.getCertificatesBlock() table += " | "; table += ""; table += result.size; @@ -507,20 +522,20 @@ function browse(host) { xmlhttp.send("action=browse&host="+host) } -function viewCertificatesByFile(senderB64, count) { - var fetch = new CertificateFetch(senderB64, infoHash) +function viewCertificatesByFile(fileSenderB64, count) { + var fetch = new CertificateFetch(fileSenderB64, infoHash) certificateFetches.set(fetch.divId, fetch) var linkSpan = document.getElementById("certificates-link-" + fetch.divId) - var hideLink = "" + _t("Hide Certificates") + "" + var hideLink = "" + _t("Hide Certificates") + "" linkSpan.innerHTML = hideLink var fetchSpan = document.getElementById("certificates-" + fetch.divId) fetchSpan.innerHTML = _t("Fetching Certificates") } -function hideCertificatesByFile(senderB64, count) { - var id = senderB64 + "_" + infoHash +function hideCertificatesByFile(fileSenderB64, count) { + var id = fileSenderB64 + "_" + infoHash certificateFetches.delete(id) // TODO: propagate cancel to core var fetchSpan = document.getElementById("certificates-" + id) @@ -528,7 +543,34 @@ function hideCertificatesByFile(senderB64, count) { var linkSpan = document.getElementById("certificates-link-" + id) var linkText = _t("View {0} Certificates", count) - var showLink = "" + linkText + "" + var showLink = "" + linkText + "" + linkSpan.innerHTML = showLink +} + +function viewCertificatesBySender(fileInfoHash, count) { + var fetch = new CertificateFetch(senderB64, fileInfoHash) + certificateFetches.set(fetch.divId, fetch) + + var linkSpan = document.getElementById("certificates-link-" + fetch.divId) + var hideLink = "" + + _t("Hide Certificates") + "" + linkSpan.innerHTML = hideLink + + var fetchSpan = document.getElementById("certificates-" + fetch.divId) + fetchSpan.innerHTML = _t("Fetching Certificates") +} + +function hideCertificatesBySender(fileInfoHash, count) { + var id = senderB64 + "_" + fileInfoHash + certificateFetches.delete(id) // TODO: propagate cancel to core + + var fetchSpan = document.getElementById("certificates-" + id) + fetchSpan.innerHTML = "" + + var linkSpan = document.getElementById("certificates-link-" + id) + var linkText = _t("View {0} Certificates", count) + var showLink = "" + + linkText + "" linkSpan.innerHTML = showLink } |