aboutsummaryrefslogtreecommitdiff
path: root/simpleSigning/src/main/resources/js/pdfas.js
diff options
context:
space:
mode:
Diffstat (limited to 'simpleSigning/src/main/resources/js/pdfas.js')
-rw-r--r--simpleSigning/src/main/resources/js/pdfas.js35
1 files changed, 35 insertions, 0 deletions
diff --git a/simpleSigning/src/main/resources/js/pdfas.js b/simpleSigning/src/main/resources/js/pdfas.js
index 6ddb7d7..a08d0f4 100644
--- a/simpleSigning/src/main/resources/js/pdfas.js
+++ b/simpleSigning/src/main/resources/js/pdfas.js
@@ -26,6 +26,9 @@ var pdfAsOrigin = "##REPLACE##DOMAIN##";
var pdfAsUrl = "##REPLACE##DOMAIN####REPLACE##CONTEXT##/Start";
+var pdfAsVersionUrl = "##REPLACE##DOMAIN####REPLACE##CONTEXT##/version";
+
+
var pdfAs = {};
/**
@@ -41,6 +44,37 @@ pdfAs.signPdf = function(content, error, success) {
this.createAsyncSignature(content.content, content.connector, content.uiId, pdfAsUrl, "PDF", success, error);
};
+pdfAs.getVersion = function(cb, err) {
+ var xmlhttp;
+
+ if (window.XMLHttpRequest) {
+ // code for IE7+, Firefox, Chrome, Opera, Safari
+ xmlhttp = new XMLHttpRequest();
+ } else {
+ // code for IE6, IE5
+ xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
+ }
+
+ xmlhttp.onreadystatechange = function() {
+ if (xmlhttp.readyState == 4 ) {
+ if(xmlhttp.status == 200){
+ var obj = JSON.parse(xmlhttp.responseText);
+ cb(obj);
+ }
+ else if(xmlhttp.status == 400) {
+ err('There was an error 400')
+ }
+ else {
+ err('something else other than 200 was returned')
+ }
+ }
+ }
+
+ xmlhttp.open("GET", pdfAsVersionUrl, true);
+ xmlhttp.send();
+}
+
+
var postman = new NoJQueryPostMessageMixin('postMessage', 'receiveMessage');
var guid = (function() {
@@ -195,6 +229,7 @@ pdfAs.createAsyncSignature = function(pdfUrl, connector, divID, pdfAsURL, type,
form.submit();
};
+
pdfAs.addCallback = function(eventId, custDiv, error, success) {
pdfAs.cbMap.eventId = {suc: success, err: error, div: custDiv};
};