From 734b2e1f111286d332ef0799b7d2c99d5b7a6bd6 Mon Sep 17 00:00:00 2001 From: Andreas Fitzek Date: Tue, 19 Aug 2014 10:40:24 +0200 Subject: show Version in example --- simpleSigning/src/main/resources/js/pdfas.js | 35 ++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) (limited to 'simpleSigning/src/main/resources/js') 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}; }; -- cgit v1.2.3