diff --git a/webui/src/main/js/search.js b/webui/src/main/js/search.js index 5ef8a596..6e1ecd53 100644 --- a/webui/src/main/js/search.js +++ b/webui/src/main/js/search.js @@ -186,6 +186,12 @@ class Certificate { this.imported = xmlNode.getElementsByTagName("Imported")[0].childNodes[0].nodeValue } + getImportLink() { + var linkText = _t("Import") + var link = "" + linkText + "" + return link + } + renderRow() { var commentPresent = "false" if (this.comment != null) @@ -200,7 +206,7 @@ class Certificate { if (this.imported == "true") html += "" + _t("Imported") + "" else - html += "" + _t("Import") + "" + html += "" + this.getImportLink() + "" html += "" return html @@ -681,6 +687,18 @@ function hideCertificatesBySender(fileInfoHash, count) { linkSpan.innerHTML = showLink } +function importCertificate(b64) { + var xmlhttp = new XMLHttpRequest() + xmlhttp.onreadystatechange = function() { + if (this.readyState == 4 && this.status == 200) { + refreshCertificates() + } + } + xmlhttp.open("POST", "/MuWire/Certificate", true) + xmlhttp.setRequestHeader('Content-type', 'application/x-www-form-urlencoded'); + xmlhttp.send("action=import&base64=" + b64) +} + function refreshStatus() { var xmlhttp = new XMLHttpRequest() xmlhttp.onreadystatechange = function() {